@byteplus/rtc 4.44.3 → 4.45.0

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.44.3
4
+ * version: 4.45.0
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 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,y=Function.prototype,E=y.bind,g=y.call,b=S&&E.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]},W=T({}.isPrototypeOf),X=K("navigator","userAgent")||"",Y=i,J=X,q=Y.process,Q=Y.Deno,Z=q&&q.versions||Q&&Q.version,$=Z&&Z.v8;$&&(v=(_=$.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=W,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)},ye=d,Ee=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,We=ne,Xe=Ge("wks"),Ye=je.Symbol,Je=Ye&&Ye.for,qe=We?Ye:Ye&&Ye.withoutSetter||ze,Qe=function(e){if(!He(Xe,e)||!Ke&&"string"!=typeof Xe[e]){var t="Symbol."+e;Ke&&He(Ye,e)?Xe[e]=Ye[e]:Xe[e]=We&&Je?Je(t):qe(t)}return Xe[e]},Ze=d,$e=j,et=de,tt=Se,rt=function(e,t){var r,i;if("string"===t&&Ee(r=e.toString)&&!ge(i=ye(r,e)))return i;if(Ee(r=e.valueOf)&&!ge(i=ye(r,e)))return i;if("string"!==t&&Ee(r=e.toString)&&!ge(i=ye(r,e)))return i;throw be("Can't convert object to primitive value")},it=Qe,nt=i.TypeError,ot=it("toPrimitive"),at=function(e,t){if(!$e(e)||et(e))return e;var r,i=tt(e,ot);if(i){if(void 0===t&&(t="default"),r=Ze(i,e,t),!$e(r)||et(r))return r;throw nt("Can't convert object to primitive value")}return void 0===t&&(t="number"),rt(e,t)},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,yt=m,Et=V,gt=ut,bt=Ue,Tt=_t,It=Object.getOwnPropertyDescriptor;n.f=vt?It:function(e,t){if(e=Et(e),t=gt(t),Tt)try{return It(e,t)}catch(e){}if(bt(e,t))return yt(!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,Wt=T(Function.toString);zt(Kt.inspectSource)||(Kt.inspectSource=function(e){return Wt(e)});var Xt,Yt,Jt,qt=Kt.inspectSource,Qt=F,Zt=qt,$t=i.WeakMap,er=Qt($t)&&/native code/.test(Zt($t)),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),yr=cr(mr.has),Er=cr(mr.set);Xt=function(e,t){if(yr(mr,e))throw new _r("Object already initialized");return t.facade=e,Er(mr,e,t),t},Yt=function(e){return Sr(mr,e)||{}},Jt=function(e){return yr(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},Yt=function(e){return lr(e,gr)?e[gr]:{}},Jt=function(e){return lr(e,gr)}}var br={set:Xt,get:Yt,has:Jt,enforce:function(e){return Jt(e)?Yt(e):Xt(e,{})},getterFor:function(e){return function(t){var r;if(!ur(t)||(r=Yt(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,Wr=function(e,t){var r=Hr(e);return r<0?zr(r+t,0):Kr(r,t)},Xr=Gr,Yr=Math.min,Jr=function(e){return e>0?Yr(Xr(e),9007199254740991):0},qr=Jr,Qr=function(e){return qr(e.length)},Zr=V,$r=Wr,ei=Qr,ti=function(e){return function(t,r,i){var n,o=Zr(t),a=ei(o),s=$r(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},yi=Ue,Ei=Si,gi=n,bi=Rt,Ti=function(e,t,r){for(var i=Ei(t),n=bi.f,o=gi.f,a=0;a<i.length;a++){var s=i[a];yi(e,s)||r&&yi(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,Wi=Array.isArray||function(e){return"Array"==Ki(e)},Xi={};Xi[Qe("toStringTag")]="z";var Yi="[object z]"===String(Xi),Ji=i,qi=Yi,Qi=F,Zi=C,$i=Qe("toStringTag"),en=Ji.Object,tn="Arguments"==Zi(function(){return arguments}()),rn=qi?Zi: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),$i))?r:tn?Zi(t):"Object"==(i=Zi(t))&&Qi(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,yn=Wi,En=mn,gn=j,bn=Qe("species"),Tn=Sn.Array,In=function(e){var t;return yn(e)&&(t=e.constructor,(En(t)&&(t===Tn||yn(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=Qr,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,y=l||wn,E=t?y(c,m):r||a?y(c,0):void 0;m>S;S++)if((s||S in _)&&(p=v(h=_[S],S,f),e))if(t)E[S]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return S;case 2:Dn(E,h)}else switch(e){case 4:return!1;case 7:Dn(E,h)}return o?-1:i||n?n:E}},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=Yi?{}.toString:function(){return"[object "+Vn(this)+"]"},Bn=Yi,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,Wn=Kn===Object.prototype?void 0:Kn,Xn=i,Yn=Hn,Jn=Wn,qn=xn,Qn=Gt,Zn=function(e){if(e&&e.forEach!==qn)try{Qn(e,"forEach",qn)}catch(t){e.forEach=qn}};for(var $n in Yn)Yn[$n]&&Zn(Xn[$n]&&Xn[$n].prototype);Zn(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,yo=po;uo.f=fo&&!_o?Object.defineProperties:function(e,t){mo(e);for(var r,i=So(t),n=yo(t),o=n.length,a=0;o>a;)vo.f(e,r=n[a++],i[r]);return e};var Eo,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{Eo=new ActiveXObject("htmlfile")}catch(e){}var e,t;Po="undefined"!=typeof document?document.domain&&Eo?Do(Eo):((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(Eo);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=Qe("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=Qe("match"),zo=function(e){var t;return jo(e)&&(void 0!==(t=e[Ho])?!!t:"RegExp"==Go(e))},Ko=zo,Wo=i.TypeError,Xo=function(e){if(Ko(e))throw Wo("The method doesn't accept regular expressions");return e},Yo=rn,Jo=i.String,qo=function(e){if("Symbol"===Yo(e))throw TypeError("Cannot convert a Symbol value to a string");return Jo(e)},Qo=Qe("match"),Zo=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Qo]=!1,"/./"[e](t)}catch(e){}}return!1},$o=Bi,ea=Xo,ta=U,ra=qo,ia=Zo,na=T("".indexOf);$o({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,ya=T,Ea=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=ya("".charAt),Pa=ya("".indexOf),ka=ya("".replace),Ma=ya("".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=Ea(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=Qe,za=Gt,Ka=Ha("species"),Wa=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===Wa.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(Wa,n,c[1])}i&&za(Wa[n],"sham",!0)},Ya=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Ja=d,qa=Dt,Qa=F,Za=C,$a=Va,es=i.TypeError,ts=function(e,t){var r=e.exec;if(Qa(r)){var i=Ja(r,e,t);return null!==i&&qa(i),i}if("RegExp"===Za(e))return Ja($a,e,t);throw es("RegExp#exec called on incompatible receiver")},rs=d,is=Dt,ns=U,os=Ya,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,ys=T,Es=d,gs=o,bs=po,Ts=hi,Is=l,Rs=Pe,As=k,Cs=Object.assign,Os=Object.defineProperty,Ns=ys([].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&&!Es(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,Ws=m,Xs=function(e,t,r){var i=zs(t);i in e?Ks.f(e,i,Ws(0,r)):e[i]=r},Ys=Wr,Js=Qr,qs=Xs,Qs=i.Array,Zs=Math.max,$s=function(e,t,r){for(var i=Js(e),n=Ys(t,i),o=Ys(void 0===r?i:r,i),a=Qs(Zs(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=$s,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=Qe;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=Qe("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,yc=K,Ec=Gs,gc=d,bc=T,Tc=a,Ic=ie,Rc=o,Ac=Ue,Cc=Wi,Oc=F,Nc=j,wc=W,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,Wc=l,Xc=oc,Yc=Ht.exports,Jc=Te.exports,qc=or,Qc=Be,Zc=Qe,$c=ac,eu=hc,tu=vc,ru=br,iu=kn.forEach,nu=nr("hidden"),ou=Zc("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=yc("JSON","stringify"),fu=Hc.f,_u=zc.f,vu=jc.f,mu=Wc.f,Su=bc([].push),yu=Jc("symbols"),Eu=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=yu[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(Eu,t,r),Pc(e);var i=Uc(t);return Pc(r),Ac(yu,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(yu,t)&&!Ac(Eu,t))&&(!(r||!Ac(this,t)||!Ac(yu,t)||Ac(this,nu)&&this[nu][t])||r)},wu=function(e,t){var r=Mc(e),i=Uc(t);if(r!==cu||!Ac(yu,i)||Ac(Eu,i)){var n=fu(r,i);return!n||!Ac(yu,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(yu,e)||Ac(qc,e)||Su(r,e)})),r},Pu=function(e){var t=e===cu,r=vu(t?Eu:Mc(e)),i=[];return iu(r,(function(e){!Ac(yu,e)||t&&!Ac(cu,e)||Su(i,yu[e])})),i};(Ic||(Yc(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=Qc(e),r=function(e){this===cu&&gc(r,Eu,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})),Yc(uu,"withoutSetter",(function(e){return Au(Qc(e),e)})),Wc.f=Nu,zc.f=Cu,Kc.f=Ou,Hc.f=wu,Bc.f=jc.f=Du,Gc.f=Pu,$c.f=function(e){return Au(Zc(e),e)},Tc&&(_u(du,"description",{configurable:!0,get:function(){return su(this).description}}),Yc(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,Ec(pu,null,i)}});if(!du[ou]){var ku=du.valueOf;Yc(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},Wu=K,Xu=Rt,Yu=a,Ju=Qe("species"),qu=function(e){var t=Wu(e),r=Xu.f;Yu&&t&&!t[Ju]&&r(t,Ju,{configurable:!0,get:function(){return this}})},Qu=W,Zu=i.TypeError,$u=function(e,t){if(Qu(t,e))return e;throw Zu("Incorrect invocation")},ed={},td=ed,rd=Qe("iterator"),id=Array.prototype,nd=function(e){return void 0!==e&&(td.Array===e||id[rd]===e)},od=rn,ad=Se,sd=ed,cd=Qe("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,yd=Se,Ed=function(e,t,r){var i,n;Sd(e);try{if(!(i=yd(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=Qr,Cd=W,Od=vd,Nd=ud,wd=Ed,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=Qe("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,Wd=i.TypeError,Xd=function(e){if(zd(e))return e;throw Wd(Kd(e)+" is not a constructor")},Yd=Dt,Jd=Xd,qd=Qe("species"),Qd=function(e,t){var r,i=Yd(e).constructor;return void 0===i||null==(r=Yd(i)[qd])?t:Jd(r)},Zd=i.TypeError,$d=function(e,t){if(e<t)throw Zd("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=$d,hl=el,pl=tl,fl=rl.setImmediate,_l=rl.clearImmediate,vl=rl.process,ml=rl.Dispatch,Sl=rl.Function,yl=rl.MessageChannel,El=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(El(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))}:yl&&!hl?(Gd=(jd=new yl).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,Wl=tl,Xl=Fl.MutationObserver||Fl.WebKitMutationObserver,Yl=Fl.document,Jl=Fl.process,ql=Fl.Promise,Ql=jl(Fl,"queueMicrotask"),Zl=Ql&&Ql.value;Zl||(Cl=function(){var e,t;for(Wl&&(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||Wl||Kl||!Xl||!Yl?!zl&&ql&&ql.resolve?((kl=ql.resolve(void 0)).constructor=ql,Ml=Bl(kl.then,kl),wl=function(){Ml(Cl)}):Wl?wl=function(){Jl.nextTick(Cl)}:(Gl=Bl(Gl,Fl),wl=function(){Gl(Cl)}):(Dl=!0,Pl=Yl.createTextNode(""),new Xl(Cl).observe(Pl,{characterData:!0}),wl=function(){Pl.data=Dl=!Dl}));var $l=Zl||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,yh=Hu,Eh=Ht.exports,gh=Ku,bh=ms,Th=vc,Ih=qu,Rh=ve,Ah=F,Ch=j,Oh=$u,Nh=qt,wh=Md,Dh=Hd,Ph=Qd,kh=Ul.set,Mh=$l,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=Qe("species"),Wh="Promise",Xh=Bh.getterFor(Wh),Yh=Bh.set,Jh=Bh.getterFor(Wh),qh=yh&&yh.prototype,Qh=yh,Zh=qh,$h=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(Wh,(function(){var e=Nh(Qh),t=e!==String(Qh);if(!t&&66===zh)return!0;if(zh>=51&&/native code/.test(e))return!1;var r=new Qh((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){Qh.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($h("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 $h("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&&(Zh=(Qh=function(e){Oh(this,Zh),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){Yh(this,{type:Wh,done:!1,notified:!1,parent:!1,reactions:new Fh,rejection:!1,state:0,value:void 0})}).prototype=gh(Zh,{then:function(e,t){var r=Jh(this),i=rp(Ph(this,Qh));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===Qh||e===lh?new dh(e):ip(e)},Ah(yh)&&qh!==Object.prototype)){hh=qh.then,ap||(Eh(qh,"then",(function(e,t){var r=this;return new Qh((function(e,t){Sh(hh,r,e,t)})).then(e,t)}),{unsafe:!0}),Eh(qh,"catch",Zh.catch,{unsafe:!0}));try{delete qh.constructor}catch(e){}bh&&bh(qh,Zh)}_h({global:!0,wrap:!0,forced:sp},{Promise:Qh}),Th(Qh,Wh,!1),Ih(Wh),lh=mh(Wh),_h({target:Wh,stat:!0,forced:sp},{reject:function(e){var t=rp(this);return Sh(t.reject,void 0,e),t.promise}}),_h({target:Wh,stat:!0,forced:sp},{resolve:function(e){return Uh(this,e)}}),_h({target:Wh,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 yp=Bi,Ep=a,gp=i,bp=T,Tp=Ue,Ip=F,Rp=W,Ap=qo,Cp=Rt.f,Op=Ti,Np=gp.Symbol,wp=Np&&Np.prototype;if(Ep&&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}}),yp({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,Wp=Pe,Xp=Gp,Yp=nr("IE_PROTO"),Jp=Hp.Object,qp=Jp.prototype,Qp=Xp?Jp.getPrototypeOf:function(e){var t=Wp(e);if(zp(t,Yp))return t[Yp];var r=t.constructor;return Kp(r)&&t instanceof r?r.prototype:t instanceof Jp?qp:null},Zp=o,$p=F,ef=Qp,tf=Ht.exports,rf=Qe("iterator"),nf=!1;[].keys&&("next"in(jp=[].keys())?(Bp=ef(ef(jp)))!==Object.prototype&&(Fp=Bp):nf=!0);var of=null==Fp||Zp((function(){var e={};return Fp[rf].call(e)!==e}));of&&(Fp={}),$p(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,yf=Qp,Ef=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=Qe("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=yf(v.call(new e)))!==Object.prototype&&s.next&&(yf(s)!==Cf&&(Ef?Ef(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,Wf=U,Xf=Hf("".charAt),Yf=Hf("".charCodeAt),Jf=Hf("".slice),qf=function(e){return function(t,r){var i,n,o=Kf(Wf(t)),a=zf(r),s=o.length;return a<0||a>=s?e?"":void 0:(i=Yf(o,a))<55296||i>56319||a+1===s||(n=Yf(o,a+1))<56320||n>57343?e?Xf(o,a):i:e?Jf(o,a,a+2):n-56320+(i-55296<<10)+65536}},Qf={codeAt:qf(!1),charAt:qf(!0)},Zf=Qf.charAt,$f=qo,e_=br,t_=Df,r_=e_.set,i_=e_.getterFor("String Iterator");t_(String,"String",(function(e){r_(this,{type:"String Iterator",string:$f(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=Zf(r,i),t.index+=e.length,{value:e,done:!1})}));var n_=i,o_=Hn,a_=Wn,s_=jf,c_=Gt,u_=Qe,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_=Qe("species"),S_=function(e){return v_>=51||!__((function(){var t=[];return(t.constructor={})[m_]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},y_=Bi,E_=i,g_=o,b_=Wi,T_=j,I_=Pe,R_=Qr,A_=Xs,C_=Rn,O_=S_,N_=ee,w_=Qe("isConcatSpreadable"),D_=E_.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)};y_({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_=Wi,V_=mn,F_=j,B_=Wr,j_=Qr,G_=V,H_=Xs,z_=Qe,K_=oc,W_=S_("slice"),X_=z_("species"),Y_=L_.Array,J_=Math.max;U_({target:"Array",proto:!0,forced:!W_},{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===Y_||x_(r.prototype))||F_(r)&&null===(r=r[X_]))&&(r=void 0),r===Y_||void 0===r))return K_(o,s,c);for(i=new(void 0===r?Y_: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 Q_(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 Z_=function(){return Z_=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},Z_.apply(this,arguments)};function $_(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=Qf.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,yv=T("".replace),Ev="[\t\n\v\f\r                 \u2028\u2029\ufeff]",gv=RegExp("^"+Ev+Ev+"*"),bv=RegExp(Ev+Ev+"*$"),Tv=function(e){return function(t){var r=Sv(mv(t));return 1&e&&(r=yv(r,gv,"")),2&e&&(r=yv(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,Wv=T,Xv=or,Yv=j,Jv=Ue,qv=Rt.f,Qv=Fr,Zv=Hs,$v=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=Qv.f,t=Wv([].splice),r={};r[rm]=1,e(r).length&&(Qv.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:Zv.f}))},fastKey:function(e,t){if(!Yv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Jv(e,rm)){if(!$v(e))return"F";if(!t)return"E";nm(e)}return e[rm].objectID},getWeakData:function(e,t){if(!Jv(e,rm)){if(!$v(e))return!0;if(!t)return!1;nm(e)}return e[rm].weakData},onFreeze:function(e){return em&&tm&&$v(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=$u,Sm=F,ym=j,Em=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&&!ym(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return n&&!ym(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(n&&!ym(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&&!Em((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=Em((function(){l.has(1)})),f=gm((function(e){new a(e)})),_=!n&&Em((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=$u,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=Qr,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}},Wm={left:Km(!1),right:Km(!0)},Xm=Wm.left,Ym=ee,Jm=tl;Bi({target:"Array",proto:!0,forced:!Un("reduce")||!Jm&&Ym>79&&Ym<83},{reduce:function(e){var t=arguments.length;return Xm(this,e,t,t>1?arguments[1]:void 0)}});var qm,Qm=Bi,Zm=T,$m=n.f,eS=Jr,tS=qo,rS=Xo,iS=U,nS=Zo,oS=Zm("".endsWith),aS=Zm("".slice),sS=Math.min,cS=nS("endsWith");Qm({target:"String",proto:!0,forced:!!(cS||(qm=$m(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 yS(e){return SS(e)?Object.keys(e).reduce((function(t,r){var i=SS(e[r]),n=i?yS(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,ov({},r,n))}),{}):e}function ES(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(i){i.endsWith("Id")?ES(e,e.get(t[i]),r):i.endsWith("Ids")&&t[i].forEach((function(t){ES(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&&ES(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=Wr,NS=Gr,wS=Qr,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),WS=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,XS=/\$([$&'`]|\d{1,2})/g,YS=Gs,JS=d,qS=T,QS=Xa,ZS=o,$S=Dt,ey=F,ty=Gr,ry=Jr,iy=qo,ny=U,oy=sv,ay=Se,sy=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=WS),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}))},cy=ts,uy=Qe("replace"),dy=Math.max,ly=Math.min,hy=qS([].concat),py=qS([].push),fy=qS("".indexOf),_y=qS("".slice),vy="$0"==="a".replace(/./,"$0"),my=!!/./[uy]&&""===/./[uy]("a","$0");QS("replace",(function(e,t,r){var i=my?"$":"$0";return[function(e,r){var i=ny(this),n=null==e?void 0:ay(e,uy);return n?JS(n,e,i,r):JS(t,iy(i),e,r)},function(e,n){var o=$S(this),a=iy(e);if("string"==typeof n&&-1===fy(n,i)&&-1===fy(n,"$<")){var s=r(t,o,a,n);if(s.done)return s.value}var c=ey(n);c||(n=iy(n));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=cy(o,a);if(null===h)break;if(py(l,h),!u)break;""===iy(h[0])&&(o.lastIndex=oy(a,ry(o.lastIndex),d))}for(var p,f="",_=0,v=0;v<l.length;v++){for(var m=iy((h=l[v])[0]),S=dy(ly(ty(h.index),a.length),0),y=[],E=1;E<h.length;E++)py(y,void 0===(p=h[E])?p:String(p));var g=h.groups;if(c){var b=hy([m],y,S,a);void 0!==g&&py(b,g);var T=iy(YS(n,void 0,b))}else T=sy(m,a,S,y,g,n);S>=_&&(f+=_y(a,_,S)+T,_=S+m.length)}return f+_y(a,_)}]}),!!ZS((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!vy||my);var Sy=a,yy=i,Ey=T,gy=Pi,by=um,Ty=Gt,Iy=Rt.f,Ry=Fr.f,Ay=W,Cy=zo,Oy=qo,Ny=aa,wy=la,Dy=Ht.exports,Py=o,ky=Ue,My=br.enforce,Uy=qu,Ly=fa,xy=ma,Vy=Qe("match"),Fy=yy.RegExp,By=Fy.prototype,jy=yy.SyntaxError,Gy=Ey(Ny),Hy=Ey(By.exec),zy=Ey("".charAt),Ky=Ey("".replace),Wy=Ey("".indexOf),Xy=Ey("".slice),Yy=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Jy=/a/g,qy=/a/g,Qy=new Fy(Jy)!==Jy,Zy=wy.MISSED_STICKY,$y=wy.UNSUPPORTED_Y,eE=Sy&&(!Qy||Zy||Ly||xy||Py((function(){return qy[Vy]=!1,Fy(Jy)!=Jy||Fy(qy)==qy||"/a/i"!=Fy(Jy,"i")})));if(gy("RegExp",eE)){for(var tE=function(e,t){var r,i,n,o,a,s,c=Ay(By,this),u=Cy(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===tE)return e;if((u||Ay(By,e))&&(e=e.source,d&&(t="flags"in h?h.flags:Gy(h))),e=void 0===e?"":Oy(e),t=void 0===t?"":Oy(t),h=e,Ly&&"dotAll"in Jy&&(i=!!t&&Wy(t,"s")>-1)&&(t=Ky(t,/s/g,"")),r=t,Zy&&"sticky"in Jy&&(n=!!t&&Wy(t,"y")>-1)&&$y&&(t=Ky(t,/y/g,"")),xy&&(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=zy(e,i)))t+=zy(e,++i);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:Hy(Yy,Xy(e,i+1))&&(i+=2,c=!0),n+=t,u++;continue;case">"===t&&c:if(""===d||ky(a,d))throw new jy("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=by(Fy(e,t),c?this:By,tE),(i||n||l.length)&&(s=My(a),i&&(s.dotAll=!0,s.raw=tE(function(e){for(var t,r=e.length,i=0,n="",o=!1;i<=r;i++)"\\"!==(t=zy(e,i))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),n+=t):n+="[\\s\\S]":n+=t+zy(e,++i);return n}(e),r)),n&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{Ty(a,"source",""===h?"(?:)":h)}catch(e){}return a},rE=function(e){e in tE||Iy(tE,e,{configurable:!0,get:function(){return Fy[e]},set:function(t){Fy[e]=t}})},iE=Ry(Fy),nE=0;iE.length>nE;)rE(iE[nE++]);By.constructor=tE,tE.prototype=By,Dy(yy,"RegExp",tE)}Uy("RegExp");var oE=T,aE=Or.PROPER,sE=Ht.exports,cE=Dt,uE=W,dE=qo,lE=o,hE=aa,pE=RegExp.prototype,fE=pE.toString,_E=oE(hE),vE=lE((function(){return"/a/b"!=fE.call({source:"a",flags:"b"})})),mE=aE&&"toString"!=fE.name;(vE||mE)&&sE(RegExp.prototype,"toString",(function(){var e=cE(this),t=dE(e.source),r=e.flags;return"/"+t+"/"+dE(void 0===r&&uE(pE,e)&&!("flags"in pE)?_E(e):r)}),{unsafe:!0});var SE=kn.some;Bi({target:"Array",proto:!0,forced:!Un("some")},{some:function(e){return SE(this,e,arguments.length>1?arguments[1]:void 0)}});var yE=a,EE=Or.EXISTS,gE=T,bE=Rt.f,TE=Function.prototype,IE=gE(TE.toString),RE=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,AE=gE(RE.exec);yE&&!EE&&bE(TE,"name",{configurable:!0,get:function(){try{return AE(RE,IE(this))[1]}catch(e){return""}}});var CE=T,OE=ve,NE=j,wE=Ue,DE=oc,PE=s,kE=i.Function,ME=CE([].concat),UE=CE([].join),LE={},xE=function(e,t,r){if(!wE(LE,t)){for(var i=[],n=0;n<t;n++)i[n]="a["+n+"]";LE[t]=kE("C,a","return new C("+UE(i,",")+")")}return LE[t](e,r)},VE=PE?kE.bind:function(e){var t=OE(this),r=t.prototype,i=DE(arguments,1),n=function(){var r=ME(i,DE(arguments));return this instanceof n?xE(t,r.length,r):t.apply(e,r)};return NE(r)&&(n.prototype=r),n},FE=VE;Bi({target:"Function",proto:!0,forced:Function.bind!==FE},{bind:FE});var BE=_S;function jE(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),BE("chrome: "+JSON.stringify(e)),n(e)}));e.video=i(e.video)}return BE("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 GE(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function HE(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 zE(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 KE(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 WE(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 XE(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,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 YE(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return XE(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 JE(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 qE(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 QE=Object.freeze({__proto__:null,shimMediaStream:GE,shimOnTrack:HE,shimGetSendersWithDtmf:zE,shimGetStats:KE,shimSenderReceiverGetStats:WE,shimAddTrackRemoveTrackWithNative:XE,shimAddTrackRemoveTrack:YE,shimPeerConnection:JE,fixNegotiationNeeded:qE,shimGetUserMedia:jE,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(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"))}}),ZE=i,$E=o,eg=qo,tg=Iv.trim,rg=T("".charAt),ig=ZE.parseFloat,ng=ZE.Symbol,og=ng&&ng.iterator,ag=1/ig("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||og&&!$E((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=Qd,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 yg(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 Eg(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:yg,shimReceiverGetStats:Eg,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:yS(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,Wg=Ht.exports,Xg=Ue,Yg=um,Jg=W,qg=de,Qg=at,Zg=o,$g=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=Qg(e,"number");return"bigint"==typeof t?t:db(t)},db=function(e){var t,r,i,n,o,a,s,c,u=Qg(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)&&Zg((function(){rb(r)}))?Yg(Object(t),r,hb):t},pb=Gg?$g(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,Wg(Hg,"Number",hb)}var _b=Bi,vb=k,mb=V,Sb=Un,yb=T([].join),Eb=vb!=Object,gb=Sb("join",",");_b({target:"Array",proto:!0,forced:Eb||!gb},{join:function(e){return yb(mb(this),void 0===e?",":e)}});var bb=Gs,Tb=d,Ib=T,Rb=Xa,Ab=zo,Cb=Dt,Ob=U,Nb=Qd,wb=sv,Db=Jr,Pb=qo,kb=Se,Mb=$s,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,Wb=vv,Xb=Iv.trim;Bi({target:"String",proto:!0,forced:function(e){return Kb((function(){return!!Wb[e]()||"​…᠎"!=="​…᠎"[e]()||zb&&Wb[e].name!==e}))}("trim")},{trim:function(){return Xb(this)}});var Yb={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}(Yb);var Jb=Yb.exports,qb=Object.freeze(e({__proto__:null,default:Jb},[Yb.exports]));function Qb(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 Zb(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 $b(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:Qb,shimMaxMessageSize:Zb,shimSendThrowTypeError:$b,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(!QE||!JE||!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=QE,rT(t,n),iT(t),jE(t,n),GE(t),JE(t,n),HE(t),YE(t,n),zE(t),KE(t),WE(t),qE(t,n),Qb(t),eT(t),Zb(t,n),$b(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),yg(t),Eg(t),bg(t),Tg(t),Ig(t),Rg(t),Ag(t),Qb(t),eT(t),Zb(t,n),$b(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),Qb(t),Zb(t,n),$b(t),tT(t,n);break;default:i("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),Bi({target:"Array",stat:!0},{isArray:Wi});var oT=$s,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,yT=Pe,ET=Qr,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=yT(this);if(UT)return void 0===e?wT(t):wT(t,e);var r,i,n=[],o=ET(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,WT=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)/WT),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)}},YT=Pe,JT=Wr,qT=Qr,QT=function(e){for(var t=YT(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},ZT=i,$T=T,eI=a,tI=LT,rI=Or,iI=Gt,nI=Ku,oI=o,aI=$u,sI=Gr,cI=Jr,uI=BT,dI=XT,lI=Qp,hI=ms,pI=Fr.f,fI=Rt.f,_I=QT,vI=$s,mI=vc,SI=rI.PROPER,yI=rI.CONFIGURABLE,EI=br.get,gI=br.set,bI=ZT.ArrayBuffer,TI=bI,II=TI&&TI.prototype,RI=ZT.DataView,AI=RI&&RI.prototype,CI=Object.prototype,OI=ZT.Array,NI=ZT.RangeError,wI=$T(_I),DI=$T([].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 EI(this)[t]}})},jI=function(e,t,r,i){var n=uI(r),o=EI(e);if(n+t>o.byteLength)throw NI("Wrong index");var a=EI(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=EI(e);if(a+t>s.byteLength)throw NI("Wrong index");for(var c=EI(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&&!yI})))HI&&yI&&iI(bI,"name","ArrayBuffer");else{(TI=function(e){return aI(this,II),new bI(uI(e))}).prototype=II;for(var zI,KI=pI(bI),WI=0;KI.length>WI;)(zI=KI[WI++])in TI||iI(TI,zI,bI[zI]);II.constructor=TI}hI&&lI(AI)!==CI&&hI(AI,CI);var XI=new RI(new TI(2)),YI=$T(AI.setInt8);XI.setInt8(0,2147483648),XI.setInt8(1,2147483649),!XI.getInt8(0)&&XI.getInt8(1)||nI(AI,{setInt8:function(e,t){YI(this,e,t<<24>>24)},setUint8:function(e,t){YI(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=EI(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,QI=T,ZI=o,$I=Dt,eR=Wr,tR=Jr,rR=Qd,iR=JI.ArrayBuffer,nR=JI.DataView,oR=nR.prototype,aR=QI(iR.prototype.slice),sR=QI(oR.getUint8),cR=QI(oR.setUint8);qI({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:ZI((function(){return!new iR(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(aR&&void 0===t)return aR($I(this),e);for(var r=$I(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,yR=rn,ER=he,gR=Gt,bR=Ht.exports,TR=Rt.f,IR=W,RR=Qp,AR=ms,CR=Qe,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"!==yR(_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=yR(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(ER(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=yR(e);return"DataView"===t||SR(GR,t)||SR(HR,t)},isTypedArray:zR,TypedArray:kR,TypedArrayPrototype:MR},WR=i,XR=o,YR=Hd,JR=KR.NATIVE_ARRAY_BUFFER_VIEWS,qR=WR.ArrayBuffer,QR=WR.Int8Array,ZR=!JR||!XR((function(){QR(1)}))||!XR((function(){new QR(-1)}))||!YR((function(e){new QR,new QR(null),new QR(1.5),new QR(e)}),!0)||XR((function(){return 1!==new QR(new qR(2),1,void 0).length})),$R=j,eA=Math.floor,tA=Number.isInteger||function(e){return!$R(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=Qr,hA=vd,pA=ud,fA=nd,_A=KR.aTypedArrayConstructor,vA=Bi,mA=i,SA=d,yA=a,EA=ZR,gA=KR,bA=JI,TA=$u,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=W,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,WA=br.set,XA=GA.f,YA=HA.f,JA=Math.round,qA=mA.RangeError,QA=bA.ArrayBuffer,ZA=QA.prototype,$A=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(ZA,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]):YA(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)};yA?(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?EA&&(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 QA(a=s*i);for(WA(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new $A(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=Wr,_C=Qr,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,yC=T(mC),EC=SC.aTypedArray;(0,SC.exportTypedArrayMethod)("copyWithin",(function(e,t){return yC(EC(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=QT,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=Qr,CC=Qd,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 WC=i,XC=o,YC=T,JC=KR,qC=jf,QC=Qe("iterator"),ZC=WC.Uint8Array,$C=YC(qC.values),eO=YC(qC.keys),tO=YC(qC.entries),rO=JC.aTypedArray,iO=JC.exportTypedArrayMethod,nO=ZC&&ZC.prototype,oO=!XC((function(){nO[QC].call([1])})),aO=!!nO&&nO.values&&nO[QC]===nO.values&&"values"===nO.values.name,sO=function(){return $C(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(QC,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=Qr,_O=Un,vO=Math.min,mO=[].lastIndexOf,SO=!!mO&&1/[1].lastIndexOf(1,-0)<0,yO=_O("lastIndexOf"),EO=SO||!yO?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=EO,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=Wm.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=Wm.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=Qr,VO=aA,FO=Pe,BO=o,jO=MO.RangeError,GO=MO.Int8Array,HO=GO&&GO.prototype,zO=HO&&HO.set,KO=LO.aTypedArray,WO=LO.exportTypedArrayMethod,XO=!BO((function(){var e=new Uint8ClampedArray(2);return UO(zO,e,{length:1,0:3},1),3!==e[1]})),YO=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]}));WO("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||YO);var JO=wC,qO=oc,QO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("slice",(function(e,t){for(var r=qO(QO(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 ZO=kn.some,$O=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("some",(function(e){return ZO($O(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=Wr,yN=wC,EN=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("subarray",(function(e,t){var r=EN(this),i=r.length,n=SN(e,i);return new(yN(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=$d,zN=/MSIE .\./.test(X),KN=FN.Function,WN=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:WN(FN.setTimeout),setInterval:WN(FN.setInterval)});var XN=Bi,YN=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 YN(this,e,arguments.length>1?arguments[1]:void 0)}}),JN("findIndex");var QN,ZN,$N=qu,ew=JI.ArrayBuffer;Bi({global:!0,forced:i.ArrayBuffer!==ew},{ArrayBuffer:ew}),$N("ArrayBuffer"),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVOKED_BEFORE_JOIN_ROOM="INVOKED_BEFORE_JOIN_ROOM",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_EXCEED_MAX_LENGTH="USER_MESSAGE_EXCEED_MAX_LENGTH",e.USER_MESSAGE_EMPTY_USER="USER_MESSAGE_EMPTY_USER",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN",e.RECONNECT_FAILED="RECONNECT_FAILED"}(QN||(QN={})),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"}(ZN||(ZN={}));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,yw=_w(fw),Ew=_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=yw(u,gw((n=s-c)/u.length))).length>n&&(o=Ew(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=Ed,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=Qr,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=Wi,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 Ww=Bi,Xw=i,Yw=T,Jw=Gr,qw=jg,Qw=fw,Zw=o,$w=Xw.RangeError,eD=Xw.String,tD=Math.floor,rD=Yw(Qw),iD=Yw("".slice),nD=Yw(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};Ww({target:"Number",proto:!0,forced:Zw((function(){return"0.000"!==nD(8e-5,3)||"1"!==nD(.9,0)||"1.25"!==nD(1.255,2)||"1000000000000000128"!==nD(0xde0b6b3a7640080,0)}))||!Zw((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 $w("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=Math.log,dD=Math.LOG10E;Bi({target:"Math",stat:!0},{log10:Math.log10||function(e){return uD(e)*dD}});var lD,hD,pD,fD,_D,vD,mD,SD,yD,ED,gD,bD,TD,ID,RD,AD,CD,OD,ND,wD,DD,PD,kD,MD,UD,LD=Bi,xD=T,VD=n.f,FD=Jr,BD=qo,jD=Xo,GD=U,HD=Zo,zD=xD("".startsWith),KD=xD("".slice),WD=Math.min,XD=HD("startsWith"),YD=!XD&&!!function(){var e=VD(String.prototype,"startsWith");return e&&!e.writable}();LD({target:"String",proto:!0,forced:!YD&&!XD},{startsWith:function(e){var t=BD(GD(this));jD(e);var r=FD(WD(arguments.length>1?arguments[1]:void 0,t.length)),i=BD(e);return zD?zD(t,i,r):KD(t,r,r+i.length)===i}}),function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(lD||(lD={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(hD||(hD={})),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"}(pD||(pD={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(fD||(fD={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(_D||(_D={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}(vD||(vD={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(mD||(mD={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(SD||(SD={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(yD||(yD={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(ED||(ED={})),function(e){e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO"}(gD||(gD={})),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"}(bD||(bD={})),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"}(TD||(TD={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(ID||(ID={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(RD||(RD={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(AD||(AD={})),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"}(CD||(CD={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(OD||(OD={})),function(e){e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY"}(ND||(ND={})),function(e){e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH"}(wD||(wD={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(DD||(DD={})),function(e){e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth"}(PD||(PD={})),function(e){e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom"}(kD||(kD={})),function(e){e[e.default=0]="default",e[e.fluent=1]="fluent",e[e.standard=2]="standard",e[e.hd=3]="hd",e[e.standardStereo=4]="standardStereo",e[e.hdMono=5]="hdMono"}(MD||(MD={}));var JD=new Uint8Array(16);function qD(){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(JD)}var QD=/^(?:[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 ZD(e){return"string"==typeof e&&QD.test(e)}for(var $D=[],eP=0;eP<256;++eP)$D.push((eP+256).toString(16).substr(1));function tP(e,t,r){var i=(e=e||{}).random||(e.rng||qD)();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=($D[e[t+0]]+$D[e[t+1]]+$D[e[t+2]]+$D[e[t+3]]+"-"+$D[e[t+4]]+$D[e[t+5]]+"-"+$D[e[t+6]]+$D[e[t+7]]+"-"+$D[e[t+8]]+$D[e[t+9]]+"-"+$D[e[t+10]]+$D[e[t+11]]+$D[e[t+12]]+$D[e[t+13]]+$D[e[t+14]]+$D[e[t+15]]).toLowerCase();if(!ZD(r))throw TypeError("Stringified UUID is invalid");return r}(i)}var rP=new TextDecoder,iP=new TextEncoder,nP=function(){return tP()},oP=function(){return Date.now()};function aP(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 sP=function(){return"undefined"==typeof window},cP=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 rP.decode(e)},e.ab2obj=function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(e){return{}}},e.str2ab=function(e){return iP.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 uP(){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 dP=function(){return Math.floor(65535*Math.random())};function lP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function hP(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 pP,fP,_P=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]}}))}))},vP=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 mP(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function SP(e){return(e&gD.AUDIO)===gD.AUDIO}function yP(e){return(e&gD.VIDEO)===gD.VIDEO}function EP(e){var t={};return Object.keys(e).forEach((function(r){"object"===us(e[r])?t[r]=EP(e[r]):r.startsWith("_")||(t[r]=e[r])})),t}function gP(e,t){if("boolean"!=typeof e)throw new tw(QN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function bP(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(QN.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(i,"]. integer only"))}function TP(e,t,r,i){if(void 0===r&&(r=1),void 0===i&&(i=Number.POSITIVE_INFINITY),null==e)throw new tw(QN.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(QN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(i,"]"))}function IP(e,t,r){if(!r.includes(e))throw new tw(QN.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function RP(e,t){if(OP(e))throw new tw(QN.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function AP(e,t){if(!(e instanceof ArrayBuffer))throw new tw(QN.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function CP(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 OP(e){return null==e}function NP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new tw(QN.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function wP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new tw(QN.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function DP(e){RP(e,"videoPlayerOption")}function PP(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(QN.INVALID_PARAMS,"The message cannot be empty");if((null==(i=e instanceof ArrayBuffer?e:cP.str2ab(JSON.stringify(e)))?void 0:i.byteLength)>1e3*t)throw new tw(QN.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function kP(e){return![pP.onRemoteStreamStats,pP.onLocalStreamStats].includes(e)}!function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onUserPublishStream="onUserPublishStream",e.onUserUnpublishStream="onUserUnpublishStream",e.onUserPublishScreen="onUserPublishScreen",e.onUserUnpublishScreen="onUserUnpublishScreen",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onVideoDeviceStateChanged="onVideoDeviceStateChanged",e.onAudioDeviceStateChanged="onAudioDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onStreamMixingEvent="onStreamMixingEvent",e.onAudioPlaybackDeviceTestVolume="onAudioPlaybackDeviceTestVolume",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom",e.onTokenWillExpire="onTokenWillExpire",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived",e.onNetworkQuality="onNetworkQuality",e.onSimulcastSubscribeFallback="onSimulcastSubscribeFallback",e.onRemoteVideoSizeChanged="onRemoteVideoSizeChanged"}(pP||(pP={})),function(e){e[e.ERR_OK=0]="ERR_OK",e[e.ERR_PARAM_INVALID=1]="ERR_PARAM_INVALID",e[e.ERR_FRAME_TIMEOUT=2]="ERR_FRAME_TIMEOUT",e[e.ERR_POSTPROCESS=3]="ERR_POSTPROCESS",e[e.ERR_PUSH_CDN=4]="ERR_PUSH_CDN",e[e.ERR_UNKNOWN=9999]="ERR_UNKNOWN"}(fP||(fP={}));var MP={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}(MP);var UP=["#0050b3","#0050b3","#0050b3","#0050b3"],LP=!sP()&&window.location.search.includes("_rtc_debug_"),xP=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(LP){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(UP[this._indent],";")],iv(t),!1))}},e}(),VP=new xP("VERTC",0),FP=function(e){function t(){return e.call(this)||this}return Q_(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 VP.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){VP.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),n(t)}}))]}))}))},t}(MP.exports.EventEmitter),BP=Ue,jP=function(e){return void 0!==e&&(BP(e,"value")||BP(e,"writable"))},GP=d,HP=j,zP=Dt,KP=jP,WP=n,XP=Qp;Bi({target:"Reflect",stat:!0},{get:function e(t,r){var i,n,o=arguments.length<3?t:arguments[2];return zP(t)===o?t[r]:(i=WP.f(t,r))?KP(i)?i.value:void 0===i.get?void 0:GP(i.get,o):HP(n=XP(t))?e(n,r,o):void 0}});var YP=Bi,JP=d,qP=Dt,QP=j,ZP=jP,$P=Rt,ek=n,tk=Qp,rk=m;var ik=o((function(){var e=function(){},t=$P.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));YP({target:"Reflect",stat:!0,forced:ik},{set:function e(t,r,i){var n,o,a,s=arguments.length<4?t:arguments[3],c=ek.f(qP(t),r);if(!c){if(QP(o=tk(t)))return e(o,r,i,s);c=rk(0)}if(ZP(c)){if(!1===c.writable||!QP(s))return!1;if(n=ek.f(s,r)){if(n.get||n.set||!1===n.writable)return!1;n.value=i,$P.f(s,r,n)}else $P.f(s,r,rk(0,i))}else{if(void 0===(a=c.set))return!1;JP(a,s,i)}return!0}}),(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 nk={};!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)}(nk);var ok={},ak={},sk={},ck=nk;function uk(e){for(var t=e.length;--t>=0;)e[t]=0}var dk=[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],lk=[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],hk=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],pk=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],fk=new Array(576);uk(fk);var _k=new Array(60);uk(_k);var vk=new Array(512);uk(vk);var mk=new Array(256);uk(mk);var Sk=new Array(29);uk(Sk);var yk,Ek,gk,bk=new Array(30);function Tk(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 Ik(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Rk(e){return e<256?vk[e]:vk[256+(e>>>7)]}function Ak(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function Ck(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,Ak(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 Ok(e,t,r){Ck(e,r[2*t],r[2*t+1])}function Nk(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function wk(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]=Nk(o[s]++,s))}}function Dk(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 Pk(e){e.bi_valid>8?Ak(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 kk(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 Mk(e,t,r){for(var i=e.heap[r],n=r<<1;n<=e.heap_len&&(n<e.heap_len&&kk(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!kk(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i}function Uk(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?Ok(e,n,t):(Ok(e,(o=mk[n])+256+1,t),0!==(a=dk[o])&&Ck(e,n-=Sk[o],a),Ok(e,o=Rk(--i),r),0!==(a=lk[o])&&Ck(e,i-=bk[o],a))}while(s<e.last_lit);Ok(e,256,t)}function Lk(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--)Mk(e,o,r);n=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Mk(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++,Mk(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),wk(o,u,e.bl_count)}function xk(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 Vk(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{Ok(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(Ok(e,n,e.bl_tree),s--),Ok(e,16,e.bl_tree),Ck(e,s-3,2)):s<=10?(Ok(e,17,e.bl_tree),Ck(e,s-3,3)):(Ok(e,18,e.bl_tree),Ck(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}}uk(bk);var Fk=!1;function Bk(e,t,r,i){Ck(e,0+(i?1:0),3),function(e,t,r,i){Pk(e),i&&(Ak(e,r),Ak(e,~r)),ck.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}sk._tr_init=function(e){Fk||(!function(){var e,t,r,i,n,o=new Array(16);for(r=0,i=0;i<28;i++)for(Sk[i]=r,e=0;e<1<<dk[i];e++)mk[r++]=i;for(mk[r-1]=i,n=0,i=0;i<16;i++)for(bk[i]=n,e=0;e<1<<lk[i];e++)vk[n++]=i;for(n>>=7;i<30;i++)for(bk[i]=n<<7,e=0;e<1<<lk[i]-7;e++)vk[256+n++]=i;for(t=0;t<=15;t++)o[t]=0;for(e=0;e<=143;)fk[2*e+1]=8,e++,o[8]++;for(;e<=255;)fk[2*e+1]=9,e++,o[9]++;for(;e<=279;)fk[2*e+1]=7,e++,o[7]++;for(;e<=287;)fk[2*e+1]=8,e++,o[8]++;for(wk(fk,287,o),e=0;e<30;e++)_k[2*e+1]=5,_k[2*e]=Nk(e,5);yk=new Tk(fk,dk,257,286,15),Ek=new Tk(_k,lk,0,30,15),gk=new Tk(new Array(0),hk,0,19,7)}(),Fk=!0),e.l_desc=new Ik(e.dyn_ltree,yk),e.d_desc=new Ik(e.dyn_dtree,Ek),e.bl_desc=new Ik(e.bl_tree,gk),e.bi_buf=0,e.bi_valid=0,Dk(e)},sk._tr_stored_block=Bk,sk._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)),Lk(e,e.l_desc),Lk(e,e.d_desc),a=function(e){var t;for(xk(e,e.dyn_ltree,e.l_desc.max_code),xk(e,e.dyn_dtree,e.d_desc.max_code),Lk(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*pk[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?Bk(e,t,r,i):4===e.strategy||o===n?(Ck(e,2+(i?1:0),3),Uk(e,fk,_k)):(Ck(e,4+(i?1:0),3),function(e,t,r,i){var n;for(Ck(e,t-257,5),Ck(e,r-1,5),Ck(e,i-4,4),n=0;n<i;n++)Ck(e,e.bl_tree[2*pk[n]+1],3);Vk(e,e.dyn_ltree,t-1),Vk(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Uk(e,e.dyn_ltree,e.dyn_dtree)),Dk(e),i&&Pk(e)},sk._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*(mk[r]+256+1)]++,e.dyn_dtree[2*Rk(t)]++),e.last_lit===e.lit_bufsize-1},sk._tr_align=function(e){Ck(e,2,3),Ok(e,256,fk),function(e){16===e.bi_valid?(Ak(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 jk=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 Gk=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 Hk,zk=function(e,t,r,i){var n=Gk,o=i+r;e^=-1;for(var a=i;a<o;a++)e=e>>>8^n[255&(e^t[a])];return-1^e},Kk={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"},Wk=nk,Xk=sk,Yk=jk,Jk=zk,qk=Kk;function Qk(e,t){return e.msg=qk[t],t}function Zk(e){return(e<<1)-(e>4?9:0)}function $k(e){for(var t=e.length;--t>=0;)e[t]=0}function eM(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(Wk.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 tM(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,eM(e.strm)}function rM(e,t){e.pending_buf[e.pending++]=t}function iM(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function nM(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 oM(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)){Wk.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,Wk.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=Yk(a.adler,s,d,c):2===a.state.wrap&&(a.adler=Jk(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 aM(e,t){for(var r,i;;){if(e.lookahead<262){if(oM(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=nM(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&&(tM(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(tM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(tM(e,!1),0===e.strm.avail_out)?1:2}function sM(e,t){for(var r,i,n;;){if(e.lookahead<262){if(oM(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=nM(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&&(tM(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]))&&tM(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?(tM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(tM(e,!1),0===e.strm.avail_out)?1:2}function cM(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 uM(){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 Wk.Buf16(1146),this.dyn_dtree=new Wk.Buf16(122),this.bl_tree=new Wk.Buf16(78),$k(this.dyn_ltree),$k(this.dyn_dtree),$k(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Wk.Buf16(16),this.heap=new Wk.Buf16(573),$k(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Wk.Buf16(573),$k(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 dM(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):Qk(e,-2)}function lM(e){var t,r=dM(e);return 0===r&&((t=e.state).window_size=2*t.w_size,$k(t.head),t.max_lazy_match=Hk[t.level].max_lazy,t.good_match=Hk[t.level].good_length,t.nice_match=Hk[t.level].nice_length,t.max_chain_length=Hk[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 hM(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 Qk(e,-2);8===i&&(i=9);var s=new uM;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 Wk.Buf8(2*s.w_size),s.head=new Wk.Buf16(s.hash_size),s.prev=new Wk.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Wk.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,lM(e)}Hk=[new cM(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(oM(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,tM(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(tM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(tM(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(tM(e,!1),e.strm.avail_out),1)})),new cM(4,4,8,4,aM),new cM(4,5,16,8,aM),new cM(4,6,32,32,aM),new cM(4,4,16,16,sM),new cM(8,16,32,32,sM),new cM(8,16,128,128,sM),new cM(8,32,128,256,sM),new cM(32,128,258,1024,sM),new cM(32,258,258,4096,sM)],ak.deflateInit=function(e,t){return hM(e,t,8,15,8,0)},ak.deflateInit2=hM,ak.deflateReset=lM,ak.deflateResetKeep=dM,ak.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?-2:(e.state.gzhead=t,0):-2},ak.deflate=function(e,t){var r,i,n,o;if(!e||!e.state||t>5||t<0)return e?Qk(e,-2):-2;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||666===i.status&&4!==t)return Qk(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,rM(i,31),rM(i,139),rM(i,8),i.gzhead?(rM(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)),rM(i,255&i.gzhead.time),rM(i,i.gzhead.time>>8&255),rM(i,i.gzhead.time>>16&255),rM(i,i.gzhead.time>>24&255),rM(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),rM(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(rM(i,255&i.gzhead.extra.length),rM(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=Jk(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(rM(i,0),rM(i,0),rM(i,0),rM(i,0),rM(i,0),rM(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),rM(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,iM(i,a),0!==i.strstart&&(iM(i,e.adler>>>16),iM(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=Jk(e.adler,i.pending_buf,i.pending-n,n)),eM(e),n=i.pending,i.pending!==i.pending_buf_size));)rM(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(e.adler=Jk(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=Jk(e.adler,i.pending_buf,i.pending-n,n)),eM(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,rM(i,o)}while(0!==o);i.gzhead.hcrc&&i.pending>n&&(e.adler=Jk(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=Jk(e.adler,i.pending_buf,i.pending-n,n)),eM(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,rM(i,o)}while(0!==o);i.gzhead.hcrc&&i.pending>n&&(e.adler=Jk(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&&eM(e),i.pending+2<=i.pending_buf_size&&(rM(i,255&e.adler),rM(i,e.adler>>8&255),e.adler=0,i.status=113)):i.status=113),0!==i.pending){if(eM(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&Zk(t)<=Zk(r)&&4!==t)return Qk(e,-5);if(666===i.status&&0!==e.avail_in)return Qk(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&&(oM(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&&(tM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(tM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(tM(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(oM(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&&(tM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(tM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(tM(e,!1),0===e.strm.avail_out)?1:2}(i,t):Hk[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&&($k(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),eM(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(rM(i,255&e.adler),rM(i,e.adler>>8&255),rM(i,e.adler>>16&255),rM(i,e.adler>>24&255),rM(i,255&e.total_in),rM(i,e.total_in>>8&255),rM(i,e.total_in>>16&255),rM(i,e.total_in>>24&255)):(iM(i,e.adler>>>16),iM(i,65535&e.adler)),eM(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},ak.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?Qk(e,-2):(e.state=null,113===t?Qk(e,-3):0):-2},ak.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=Yk(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&($k(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new Wk.Buf8(r.w_size),Wk.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,oM(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,oM(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},ak.deflateInfo="pako deflate (from Nodeca project)";var pM={},fM=nk,_M=!0,vM=!0;try{String.fromCharCode.apply(null,[0])}catch(e){_M=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){vM=!1}for(var mM=new fM.Buf8(256),SM=0;SM<256;SM++)mM[SM]=SM>=252?6:SM>=248?5:SM>=240?4:SM>=224?3:SM>=192?2:1;function yM(e,t){if(t<65534&&(e.subarray&&vM||!e.subarray&&_M))return String.fromCharCode.apply(null,fM.shrinkBuf(e,t));for(var r="",i=0;i<t;i++)r+=String.fromCharCode(e[i]);return r}mM[254]=mM[254]=1,pM.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 fM.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},pM.buf2binstring=function(e){return yM(e,e.length)},pM.binstring2buf=function(e){for(var t=new fM.Buf8(e.length),r=0,i=t.length;r<i;r++)t[r]=e.charCodeAt(r);return t},pM.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=mM[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 yM(s,i)},pM.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+mM[e[r]]>t?r:t};var EM=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},gM=ak,bM=nk,TM=pM,IM=Kk,RM=EM,AM=Object.prototype.toString;function CM(e){if(!(this instanceof CM))return new CM(e);this.options=bM.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 RM,this.strm.avail_out=0;var r=gM.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(IM[r]);if(t.header&&gM.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(i="string"==typeof t.dictionary?TM.string2buf(t.dictionary):"[object ArrayBuffer]"===AM.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=gM.deflateSetDictionary(this.strm,i)))throw new Error(IM[r]);this._dict_set=!0}}function OM(e,t){var r=new CM(t);if(r.push(e,!0),r.err)throw r.msg||IM[r.err];return r.result}CM.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=TM.string2buf(e):"[object ArrayBuffer]"===AM.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 bM.Buf8(o),n.next_out=0,n.avail_out=o),1!==(r=gM.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(TM.buf2binstring(bM.shrinkBuf(n.output,n.next_out))):this.onData(bM.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==r);return 4===i?(r=gM.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==i||(this.onEnd(0),n.avail_out=0,!0)},CM.prototype.onData=function(e){this.chunks.push(e)},CM.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=bM.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},ok.Deflate=CM,ok.deflate=OM,ok.deflateRaw=function(e,t){return(t=t||{}).raw=!0,OM(e,t)},ok.gzip=function(e,t){return(t=t||{}).gzip=!0,OM(e,t)};var NM={},wM=a,DM=Rt,PM=aa,kM=o,MM=RegExp.prototype;wM&&kM((function(){return"sy"!==Object.getOwnPropertyDescriptor(MM,"flags").get.call({dotAll:!0,sticky:!0})}))&&DM.f(MM,"flags",{configurable:!0,get:PM});var UM={},LM=nk,xM=[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],VM=[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],FM=[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],BM=[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],jM=nk,GM=jk,HM=zk,zM=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,y,E,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),y=_[p&m];t:for(;;){if(p>>>=E=y>>>24,f-=E,0===(E=y>>>16&255))A[o++]=65535&y;else{if(!(16&E)){if(0==(64&E)){y=_[(65535&y)+(p&(1<<E)-1)];continue t}if(32&E){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}g=65535&y,(E&=15)&&(f<E&&(p+=R[i++]<<f,f+=8),g+=p&(1<<E)-1,p>>>=E,f-=E),f<15&&(p+=R[i++]<<f,f+=8,p+=R[i++]<<f,f+=8),y=v[p&S];r:for(;;){if(p>>>=E=y>>>24,f-=E,!(16&(E=y>>>16&255))){if(0==(64&E)){y=v[(65535&y)+(p&(1<<E)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&y,f<(E&=15)&&(p+=R[i++]<<f,(f+=8)<E&&(p+=R[i++]<<f,f+=8)),(b+=p&(1<<E)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=E,f-=E,b>(E=o-a)){if((E=b-E)>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-E,E<g){g-=E;do{A[o++]=h[T++]}while(--E);T=o-b,I=A}}else if(l<E){if(T+=u+l-E,(E-=l)<g){g-=E;do{A[o++]=h[T++]}while(--E);if(T=0,l<g){g-=E=l;do{A[o++]=h[T++]}while(--E);T=o-b,I=A}}}else if(T+=l-E,E<g){g-=E;do{A[o++]=h[T++]}while(--E);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},KM=function(e,t,r,i,n,o,a,s){var c,u,d,l,h,p,f,_,v,m=s.bits,S=0,y=0,E=0,g=0,b=0,T=0,I=0,R=0,A=0,C=0,O=null,N=0,w=new LM.Buf16(16),D=new LM.Buf16(16),P=null,k=0;for(S=0;S<=15;S++)w[S]=0;for(y=0;y<i;y++)w[t[r+y]]++;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(E=1;E<g&&0===w[E];E++);for(b<E&&(b=E),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(y=0;y<i;y++)0!==t[r+y]&&(a[D[t[r+y]]++]=y);if(0===e?(O=P=a,p=19):1===e?(O=xM,N-=257,P=VM,k-=257,p=256):(O=FM,P=BM,p=-1),C=0,y=0,S=E,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[y]<p?(_=0,v=a[y]):a[y]>p?(_=P[k+a[y]],v=O[N+a[y]]):(_=96,v=0),c=1<<S-I,E=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,y++,0==--w[S]){if(S===g)break;S=t[r+a[y]]}if(S>b&&(C&l)!==d){for(0===I&&(I=b),h+=E,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 WM(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 jM.Buf16(320),this.work=new jM.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function YM(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 jM.Buf32(852),t.distcode=t.distdyn=new jM.Buf32(592),t.sane=1,t.back=-1,0):-2}function JM(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,YM(e)):-2}function qM(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,JM(e))):-2}function QM(e,t){var r,i;return e?(i=new XM,e.state=i,i.window=null,0!==(r=qM(e,t))&&(e.state=null),r):-2}var ZM,$M,eU=!0;function tU(e){if(eU){var t;for(ZM=new jM.Buf32(512),$M=new jM.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(KM(1,e.lens,0,288,ZM,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;KM(2,e.lens,0,32,$M,0,e.work,{bits:5}),eU=!1}e.lencode=ZM,e.lenbits=9,e.distcode=$M,e.distbits=5}function rU(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 jM.Buf8(o.wsize)),i>=o.wsize?(jM.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),jM.arraySet(o.window,t,r-i,n,o.wnext),(i-=n)?(jM.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}UM.inflateReset=JM,UM.inflateReset2=qM,UM.inflateResetKeep=YM,UM.inflateInit=function(e){return QM(e,15)},UM.inflateInit2=QM,UM.inflate=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,y,E,g,b,T,I,R,A=0,C=new jM.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=HM(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=HM(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=HM(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=HM(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=HM(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)),jM.arraySet(r.head.extra,i,o,p,b)),512&r.flags&&(r.check=HM(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=HM(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=HM(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=WM(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(tU(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;jM.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=KM(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=KM(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=KM(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,zM(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(y=v,E=m,g=S;m=(A=r.lencode[g+((u&(1<<y+E)-1)>>y)])>>>16&255,S=65535&A,!(y+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}u>>>=y,d-=y,r.back+=y}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(y=v,E=m,g=S;m=(A=r.distcode[g+((u&(1<<y+E)-1)>>y)])>>>16&255,S=65535&A,!(y+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}u>>>=y,d-=y,r.back+=y}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?HM(r.check,n,h,a-h):GM(r.check,n,h,a-h)),h=c,(r.flags?u:WM(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))&&rU(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?HM(r.check,n,h,e.next_out-h):GM(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},UM.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},UM.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},UM.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&&GM(1,t,i,0)!==r.check?-3:rU(e,t,i,i)?(r.mode=31,-4):(r.havedict=1,0):-2},UM.inflateInfo="pako inflate (from Nodeca project)";var iU={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 nU=UM,oU=nk,aU=pM,sU=iU,cU=Kk,uU=EM,dU=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},lU=Object.prototype.toString;function hU(e){if(!(this instanceof hU))return new hU(e);this.options=oU.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 uU,this.strm.avail_out=0;var r=nU.inflateInit2(this.strm,t.windowBits);if(r!==sU.Z_OK)throw new Error(cU[r]);if(this.header=new dU,nU.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=aU.string2buf(t.dictionary):"[object ArrayBuffer]"===lU.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=nU.inflateSetDictionary(this.strm,t.dictionary))!==sU.Z_OK))throw new Error(cU[r])}function pU(e,t){var r=new hU(t);if(r.push(e,!0),r.err)throw r.msg||cU[r.err];return r.result}hU.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?sU.Z_FINISH:sU.Z_NO_FLUSH,"string"==typeof e?s.input=aU.binstring2buf(e):"[object ArrayBuffer]"===lU.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 oU.Buf8(c),s.next_out=0,s.avail_out=c),(r=nU.inflate(s,sU.Z_NO_FLUSH))===sU.Z_NEED_DICT&&u&&(r=nU.inflateSetDictionary(this.strm,u)),r===sU.Z_BUF_ERROR&&!0===d&&(r=sU.Z_OK,d=!1),r!==sU.Z_STREAM_END&&r!==sU.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==sU.Z_STREAM_END&&(0!==s.avail_in||i!==sU.Z_FINISH&&i!==sU.Z_SYNC_FLUSH)||("string"===this.options.to?(n=aU.utf8border(s.output,s.next_out),o=s.next_out-n,a=aU.buf2string(s.output,n),s.next_out=o,s.avail_out=c-o,o&&oU.arraySet(s.output,s.output,n,o,0),this.onData(a)):this.onData(oU.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!==sU.Z_STREAM_END);return r===sU.Z_STREAM_END&&(i=sU.Z_FINISH),i===sU.Z_FINISH?(r=nU.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===sU.Z_OK):i!==sU.Z_SYNC_FLUSH||(this.onEnd(sU.Z_OK),s.avail_out=0,!0)},hU.prototype.onData=function(e){this.chunks.push(e)},hU.prototype.onEnd=function(e){e===sU.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=oU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},NM.Inflate=hU,NM.inflate=pU,NM.inflateRaw=function(e,t){return(t=t||{}).raw=!0,pU(e,t)},NM.ungzip=pU;var fU={};(0,nk.assign)(fU,ok,NM,iU);var _U,vU,mU,SU,yU,EU,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,WU,XU,YU,JU,qU,QU,ZU,$U,eL,tL,rL,iL,nL,oL,aL,sL,cL=fU,uL=new xP("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"}(_U||(_U={})),function(e){e.RTC="rtc"}(vU||(vU={})),function(e){e.W_5="5"}(mU||(mU={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(SU||(SU={})),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"}(yU||(yU={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(EU||(EU={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(gU||(gU={})),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"}(bU||(bU={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(TU||(TU={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(IU||(IU={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(RU||(RU={})),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"}(AU||(AU={})),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"}(CU||(CU={})),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"}(OU||(OU={})),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"}(NU||(NU={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(wU||(wU={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(DU||(DU={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(PU||(PU={})),function(e){e.W_0="0",e.W_1="1"}(kU||(kU={})),function(e){e.UP="up",e.DOWN="down"}(MU||(MU={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(UU||(UU={})),function(e){e.UP="up",e.DOWN="down"}(LU||(LU={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(xU||(xU={})),function(e){e.W_0="0",e.W_1="1"}(VU||(VU={})),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"}(FU||(FU={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(BU||(BU={})),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"}(jU||(jU={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(GU||(GU={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(HU||(HU={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(zU||(zU={})),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"}(KU||(KU={})),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"}(WU||(WU={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(XU||(XU={})),function(e){e.BEGIN="begin",e.END="end"}(YU||(YU={})),function(e){e.BEGIN="begin",e.END="end"}(JU||(JU={})),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"}(qU||(qU={})),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"}(QU||(QU={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(ZU||(ZU={})),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"}($U||($U={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(eL||(eL={})),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"}(tL||(tL={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(rL||(rL={})),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"}(iL||(iL={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(nL||(nL={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(oL||(oL={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(aL||(aL={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(sL||(sL={}));var 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),sP()||window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(null,!0)})),t}return Q_(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=XL.LOG_SERVER_URL;if(n.open("POST",o,!0),e||(this.posting=!0),!sP()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",i),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!sP()&&location.search.includes("_rtc_debug_"))n.send(JSON.stringify(i));else{var a=cL.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,y=t.aid,E=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:y,device_model:E,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=Z_(Z_({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message: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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcGetAccess=function(e,t,r,i,n,o,a){void 0===a&&(a={});var s=Z_(Z_({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse: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=Z_(Z_({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcNodeChange=function(e,t,r,i){void 0===i&&(i={});var n=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id: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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.firstRemoteVideoRender=function(e,t,r){void 0===r&&(r={});var i=Z_(Z_({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcPublishStat=function(e,t,r,i,n){void 0===n&&(n={});var o=Z_(Z_({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start: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=Z_(Z_({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=Z_(Z_({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=Z_(Z_(Z_(Z_({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcMessageStatistics=function(e,t,r,i){void 0===i&&(i={});var n=Z_(Z_(Z_(Z_(Z_({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=Z_(Z_({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcInvokeStatus=function(e,t,r,i,n,o){void 0===o&&(o={});var a=Z_(Z_({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name: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=Z_(Z_(Z_({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});uL.print("rtcFirstFrame",JSON.stringify(e)),this.push(r)},t.prototype.rtcMuteRemote=function(e,t,r){void 0===r&&(r={});var i=Z_(Z_(Z_(Z_({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=Z_(Z_({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.joinRoom=function(e,t,r,i,n){void 0===n&&(n={});var o=Z_(Z_({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result: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=Z_(Z_({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id: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=Z_(Z_({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(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=Z_(Z_({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=Z_(Z_({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var r=Z_(Z_(Z_({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(r)},t.prototype.rtcEncodeFirstFrame=function(e,t,r){void 0===r&&(r={});var i=Z_(Z_(Z_(Z_({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcFirstFrameEncoded=function(e,t,r){void 0===r&&(r={});var i=Z_(Z_(Z_(Z_({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcSendFirstPacket=function(e,t,r){void 0===r&&(r={});var i=Z_(Z_(Z_(Z_({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcRecvFirstPacket=function(e,t,r){void 0===r&&(r={});var i=Z_(Z_(Z_(Z_({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcRecvFirstFrame=function(e,t,r){void 0===r&&(r={});var i=Z_(Z_(Z_(Z_({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcDecodeFirstFrame=function(e,t,r){void 0===r&&(r={});var i=Z_(Z_(Z_(Z_({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t}(FP),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 yL(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(hP(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(hP([t||{}]))),t})).catch((function(t){throw SL[e].rtcSdkCallback(i,t.code,JSON.stringify(t.message)),t})):(SL[e].rtcSdkCallback(i,0,JSON.stringify(hP([s||{}]))),s)}}}}function EL(e,t,r){void 0===r&&(r=0),(e===pP.onUserMessageReceivedOutsideRoom||e===pP.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)}var bL=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}(),TL=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Q_(t,e),t.prototype.getDeviceId=function(){if(sP())return"";var e=this.get("RTC_DEVICE_ID");return e||(e=tP()),this.set("RTC_DEVICE_ID",e),e},t.prototype.setDeviceId=function(e){return[_L,vL,mL].forEach((function(t){return t.setStats({device_id:e})})),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.prototype.getAudioProfile=function(){return this.get("engine_BAC")},t.prototype.setAudioProfile=function(e){return this.set("engine_BAC",e)},t}(bL),IL=new TL,RL="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function AL(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var CL="rtc.rtcplus.com".split(","),OL={VERSION:"4.44.3",ICE_CONFIG_REQUEST_URLS_INTERNAL:RL.map(AL),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:"https://web-log-report.rtcplus.com/video/v1/webrtc_log/",CONFIG_REQUEST_DOMAINS:CL,DEVICE_ID:""};function NL(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(OL.ICE_CONFIG_REQUEST_URLS=t.map(AL))):void("LOG_SERVER_URL"!==e||t!==RD.overseas?"LOG_SERVER_URL"!==e||t!==RD.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?("DEVICE_ID"===e&&IL.setDeviceId(t),OL[e]=t):OL.LOG_SERVER_URL=t:OL.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/":OL.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function wL(e){return"DEVICE_ID"===e?IL.getDeviceId():OL[e]}function DL(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},control:{protocol:"2.0"},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||zL.audio.codec,bitRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.kBitRate)||zL.audio.kBitRate),sampleRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.sampleRate)||zL.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||zL.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||zL.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||zL.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||zL.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||zL.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:zL.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||zL.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||zL.video.width,height:(null===(f=t.video)||void 0===f?void 0:f.height)||zL.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||zL.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)||zL.layout.appData}}}}function PL(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)||OD.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 kL,ML,UL,LL,xL,VL,FL,BL,jL,GL,HL,zL={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"}},KL={width:640,height:360,frameRate:30,maxKbps:600},WL={width:1920,height:1080,frameRate:15,maxKbps:3e3},XL=OL;!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"}(kL||(kL={})),function(e){e.PushLimitWarn="PushLimitWarn"}(ML||(ML={})),function(e){e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire",e.STREAM_CONTROL_MESSAGE="streamControlMessage",e.ON_SCENE_CONFIG="onSceneConfig"}(UL||(UL={})),function(e){e.RSCP="RSCP"}(LL||(LL={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(xL||(xL={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(VL||(VL={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(FL||(FL={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(jL||(jL={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(GL||(GL={})),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"}(HL||(HL={}));var YL,JL,qL=((BL={})[HL.SUCCESS]=[0,"success"],BL[HL.TIMEOUT]=[QN.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],BL[HL.BROKEN]=[QN.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],BL[HL.NO_RECEIVER]=[QN.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],BL[HL.NO_RELAYPATH]=[QN.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],BL[HL.SEND_TO_SERVER_ERROR]=[QN.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],BL[HL.SERVER_RESPONSE_ERROR]=[QN.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],BL[HL.NOT_JOIN]=[QN.USER_MESSAGE_NOT_JOIN,"not join room"],BL[HL.INIT]=[QN.USER_MESSAGE_INIT,"not init."],BL[HL.NO_CONNECTION]=[QN.USER_MESSAGE_NO_CONNECTION,"no connection."],BL[HL.EXCEED_MAX_LENGTH]=[QN.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],BL[HL.EMPTY_USER]=[QN.USER_MESSAGE_EMPTY_USER,"user id is empty."],BL[HL.NOT_LOGIN]=[QN.USER_MESSAGE_NOT_LOGIN,"not login."],BL[HL.SERVER_PARAMS_NOTSET]=[QN.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],BL[HL.UNKNOWN]=[QN.USER_MESSAGE_UNKNOWN,"unknown."],BL),QL=new xP("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(YL||(YL={})),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"}(JL||(JL={}));var ZL=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 Q_(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",wU.UP),new Promise((function(n,o){var a=i._genHeader(r);a.id=uP();var s=a.id.join("-"),c=setTimeout((function(){i._singlingCache.delete(s),o(new tw(QN.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)}}),QL.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),i._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:JL.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=[Z_({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:jL.SEND,type:GL.P2P,err:HL.SUCCESS},i)],s={binary:e},e?[4,cP.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,[Z_.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var r=this;return void 0===t&&(t={}),lP(e.msg)?this._rttIds[e.id]=e.id:e.dir===jL.SEND&&QL.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(i,n){var o=r._genHeader(Z_(Z_({needAck:!0,functionType:JL.C2C},t),{id:uP()}));if(e.dir===jL.SEND){var a=setTimeout((function(){r._p2pCache.delete(e.id),n(new tw(QN.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(qL[e.err]||[QN.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(QN.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=cP.str2ab(JSON.stringify([e,r])),a=aP(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===YL.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:YL.ACK,id:e.split("-").map((function(e){return+e}))});QL.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,y,E,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 cL.Inflate).push(o,!0),o=a.result),s=cP.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&hL.rtcSignalingMsgError(-1,e.message,OU.MESSAGE_PARSE_FAILED),[2]}switch(n.functionType){case JL.C2S:return[3,1];case JL.C2C:return[3,6];case JL.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=n.id)||void 0===t?void 0:t.join("-"))||"",n.direction!==YL.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],QL.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,cP.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=V.sent(),V.label=4;case 4:this.emit(d,Z_({},c)),hL.rtcSignaling(0,s,"on-".concat(d),"Recv",wU.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)===jL.FEEDBACK||lP(null==c?void 0:c.msg)?delete this._rttIds[h]:QL.print("Signal","<<<<<< p2p response",c),c.dir){case jL.SEND:return[3,7];case jL.FEEDBACK:return[3,16]}return[3,17];case 7:return lP(null==c?void 0:c.msg)?[3,15]:(f=(p=c).binary,_=p.msg,v=p.room,m=p.to,S=p.from,y=""===v?f?UL.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:UL.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:f?UL.USER_BINARY_MESSAGE_RECEIVED:UL.USER_MESSAGE_RECEIVED,m?[3,11]:(E=this.emit,g=[UL.ON_CUSTOM_MESSAGE],L={clientId:S,binary:f},f?[4,cP.b64str2ab(_)]:[3,9]));case 8:return b=V.sent(),[3,10];case 9:b=_,V.label=10;case 10:return E.apply(this,g.concat([(L.message=b,L)])),[3,15];case 11:return T=this.emit,I=[y],R=[Z_({},c)],x={},f?[4,cP.b64str2ab(_)]:[3,13];case 12:return A=V.sent(),[3,14];case 13:A=_,V.label=14;case 14:T.apply(this,I.concat([Z_.apply(void 0,R.concat([(x.msg=A,x)]))])),V.label=15;case 15:return this._sendP2PMessage(Z_(Z_({},c),{dir:jL.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===HL.SUCCESS?C.success(c.id):C.error(c)),[3,17];case 17:return[3,19];case 18:if(n.direction===YL.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",wU.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){QL.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){QL.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={}),Z_({version:2,zip:!1,encrypt:!1,needAck:!0,direction:YL.SEND,functionType:JL.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),QL.print("Signal","<<<<<< [".concat(i.signalingType,"-ack]"),t)),hL.rtcSignaling(0,r,null==i?void 0:i.signalingType,"Ack",wU.DOWN)},t}(MP.exports.EventEmitter),$L=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"})},t.timeout&&(d.timeout=t.timeout),u&&(o=JSON.stringify(o)),d.send(o),t.xhr=d}))},e.prototype.get=function(e,t){return this.ajax({method:"GET",url:e,headers:t})},e.prototype.post=function(e,t,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}(),ex=new xP("ICE Request",3),tx=function(){function e(){this._request=new $L}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=IL.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,r,i,n,o,a),gL("es.R.node.cache",s),Array.isArray(s)?[2,Promise.resolve(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=IL.getAccessUrls(),c=!0,gL("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=XL.ICE_CONFIG_REQUEST_URLS,c=!1,gL("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=XL.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;return IL.setAccessNode(e,r,t.ttl||11200),t.dispatchDomains&&IL.setAccessUrls(t.dispatchDomains),r})).catch((function(s){if(c)return gL("es.R.req.fallback",""),IL.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:nP(),os:"web",sdkVersion:XL.VERSION,expectedAddr:wL("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:"NODE_CHANGED",reason:o}}],delete r.expectedAddr),u=Date.now(),hL.rtcGetAccess(0,JSON.stringify(r),0,AU.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(QN.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==i.code)throw new tw(QN.ICE_SERVER_WRONG,"get ICE config failed",{server_code:i.code,message:JSON.stringify(i)});if(!(o=i.nodes[0]))throw new tw(QN.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,vP(d).then((function(t){var i=t.result;t.firstNode;var n=t.index;return hL.rtcGetAccess(200,JSON.stringify(i),Date.now()-u,AU.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,AU.RESPONSE,e.join(","),r.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(ex.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),rx=function(){function e(){this._request=new $L}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.44.3",deviceType:"web"};this._request.timeout=800;var r=XL.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));hL.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),gU.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(QN.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new tw(QN.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:i}]}}))}))}));return new Promise((function(e){vP(i).then((function(t){var i=t.result,n=t.index;IL.setH264BlackList(i.web_h264_black_list),hL.rtcGetConfig(200,JSON.stringify(i),0,r[n],gU.RESPONSE,"",!1),e(i.web_h264_black_list)})).catch((function(t){hL.rtcGetConfig(500,t.message,0,"",gU.RESPONSE,"",!1),e(IL.getH264BlackList()||[])}))}))},e.prototype.getAudioProfile=function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.44.3",deviceType:"web"},r=XL.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));hL.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),gU.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(QN.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.engine_BAC))throw new tw(QN.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:i}]}}))}))}));return new Promise((function(e){vP(i).then((function(t){var i=t.result,n=t.index;IL.setAudioProfile(i.engine_BAC),hL.rtcGetConfig(200,JSON.stringify(i),0,r[n],gU.RESPONSE,"",!1),e(i.engine_BAC)})).catch((function(t){hL.rtcGetConfig(500,t.message,0,"",gU.RESPONSE,"",!1),e(IL.getAudioProfile()||[])}))}))},e}(),ix={},nx={},ox={exports:{}},ax=ox.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(ax).forEach((function(e){ax[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=ox.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}}))}))}}(nx);var sx=ox.exports,cx=/%[sdv%]/g,ux=function(e){var t=1,r=arguments,i=r.length;return e.replace(cx,(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""}}))},dx=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 ux.apply(null,i)},lx=["v","o","s","i","u","e","p","c","b","t","r","z","a"],hx=["i","c","b","a"],px=nx,fx=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||lx,i=t.innerOrder||hx,n=[];return r.forEach((function(t){sx[t].forEach((function(r){r.name in e&&null!=e[r.name]?n.push(dx(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){n.push(dx(t,r,e))}))}))})),e.media.forEach((function(e){n.push(dx("m",sx.m[0],e)),i.forEach((function(t){sx[t].forEach((function(r){r.name in e&&null!=e[r.name]?n.push(dx(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){n.push(dx(t,r,e))}))}))}))})),n.join("\r\n")+"\r\n"},_x=ix.write=fx,vx=ix.parse=px.parse;ix.parseParams=px.parseParams,ix.parseFmtpConfig=px.parseFmtpConfig,ix.parsePayloads=px.parsePayloads,ix.parseRemoteCandidates=px.parseRemoteCandidates,ix.parseImageAttributes=px.parseImageAttributes,ix.parseSimulcastStreamList=px.parseSimulcastStreamList;var mx=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this._iceConfigNode.iceParams,i=ix.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"})),ix.write(i)},e}(),Sx=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,Tx(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=ix.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)})),ix.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=bx(r)),e.candidates=this._candidates,e.iceOptions="renomination","application"===e.type&&(e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144})},e}();function yx(e,t){var r,i=ix.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 Ex=function(e,t,r){var i,n;try{var o=ix.parse(e),a=ix.parse(t),s="".concat(null===(i=a.groups)||void 0===i?void 0:i[0].mids).split(" "),c="".concat(null===(n=o.groups)||void 0===n?void 0:n[0].mids).split(" "),u={};s.forEach((function(e){return u[e]=e}));var d={};c.forEach((function(e){u[e]||(d[e]=e)}));var l="",h="";return o.media=o.media.filter((function(e){return d[e.mid]&&"audio"===e.type?l="".concat(e.mid):d[e.mid]&&"video"===e.type&&(h="".concat(e.mid)),d[e.mid]})),delete o.groups,delete o.msidSemantic,o.invalid=[{value:"realx-exts:rscp"}],{partialSdp:ix.write(o),audioMid:l,videoMid:h}}catch(e){return null}},gx=function(e,t){var r;try{var i=ix.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,ix.write(i)}catch(e){return""}},bx=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(Z_(Z_({},n),{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){i.push(Z_(Z_({},n),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),i},Tx=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,cP.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=aP(Uint8Array,r,i,o,a),[4,cP.ab2b64str(s.buffer)];case 2:return[2,c.sent()]}}))}))};function Ix(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 Z_(Z_({},i),{scaleResolutionDownBy:r})}var Rx=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],Ax=[{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 Cx={width:160,height:90,frameRate:15,maxkbps:100},Ox={width:480,height:270,frameRate:30,maxkbps:400};function Nx(e){if(!e.length)return[];var t=e.shift(),r=t.width/t.height,i=0,n=0,o=Z_(Z_({},t),{video_index:n,sub_index:i++});delete o.rid;for(var a=[o],s=0,c=0;c<Rx.length;c++)if(Rx[c].height<t.height){s=c;break}var u=e.shift();for(c=s;c<Rx.length;c++){var d=Rx[c];if(u&&d.height<=(null==u?void 0:u.height)){var l=d.height===(null==u?void 0:u.height),h=Z_(Z_({},u),{video_index:++n,sub_index:i++});if(delete h.rid,a.push(h),u=e.shift(),l)continue}a.push(Z_(Z_({},d),{width:Math.floor(d.height*r),video_index:n,sub_index:i++}))}return a}var wx,Dx,Px,kx,Mx,Ux="chrome-stable"===(wx="none",sP()||(null!==window.navigator.userAgent.match("Firefox")?wx="mozilla":null!==window.navigator.userAgent.match("Chrome")?(wx="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(wx="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(wx="safari")),wx);!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"}(Dx||(Dx={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(Px||(Px={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(kx||(kx={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(Mx||(Mx={}));var Lx,xx,Vx,Fx=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 Dx.candidatePair:r=t.handleCandidatePair;break;case Dx.certificate:r=t.handleCertificate;break;case Dx.remoteCandidate:r=t.handleRemoteCandidate;break;case Dx.remoteInboundRtp:r=t.handleInboundRtp;break;case Dx.remoteOutboundRtp:r=t.handleOutboundRtp;break;case Dx.sctpTransport:r=t.handleSctpTransport;break;case Dx.sender:r=t.handleSender;break;case Dx.stream:r=t.handleStream;break;case Dx.track:r=t.handleTrack;break;case Dx.transceiver:r=t.handleTransceiver;break;case Dx.transport:r=t.handleTransport;break;case Dx.codec:r=t.handleCodec;break;case Dx.csrc:r=t.handleCsrc;break;case Dx.dataChannel:r=t.handleDataChannel;break;case Dx.iceServer:r=t.handleIceServer;break;case Dx.mediaSource:r=t.handleMediaSource;break;case Dx.outboundRtp:r=t.handleOutboundRtp;break;case Dx.inboundRtp:r=t.handleInboundRtp;break;case Dx.peerConnection:r=t.handlePeerConnection;break;case Dx.receiver:r=t.handleReceiver;break;case Dx.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(!Ux||void 0!==window.InstallTrigger)return r(t.stats);try{t.peer.getStats((function(i){i.result().forEach((function(r){if(!Bx.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}(),Bx=["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"],jx=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 Fx(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"}(Lx||(Lx={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(xx||(xx={})),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"}(Vx||(Vx={}));var Gx,Hx=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(Gx)return[2,Gx];e=[],s.label=1;case 1:return s.trys.push([1,5,,6]),[4,_P()];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 rx).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"),Gx=e,[2,e];case 5:return s.sent(),[2,e];case 6:return[2]}}))}))},zx=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},Kx=new xP("BasicHandler",3),Wx=zx(),Xx={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!Wx||void 0},Yx=function(e){function t(t,r){var i=e.call(this)||this;return i.monitor=t,i._peerConnection=new RTCPeerConnection(Xx),i._dataChannel=i._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),i._context=r,i._dataChannel.binaryType="arraybuffer",i._peerConnection.ontrack=function(e){var t,r;Kx.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(r=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===r?void 0:r.id)),i.emit("ontrack",e)},i._peerConnection.onconnectionstatechange=function(e){Kx.print("constructor","onconnectionstatechange ".concat(i._peerConnection.iceConnectionState," -> ").concat(i._peerConnection.connectionState)),"failed"!==i._peerConnection.iceConnectionState&&"closed"!==i._peerConnection.iceConnectionState&&"failed"!==i._peerConnection.connectionState||i.emit("disconnect")},i._peerConnection.oniceconnectionstatechange=function(){var e=i._peerConnection.iceConnectionState;t.rtcPreIceState(e,CU["".concat(e.toUpperCase())])},i}return Q_(t,e),t.prototype.connect=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 Kx.print("connect","invoke connect"),[4,this._peerConnection.createOffer()];case 1:return r=a.sent(),this._localSdp=new mx(e),[4,this.setLocalDescription(r.sdp)];case 2:return a.sent(),(i=null===(t=this._peerConnection)||void 0===t?void 0:t.sctp)&&(i.onstatechange=function(){o.monitor.rtcInvokeStatus("sctp state change TO: ".concat(i.state),0,"sctp","",0)},i.transport&&(i.transport.onstatechange=function(){var e;o.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null===(e=null==i?void 0:i.transport)||void 0===e?void 0:e.state),0,"dtls","",0)})),this._remoteSdp=new Sx(e),[4,this._remoteSdp.getServerUfrag()];case 3:return a.sent(),n=this._remoteSdp.modifyByIceNode(r.sdp),[4,this.setRemoteDescription(n)];case 4:return a.sent(),[4,new Promise((function(e,t){o._dataChannel.onopen=function(){Kx.print("connect","dataChannel open"),gL("es.dc.open",""),e("")},o._dataChannel.onerror=function(e){hL.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,OU.INVALID_DATA),gL("es.dc.error",""),t(e)},o._dataChannel.onclose=function(e){gL("es.dc.close",""),t(e)},o._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==o._peerConnection.iceConnectionState&&"closed"!==o._peerConnection.iceConnectionState&&"failed"!==o._peerConnection.connectionState||t(e)}))}))];case 5:return a.sent(),Kx.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,this._context=void 0},t.prototype._simulcast=function(e,t,r,i,n){var o=[],a=function(e){for(var t=0,r=e.width*e.height,i=0;i<Ax.length;i++)if(r>=Ax[i].totalPixels){t=i;break}if(0===t)return Ax[t].maxLayers;var n=Ax[t-1].totalPixels;return(n-r)/(n-Ax[t].totalPixels)<.1?Ax[t-1].maxLayers:Ax[t].maxLayers}(t);Kx.print("simulcast() ","maxLayers: %o",a),1===e.videoEncodeConfig.length?(o=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/Cx.width,n=e.width/Ox.width):(i=e.height/Cx.height,n=e.height/Ox.height),r.push({maxkbps:Cx.maxkbps,scaleResolutionDownBy:i,frameRate:Cx.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),t<=2||i>2&&r.unshift({maxkbps:Ox.maxkbps,scaleResolutionDownBy:n,frameRate:Ox.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),r}(r,a),Kx.print("simulcast() ","simulcastLayers: %o",o)):(o=e.videoEncodeConfig.slice(1).slice(1-a).map((function(e){return Z_({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},Ix(r,e))})),Kx.print("simulcast() ","simulcastLayers2: %o",o)),o.forEach((function(e,t){var r={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:e.scaleResolutionDownBy,rid:"".concat(t+1),maxFramerate:e.frameRate};i.sendEncodings&&i.sendEncodings.unshift(r),n.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))},t.prototype.publish=function(e,t){var r,i;return ev(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,y,E,g,b,T,I,R,A,C,O,N,w,D,P,k;return tv(this,(function(M){switch(M.label){case 0:return n=e.stream,o=e.videoTrack,a=e.audioTrack,s=e.enableSimulcast,c=e.pubAudio,u=e.pubVideo,d={},l=[],h=[],Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length&&(p=null==o?void 0:o.getTrack(),f={width:640,height:360,frameRate:30},p&&(_=null==p?void 0:p.getSettings(),f={width:Math.floor(_.width),height:Math.floor(_.height),frameRate:Math.floor(_.frameRate)}),v=null==e?void 0:e.videoEncodeConfig[0],m=Ix(f,v),e.prevScaleResolutionDownBy=m.scaleResolutionDownBy,e.videoInputConfig=f,S={maxBitrate:1e3*v.maxKbps,scaleResolutionDownBy:m.scaleResolutionDownBy,rid:"0",maxFramerate:v.frameRate||15},d.sendEncodings=[S],l.push({width:m.width,height:m.height,framerate:v.frameRate,maxkbps:v.maxKbps,rid:"0"}),s&&(this._simulcast(e,m,f,d,l),(null==t?void 0:t.simulcastOnDemand)&&(h=Nx(nv([],iv(l),!1))),Kx.print("subVideoDesc","desc: %o ",h))),Kx.print("publish videoTransceiverInit videoDescriptions","",d,l),y=null==a?void 0:a.getTrack(),(null==a?void 0:a.mixType)!==xx.PLAYOUT&&(null==a?void 0:a.mixedAudioTrack)&&(y=null==a?void 0:a.mixedAudioTrack),e.audioTransceiver=this._peerConnection.addTransceiver(c&&y?y:"audio",{direction:"sendonly",streams:[n]}),E=e.audioTransceiver,(null==t?void 0:t.audioRed)&&(null===(r=window.RTCRtpSender)||void 0===r?void 0:r.getCapabilities)&&E.setCodecPreferences&&(Kx.print("publish","publish audio red is true"),(g=((null===(i=window.RTCRtpSender)||void 0===i?void 0:i.getCapabilities("audio"))||{}).codecs)&&(b=g.findIndex((function(e){return"audio/red"===e.mimeType})),T=iv(g.splice(b,1),1),I=T[0],g.unshift(I),E.setCodecPreferences(g),Kx.print("publish","audio preferences codecs",g))),Wx&&e.initAudioEncodedTransform(),R=null==o?void 0:o.getTrack(),e.videoTransceiver=this._peerConnection.addTransceiver(u&&R?R:"video",Z_({direction:"sendonly",streams:[n]},d)),Wx&&e.initVideoEncodedTransform(),Kx.print("sender.getParameters()",e.videoTransceiver.sender.getParameters()),A=oP(),hL.rtcBeginCreateOffer(DU.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:if(C=M.sent(),O=vx(C.sdp),N=O.media.find((function(e){return"audio"===e.type})),(w=null==N?void 0:N.rtp.find((function(e){return"opus"===e.codec})))&&N&&(D=N.fmtp.find((function(e){return e.payload===w.payload})))&&this._context&&(D.config+=this._context.audioProfileManager.getOpusConfigStr()),P=_x(O),hL.rtcCreateOffer(0,PU.UP,e.streamId,e.userId,oP()-A),k=Ex(P,this.getLocalDescriptionSdp(),this._context),!C.sdp||!k)throw new tw(QN.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Z_(Z_({sdp:P},k),{type:"incroffer",semantics:"unified-plan",videoDescriptions:l,subVideoDescriptions:h})]}}))}))},t.prototype.updateScaleResolutionDownBy=function(e){var t,r,i;return ev(this,void 0,void 0,(function(){var n,o,a,s,c,u,d;return tv(this,(function(l){return Kx.print("updateScaleResolutionDownBy()"),n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver,n&&e.pubVideo&&o?(a=null==n?void 0:n.getSettings(),s={width:Math.floor(a.width),height:Math.floor(a.height),frameRate:Math.floor(a.frameRate)},(c=Ix(s,e.videoEncodeConfig[0])).scaleResolutionDownBy===e.prevScaleResolutionDownBy&&Kx.print("updateScaleResolutionDownBy()","no change %o",e.prevScaleResolutionDownBy),(u=null===(r=o.sender)||void 0===r?void 0:r.getParameters())&&(d=c.scaleResolutionDownBy/e.prevScaleResolutionDownBy,u.encodings=null===(i=null==u?void 0:u.encodings)||void 0===i?void 0:i.map((function(t){var r;Math.max(t.scaleResolutionDownBy=(t.scaleResolutionDownBy||1)*d,1);var i=+t.rid||0;return t.maxFramerate=(null===(r=e.videoEncodeConfig[i])||void 0===r?void 0:r.frameRate)||t.maxFramerate,t})),e.prevScaleResolutionDownBy=c.scaleResolutionDownBy,e.videoInputConfig=s,null==o||o.sender.setParameters(u)),[2]):(Kx.print("updateScaleResolutionDownBy()","no pub"),[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:gx(this.getLocalDescriptionSdp(),[t.audioMid,t.videoMid]),audioMid:t.audioMid,videoMid:t.videoMid,type:r,semantics:i}]:(e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),Wx&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),Wx&&e.initVideoEncodedTransform(),n=oP(),hL.rtcBeginCreateOffer(DU.DOWN,e.streamId,e.userId),[4,this._peerConnection.createOffer()]);case 1:if(o=s.sent(),hL.rtcCreateOffer(0,PU.DOWN,e.streamId,e.userId,oP()-n),a=Ex(o.sdp,this.getLocalDescriptionSdp()),!o.sdp||!a)throw new tw(QN.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Z_(Z_({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,UU.INCRANSWER,0,t,n,i.streamId,i.userId),a=this._peerConnection.remoteDescription,s=ix.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}),{}),ix.parse(t).media.forEach((function(e){return c[e.mid]=e})),u=[],d=ix.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(ix.write(d),i,n)];case 1:return p.sent(),[4,this.setRemoteDescription(ix.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=oP(),c=r||MU.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]),Kx.print("setOffer","set offer: ",a),[4,this._peerConnection.setLocalDescription(a)];case 2:return h.sent(),hL.rtcSetDescription(0,a.sdp,kU.W_1,c,u,d,oP()-s,{type:"offer"}),[3,4];case 3:throw(l=h.sent())instanceof Error&&hL.rtcSetDescription(-1,l.message,kU.W_1,c,u,d,oP()-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=oP(),a=r||MU.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]),Kx.print("setAnswer","set answer: ",n),[4,this._peerConnection.setRemoteDescription(n)];case 2:return d.sent(),hL.rtcSetDescription(0,n.sdp,kU.W_0,a,s,c,oP()-o,{type:"answer"}),[3,4];case 3:throw(u=d.sent())instanceof Error&&hL.rtcSetDescription(-1,u.message,kU.W_0,a,s,c,oP()-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 Kx.print("closeMids","closeMids: ",e),i=this.getLocalDescriptionSdp(),n=yx(i,e),o=this.getRemoteDescriptionSdp(),a=yx(o,e),[4,this._peerConnection.createOffer()];case 1:return c.sent(),[4,this.setLocalDescription(ix.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(ix.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,_P()];case 1:if(!(e=t.sent()))throw new tw(QN.NOT_SUPPORTED,"Get offer Error");return[2,{sdp:e,semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.getStats=function(e,t){return jx(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 Kx.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}(MP.exports.EventEmitter),Jx=new xP("Locker",2),qx=1,Qx=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=qx++,e&&(this.name=e),Jx.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,Jx.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,Jx.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}(),Zx=T,$x=Ku,eV=Lv.exports.getWeakData,tV=Dt,rV=j,iV=$u,nV=Md,oV=Ue,aV=br.set,sV=br.getterFor,cV=kn.find,uV=kn.findIndex,dV=Zx([].splice),lV=0,hV=function(e){return e.frozen||(e.frozen=new pV)},pV=function(){this.entries=[]},fV=function(e,t){return cV(e.entries,(function(e){return e[0]===t}))};pV.prototype={get:function(e){var t=fV(this,e);if(t)return t[1]},has:function(e){return!!fV(this,e)},set:function(e,t){var r=fV(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=uV(this.entries,(function(t){return t[0]===e}));return~t&&dV(this.entries,t,1),!!~t}};var _V,vV={getConstructor:function(e,t,r,i){var n=e((function(e,n){iV(e,o),aV(e,{type:t,id:lV++,frozen:void 0}),null!=n&&nV(n,e[i],{that:e,AS_ENTRIES:r})})),o=n.prototype,a=sV(t),s=function(e,t,r){var i=a(e),n=eV(tV(t),!0);return!0===n?hV(i).set(t,r):n[i.id]=r,e};return $x(o,{delete:function(e){var t=a(this);if(!rV(e))return!1;var r=eV(e);return!0===r?hV(t).delete(e):r&&oV(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!rV(e))return!1;var r=eV(e);return!0===r?hV(t).has(e):r&&oV(r,t.id)}}),$x(o,r?{get:function(e){var t=a(this);if(rV(e)){var r=eV(e);return!0===r?hV(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}},mV=i,SV=T,yV=Ku,EV=Lv.exports,gV=Im,bV=vV,TV=j,IV=Hv,RV=br.enforce,AV=er,CV=!mV.ActiveXObject&&"ActiveXObject"in mV,OV=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},NV=gV("WeakMap",OV,bV);if(AV&&CV){_V=bV.getConstructor(OV,"WeakMap",!0),EV.enable();var wV=NV.prototype,DV=SV(wV.delete),PV=SV(wV.has),kV=SV(wV.get),MV=SV(wV.set);yV(wV,{delete:function(e){if(TV(e)&&!IV(e)){var t=RV(this);return t.frozen||(t.frozen=new _V),DV(this,e)||t.frozen.delete(e)}return DV(this,e)},has:function(e){if(TV(e)&&!IV(e)){var t=RV(this);return t.frozen||(t.frozen=new _V),PV(this,e)||t.frozen.has(e)}return PV(this,e)},get:function(e){if(TV(e)&&!IV(e)){var t=RV(this);return t.frozen||(t.frozen=new _V),PV(this,e)?kV(this,e):t.frozen.get(e)}return kV(this,e)},set:function(e,t){if(TV(e)&&!IV(e)){var r=RV(this);r.frozen||(r.frozen=new _V),PV(this,e)?MV(this,e,t):r.frozen.set(e,t)}else MV(this,e,t);return this}})}var UV,LV,xV,VV,FV,BV,jV,GV,HV,zV,KV=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),!sP()&&t.refreshDevices(),t}return Q_(t,e),t.prototype.refreshDevices=function(){return ev(this,void 0,void 0,(function(){var e=this;return tv(this,(function(t){switch(t.label){case 0:return navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2];case 1:return t.sent().forEach((function(t){var r;null===(r=e.deviceMap[t.kind])||void 0===r||r.set(t.deviceId,t)})),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(e){var t=r.deviceMap[e.kind].get(e.deviceId);r.deviceMap[e.kind].set(e.deviceId,e),t||(e.kind.includes("video")?r.emit(pP.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&r.emit(pP.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),t.forEach((function(t){e.find((function(e){return e.deviceId===t.deviceId&&e.kind===t.kind}))||(r.deviceMap[t.kind].delete(t.deviceId),t.kind.includes("video")?r.emit(pP.onVideoDeviceStateChanged,{mediaDeviceInfo:t,deviceState:"inactive"}):t.kind.includes("audio")&&r.emit(pP.onAudioDeviceStateChanged,{mediaDeviceInfo:t,deviceState:"inactive"}))})),[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(QN.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(QN.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasAudioPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasAudioPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasAudioPermission]}}))}))},t.prototype.enumerateDevices=function(){return 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))]}}))}))},t.prototype.enumerateAudioCaptureDevices=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())]}}))}))},t.prototype.enumerateVideoCaptureDevices=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.videoinput.values())]}}))}))},t.prototype.enumerateAudioPlaybackDevices=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.audiooutput.values())]}}))}))},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.enumerateDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},Object.defineProperty(t.prototype,"hasAudioPermission",{get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new tw(QN.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(QN.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}(FP),WV=new KV,XV=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}(),YV=function(){function e(e){var t=JV.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,this._ctx=t}return e.prototype.getAudioLevel=function(){var e;"suspended"===(null===(e=this._ctx)||void 0===e?void 0:e.state)&&this._ctx.resume();var t=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(t);var r=0;return t.forEach((function(e){return r=Math.max(r,Math.abs(e-128))})),r/128*255},e.prototype.destroy=function(){this._audioSource.disconnect(),this._analyserNode.disconnect()},e}(),JV=new XV,qV=new xP("VERTC",0),QV=new WeakMap,ZV=function(e){return QV.get(e)},$V=function(e){function t(t,r){var i=e.call(this)||this;return i._trackId=t,i.mediaType=r,i}return Q_(t,e),t.prototype.getId=function(){return this._trackId},t}(FP),eF=function(e){function t(t,r,i){var n=e.call(this,r,i)||this;return n._mediaTrack=t,n._initListeners(),n}return Q_(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}($V),tF=function(e){function t(t,r,i){var n=e.call(this,r,i)||this;return n._mediaTrack=t,n}return Q_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}($V),rF=function(e){function t(t,r){var i=e.call(this,t,r,"video")||this;return i.dummy=!1,i}return Q_(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?(qV.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}(eF),iF=function(e){function t(t,r){var i=e.call(this,t,r,"audio")||this;return i.mixType=xx.PLAYOUT_AND_PUBLISH,i}return Q_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new YV(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?(qV.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}(eF),nF=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return Q_(t,e),t}(tF),oF=function(e){function t(t,r){return e.call(this,t,r,"audio")||this}return Q_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new YV(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(tF),aF=function(e){function t(t,r){return e.call(this,t,r)||this}return Q_(t,e),t}(iF),sF=function(e){function t(t,r){return e.call(this,t,r)||this}return Q_(t,e),t}(rF),cF=function(e){function t(t,r){return e.call(this,t,r)||this}return Q_(t,e),t}(rF),uF=function(e){function t(t,r){return e.call(this,t,r)||this}return Q_(t,e),t}(iF),dF=function(e){function t(t,r){return e.call(this,t,r)||this}return Q_(t,e),t}(rF),lF=function(e){function t(t,r){return e.call(this,t,r)||this}return Q_(t,e),t}(iF);function hF(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]),qV.print("createCameraVideoTrack","constraints:",e),hL.rtcVideoCaptureEvent({event_type:tL.START,media_device_id:i}),n=oP(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return r=c.sent(),hL.rtcVideoCaptureEvent({event_type:tL.START_CAPTURE_RESULT,media_device_id:i,reason:iL.SUCCESS,elapse:oP()-n}),WV.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),hL.rtcVideoCaptureEvent({event_type:tL.RUNNING_FAILED,media_device_id:i,error_code:o.code,reason:o.name+o.message}),new tw(QN.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getVideoTracks()[0],QV.set(a,r),(s=new sF(a,nP())).videoCaptureConfig=e,[2,s]}}))}))}function pF(e,t){var r;return ev(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d,l,h,p;return tv(this,(function(f){switch(f.label){case 0:qV.print("createCameraVideoTrack","constraints:",e),n=(null===(r=null==e?void 0:e.deviceId)||void 0===r?void 0:r.exact)||"default",a=(o=t||{}).sampleRate,s=o.channel,c=o.agc,u=o.ans,d=o.aec,void 0===e.sampleRate&&(e.sampleRate=a),void 0===e.channelCount&&(e.channelCount=s),void 0===e.autoGainControl&&(e.autoGainControl=c),void 0===e.noiseSuppression&&(e.noiseSuppression=u),void 0===e.echoCancellation&&(e.echoCancellation=d),f.label=1;case 1:return f.trys.push([1,3,,4]),hL.rtcVideoCaptureEvent({event_type:tL.START,media_device_id:n}),l=oP(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return i=f.sent(),hL.rtcVideoCaptureEvent({event_type:tL.START_CAPTURE_RESULT,media_device_id:n,reason:iL.SUCCESS,elapse:oP()-l}),WV.hasAudioPermission=!0,[3,4];case 3:throw h=f.sent(),hL.rtcVideoCaptureEvent({event_type:tL.RUNNING_FAILED,media_device_id:n,error_code:h.code,reason:h.name+h.message}),new tw(QN.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",h);case 4:return p=i.getAudioTracks()[0],QV.set(p,i),[2,new aF(p,nP())]}}))}))}function fF(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:qV.print("createScreenStream","withAudio:",e),n.label=1;case 1:return n.trys.push([1,3,,4]),hL.rtcVideoCaptureEvent({event_type:tL.START,media_device_id:"screen"}),r=oP(),[4,navigator.mediaDevices.getDisplayMedia({video:!0,audio:e})];case 2:return t=n.sent(),hL.rtcVideoCaptureEvent({event_type:tL.START_CAPTURE_RESULT,media_device_id:"screen",reason:iL.SUCCESS,elapse:oP()-r}),[3,4];case 3:throw i=n.sent(),hL.rtcVideoCaptureEvent({event_type:tL.RUNNING_FAILED,media_device_id:"screen",error_code:i.code,reason:i.name+i.message}),new tw(QN.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",i);case 4:return[2,t]}}))}))}!function(e){e[e.NONE=0]="NONE"}(UV||(UV={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(LV||(LV={})),function(e){e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_PUBLISH_STATE_CHANGE="on_user_publish_state_change",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error",e.ON_NETWORK_QUALITY="on_network_quality",e.ON_SIMULCAST_SUBSCRIBE_FALLBACK="on_simulcast_subscribe_fallback",e.ON_REMOTE_VIDEO_SIZE_CHANGED="on_remote_video_size_changed",e.RECONNECT_FAILED="reconnect_failed"}(xV||(xV={})),function(e){e.TranscodeStateChanged="TranscodeStateChanged",e.TranscodeStarted="TranscodeStarted",e.TranscodeUpdated="TranscodeUpdated",e.TranscodeStoped="TranscodeStoped"}(VV||(VV={})),function(e){e[e.START=1]="START",e[e.START_SUCCESS=2]="START_SUCCESS",e[e.START_FAILED=3]="START_FAILED",e[e.UPDATE=4]="UPDATE",e[e.UPDATE_SUCCESS=5]="UPDATE_SUCCESS",e[e.UPDATE_FAILED=6]="UPDATE_FAILED",e[e.STOP=7]="STOP",e[e.STOP_SUCCESS=8]="STOP_SUCCESS",e[e.STOP_FAILED=9]="STOP_FAILED"}(FV||(FV={})),function(e){e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB"}(BV||(BV={})),function(e){e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB"}(jV||(jV={})),function(e){e[e.communication=0]="communication",e[e.live_broadcasting=1]="live_broadcasting",e[e.game=2]="game",e[e.cloud_game=3]="cloud_game",e[e.low_latency=4]="low_latency",e[e.chat=5]="chat",e[e.chat_room=6]="chat_room",e[e.lw_together=7]="lw_together",e[e.game_hd=8]="game_hd",e[e.co_host=9]="co_host",e[e.interactive_podcast=10]="interactive_podcast",e[e.ktv=11]="ktv",e[e.chorus=12]="chorus",e[e.vr_chat=13]="vr_chat",e[e.game_streaming=14]="game_streaming",e[e.lan_live_streaming=15]="lan_live_streaming",e[e.meeting=16]="meeting",e[e.meeting_room=17]="meeting_room",e[e.classroom=18]="classroom"}(HV||(HV={})),function(e){e.IES_living="IES_living",e.FeedShare="FeedShare",e.fluent="fluent",e.IES_chatroom="IES_chatroom",e.standard="standard",e.IES_PK="IES_PK",e.IES_KTV="IES_KTV"}(zV||(zV={}));var _F=((GV={})[kD.communication]=[HV.communication],GV[kD.chat]=[HV.communication],GV[kD.chatRoom]=[HV.live_broadcasting,zV.IES_chatroom],GV[kD.coHost]=[HV.live_broadcasting,zV.IES_PK],GV[kD.meeting]=[HV.meeting],GV[kD.classRoom]=[HV.communication],GV);Bi({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var vF,mF=function(){function e(e){this._stream=e}return e.prototype.setVar=function(e,t,r){this.client=e,this.handler=t,this.monitor=r},e.prototype.delStatsEvtInterval=function(){clearTimeout(this._timer),this._timer=void 0},e.prototype.destroy=function(){this.delStatsEvtInterval()},e}(),SF=function(e){function t(t){var r=e.call(this,t)||this;return r._stream=t,r}return Q_(t,e),t.prototype.setLocalStreamStatsEvtInterval=function(e,t,r){var i,n,o=this;if(!this._timer){this.setVar(e,t,r),e.once(xL.ABNORMAL_DISCONNECTION,(function(){o.destroy()}));var a={audio:{},video:{}},s=null===(i=this._stream.audioTrack)||void 0===i?void 0:i.getTrack(),c=null===(n=this._stream.videoTrack)||void 0===n?void 0:n.getTrack();this.getAudioStats(s,a),this.getVideoStats(c,a),this.delStatsEvtInterval();this._timer=setTimeout((function e(){return ev(o,void 0,void 0,(function(){var t,r;return tv(this,(function(i){switch(i.label){case 0:return[4,ev(o,void 0,void 0,(function(){var e,t,r,i,n,o;return tv(this,(function(s){switch(s.label){case 0:return e=null===(n=this._stream.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=this._stream.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getAudioStats(e,a)];case 1:return r=s.sent(),[4,this.getVideoStats(t,a)];case 2:return i=s.sent(),[2,{audioStats:r,videoStats:i,isScreen:this._stream.isScreen}]}}))}))];case 1:return t=i.sent(),null===(r=this.client)||void 0===r||r.emit("onLocalStreamStats",t),this._timer=setTimeout(e,2e3),[2]}}))}))}),2e3)}},t.prototype.unpublish=function(){this.delStatsEvtInterval()},t.prototype.getAudioStats=function(e,t){var r;return ev(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d,l,h;return tv(this,(function(p){switch(p.label){case 0:return i={},n={timestamp:Date.now()},o=this._stream,a=o.streamId,s=o.audioMid,c=o.isScreen,u=o.pubAttributes,d={media_type:"audio",is_screen:!!c,direction:"up",stream_id:a,vid:s,connection_status:navigator.onLine,capture_state:u.localaudio?"capture_state_on":"capture_state_off"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(l=p.sent()).length?(l.forEach((function(e){var t=e.type,r=e.packetsSent,o=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,u=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,y=e.currentRoundTripTime,E=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?(n.packetsSent=r,n.bytesSent=a,d.bytes=a,d.packetsSent=r,d.nackCount=M,d.ssrc=F,d.retransmitted_bytes_sent=U,d.retransmitted_packets_sent=L):"remote-inbound-rtp"===t?(n.packetsLost=o,d.packetsLost=o,d.jitter=1e3*C,i.rtt=1e3*c,d.rtt=i.rtt,d.round_trip_time_measurements=x):"codec"===t?(i.recordSampleRate=s,i.numChannels=u,d.codecName=p):"media-source"===t?(d.audio_level=-10*Math.log10(Math.pow(l,2)),d.volume=255*l,d.total_audio_energy=B,d.total_samples_duration=j):"ssrc"===t&&"audio"===G?(d.audio_network_elapse=h,d.send_level=V):"candidate-pair"===t?(d.ice_available_incoming_bitrate=f,d.ice_available_outgoing_bitrate=_,d.ice_bytes_received=v,d.ice_bytes_sent=a,d.ice_nominated=+m,d.ice_pair_id=S,d.ice_pair_rtt=y,d.ice_pair_state=E,d.ice_pair_writable=g,d.recv_ping_requests=b,d.recv_ping_responses=T,d.sent_ping_requests_before_first_response=I,d.sent_ping_requests_total=I+(R||0),d.sent_ping_responses=A):"local-candidate"===t?(d.local_candidate_type=O,d.local_ip=N||w,d.local_network_type=D,d.local_port=P,d.protocol=k):"remote-candidate"===t&&(d.remote_candidate_type=O,d.remote_ip=N||w,d.remote_port=P)})),(h=t.audio).timestamp?(void 0!==n.packetsLost&&(i.audioLossRate=(n.packetsLost-h.packetsLost)/(n.packetsSent-h.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,d.fraction_lost=i.audioLossRate),i.statsInterval=n.timestamp-h.timestamp,d.stats_interval=i.statsInterval,i.sendKBitrate=(n.bytesSent-h.bytesSent||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.sendKBitrate),d.bandwidth=Math.round(d.bitrate/1024),t.audio=n,null===(r=this.monitor)||void 0===r||r.rtcMediaStatistics(d,{}),[2,i]):(t.audio=n,[2,i])):[2,i]}}))}))},t.prototype.getVideoStats=function(e,t){var r,i;return ev(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p,f,_,v,m;return tv(this,(function(S){switch(S.label){case 0:return n={},o={timestamp:Date.now(),simulcast:{}},a=this._stream,s=a.streamId,c=a.videoMid,u=a.isScreen,d=a.pubAttributes,l=a.enableSimulcast,h={media_type:"video",is_screen:!!u,direction:"up",stream_id:s,vid:c,connection_status:navigator.onLine,capture_state:d.localvideo?"capture_state_on":"capture_state_off"},e&&this.handler?(n.isScreen=u,[4,this.handler.getStats(e)]):[2,n];case 1:return(p=S.sent()).length?(f=0,p.forEach((function(e){var t=e.type,r=e.framesEncoded,i=e.packetsLost,a=e.bytesSent,s=e.framesSent,c=e.roundTripTime,u=e.mimeType,d=e.frameWidth,p=e.frameHeight,_=e.packetsSent,v=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,S=e.googAvailableSendBandwidth,y=e.googAvgEncodeMs,E=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,W=e.ssrc,X=e.googTargetEncBitrate,Y=e.googTransmitBitrate,J=e.googRtt,q=e.retransmittedPacketsSent,Q=e.encoderImplementation,Z=e.jitter,$=e.rid;"outbound-rtp"===t?(l&&($?o.simulcast[$]=e:o.simulcast[f]=e,f++),o.framesEncoded=r,o.bytesSent=a,o.framesSent=s,h.bytes=a,o.packetsSent=_,h.packetsSent=_,h.nackCount=L,h.pli_count=x,h.qp_sum=F,h.ssrc=W,h.retransmitted_packets_sent=q,h.encoder_implementation=Q):"track"===t?(n.encodedFrameWidth=d,n.encodedFrameHeight=p,h.frame_size_height=p,h.frame_size_width=d):"remote-inbound-rtp"===t?(o.packetsLost=i,n.rtt=1e3*c,h.rtt=n.rtt,h.jitter=Z,h.packetsLost=i):"codec"===t?(n.codecType=u,h.codecName=u):"candidate-pair"===t?(h.ice_available_incoming_bitrate=T,h.ice_available_outgoing_bitrate=I,h.ice_bytes_received=R,h.ice_bytes_sent=a,h.ice_nominated=+A,h.ice_pair_id=C,h.ice_pair_rtt=O,h.ice_pair_state=N,h.ice_pair_writable=w,h.recv_ping_requests=B,h.recv_ping_responses=j,h.sent_ping_requests_before_first_response=H,h.sent_ping_requests_total=H+z,h.sent_ping_responses=K):"local-candidate"===t?(h.local_candidate_type=D,h.local_ip=P||k,h.local_network_type=M,h.local_port=U,h.protocol=V):"remote-candidate"===t?(h.remote_candidate_type=D,h.remote_ip=P||k,h.remote_port=U):"VideoBwe"===t?(h.encBitratebps=v,h.available_receive_bandwidth=m,h.available_send_bandwidth=S,h.bucket_delay=E,h.retransmitBitratebps=G,h.targetEncBitratebps=X,h.transmit_bitrate=Y):"ssrc"===t&&(h.video_network_elapse=J,h.avg_encode_ms=y,h.encodeUsage=g,h.frame_rate_input=b,h.orignal_input_Framerate=+b)})),(_=t.video).timestamp?(n.statsInterval=o.timestamp-_.timestamp,h.stats_interval=n.statsInterval,v=Object.keys(o.simulcast),l?(h.sim_enc_width=[],h.sim_enc_height=[],h.sim_enc_bps=[],h.sim_enc_framerate=[],h.sim_rids=[],h.sim_enc_bandwidth=[],h.sim_sent_framerate=[],h.sim_fraction_lost=[],m=!1,v.sort((function(e,t){return+e-+t})).forEach((function(e){var t=o.simulcast[e],r=t.frameWidth,i=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,p=t.qualityLimitationDurations,f=t.qualityLimitationResolutionChanges;void 0!==l&&(h.sim_qualityLimitationReason||(h.sim_qualityLimitationReason=[],h.sim_qualityLimitationDurations=[],h.sim_qualityLimitationResolutionChanges=[]),h.sim_qualityLimitationReason.push(l),h.sim_qualityLimitationDurations.push(p),h.sim_qualityLimitationResolutionChanges.push(f));var v=_.simulcast[e];if(h.sim_enc_width.push(r||0),h.sim_enc_height.push(i||0),v){var S=(a-v.bytesSent||0)/n.statsInterval;h.sim_enc_bps.push(Math.round(8e3*S)),h.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var y=1e3*(s-v.framesEncoded)/n.statsInterval;h.sim_enc_framerate.push(Math.round(y)),h.sim_rids.push(e);var E=void 0!==c?c-v.framesSent:s-v.framesEncoded,g=1e3*E/n.statsInterval;h.sim_sent_framerate.push(Math.round(g));var b=(u-v.packetsLost)/(d-v.packetsSent);b=Number.isNaN(b)?0:b,h.sim_fraction_lost.push(b),r>0&&!m&&(n.sentKBitrate=8*S,n.encoderOutputFrameRate=y,n.encodedFrameCount=E,n.sentFrameRate=g,n.videoLossRate=b,m=!0)}})),null===(r=this.monitor)||void 0===r||r.rtcMediaStatistics(h,{})):(n.encodedFrameCount=void 0!==o.framesSent?o.framesSent-_.framesSent:o.framesEncoded-_.framesEncoded,n.sentKBitrate=(o.bytesSent-_.bytesSent||0)/n.statsInterval*8,h.bitrate=Math.round(1e3*n.sentKBitrate),h.bandwidth=Math.round(h.bitrate/1024),n.encoderOutputFrameRate=1e3*(o.framesEncoded-_.framesEncoded)/n.statsInterval,h.frame_rate_encoded=Math.round(n.encoderOutputFrameRate),n.sentFrameRate=1e3*n.encodedFrameCount/n.statsInterval,h.frame_rate_sent=Math.round(n.sentFrameRate),n.videoLossRate=(o.packetsLost-_.packetsLost)/(o.packetsSent-_.packetsSent),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,h.fraction_lost=n.videoLossRate,null===(i=this.monitor)||void 0===i||i.rtcMediaStatistics(h,{})),t.video=o,[2,n]):(t.video=o,[2,n])):[2,n]}}))}))},t}(mF),yF=function(e){function t(t){var r=e.call(this,t)||this;return r._videoInWaiting=!1,r}return Q_(t,e),Object.defineProperty(t,"audioStallConfig",{set:function(e){t.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,t.audioStallRatio=null==e?void 0:e.audio_stall_ratio},enumerable:!1,configurable:!0}),t.prototype.setRemoteStreamStatsEvtInterval=function(e,r,i){var n,o;return ev(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,f,_,v=this;return tv(this,(function(m){switch(m.label){case 0:return this._timer?[2]:(this.setVar(e,r,i),e.once(xL.ABNORMAL_DISCONNECTION,(function(){v.destroy()})),this._audioStallInterval=t.audioStallInterval||100,this._audioStallRatio=t.audioStallRatio||.6,a={audio:{},video:{}},s=null===(n=this._stream.audioTrack)||void 0===n?void 0:n.getTrack(),c=null===(o=this._stream.videoTrack)||void 0===o?void 0:o.getTrack(),this.getRemoteVideoStats(c,a),[4,this.getRemoteAudioStats(s,a)]);case 1:return m.sent(),this.delStatsEvtInterval(),u=0,d=0,h=[],p=0,this._setAudioStallCount=function(){if(v._audioStallInterval>0&&void 0!==a.audio.concealedSamples){var e=a.audio.concealedSamples,t=a.audio.totalSamplesReceived,r=oP(),i={isStall:!1,counted:!1,diff:0},n=.5*v._audioStallInterval;v._audioStallCount=function(){return ev(v,void 0,void 0,(function(){var o,a,s,c,l,f,_,v,m,S,y,E,g,b,T,I;return tv(this,(function(R){switch(R.label){case 0:return o=this._stream,a=o.hasAudio,s=o.subAudio,a&&s?(c=null===(I=this._stream.audioTrack)||void 0===I?void 0:I.getTrack(),l=Date.now(),[4,this.handler.getStats(c,!0)]):(i.isStall=!1,i.counted=!1,h.push({reason:"hasAudio: ".concat(a,", subAudio: ").concat(s)}),[2,{stall_count:u,stall_duration:d,stall_list:h,stats_count:p}]);case 1:return f=R.sent(),_=Date.now(),v=oP(),(m=v-r)<n?(h.push({diff:m,start:r,end:v,get_stats_cost:_-l,get_stats_start:l,get_stats_end:_,reason:"diff(".concat(m,") < minInterval(").concat(n,")")}),[2,{stall_count:u,stall_duration:d,stall_list:h,stats_count:p}]):(S=f.length,y=f.find((function(e){return"inbound-rtp"===e.type})),y?(E=y.concealedSamples,g=y.totalSamplesReceived,T=g-t,(b=E-e)>=0&&T>=0&&b>=this._audioStallRatio*T?(h.push({concealed:b,received:T,diff:m,start:r,end:v,get_stats_cost:_-l,get_stats_start:l,get_stats_end:_,is_stall:!0}),i.isStall?(i.counted?d+=m:(d=d+i.diff+m,u++),i.counted=!0):m>=200?(d+=m,u++,i.counted=!0):(i.counted=!1,i.diff=m),i.isStall=!0):(h.push({concealed:b,received:T,diff:m,start:r,end:v,get_stats_cost:_-l,get_stats_start:l,get_stats_end:_}),i.isStall=!1,i.counted=!1),e=E,t=g,r=v,p++,[2,{stall_count:u,stall_duration:d,stall_list:h,stats_count:p}]):(h.push({diff:m,start:r,end:v,get_stats_cost:_-l,get_stats_start:l,get_stats_end:_,reason:S?"no inbound-rtp":"no report"}),[2,{stall_count:u,stall_duration:d,stall_list:h,stats_count:p}]))}}))}))},l=function(){return ev(v,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),this._audioStallCount?[4,this._audioStallCount()]:[3,2];case 1:e.sent(),this._audioStallTimer=setTimeout(l,this._audioStallInterval),e.label=2;case 2:return[2]}}))}))},v._audioStallTimer=setTimeout(l,v._audioStallInterval)}},this._setAudioStallCount(),f=function(){return ev(v,void 0,void 0,(function(){var e,t,r,i,n,o;return tv(this,(function(s){switch(s.label){case 0:return e=null===(n=this._stream.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=this._stream.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getRemoteAudioStats(e,a)];case 1:return r=s.sent(),u=0,d=0,h=[],p=0,[4,this.getRemoteVideoStats(t,a)];case 2:return i=s.sent(),[2,{audioStats:r,videoStats:i,isScreen:this._stream.isScreen,userId:this._stream.userId}]}}))}))},_=function(){return ev(v,void 0,void 0,(function(){var e,t;return tv(this,(function(r){switch(r.label){case 0:return[4,f()];case 1:return e=r.sent(),null===(t=this.client)||void 0===t||t.emit("onRemoteStreamStats",e),l&&(this._audioStallTimer=setTimeout(l,this._audioStallInterval)),this._timer=setTimeout(_,2e3),[2]}}))}))},this._timer=setTimeout(_,2e3),[2]}}))}))},t.prototype.delStatsEvtInterval=function(){e.prototype.delStatsEvtInterval.call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0},t.prototype.unsubscribe=function(){this.delStatsEvtInterval(),this._videoInWaiting=!1},t.prototype.getRemoteAudioStats=function(e,t){var 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,y,E;return tv(this,(function(g){switch(g.label){case 0:return i={},n={},o=this._stream,a=o.streamId,s=o.userId,c=o.isScreen,u=o.audioMid,d=o.subMediaType,l=o._attributes,h={media_type:"audio",is_screen:!!c,direction:"down",stream_id:a,stream_user_id:s,vid:u,connection_status:navigator.onLine,mute_state:d===gD.AUDIO_AND_VIDEO||d===gD.AUDIO?"mute_state_off":"mute_state_on",remote_user_capture_state:l.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:l.localaudio&&l.audiostream?"mute_state_off":"mute_state_on"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(p=g.sent()).length?(p.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,l=e.totalSamplesReceived,p=e.concealedSamples,f=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,S=e.currentRoundTripTime,y=e.audioLevel,E=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?(n.packetsLost=r,n.packetsReceived=o,h.packetsReceived=o,n.bytesReceived=a,h.bytes=a,void 0!==s&&(i.jitterBufferDelay=s/c*1e3,h.average_jitter_buffer_delay_ms=i.jitterBufferDelay),void 0!==l&&(n.totalSamplesReceived=l,i.concealedSamples=p,n.concealedSamples=p,n.silentConcealedSamples=f,h.concealedSamples=p,i.concealmentEvents=_,h.totalSamplesReceived=l),void 0!==I&&(h.fec_packets_received=I),h.jitter=1e3*D,h.ssrc=z):"codec"===t?(i.recordSampleRate=u,d&&(i.numChannels=d),h.codecName=b):"candidate-pair"===t?(h.ice_available_incoming_bitrate=R,h.ice_available_outgoing_bitrate=A,h.ice_bytes_received=a,h.ice_bytes_sent=C,h.ice_nominated=+O,h.ice_pair_id=N,h.ice_pair_rtt=S,h.rtt=1e3*S,h.ice_pair_state=m,h.ice_pair_writable=w,h.recv_ping_requests=F,h.recv_ping_responses=B,h.sent_ping_requests_before_first_response=j,h.sent_ping_requests_total=j+(G||0),h.sent_ping_responses=H,"succeeded"===m&&(i.rtt=1e3*S,i.total_rtt=1e3*v)):"track"===t&&"audio"===K?(h.audio_level=-10*Math.log10(Math.pow(y,2)),h.volume=255*y,h.total_audio_energy=E,h.totalAudioDuration=g):"ssrc"===t?(h.decodingNormal=T,h.recvAudioLevel=V):"local-candidate"===t?(h.local_candidate_type=P,h.local_ip=k||M,h.local_network_type=U,h.local_port=L,h.protocol=x):"remote-candidate"===t&&(h.remote_candidate_type=P,h.remote_ip=k||M,h.remote_port=L)})),(f=t.audio).timestamp?(_={},void 0!==n.concealedSamples&&(h.interval_concealed_samples=n.concealedSamples-f.concealedSamples,h.interval_samples_received=n.totalSamplesReceived-f.totalSamplesReceived,h.interval_silent_concealed_samples=n.silentConcealedSamples-f.silentConcealedSamples),this._audioStallInterval>0&&void 0!==f.concealedSamples?(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),this._audioStallCount?[4,this._audioStallCount()]:[3,3]):[3,3]):(n.timestamp=Date.now(),t.audio=n,[2,i])):[2,i];case 2:v=g.sent(),m=v.stall_count,S=v.stall_duration,y=v.stall_list,E=v.stats_count,_.stall_list=y,_.stats_count=E,h.concealedSamples===h.interval_concealed_samples&&h.totalSamplesReceived===h.interval_samples_received?(h.stall_count=0,h.stall_duration=0):(h.stall_count=m,h.stall_duration=S),i.stallCount=h.stall_count,i.stallDuration=h.stall_duration,g.label=3;case 3:return n.timestamp=Date.now(),i.audioLossRate=(n.packetsLost-f.packetsLost)/(n.packetsReceived-f.packetsReceived+(n.packetsLost-f.packetsLost)),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,h.packetsLost=Math.round(n.packetsLost-f.packetsLost),h.fraction_lost=i.audioLossRate,h.packets_lost_rate=i.audioLossRate,i.statsInterval=n.timestamp-f.timestamp,h.stats_interval=i.statsInterval,i.receivedKBitrate=(n.bytesReceived-f.bytesReceived||0)/i.statsInterval,h.bitrate=Math.round(8e3*i.receivedKBitrate),h.bandwidth=Math.round(h.bitrate/1024),void 0!==n.concealedSamples&&(i.receivedSampleRate=1e3*h.interval_samples_received/i.statsInterval),t.audio=n,null===(r=this.monitor)||void 0===r||r.rtcMediaStatistics(h,{},_),i._retransmittedRate=(n.retransmittedPacketsSent-f.retransmittedPacketsSent)/(n.packetsSent-f.packetsSent),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),[2,i]}}))}))},t.prototype.getRemoteVideoStats=function(e,t){var r;return ev(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d,l,h,p,f;return tv(this,(function(_){switch(_.label){case 0:return i={},n={timestamp:Date.now()},o=this._stream,a=o.streamId,s=o.userId,c=o.isScreen,u=o.subMediaType,d=o._attributes,l=o.videoMid,h={media_type:"video",is_screen:!!c,direction:"down",stream_id:a,stream_user_id:s,vid:l,connection_status:navigator.onLine,mute_state:u===gD.AUDIO_AND_VIDEO||u===gD.VIDEO?"mute_state_off":"mute_state_on",remote_user_capture_state:d.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:d.localvideo&&d.videostream?"mute_state_off":"mute_state_on"},e&&this.handler?(i.isScreen=c,[4,this.handler.getStats(e)]):[2,i];case 1:return(p=_.sent()).length?(p.forEach((function(e){var t=e.type,r=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,c=e.bytesReceived,u=e.framesDecoded,d=e.jitterBufferDelay,l=e.jitterBufferEmittedCount,p=e.mimeType,f=e.firCount,_=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,S=e.nominated,y=e.id,E=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;e.kind;var x=e.jitter,V=e.framesReceived,F=e.keyFramesDecoded,B=e.totalDecodeTime,j=e.decoderImplementation,G=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(n.packetsLost=a,h.packetsLost=a,n.packetsReceived=s,h.packetsReceived=s,n.bytesReceived=c,h.bytes=c,n.framesDecoded=u,void 0!==d&&(n.jitterBufferDelay=d/l*1e3,h.average_jitter_buffer_delay_ms=n.jitterBufferDelay),h.fir_count=f,h.nackCount=O,h.pli_count=N,h.ssrc=L,h.jitter=x,h.framesReceived=V,n.framesReceived=V,h.framesDecoded=u,h.key_frames_decoded=F,h.total_decode_time=B,h.decoder_name=j,h.last_packet_received_timestamp=G):"track"===t&&void 0!==o?(i.width=o,h.frame_size_width=o,i.height=r,h.frame_size_height=r,void 0!==V&&(h.framesReceived=V,n.framesReceived=V)):"codec"===t?h.codecName=p:"candidate-pair"===t?(h.ice_available_incoming_bitrate=_,h.ice_available_outgoing_bitrate=v,h.ice_bytes_received=c,h.ice_bytes_sent=m,h.ice_nominated=+S,h.ice_pair_id=y,h.ice_pair_rtt=E,h.rtt=1e3*E,i.rtt=h.rtt,h.ice_pair_state=g,h.ice_pair_writable=b,h.recv_ping_requests=D,h.recv_ping_responses=P,h.sent_ping_requests_before_first_response=k,h.sent_ping_requests_total=k+(M||0),h.sent_ping_responses=U):"local-candidate"===t?(h.local_candidate_type=T,h.local_ip=I||R,h.local_network_type=A,h.local_port=C,h.protocol=w):"remote-candidate"===t&&(h.remote_candidate_type=T,h.remote_ip=I||R,h.remote_port=C)})),(f=t.video).timestamp?(i.videoLossRate=(n.packetsLost-f.packetsLost)/(n.packetsReceived-f.packetsReceived+(n.packetsLost-f.packetsLost)),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,h.fraction_lost=i.videoLossRate,h.packets_lost_rate=i.videoLossRate,i.statsInterval=n.timestamp-f.timestamp,h.stats_interval=i.statsInterval,i.receivedKBitrate=(n.bytesReceived-f.bytesReceived||0)/i.statsInterval,h.bitrate=Math.round(8e3*i.receivedKBitrate),h.bandwidth=Math.round(h.bitrate/1024),i.decoderOutputFrameRate=1e3*(n.framesDecoded-f.framesDecoded)/i.statsInterval,i.receivedFrameRate=1e3*(n.framesReceived-f.framesReceived)/i.statsInterval,h.frame_rate_decoded=Math.round(i.decoderOutputFrameRate),h.frame_rate_received=h.frame_rate_decoded,t.video=n,this.processStall(this._stream,h,i,c),null===(r=this.monitor)||void 0===r||r.rtcMediaStatistics(h,{}),[2,i]):(t.video=n,[2,i])):[2,i]}}))}))},t.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?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=n,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},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1},t}(mF),EF=new xP("MediaServerClient",2);!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(vF||(vF={}));var gF=function(e,t){EF.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)},bF=function(e){function t(t,r){void 0===r&&(r=hL);var i=e.call(this)||this;return i._ontrackCallbackMap=new Map,i._pubConfig={},i._subConfig={},i._roomProfile=kD.communication,i.monitor=r,i._pubSubLock=new Qx("pubSubLock"),i._joinLeaveLock=new Qx("joinLeaveLock"),i._state=vF.DISCONNECTED,i._roomAttributes={multiChatMode:!1,bigRoomMode:!1},i._context=t,i}return Q_(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){EF.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(xL.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[UL.ON_ADD_STREAM,UL.ON_REMOVE_STREAM,UL.USER_CONNECTION,UL.USER_DISCONNECTION,UL.ON_UPDATE_STREAM_ATTRIBUTES,UL.ON_UPDATE_ROOM_ATTRIBUTES,UL.ON_PUSH_TRACK,UL.ON_REMOVE_TRACK,UL.NODE_CHANGE,UL.ON_CUSTOM_MESSAGE,UL.USER_MESSAGE_RECEIVED,UL.USER_BINARY_MESSAGE_RECEIVED,UL.POST_PROCESSING_MESSAGE,UL.ON_USER_TOKEN_WILL_EXPIRE,UL.STREAM_CONTROL_MESSAGE,UL.ON_SCENE_CONFIG,LL.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(){EF.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(xL.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(xL.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,u,d=this;return tv(this,(function(l){switch(l.label){case 0:return this.connectionState=vF.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 d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new tx,[4,null===(n=this._iceConfigRequestManager)||void 0===n?void 0:n.getAccessNode(e,t,r,IL.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy)];case 2:if(!(o=l.sent()))throw gL("es.join.getNodeFailed",""),new tw(QN.ICE_SERVER_WRONG,"get ICE config failed");gL("es.join.getNodeSuccess",o),l.label=3;case 3:this._addHandlerEvents(),Promise.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),l.label=4;case 4:return l.trys.push([4,6,,7]),s=!1,c=o.map((function(e){var t=new Yx(d.monitor,d._context);return t.connect(e).then((function(r){s?t.destroy():(s=!0,a=r,d.safeEmit("prevIceNode",e),d._handler=t,d._addHandlerEvents())})).catch((function(e){t.destroy()}))})),[4,vP(c)];case 5:return l.sent(),EF.print("join","establish peerConnection success"),[3,7];case 6:throw u=l.sent(),this.connectionState=vF.DISCONNECTED,new tw(QN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",u);case 7:if(!a)throw this.connectionState=vF.DISCONNECTED,new tw(QN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");return this._dataChannelSignal=new ZL(a),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[2]}}))}))},t.prototype.join=function(e,t,r,i){var n,o,a,s,c,u,d,l,h,p;return void 0===t&&(t={}),void 0===r&&(r=!1),ev(this,void 0,void 0,(function(){var f,_,v,m,S,y,E,g=this;return tv(this,(function(b){switch(b.label){case 0:return EF.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._roomProfile=e.roomProfile,this._sessionId=t.sessionId,[4,this.connect(this._appId,this._roomId,this._clientId,t)];case 1:return b.sent(),[4,null===(n=this._handler)||void 0===n?void 0:n.getDefaultSdp()];case 2:return f=b.sent(),y={Authorization:cP.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}},E={},[4,Hx()];case 3:y.params=(E.supportedCodecs=b.sent(),E.deviceType="web",E.userAgent=window.navigator.userAgent,E.sdkVersion=XL.VERSION,E.deviceId=IL.getDeviceId(),E.appId=this._appId,E.roomId=this._roomId,E.userId=this._clientId,E.businessId=this._businessId,E.enable_cloud_proxy=this._useCloudProxy,E.channelProfile=_F[this._roomProfile]?_F[this._roomProfile][0]:0,E),y.options={enableUnBundleMode:!0,supportTokenExpireCallBack:!0,enableSceneConfigV2:!0},y.sdpInfo=f,_=y,Promise.resolve().then((function(){return g.emit("onSendingJoinMessageHook")})),b.label=4;case 4:return b.trys.push([4,6,,7]),v=r?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(v,_)];case 5:return m=b.sent(),EF.print("join","send join message success"),this._authorization=_.Authorization,this.connectionState=vF.CONNECTED,yF.audioStallConfig=null===(o=m.config)||void 0===o?void 0:o.engine_WEB,this._pubConfig.audioRed=!!(null===(s=null===(a=m.config)||void 0===a?void 0:a.engine_WEB)||void 0===s?void 0:s.pub_audio_red),this._subConfig.muteReplaceUnsub=!!(null===(c=m.config)||void 0===c?void 0:c.mute_replace_unsub),this._pubConfig.simulcastOnDemand=!!(null===(l=null===(d=null===(u=m.config)||void 0===u?void 0:u.engine_VPM)||void 0===d?void 0:d.ondemand)||void 0===l?void 0:l.enable),null===(h=this._context)||void 0===h||h.audioProfileManager.updateEngineBAC(null===(p=m.config)||void 0===p?void 0:p.engine_BAC),[2,m];case 6:if(S=b.sent(),this.connectionState=vF.DISCONNECTED,(null==S?void 0:S.code)>=700&&(null==S?void 0:S.code)<800)throw new tw(QN.INVALID_TOKEN,(null==S?void 0:S.message)||"Invalid token");if(200!==(null==S?void 0:S.code))throw new tw(QN.JOIN_ROOM_FAILED,(null==S?void 0:S.message)||"Join room failed");return[3,7];case 7:return[2]}}))}))},t.prototype.publish=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;return tv(this,(function(m){switch(m.label){case 0:EF.print("publish()","localStream: %o",e),a=e.videoTrack,s=e.audioTrack,c=oP(),u="",d="",l="",m.label=1;case 1:return m.trys.push([1,5,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(h=m.sent()))throw new tw(QN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return u=h.audioMid,d=h.videoMid,l=h.sdp,e.pubAttributes={localaudio:!!s,localvideo:!!a,videostream:e.pubVideo,audiostream:e.pubAudio,extvideo:!!(a instanceof dF),extaudio:!!(s instanceof lF)},p={attributes:Z_({videoDescriptions:h.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:u,videoMid:d,sdpInfo:{msid:e.stream.id,type:h.type,sdp:h.partialSdp,semantics:h.semantics}},e.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(p.attributes.subVideoDescriptions=h.subVideoDescriptions),[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("publish",p)];case 3:if(200!==(null==(f=m.sent())?void 0:f.code))throw new tw(QN.PUBLISH_FAILED,(null==f?void 0:f.message)||"publish failed");return _=null===(i=null==f?void 0:f.relayMessage)||void 0===i?void 0:i.sdp,[4,null===(n=this._handler)||void 0===n?void 0:n.setAnswerSdp(h.sdp,_,void 0,e,MU.UP)];case 4:return m.sent(),e.streamId=f.streamId,e.videoMid=d,e.audioMid=u,e.subVideoDescriptions=h.subVideoDescriptions,this.monitor.rtcPublishStat(xU.SUCCESS,VU.W_0,c,FU.UNKNOWN),e.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 5:return(v=m.sent())instanceof Error&&this.monitor.rtcPublishStat(xU.FAIL,VU.W_0,c,v.message),u&&d?[4,null===(o=this._handler)||void 0===o?void 0:o.rollback(l,[u,d])]:[3,7];case 6:m.sent(),m.label=7;case 7:throw v;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,r,i,n,o,a;return ev(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f,_,v,m,S,y,E,g,b,T,I,R,A,C,O,N,w,D,P,k;return tv(this,(function(M){switch(M.label){case 0:EF.print("updatePubTrack()","localStream: %o",e),s=e.videoTrack,c=e.audioTrack,u=e.pubAudio,d=e.pubVideo,l=null==c?void 0:c.getTrack(),h=null==s?void 0:s.getTrack(),d&&h?null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack(h):null===(r=e.videoTransceiver)||void 0===r||r.sender.replaceTrack(null),null===(i=this._handler)||void 0===i||i.updateScaleResolutionDownBy(e),u&&l?(f=(p=c).mixType,(_=p.mixedAudioTrack)&&f!==xx.PLAYOUT&&!0===l.enabled&&(l=_),null===(n=e.audioTransceiver)||void 0===n||n.sender.replaceTrack(l)):null===(o=e.audioTransceiver)||void 0===o||o.sender.replaceTrack(null),v={localaudio:!!c,localvideo:!!s,videostream:d,audiostream:u,extvideo:!!(s instanceof dF),extaudio:!!(c instanceof lF)},m={};try{for(S=rv(Object.entries(v)),y=S.next();!y.done;y=S.next())E=iv(y.value,2),g=E[0],(b=E[1])!==Reflect.get(e.pubAttributes,g)&&Reflect.set(m,g,b)}catch(e){P={error:e}}finally{try{y&&!y.done&&(k=S.return)&&k.call(S)}finally{if(P)throw P.error}}return Object.keys(m).length?(e.observer&&(T=e.observer,I=m.audiostream,R=m.videostream,A=m.localaudio,O=m.extaudio,N=m.extvideo,void 0!==(C=m.localvideo)?void 0!==N?T.setPushVideo(N):T.setEnableVideo(C):void 0!==R&&T.setUnmuteVideo(R),void 0!==A?void 0!==O?T.setPushAudio(O):T.setEnableAudio(A):void 0!==I&&T.setUnmuteAudio(I)),e.pubAttributes=v,w={roomId:this._roomId,streamId:e.streamId,attributes:m},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateStreamAttributes",w)]):[2];case 1:if(200!==(null==(D=M.sent())?void 0:D.code))throw new tw(QN.UPDATE_TRACK_FAILED,(null==D?void 0:D.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(EF.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(QN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new tw(QN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 4:return[2]}}))}))},t.prototype.unpublish=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 EF.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==(n=o.sent())?void 0:n.code))throw new tw(QN.UNPUBLISH_FAILED,(null==n?void 0:n.message)||"unpublish failed");return[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 2:return o.sent(),e.statsReport.unpublish(),[2]}}))}))},t.prototype.subscribe=function(e,t,r){var i,n,o,a,s,c,u,d;return ev(this,void 0,void 0,(function(){var l,h,p,f,_,v,m,S,y,E,g,b,T,I,R,A,C,O,N,w;return tv(this,(function(D){switch(D.label){case 0:if(e.hasSubscribed)return[2,this._updateSubTrack(e,t,jV.SUB)];if(EF.print("subscribe()","mediaType: %o",t),gF("subscribe()",e),l=!1,h=!1,SP(t)&&(h=!0),yP(t)&&(l=!0),!l&&this._multiChatMode())return[2];p=oP(),f=e.audioMid,_=e.videoMid,m=!1,D.label=1;case 1:return D.trys.push([1,12,,15]),f&&_?(m=!0,[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e,{audioMid:f,videoMid:_})]):[3,3];case 2:return v=D.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(v=D.sent()))throw new tw(QN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");f=v.audioMid,_=v.videoMid,D.label=5;case 5:return S={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:_,audioMid:f,sdpInfo:{sdp:null==v?void 0:v.partialSdp,semantics:null==v?void 0:v.semantics,type:null==v?void 0:v.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||h,video:l},qualityLayer:{spatialLayer:(null==r?void 0:r.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==r?void 0:r.spatialSubLayer)||-1}}},[4,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("subscribe",S)];case 6:if(200!==(null==(y=D.sent())?void 0:y.code))throw new tw(QN.SUBSCRIBE_FAILED,(null==y?void 0:y.message)||"subscribe failed");return E=[],g=!this._multiChatMode(),!(e.audioMid&&e.videoMid)&&E.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new tw(QN.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(n){"video"===n.mediaType&&(EF.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),g&&E.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new tw(QN.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(EF.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),b=function(t){e.ontrack(t)},null===(a=this._handler)||void 0===a||a.on("ontrack",b),this._ontrackCallbackMap.set(e,b),T=null==y?void 0:y.relayMessage,I=T.audioMid,R=T.videoMid,A=T.sequenceId,C=T.sdp,m&&f!==I?(EF.print("subscribe","mid mot match",f,I),[4,null===(s=this._handler)||void 0===s?void 0:s.closeMLine([f,_])]):[3,9];case 7:return D.sent(),[4,null===(c=this._handler)||void 0===c?void 0:c.subscribe(e)];case 8:if(!(v=D.sent()))throw new tw(QN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");f=v.audioMid,_=v.videoMid,D.label=9;case 9:return(w={})[f]=I,w[_]=R,O=w,e.videoMid=R,e.audioMid=I,e.sequenceId=A,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==v?void 0:v.sdp,C,O,e,MU.DOWN)];case 10:return D.sent(),[4,Promise.all(E)];case 11:return D.sent(),this._multiChatMode()||(e.subAudio=h),e.subVideo=l,this.monitor.rtcSubscribeStat(BU.SUCCESS,p,jU.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 12:return(N=D.sent())instanceof Error&&this.monitor.rtcSubscribeStat(BU.FAIL,p,N.message,e.userId),f&&_?[4,null===(d=this._handler)||void 0===d?void 0:d.rollback(null==v?void 0:v.sdp,[f,_])]:[3,14];case 13:D.sent(),D.label=14;case 14:throw N;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 EF.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 EF.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,i){return ev(this,void 0,void 0,(function(){return tv(this,(function(n){return[2,this._updateSubTrack(e,t,r,i||e.subLayer)]}))}))},t.prototype._updateSubTrack=function(e,t,r,i){var n,o,a,s,c;return void 0===i&&(i={spatialLayer:0,spatialSubLayer:-1}),ev(this,void 0,void 0,(function(){var u,d,l,h,p;return tv(this,(function(f){switch(f.label){case 0:return EF.print("updateSubTrack()","mediaType: %o, subLayer: %o",t,i),gF("updateSubTrack()",e),u=0,u=r===jV.SUB?e.subMediaType|t:e.subMediaType-(e.subMediaType&t),EF.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",e.subMediaType,r,t,u),e.subMediaType===u&&EF.print("updateSubTrack","mediaType no change"),d=!1,l=!1,SP(u)&&(l=!0),yP(u)&&(d=!0),h={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:d,audio:!!this._multiChatMode()||l},qualityLayer:{spatialLayer:null!==(n=i.spatialLayer)&&void 0!==n?n:0,temporalLayer:0,spatialSubLayer:null!==(o=i.spatialSubLayer)&&void 0!==o?o:-1}}},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateSubscribe",h)];case 1:if(200!==(null==(p=f.sent())?void 0:p.code))throw new tw(QN.UPDATE_TRACK_FAILED,(null==p?void 0:p.message)||"update track failed");return e.paused=!d,this._multiChatMode()||(null===(s=e.observer)||void 0===s||s.setUnmuteAudio(l),e.subAudio=l),null===(c=e.observer)||void 0===c||c.setUnmuteVideo(d),e.subVideo=d,e.subMediaType=u,e.subLayer=i,[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,y,E;return tv(this,(function(g){switch(g.label){case 0:if(EF.print("subscribe4pushTrack()","streamInfo: %o",t),gF("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 EF.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(QN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");p=_.audioMid,f=_.videoMid,g.label=5;case 5:return(E={})[p]=u,E[f]=d,v=E,EF.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(QN.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(EF.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,MU.DOWN)];case 6:return g.sent(),[4,Promise.all(m)];case 7:return g.sent(),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 8:return y=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 y;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 gF("unsubscribe4removeTrack()",e),EF.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(EF.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(),EF.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),[2]}}))}))},t.prototype.unsubscribe=function(e,t,r){var i,n,o,a;return void 0===r&&(r=!1),ev(this,void 0,void 0,(function(){var s,c;return tv(this,(function(u){switch(u.label){case 0:if(gF("unsubscribe()",e),s=e.subMediaType-(e.subMediaType&t),!r&&(this._subConfig.muteReplaceUnsub||s!==UV.NONE))return[2,this._updateSubTrack(e,t,jV.UNSUB)];c={roomId:this._roomId,streamId:e.streamId,userId:e.userId},u.label=1;case 1:return u.trys.push([1,3,,4]),[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("unsubscribe",c)];case 2:case 3:return u.sent(),[3,4];case 4:return e.hasSubscribed=!1,e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),null===(n=e.observer)||void 0===n||n.setSubscribeVideo(!1),e.subAudio?[3,6]:(null===(o=e.observer)||void 0===o||o.setSubscribeAudio(!1),[4,null===(a=this._handler)||void 0===a?void 0:a.closeMLine([e.videoMid||"",e.audioMid||""])]);case 5:u.sent(),EF.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),u.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 gF("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==kL.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this.unsubscribe(e,gD.AUDIO_AND_VIDEO,!0),[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 EF.print("leave()"),this.connectionState!==vF.CONNECTED?[3,7]:(this.connectionState=vF.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=vF.DISCONNECTED,[3,6];case 4:throw i=n.sent(),this.connectionState=vF.CONNECTED,i;case 5:return r(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new tw(QN.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,r,i,n;return ev(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m;return tv(this,(function(S){switch(S.label){case 0:return[4,null===(t=this._handler)||void 0===t?void 0:t.subscribe(e)];case 1:if(!(o=S.sent()))throw new tw(QN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return a=oP(),s=o.audioMid,c=o.videoMid,u={appId:this._appId,streamId:e.streamId,audio:!0,video:!0,data:!0,audioMid:s,videoMid:c,sdpInfo:{sdp:null==o?void 0:o.partialSdp,semantics:null==o?void 0:o.semantics,type:null==o?void 0:o.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}}},[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("startPullStream",u)];case 2:return d=S.sent(),(l=[]).push(new Promise((function(t,r){var i=setTimeout((function(){return r(new tw(QN.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),5e3);e.on("ontrack",(function r(n){"video"===n.mediaType&&(EF.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),l.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new tw(QN.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),5e3);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(EF.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),h=function(t){e.ontrack(t)},null===(i=this._handler)||void 0===i||i.on("ontrack",h),this._ontrackCallbackMap.set(e,h),p=null==d?void 0:d.relayMessage,f=p.audioMid,_=p.videoMid,v=p.sequenceId,m=p.sdp,e.videoMid=_,e.audioMid=f,e.sequenceId=v,e._workaround_1_=!1,e.paused=!1,e.hasSubscribed=!0,e.subAudio=!0,e.subVideo=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.setAnswerSdp(null==o?void 0:o.sdp,m,{},e,MU.DOWN)];case 3:return S.sent(),[4,Promise.all(l)];case 4:return S.sent(),this.monitor.rtcSubscribeStat(BU.SUCCESS,a,jU.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,r;return ev(this,void 0,void 0,(function(){var i;return tv(this,(function(n){switch(n.label){case 0:gF("unsubscribePublicStream()",e),i={appId:this._appId,streamId:e.streamId},n.label=1;case 1:return n.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("stopPullStream",i)];case 2:case 3:return n.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 n.sent(),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.destroy=function(){var e,t,r;EF.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,this._context=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(r=this._iceConfigRequestManager)||void 0===r||r.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState=vF.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}),$_([RF],t.prototype,"join",null),$_([IF,TF],t.prototype,"publish",null),$_([IF,TF],t.prototype,"updatePubTrack",null),$_([IF,TF],t.prototype,"unpublish",null),$_([IF,TF],t.prototype,"subscribe",null),$_([TF],t.prototype,"controlMessage",null),$_([TF],t.prototype,"updateUserAttributes",null),$_([IF,TF],t.prototype,"updateSubTrack",null),$_([IF,TF],t.prototype,"subscribe4pushTrack",null),$_([IF,TF],t.prototype,"unsubscribe4removeTrack",null),$_([IF,TF],t.prototype,"unsubscribe",null),$_([IF,TF],t.prototype,"handleRemoveStream",null),$_([IF],t.prototype,"subscribePublicStream",null),$_([IF],t.prototype,"unsubscribePublicStream",null),t}(FP);function TF(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===vF.CONNECTED?[4,i.apply(this,e)]:[3,2];case 1:return r.sent(),[3,3];case 2:throw new tw(QN.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},r}function IF(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 RF(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(QN.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 AF,CF,OF=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}(),NF=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}();!function(e){e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass"}(AF||(AF={})),function(e){e[e.invalid=0]="invalid",e[e.cfgResolution=1]="cfgResolution",e[e.bitstreamHash=2]="bitstreamHash",e[e.screenCodec=3]="screenCodec"}(CF||(CF={}));var wF=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),DF=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]);function PF(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function kF(e,t){void 0===t&&(t=0);for(var r=0;255===e[t]&&t<e.byteLength;)t++,r+=255;return t<e.byteLength&&(r+=e[t++]),[r,t]}var MF,UF=function(){function e(){}return e.generateSEI=function(e,t){void 0===t&&(t=!1);var r=new Uint8Array([0,0,0,1]),i=new Uint8Array([6]),n=new Uint8Array([5]),o=t?wF:DF,a=PF(e.byteLength+o.byteLength),s=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]&&t.push(3),t.push(e[r]);return new Uint8Array(t)}(e);return new Uint8Array(nv(nv(nv(nv(nv(nv(nv([],iv(r),!1),iv(i),!1),iv(n),!1),iv(a),!1),iv(o),!1),iv(s),!1),[128],!1))},e.decodeSeiBody=function(e){var t=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]||t.push(e[r]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var i=iv(kF(t,r+=2),2),n=i[0];r=i[1];var o=AF.bypass,a=r+n;return t.byteLength>=DF.byteLength&&n>=DF.byteLength&&t.slice(r,r+DF.byteLength).toString()===DF.toString()?(r+=DF.byteLength,o=AF.external):t.byteLength>=DF.byteLength&&n>=DF.byteLength&&t.slice(r,r+wF.byteLength).toString()===wF.toString()&&(r+=wF.byteLength,o=AF.internal),{type:o,payload:t.slice(r,a)}}}},e.parseInternalSEI=function(e){var t=new Map,r=0;if(e.type===AF.internal){for(;e.payload.byteLength-r>=2;){var i=iv(kF(e.payload,r),2),n=i[0];r=i[1];var o=iv(kF(e.payload,r),2),a=o[0];if(r=o[1],t.get(n)||!(a<e.payload.byteLength-r))break;t.set(n,e.payload.slice(r,r+a))}return t}},e.makeInternalSei=function(e){var t,r,i=[];try{for(var n=rv(e),o=n.next();!o.done;o=n.next()){var a=iv(o.value,2),s=a[0],c=a[1],u=PF(s),d=PF(c.byteLength);i.push(u,d,c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}var l=i.reduce((function(e,t){return e+t.byteLength}),0),h=new Uint8Array(l);return i.reduce((function(e,t){return h.set(t,e),e+t.byteLength}),0),h},e}(),LF=new xP("Stream",0),xF=function(){function e(){this.isScreen=!1,this.seiList=[],this.subVideoDescriptions=[],this.enableSimulcast=!1,this.prevScaleResolutionDownBy=1,this.pubAudio=!1,this.pubVideo=!1,this.stream=new MediaStream,this.videoInputConfig={width:640,height:360,frameRate:30},this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new SF(this)}return Object.defineProperty(e.prototype,"hasPublished",{get:function(){return this.videoTransceiver&&this.audioTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),e.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(zx()){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=UF.generateSEI(i.content),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 LF.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 LF.print("no sender found when trying to bind encodedTransform")},e.prototype.clean=function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]},e.prototype.switchTrackEnableState=function(e,t){var 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}(),VF=function(e){function t(t,r,i,n,o){void 0===o&&(o=wD.LOW);var a=e.call(this)||this;return a.userPriority=o,a.originalStreamIndex=0,a.userId=t,a.isScreen=i,a.streamId=r,a.hasAudio=n.audiostream&&n.localaudio,a.hasVideo=n.videostream&&n.localvideo,a._attributes=n,a.subVideo=!1,a.subAudio=!1,a._sequenceId=0,a.subMediaType=UV.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.hasSubscribed=!1,a.statsReport=new yF(a),a}return Q_(t,e),Object.defineProperty(t.prototype,"sequenceId",{get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e},enumerable:!1,configurable:!0}),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=OF.getNalunits(new NF(t.data)).find((function(e){return e.sei}));if(i){var n=UF.decodeSeiBody(i.body);n&&n.type!==AF.internal&&e.safeEmit("onSEIMessage",n.payload)}r.enqueue(t)}})).pipeTo(i)}else LF.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 LF.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;LF.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()},t.prototype.resetHasSubscribed=function(){this.hasSubscribed=!1},t.prototype.setRemoteUserPriority=function(e){this.userPriority=e},t.prototype.getStreamPriority=function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e},t.prototype.getSubscribeFallbackParams=function(e){if(e!==ND.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,jV.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===ND.AUDIO_ONLY)return[gD.VIDEO,jV.UNSUB]}return null},t.prototype.getSubscribeRecoverParams=function(){if(this.originalMediaType&&yP(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,jV.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,jV.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null},t.prototype._setStream=function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}},t.prototype._setAudioTrack=function(e){var t,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 oF(e,nP()),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 nF(e,nP()),this.emit("ontrack",this.videoTrack))},t.prototype._getSubLayerBySpatialLayer=function(e){var t=this._attributes,r=t.videoDescriptions,i=t.subVideoDescriptions,n=void 0===i?[]:i,o=r[e],a=o.width,s=o.height,c=n.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}},t}(FP);!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.RECEIVED=3]="RECEIVED"}(MF||(MF={}));var FF,BF=function(){function e(e,t){this._audioEventSessionId=dP(),this._videoEventSessionId=dP(),this._isScreen=!1,this._audioFirstFrameState=MF.INITIAL,this._videoFirstFrameState=MF.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:KU.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:KU.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=KU.LOGIN,d=KU.UNMUTE,l=KU.SUBSCRIBE,h=KU.PUSH_TRACK,[u,d,l,h].indexOf(t)>=0&&(s=0,c=!1),e===zU.AUDIO?(c||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},p={media_type:e,event_type:HU.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(zU.AUDIO,WU.TIMEOUT),f._firstAudioFrameInterval&&window.clearInterval(f._firstAudioFrameInterval)}),this._timeout),hL.rtcFirstFrame(p),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=MF.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===zU.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)?zU.SCREEN_VIDEO:e,event_type:HU.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(zU.VIDEO,WU.TIMEOUT),f._firstVideoFrameInterval&&window.clearInterval(f._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),hL.rtcFirstFrame(p),this._videoFirstFrameState=MF.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===zU.AUDIO){if(this._audioFirstFrameState!==MF.BEGIN)return;var u={event_type:HU.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=MF.STOPPED}else if(e===zU.VIDEO){if(this._videoFirstFrameState!==MF.BEGIN)return;u={event_type:HU.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?zU.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=MF.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=KU.LOGIN,a=KU.UNMUTE,s=KU.SUBSCRIBE,c=KU.PUSH_TRACK,e===zU.AUDIO){if(this._audioFirstFrameState!==MF.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:HU.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=MF.RECEIVED}else if(e===zU.VIDEO){if(this._videoFirstFrameState!==MF.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:HU.RECV_END,media_type:(null===(r=this._stream)||void 0===r?void 0:r.isScreen)?zU.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=MF.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(zU.AUDIO,KU.LOGIN),e&&(null===(i=this._stream)||void 0===i?void 0:i.hasVideo)&&t.video&&this.beginRecvFrame(zU.VIDEO,KU.LOGIN),!e&&(null===(n=this._stream)||void 0===n?void 0:n.hasAudio)&&this.stopRecvFrame(zU.AUDIO,WU.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(zU.VIDEO,WU.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(zU.AUDIO,KU.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(zU.AUDIO,WU.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(zU.AUDIO,KU.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(zU.AUDIO,WU.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(zU.AUDIO,KU.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(zU.AUDIO,WU.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(zU.VIDEO,KU.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(zU.VIDEO,WU.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(zU.VIDEO,KU.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(zU.VIDEO,WU.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(zU.VIDEO,KU.ENABLE):this.stopRecvFrame(zU.VIDEO,WU.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(zU.AUDIO,KU.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(zU.AUDIO,KU.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(zU.VIDEO,KU.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(zU.VIDEO,KU.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(zU.VIDEO,KU.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(zU.VIDEO,WU.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(zU.AUDIO,KU.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(zU.AUDIO,WU.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(zU.AUDIO,KU.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasAudio)&&this.stopRecvFrame(zU.AUDIO,WU.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(zU.VIDEO,KU.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&this.stopRecvFrame(zU.VIDEO,WU.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(zU.AUDIO,KU.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(zU.AUDIO,WU.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,jx(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(zU.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,jx(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(zU.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,jx(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:KU.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:KU.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"}(FF||(FF={}));var jF,GF,HF,zF,KF=function(){function e(e,t){this._audioEventSessionId=dP(),this._videoEventSessionId=dP(),this._currentAudioSend={startTime:0,eventSessionId:0,type:KU.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:KU.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=FF.INITIAL,this._videoFirstFrameState=FF.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var r,i,n,o=this;if(e===zU.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:HU.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(zU.AUDIO,WU.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),hL.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=FF.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===zU.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)?zU.SCREEN_VIDEO:e,event_type:HU.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(zU.VIDEO,WU.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),hL.rtcFirstFrame(a),this._videoFirstFrameState=FF.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===zU.AUDIO){if(this._audioFirstFrameState!==FF.BEGIN)return;var s={event_type:HU.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=FF.STOPPED}else if(e===zU.VIDEO){if(this._videoFirstFrameState!==FF.BEGIN)return;s={event_type:HU.SENT_END,media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?zU.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=FF.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===zU.AUDIO){if(this._audioFirstFrameState!==FF.BEGIN)return;if(!this._currentAudioSend)return;var r=this._currentAudioSend,i=r.type,n=r.startTime,o={event_type:HU.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=FF.SENT}else if(e===zU.VIDEO){if(this._videoFirstFrameState!==FF.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;i=a.type,n=a.startTime,o={event_type:HU.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?zU.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=FF.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(zU.VIDEO,KU.LOGIN),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(zU.AUDIO,KU.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(zU.AUDIO,WU.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(zU.VIDEO,WU.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(zU.VIDEO,KU.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(zU.AUDIO,KU.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(zU.AUDIO,WU.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(zU.VIDEO,WU.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(zU.AUDIO,KU.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(zU.AUDIO,WU.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(zU.AUDIO,KU.ENABLE),!e&&this._audioSending&&this.stopSendFrame(zU.AUDIO,WU.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(zU.VIDEO,KU.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(zU.VIDEO,WU.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(zU.VIDEO,KU.ENABLE),!e&&this._videoSending&&this.stopSendFrame(zU.VIDEO,WU.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(zU.AUDIO,WU.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(zU.AUDIO,WU.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(zU.AUDIO,KU.PUSH),!e&&this._audioSending&&this.stopSendFrame(zU.AUDIO,WU.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(zU.VIDEO,WU.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(zU.VIDEO,WU.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(zU.VIDEO,KU.PUSH),!e&&this._videoSending&&this.stopSendFrame(zU.VIDEO,WU.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(zU.AUDIO,WU.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(zU.VIDEO,WU.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,jx(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,jx(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(zU.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(zU.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=FF.INITIAL,this._videoFirstFrameState=FF.INITIAL,this._currentAudioSend={startTime:0,eventSessionId:0,type:KU.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:KU.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===FF.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===FF.BEGIN},enumerable:!1,configurable:!0}),e}();!function(e){e[e.UNKOWN=0]="UNKOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(GF||(GF={})),function(e){e[e.INVALID=0]="INVALID",e[e.GOOD=1]="GOOD",e[e.MEDIUM=2]="MEDIUM",e[e.POOR=3]="POOR"}(HF||(HF={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(zF||(zF={}));var WF=((jF={})[zF.AUDIO]={delay:1200,stallRadio:.3},jF[zF.VIDEO]={delay:1200,stallRadio:.6},jF[zF.SCREEN_AUDIO]={delay:1600,stallRadio:.8},jF[zF.SCREEN_VIDEO]={delay:1600,stallRadio:.8},jF),XF=function(){function e(){this._preUplinkStats=new Map,this._preDownlinkStats=new Map,this._connectionState=vF.CONNECTED}return e.prototype.updateUplinkStats=function(e){var t=e.audioStats,r=e.videoStats,i=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var n=i?zF.SCREEN_AUDIO:zF.AUDIO,o=t.rtt,a=t._fractionLost,s=t._retransmittedRate,c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,nv(nv([],iv(u),!1),[c],!1).slice(-2))}if(r.sentKBitrate>0&&r.rtt){n=i?zF.SCREEN_VIDEO:zF.VIDEO,o=r.rtt,a=r._fractionLost;r.videoLossRate;var d=r._sendBandWidth;s=r._retransmittedRate;0===d&&(a=Math.max(.65,a));c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,nv(nv([],iv(u),!1),[c],!1).slice(-2))}this._startNetworkQualityReport()},e.prototype.updateDownlinkStats=function(e,t){if(t){var r,i,n=this._getStreamActiveState(t),o=n.audioActive,a=n.videoActive,s=e.audioStats,c=e.videoStats,u=e.isScreen,d=e.userId;if(o&&s.rtt)if(0===s.receivedKBitrate)r=DD.VBAD;else{var l=s.rtt,h=s.audioLossRate,p=s.stallDuration,f=s.statsInterval,_=s.e2eDelay,v=p/f,m=u?zF.SCREEN_AUDIO:zF.AUDIO,S=this._getQosLevel(l,h||0,c._retransmittedRate||0),y=this._getDownlinkQoE(m,v,_);r=this._getNetworkQuality(S,y)}if(a)if(0===c.receivedKBitrate||0===c.rtt)i=DD.VBAD;else{l=c.rtt;var E=c.videoLossRate,g=(p=c.stallDuration,f=c.statsInterval,_=c.e2eDelay,c._retransmittedRate);v=p/f,m=u?zF.SCREEN_VIDEO:zF.VIDEO,S=this._getQosLevel(l,E||0,g||0),y=this._getDownlinkQoE(m,v,_);i=this._getNetworkQuality(S,y)}var b=r&&i?Math.ceil((r+i)/2):r||i;if(b){var T="".concat(d).concat(u?"_screen":""),I=this._preDownlinkStats.get(T)||[b];this._preDownlinkStats.set(T,nv(nv([],iv(I),!1),[b],!1).slice(-2)),this._startNetworkQualityReport()}}},e.prototype.setConnectionState=function(e){this._connectionState=e},e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._delayTimer&&(window.clearTimeout(this._delayTimer),delete this._delayTimer),this._preUplinkStats.clear(),this._preDownlinkStats.clear()},e.prototype._startNetworkQualityReport=function(){var e=this;this._delayTimer||this._timer||(this._preUplinkStats.size>0||this._preDownlinkStats.size>0)&&(this._delayTimer=window.setTimeout((function(){delete e._delayTimer,e._reportNetworkQuality(),e._timer=window.setInterval((function(){e._reportNetworkQuality()}),2e3)}),300))},e.prototype._reportNetworkQuality=function(){var e,t,r=this;if(this._connectionState!==vF.CONNECTED)e=t=DD.VBAD;else{var i=this._getBetterQualityAndRemoveOldest(zF.AUDIO,"up"),n=this._getBetterQualityAndRemoveOldest(zF.VIDEO,"up");e=i&&n?Math.ceil((i+n)/2):i||n||this._getBetterQualityAndRemoveOldest(zF.SCREEN_VIDEO,"up")||this._getBetterQualityAndRemoveOldest(zF.SCREEN_AUDIO,"up")||DD.UNKNOWN;var o=Array.from(this._preDownlinkStats.keys()).map((function(e){return r._getBetterQualityAndRemoveOldest(e,"down")})).filter((function(e){return e}));t=Math.ceil(o.reduce((function(e,t){return t+e}),0)/o.length)||DD.UNKNOWN}this.reportor&&this.reportor(e,t)},e.prototype._getNetworkQuality=function(e,t){return t===HF.GOOD?Math.max(e-2,1):t===HF.MEDIUM?e:Math.min(e+1,5)},e.prototype._getQosLevel=function(e,t,r){var i;return i=e<=250&&t<=.15?GF.EXCELLENT:e<=500&&t<=.3?GF.GOOD:e<=750&&t<=.45?GF.POOR:e<=1e3&&t<=.6?GF.BAD:GF.VBAD,r>.5?i=Math.max(i,GF.BAD):r>.35?i=Math.max(i,GF.POOR):r>.15&&(i=Math.max(i,GF.GOOD)),i},e.prototype._getUplinkQoE=function(e,t){var r=HF.INVALID;switch(e){case zF.AUDIO:case zF.VIDEO:r=t<.05?HF.GOOD:t<.1?HF.MEDIUM:HF.POOR;break;case zF.SCREEN_VIDEO:case zF.SCREEN_AUDIO:r=t<.04?HF.GOOD:t<.08?HF.MEDIUM:HF.POOR}return r},e.prototype._getDownlinkQoE=function(e,t,r){var i=WF[e];return t>i.stallRadio||r>i.delay||t>i.stallRadio/2&&r>i.delay/2?HF.POOR:(t>i.stallRadio/2||i.delay,HF.MEDIUM)},e.prototype._getBetterQualityAndRemoveOldest=function(e,t){var r=DD.UNKNOWN,i="up"===t?this._preUplinkStats:this._preDownlinkStats,n=i.get(e);if(n){var o=n.filter((function(e){return e}));o.length>0&&(r=Math.min.apply(Math,nv([],iv(o),!1))),n.shift(),0===n.length&&i.delete(e)}return r},e.prototype._getStreamActiveState=function(e){var t=e.subMediaType,r=e._attributes,i=e.subVideo;return{audioActive:e.subAudio&&SP(t)&&r.localaudio&&r.audiostream,videoActive:i&&yP(t)&&r.localvideo&&r.videostream}},e}(),YF=function(){function e(e){this._room=e,this._remoteVideoSizeCache={},this._remoteScreenSizeCache={},this._start()}return e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}},e.prototype._start=function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},r={};e._room.remoteStreams.forEach((function(i,n){i.forEach((function(i){var o,a=null===(o=i.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=i.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[n]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,p=a.getSettings(),f=p.width,_=void 0===f?0:f,v=p.height,m=void 0===v?0:v;h===m&&d===_||e.onchange&&e.onchange(n,i.isScreen,_,m),delete s[n],(i.isScreen?r:t)[n]={width:_,height:m}}}))})),Object.keys(e._remoteVideoSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!1,0,0)})),Object.keys(e._remoteScreenSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=r}),1e3))},e}(),JF=kn.every;Bi({target:"Array",proto:!0,forced:!Un("every")},{every:function(e){return JF(this,e,arguments.length>1?arguments[1]:void 0)}});var qF=new xP("SubscribeFallbackManager",2),QF=function(){function e(e){this._room=e,this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,this._inSubscribeRecoverChecking=!1,this._forbidSubRecover=!1,this._forbidSubRecoverDuration=1e4}return e.prototype.updateNetworkQuality=function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===DD.BAD||e===DD.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*DD.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===DD.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")},e.prototype.destroy=function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback},e.prototype._subscribeFallbackOrRecover=function(e){return ev(this,void 0,void 0,(function(){var t,r,i,n,o,a,s,c,u,d=this;return tv(this,(function(l){switch(l.label){case 0:if(this._isSubscribeFallbackOrRecover||this._room.connectionState!==vF.CONNECTED)return[2];if(this._room.subscribeFallbackOption!==ND.AUDIO_ONLY&&this._room.subscribeFallbackOption!==ND.VIDEO_STREAM_LOW)return[3,5];if(t=new Map,this._room.remoteStreams.forEach((function(r){r.forEach((function(r){if(r.hasSubscribed){var i="fallback"===e?r.getSubscribeFallbackParams(d._room.subscribeFallbackOption):r.getSubscribeRecoverParams();if(i){var n=r.getStreamPriority(),o=t.get(n)||[];o.push({stream:r,fallbackOrRecoverOption:i}),t.set(n,o)}}}))})),!(t.size>0))return[3,5];if(qF.print("_subscribeFallbackOrRecover()","start subscribe ".concat(e,".")),r=Array.from(t.keys()).sort((function(e,t){return e-t}))["fallback"===e?0:t.size-1],i=iv(t.get(r)||[],1),!(n=i[0]))return[3,5];o=n.stream,a=n.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,s=o.subLayer.spatialLayer,c=o.subVideo,qF.print("_subscribeFallbackOrRecover()","".concat(o.userId,"'s stream will be ").concat(e," to: MediaType=").concat(a[0]," subState=").concat(a[1]," subLayer=").concat(a[2])),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,vP([(u=this._room).updateSubTrack.apply(u,nv([o],iv(a),!1)).then((function(){"recover"===e?d._startSubscribeRecoverCheck():qF.print("_subscribeFallbackOrRecover()","fallback success."),d.onSubscribeFallback&&d.onSubscribeFallback({userId:o.userId,isScreen:o.isScreen,beforeEnable:c,beforeVideoIndex:s,afterEnable:o.subVideo,afterVideoIndex:o.subLayer.spatialLayer,reason:"fallback"===e?PD.SubscribeFallbackByBandwidth:PD.SubscribeRecoverByBandwidth})})),(h=2e3,new Promise((function(e){window.setTimeout(e,h)})))])];case 2:case 3:return l.sent(),[3,4];case 4:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,l.label=5;case 5:return[2]}var h}))}))},e.prototype._startSubscribeRecoverCheck=function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=1e4,delete e._subRecoverCheckTimer,qF.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)},e.prototype._stopSubscribeRecoverCheck=function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1},e.prototype._startForbidSubRecover=function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),qF.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)},e.prototype._stopForbidSubRecover=function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)},e}(),ZF=new xP("Room",1),$F=function(e){function t(t,r){var i=e.call(this)||this;return i._remoteUsers=new Map,i._remoteStreams=new Map,i._waitForNewToken=!1,i._userDuplicateLoginTimerMap=new Map,i._hasPublished=!1,i._roomConfig=t,i._mediaServerClient=new bF(r),i._reconnectRecord=new eB,i._addHandlerEventHandler(),i._isReconnecting=!1,i._networkQualityManager=new XF,i._networkQualityManager.reportor=i._reportNetworkQuality.bind(i),i._videoSizeObserver=new YF(i),i._videoSizeObserver.onchange=i._emitVideoSizeChange.bind(i),i._subFallbackManager=new QF(i),i._subFallbackManager.onSubscribeFallback=i._emitSubscribeFallback.bind(i),i._context=r,i}return Q_(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,y,E,g,b,T=this;null===(e=this._mediaServerClient)||void 0===e||e.on(UL.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(UL.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(UL.USER_CONNECTION,this._onUserConnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(UL.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(UL.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(UL.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(UL.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(UL.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(UL.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(UL.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(UL.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(UL.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(UL.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(UL.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(UL.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(UL.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(LL.RSCP,this._onPublishOnDemand.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(xL.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(xL.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on("onRemoteStreamStats",(function(e){T._networkQualityManager.updateDownlinkStats(e,T._findRemoteStreamByScreen(e.userId,e.isScreen)),T.emit(xV.ON_REMOTE_STREAM_STATS,EP(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("onLocalStreamStats",(function(e){T._networkQualityManager.updateUplinkStats(e),T.emit(xV.ON_LOCAL_STREAM_STATS,EP(e))})),null===(g=this._mediaServerClient)||void 0===g||g.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e})),null===(b=this._mediaServerClient)||void 0===b||b.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,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}),ZF.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=function(e){var t;hL.joinRoom(JU.END,a,!0,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),s(e)},this._joinRejectCallback=function(e){var t;hL.joinRoom(JU.END,a,!1,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)},this._liveControlMessage=n,this._roomInfo={appId:e,roomId:t,token:r,userInfo:i,useCloudProxy:o,roomProfile:this._roomConfig.roomProfileType},a=oP(),this.setSessionId(),hL.joinRoom(JU.BEGIN,a,!1,"",{enable_cloud_proxy:null===(u=this._roomInfo)||void 0===u?void 0:u.useCloudProxy}),this._join(this._joinResolveCallback,this._joinRejectCallback,!1),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,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=oP(),ZF.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,feedbackNode:this._getAccessFeedbackIceNode},r,this._liveControlMessage)];case 2:return o=s.sent(),this._mediaServerClient.roomAttributes=o.roomAttributes,this._reconnectRecord.clear(),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",oP()-n),this._onJoinSucc(o,r),[3,4];case 3:return(a=s.sent()).code!==QN.OPERATION_CANCEL&&"function"==typeof t?[2,t(a)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,r,i,n){var o,a,s,c,u;return ev(this,void 0,void 0,(function(){var d,l,h,p;return tv(this,(function(f){switch(f.label){case 0:return ZF.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new xF,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new KF(this._localScreenStream,this._mediaServerClient.handler))),d=!1,l=!1,h=!1,p=!1,!this._localScreenStream.videoTrack&&t?(t instanceof dF&&(l=!0),d=!0):this._localScreenStream.videoTrack&&!t&&(d=!1),!this._localScreenStream.audioTrack&&r?(r instanceof lF&&(p=!0),h=!0):this._localScreenStream.audioTrack&&!r&&(h=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=r,this._localScreenStream.videoEncodeConfig=e,i&&(SP(i)&&(this._localScreenStream.pubAudio=n===BV.PUB),yP(i)&&(this._localScreenStream.pubVideo=n===BV.PUB),ZF.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo?this._localScreenStream.hasPublished?[3,2]:(null===(o=this._localScreenStream.observer)||void 0===o||o.setPublish(!0),[4,this._mediaServerClient.publish(this._localScreenStream)]):[2,this.unpublishScreen()];case 1:return f.sent(),[3,4];case 2:return l?null===(a=this._localScreenStream.observer)||void 0===a||a.setPushVideo(d):null===(s=this._localScreenStream.observer)||void 0===s||s.setEnableVideo(d),p?null===(c=this._localScreenStream.observer)||void 0===c||c.setPushAudio(h):null===(u=this._localScreenStream.observer)||void 0===u||u.setEnableAudio(h),[4,this.updatePubScreenTrack()];case 3:f.sent(),f.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 ZF.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 ZF.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?(null===(e=this._localScreenStream.observer)||void 0===e||e.setPublish(!1),[4,this._mediaServerClient.unpublish(this._localScreenStream)]):[3,2];case 1:t.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,t.label=2;case 2:return[2]}}))}))},t.prototype.liveControlMessage=function(e){var t;return ev(this,void 0,void 0,(function(){var r=this;return tv(this,(function(i){switch(i.label){case 0:return ZF.print("controlMessage","Invoke controlMessage"),null===(t=e.transcodeMeta)||void 0===t||t.layout.regions.forEach((function(e){r.roomInfo&&(e.roomID=r.roomInfo.roomId)})),this._liveControlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return i.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 ZF.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,o,a){var s,c,u,d,l,h;return void 0===a&&(a=!1),ev(this,void 0,void 0,(function(){var p,f,_,v,m,S;return tv(this,(function(y){switch(y.label){case 0:if(ZF.print("publish","Invoke publish"),p=!1,this._localStream||(this._localStream=new xF,this._mediaServerClient.handler&&(this._localStream.observer=new KF(this._localStream,this._mediaServerClient.handler)),p=!0),this._localStream.videoTrack=r,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=e,this._localStream.enableSimulcast=t,n&&(SP(n)&&(this._localStream.pubAudio=o===BV.PUB),yP(n)&&(this._localStream.pubVideo=o===BV.PUB),ZF.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished)return[3,5];y.label=1;case 1:return y.trys.push([1,3,,4]),a?null===(s=this._localStream.observer)||void 0===s||s.setLogin(!0):p&&(f=!!this._localStream.videoTrack,_=!!this._localStream.audioTrack,v=this._localStream.videoTrack instanceof dF,m=this._localStream.audioTrack instanceof lF,this._roomConfig.isAutoPublish&&!this._hasPublished?(f&&(v?null===(c=this._localStream.observer)||void 0===c||c.setPushVideo(!0):null===(u=this._localStream.observer)||void 0===u||u.setEnableVideo(!0)),_&&(m?null===(d=this._localStream.observer)||void 0===d||d.setPushAudio(!0):null===(l=this._localStream.observer)||void 0===l||l.setEnableAudio(!0))):null===(h=this._localStream.observer)||void 0===h||h.setPublish(!0)),[4,this._mediaServerClient.publish(this._localStream)];case 2:return y.sent(),this._hasPublished=!0,this.emit(xV.ON_PUBLISH_RESULT,{isScreen:!1,state:mD.PUBLISH_SUCC}),[3,4];case 3:throw S=y.sent(),this.emit(xV.ON_PUBLISH_RESULT,{isScreen:!1,state:mD.PUBLISH_FAIL}),S;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:y.sent(),y.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return ZF.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 ZF.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(){var i;return tv(this,(function(n){switch(n.label){case 0:return ZF.print("subscribe","remoteStream %o",e),i=void 0,r&&(i=this._getSubLayer(r,e)),[4,this._mediaServerClient.subscribe(e,t,i)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r,i){var n;return ev(this,void 0,void 0,(function(){return tv(this,(function(o){return ZF.print("updateSubTrack","Invoke updateSubTrack"),[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(e,t,r,i)]}))}))},t.prototype.updateSubVideoConfig=function(e,t){var r,i,n;return ev(this,void 0,void 0,(function(){var o,a;return tv(this,(function(s){return!(o=this._findRemoteStreamByScreen(e,!1))||!o.hasSubscribed||(null===(i=null===(r=null==o?void 0:o.attributes)||void 0===r?void 0:r.videoDescriptions)||void 0===i?void 0:i.length)<=1?[2]:(a=this._getSubLayer(t,o),o.originalStreamIndex=a.spatialLayer,[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(o,o.subMediaType,jV.SUB,a)])}))}))},t.prototype._getSubLayer=function(e,t){for(var r,i,n,o,a,s=null==t?void 0:t.attributes,c=s.videoDescriptions,u=s.subVideoDescriptions,d=Array.isArray(u)?u:c,l=-1,h=e.width*e.height,p=0;p<(null==d?void 0:d.length);p++)if(h>=(null===(r=d[p])||void 0===r?void 0:r.width)*(null===(i=d[p])||void 0===i?void 0:i.height)){l=p;break}var f=d[0];if(-1===l)f=d[l=d.length-1];else if(0!==l){var _=d[l-1].width*d[l-1].height,v=(_-h)/(_-d[l].width*d[l].height);f=v<.1?d[l-1]:d[l],l=v<.1?l-1:l}return a=null!==(n=null==f?void 0:f.sub_index)&&void 0!==n?n:-1,{spatialLayer:null!==(o=null==f?void 0:f.video_index)&&void 0!==o?o:l,spatialSubLayer:a}},t.prototype.unsubscribe=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:return ZF.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e,t)];case 1:return r.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:ZF.print("leave","Invoke leave"),r=oP(),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,"",oP()-r),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&hL.rtcLeaveRoom(-1,a.message,oP()-r),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteUserPriority=function(e,t){var r,i;null===(r=this.remoteStreams.get(e))||void 0===r||r.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(i=this.userPriorityMap)||void 0===i||i.set(e,t)},t.prototype.destroy=function(){var e,t,r,i;ZF.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._context=void 0,this._reconnectRecord=new eB,this._removeHandlerEventHandler(),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy()},t.prototype.updateToken=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return ZF.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e),[4,this._mediaServerClient.updateToken(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return 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=s.updateSubTrack(r,e,jV.UNSUB);i&&t.push(i)}}))}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&&r.hasSubscribed){var i=s.updateSubTrack(r,e,jV.SUB);i&&t.push(i)}}))}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=tP(),_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,cP.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(){ZF.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new bF(this._context),this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var r,i,n,o,a,s=this;ZF.print("JoinSuccess()"),this._serverConfig=e.config;var c=[],u=[],d=[],l=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var 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:kL.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]),ZF.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType)];case 2:return r.sent(),ZF.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(xV.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=r.sent(),ZF.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;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 f=this._findRemoteStream(e.clientId,e.streamId);if(!f){f=new VF(e.clientId,e.streamId,e.screen,e.attributes,null===(n=this.userPriorityMap)||void 0===n?void 0:n.get(e.clientId)),this._initStreamListeners(f);var _=this._remoteStreams.get(e.clientId);_?_.push(f):this._remoteStreams.set(e.clientId,[f])}if(this._mediaServerClient.handler&&(f.observer=new BF(f,this._mediaServerClient.handler)),!f.isScreen&&(r&&f.hasVideo&&(f.attributes.extvideo?(null===(o=f.observer)||void 0===o||o.setExternalVideoSource(!0),null===(a=f.observer)||void 0===a||a.setPushVideo(!0)):(null===(s=f.observer)||void 0===s||s.setExternalVideoSource(!1),null===(c=f.observer)||void 0===c||c.setPublishVideo(!0))),r&&f.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(f.attributes.extaudio?(null===(u=f.observer)||void 0===u||u.setExternalAudioSource(!0),null===(d=f.observer)||void 0===d||d.setPushAudio(!0)):(null===(l=f.observer)||void 0===l||l.setExternalAudioSource(!1),null===(h=f.observer)||void 0===h||h.setPublishAudio(!0))),!0===t&&!1===r)){var v=this._roomConfig,m=v.isAutoSubscribeAudio,S=v.isAutoSubscribeVideo;null===(p=f.observer)||void 0===p||p.setLogin(!0,{audio:!!m,video:!!S})}return t&&this.safeEmit(UL.ON_ADD_STREAM,{stream:f}),f}},t.prototype._onUserConnection=function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var 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,Z_({},i)),this.safeEmit(UL.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===VL.kickedByAdmin?a=QN.KICKED_OUT:n===VL.onUserTokenDidExpire?a=QN.TOKEN_EXPIRED:n===VL.userDuplicateLogin&&(a=QN.DUPLICATE_LOGIN),o===FL.roomDismissByAdmin&&(a=QN.ROOM_DISMISS),a&&this.safeEmit(xV.ON_ROOM_ERROR,{errorCode:a})}else{var s=pD.DROPPED;n===VL.userLeave?s=pD.QUIT:n===VL.kickedByAdmin?s=pD.KICKED_BY_ADMIN:n===VL.roleChanged&&(s=pD.SWITCH_TO_INVISIBLE);var c=function(){r._remoteUsers.delete(i),r.safeEmit(xV.ON_USER_LEAVE,{userInfo:{userId:i},reason:s})};if(n===VL.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)}})).finally((function(){o.safeEmit(UL.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,y=e.clientId,E=e.streamId,g=e.attributes,b=this._findRemoteStream(y,E);if(b){var T=b.attributes,I=Z_(Z_({},T),g),R=!1,A=I.localaudio!==T.localaudio,C=!1,O=!1,N=I.localvideo!==T.localvideo,w=!1,D=UV.NONE,P=UV.NONE;I.audiostream!==T.audiostream&&(R=I.localaudio,C=!!I.audiostream,I.audiostream?D|=gD.AUDIO:P|=gD.AUDIO),I.videostream!==T.videostream&&(O=I.localvideo,w=!!I.videostream,I.videostream?D|=gD.VIDEO:P|=gD.VIDEO),D&&this.safeEmit(xV.ON_USER_PUBLISH_STATE_CHANGE,{userId:y,mediaType:D,isScreen:b.isScreen,pubState:BV.PUB,remoteStream:b}),P&&this.safeEmit(xV.ON_USER_PUBLISH_STATE_CHANGE,{userId:y,mediaType:P,isScreen:b.isScreen,pubState:BV.UNPUB,remoteStream:b}),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(xV.ON_USER_START_AUDIO_CAPTURE,{userId:y})):(I.extaudio?(null===(o=b.observer)||void 0===o||o.setExternalAudioSource(!0),null===(a=b.observer)||void 0===a||a.setPushAudio(!1)):(null===(s=b.observer)||void 0===s||s.setExternalAudioSource(!1),null===(c=b.observer)||void 0===c||c.setEnableAudio(!1)),!b.isScreen&&this.safeEmit(xV.ON_USER_STOP_AUDIO_CAPTURE,{userId:y}))),I.localvideo!==T.localvideo&&(I.localvideo?(I.extvideo?(null===(u=b.observer)||void 0===u||u.setExternalVideoSource(!0),null===(d=b.observer)||void 0===d||d.setPushVideo(!0)):(null===(l=b.observer)||void 0===l||l.setExternalVideoSource(!1),null===(h=b.observer)||void 0===h||h.setEnableVideo(!0)),this.safeEmit(xV.ON_USER_START_VIDEO_CAPTURE,{userId:y})):(I.extvideo?(null===(p=b.observer)||void 0===p||p.setExternalVideoSource(!0),null===(f=b.observer)||void 0===f||f.setPushVideo(!1)):(null===(_=b.observer)||void 0===_||_.setExternalVideoSource(!1),null===(v=b.observer)||void 0===v||v.setEnableVideo(!1)),!b.isScreen&&this.safeEmit(xV.ON_USER_STOP_VIDEO_CAPTURE,{userId:y}))),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(xV.SUBSCRIBE_PUSH_TRACK,{stream:n})})).catch((function(e){ZF.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(xV.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){ZF.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,r=e.nodes,i=e.reason;IL.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,bU.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,TU.PEERCONNECTION),this._join((function(){hL.rtcReconnected(IU.PEERCONNECTION_RECONNECTED,RU.PEERCONNECTION)}),(function(e){r._reconnectRecord.record(e),r._reconnectRecord.shouldReconnect?(ZF.print("Reconnecting error, will reconnect after 3s",e),r._reconnectTimer=setTimeout(r._reconnect.bind(r),3e3)):(r.safeEmit(xV.RECONNECT_FAILED),r.destroy())}),!0)},t.prototype._handleAbnormalDisconnection=function(){ZF.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===vF.DISCONNECTED)t=TD.CONNECTION_STATE_DISCONNECTED;else if(e.next===vF.CONNECTED)t=this._isReconnecting?TD.CONNECTION_STATE_RECONNECTED:TD.CONNECTION_STATE_CONNECTED;else{if(e.next!==vF.CONNECTING)return;t=this._isReconnecting?TD.CONNECTION_STATE_RECONNECTING:TD.CONNECTION_STATE_CONNECTING}this._networkQualityManager.setConnectionState(e.next),this.safeEmit(xL.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(xV.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?ED.STREAM_INDEX_SCREEN:ED.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(UL.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(UL.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(UL.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){if(e.body){var t=e.body,r=t.error||0,i=FV.START,n=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(i=FV.START_FAILED);break;case"TranscodeStateChanged":i=0!==t.error?FV.START_FAILED:FV.START_SUCCESS;break;case"TranscodeStopped":i=0!==t.error?FV.STOP_FAILED:FV.STOP_SUCCESS;break;case"TranscodeUpdated":i=0!==t.error?FV.UPDATE_FAILED:FV.UPDATE_SUCCESS}this.safeEmit(UL.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:i,message:n[r]})}this.safeEmit(UL.POST_PROCESSING_MESSAGE,{code:r,message:n[r],type:e.type})}},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(UL.ON_USER_TOKEN_WILL_EXPIRE,null)},t.prototype._onSceneConfig=function(e){var t,r,i=e.multiSceneConfig,n=_F[this._roomConfig.roomProfileType][1];if(i){var o=i[n];o&&o.engine_BAC&&(null===(t=this._context)||void 0===t||t.audioProfileManager.updateEngineBAC(o.engine_BAC)),o&&o.engine_ANM&&(null===(r=this._context)||void 0===r||r.audioProfileManager.updateEngineANM(o.engine_ANM))}},t.prototype._onStreamControlMessage=function(e){var t,r;e.type===ML.PushLimitWarn&&((null===(t=this._localStream)||void 0===t?void 0:t.pubAudio)||(null===(r=this._localStream)||void 0===r?void 0:r.pubVideo)||this.unpublish())},t.prototype._onPublishOnDemand=function(e){var t,r,i,n,o,a,s,c,u,d,l;if(!1!==(null===(i=null===(r=null===(t=this._serverConfig)||void 0===t?void 0:t.engine_VPM)||void 0===r?void 0:r.ondemand)||void 0===i?void 0:i.enable)&&(null===(n=this._localStream)||void 0===n?void 0:n.enableSimulcast)&&(null===(o=this._localStream)||void 0===o?void 0:o.videoTransceiver)){var h=null===(a=this._localStream)||void 0===a?void 0:a.stream.id,p=null===(s=this._localStream)||void 0===s?void 0:s.videoTransceiver.sender,f=p.getParameters();if(Array.isArray(f.encodings)&&Array.isArray(e)){var _={};ZF.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null===(t=null==e?void 0:e.StreamIds)||void 0===t?void 0:t.includes(h)){var r=null==e?void 0:e.Metadata.SubvideoIndex;_[r]=r}}));var v={};null===(u=null===(c=this._localStream)||void 0===c?void 0:c.subVideoDescriptions)||void 0===u||u.forEach((function(e){void 0!==_[e.sub_index]&&(v[e.video_index]=e)}));var m=(null===(l=null===(d=p.track)||void 0===d?void 0:d.getSettings())||void 0===l?void 0:l.height)||720,S=[];f.encodings=f.encodings.map((function(e){return e.rid&&(v[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/v[e.rid].height,1),S.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy})):(S.push({type:0,rid:e.rid}),e.active=!1)),e})),hL.rtcInvokeStatus(JSON.stringify(S),0,"rscp",h,0)}p.setParameters(f)}},t.prototype._reportNetworkQuality=function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(xV.ON_NETWORK_QUALITY,e,t)},t.prototype._emitVideoSizeChange=function(e,t,r,i){var n;this.emit(xV.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(n=this.roomInfo)||void 0===n?void 0:n.roomId,userId:e,streamIndex:t?ED.STREAM_INDEX_SCREEN:ED.STREAM_INDEX_MAIN},{width:r,height:i})},t.prototype._emitSubscribeFallback=function(e){this.emit(xV.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)},t}(FP),eB=function(){function e(){this._all_201_count=0,this._has_4xx=!1}return Object.defineProperty(e.prototype,"shouldReconnect",{get:function(){return!(this._all_201_count>=3||this._has_4xx)},enumerable:!1,configurable:!0}),e.prototype.record=function(e){var t=!1,r=!1;if(Array.isArray(e)){var i=0;e.map((function(e){var t,n,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(n=e.error)||void 0===n?void 0:n.code)<500&&(r=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&i++})),i===e.length&&(t=!0),t&&this._all_201_count++,r&&(this._has_4xx=!0)}},e.prototype.clear=function(){this._all_201_count=0,this._has_4xx=!1},e}(),tB=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},rB=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},iB=new xP("Player",0),nB=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],oB={playsinline:"","webkit-playsinline":""},aB={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},sB=new(function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var r="audio"===e?oB:aB;if("video"===e&&this.videoCache.length>0){if(i=this.videoCache.pop())return rB(i,{style:t,attributes:r}),i}else if("audio"===e&&this.audioCache.length>0){var i;if(i=this.audioCache.pop())return rB(i,{style:t,attributes:r}),i}return tB(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}()),cB=function(e){function t(t){var r=e.call(this)||this;r.mirrorType=ID.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:yD.RENDER_MODE_FIT;var o="string"==typeof i?document.getElementById(i):i;if(!o)throw new tw(QN.CANT_FIND_DOM,"can't find dom");return r._containerDom=o,r.userId=n,r.isScreen=!!t.isScreen,r._initVideo(),r}return Q_(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=sB.getOrCreate("video",{width:"100%",height:"100%",background:"black"}),this._videoDom.id="".concat(this.userId,"_").concat(nP()),this.renderMode===yD.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===ID.MIRROR_TYPE_RENDER)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&nB.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&&(nB.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,iB.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),iB.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(iB.print("Invoke AudioPlayer.manuallyPlay"),!this._videoDom)throw new tw(QN.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){iB.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?ID.MIRROR_TYPE_RENDER:ID.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;iB.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(){iB.print("destroy","video player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._videoDom&&(sB.recycle(this._videoDom),delete this._videoDom)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(MP.exports.EventEmitter),uB=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(QN.CANT_FIND_DOM,"can't find dom");i._containerDom=n}else i._containerDom=document.body;return i.userId=t,i._initAudio(),i}return Q_(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=sB.getOrCreate("audio",{display:"none"}),this._audioDom.id="".concat(this.userId,"_").concat(nP()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&nB.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&&(nB.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 iB.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(iB.print("Invoke AudioPlayer.manuallyPlay"),!this._audioDom)throw new tw(QN.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 iB.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,WV.enumerateAudioPlaybackDevices()];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;iB.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(){iB.print("destroy","audio player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._audioDom&&(sB.recycle(this._audioDom),delete this._audioDom)},t}(MP.exports.EventEmitter),dB="object"==("undefined"==typeof global?"undefined":us(global))&&global&&global.Object===Object&&global,lB="object"==("undefined"==typeof self?"undefined":us(self))&&self&&self.Object===Object&&self,hB=dB||lB||Function("return this")(),pB=hB.Symbol,fB=Object.prototype,_B=fB.hasOwnProperty,vB=fB.toString,mB=pB?pB.toStringTag:void 0;var SB=Object.prototype.toString;var yB=pB?pB.toStringTag:void 0;function EB(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":yB&&yB in Object(e)?function(e){var t=_B.call(e,mB),r=e[mB];try{e[mB]=void 0;var i=!0}catch(e){}var n=vB.call(e);return i&&(t?e[mB]=r:delete e[mB]),n}(e):function(e){return SB.call(e)}(e)}function gB(e){return null!=e&&"object"==us(e)}var bB=Array.isArray;function TB(e){var t=us(e);return null!=e&&("object"==t||"function"==t)}function IB(e){return e}function RB(e){if(!TB(e))return!1;var t=EB(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var AB=hB["__core-js_shared__"],CB=function(){var e=/[^.]+$/.exec(AB&&AB.keys&&AB.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var OB=Function.prototype.toString;var NB=/^\[object .+?Constructor\]$/,wB=Function.prototype,DB=Object.prototype,PB=wB.toString,kB=DB.hasOwnProperty,MB=RegExp("^"+PB.call(kB).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function UB(e){return!(!TB(e)||(t=e,CB&&CB in t))&&(RB(e)?MB:NB).test(function(e){if(null!=e){try{return OB.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function LB(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 xB=Date.now;var VB,FB,BB,jB=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return UB(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),GB=jB,HB=GB?function(e,t){return GB(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:IB,zB=(VB=HB,FB=0,BB=0,function(){var e=xB(),t=16-(e-BB);if(BB=e,t>0){if(++FB>=800)return arguments[0]}else FB=0;return VB.apply(void 0,arguments)}),KB=/^(?:0|[1-9]\d*)$/;function WB(e,t){var r=us(e);return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&KB.test(e))&&e>-1&&e%1==0&&e<t}function XB(e,t,r){"__proto__"==t&&GB?GB(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function YB(e,t){return e===t||e!=e&&t!=t}var JB=Object.prototype.hasOwnProperty;function qB(e,t,r){var i=e[t];JB.call(e,t)&&YB(i,r)&&(void 0!==r||t in e)||XB(e,t,r)}var QB=Math.max;function ZB(e,t){return zB(function(e,t,r){return t=QB(void 0===t?e.length-1:t,0),function(){for(var i=arguments,n=-1,o=QB(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),LB(e,this,s)}}(e,t,IB),e+"")}function $B(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function ej(e){return null!=e&&$B(e.length)&&!RB(e)}var tj=Object.prototype;function rj(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||tj)}function ij(e){return gB(e)&&"[object Arguments]"==EB(e)}var nj=Object.prototype,oj=nj.hasOwnProperty,aj=nj.propertyIsEnumerable,sj=ij(function(){return arguments}())?ij:function(e){return gB(e)&&oj.call(e,"callee")&&!aj.call(e,"callee")};var cj="object"==("undefined"==typeof exports?"undefined":us(exports))&&exports&&!exports.nodeType&&exports,uj=cj&&"object"==("undefined"==typeof module?"undefined":us(module))&&module&&!module.nodeType&&module,dj=uj&&uj.exports===cj?hB.Buffer:void 0,lj=(dj?dj.isBuffer:void 0)||function(){return!1},hj={};hj["[object Float32Array]"]=hj["[object Float64Array]"]=hj["[object Int8Array]"]=hj["[object Int16Array]"]=hj["[object Int32Array]"]=hj["[object Uint8Array]"]=hj["[object Uint8ClampedArray]"]=hj["[object Uint16Array]"]=hj["[object Uint32Array]"]=!0,hj["[object Arguments]"]=hj["[object Array]"]=hj["[object ArrayBuffer]"]=hj["[object Boolean]"]=hj["[object DataView]"]=hj["[object Date]"]=hj["[object Error]"]=hj["[object Function]"]=hj["[object Map]"]=hj["[object Number]"]=hj["[object Object]"]=hj["[object RegExp]"]=hj["[object Set]"]=hj["[object String]"]=hj["[object WeakMap]"]=!1;var pj="object"==("undefined"==typeof exports?"undefined":us(exports))&&exports&&!exports.nodeType&&exports,fj=pj&&"object"==("undefined"==typeof module?"undefined":us(module))&&module&&!module.nodeType&&module,_j=fj&&fj.exports===pj&&dB.process,vj=function(){try{var e=fj&&fj.require&&fj.require("util").types;return e||_j&&_j.binding&&_j.binding("util")}catch(e){}}(),mj=vj&&vj.isTypedArray,Sj=mj?function(e){return function(t){return e(t)}}(mj):function(e){return gB(e)&&$B(e.length)&&!!hj[EB(e)]},yj=Sj,Ej=Object.prototype.hasOwnProperty;function gj(e,t){var r=bB(e),i=!r&&sj(e),n=!r&&!i&&lj(e),o=!r&&!i&&!n&&yj(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&&!Ej.call(e,u)||a&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||WB(u,c))||s.push(u);return s}var bj=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Tj=bj,Ij=Object.prototype.hasOwnProperty;function Rj(e){return ej(e)?gj(e):function(e){if(!rj(e))return Tj(e);var t=[];for(var r in Object(e))Ij.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var Aj=Object.prototype.hasOwnProperty;function Cj(e){if(!TB(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=rj(e),r=[];for(var i in e)("constructor"!=i||!t&&Aj.call(e,i))&&r.push(i);return r}var Oj,Nj=(Oj=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?XB(r,s,c):qB(r,s,c)}}(t,function(e){return ej(e)?gj(e,!0):Cj(e)}(t),e)},ZB((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=Oj.length>3&&"function"==typeof n?(i--,n):void 0,o&&function(e,t,r){if(!TB(r))return!1;var i=us(t);return!!("number"==i?ej(r)&&WB(t,r.length):"string"==i&&t in r)&&YB(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&&Oj(e,a,r,n)}return e}))),wj=Nj;function Dj(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 Pj(e){return null==e?[]:Dj(e,Rj(e))}var kj=o,Mj=Qe("iterator"),Uj=!kj((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[Mj]||"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})),Lj=T,xj=/[^\0-\u007E]/,Vj=/[.\u3002\uFF0E\uFF61]/g,Fj="Overflow: input needs wider integers to process",Bj=i.RangeError,jj=Lj(Vj.exec),Gj=Math.floor,Hj=String.fromCharCode,zj=Lj("".charCodeAt),Kj=Lj([].join),Wj=Lj([].push),Xj=Lj("".replace),Yj=Lj("".split),Jj=Lj("".toLowerCase),qj=function(e){return e+22+75*(e<26)},Qj=function(e,t,r){var i=0;for(e=r?Gj(e/700):e>>1,e+=Gj(e/t);e>455;)e=Gj(e/35),i+=36;return Gj(i+36*e/(e+38))},Zj=function(e){var t=[];e=function(e){for(var t=[],r=0,i=e.length;r<i;){var n=zj(e,r++);if(n>=55296&&n<=56319&&r<i){var o=zj(e,r++);56320==(64512&o)?Wj(t,((1023&n)<<10)+(1023&o)+65536):(Wj(t,n),r--)}else Wj(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&&Wj(t,Hj(i));var c=t.length,u=c;for(c&&Wj(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>Gj((2147483647-a)/l))throw Bj(Fj);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((i=e[r])<o&&++a>2147483647)throw Bj(Fj);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;Wj(t,Hj(qj(f+_%v))),h=Gj(_/v),p+=36}Wj(t,Hj(qj(h))),s=Qj(a,l,u==c),a=0,u++}}a++,o++}return Kj(t,"")},$j=Bi,eG=i,tG=K,rG=d,iG=T,nG=Uj,oG=Ht.exports,aG=Ku,sG=vc,cG=pf,uG=br,dG=$u,lG=F,hG=Ue,pG=zi,fG=rn,_G=Dt,vG=j,mG=qo,SG=ko,yG=m,EG=vd,gG=ud,bG=$d,TG=dT,IG=Qe("iterator"),RG=uG.set,AG=uG.getterFor("URLSearchParams"),CG=uG.getterFor("URLSearchParamsIterator"),OG=tG("fetch"),NG=tG("Request"),wG=tG("Headers"),DG=NG&&NG.prototype,PG=wG&&wG.prototype,kG=eG.RegExp,MG=eG.TypeError,UG=eG.decodeURIComponent,LG=eG.encodeURIComponent,xG=iG("".charAt),VG=iG([].join),FG=iG([].push),BG=iG("".replace),jG=iG([].shift),GG=iG([].splice),HG=iG("".split),zG=iG("".slice),KG=/\+/g,WG=Array(4),XG=function(e){return WG[e-1]||(WG[e-1]=kG("((?:%[\\da-f]{2}){"+e+"})","gi"))},YG=function(e){try{return UG(e)}catch(t){return e}},JG=function(e){var t=BG(e,KG," "),r=4;try{return UG(t)}catch(e){for(;r;)t=BG(t,XG(r--),YG);return t}},qG=/[!'()~]|%20/g,QG={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},ZG=function(e){return QG[e]},$G=function(e){return BG(LG(e),qG,ZG)},eH=cG((function(e,t){RG(this,{type:"URLSearchParamsIterator",iterator:EG(AG(e).entries),kind:t})}),"Iterator",(function(){var e=CG(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),tH=function(e){this.entries=[],this.url=null,void 0!==e&&(vG(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===xG(e,0)?zG(e,1):e:mG(e)))};tH.prototype={type:"URLSearchParams",bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,n,o,a,s,c=gG(e);if(c)for(r=(t=EG(e,c)).next;!(i=rG(r,t)).done;){if(o=(n=EG(_G(i.value))).next,(a=rG(o,n)).done||(s=rG(o,n)).done||!rG(o,n).done)throw MG("Expected sequence with length 2");FG(this.entries,{key:mG(a.value),value:mG(s.value)})}else for(var u in e)hG(e,u)&&FG(this.entries,{key:u,value:mG(e[u])})},parseQuery:function(e){if(e)for(var t,r,i=HG(e,"&"),n=0;n<i.length;)(t=i[n++]).length&&(r=HG(t,"="),FG(this.entries,{key:JG(jG(r)),value:JG(VG(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],FG(r,$G(e.key)+"="+$G(e.value));return VG(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var rH=function(){dG(this,iH);var e=arguments.length>0?arguments[0]:void 0;RG(this,new tH(e))},iH=rH.prototype;if(aG(iH,{append:function(e,t){bG(arguments.length,2);var r=AG(this);FG(r.entries,{key:mG(e),value:mG(t)}),r.updateURL()},delete:function(e){bG(arguments.length,1);for(var t=AG(this),r=t.entries,i=mG(e),n=0;n<r.length;)r[n].key===i?GG(r,n,1):n++;t.updateURL()},get:function(e){bG(arguments.length,1);for(var t=AG(this).entries,r=mG(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){bG(arguments.length,1);for(var t=AG(this).entries,r=mG(e),i=[],n=0;n<t.length;n++)t[n].key===r&&FG(i,t[n].value);return i},has:function(e){bG(arguments.length,1);for(var t=AG(this).entries,r=mG(e),i=0;i<t.length;)if(t[i++].key===r)return!0;return!1},set:function(e,t){bG(arguments.length,1);for(var r,i=AG(this),n=i.entries,o=!1,a=mG(e),s=mG(t),c=0;c<n.length;c++)(r=n[c]).key===a&&(o?GG(n,c--,1):(o=!0,r.value=s));o||FG(n,{key:a,value:s}),i.updateURL()},sort:function(){var e=AG(this);TG(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=AG(this).entries,i=pG(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 eH(this,"keys")},values:function(){return new eH(this,"values")},entries:function(){return new eH(this,"entries")}},{enumerable:!0}),oG(iH,IG,iH.entries,{name:"entries"}),oG(iH,"toString",(function(){return AG(this).serialize()}),{enumerable:!0}),sG(rH,"URLSearchParams"),$j({global:!0,forced:!nG},{URLSearchParams:rH}),!nG&&lG(wG)){var nH=iG(PG.has),oH=iG(PG.set),aH=function(e){if(vG(e)){var t,r=e.body;if("URLSearchParams"===fG(r))return t=e.headers?new wG(e.headers):new wG,nH(t,"content-type")||oH(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),SG(e,{body:yG(0,mG(r)),headers:yG(0,t)})}return e};if(lG(OG)&&$j({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return OG(e,arguments.length>1?aH(arguments[1]):{})}}),lG(NG)){var sH=function(e){return dG(this,DG),new NG(e,arguments.length>1?aH(arguments[1]):{})};DG.constructor=sH,sH.prototype=DG,$j({global:!0,forced:!0},{Request:sH})}}var cH,uH={URLSearchParams:rH,getState:AG},dH=Bi,lH=a,hH=Uj,pH=i,fH=zi,_H=T,vH=uo.f,mH=Ht.exports,SH=$u,yH=Ue,EH=ws,gH=Bw,bH=$s,TH=Qf.codeAt,IH=function(e){var t,r,i=[],n=Yj(Xj(Jj(e),Vj,"."),".");for(t=0;t<n.length;t++)r=n[t],Wj(i,jj(xj,r)?"xn--"+Zj(r):r);return Kj(i,".")},RH=qo,AH=vc,CH=$d,OH=uH,NH=br,wH=NH.set,DH=NH.getterFor("URL"),PH=OH.URLSearchParams,kH=OH.getState,MH=pH.URL,UH=pH.TypeError,LH=pH.parseInt,xH=Math.floor,VH=Math.pow,FH=_H("".charAt),BH=_H(/./.exec),jH=_H([].join),GH=_H(1..toString),HH=_H([].pop),zH=_H([].push),KH=_H("".replace),WH=_H([].shift),XH=_H("".split),YH=_H("".slice),JH=_H("".toLowerCase),qH=_H([].unshift),QH=/[a-z]/i,ZH=/[\d+-.a-z]/i,$H=/\d/,ez=/^0x/i,tz=/^[0-7]+$/,rz=/^\d+$/,iz=/^[\da-f]+$/i,nz=/[\0\t\n\r #%/:<>?@[\\\]^|]/,oz=/[\0\t\n\r #/:<>?@[\\\]^|]/,az=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,sz=/[\t\n\r]/g,cz=function(e){var t,r,i,n;if("number"==typeof e){for(t=[],r=0;r<4;r++)qH(t,e%256),e=xH(e/256);return jH(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+=GH(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},uz={},dz=EH({},uz,{" ":1,'"':1,"<":1,">":1,"`":1}),lz=EH({},dz,{"#":1,"?":1,"{":1,"}":1}),hz=EH({},lz,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),pz=function(e,t){var r=TH(e,0);return r>32&&r<127&&!yH(t,e)?e:encodeURIComponent(e)},fz={ftp:21,file:null,http:80,https:443,ws:80,wss:443},_z=function(e,t){var r;return 2==e.length&&BH(QH,FH(e,0))&&(":"==(r=FH(e,1))||!t&&"|"==r)},vz=function(e){var t;return e.length>1&&_z(YH(e,0,2))&&(2==e.length||"/"===(t=FH(e,2))||"\\"===t||"?"===t||"#"===t)},mz=function(e){return"."===e||"%2e"===JH(e)},Sz={},yz={},Ez={},gz={},bz={},Tz={},Iz={},Rz={},Az={},Cz={},Oz={},Nz={},wz={},Dz={},Pz={},kz={},Mz={},Uz={},Lz={},xz={},Vz={},Fz=function(e,t,r){var i,n,o,a=RH(e);if(t){if(n=this.parse(a))throw UH(n);this.searchParams=null}else{if(void 0!==r&&(i=new Fz(r,!0)),n=this.parse(a,null,i))throw UH(n);(o=kH(new PH)).bindURL(this),this.searchParams=o}};Fz.prototype={type:"URL",parse:function(e,t,r){var i,n,o,a,s,c=this,u=t||Sz,d=0,l="",h=!1,p=!1,f=!1;for(e=RH(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=KH(e,az,"")),e=KH(e,sz,""),i=gH(e);d<=i.length;){switch(n=i[d],u){case Sz:if(!n||!BH(QH,n)){if(t)return"Invalid scheme";u=Ez;continue}l+=JH(n),u=yz;break;case yz:if(n&&(BH(ZH,n)||"+"==n||"-"==n||"."==n))l+=JH(n);else{if(":"!=n){if(t)return"Invalid scheme";l="",u=Ez,d=0;continue}if(t&&(c.isSpecial()!=yH(fz,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&fz[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=Dz:c.isSpecial()&&r&&r.scheme==c.scheme?u=gz:c.isSpecial()?u=Rz:"/"==i[d+1]?(u=bz,d++):(c.cannotBeABaseURL=!0,zH(c.path,""),u=Lz)}break;case Ez:if(!r||r.cannotBeABaseURL&&"#"!=n)return"Invalid scheme";if(r.cannotBeABaseURL&&"#"==n){c.scheme=r.scheme,c.path=bH(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=Vz;break}u="file"==r.scheme?Dz:Tz;continue;case gz:if("/"!=n||"/"!=i[d+1]){u=Tz;continue}u=Az,d++;break;case bz:if("/"==n){u=Cz;break}u=Uz;continue;case Tz:if(c.scheme=r.scheme,n==cH)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=bH(r.path),c.query=r.query;else if("/"==n||"\\"==n&&c.isSpecial())u=Iz;else if("?"==n)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=bH(r.path),c.query="",u=xz;else{if("#"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=bH(r.path),c.path.length--,u=Uz;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=bH(r.path),c.query=r.query,c.fragment="",u=Vz}break;case Iz:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=Uz;continue}u=Cz}else u=Az;break;case Rz:if(u=Az,"/"!=n||"/"!=FH(l,d+1))continue;d++;break;case Az:if("/"!=n&&"\\"!=n){u=Cz;continue}break;case Cz:if("@"==n){h&&(l="%40"+l),h=!0,o=gH(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||f){var m=pz(v,hz);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(n==cH||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=gH(l).length+1,l="",u=Oz}else l+=n;break;case Oz:case Nz:if(t&&"file"==c.scheme){u=kz;continue}if(":"!=n||p){if(n==cH||"/"==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=Mz,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=wz,t==Nz)return}break;case wz:if(!BH($H,n)){if(n==cH||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var S=LH(l,10);if(S>65535)return"Invalid port";c.port=c.isSpecial()&&S===fz[c.scheme]?null:S,l=""}if(t)return;u=Mz;continue}return"Invalid port"}l+=n;break;case Dz:if(c.scheme="file","/"==n||"\\"==n)u=Pz;else{if(!r||"file"!=r.scheme){u=Uz;continue}if(n==cH)c.host=r.host,c.path=bH(r.path),c.query=r.query;else if("?"==n)c.host=r.host,c.path=bH(r.path),c.query="",u=xz;else{if("#"!=n){vz(jH(bH(i,d),""))||(c.host=r.host,c.path=bH(r.path),c.shortenPath()),u=Uz;continue}c.host=r.host,c.path=bH(r.path),c.query=r.query,c.fragment="",u=Vz}}break;case Pz:if("/"==n||"\\"==n){u=kz;break}r&&"file"==r.scheme&&!vz(jH(bH(i,d),""))&&(_z(r.path[0],!0)?zH(c.path,r.path[0]):c.host=r.host),u=Uz;continue;case kz:if(n==cH||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&_z(l))u=Uz;else if(""==l){if(c.host="",t)return;u=Mz}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=Mz}continue}l+=n;break;case Mz:if(c.isSpecial()){if(u=Uz,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=cH&&(u=Uz,"/"!=n))continue}else c.fragment="",u=Vz;else c.query="",u=xz;break;case Uz:if(n==cH||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(s=JH(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||zH(c.path,"")):mz(l)?"/"==n||"\\"==n&&c.isSpecial()||zH(c.path,""):("file"==c.scheme&&!c.path.length&&_z(l)&&(c.host&&(c.host=""),l=FH(l,0)+":"),zH(c.path,l)),l="","file"==c.scheme&&(n==cH||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)WH(c.path);"?"==n?(c.query="",u=xz):"#"==n&&(c.fragment="",u=Vz)}else l+=pz(n,lz);break;case Lz:"?"==n?(c.query="",u=xz):"#"==n?(c.fragment="",u=Vz):n!=cH&&(c.path[0]+=pz(n,uz));break;case xz:t||"#"!=n?n!=cH&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":pz(n,uz)):(c.fragment="",u=Vz);break;case Vz:n!=cH&&(c.fragment+=pz(n,dz))}d++}},parseHost:function(e){var t,r,i;if("["==FH(e,0)){if("]"!=FH(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 FH(e,l)};if(":"==h()){if(":"!=FH(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&BH(iz,h());)t=16*t+LH(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(!BH($H,h()))return;for(;BH($H,h());){if(o=LH(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}(YH(e,1,-1)),!t)return"Invalid host";this.host=t}else if(this.isSpecial()){if(e=IH(e),BH(nz,e))return"Invalid host";if(t=function(e){var t,r,i,n,o,a,s,c=XH(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"==FH(n,0)&&(o=BH(ez,n)?16:8,n=YH(n,8==o?1:2)),""===n)a=0;else{if(!BH(10==o?rz:8==o?tz:iz,n))return e;a=LH(n,o)}zH(r,a)}for(i=0;i<t;i++)if(a=r[i],i==t-1){if(a>=VH(256,5-t))return null}else if(a>255)return null;for(s=HH(r),i=0;i<r.length;i++)s+=r[i]*VH(256,3-i);return s}(e),null===t)return"Invalid host";this.host=t}else{if(BH(oz,e))return"Invalid host";for(t="",r=gH(e),i=0;i<r.length;i++)t+=pz(r[i],uz);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return yH(fz,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&_z(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+=cz(n),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+jH(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw UH(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new Bz(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+cz(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(RH(e)+":",Sz)},getUsername:function(){return this.username},setUsername:function(e){var t=gH(RH(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=pz(t[r],hz)}},getPassword:function(){return this.password},setPassword:function(e){var t=gH(RH(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=pz(t[r],hz)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?cz(e):cz(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,Oz)},getHostname:function(){var e=this.host;return null===e?"":cz(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Nz)},getPort:function(){var e=this.port;return null===e?"":RH(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=RH(e))?this.port=null:this.parse(e,wz))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+jH(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,Mz))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=RH(e))?this.query=null:("?"==FH(e,0)&&(e=YH(e,1)),this.query="",this.parse(e,xz)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=RH(e))?("#"==FH(e,0)&&(e=YH(e,1)),this.fragment="",this.parse(e,Vz)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Bz=function(e){var t=SH(this,jz),r=CH(arguments.length,1)>1?arguments[1]:void 0,i=wH(t,new Fz(e,!1,r));lH||(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())},jz=Bz.prototype,Gz=function(e,t){return{get:function(){return DH(this)[e]()},set:t&&function(e){return DH(this)[t](e)},configurable:!0,enumerable:!0}};if(lH&&vH(jz,{href:Gz("serialize","setHref"),origin:Gz("getOrigin"),protocol:Gz("getProtocol","setProtocol"),username:Gz("getUsername","setUsername"),password:Gz("getPassword","setPassword"),host:Gz("getHost","setHost"),hostname:Gz("getHostname","setHostname"),port:Gz("getPort","setPort"),pathname:Gz("getPathname","setPathname"),search:Gz("getSearch","setSearch"),searchParams:Gz("getSearchParams"),hash:Gz("getHash","setHash")}),mH(jz,"toJSON",(function(){return DH(this).serialize()}),{enumerable:!0}),mH(jz,"toString",(function(){return DH(this).serialize()}),{enumerable:!0}),MH){var Hz=MH.createObjectURL,zz=MH.revokeObjectURL;Hz&&mH(Bz,"createObjectURL",fH(Hz,MH)),zz&&mH(Bz,"revokeObjectURL",fH(zz,MH))}AH(Bz,"URL"),dH({global:!0,forced:!hH,sham:!lH},{URL:Bz});var Kz,Wz=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,IP(n=r.type,"mixingType",Pj(xx)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=ZV(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:Vx.AUDIO_MIXING_STATE_STOPPED,error:ZN.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:Vx.AUDIO_MIXING_STATE_FAILED,error:ZN.AUDIO_MIXING_ERROR_START_FAILED}),new tw(QN.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:Vx.AUDIO_MIXING_STATE_FINISHED,error:ZN.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===xx.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:Vx.AUDIO_MIXING_STATE_PLAYING,error:ZN.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:Vx.AUDIO_MIXING_STATE_STOPPED,error:ZN.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:Vx.AUDIO_MIXING_STATE_PAUSED,error:ZN.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:Vx.AUDIO_MIXING_STATE_PLAYING,error:ZN.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:Vx.AUDIO_MIXING_STATE_PRELOADED,error:ZN.AUDIO_MIXING_ERROR_OK}),t.arrayBuffer();throw i._context.emitMessage({mixId:e,state:Vx.AUDIO_MIXING_STATE_FAILED,error:ZN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new tw(QN.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(e){throw new tw(QN.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){IP(e,"type",Pj(xx));var t=this._context.getLocalAudioTrack();if(t){var r=ZV(t.getTrack());if(r&&this.mixMediaStream(r),e===xx.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:Vx.AUDIO_MIXING_STATE_PCM_ENABLED,error:ZN.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:Vx.AUDIO_MIXING_STATE_PCM_DISABLED,error:ZN.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()},$_([yL("default","id","filePath","options")],e.prototype,"startAudioMixing",null),$_([yL("default","id")],e.prototype,"stopAudioMixing",null),$_([yL("default","id")],e.prototype,"pauseAudioMixing",null),$_([yL("default","id")],e.prototype,"resumeAudioMixing",null),$_([yL("default","id")],e.prototype,"preloadAudioMixing",null),$_([yL("default","id")],e.prototype,"unloadAudioMixing",null),$_([yL("default","id")],e.prototype,"getAudioMixingVolume",null),$_([yL("default","id","volume")],e.prototype,"setAudioMixingVolume",null),$_([yL("default","id")],e.prototype,"getAudioMixingDuration",null),$_([yL("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),$_([yL("default","id","position")],e.prototype,"setAudioMixingPosition",null),$_([yL("default","type")],e.prototype,"enableAudioMixingBuffer",null),$_([yL()],e.prototype,"disableAudioMixingBuffer",null),$_([yL("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(Kz||(Kz={}));var Xz=new xP("RTMClient",1),Yz=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r._dataChannelSignal=null,r._handler=null,r._dataChannelSignalState=vF.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 Q_(t,e),t.prototype.login=function(e,t){var r=this;return new Promise((function(i,n){if(Xz.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new tw(QN.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new tw(QN.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():(Xz.print("login","init dataChannelSingling"),r._dataChannelSignalState=vF.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(QN.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:JL.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(QN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:JL.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(QN.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(QN.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:JL.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(QN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:GL.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=nP();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:cP.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:XL.VERSION,deviceId:IL.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:JL.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=QN.INVALID_PARAMS,i="Invalid userId"):(r=QN.INVALID_TOKEN,i="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=QN.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,s=this;return tv(this,(function(c){switch(c.label){case 0:if(t=new tx,r=this._iceConfigNode)return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,null==t?void 0:t.getAccessNode(this._appId,"",e,IL.getDeviceId(),"")];case 2:if(i=c.sent(),!(r=i[0]))throw new Error;return[3,4];case 3:throw c.sent(),gL("rtm.login.getNodeFailed","",0,!0),new tw(QN.ICE_SERVER_WRONG,"get ICE config failed");case 4:gL("rtm.login.getNodeSuccess",r,0,!0),Xz.print("_createDataChannelSignaling()","get node success",r),this._handler=new Yx(pL),this._handler.once("disconnect",(function(){Xz.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),s._onDisconnect()})),c.label=5;case 5:return c.trys.push([5,7,,8]),[4,this._handler.connect(r)];case 6:return n=c.sent(),Xz.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=vF.CONNECTED,[3,8];case 7:throw o=c.sent(),this._iceConfigNode=null,this._dataChannelSignalState=vF.DISCONNECTED,new tw(QN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",o);case 8:return a=new ZL(n),Xz.print("_createDataChannelSignaling()","send ping"),a.sendPingSignaling(),a.once("close",(function(){Xz.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),s._onDisconnect()})),a.on(UL.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){s.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),a.on(UL.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){s.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),a.on(UL.USER_DISCONNECTION,(function(){s.emit("onUserDisconnection"),s._clearState()})),a.on(UL.NODE_CHANGE,(function(e){gL("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(s._iceConfigNode=e.nodes[0]),s._loginResolveCallback&&s._loginRejectCallback?s._login():s._reconnect()})),[2,a]}}))}))},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!==vF.CONNECTED)throw new tw(QN.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=vF.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&&(Xz.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){Xz.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){Xz.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}(MP.exports.EventEmitter),Jz=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r.remoteStreams=new Map,r}return Q_(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 bF,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,r=this;return tv(this,(function(i){switch(i.label){case 0:if(this.remoteStreams.get(e))throw new tw(QN.REPEAT_PLAY,"repeat play public media stream");return(t=new VF(e,e,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var i=function(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var r={seiCount:0,seis:[]},i=!1,n=2;n<t.byteLength;){var o=t.getUint16(n);if(n+=2,t.byteLength-n<o){i=!0;break}var a=new Uint8Array(e.buffer,n,o);if(n+=o,t.byteLength-n>0&&t.byteLength-n<=2){i=!0;break}r.seiCount++,r.seis.push(a)}return i&&(r.seiCount=1,r.seis=[e]),r}(e),n=0;n<i.seiCount;n++)r.emit(xV.ON_SEI_MESSAGED_RECEIVED,{sei:i.seis[n],publicStreamId:t.streamId})})),[4,this._mediaServerClient.subscribePublicStream(t)];case 1:return i.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(xV.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(xL.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))},t}(FP),qz=new xP("AudioDeviceManager",1),Qz=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._isAudioPlaybackDeviceTesting=!1,t._isAudioDeviceRecordTesting=!1,t}return Q_(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(QN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");this._isAudioPlaybackDeviceTesting=!0,qz.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&&(qz.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(QN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");return this._isAudioDeviceRecordTesting=!0,qz.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){qz.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(){qz.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()},t.prototype.stopAudioDevicePlayTest=function(){this._isAudioDeviceRecordTesting&&(qz.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.getRecordTrack=function(){return this._audioTrack},t.prototype.destroy=function(){qz.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=tB("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),r._audioElement.loop=t.loop,qz.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),r._audioElement.oncanplay=function(){qz.print("_playAudioFile()","oncanplay"),i()},r._audioElement.onerror=function(e){var t,i;n(new tw(QN.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&&(qz.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&&(qz.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new YV(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&&(qz.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,pF({})];case 1:return t._audioTrack=n.sent(),r=ZV(this._audioTrack.getTrack()),qz.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];qz.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(QN.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}(MP.exports.EventEmitter),Zz=function(){function e(){this.engineBAC={},this.engineANM={},this._init()}return e.prototype._init=function(){return ev(this,void 0,void 0,(function(){var e,t;return tv(this,(function(r){switch(r.label){case 0:return e=new rx,t=this,[4,e.getAudioProfile()];case 1:return t.engineBAC=r.sent(),[2]}}))}))},e.prototype.updateEngineBAC=function(e){e&&(this.engineBAC={codec:this.engineBAC.codec,play:Z_(Z_({},this.engineBAC.play),e.play),record:Z_(Z_({},this.engineBAC.record),e.record)},this.setAEC(!!e.aec),this.setAGC(!!e.agc))},e.prototype.updateEngineANM=function(e){e&&(this.engineANM={bitrate:e.enc_param.bitrate,channel:e.enc_param.chn})},e.prototype.setAudioProfile=function(e){var t,r,i;switch(e){case MD.fluent:r=16e3,t=24e3;break;case MD.standard:r=48e3,t=48e3;break;case MD.hd:r=48e3,t=128e3,i=2;break;case MD.standardStereo:r=48e3,t=8e4,i=2;break;case MD.hdMono:r=48e3,t=128e3}t&&(this.bitrate=t),i&&(this.channel=i),r&&(this.sampleRate=r)},e.prototype.setBitrate=function(e){e>128e3&&(e=128e3),this.bitrate=e},e.prototype.setAEC=function(e){this.aec=e},e.prototype.setAGC=function(e){this.agc=e},e.prototype.setANS=function(e){this.ans=e},e.prototype.getOpusConfigStr=function(){var e,t,r=";";return this.bitrate&&(r+="maxaveragebitrate=".concat(this.bitrate,";")),(this.sampleRate||(null===(e=this.engineBAC.record)||void 0===e?void 0:e.sr))&&(r+="maxplaybackrate=".concat(this.sampleRate||this.engineBAC.record.sr,";sprop-maxcapturerate=").concat(this.sampleRate||this.engineBAC.record.sr,";")),((this.channel||1)>1||(null===(t=this.engineBAC.record)||void 0===t?void 0:t.chn)>1)&&(r+="stereo=1;sprop-stereo=1;"),r},Object.defineProperty(e.prototype,"config",{get:function(){var e,t,r;return{bitrate:this.bitrate||this.engineANM.bitrate,channel:this.channel||(null===(e=this.engineBAC.record)||void 0===e?void 0:e.chn)||(null===(t=this.engineANM)||void 0===t?void 0:t.chn)||1,aec:!!this.aec,agc:!!this.agc,ans:!!this.ans,sampleRate:this.sampleRate||(null===(r=this.engineBAC.record)||void 0===r?void 0:r.sr)}},enumerable:!1,configurable:!0}),e}(),$z=new xP("Engine",0),eK=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=[KL],r._screenStreamEncodeConfig=[WL],r._pauseAllSubscribeState={audio:!1,video:!1},r._audioPropertiesReportTimer=null,r._mirrorType=ID.MIRROR_TYPE_RENDER,r._audioDeviceManager=new Qz,r._audioProfileManager=new Zz,r._remoteVideoConfig=new Map,r._userPriorityMap=new Map,r._subscribeFallbackOption=ND.DISABLE,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=xx.PLAYOUT_AND_PUBLISH),ev(r,void 0,void 0,(function(){var r;return tv(this,(function(i){switch(i.label){case 0:return $z.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(pP.onAudioMixingStateChanged,e)},r._appId=t,r._pubLock=new Qx("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new Wz({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:lD.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:lD.VIDEO_SOURCE_TYPE_INTERNAL,audio:hD.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:hD.AUDIO_SOURCE_TYPE_INTERNAL},r._rtmClient=new Yz(t),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r}return Q_(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 $z.print("updateToken()","token: %s",e),TP(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(QN.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.setVideoCaptureDevice=function(e){return ev(this,void 0,void 0,(function(){var t,r;return tv(this,(function(i){switch(i.label){case 0:return $z.print("setVideoCaptureDevice()","deviceId: %s",e),TP(e,"deviceId"),this._localVideoTrack?(t=this._videoStreamConstraints,"user"===e||"environment"===e||"left"===e||"right"===e?(delete t.deviceId,t.facingMode=e):t.deviceId={exact:e},this._videoStreamConstraints=t,[4,hF(t)]):(this._localVideoDeviceId=e,[2,Promise.resolve()]);case 1:return r=i.sent(),this._initLocalTrackEvents(r),this._localVideoTrack.close(),this._localVideoTrack=r,this._videoPlayer&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(r),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))},t.prototype.setAudioCaptureDevice=function(e){return ev(this,void 0,void 0,(function(){var t,r;return tv(this,(function(i){switch(i.label){case 0:return $z.print("setAudioCaptureDevice()","deviceId: %s",e),TP(e,"deviceId"),this._localAudioTrack?((t=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=t,[4,pF(t,this._audioProfileManager)]):(this._localAudioDeviceId=e,[2,Promise.resolve()]);case 1:return r=i.sent(),this._initLocalTrackEvents(r),this._localAudioTrack.close(),this._localAudioTrack=r,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){WV.on(pP.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),WV.on(pP.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.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,y,E,g,b,T,I,R,A,C,O=this;null===(e=this._room)||void 0===e||e.on(UL.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(UL.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(UL.USER_CONNECTION,this._onUserConnection.bind(this)),null===(i=this._room)||void 0===i||i.on(xV.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(n=this._room)||void 0===n||n.on(xV.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(xV.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(UL.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(UL.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(UL.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(UL.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(UL.POST_PROCESSING_MESSAGE,(function(e){!function(e){return"2.0"===e.protocol}(e)?"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e):O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message})})),null===(l=this._room)||void 0===l||l.on(xL.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(xV.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(p=this._room)||void 0===p||p.on(xV.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(xV.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(xV.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(v=this._room)||void 0===v||v.on(xV.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=O._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&O.safeEmit(pP.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(xV.ON_REMOTE_STREAM_STATS,(function(e){O.safeEmit(pP.onRemoteStreamStats,e)})),null===(S=this._room)||void 0===S||S.on(xV.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(pP.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(xV.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(E=this._room)||void 0===E||E.on(xV.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(pP.onUserStartAudioCapture,{userId:t})})),null===(g=this._room)||void 0===g||g.on(xV.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(pP.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(xV.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(pP.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(xV.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(pP.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(xV.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(pP.onSEIMessageReceived,e)})),null===(R=this._room)||void 0===R||R.on(xV.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(pP.onRemoteVideoSizeChanged,e,t)})),null===(A=this._room)||void 0===A||A.on(xV.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(pP.onSimulcastSubscribeFallback,e)})),null===(C=this._room)||void 0===C||C.on(xV.RECONNECT_FAILED,(function(){O.safeEmit(pP.onError,{errorCode:QN.RECONNECT_FAILED})}))},t.prototype.safeEmit=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return kP(t)&&EL(t,hP(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 ev(this,void 0,void 0,(function(){var n,o,a;return tv(this,(function(s){switch(s.label){case 0:if($z.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,r,i),OP(e)||TP(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new tw(QN.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){RP(e,"userInfo"),NP(e.userId),OP(e.extraInfo)||TP(e.extraInfo,"userInfo.extraInfo",1,200)}(r),n={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:kD.communication},wj(n,i),function(e){RP(e,"roomConfig"),gP(e.isAutoPublish,"roomConfig.isAutoPublish"),gP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),gP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(n),!this._room||this._room.connectionState===vF.DISCONNECTED)return[3,1];throw new tw(QN.REPEAT_JOIN,"Already joined");case 1:this._room=new $F(i,{audioProfileManager:this._audioProfileManager}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),o=this._liveTranscodeConfig&&DL("started",this._liveTranscodeConfig),s.label=2;case 2:return s.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,Z_(Z_({},r),{businessId:this._businessId,role:this._visibility?Kz.NORMAL_USER:Kz.SILENT_USER}),o,this._useCloudProxy)];case 3:return s.sent(),this._roomConfig=i,this._tempRoomConfig&&delete this._tempRoomConfig,[3,5];case 4:throw(a=s.sent()).code===QN.INVALID_TOKEN&&(this._tempRoomConfig=i),a;case 5:(null==i?void 0:i.isAutoPublish)&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:gD.AUDIO_AND_VIDEO}):this.safeEmit(pP.onAutoPublishResult,{isScreen:!1,state:mD.PUBLISH_FAIL})),s.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 $z.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;$z.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=[KL],this._screenStreamEncodeConfig=[WL],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(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear()},t.prototype.publishStream=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return $z.print("publishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),yP(e)&&!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=(r=this._localImgVideoTrack,new sF(r,nP())),this._localVideoTrack.dummy=!0),[4,this._updatePublish({mediaType:e})];case 1:return t.sent(),[2]}var r}))}))},t.prototype.unpublishStream=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return $z.print("unpublishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updatePublish({mediaType:e,pubState:BV.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.publishScreen=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:$z.print("publishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),r.label=1;case 1:return r.trys.push([1,3,,4]),yP(e)&&!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=(i=this._localImgScreenTrack,new cF(i,nP())),this._localScreenVideoTrack.dummy=!0),[4,this._updateScreenPublish({mediaType:e,pubState:BV.PUB})];case 2:return r.sent(),[3,4];case 3:throw(t=r.sent())instanceof tw?t:new tw(QN.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}var i}))}))},t.prototype.unpublishScreen=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return $z.print("unpublishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updateScreenPublish({mediaType:e,pubState:BV.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.subscribeStream=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return $z.print("subscribeStream()","userId: %o, mediaType: %o",e,t),[2,this._subscribe(!1,e,t)]}))}))},t.prototype._subscribe=function(e,t,r){var i,n,o,a,s;return ev(this,void 0,void 0,(function(){var c,u,d,l,h;return tv(this,(function(p){switch(p.label){case 0:if(this._checkMediaType(r),this._assertNotInRoom(),c=this._room.remoteStreams.get(t),!(u=null==c?void 0:c.find((function(t){return t.isScreen===e}))))throw new tw(QN.STREAM_NOT_EXIST,"stream not exist");return this._pauseAllSubscribeState.audio&&(r-=r&gD.AUDIO),this._pauseAllSubscribeState.video&&(r-=r&gD.VIDEO),$z.print("subscribeStream()","due to pauseAll mediaType: %o",r),d=u.hasSubscribed,l=this._remoteVideoConfig.get(t)||(null===(i=this._roomConfig)||void 0===i?void 0:i.remoteVideoConfig),u.originalMediaType=r,[4,this._room.subscribe(u,r,l)];case 1:return p.sent(),SP(r)&&this._updateAudioPlayerState(u),yP(r)&&this._updateVideoPlayerState(u),e||!(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)&&!(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo)||(u.audioTrack||u.videoTrack)&&(h={userId:t,isScreen:!1,state:vD.SUBSCRIBE_SUCC},this.safeEmit(pP.onAutoSubscribeResult,h)),!d&&SP(r)&&(null===(a=u.observer)||void 0===a||a.setSubscribeAudio(!0)),!d&&yP(r)&&(null===(s=u.observer)||void 0===s||s.setSubscribeVideo(!0)),[2]}}))}))},t.prototype.unsubscribeStream=function(e,t){return ev(this,void 0,void 0,(function(){var r,i;return tv(this,(function(n){if($z.print("unsubscribeStream()","userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),r=this._room.remoteStreams.get(e),!(null==(i=null==r?void 0:r.find((function(e){return!e.isScreen})))?void 0:i.hasSubscribed))throw new tw(QN.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(i,t),[2]}))}))},t.prototype.subscribeScreen=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return $z.print("subscribeScreen() userId: %o, mediaType: %o",e,t),[2,this._subscribe(!0,e,t)]}))}))},t.prototype.unsubscribeScreen=function(e,t){return ev(this,void 0,void 0,(function(){var r,i;return tv(this,(function(n){if($z.print("unsubscribeScreen() userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),r=this._room.remoteStreams.get(e),!(null==(i=null==r?void 0:r.find((function(e){return e.isScreen})))?void 0:i.hasSubscribed))throw new tw(QN.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(i,t),[2]}))}))},t.prototype.setRemoteVideoConfig=function(e,t){var r;return ev(this,void 0,void 0,(function(){return tv(this,(function(i){return $z.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",e,t),NP(e),function(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new tw(QN.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}(t),this._remoteVideoConfig.set(e,t),[2,null===(r=this._room)||void 0===r?void 0:r.updateSubVideoConfig(e,t).then((function(){}))]}))}))},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($z.print("startVideoCapture()","deviceId: %s",e),OP(e)||TP(e,"deviceId"),e=e||this._localVideoDeviceId,this._localVideoTrack&&!this._localVideoTrack.dummy)throw new tw(QN.REPEAT_CAPTURE,"Has already capture");return i=this._videoStreamConstraints,e&&("user"===e||"environment"===e||"left"===e||"right"===e?i.facingMode=e:i.deviceId={exact:e},this._videoStreamConstraints=i),[4,hF(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(pP.onAutoPublishResult,{isScreen:!1,state:mD.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($z.print("stopVideoCapture()"),this._trackSourceType.video===lD.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tw(QN.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($z.print("startAudioCapture()","deviceId: $o",e),OP(e)||TP(e,"deviceId"),e=e||this._localAudioDeviceId,this._localAudioTrack)throw new tw(QN.REPEAT_CAPTURE,"Has already capture");return i=this._audioStreamConstraints,e&&(i.deviceId={exact:e},this._audioStreamConstraints=i),[4,pF(i,this._audioProfileManager)];case 1:return n=a.sent(),this._initLocalTrackEvents(n),this._localAudioTrack=n,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(pP.onAutoPublishResult,{isScreen:!1,state:mD.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($z.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===hD.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tw(QN.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 $z.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($z.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===lD.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tw(QN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===hD.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tw(QN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,fF(a)];case 1:return s=u.sent(),this._localScreenVideoTrack=new cF(s.getVideoTracks()[0],nP()),(c=s.getAudioTracks()).length&&(this._localScreenAudioTrack=new uF(c[0],nP()),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 $z.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.setLocalVideoPlayer=function(e,t){var r,i;if($z.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),IP(e,"streamIndex",[ED.STREAM_INDEX_MAIN,ED.STREAM_INDEX_SCREEN]),t&&t.renderDom)return DP(t),e!=ED.STREAM_INDEX_MAIN||this._videoPlayer?e!=ED.STREAM_INDEX_SCREEN||this._screenPlayer?void 0:(this._screenPlayer=new cB(Z_(Z_({},t),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement):(this._videoPlayer=new cB(t),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement);e==ED.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:$z.print("startLiveTranscoding()","transcode: %o",e),TP(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,i.label=1;case 1:return i.trys.push([1,3,,4]),this.safeEmit(pP.onStreamMixingEvent,{event:FV.START,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(DL("started",this._liveTranscodeConfig))];case 2:return i.sent(),[3,4];case 3:throw(r=i.sent())instanceof tw?r:new tw(QN.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($z.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=wj(this._liveTranscodeConfig,e),i.label=1;case 1:return i.trys.push([1,3,,4]),this.safeEmit(pP.onStreamMixingEvent,{event:FV.UPDATE,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(DL("layoutChanged",this._liveTranscodeConfig))];case 2:return i.sent(),[3,4];case 3:throw(r=i.sent())instanceof tw?r:new tw(QN.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($z.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(pP.onStreamMixingEvent,{event:FV.STOP,error:0,message:""}),[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(QN.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return $z.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,r;return ev(this,void 0,void 0,(function(){return tv(this,(function(i){switch(i.label){case 0:if($z.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==vF.CONNECTED)throw new tw(QN.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:i.sent(),i.label=2;case 2:return[4,this._room.updateUserAttributes({role:e?Kz.NORMAL_USER:Kz.SILENT_USER})];case 3:return i.sent(),this._visibility=e,e&&(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoPublish)&&this._updatePublish({mediaType:gD.AUDIO_AND_VIDEO}),[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(pP.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):r.safeEmit(pP.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(pP.onFirstPublicStreamVideoFrameDecoded,c),r.safeEmit(pP.onFirstPublicStreamVideoFrameRendered,c)):(r.safeEmit(pP.onVideoFirstFrameDecoded,c),r.safeEmit(pP.onVideoFirstFrameRendered,c)),hL.firstRemoteVideoRender("",i.userId)}break;case"autoplay-error":return t&&(i.publicStreamId=i.userId),void r.safeEmit(pP.onAutoplayFailed,i)}r.safeEmit(pP.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(pP.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var r,i,n,o,a,s;$z.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),IP(e,"streamIndex",[ED.STREAM_INDEX_MAIN,ED.STREAM_INDEX_SCREEN]),DP(t);var c=t.userId;if(e==ED.STREAM_INDEX_MAIN){if(null===(r=this._remoteVideoPlayer.get(c))||void 0===r||r.destroy(),!t.renderDom)return;var u=new cB(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}if(null===(o=this._remoteScreenPlayer.get(c))||void 0===o||o.destroy(),t.renderDom){var d;u=new cB(Z_(Z_({},t),{isScreen:!0}));return this._remoteScreenPlayer.set(c,u),this._initPlayerEvents(u),(d=null===(s=null===(a=this._room)||void 0===a?void 0:a.remoteStreams.get(c))||void 0===s?void 0:s.find((function(e){return e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}},t.prototype.setLocalVideoMirrorType=function(e){$z.print("setLocalVideoMirrorType()","mirrorType: %o",e),IP(e,"mirrorType",[ID.MIRROR_TYPE_NONE,ID.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 $z.print("setAudioPlaybackDevice()","deviceId: %s",e),TP(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?($z.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,WV.getDeviceById(e)];case 1:if(!(r=i.sent()))throw new tw(QN.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(pP.onAudioPlaybackDeviceChanged,r),hL.rtcAudioDevice(GU.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($z.print("play()","userId | publicStreamId: %s",e),NP(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(QN.INVALID_PARAMS,"Player not found");return t&&t.manuallyPlay(),r&&r.manuallyPlay(),[2]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return ev(this,void 0,void 0,(function(){var t,r=this;return tv(this,(function(i){return $z.print("pauseAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?[2,Promise.resolve()]:(t=function(){SP(e)&&(r._pauseAllSubscribeState.audio=!0),yP(e)&&(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 $z.print("resumeAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video?(t=function(){SP(e)&&(r._pauseAllSubscribeState.audio=!1),yP(e)&&(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(NP(e),PP(t),!this._room||this._room.connectionState!==vF.CONNECTED)throw new tw(QN.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(NP(e),AP(t,"message"),PP(t),!this._room||this._room.connectionState!==vF.CONNECTED)throw new tw(QN.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(PP(e),!this._room||this._room.connectionState!==vF.CONNECTED)throw new tw(QN.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(PP(e),!this._room||this._room.connectionState!==vF.CONNECTED)throw new tw(QN.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 $z.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,CP(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 $z.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,CP(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(),this._updatePublish(),i.label=2;case 2:return[2]}}))}))},t.prototype.enableSimulcastMode=function(e){return $z.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0},t.prototype.setVideoEncoderConfig=function(e){var t;return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return $z.print("setVideoEncoderConfig()"," descriptions: %o",e),Array.isArray(e)||(e=[e]),e.length>3&&(e=e.slice(0,3)),e.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._videoStreamEncodeConfig=e,(null===(t=this._room)||void 0===t?void 0:t.hasPublished)&&this._updatePublish(),[2]}))}))},t.prototype.setScreenEncoderConfig=function(e){var t;return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return $z.print("setScreenEncoderConfig()","description: %o",e),this._screenStreamEncodeConfig=[e],(null===(t=this._room)||void 0===t?void 0:t.hasScreenPublished)&&this._updateScreenPublish(),[2]}))}))},t.prototype.sendSEIMessage=function(e,t,r){var i,n,o,a,s,c;$z.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),IP(e,"streamIndex",[ED.STREAM_INDEX_MAIN,ED.STREAM_INDEX_SCREEN]),bP(r,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(cP.str2ab(t)):t;if(t.length){var d;if(e===ED.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)$z.print("sei size must not bigger than 4KB");else{var l=nP();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 $z.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;$z.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(pP.onAudioVolumeIndication,{speakers:r})}),e)},t.prototype.enableAudioPropertiesReport=function(e){var t=this;void 0===e&&(e={}),$z.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:ED.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:mP(i)}})}if(t._localScreenAudioTrack){i=t._localScreenAudioTrack.getAudioLevel();e.push({streamIndex:ED.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:mP(i)}})}if(t.safeEmit(pP.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?ED.STREAM_INDEX_SCREEN:ED.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:mP(a)}})}}))})),t.safeEmit(pP.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 y,E,g;return tv(this,(function(b){switch(b.label){case 0:return $z.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),IP(e,"streamIndex",[ED.STREAM_INDEX_MAIN,ED.STREAM_INDEX_SCREEN]),IP(t,"VideoSourceType",[lD.VIDEO_SOURCE_TYPE_EXTERNAL,lD.VIDEO_SOURCE_TYPE_INTERNAL]),y=e===ED.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[y]===t?[3,4]:(this._trackSourceType[y]=t,$z.print("setVideoSourceType","set ".concat(y," source type to ").concat(t)),this._localVideoTrack&&e===ED.STREAM_INDEX_MAIN?(g=!1,t===lD.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localVideoTrack.close()),null===(r=this._videoPlayer)||void 0===r||r.stop(),this._localVideoTrack=void 0,E=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)||E?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:b.sent(),b.label=2;case 2:return this._localScreenVideoTrack&&e===ED.STREAM_INDEX_SCREEN?(g=!1,t===lD.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($z.print("setExternalVideoTrack()","index: %o, track: %o",e,t),IP(e,"streamIndex",[ED.STREAM_INDEX_MAIN,ED.STREAM_INDEX_SCREEN]),e!==ED.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==lD.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tw(QN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new dF(t,nP()),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!==ED.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==lD.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tw(QN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new dF(t,nP()),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,y;return tv(this,(function(E){switch(E.label){case 0:return $z.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),IP(e,"streamIndex",[ED.STREAM_INDEX_MAIN,ED.STREAM_INDEX_SCREEN]),IP(t,"audioSourceType",[hD.AUDIO_SOURCE_TYPE_EXTERNAL,hD.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===ED.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,$z.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===ED.STREAM_INDEX_MAIN?(y=!1,this._trackSourceType.audio===hD.AUDIO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,S=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,y?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:E.sent(),E.label=2;case 2:return this._localScreenAudioTrack&&e===ED.STREAM_INDEX_SCREEN?(y=!1,this._trackSourceType.audio===hD.AUDIO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,y?null===(h=null===(l=null===(d=this._room)||void 0===d?void 0:d.localScreenStream)||void 0===l?void 0:l.observer)||void 0===h||h.setEnableAudio(!1):null===(_=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:E.sent(),E.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($z.print("setExternalAudioTrack()","index: %o, track: %o",e,t),IP(e,"streamIndex",[ED.STREAM_INDEX_MAIN,ED.STREAM_INDEX_SCREEN]),e!==ED.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==hD.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tw(QN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new lF(t,nP()),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!==ED.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==hD.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tw(QN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new lF(t,nP()),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 $z.print("login()","token: %o, userInfo: %o",e,t),OP(e)||TP(e,"token"),NP(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 $z.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 $z.print("updateLoginToken()","token: %o",e),OP(e)||TP(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 $z.print("getPeerOnlineStatus()","userId: %o",e),NP(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 NP(e),PP(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 NP(e),AP(t,"message"),PP(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 $z.print("setServerParams()","signature: %o, url: %0",e,t),TP(e,"signature"),TP(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 TP(e,"message"),PP(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 AP(e,"message"),PP(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.startCloudProxy=function(e){if(this._room)throw new tw(QN.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;$z.print("startCloudProxy()",e),TP(e.logProxy,"logProxy"),TP(e.accessProxy,"accessProxy"),TP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=wL("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=wL("LOG_SERVER_URL"),this._originConfigServerUrls=wL("CONFIG_REQUEST_DOMAINS"),NL("ICE_CONFIG_REQUEST_URLS",e.accessProxy),NL("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),NL("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new tw(QN.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");$z.print("stopCloudProxy()"),NL("ICE_CONFIG_REQUEST_URLS",[]),NL("LOG_SERVER_URL",this._originLogServerUrl),NL("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($z.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),wP(e),!this._room||this._room.connectionState!==vF.CONNECTED)throw new tw(QN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new tw(QN.REPEAT_PUSH,"repeat push public media stream");return r=PL(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($z.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),wP(e),!this._room||this._room.connectionState!==vF.CONNECTED)throw new tw(QN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return r=PL(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($z.print("startPushPublicStream()","publicStreamId: %o",e),wP(e),!this._room||this._room.connectionState!==vF.CONNECTED)throw new tw(QN.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,r;return ev(this,void 0,void 0,(function(){var i,n,o,a=this;return tv(this,(function(s){switch(s.label){case 0:return wP(e),this._outsideRoom?[3,2]:(this._outsideRoom=new Jz(this._appId),this._outsideRoom.on(xV.RESUBSCRIBE,(function(e){var t,r,i=e.stream;if(i){var n=a._publicStreamAudioPlayer.get(i.streamId);n&&i.audioTrack&&(n.stop(),n.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var o=a._publicStreamVideoPlayer.get(i.streamId);o&&i.videoTrack&&o.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,a.safeEmit(pP.onPublicStreamStats,e)})),null===(r=this._outsideRoom)||void 0===r||r.on(xV.ON_SEI_MESSAGED_RECEIVED,(function(e){a.safeEmit(pP.onPublicStreamSEIMessageReceived,e)})),[4,this._outsideRoom.connect()]);case 1:s.sent(),s.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return i=s.sent(),(n=this._publicStreamVideoPlayer.get(e))&&(null==i?void 0:i.videoTrack)&&n.playVideo(i.videoTrack,i),!(o=this._publicStreamAudioPlayer.get(e))&&(null==i?void 0:i.audioTrack)&&(o=new uB(e),this._initPlayerEvents(o,!0),o.playAudio(i.audioTrack),this._publicStreamAudioPlayer.set(e,o)),[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.setAudioProfile=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return this._audioProfileManager.setAudioProfile(e),[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var r,i;$z.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 cB(Z_(Z_({},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){TP(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(QN.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===ED.STREAM_INDEX_MAIN?r._localImgVideoTrack=s:r._localImgScreenTrack=s,i()}catch(e){n(new tw(QN.UNEXPECTED_ERROR,e.message))}},o.onerror=function(){n(new tw(QN.UNEXPECTED_ERROR,"Load image error"))}}))]}))}))},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(zL))},t.prototype._updatePublish=function(e){return void 0===e&&(e={}),ev(this,void 0,void 0,(function(){var t,r,i;return tv(this,(function(n){switch(n.label){case 0:if($z.print("_updatePublish()","config: %o",e),t={mediaType:void 0,invokeByJoinRoom:!1,pubState:BV.PUB},e=Z_(Z_({},t),e),!this._visibility)throw new tw(QN.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(r=n.sent(),!this._room||this._room.connectionState!==vF.CONNECTED)return r(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,e.mediaType,e.pubState,e.invokeByJoinRoom)];case 3:return n.sent(),[3,6];case 4:throw(i=n.sent())instanceof tw?i:new tw(QN.UNEXPECTED_ERROR,"unexpected error",i);case 5:return r(),[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 $z.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",e,t),TP(e,"filePath"),bP(t,"indicationInterval"),[4,this._audioDeviceManager.startAudioPlaybackDeviceTest(e,t)];case 1:return[2,r.sent()]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){$z.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 $z.print("startAudioDeviceRecordTest()","indicationInterval: %o",e),bP(e,"indicationInterval"),[4,this._audioDeviceManager.startAudioDeviceRecordTest(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){$z.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()},t.prototype.stopAudioDevicePlayTest=function(){$z.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()},t.prototype.setRemoteUserPriority=function(e,t){var r;$z.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{NP(e),IP(t,"priority",[wD.HIGH,wD.MEDIUM,wD.LOW])}catch(e){return console.warn(e),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.setRemoteUserPriority(e,t),!0},t.prototype.setSubscribeFallbackOption=function(e){$z.print("setSubscribeFallbackOption()","option: %o",e);try{IP(e,"option",[ND.DISABLE,ND.VIDEO_STREAM_LOW,ND.AUDIO_ONLY])}catch(e){return console.warn(e),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)},t.prototype._updateScreenPublish=function(e){return void 0===e&&(e={}),ev(this,void 0,void 0,(function(){var t,r,i;return tv(this,(function(n){switch(n.label){case 0:return $z.print("_updateScreenPublish()"),t={mediaType:void 0,pubState:BV.PUB},e=Z_(Z_({},t),e),[4,this._pubLock.lock()];case 1:if(r=n.sent(),!this._room||this._room.connectionState!==vF.CONNECTED)return r(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,e.mediaType,e.pubState)];case 3:return n.sent(),[3,6];case 4:throw(i=n.sent())instanceof tw?i:new tw(QN.UNEXPECTED_ERROR,"unexpected error",i);case 5:return r(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){$z.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 uB(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){$z.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=e.stream,r=null==t?void 0:t.attributes,i=r.localaudio,n=r.audiostream,o=r.localvideo,a=r.videostream,s=UV.NONE;n&&(s|=gD.AUDIO),a&&(s|=gD.VIDEO),s&&((null==t?void 0:t.isScreen)?this.safeEmit(pP.onUserPublishScreen,{userId:t.userId,mediaType:s}):(this.safeEmit(pP.onUserPublishStream,{userId:t.userId,mediaType:s}),this._handleAutoSubscribe(t,!0)),(null==t?void 0:t.isScreen)||(i&&this.safeEmit(pP.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(pP.onUserStartVideoCapture,{userId:t.userId})))},t.prototype._handleAutoSubscribe=function(e,t){var r,i,n,o,a=UV.NONE;(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeAudio)&&(a|=gD.AUDIO),(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeVideo)&&(a|=gD.VIDEO),$z.print("_onAddStream","autoSubType: ".concat(a)),a&&(t&&SP(a)&&(null===(n=e.observer)||void 0===n||n.setAutoSubscribeAudio(!0)),t&&yP(a)&&(null===(o=e.observer)||void 0===o||o.setAutoSubscribeVideo(!0)),this._subscribe(!1,e.userId,a))},t.prototype._onRemoveStream=function(e){var t,r=this,i=e.stream,n=null!==(t=tK[e.reason])&&void 0!==t?t:bD.STREAM_REMOVE_REASON_OTHER,o=i.isScreen?pP.onUserUnpublishScreen:pP.onUserUnpublishStream;this.safeEmit(o,{userId:i.userId,mediaType:gD.AUDIO_AND_VIDEO,reason:n}),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(pP.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(pP.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(pP.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onNetworkQuality=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.safeEmit.apply(this,nv([pP.onNetworkQuality],iv(e),!1))},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===TD.CONNECTION_STATE_CONNECTED&&this.safeEmit(pP.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(pP.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(pP.onVideoFirstFrameDecoded,e)},t.prototype._onVideoDeviceStateChange=function(e){this.safeEmit(pP.onVideoDeviceStateChanged,e)},t.prototype._onAudioDeviceStateChange=function(e){this.safeEmit(pP.onAudioDeviceStateChanged,e)},t.prototype._onUserPublishStateChange=function(e){var t=e.userId,r=e.isScreen,i=e.mediaType,n=e.pubState,o=e.remoteStream,a={userId:t,mediaType:i};r?n===BV.PUB?this.safeEmit(pP.onUserPublishScreen,a):this.safeEmit(pP.onUserUnpublishScreen,Z_(Z_({},a),{reason:bD.STREAM_REMOVE_REASON_UNPUBLISH})):n===BV.PUB?(this.safeEmit(pP.onUserPublishStream,a),this._handleAutoSubscribe(o,!0)):this.safeEmit(pP.onUserUnpublishStream,Z_(Z_({},a),{reason:bD.STREAM_REMOVE_REASON_UNPUBLISH}))},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(pP.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(pP.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this.safeEmit(pP.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(pP.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(pP.onLiveTranscodingResult,e)},t.prototype._onStreamMixingEvent=function(e){this.safeEmit(pP.onStreamMixingEvent,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(pP.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(pP.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t.safeEmit(pP.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t.safeEmit(pP.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(pP.onError,{errorCode:QN.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(pP.onError,{errorCode:QN.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(pP.onAudioPlaybackDeviceTestVolume,t)}))},t.prototype._assertNotInRoom=function(){if(!this._room||this._room.connectionState!==vF.CONNECTED)throw new tw(QN.INVOKED_BEFORE_JOIN_ROOM,"join first")},t.prototype._checkMediaType=function(e){IP(e,"mediaType",[gD.AUDIO,gD.VIDEO,gD.AUDIO_AND_VIDEO])},$_([yL()],t.prototype,"updateToken",null),$_([yL()],t.prototype,"setVideoCaptureDevice",null),$_([yL()],t.prototype,"setAudioCaptureDevice",null),$_([yL()],t.prototype,"joinRoom",null),$_([yL()],t.prototype,"leaveRoom",null),$_([yL()],t.prototype,"destroy",null),$_([yL()],t.prototype,"publishStream",null),$_([yL()],t.prototype,"unpublishStream",null),$_([yL()],t.prototype,"publishScreen",null),$_([yL()],t.prototype,"unpublishScreen",null),$_([yL()],t.prototype,"subscribeStream",null),$_([yL()],t.prototype,"unsubscribeStream",null),$_([yL()],t.prototype,"subscribeScreen",null),$_([yL()],t.prototype,"unsubscribeScreen",null),$_([yL()],t.prototype,"setRemoteVideoConfig",null),$_([yL()],t.prototype,"startVideoCapture",null),$_([yL()],t.prototype,"stopVideoCapture",null),$_([yL()],t.prototype,"startAudioCapture",null),$_([yL()],t.prototype,"stopAudioCapture",null),$_([yL()],t.prototype,"getAudioMixingManager",null),$_([yL()],t.prototype,"startScreenCapture",null),$_([yL()],t.prototype,"stopScreenCapture",null),$_([yL()],t.prototype,"setLocalVideoPlayer",null),$_([yL()],t.prototype,"startLiveTranscoding",null),$_([yL()],t.prototype,"updateLiveTranscoding",null),$_([yL()],t.prototype,"stopLiveTranscoding",null),$_([yL()],t.prototype,"setBusinessId",null),$_([yL()],t.prototype,"setUserVisibility",null),$_([yL()],t.prototype,"setRemoteVideoPlayer",null),$_([yL()],t.prototype,"setLocalVideoMirrorType",null),$_([yL()],t.prototype,"setAudioPlaybackDevice",null),$_([yL()],t.prototype,"play",null),$_([yL()],t.prototype,"pauseAllSubscribedStream",null),$_([yL()],t.prototype,"resumeAllSubscribedStream",null),$_([yL()],t.prototype,"sendUserMessage",null),$_([yL()],t.prototype,"sendUserBinaryMessage",null),$_([yL()],t.prototype,"sendRoomMessage",null),$_([yL()],t.prototype,"sendRoomBinaryMessage",null),$_([yL()],t.prototype,"setAudioCaptureConfig",null),$_([yL()],t.prototype,"setVideoCaptureConfig",null),$_([yL()],t.prototype,"enableSimulcastMode",null),$_([yL()],t.prototype,"setVideoEncoderConfig",null),$_([yL()],t.prototype,"setScreenEncoderConfig",null),$_([yL()],t.prototype,"sendSEIMessage",null),$_([yL()],t.prototype,"setAudioVolumeIndicationInterval",null),$_([yL()],t.prototype,"enableAudioPropertiesReport",null),$_([yL()],t.prototype,"setVideoSourceType",null),$_([yL()],t.prototype,"setExternalVideoTrack",null),$_([yL()],t.prototype,"setAudioSourceType",null),$_([yL()],t.prototype,"setExternalAudioTrack",null),$_([yL("rtm")],t.prototype,"login",null),$_([yL("rtm")],t.prototype,"logout",null),$_([yL("rtm")],t.prototype,"updateLoginToken",null),$_([yL("rtm")],t.prototype,"getPeerOnlineStatus",null),$_([yL("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),$_([yL("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),$_([yL("rtm")],t.prototype,"setServerParams",null),$_([yL("rtm")],t.prototype,"sendServerMessage",null),$_([yL("rtm")],t.prototype,"sendServerBinaryMessage",null),$_([yL()],t.prototype,"startCloudProxy",null),$_([yL()],t.prototype,"stopCloudProxy",null),$_([yL()],t.prototype,"startPushPublicStream",null),$_([yL()],t.prototype,"updatePublicStreamParam",null),$_([yL()],t.prototype,"stopPushPublicStream",null),$_([yL("outsideRoom")],t.prototype,"startPlayPublicStream",null),$_([yL("outsideRoom")],t.prototype,"stopPlayPublicStream",null),$_([yL()],t.prototype,"setAudioProfile",null),$_([yL("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),$_([yL()],t.prototype,"setDummyCaptureImagePath",null),$_([yL()],t.prototype,"startAudioPlaybackDeviceTest",null),$_([yL()],t.prototype,"stopAudioPlaybackDeviceTest",null),$_([yL()],t.prototype,"startAudioDeviceRecordTest",null),$_([yL()],t.prototype,"stopAudioDeviceRecordAndPlayTest",null),$_([yL()],t.prototype,"stopAudioDevicePlayTest",null),$_([yL()],t.prototype,"setRemoteUserPriority",null),$_([yL()],t.prototype,"setSubscribeFallbackOption",null),t}(FP),tK={"client unpublished":bD.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":bD.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":bD.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":bD.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":bD.STREAM_REMOVE_REASON_REPUBLISH},rK=new xP("VERTC",0);[_L,vL,mL].forEach((function(e){return e.setStats({rtc_sdk_version:XL.VERSION,product_line:vU.RTC,report_version:mU.W_5,os:SU.WEB,device_id:IL.getDeviceId(),user_agent:sP()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var iK=function(e){return rK.print("createEngine","Invoke VERTC.createEngine"),TP(e,"appId"),[_L,vL,mL].forEach((function(t){return t.setStats({rtc_app_id:e})})),hL.sdkInitEngine(Date.now(),YU.BEGIN),new eK(e)},nK=function(e){if(rK.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof eK))throw new tw(QN.INVALID_ENGINE,"Invalid engine object");e.destroy(),hL.sdkInitEngine(Date.now(),YU.END)},oK=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,WV.enumerateDevices()]}))}))},aK=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,WV.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,WV.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,i]}}))}))},sK=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,WV.enumerateAudioCaptureDevices()]}))}))},cK=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,WV.enumerateVideoCaptureDevices()]}))}))},uK=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,WV.enumerateAudioPlaybackDevices()]}))}))},dK=function(){return XL.VERSION},lK=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]),!sP()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,Hx()]:[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]}}))}))},hK=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,Hx()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!sP()&&location.search.includes("_rtc_autotest_");var pK=new function(){this.getSdkVersion=dK,this.createEngine=iK,this.destroyEngine=nK,this.enumerateDevices=oK,this.enableDevices=aK,this.enumerateAudioCaptureDevices=sK,this.enumerateVideoCaptureDevices=cK,this.enumerateAudioPlaybackDevices=uK,this.getParameter=wL,this.setParameter=NL,this.isSupported=lK,this.getSupportedCodecs=hK,this.events=pP,this.ErrorCode=QN,this.platform="BytePlus",this._monitor=hL};export{Lx as AudioMixingDualMonoMode,xx as AudioMixingType,MD as AudioProfileType,hD as AudioSourceType,fD as ChannelProfile,TD as ConnectionState,PD as FallbackOrRecoverReason,RD as LogChannel,gD as MediaType,SD as MirrorMode,ID as MirrorType,DD as NetworkQuality,OD as PublicInterpolationMode,CD as PublicStreamType,mD as PublishState,wD as RemoteUserPriority,kD as RoomProfileType,ED as StreamIndex,bD as StreamRemoveReason,ND as SubscribeFallbackOption,_D as SubscribeMode,vD as SubscribeState,AD as USER_ONLINE_STATUS,pD as UserOfflineReason,yD as VideoRenderMode,lD as VideoSourceType,pK as default};
6
+ function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(i){if("default"!==i&&!(i in e)){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}))})),Object.freeze(e)}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i=function(e){return e&&e.Math==Math&&e},r=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("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,_=p&&!h.call({1:2},1);l.f=_?function(e){var t=p(this,e);return!!t&&t.enumerable}:h;var f,v,m=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},S=s,y=Function.prototype,g=y.bind,E=y.call,b=S&&g.bind(E,E),T=S?function(e){return e&&b(e)}:function(e){return e&&function(){return E.apply(e,arguments)}},I=T,R=I({}.toString),A=I("".slice),C=function(e){return A(R(e),8,-1)},O=T,w=o,N=C,P=r.Object,D=O("".split),k=w((function(){return!P("z").propertyIsEnumerable(0)}))?function(e){return"String"==N(e)?D(e,""):P(e)}:P,M=r.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=r,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]},W=T({}.isPrototypeOf),Y=K("navigator","userAgent")||"",X=r,q=Y,J=X.process,Q=X.Deno,Z=J&&J.versions||Q&&Q.version,$=Z&&Z.v8;$&&(v=(f=$.split("."))[0]>0&&f[0]<4?1:+(f[0]+f[1])),!v&&q&&(!(f=q.match(/Edge\/(\d+)/))||f[1]>=74)&&(f=q.match(/Chrome\/(\d+)/))&&(v=+f[1]);var ee=v,te=ee,ie=o,re=!!Object.getOwnPropertySymbols&&!ie((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&te&&te<41})),ne=re&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,oe=K,ae=F,se=W,ce=ne,ue=r.Object,de=ce?function(e){return"symbol"==typeof e}:function(e){var t=oe("Symbol");return ae(t)&&se(t.prototype,ue(e))},le=r.String,he=function(e){try{return le(e)}catch(e){return"Object"}},pe=F,_e=he,fe=r.TypeError,ve=function(e){if(pe(e))return e;throw fe(_e(e)+" is not a function")},me=ve,Se=function(e,t){var i=e[t];return null==i?void 0:me(i)},ye=d,ge=F,Ee=j,be=r.TypeError,Te={exports:{}},Ie=r,Re=Object.defineProperty,Ae=function(e,t){try{Re(Ie,e,{value:t,configurable:!0,writable:!0})}catch(i){Ie[e]=t}return t},Ce=Ae,Oe=r["__core-js_shared__"]||Ce("__core-js_shared__",{}),we=Oe;(Te.exports=function(e,t){return we[e]||(we[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 Ne=U,Pe=r.Object,De=function(e){return Pe(Ne(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=r,Ge=Te.exports,He=Ue,ze=Be,Ke=re,We=ne,Ye=Ge("wks"),Xe=je.Symbol,qe=Xe&&Xe.for,Je=We?Xe:Xe&&Xe.withoutSetter||ze,Qe=function(e){if(!He(Ye,e)||!Ke&&"string"!=typeof Ye[e]){var t="Symbol."+e;Ke&&He(Xe,e)?Ye[e]=Xe[e]:Ye[e]=We&&qe?qe(t):Je(t)}return Ye[e]},Ze=d,$e=j,et=de,tt=Se,it=function(e,t){var i,r;if("string"===t&&ge(i=e.toString)&&!Ee(r=ye(i,e)))return r;if(ge(i=e.valueOf)&&!Ee(r=ye(i,e)))return r;if("string"!==t&&ge(i=e.toString)&&!Ee(r=ye(i,e)))return r;throw be("Can't convert object to primitive value")},rt=Qe,nt=r.TypeError,ot=rt("toPrimitive"),at=function(e,t){if(!$e(e)||et(e))return e;var i,r=tt(e,ot);if(r){if(void 0===t&&(t="default"),i=Ze(r,e,t),!$e(i)||et(i))return i;throw nt("Can't convert object to primitive value")}return void 0===t&&(t="number"),it(e,t)},st=at,ct=de,ut=function(e){var t=st(e,"string");return ct(t)?t:t+""},dt=j,lt=r.document,ht=dt(lt)&&dt(lt.createElement),pt=function(e){return ht?lt.createElement(e):{}},_t=pt,ft=!a&&!o((function(){return 7!=Object.defineProperty(_t("div"),"a",{get:function(){return 7}}).a})),vt=a,mt=d,St=l,yt=m,gt=V,Et=ut,bt=Ue,Tt=ft,It=Object.getOwnPropertyDescriptor;n.f=vt?It:function(e,t){if(e=gt(e),t=Et(t),Tt)try{return It(e,t)}catch(e){}if(bt(e,t))return yt(!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=r,Ot=j,wt=Ct.String,Nt=Ct.TypeError,Pt=function(e){if(Ot(e))return e;throw Nt(wt(e)+" is not an object")},Dt=a,kt=ft,Mt=At,Ut=Pt,Lt=ut,xt=r.TypeError,Vt=Object.defineProperty,Ft=Object.getOwnPropertyDescriptor;Rt.f=Dt?Mt?function(e,t,i){if(Ut(e),t=Lt(t),Ut(i),"function"==typeof e&&"prototype"===t&&"value"in i&&"writable"in i&&!i.writable){var r=Ft(e,t);r&&r.writable&&(e[t]=i.value,i={configurable:"configurable"in i?i.configurable:r.configurable,enumerable:"enumerable"in i?i.enumerable:r.enumerable,writable:!1})}return Vt(e,t,i)}:Vt:function(e,t,i){if(Ut(e),t=Lt(t),Ut(i),kt)try{return Vt(e,t,i)}catch(e){}if("get"in i||"set"in i)throw xt("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var Bt=Rt,jt=m,Gt=a?function(e,t,i){return Bt.f(e,t,jt(1,i))}:function(e,t,i){return e[t]=i,e},Ht={exports:{}},zt=F,Kt=Oe,Wt=T(Function.toString);zt(Kt.inspectSource)||(Kt.inspectSource=function(e){return Wt(e)});var Yt,Xt,qt,Jt=Kt.inspectSource,Qt=F,Zt=Jt,$t=r.WeakMap,ei=Qt($t)&&/native code/.test(Zt($t)),ti=Te.exports,ii=Be,ri=ti("keys"),ni=function(e){return ri[e]||(ri[e]=ii(e))},oi={},ai=ei,si=r,ci=T,ui=j,di=Gt,li=Ue,hi=Oe,pi=ni,_i=oi,fi=si.TypeError,vi=si.WeakMap;if(ai||hi.state){var mi=hi.state||(hi.state=new vi),Si=ci(mi.get),yi=ci(mi.has),gi=ci(mi.set);Yt=function(e,t){if(yi(mi,e))throw new fi("Object already initialized");return t.facade=e,gi(mi,e,t),t},Xt=function(e){return Si(mi,e)||{}},qt=function(e){return yi(mi,e)}}else{var Ei=pi("state");_i[Ei]=!0,Yt=function(e,t){if(li(e,Ei))throw new fi("Object already initialized");return t.facade=e,di(e,Ei,t),t},Xt=function(e){return li(e,Ei)?e[Ei]:{}},qt=function(e){return li(e,Ei)}}var bi={set:Yt,get:Xt,has:qt,enforce:function(e){return qt(e)?Xt(e):Yt(e,{})},getterFor:function(e){return function(t){var i;if(!ui(t)||(i=Xt(t)).type!==e)throw fi("Incompatible receiver, "+e+" required");return i}}},Ti=a,Ii=Ue,Ri=Function.prototype,Ai=Ti&&Object.getOwnPropertyDescriptor,Ci=Ii(Ri,"name"),Oi={EXISTS:Ci,PROPER:Ci&&"something"===function(){}.name,CONFIGURABLE:Ci&&(!Ti||Ti&&Ai(Ri,"name").configurable)},wi=r,Ni=F,Pi=Ue,Di=Gt,ki=Ae,Mi=Jt,Ui=Oi.CONFIGURABLE,Li=bi.get,xi=bi.enforce,Vi=String(String).split("String");(Ht.exports=function(e,t,i,r){var n,o=!!r&&!!r.unsafe,a=!!r&&!!r.enumerable,s=!!r&&!!r.noTargetGet,c=r&&void 0!==r.name?r.name:t;Ni(i)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Pi(i,"name")||Ui&&i.name!==c)&&Di(i,"name",c),(n=xi(i)).source||(n.source=Vi.join("string"==typeof c?c:""))),e!==wi?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=i:Di(e,t,i)):a?e[t]=i:ki(t,i)})(Function.prototype,"toString",(function(){return Ni(this)&&Li(this).source||Mi(this)}));var Fi={},Bi=Math.ceil,ji=Math.floor,Gi=function(e){var t=+e;return t!=t||0===t?0:(t>0?ji:Bi)(t)},Hi=Gi,zi=Math.max,Ki=Math.min,Wi=function(e,t){var i=Hi(e);return i<0?zi(i+t,0):Ki(i,t)},Yi=Gi,Xi=Math.min,qi=function(e){return e>0?Xi(Yi(e),9007199254740991):0},Ji=qi,Qi=function(e){return Ji(e.length)},Zi=V,$i=Wi,er=Qi,tr=function(e){return function(t,i,r){var n,o=Zi(t),a=er(o),s=$i(r,a);if(e&&i!=i){for(;a>s;)if((n=o[s++])!=n)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===i)return e||s||0;return!e&&-1}},ir={includes:tr(!0),indexOf:tr(!1)},rr=Ue,nr=V,or=ir.indexOf,ar=oi,sr=T([].push),cr=function(e,t){var i,r=nr(e),n=0,o=[];for(i in r)!rr(ar,i)&&rr(r,i)&&sr(o,i);for(;t.length>n;)rr(r,i=t[n++])&&(~or(o,i)||sr(o,i));return o},ur=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],dr=cr,lr=ur.concat("length","prototype");Fi.f=Object.getOwnPropertyNames||function(e){return dr(e,lr)};var hr={};hr.f=Object.getOwnPropertySymbols;var pr=K,_r=Fi,fr=hr,vr=Pt,mr=T([].concat),Sr=pr("Reflect","ownKeys")||function(e){var t=_r.f(vr(e)),i=fr.f;return i?mr(t,i(e)):t},yr=Ue,gr=Sr,Er=n,br=Rt,Tr=function(e,t,i){for(var r=gr(t),n=br.f,o=Er.f,a=0;a<r.length;a++){var s=r[a];yr(e,s)||i&&yr(i,s)||n(e,s,o(t,s))}},Ir=o,Rr=F,Ar=/#|\.prototype\./,Cr=function(e,t){var i=wr[Or(e)];return i==Pr||i!=Nr&&(Rr(t)?Ir(t):!!t)},Or=Cr.normalize=function(e){return String(e).replace(Ar,".").toLowerCase()},wr=Cr.data={},Nr=Cr.NATIVE="N",Pr=Cr.POLYFILL="P",Dr=Cr,kr=r,Mr=n.f,Ur=Gt,Lr=Ht.exports,xr=Ae,Vr=Tr,Fr=Dr,Br=function(e,t){var i,r,n,o,a,s=e.target,c=e.global,u=e.stat;if(i=c?kr:u?kr[s]||xr(s,{}):(kr[s]||{}).prototype)for(r in t){if(o=t[r],n=e.noTargetGet?(a=Mr(i,r))&&a.value:i[r],!Fr(c?r:s+(u?".":"#")+r,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;Vr(o,n)}(e.sham||n&&n.sham)&&Ur(o,"sham",!0),Lr(i,r,o,e)}},jr=ve,Gr=s,Hr=T(T.bind),zr=function(e,t){return jr(e),void 0===t?e:Gr?Hr(e,t):function(){return e.apply(t,arguments)}},Kr=C,Wr=Array.isArray||function(e){return"Array"==Kr(e)},Yr={};Yr[Qe("toStringTag")]="z";var Xr="[object z]"===String(Yr),qr=r,Jr=Xr,Qr=F,Zr=C,$r=Qe("toStringTag"),en=qr.Object,tn="Arguments"==Zr(function(){return arguments}()),rn=Jr?Zr:function(e){var t,i,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=en(e),$r))?i:tn?Zr(t):"Object"==(r=Zr(t))&&Qr(t.callee)?"Arguments":r},nn=T,on=o,an=F,sn=rn,cn=Jt,un=function(){},dn=[],ln=K("Reflect","construct"),hn=/^\s*(?:class|function)\b/,pn=nn(hn.exec),_n=!hn.exec(un),fn=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 _n||!!pn(hn,cn(e))}catch(e){return!0}};vn.sham=!0;var mn=!ln||on((function(){var e;return fn(fn.call)||!fn(Object)||!fn((function(){e=!0}))||e}))?vn:fn,Sn=r,yn=Wr,gn=mn,En=j,bn=Qe("species"),Tn=Sn.Array,In=function(e){var t;return yn(e)&&(t=e.constructor,(gn(t)&&(t===Tn||yn(t.prototype))||En(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=zr,Cn=k,On=De,wn=Qi,Nn=Rn,Pn=T([].push),Dn=function(e){var t=1==e,i=2==e,r=3==e,n=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,p,_=On(c),f=Cn(_),v=An(u,d),m=wn(f),S=0,y=l||Nn,g=t?y(c,m):i||a?y(c,0):void 0;m>S;S++)if((s||S in f)&&(p=v(h=f[S],S,_),e))if(t)g[S]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return S;case 2:Pn(g,h)}else switch(e){case 4:return!1;case 7:Pn(g,h)}return o?-1:r||n?n:g}},kn={forEach:Dn(0),map:Dn(1),filter:Dn(2),some:Dn(3),every:Dn(4),find:Dn(5),findIndex:Dn(6),filterReject:Dn(7)},Mn=o,Un=function(e,t){var i=[][e];return!!i&&Mn((function(){i.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)};Br({target:"Array",proto:!0,forced:[].forEach!=xn},{forEach:xn});var Vn=rn,Fn=Xr?{}.toString:function(){return"[object "+Vn(this)+"]"},Bn=Xr,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,Wn=Kn===Object.prototype?void 0:Kn,Yn=r,Xn=Hn,qn=Wn,Jn=xn,Qn=Gt,Zn=function(e){if(e&&e.forEach!==Jn)try{Qn(e,"forEach",Jn)}catch(t){e.forEach=Jn}};for(var $n in Xn)Xn[$n]&&Zn(Yn[$n]&&Yn[$n].prototype);Zn(qn);var eo=Br,to=T,io=r.Date,ro=to(io.prototype.getTime);eo({target:"Date",stat:!0},{now:function(){return ro(new io)}});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=cr,ho=ur,po=Object.keys||function(e){return lo(e,ho)},_o=a,fo=At,vo=Rt,mo=Pt,So=V,yo=po;uo.f=_o&&!fo?Object.defineProperties:function(e,t){mo(e);for(var i,r=So(t),n=yo(t),o=n.length,a=0;o>a;)vo.f(e,i=n[a++],r[i]);return e};var go,Eo=K("document","documentElement"),bo=Pt,To=uo,Io=ur,Ro=oi,Ao=Eo,Co=pt,Oo=ni("IE_PROTO"),wo=function(){},No=function(e){return"<script>"+e+"<\/script>"},Po=function(e){e.write(No("")),e.close();var t=e.parentWindow.Object;return e=null,t},Do=function(){try{go=new ActiveXObject("htmlfile")}catch(e){}var e,t;Do="undefined"!=typeof document?document.domain&&go?Po(go):((t=Co("iframe")).style.display="none",Ao.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(No("document.F=Object")),e.close(),e.F):Po(go);for(var i=Io.length;i--;)delete Do.prototype[Io[i]];return Do()};Ro[Oo]=!0;var ko=Object.create||function(e,t){var i;return null!==e?(wo.prototype=bo(e),i=new wo,wo.prototype=null,i[Oo]=e):i=Do(),void 0===t?i:To.f(i,t)},Mo=ko,Uo=Rt,Lo=Qe("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=ir.includes,Bo=Vo;Br({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=Qe("match"),zo=function(e){var t;return jo(e)&&(void 0!==(t=e[Ho])?!!t:"RegExp"==Go(e))},Ko=zo,Wo=r.TypeError,Yo=function(e){if(Ko(e))throw Wo("The method doesn't accept regular expressions");return e},Xo=rn,qo=r.String,Jo=function(e){if("Symbol"===Xo(e))throw TypeError("Cannot convert a Symbol value to a string");return qo(e)},Qo=Qe("match"),Zo=function(e){var t=/./;try{"/./"[e](t)}catch(i){try{return t[Qo]=!1,"/./"[e](t)}catch(e){}}return!1},$o=Br,ea=Yo,ta=U,ia=Jo,ra=Zo,na=T("".indexOf);$o({target:"String",proto:!0,forced:!ra("includes")},{includes:function(e){return!!~na(ia(ta(this)),ia(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=r.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=r.RegExp,_a=ha((function(){var e=pa(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),fa=o,va=r.RegExp,ma=fa((function(){var e=va("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Sa=d,ya=T,ga=Jo,Ea=aa,ba=la,Ta=Te.exports,Ia=ko,Ra=bi.get,Aa=_a,Ca=ma,Oa=Ta("native-string-replace",String.prototype.replace),wa=RegExp.prototype.exec,Na=wa,Pa=ya("".charAt),Da=ya("".indexOf),ka=ya("".replace),Ma=ya("".slice),Ua=function(){var e=/a/,t=/b*/g;return Sa(wa,e,"a"),Sa(wa,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),La=ba.BROKEN_CARET,xa=void 0!==/()??/.exec("")[1];(Ua||xa||La||Aa||Ca)&&(Na=function(e){var t,i,r,n,o,a,s,c=this,u=Ra(c),d=ga(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=Sa(Na,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=La&&c.sticky,_=Sa(Ea,c),f=c.source,v=0,m=d;if(p&&(_=ka(_,"y",""),-1===Da(_,"g")&&(_+="g"),m=Ma(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Pa(d,c.lastIndex-1))&&(f="(?: "+f+")",m=" "+m,v++),i=new RegExp("^(?:"+f+")",_)),xa&&(i=new RegExp("^"+f+"$(?!\\s)",_)),Ua&&(r=c.lastIndex),n=Sa(wa,p?i: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:r),xa&&n&&n.length>1&&Sa(Oa,n[0],i,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n&&h)for(n.groups=a=Ia(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=n[s[1]];return n});var Va=Na;Br({target:"RegExp",proto:!0,forced:/./.exec!==Va},{exec:Va});var Fa=T,Ba=Ht.exports,ja=Va,Ga=o,Ha=Qe,za=Gt,Ka=Ha("species"),Wa=RegExp.prototype,Ya=function(e,t,i,r){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,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[Ka]=function(){return i},i.flags="",i[n]=/./[n]),i.exec=function(){return t=!0,null},i[n](""),!t}));if(!o||!a||i){var s=Fa(/./[n]),c=t(n,""[e],(function(e,t,i,r,n){var a=Fa(e),c=t.exec;return c===ja||c===Wa.exec?o&&!n?{done:!0,value:s(t,i,r)}:{done:!0,value:a(i,t,r)}:{done:!1}}));Ba(String.prototype,e,c[0]),Ba(Wa,n,c[1])}r&&za(Wa[n],"sham",!0)},Xa=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},qa=d,Ja=Pt,Qa=F,Za=C,$a=Va,es=r.TypeError,ts=function(e,t){var i=e.exec;if(Qa(i)){var r=qa(i,e,t);return null!==r&&Ja(r),r}if("RegExp"===Za(e))return qa($a,e,t);throw es("RegExp#exec called on incompatible receiver")},is=d,rs=Pt,ns=U,os=Xa,as=Jo,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)}Ya("search",(function(e,t,i){return[function(t){var i=ns(this),r=null==t?void 0:ss(t,e);return r?is(r,t,i):new RegExp(t)[e](as(i))},function(e){var r=rs(this),n=as(e),o=i(t,r,n);if(o.done)return o.value;var a=r.lastIndex;os(a,0)||(r.lastIndex=0);var s=cs(r,n);return os(r.lastIndex,a)||(r.lastIndex=a),null===s?-1:s.index}]}));var ds=r,ls=F,hs=ds.String,ps=ds.TypeError,_s=T,fs=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,i={};try{(e=_s(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(i,[]),t=i instanceof Array}catch(e){}return function(i,r){return fs(i),vs(r),t?e(i,r):i.__proto__=r,i}}():void 0);Br({target:"Object",stat:!0},{setPrototypeOf:ms}),Br({target:"Object",stat:!0,sham:!a},{create:ko});var Ss=a,ys=T,gs=d,Es=o,bs=po,Ts=hr,Is=l,Rs=De,As=k,Cs=Object.assign,Os=Object.defineProperty,ws=ys([].concat),Ns=!Cs||Es((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={},i=Symbol(),r="abcdefghijklmnopqrst";return e[i]=7,r.split("").forEach((function(e){t[e]=e})),7!=Cs({},e)[i]||bs(Cs({},t)).join("")!=r}))?function(e,t){for(var i=Rs(e),r=arguments.length,n=1,o=Ts.f,a=Is.f;r>n;)for(var s,c=As(arguments[n++]),u=o?ws(bs(c),o(c)):bs(c),d=u.length,l=0;d>l;)s=u[l++],Ss&&!gs(a,c,s)||(i[s]=c[s]);return i}:Cs,Ps=Ns;Br({target:"Object",stat:!0,forced:Object.assign!==Ps},{assign:Ps});var Ds=Br,ks=ir.indexOf,Ms=Un,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,Ws=m,Ys=function(e,t,i){var r=zs(t);r in e?Ks.f(e,r,Ws(0,i)):e[r]=i},Xs=Wi,qs=Qi,Js=Ys,Qs=r.Array,Zs=Math.max,$s=function(e,t,i){for(var r=qs(e),n=Xs(t,r),o=Xs(void 0===i?r:i,r),a=Qs(Zs(o-n,0)),s=0;n<o;n++,s++)Js(a,s,e[n]);return a.length=s,a},ec=C,tc=V,ic=Fi.f,rc=$s,nc="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Hs.f=function(e){return nc&&"Window"==ec(e)?function(e){try{return ic(e)}catch(e){return rc(nc)}}(e):ic(tc(e))};var oc=T([].slice),ac={},sc=Qe;ac.f=sc;var cc=r,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,_c=Ue,fc=Qe("toStringTag"),vc=function(e,t,i){e&&!i&&(e=e.prototype),e&&!_c(e,fc)&&pc(e,fc,{configurable:!0,value:t})},mc=Br,Sc=r,yc=K,gc=Gs,Ec=d,bc=T,Tc=a,Ic=re,Rc=o,Ac=Ue,Cc=Wr,Oc=F,wc=j,Nc=W,Pc=de,Dc=Pt,kc=De,Mc=V,Uc=ut,Lc=Jo,xc=m,Vc=ko,Fc=po,Bc=Fi,jc=Hs,Gc=hr,Hc=n,zc=Rt,Kc=uo,Wc=l,Yc=oc,Xc=Ht.exports,qc=Te.exports,Jc=oi,Qc=Be,Zc=Qe,$c=ac,eu=hc,tu=vc,iu=bi,ru=kn.forEach,nu=ni("hidden"),ou=Zc("toPrimitive"),au=iu.set,su=iu.getterFor("Symbol"),cu=Object.prototype,uu=Sc.Symbol,du=uu&&uu.prototype,lu=Sc.TypeError,hu=Sc.QObject,pu=yc("JSON","stringify"),_u=Hc.f,fu=zc.f,vu=jc.f,mu=Wc.f,Su=bc([].push),yu=qc("symbols"),gu=qc("op-symbols"),Eu=qc("string-to-symbol-registry"),bu=qc("symbol-to-string-registry"),Tu=qc("wks"),Iu=!hu||!hu.prototype||!hu.prototype.findChild,Ru=Tc&&Rc((function(){return 7!=Vc(fu({},"a",{get:function(){return fu(this,"a",{value:7}).a}})).a}))?function(e,t,i){var r=_u(cu,t);r&&delete cu[t],fu(e,t,i),r&&e!==cu&&fu(cu,t,r)}:fu,Au=function(e,t){var i=yu[e]=Vc(du);return au(i,{type:"Symbol",tag:e,description:t}),Tc||(i.description=t),i},Cu=function(e,t,i){e===cu&&Cu(gu,t,i),Dc(e);var r=Uc(t);return Dc(i),Ac(yu,r)?(i.enumerable?(Ac(e,nu)&&e[nu][r]&&(e[nu][r]=!1),i=Vc(i,{enumerable:xc(0,!1)})):(Ac(e,nu)||fu(e,nu,xc(1,{})),e[nu][r]=!0),Ru(e,r,i)):fu(e,r,i)},Ou=function(e,t){Dc(e);var i=Mc(t),r=Fc(i).concat(Du(i));return ru(r,(function(t){Tc&&!Ec(wu,i,t)||Cu(e,t,i[t])})),e},wu=function(e){var t=Uc(e),i=Ec(mu,this,t);return!(this===cu&&Ac(yu,t)&&!Ac(gu,t))&&(!(i||!Ac(this,t)||!Ac(yu,t)||Ac(this,nu)&&this[nu][t])||i)},Nu=function(e,t){var i=Mc(e),r=Uc(t);if(i!==cu||!Ac(yu,r)||Ac(gu,r)){var n=_u(i,r);return!n||!Ac(yu,r)||Ac(i,nu)&&i[nu][r]||(n.enumerable=!0),n}},Pu=function(e){var t=vu(Mc(e)),i=[];return ru(t,(function(e){Ac(yu,e)||Ac(Jc,e)||Su(i,e)})),i},Du=function(e){var t=e===cu,i=vu(t?gu:Mc(e)),r=[];return ru(i,(function(e){!Ac(yu,e)||t&&!Ac(cu,e)||Su(r,yu[e])})),r};(Ic||(Xc(du=(uu=function(){if(Nc(du,this))throw lu("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Lc(arguments[0]):void 0,t=Qc(e),i=function(e){this===cu&&Ec(i,gu,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:i}),Au(t,e)}).prototype,"toString",(function(){return su(this).tag})),Xc(uu,"withoutSetter",(function(e){return Au(Qc(e),e)})),Wc.f=wu,zc.f=Cu,Kc.f=Ou,Hc.f=Nu,Bc.f=jc.f=Pu,Gc.f=Du,$c.f=function(e){return Au(Zc(e),e)},Tc&&(fu(du,"description",{configurable:!0,get:function(){return su(this).description}}),Xc(cu,"propertyIsEnumerable",wu,{unsafe:!0}))),mc({global:!0,wrap:!0,forced:!Ic,sham:!Ic},{Symbol:uu}),ru(Fc(Tu),(function(e){eu(e)})),mc({target:"Symbol",stat:!0,forced:!Ic},{for:function(e){var t=Lc(e);if(Ac(Eu,t))return Eu[t];var i=uu(t);return Eu[t]=i,bu[i]=t,i},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:Nu}),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,i){var r=Yc(arguments),n=t;if((wc(t)||void 0!==e)&&!Pc(e))return Cc(t)||(t=function(e,t){if(Oc(n)&&(t=Ec(n,this,e,t)),!Pc(t))return t}),r[1]=t,gc(pu,null,r)}});if(!du[ou]){var ku=du.valueOf;Xc(du,ou,(function(e){return Ec(ku,this)}))}tu(uu,"Symbol"),Jc[nu]=!0;var Mu=Br,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=Br,ju=a,Gu=Rt.f;Bu({target:"Object",stat:!0,forced:Object.defineProperty!==Gu,sham:!ju},{defineProperty:Gu});var Hu=r.Promise,zu=Ht.exports,Ku=function(e,t,i){for(var r in t)zu(e,r,t[r],i);return e},Wu=K,Yu=Rt,Xu=a,qu=Qe("species"),Ju=function(e){var t=Wu(e),i=Yu.f;Xu&&t&&!t[qu]&&i(t,qu,{configurable:!0,get:function(){return this}})},Qu=W,Zu=r.TypeError,$u=function(e,t){if(Qu(t,e))return e;throw Zu("Incorrect invocation")},ed={},td=ed,id=Qe("iterator"),rd=Array.prototype,nd=function(e){return void 0!==e&&(td.Array===e||rd[id]===e)},od=rn,ad=Se,sd=ed,cd=Qe("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,_d=ud,fd=r.TypeError,vd=function(e,t){var i=arguments.length<2?_d(e):t;if(ld(i))return hd(dd(i,e));throw fd(pd(e)+" is not iterable")},md=d,Sd=Pt,yd=Se,gd=function(e,t,i){var r,n;Sd(e);try{if(!(r=yd(e,"return"))){if("throw"===t)throw i;return i}r=md(r,e)}catch(e){n=!0,r=e}if("throw"===t)throw i;if(n)throw r;return Sd(r),i},Ed=zr,bd=d,Td=Pt,Id=he,Rd=nd,Ad=Qi,Cd=W,Od=vd,wd=ud,Nd=gd,Pd=r.TypeError,Dd=function(e,t){this.stopped=e,this.result=t},kd=Dd.prototype,Md=function(e,t,i){var r,n,o,a,s,c,u,d=i&&i.that,l=!(!i||!i.AS_ENTRIES),h=!(!i||!i.IS_ITERATOR),p=!(!i||!i.INTERRUPTED),_=Ed(t,d),f=function(e){return r&&Nd(r,"normal",e),new Dd(!0,e)},v=function(e){return l?(Td(e),p?_(e[0],e[1],f):_(e[0],e[1])):p?_(e,f):_(e)};if(h)r=e;else{if(!(n=wd(e)))throw Pd(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 Dd(!1)}r=Od(e,n)}for(c=r.next;!(u=bd(c,r)).done;){try{s=v(u.value)}catch(e){Nd(r,"throw",e)}if("object"==typeof s&&s&&Cd(kd,s))return s}return new Dd(!1)},Ud=Qe("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 i=!1;try{var r={};r[Ud]=function(){return{next:function(){return{done:i=!0}}}},e(r)}catch(e){}return i},zd=mn,Kd=he,Wd=r.TypeError,Yd=function(e){if(zd(e))return e;throw Wd(Kd(e)+" is not a constructor")},Xd=Pt,qd=Yd,Jd=Qe("species"),Qd=function(e,t){var i,r=Xd(e).constructor;return void 0===r||null==(i=Xd(r)[Jd])?t:qd(i)},Zd=r.TypeError,$d=function(e,t){if(e<t)throw Zd("Not enough arguments");return e},el=/(?:ipad|iphone|ipod).*applewebkit/i.test(Y),tl="process"==C(r.process),il=r,rl=Gs,nl=zr,ol=F,al=Ue,sl=o,cl=Eo,ul=oc,dl=pt,ll=$d,hl=el,pl=tl,_l=il.setImmediate,fl=il.clearImmediate,vl=il.process,ml=il.Dispatch,Sl=il.Function,yl=il.MessageChannel,gl=il.String,El=0,bl={};try{Fd=il.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){il.postMessage(gl(e),Fd.protocol+"//"+Fd.host)};_l&&fl||(_l=function(e){ll(arguments.length,1);var t=ol(e)?e:Sl(e),i=ul(arguments,1);return bl[++El]=function(){rl(t,void 0,i)},Bd(El),El},fl=function(e){delete bl[e]},pl?Bd=function(e){vl.nextTick(Il(e))}:ml&&ml.now?Bd=function(e){ml.now(Il(e))}:yl&&!hl?(Gd=(jd=new yl).port2,jd.port1.onmessage=Rl,Bd=nl(Gd.postMessage,Gd)):il.addEventListener&&ol(il.postMessage)&&!il.importScripts&&Fd&&"file:"!==Fd.protocol&&!sl(Al)?(Bd=Al,il.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,wl,Nl,Pl,Dl,kl,Ml,Ul={set:_l,clear:fl},Ll=r,xl=/ipad|iphone|ipod/i.test(Y)&&void 0!==Ll.Pebble,Vl=/web0s(?!.*chrome)/i.test(Y),Fl=r,Bl=zr,jl=n.f,Gl=Ul.set,Hl=el,zl=xl,Kl=Vl,Wl=tl,Yl=Fl.MutationObserver||Fl.WebKitMutationObserver,Xl=Fl.document,ql=Fl.process,Jl=Fl.Promise,Ql=jl(Fl,"queueMicrotask"),Zl=Ql&&Ql.value;Zl||(Cl=function(){var e,t;for(Wl&&(e=ql.domain)&&e.exit();Ol;){t=Ol.fn,Ol=Ol.next;try{t()}catch(e){throw Ol?Nl():wl=void 0,e}}wl=void 0,e&&e.enter()},Hl||Wl||Kl||!Yl||!Xl?!zl&&Jl&&Jl.resolve?((kl=Jl.resolve(void 0)).constructor=Jl,Ml=Bl(kl.then,kl),Nl=function(){Ml(Cl)}):Wl?Nl=function(){ql.nextTick(Cl)}:(Gl=Bl(Gl,Fl),Nl=function(){Gl(Cl)}):(Pl=!0,Dl=Xl.createTextNode(""),new Yl(Cl).observe(Dl,{characterData:!0}),Nl=function(){Dl.data=Pl=!Pl}));var $l=Zl||function(e){var t={fn:e,next:void 0};wl&&(wl.next=t),Ol||(Ol=t,Nl()),wl=t},eh={},th=ve,ih=function(e){var t,i;this.promise=new e((function(e,r){if(void 0!==t||void 0!==i)throw TypeError("Bad Promise constructor");t=e,i=r})),this.resolve=th(t),this.reject=th(i)};eh.f=function(e){return new ih(e)};var rh=Pt,nh=j,oh=eh,ah=function(e,t){if(rh(e),nh(t)&&t.constructor===e)return t;var i=oh.f(e);return(0,i.resolve)(t),i.promise},sh=r,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,_h="object"==typeof window,fh=Br,vh=r,mh=K,Sh=d,yh=Hu,gh=Ht.exports,Eh=Ku,bh=ms,Th=vc,Ih=Ju,Rh=ve,Ah=F,Ch=j,Oh=$u,wh=Jt,Nh=Md,Ph=Hd,Dh=Qd,kh=Ul.set,Mh=$l,Uh=ah,Lh=function(e,t){var i=sh.console;i&&i.error&&(1==arguments.length?i.error(e):i.error(e,t))},xh=eh,Vh=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Fh=ph,Bh=bi,jh=Dr,Gh=_h,Hh=tl,zh=ee,Kh=Qe("species"),Wh="Promise",Yh=Bh.getterFor(Wh),Xh=Bh.set,qh=Bh.getterFor(Wh),Jh=yh&&yh.prototype,Qh=yh,Zh=Jh,$h=vh.TypeError,ep=vh.document,tp=vh.process,ip=xh.f,rp=ip,np=!!(ep&&ep.createEvent&&vh.dispatchEvent),op=Ah(vh.PromiseRejectionEvent),ap=!1,sp=jh(Wh,(function(){var e=wh(Qh),t=e!==String(Qh);if(!t&&66===zh)return!0;if(zh>=51&&/native code/.test(e))return!1;var i=new Qh((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};return(i.constructor={})[Kh]=r,!(ap=i.then((function(){}))instanceof r)||!t&&Gh&&!op})),cp=sp||!Ph((function(e){Qh.all(e).catch((function(){}))})),up=function(e){var t;return!(!Ch(e)||!Ah(t=e.then))&&t},dp=function(e,t){var i,r,n,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&fp(t),t.rejection=1),!0===s?i=o:(d&&d.enter(),i=s(o),d&&(d.exit(),n=!0)),i===e.promise?u($h("Promise-chain cycle")):(r=up(i))?Sh(r,i,c,u):c(i)):u(o)}catch(e){d&&!n&&d.exit(),u(e)}},lp=function(e,t){e.notified||(e.notified=!0,Mh((function(){for(var i,r=e.reactions;i=r.get();)dp(i,e);e.notified=!1,t&&!e.rejection&&pp(e)})))},hp=function(e,t,i){var r,n;np?((r=ep.createEvent("Event")).promise=t,r.reason=i,r.initEvent(e,!1,!0),vh.dispatchEvent(r)):r={promise:t,reason:i},!op&&(n=vh["on"+e])?n(r):"unhandledrejection"===e&&Lh("Unhandled promise rejection",i)},pp=function(e){Sh(kh,vh,(function(){var t,i=e.facade,r=e.value;if(_p(e)&&(t=Vh((function(){Hh?tp.emit("unhandledRejection",r,i):hp("unhandledrejection",i,r)})),e.rejection=Hh||_p(e)?2:1,t.error))throw t.value}))},_p=function(e){return 1!==e.rejection&&!e.parent},fp=function(e){Sh(kh,vh,(function(){var t=e.facade;Hh?tp.emit("rejectionHandled",t):hp("rejectionhandled",t,e.value)}))},vp=function(e,t,i){return function(r){e(t,r,i)}},mp=function(e,t,i){e.done||(e.done=!0,i&&(e=i),e.value=t,e.state=2,lp(e,!0))},Sp=function(e,t,i){if(!e.done){e.done=!0,i&&(e=i);try{if(e.facade===t)throw $h("Promise can't be resolved itself");var r=up(t);r?Mh((function(){var i={done:!1};try{Sh(r,t,vp(Sp,i,e),vp(mp,i,e))}catch(t){mp(i,t,e)}})):(e.value=t,e.state=1,lp(e,!1))}catch(t){mp({done:!1},t,e)}}};if(sp&&(Zh=(Qh=function(e){Oh(this,Zh),Rh(e),Sh(uh,this);var t=Yh(this);try{e(vp(Sp,t),vp(mp,t))}catch(e){mp(t,e)}}).prototype,(uh=function(e){Xh(this,{type:Wh,done:!1,notified:!1,parent:!1,reactions:new Fh,rejection:!1,state:0,value:void 0})}).prototype=Eh(Zh,{then:function(e,t){var i=qh(this),r=ip(Dh(this,Qh));return i.parent=!0,r.ok=!Ah(e)||e,r.fail=Ah(t)&&t,r.domain=Hh?tp.domain:void 0,0==i.state?i.reactions.add(r):Mh((function(){dp(r,i)})),r.promise},catch:function(e){return this.then(void 0,e)}}),dh=function(){var e=new uh,t=Yh(e);this.promise=e,this.resolve=vp(Sp,t),this.reject=vp(mp,t)},xh.f=ip=function(e){return e===Qh||e===lh?new dh(e):rp(e)},Ah(yh)&&Jh!==Object.prototype)){hh=Jh.then,ap||(gh(Jh,"then",(function(e,t){var i=this;return new Qh((function(e,t){Sh(hh,i,e,t)})).then(e,t)}),{unsafe:!0}),gh(Jh,"catch",Zh.catch,{unsafe:!0}));try{delete Jh.constructor}catch(e){}bh&&bh(Jh,Zh)}fh({global:!0,wrap:!0,forced:sp},{Promise:Qh}),Th(Qh,Wh,!1),Ih(Wh),lh=mh(Wh),fh({target:Wh,stat:!0,forced:sp},{reject:function(e){var t=ip(this);return Sh(t.reject,void 0,e),t.promise}}),fh({target:Wh,stat:!0,forced:sp},{resolve:function(e){return Uh(this,e)}}),fh({target:Wh,stat:!0,forced:cp},{all:function(e){var t=this,i=ip(t),r=i.resolve,n=i.reject,o=Vh((function(){var i=Rh(t.resolve),o=[],a=0,s=1;Nh(e,(function(e){var c=a++,u=!1;s++,Sh(i,t,e).then((function(e){u||(u=!0,o[c]=e,--s||r(o))}),n)})),--s||r(o)}));return o.error&&n(o.value),i.promise},race:function(e){var t=this,i=ip(t),r=i.reject,n=Vh((function(){var n=Rh(t.resolve);Nh(e,(function(e){Sh(n,t,e).then(i.resolve,r)}))}));return n.error&&r(n.value),i.promise}});var yp=Br,gp=a,Ep=r,bp=T,Tp=Ue,Ip=F,Rp=W,Ap=Jo,Cp=Rt.f,Op=Tr,wp=Ep.Symbol,Np=wp&&wp.prototype;if(gp&&Ip(wp)&&(!("description"in Np)||void 0!==wp().description)){var Pp={},Dp=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:Ap(arguments[0]),t=Rp(Np,this)?new wp(e):void 0===e?wp():wp(e);return""===e&&(Pp[t]=!0),t};Op(Dp,wp),Dp.prototype=Np,Np.constructor=Dp;var kp="Symbol(test)"==String(wp("test")),Mp=bp(Np.toString),Up=bp(Np.valueOf),Lp=/^Symbol\((.*)\)[^)]+$/,xp=bp("".replace),Vp=bp("".slice);Cp(Np,"description",{configurable:!0,get:function(){var e=Up(this),t=Mp(e);if(Tp(Pp,e))return"";var i=kp?Vp(t,7,-1):xp(t,Lp,"$1");return""===i?void 0:i}}),yp({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=r,zp=Ue,Kp=F,Wp=De,Yp=Gp,Xp=ni("IE_PROTO"),qp=Hp.Object,Jp=qp.prototype,Qp=Yp?qp.getPrototypeOf:function(e){var t=Wp(e);if(zp(t,Xp))return t[Xp];var i=t.constructor;return Kp(i)&&t instanceof i?i.prototype:t instanceof qp?Jp:null},Zp=o,$p=F,e_=Qp,t_=Ht.exports,i_=Qe("iterator"),r_=!1;[].keys&&("next"in(jp=[].keys())?(Bp=e_(e_(jp)))!==Object.prototype&&(Fp=Bp):r_=!0);var n_=null==Fp||Zp((function(){var e={};return Fp[i_].call(e)!==e}));n_&&(Fp={}),$p(Fp[i_])||t_(Fp,i_,(function(){return this}));var o_={IteratorPrototype:Fp,BUGGY_SAFARI_ITERATORS:r_},a_=o_.IteratorPrototype,s_=ko,c_=m,u_=vc,d_=ed,l_=function(){return this},h_=function(e,t,i,r){var n=t+" Iterator";return e.prototype=s_(a_,{next:c_(+!r,i)}),u_(e,n,!1),d_[n]=l_,e},p_=Br,__=d,f_=Oi,v_=F,m_=h_,S_=Qp,y_=ms,g_=vc,E_=Gt,b_=Ht.exports,T_=ed,I_=f_.PROPER,R_=f_.CONFIGURABLE,A_=o_.IteratorPrototype,C_=o_.BUGGY_SAFARI_ITERATORS,O_=Qe("iterator"),w_=function(){return this},N_=function(e,t,i,r,n,o,a){m_(i,t,r);var s,c,u,d=function(e){if(e===n&&f)return f;if(!C_&&e in p)return p[e];switch(e){case"keys":case"values":case"entries":return function(){return new i(this,e)}}return function(){return new i(this)}},l=t+" Iterator",h=!1,p=e.prototype,_=p[O_]||p["@@iterator"]||n&&p[n],f=!C_&&_||d(n),v="Array"==t&&p.entries||_;if(v&&(s=S_(v.call(new e)))!==Object.prototype&&s.next&&(S_(s)!==A_&&(y_?y_(s,A_):v_(s[O_])||b_(s,O_,w_)),g_(s,l,!0)),I_&&"values"==n&&_&&"values"!==_.name&&(R_?E_(p,"name","values"):(h=!0,f=function(){return __(_,this)})),n)if(c={values:d("values"),keys:o?f:d("keys"),entries:d("entries")},a)for(u in c)(C_||h||!(u in p))&&b_(p,u,c[u]);else p_({target:t,proto:!0,forced:C_||h},c);return p[O_]!==f&&b_(p,O_,f,{name:n}),T_[t]=f,c},P_=V,D_=Vo,k_=ed,M_=bi,U_=Rt.f,L_=N_,x_=a,V_=M_.set,F_=M_.getterFor("Array Iterator"),B_=L_(Array,"Array",(function(e,t){V_(this,{type:"Array Iterator",target:P_(e),index:0,kind:t})}),(function(){var e=F_(this),t=e.target,i=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==i?{value:r,done:!1}:"values"==i?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),j_=k_.Arguments=k_.Array;if(D_("keys"),D_("values"),D_("entries"),x_&&"values"!==j_.name)try{U_(j_,"name",{value:"values"})}catch(e){}var G_=T,H_=Gi,z_=Jo,K_=U,W_=G_("".charAt),Y_=G_("".charCodeAt),X_=G_("".slice),q_=function(e){return function(t,i){var r,n,o=z_(K_(t)),a=H_(i),s=o.length;return a<0||a>=s?e?"":void 0:(r=Y_(o,a))<55296||r>56319||a+1===s||(n=Y_(o,a+1))<56320||n>57343?e?W_(o,a):r:e?X_(o,a,a+2):n-56320+(r-55296<<10)+65536}},J_={codeAt:q_(!1),charAt:q_(!0)},Q_=J_.charAt,Z_=Jo,$_=bi,ef=N_,tf=$_.set,rf=$_.getterFor("String Iterator");ef(String,"String",(function(e){tf(this,{type:"String Iterator",string:Z_(e),index:0})}),(function(){var e,t=rf(this),i=t.string,r=t.index;return r>=i.length?{value:void 0,done:!0}:(e=Q_(i,r),t.index+=e.length,{value:e,done:!1})}));var nf=r,of=Hn,af=Wn,sf=B_,cf=Gt,uf=Qe,df=uf("iterator"),lf=uf("toStringTag"),hf=sf.values,pf=function(e,t){if(e){if(e[df]!==hf)try{cf(e,df,hf)}catch(t){e[df]=hf}if(e[lf]||cf(e,lf,t),of[t])for(var i in sf)if(e[i]!==sf[i])try{cf(e,i,sf[i])}catch(t){e[i]=sf[i]}}};for(var _f in of)pf(nf[_f]&&nf[_f].prototype,_f);pf(af,"DOMTokenList");var ff=o,vf=ee,mf=Qe("species"),Sf=function(e){return vf>=51||!ff((function(){var t=[];return(t.constructor={})[mf]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},yf=Br,gf=r,Ef=o,bf=Wr,Tf=j,If=De,Rf=Qi,Af=Ys,Cf=Rn,Of=Sf,wf=ee,Nf=Qe("isConcatSpreadable"),Pf=gf.TypeError,Df=wf>=51||!Ef((function(){var e=[];return e[Nf]=!1,e.concat()[0]!==e})),kf=Of("concat"),Mf=function(e){if(!Tf(e))return!1;var t=e[Nf];return void 0!==t?!!t:bf(e)};yf({target:"Array",proto:!0,forced:!Df||!kf},{concat:function(e){var t,i,r,n,o,a=If(this),s=Cf(a,0),c=0;for(t=-1,r=arguments.length;t<r;t++)if(Mf(o=-1===t?a:arguments[t])){if(c+(n=Rf(o))>9007199254740991)throw Pf("Maximum allowed index exceeded");for(i=0;i<n;i++,c++)i in o&&Af(s,c,o[i])}else{if(c>=9007199254740991)throw Pf("Maximum allowed index exceeded");Af(s,c++,o)}return s.length=c,s}});var Uf=Br,Lf=r,xf=Wr,Vf=mn,Ff=j,Bf=Wi,jf=Qi,Gf=V,Hf=Ys,zf=Qe,Kf=oc,Wf=Sf("slice"),Yf=zf("species"),Xf=Lf.Array,qf=Math.max;Uf({target:"Array",proto:!0,forced:!Wf},{slice:function(e,t){var i,r,n,o=Gf(this),a=jf(o),s=Bf(e,a),c=Bf(void 0===t?a:t,a);if(xf(o)&&(i=o.constructor,(Vf(i)&&(i===Xf||xf(i.prototype))||Ff(i)&&null===(i=i[Yf]))&&(i=void 0),i===Xf||void 0===i))return Kf(o,s,c);for(r=new(void 0===i?Xf:i)(qf(c-s,0)),n=0;s<c;s++,n++)s in o&&Hf(r,n,o[s]);return r.length=n,r}}),hc("asyncIterator");var Jf=function(e,t){return Jf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},Jf(e,t)};function Qf(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}Jf(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var Zf=function(){return Zf=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Zf.apply(this,arguments)};function $f(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===("undefined"==typeof Reflect?"undefined":us(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a}function ev(e,t,i,r){return new(i||(i=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function tv(e,t){var i,r,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function iv(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],r=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function rv(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var r,n,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return a}function nv(e,t,i){if(i||2===arguments.length)for(var r,n=0,o=t.length;n<o;n++)!r&&n in t||(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))}function ov(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var av=J_.charAt,sv=function(e,t,i){return t+(i?av(e,t).length:1)},cv=d,uv=Pt,dv=qi,lv=Jo,hv=U,pv=Se,_v=sv,fv=ts;Ya("match",(function(e,t,i){return[function(t){var i=hv(this),r=null==t?void 0:pv(t,e);return r?cv(r,t,i):new RegExp(t)[e](lv(i))},function(e){var r=uv(this),n=lv(e),o=i(t,r,n);if(o.done)return o.value;if(!r.global)return fv(r,n);var a=r.unicode;r.lastIndex=0;for(var s,c=[],u=0;null!==(s=fv(r,n));){var d=lv(s[0]);c[u]=d,""===d&&(r.lastIndex=_v(n,dv(r.lastIndex),a)),u++}return 0===u?null:c}]}));var vv="\t\n\v\f\r                 \u2028\u2029\ufeff",mv=U,Sv=Jo,yv=T("".replace),gv="[\t\n\v\f\r                 \u2028\u2029\ufeff]",Ev=RegExp("^"+gv+gv+"*"),bv=RegExp(gv+gv+"*$"),Tv=function(e){return function(t){var i=Sv(mv(t));return 1&e&&(i=yv(i,Ev,"")),2&e&&(i=yv(i,bv,"")),i}},Iv={start:Tv(1),end:Tv(2),trim:Tv(3)},Rv=r,Av=o,Cv=T,Ov=Jo,wv=Iv.trim,Nv=Rv.parseInt,Pv=Rv.Symbol,Dv=Pv&&Pv.iterator,kv=/^[+-]?0x/i,Mv=Cv(kv.exec),Uv=8!==Nv("\t\n\v\f\r                 \u2028\u2029\ufeff08")||22!==Nv("\t\n\v\f\r                 \u2028\u2029\ufeff0x16")||Dv&&!Av((function(){Nv(Object(Dv))}))?function(e,t){var i=wv(Ov(e));return Nv(i,t>>>0||(Mv(kv,i)?16:10))}:Nv;Br({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=Br,Wv=T,Yv=oi,Xv=j,qv=Ue,Jv=Rt.f,Qv=Fi,Zv=Hs,$v=Hv,em=zv,tm=!1,im=Be("meta"),rm=0,nm=function(e){Jv(e,im,{value:{objectID:"O"+rm++,weakData:{}}})},om=Lv.exports={enable:function(){om.enable=function(){},tm=!0;var e=Qv.f,t=Wv([].splice),i={};i[im]=1,e(i).length&&(Qv.f=function(i){for(var r=e(i),n=0,o=r.length;n<o;n++)if(r[n]===im){t(r,n,1);break}return r},Kv({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Zv.f}))},fastKey:function(e,t){if(!Xv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!qv(e,im)){if(!$v(e))return"F";if(!t)return"E";nm(e)}return e[im].objectID},getWeakData:function(e,t){if(!qv(e,im)){if(!$v(e))return!0;if(!t)return!1;nm(e)}return e[im].weakData},onFreeze:function(e){return em&&tm&&$v(e)&&!qv(e,im)&&nm(e),e}};Yv[im]=!0;var am=F,sm=j,cm=ms,um=function(e,t,i){var r,n;return cm&&am(r=t.constructor)&&r!==i&&sm(n=r.prototype)&&n!==i.prototype&&cm(e,n),e},dm=Br,lm=r,hm=T,pm=Dr,_m=Ht.exports,fm=Lv.exports,vm=Md,mm=$u,Sm=F,ym=j,gm=o,Em=Hd,bm=vc,Tm=um,Im=function(e,t,i){var r=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=r?"set":"add",a=lm[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=hm(s[e]);_m(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(n&&!ym(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return n&&!ym(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(n&&!ym(e))&&t(this,0===e?0:e)}:function(e,i){return t(this,0===e?0:e,i),this})};if(pm(e,!Sm(a)||!(n||s.forEach&&!gm((function(){(new a).entries().next()})))))c=i.getConstructor(t,e,r,o),fm.enable();else if(pm(e,!0)){var l=new c,h=l[o](n?{}:-0,1)!=l,p=gm((function(){l.has(1)})),_=Em((function(e){new a(e)})),f=!n&&gm((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));_||((c=t((function(e,t){mm(e,s);var i=Tm(new a,e,c);return null!=t&&vm(t,i[o],{that:i,AS_ENTRIES:r}),i}))).prototype=s,s.constructor=c),(p||f)&&(d("delete"),d("has"),r&&d("get")),(f||h)&&d(o),n&&s.clear&&delete s.clear}return u[e]=c,dm({global:!0,forced:c!=a},u),bm(c,e),n||i.setStrong(c,e,r),c},Rm=Rt.f,Am=ko,Cm=Ku,Om=zr,wm=$u,Nm=Md,Pm=N_,Dm=Ju,km=a,Mm=Lv.exports.fastKey,Um=bi.set,Lm=bi.getterFor,xm={getConstructor:function(e,t,i,r){var n=e((function(e,n){wm(e,o),Um(e,{type:t,index:Am(null),first:void 0,last:void 0,size:0}),km||(e.size=0),null!=n&&Nm(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=Lm(t),s=function(e,t,i){var r,n,o=a(e),s=c(e,t);return s?s.value=i:(o.last=s={index:n=Mm(t,!0),key:t,value:i,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=s),r&&(r.next=s),km?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},c=function(e,t){var i,r=a(e),n=Mm(t);if("F"!==n)return r.index[n];for(i=r.first;i;i=i.next)if(i.key==t)return i};return Cm(o,{clear:function(){for(var e=a(this),t=e.index,i=e.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete t[i.index],i=i.next;e.first=e.last=void 0,km?e.size=0:this.size=0},delete:function(e){var t=this,i=a(t),r=c(t,e);if(r){var n=r.next,o=r.previous;delete i.index[r.index],r.removed=!0,o&&(o.next=n),n&&(n.previous=o),i.first==r&&(i.first=n),i.last==r&&(i.last=o),km?i.size--:t.size--}return!!r},forEach:function(e){for(var t,i=a(this),r=Om(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:i.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Cm(o,i?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),km&&Rm(o,"size",{get:function(){return a(this).size}}),n},setStrong:function(e,t,i){var r=t+" Iterator",n=Lm(t),o=Lm(r);Pm(e,t,(function(e,t){Um(this,{type:r,target:e,state:n(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,i=e.last;i&&i.removed;)i=i.previous;return e.target&&(e.last=i=i?i.next:e.state.first)?"keys"==t?{value:i.key,done:!1}:"values"==t?{value:i.value,done:!1}:{value:[i.key,i.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),i?"entries":"values",!i,!0),Dm(t)}};Im("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),xm);var Vm=De,Fm=po;Br({target:"Object",stat:!0,forced:o((function(){Fm(1)}))},{keys:function(e){return Fm(Vm(e))}});var Bm=ve,jm=De,Gm=k,Hm=Qi,zm=r.TypeError,Km=function(e){return function(t,i,r,n){Bm(i);var o=jm(t),a=Gm(o),s=Hm(o),c=e?s-1:0,u=e?-1:1;if(r<2)for(;;){if(c in a){n=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw zm("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(n=i(n,a[c],c,o));return n}},Wm={left:Km(!1),right:Km(!0)},Ym=Wm.left,Xm=ee,qm=tl;Br({target:"Array",proto:!0,forced:!Un("reduce")||!qm&&Xm>79&&Xm<83},{reduce:function(e){var t=arguments.length;return Ym(this,e,t,t>1?arguments[1]:void 0)}});var Jm,Qm=Br,Zm=T,$m=n.f,eS=qi,tS=Jo,iS=Yo,rS=U,nS=Zo,oS=Zm("".endsWith),aS=Zm("".slice),sS=Math.min,cS=nS("endsWith");Qm({target:"String",proto:!0,forced:!!(cS||(Jm=$m(String.prototype,"endsWith"),!Jm||Jm.writable))&&!cS},{endsWith:function(e){var t=tS(rS(this));iS(e);var i=arguments.length>1?arguments[1]:void 0,r=t.length,n=void 0===i?r:sS(eS(i),r),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,i){var r=e.match(t);return r&&r.length>=i&&parseInt(r[i],10)}function hS(e,t,i){if(e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,n=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return n.apply(this,arguments);var o=function(e){var t=i(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),n.apply(this,[e,o])};var o=r.removeEventListener;r.removeEventListener=function(e,i){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(i))return o.apply(this,arguments);var r=this._eventMap[t].get(i);return this._eventMap[t].delete(i),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function 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 _S(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 fS(){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 i=e.navigator;if(i.mozGetUserMedia)t.browser="firefox",t.version=lS(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=lS(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!i.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=lS(i.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 yS(e){return SS(e)?Object.keys(e).reduce((function(t,i){var r=SS(e[i]),n=r?yS(e[i]):e[i],o=r&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,ov({},i,n))}),{}):e}function gS(e,t,i){t&&!i.has(t.id)&&(i.set(t.id,t),Object.keys(t).forEach((function(r){r.endsWith("Id")?gS(e,e.get(t[r]),i):r.endsWith("Ids")&&t[r].forEach((function(t){gS(e,e.get(t),i)}))})))}function ES(e,t,i){var r=i?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(i){i.type===r&&i.trackId===t.id&&gS(e,i,n)}))})),n}var bS=Br,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=Br,CS=r,OS=Wi,wS=Gi,NS=Qi,PS=De,DS=Rn,kS=Ys,MS=Sf("splice"),US=CS.TypeError,LS=Math.max,xS=Math.min;AS({target:"Array",proto:!0,forced:!MS},{splice:function(e,t){var i,r,n,o,a,s,c=PS(this),u=NS(c),d=OS(e,u),l=arguments.length;if(0===l?i=r=0:1===l?(i=0,r=u-d):(i=l-2,r=xS(LS(wS(t),0),u-d)),u+i-r>9007199254740991)throw US("Maximum allowed length exceeded");for(n=DS(c,r),o=0;o<r;o++)(a=d+o)in c&&kS(n,o,c[a]);if(n.length=r,i<r){for(o=d;o<u-r;o++)s=o+i,(a=o+r)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-r+i;o--)delete c[o-1]}else if(i>r)for(o=u-r;o>d;o--)s=o+i-1,(a=o+r-1)in c?c[s]=c[a]:delete c[s];for(o=0;o<i;o++)c[o+d]=arguments[o+2];return c.length=u-r+i,n}});var VS=kn.map;Br({target:"Array",proto:!0,forced:!Sf("map")},{map:function(e){return VS(this,e,arguments.length>1?arguments[1]:void 0)}});var FS=kn.filter;Br({target:"Array",proto:!0,forced:!Sf("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),WS=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,YS=/\$([$&'`]|\d{1,2})/g,XS=Gs,qS=d,JS=T,QS=Ya,ZS=o,$S=Pt,ey=F,ty=Gi,iy=qi,ry=Jo,ny=U,oy=sv,ay=Se,sy=function(e,t,i,r,n,o){var a=i+e.length,s=r.length,c=YS;return void 0!==n&&(n=jS(n),c=WS),zS(o,c,(function(o,c){var u;switch(HS(c,0)){case"$":return"$";case"&":return e;case"`":return KS(t,0,i);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===r[l-1]?HS(c,1):r[l-1]+HS(c,1):o}u=r[d-1]}return void 0===u?"":u}))},cy=ts,uy=Qe("replace"),dy=Math.max,ly=Math.min,hy=JS([].concat),py=JS([].push),_y=JS("".indexOf),fy=JS("".slice),vy="$0"==="a".replace(/./,"$0"),my=!!/./[uy]&&""===/./[uy]("a","$0");QS("replace",(function(e,t,i){var r=my?"$":"$0";return[function(e,i){var r=ny(this),n=null==e?void 0:ay(e,uy);return n?qS(n,e,r,i):qS(t,ry(r),e,i)},function(e,n){var o=$S(this),a=ry(e);if("string"==typeof n&&-1===_y(n,r)&&-1===_y(n,"$<")){var s=i(t,o,a,n);if(s.done)return s.value}var c=ey(n);c||(n=ry(n));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=cy(o,a);if(null===h)break;if(py(l,h),!u)break;""===ry(h[0])&&(o.lastIndex=oy(a,iy(o.lastIndex),d))}for(var p,_="",f=0,v=0;v<l.length;v++){for(var m=ry((h=l[v])[0]),S=dy(ly(ty(h.index),a.length),0),y=[],g=1;g<h.length;g++)py(y,void 0===(p=h[g])?p:String(p));var E=h.groups;if(c){var b=hy([m],y,S,a);void 0!==E&&py(b,E);var T=ry(XS(n,void 0,b))}else T=sy(m,a,S,y,E,n);S>=f&&(_+=fy(a,f,S)+T,f=S+m.length)}return _+fy(a,f)}]}),!!ZS((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!vy||my);var Sy=a,yy=r,gy=T,Ey=Dr,by=um,Ty=Gt,Iy=Rt.f,Ry=Fi.f,Ay=W,Cy=zo,Oy=Jo,wy=aa,Ny=la,Py=Ht.exports,Dy=o,ky=Ue,My=bi.enforce,Uy=Ju,Ly=_a,xy=ma,Vy=Qe("match"),Fy=yy.RegExp,By=Fy.prototype,jy=yy.SyntaxError,Gy=gy(wy),Hy=gy(By.exec),zy=gy("".charAt),Ky=gy("".replace),Wy=gy("".indexOf),Yy=gy("".slice),Xy=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,qy=/a/g,Jy=/a/g,Qy=new Fy(qy)!==qy,Zy=Ny.MISSED_STICKY,$y=Ny.UNSUPPORTED_Y,eg=Sy&&(!Qy||Zy||Ly||xy||Dy((function(){return Jy[Vy]=!1,Fy(qy)!=qy||Fy(Jy)==Jy||"/a/i"!=Fy(qy,"i")})));if(Ey("RegExp",eg)){for(var tg=function(e,t){var i,r,n,o,a,s,c=Ay(By,this),u=Cy(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===tg)return e;if((u||Ay(By,e))&&(e=e.source,d&&(t="flags"in h?h.flags:Gy(h))),e=void 0===e?"":Oy(e),t=void 0===t?"":Oy(t),h=e,Ly&&"dotAll"in qy&&(r=!!t&&Wy(t,"s")>-1)&&(t=Ky(t,/s/g,"")),i=t,Zy&&"sticky"in qy&&(n=!!t&&Wy(t,"y")>-1)&&$y&&(t=Ky(t,/y/g,"")),xy&&(o=function(e){for(var t,i=e.length,r=0,n="",o=[],a={},s=!1,c=!1,u=0,d="";r<=i;r++){if("\\"===(t=zy(e,r)))t+=zy(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:Hy(Xy,Yy(e,r+1))&&(r+=2,c=!0),n+=t,u++;continue;case">"===t&&c:if(""===d||ky(a,d))throw new jy("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=by(Fy(e,t),c?this:By,tg),(r||n||l.length)&&(s=My(a),r&&(s.dotAll=!0,s.raw=tg(function(e){for(var t,i=e.length,r=0,n="",o=!1;r<=i;r++)"\\"!==(t=zy(e,r))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),n+=t):n+="[\\s\\S]":n+=t+zy(e,++r);return n}(e),i)),n&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{Ty(a,"source",""===h?"(?:)":h)}catch(e){}return a},ig=function(e){e in tg||Iy(tg,e,{configurable:!0,get:function(){return Fy[e]},set:function(t){Fy[e]=t}})},rg=Ry(Fy),ng=0;rg.length>ng;)ig(rg[ng++]);By.constructor=tg,tg.prototype=By,Py(yy,"RegExp",tg)}Uy("RegExp");var og=T,ag=Oi.PROPER,sg=Ht.exports,cg=Pt,ug=W,dg=Jo,lg=o,hg=aa,pg=RegExp.prototype,_g=pg.toString,fg=og(hg),vg=lg((function(){return"/a/b"!=_g.call({source:"a",flags:"b"})})),mg=ag&&"toString"!=_g.name;(vg||mg)&&sg(RegExp.prototype,"toString",(function(){var e=cg(this),t=dg(e.source),i=e.flags;return"/"+t+"/"+dg(void 0===i&&ug(pg,e)&&!("flags"in pg)?fg(e):i)}),{unsafe:!0});var Sg=kn.some;Br({target:"Array",proto:!0,forced:!Un("some")},{some:function(e){return Sg(this,e,arguments.length>1?arguments[1]:void 0)}});var yg=a,gg=Oi.EXISTS,Eg=T,bg=Rt.f,Tg=Function.prototype,Ig=Eg(Tg.toString),Rg=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Ag=Eg(Rg.exec);yg&&!gg&&bg(Tg,"name",{configurable:!0,get:function(){try{return Ag(Rg,Ig(this))[1]}catch(e){return""}}});var Cg=T,Og=ve,wg=j,Ng=Ue,Pg=oc,Dg=s,kg=r.Function,Mg=Cg([].concat),Ug=Cg([].join),Lg={},xg=function(e,t,i){if(!Ng(Lg,t)){for(var r=[],n=0;n<t;n++)r[n]="a["+n+"]";Lg[t]=kg("C,a","return new C("+Ug(r,",")+")")}return Lg[t](e,i)},Vg=Dg?kg.bind:function(e){var t=Og(this),i=t.prototype,r=Pg(arguments,1),n=function(){var i=Mg(r,Pg(arguments));return this instanceof n?xg(t,i.length,i):t.apply(e,i)};return wg(i)&&(n.prototype=i),n},Fg=Vg;Br({target:"Function",proto:!0,forced:Function.bind!==Fg},{bind:Fg});var Bg=fS;function jg(e,t){var i=e&&e.navigator;if(i.mediaDevices){var r=function(e){if("object"!==us(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(i){if("require"!==i&&"advanced"!==i&&"mediaSource"!==i){var r="object"===us(e[i])?e[i]:{ideal:e[i]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var n=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var o={};"number"==typeof r.ideal?(o[n("min",i)]=r.ideal,t.optional.push(o),(o={})[n("max",i)]=r.ideal,t.optional.push(o)):(o[n("",i)]=r.ideal,t.optional.push(o))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",i)]=r.exact):["min","max"].forEach((function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[n(e,i)]=r[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,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(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)&&(!i.mediaDevices.getSupportedConstraints||!i.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 i.mediaDevices.enumerateDevices().then((function(t){var i=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return s.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!i&&t.length&&s.includes("back")&&(i=t[t.length-1]),i&&(e.video.deviceId=a.exact?{exact:i.deviceId}:{ideal:i.deviceId}),e.video=r(e.video),Bg("chrome: "+JSON.stringify(e)),n(e)}));e.video=r(e.video)}return Bg("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(i.getUserMedia=function(e,t,r){n(e,(function(e){i.webkitGetUserMedia(e,t,(function(e){r&&r(o(e))}))}))}.bind(i),i.mediaDevices.getUserMedia){var a=i.mediaDevices.getUserMedia.bind(i.mediaDevices);i.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 Gg(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Hg(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 i=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(r){var n;n=e.RTCPeerConnection.prototype.getReceivers?i.getReceivers().find((function(e){return e.track&&e.track.id===r.track.id})):{track:r.track};var o=new Event("track");o.track=r.track,o.receiver=n,o.transceiver={receiver:n},o.streams=[t.stream],i.dispatchEvent(o)})),t.stream.getTracks().forEach((function(r){var n;n=e.RTCPeerConnection.prototype.getReceivers?i.getReceivers().find((function(e){return e.track&&e.track.id===r.id})):{track:r};var o=new Event("track");o.track=r,o.receiver=n,o.transceiver={receiver:n},o.streams=[t.stream],i.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 zg(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 i=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var n=i.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};var r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.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 i=this;this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((function(e){i._senders.push(t(i,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 i=t._senders.find((function(t){return t.track===e}));i&&t._senders.splice(t._senders.indexOf(i),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 Kg(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,i=Array.prototype.slice.call(arguments),r=i[0],n=i[1],o=i[2];if(arguments.length>0&&"function"==typeof r)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof r))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var i={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){i[t]=e.stat(t)})),t[i.id]=i})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){n(s(a(e)))};return t.apply(this,[c,r])}return new Promise((function(i,r){t.apply(e,[function(e){i(s(a(e)))},r])})).then(n,o)}}}function Wg(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,i=t.apply(this,[]);return i.forEach((function(t){return t._pc=e})),i});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return ES(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var r=e.RTCPeerConnection.prototype.getReceivers;r&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=r.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 ES(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,i,r,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?r=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(i?r=!0:i=e),e.track===o})),r||t&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return n.apply(this,arguments)}}}}function Yg(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){if(!i)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var r=t.apply(this,arguments);return this._shimmedLocalStreams[i.id]?-1===this._shimmedLocalStreams[i.id].indexOf(r)&&this._shimmedLocalStreams[i.id].push(r):this._shimmedLocalStreams[i.id]=[i,r],r};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var r=this.getSenders();i.apply(this,arguments);var n=this.getSenders().filter((function(e){return-1===r.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(n)};var r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(i){var r=t._shimmedLocalStreams[i].indexOf(e);-1!==r&&t._shimmedLocalStreams[i].splice(r,1),1===t._shimmedLocalStreams[i].length&&delete t._shimmedLocalStreams[i]})),n.apply(this,arguments)}}function Xg(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Yg(e);var i=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=i.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var i=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(i.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,i){var r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[i.id];if(a)a.addTrack(t),Promise.resolve().then((function(){r.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[i.id]=s,this._reverseStreams[s.id]=i,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=ov({},t,(function(){var e=this,t=arguments,r=arguments.length&&"function"==typeof arguments[0];return r?i.apply(this,[function(i){var r=s(e,i);t[0].apply(null,[r])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):i.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=r[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,i=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(r){i._streams[r].getTracks().find((function(t){return e.track===t}))&&(t=i._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(n.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:i})}function c(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(r.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:i})}}function qg(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=ov({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}))}function Jg(e,t){hS(e,"negotiationneeded",(function(e){var i=e.target;if(!(t.version<72||i.getConfiguration&&"plan-b"===i.getConfiguration().sdpSemantics)||"stable"===i.signalingState)return e}))}var Qg=Object.freeze({__proto__:null,shimMediaStream:Gg,shimOnTrack:Hg,shimGetSendersWithDtmf:zg,shimGetStats:Kg,shimSenderReceiverGetStats:Wg,shimAddTrackRemoveTrackWithNative:Yg,shimAddTrackRemoveTrack:Xg,shimPeerConnection:qg,fixNegotiationNeeded:Jg,shimGetUserMedia:jg,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(i){return t(i).then((function(t){var r=i.video&&i.video.width,n=i.video&&i.video.height,o=i.video&&i.video.frameRate;return i.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(i.video.mandatory.maxWidth=r),n&&(i.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(i)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),Zg=r,$g=o,eE=Jo,tE=Iv.trim,iE=T("".charAt),rE=Zg.parseFloat,nE=Zg.Symbol,oE=nE&&nE.iterator,aE=1/rE("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||oE&&!$g((function(){rE(Object(oE))}))?function(e){var t=tE(eE(e)),i=rE(t);return 0===i&&"-"==iE(t,0)?-0:i}:rE;Br({global:!0,forced:parseFloat!=aE},{parseFloat:aE});var sE=Br,cE=Hu,uE=o,dE=K,lE=F,hE=Qd,pE=ah,_E=Ht.exports;if(sE({target:"Promise",proto:!0,real:!0,forced:!!cE&&uE((function(){cE.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=hE(this,dE("Promise")),i=lE(e);return this.then(i?function(i){return pE(t,e()).then((function(){return i}))}:e,i?function(i){return pE(t,e()).then((function(){throw i}))}:e)}}),lE(cE)){var fE=dE("Promise").prototype.finally;cE.prototype.finally!==fE&&_E(cE.prototype,"finally",fE,{unsafe:!0})}function vE(e,t){var i=e&&e.navigator,r=e&&e.MediaStreamTrack;if(i.getUserMedia=function(e,t,r){vS("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){var n=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])},o=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.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)},r&&r.prototype.getSettings){var a=r.prototype.getSettings;r.prototype.getSettings=function(){var e=a.apply(this,arguments);return n(e,"mozAutoGainControl","autoGainControl"),n(e,"mozNoiseSuppression","noiseSuppression"),e}}if(r&&r.prototype.applyConstraints){var s=r.prototype.applyConstraints;r.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 mE(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 SE(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 i=e.RTCPeerConnection.prototype[t],r=ov({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}));var i={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=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 r.apply(this,[n||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=i[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,r){e.set(r,Object.assign({},t,{type:i[t.type]||t.type}))}))}return e})).then(o,a)}}}function yE(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,i=t.apply(this,[]);return i.forEach((function(t){return t._pc=e})),i});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.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 gE(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,i=t.apply(this,[]);return i.forEach((function(t){return t._pc=e})),i}),hS(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function EE(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;vS("removeStream","removeTrack"),this.getSenders().forEach((function(i){i.track&&e.getTracks().includes(i.track)&&t.removeTrack(i)}))})}function bE(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function TE(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],i=e&&"sendEncodings"in e;i&&e.sendEncodings.forEach((function(e){if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var r=t.apply(this,arguments);if(i){var n=r.sender,o=n.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,n.sendEncodings=e.sendEncodings,this.setParametersPromises.push(n.setParameters(o).then((function(){delete n.sendEncodings})).catch((function(){delete n.sendEncodings}))))}return r})}}function IE(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 RE(e){if("object"===us(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,i=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(i,e)})).finally((function(){i.setParametersPromises=[]})):t.apply(this,arguments)}}}function AE(e){if("object"===us(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,i=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(i,e)})).finally((function(){i.setParametersPromises=[]})):t.apply(this,arguments)}}}var CE=Object.freeze({__proto__:null,shimOnTrack:mE,shimPeerConnection:SE,shimSenderGetStats:yE,shimReceiverGetStats:gE,shimRemoveStream:EE,shimRTCDataChannel:bE,shimAddTransceiver:TE,shimGetParameters:IE,shimCreateOffer:RE,shimCreateAnswer:AE,shimGetUserMedia:vE,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(i){if(!i||!i.video){var r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return!0===i.video?i.video={mediaSource:t}:i.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(i)})}});function OE(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 i=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(r){return t.call(i,r,e)})),e.getVideoTracks().forEach((function(r){return t.call(i,r,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var i=this,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n&&n.forEach((function(e){i._localStreams?i._localStreams.includes(e)||i._localStreams.push(e):i._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 i=this._localStreams.indexOf(e);if(-1!==i){this._localStreams.splice(i,1);var r=e.getTracks();this.getSenders().forEach((function(e){r.includes(e.track)&&t.removeTrack(e)}))}})}}function wE(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 i=new Event("addstream");i.stream=e,t.dispatchEvent(i)}}))})}});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 i=new Event("addstream");i.stream=t,e.dispatchEvent(i)}}))}),t.apply(e,arguments)}}}function NE(e){if("object"===us(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,i=t.createOffer,r=t.createAnswer,n=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=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},t.createAnswer=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};var s=function(e,t,i){var r=n.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,i){var r=o.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,i){var r=a.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},t.addIceCandidate=s}}function PE(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var i=t.mediaDevices,r=i.getUserMedia.bind(i);t.mediaDevices.getUserMedia=function(e){return r(DE(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,i,r){t.mediaDevices.getUserMedia(e).then(i,r)}.bind(t))}function DE(e){return e&&void 0!==e.video?Object.assign({},e,{video:yS(e.video)}):e}function kE(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,i){if(e&&e.iceServers){for(var r=[],n=0;n<e.iceServers.length;n++){var o=e.iceServers[n];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(vS("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,r.push(o)):r.push(e.iceServers[n])}e.iceServers=r}return new t(e,i)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function ME(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 UE(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveAudio||i||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var r=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function LE(e){"object"!==us(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var xE=Object.freeze({__proto__:null,shimLocalStreamsAPI:OE,shimRemoteStreamsAPI:wE,shimCallbacksAPI:NE,shimGetUserMedia:PE,shimConstraints:DE,shimRTCIceServerUrls:kE,shimTrackEventTransceiver:ME,shimCreateOfferLegacy:UE,shimAudioContext:LE}),VE=De,FE=at;Br({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=VE(this),i=FE(t,"number");return"number"!=typeof i||isFinite(i)?t.toISOString():null}});var BE=d;Br({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return BE(URL.prototype.toString,this)}});var jE=T(1..valueOf),GE=a,HE=r,zE=T,KE=Dr,WE=Ht.exports,YE=Ue,XE=um,qE=W,JE=de,QE=at,ZE=o,$E=Fi.f,eb=n.f,tb=Rt.f,ib=jE,rb=Iv.trim,nb=HE.Number,ob=nb.prototype,ab=HE.TypeError,sb=zE("".slice),cb=zE("".charCodeAt),ub=function(e){var t=QE(e,"number");return"bigint"==typeof t?t:db(t)},db=function(e){var t,i,r,n,o,a,s,c,u=QE(e,"number");if(JE(u))throw ab("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=rb(u),43===(t=cb(u,0))||45===t){if(88===(i=cb(u,2))||120===i)return NaN}else if(48===t){switch(cb(u,1)){case 66:case 98:r=2,n=49;break;case 79:case 111:r=8,n=55;break;default:return+u}for(a=(o=sb(u,2)).length,s=0;s<a;s++)if((c=cb(o,s))<48||c>n)return NaN;return parseInt(o,r)}return+u};if(KE("Number",!nb(" 0o1")||!nb("0b1")||nb("+0x1"))){for(var lb,hb=function(e){var t=arguments.length<1?0:nb(ub(e)),i=this;return qE(ob,i)&&ZE((function(){ib(i)}))?XE(Object(t),i,hb):t},pb=GE?$E(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(","),_b=0;pb.length>_b;_b++)YE(nb,lb=pb[_b])&&!YE(hb,lb)&&tb(hb,lb,eb(nb,lb));hb.prototype=ob,ob.constructor=hb,WE(HE,"Number",hb)}var fb=Br,vb=k,mb=V,Sb=Un,yb=T([].join),gb=vb!=Object,Eb=Sb("join",",");fb({target:"Array",proto:!0,forced:gb||!Eb},{join:function(e){return yb(mb(this),void 0===e?",":e)}});var bb=Gs,Tb=d,Ib=T,Rb=Ya,Ab=zo,Cb=Pt,Ob=U,wb=Qd,Nb=sv,Pb=qi,Db=Jo,kb=Se,Mb=$s,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,i){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,i){var r=Db(Ob(this)),n=void 0===i?4294967295:i>>>0;if(0===n)return[];if(void 0===e)return[r];if(!Ab(e))return Tb(t,r,e,n);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=Tb(Lb,l,r))&&!((a=l.lastIndex)>d&&(Gb(c,Hb(r,d,o.index)),o.length>1&&o.index<r.length&&bb(Bb,c,Mb(o,1)),s=o[0].length,d=a,c.length>=n));)l.lastIndex===o.index&&l.lastIndex++;return d===r.length?!s&&jb(l,"")||Gb(c,""):Gb(c,Hb(r,d)),c.length>n?Mb(c,0,n):c}:"0".split(void 0,0).length?function(e,i){return void 0===e&&0===i?[]:Tb(t,this,e,i)}:t,[function(t,i){var n=Ob(this),o=null==t?void 0:kb(t,e);return o?Tb(o,t,n,i):Tb(r,Db(n),t,i)},function(e,n){var o=Cb(this),a=Db(e),s=i(r,o,a,n,r!==t);if(s.done)return s.value;var c=wb(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,_=0,f=[];_<a.length;){l.lastIndex=Vb?0:_;var v,m=Ub(l,Vb?Hb(a,_):a);if(null===m||(v=Fb(Pb(l.lastIndex+(Vb?_:0)),a.length))===p)_=Nb(a,_,u);else{if(Gb(f,Hb(a,p,_)),f.length===h)return f;for(var S=1;S<=m.length-1;S++)if(Gb(f,m[S]),f.length===h)return f;_=p=v}}return Gb(f,Hb(a,p)),f}]}),!!xb((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var i="ab".split(e);return 2!==i.length||"a"!==i[0]||"b"!==i[1]})),Vb);var zb=Oi.PROPER,Kb=o,Wb=vv,Yb=Iv.trim;Br({target:"String",proto:!0,forced:function(e){return Kb((function(){return!!Wb[e]()||"​…᠎"!=="​…᠎"[e]()||zb&&Wb[e].name!==e}))}("trim")},{trim:function(){return Yb(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 i=t.splitSections(e);return i&&i[0]},t.getMediaSections=function(e){var i=t.splitSections(e);return i.shift(),i},t.matchPrefix=function(e,i){return t.splitLines(e).filter((function(e){return 0===e.indexOf(i)}))},t.parseCandidate=function(e){for(var t,i={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":i.relatedAddress=t[r+1];break;case"rport":i.relatedPort=parseInt(t[r+1],10);break;case"tcptype":i.tcpType=t[r+1];break;case"ufrag":i.ufrag=t[r+1],i.usernameFragment=t[r+1];break;default:void 0===i[t[r]]&&(i[t[r]]=t[r+1])}return i},t.writeCandidate=function(e){var t=[];t.push(e.foundation);var i=e.component;"rtp"===i?t.push(1):"rtcp"===i?t.push(2):t.push(i),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),i={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),i.name=t[0],i.clockRate=parseInt(t[1],10),i.channels=3===t.length?parseInt(t[2],10):1,i.numChannels=i.channels,i},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var i=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==i?"/"+i:"")+"\r\n"},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,i={},r=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<r.length;n++)i[(t=r[n].trim().split("="))[0].trim()]=t[1];return i},t.writeFmtp=function(e){var t="",i=e.payloadType;if(void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+i+" "+r.join(";")+"\r\n"}return t},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="",i=e.payloadType;return void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+i+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),i={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(i.attribute=e.substr(t+1,r-t-1),i.value=e.substr(r+1)):i.attribute=e.substr(t+1),i},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 i=t.matchPrefix(e,"a=mid:")[0];if(i)return i.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,i){return{role:"auto",fingerprints:t.matchPrefix(e+i,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var i="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){i+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),i},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,i){return t.matchPrefix(e+i,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,i){var r=t.matchPrefix(e+i,"a=ice-ufrag:")[0],n=t.matchPrefix(e+i,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.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 i={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var o=r[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),i.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":i.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){i.headerExtensions.push(t.parseExtmap(e))})),i},t.writeRtpDescription=function(e,i){var r="";r+="m="+e+" ",r+=i.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=i.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",i.codecs.forEach((function(e){r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));var n=0;return i.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(r+="a=maxptime:"+n+"\r\n"),i.headerExtensions&&i.headerExtensions.forEach((function(e){r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){var i,r=[],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&&(i=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&&i&&(t.rtx={ssrc:i}),r.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&c&&r.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,r.forEach((function(e){e.maxBitrate=d}))),r},t.parseRtcpParameters=function(e){var i={},r=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(i.cname=r.value,i.ssrc=r.ssrc);var n=t.matchPrefix(e,"a=rtcp-rsize");i.reducedSize=n.length>0,i.compound=0===n.length;var o=t.matchPrefix(e,"a=rtcp-mux");return i.mux=o.length>0,i},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 i,r=t.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(i=r[0].substr(7).split(" "))[0],track:i[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:(i=n[0].value.split(" "))[0],track:i[1]}:void 0},t.parseSctpDescription=function(e){var i,r=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");n.length>0&&(i=parseInt(n[0].substr(19),10)),isNaN(i)&&(i=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:r.fmt,maxMessageSize:i};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:i}}},t.writeSctpDescription=function(e,t){var i=[];return i="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&i.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),i.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,i,r){var n=void 0!==i?i:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,i){for(var r=t.splitLines(e),n=0;n<r.length;n++)switch(r[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[n].substr(2)}return i?t.getDirection(i):"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 i=t.splitLines(e)[0].substr(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}},t.parseOLine=function(e){var i=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var i=t.splitLines(e),r=0;r<i.length;r++)if(i[r].length<2||"="!==i[r].charAt(1))return!1;return!0},e.exports=t}(Xb);var qb=Xb.exports,Jb=Object.freeze(e({__proto__:null,default:qb},[Xb.exports]));function Qb(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 i=new t(e),r=qb.parseCandidate(e.candidate),n=Object.assign(i,r);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 Zb(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var i=function(e){if(!e||!e.sdp)return!1;var t=qb.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=qb.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},r=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var i=parseInt(t[1],10);return i!=i?-1:i},n=function(e){var i=65536;return"firefox"===t.browser&&(i=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),i},o=function(e,i){var r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);var n=qb.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?r=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==i&&(r=2147483637),r},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(i(arguments[0])){var c,u=r(arguments[0]),d=n(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function $b(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return i(e,this),e},hS(e,"datachannel",(function(e){return i(e.channel,e.target),e}))}function i(e,t){var i=e.send;e.send=function(){var r=arguments[0],n=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return i.apply(e,arguments)}}}function 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 i=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var i=new Event("connectionstatechange",e);t.dispatchEvent(i)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}}))}}function tT(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var r=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return i.apply(this,arguments)}}}function iT(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var i=e.RTCPeerConnection.prototype.addIceCandidate;i&&0!==i.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function rT(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var i=e.RTCPeerConnection.prototype.setLocalDescription;i&&0!==i.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==us(t)||t.type&&t.sdp)return i.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 i.apply(this,[t]);var r="offer"===t.type?this.createOffer:this.createAnswer;return r.apply(this).then((function(t){return i.apply(e,[t])}))})}}var nT=Object.freeze({__proto__:null,shimRTCIceCandidate:Qb,shimMaxMessageSize:Zb,shimSendThrowTypeError:$b,shimConnectionState:eT,removeExtmapAllowMixed:tT,shimAddIceCandidateNullOrEmpty:iT,shimParameterlessSetLocalDescription:rT});!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},r=fS,n=mS(t),o={browserDetails:n,commonShim:nT,extractVersion:lS,disableLog:pS,disableWarnings:_S,sdp:Jb};switch(n.browser){case"chrome":if(!Qg||!qg||!i.shimChrome)return r("Chrome shim is not included in this adapter release."),o;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),o;r("adapter.js shimming chrome."),o.browserShim=Qg,iT(t,n),rT(t),jg(t,n),Gg(t),qg(t,n),Hg(t),Xg(t,n),zg(t),Kg(t),Wg(t),Jg(t,n),Qb(t),eT(t),Zb(t,n),$b(t),tT(t,n);break;case"firefox":if(!CE||!SE||!i.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=CE,iT(t,n),rT(t),vE(t,n),SE(t,n),mE(t),EE(t),yE(t),gE(t),bE(t),TE(t),IE(t),RE(t),AE(t),Qb(t),eT(t),Zb(t,n),$b(t);break;case"safari":if(!xE||!i.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=xE,iT(t,n),rT(t),kE(t),UE(t),NE(t),OE(t),wE(t),ME(t),PE(t),LE(t),Qb(t),Zb(t,n),$b(t),tT(t,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var oT=Br,aT=r,sT=Gs,cT=F,uT=oc,dT=$d,lT=/MSIE .\./.test(Y),hT=aT.Function,pT=function(e){return function(t,i){var r=dT(arguments.length,1)>2,n=cT(t)?t:hT(t),o=r?uT(arguments,2):void 0;return e(r?function(){sT(n,this,o)}:n,i)}};oT({global:!0,bind:!0,forced:lT},{setTimeout:pT(aT.setTimeout),setInterval:pT(aT.setInterval)}),Br({target:"Array",stat:!0},{isArray:Wr});var _T=$s,fT=Math.floor,vT=function(e,t){var i=e.length,r=fT(i/2);return i<8?mT(e,t):ST(e,vT(_T(e,0,r),t),vT(_T(e,r),t),t)},mT=function(e,t){for(var i,r,n=e.length,o=1;o<n;){for(r=o,i=e[o];r&&t(e[r-1],i)>0;)e[r]=e[--r];r!==o++&&(e[r]=i)}return e},ST=function(e,t,i,r){for(var n=t.length,o=i.length,a=0,s=0;a<n||s<o;)e[a+s]=a<n&&s<o?r(t[a],i[s])<=0?t[a++]:i[s++]:a<n?t[a++]:i[s++];return e},yT=vT,gT=Y.match(/firefox\/(\d+)/i),ET=!!gT&&+gT[1],bT=/MSIE|Trident/.test(Y),TT=Y.match(/AppleWebKit\/(\d+)\./),IT=!!TT&&+TT[1],RT=Br,AT=T,CT=ve,OT=De,wT=Qi,NT=Jo,PT=o,DT=yT,kT=Un,MT=ET,UT=bT,LT=ee,xT=IT,VT=[],FT=AT(VT.sort),BT=AT(VT.push),jT=PT((function(){VT.sort(void 0)})),GT=PT((function(){VT.sort(null)})),HT=kT("sort"),zT=!PT((function(){if(LT)return LT<70;if(!(MT&&MT>3)){if(UT)return!0;if(xT)return xT<603;var e,t,i,r,n="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(r=0;r<47;r++)VT.push({k:t+r,v:i})}for(VT.sort((function(e,t){return t.v-e.v})),r=0;r<VT.length;r++)t=VT[r].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));RT({target:"Array",proto:!0,forced:jT||!GT||!HT||!zT},{sort:function(e){void 0!==e&&CT(e);var t=OT(this);if(zT)return void 0===e?FT(t):FT(t,e);var i,r,n=[],o=wT(t);for(r=0;r<o;r++)r in t&&BT(n,t[r]);for(DT(n,function(e){return function(t,i){return void 0===i?-1:void 0===t?1:void 0!==e?+e(t,i)||0:NT(t)>NT(i)?1:-1}}(e)),i=n.length,r=0;r<i;)t[r]=n[r++];for(;r<o;)delete t[r++];return t}});var KT="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,WT=Gi,YT=qi,XT=r.RangeError,qT=function(e){if(void 0===e)return 0;var t=WT(e),i=YT(t);if(t!==i)throw XT("Wrong length or index");return i},JT=r.Array,QT=Math.abs,ZT=Math.pow,$T=Math.floor,eI=Math.log,tI=Math.LN2,iI={pack:function(e,t,i){var r,n,o,a=JT(i),s=8*i-t-1,c=(1<<s)-1,u=c>>1,d=23===t?ZT(2,-24)-ZT(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=QT(e))!=e||e===1/0?(n=e!=e?1:0,r=c):(r=$T(eI(e)/tI),e*(o=ZT(2,-r))<1&&(r--,o*=2),(e+=r+u>=1?d/o:d*ZT(2,1-u))*o>=2&&(r++,o/=2),r+u>=c?(n=0,r=c):r+u>=1?(n=(e*o-1)*ZT(2,t),r+=u):(n=e*ZT(2,u-1)*ZT(2,t),r=0));t>=8;)a[h++]=255&n,n/=256,t-=8;for(r=r<<t|n,s+=t;s>0;)a[h++]=255&r,r/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var i,r=e.length,n=8*r-t-1,o=(1<<n)-1,a=o>>1,s=n-7,c=r-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(i=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)i=256*i+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return i?NaN:u?-1/0:1/0;i+=ZT(2,t),d-=a}return(u?-1:1)*i*ZT(2,d-t)}},rI=De,nI=Wi,oI=Qi,aI=function(e){for(var t=rI(this),i=oI(t),r=arguments.length,n=nI(r>1?arguments[1]:void 0,i),o=r>2?arguments[2]:void 0,a=void 0===o?i:nI(o,i);a>n;)t[n++]=e;return t},sI=r,cI=T,uI=a,dI=KT,lI=Oi,hI=Gt,pI=Ku,_I=o,fI=$u,vI=Gi,mI=qi,SI=qT,yI=iI,gI=Qp,EI=ms,bI=Fi.f,TI=Rt.f,II=aI,RI=$s,AI=vc,CI=lI.PROPER,OI=lI.CONFIGURABLE,wI=bi.get,NI=bi.set,PI=sI.ArrayBuffer,DI=PI,kI=DI&&DI.prototype,MI=sI.DataView,UI=MI&&MI.prototype,LI=Object.prototype,xI=sI.Array,VI=sI.RangeError,FI=cI(II),BI=cI([].reverse),jI=yI.pack,GI=yI.unpack,HI=function(e){return[255&e]},zI=function(e){return[255&e,e>>8&255]},KI=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},WI=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},YI=function(e){return jI(e,23,4)},XI=function(e){return jI(e,52,8)},qI=function(e,t){TI(e.prototype,t,{get:function(){return wI(this)[t]}})},JI=function(e,t,i,r){var n=SI(i),o=wI(e);if(n+t>o.byteLength)throw VI("Wrong index");var a=wI(o.buffer).bytes,s=n+o.byteOffset,c=RI(a,s,s+t);return r?c:BI(c)},QI=function(e,t,i,r,n,o){var a=SI(i),s=wI(e);if(a+t>s.byteLength)throw VI("Wrong index");for(var c=wI(s.buffer).bytes,u=a+s.byteOffset,d=r(+n),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(dI){var ZI=CI&&"ArrayBuffer"!==PI.name;if(_I((function(){PI(1)}))&&_I((function(){new PI(-1)}))&&!_I((function(){return new PI,new PI(1.5),new PI(NaN),ZI&&!OI})))ZI&&OI&&hI(PI,"name","ArrayBuffer");else{(DI=function(e){return fI(this,kI),new PI(SI(e))}).prototype=kI;for(var $I,eR=bI(PI),tR=0;eR.length>tR;)($I=eR[tR++])in DI||hI(DI,$I,PI[$I]);kI.constructor=DI}EI&&gI(UI)!==LI&&EI(UI,LI);var iR=new MI(new DI(2)),rR=cI(UI.setInt8);iR.setInt8(0,2147483648),iR.setInt8(1,2147483649),!iR.getInt8(0)&&iR.getInt8(1)||pI(UI,{setInt8:function(e,t){rR(this,e,t<<24>>24)},setUint8:function(e,t){rR(this,e,t<<24>>24)}},{unsafe:!0})}else kI=(DI=function(e){fI(this,kI);var t=SI(e);NI(this,{bytes:FI(xI(t),0),byteLength:t}),uI||(this.byteLength=t)}).prototype,UI=(MI=function(e,t,i){fI(this,UI),fI(e,kI);var r=wI(e).byteLength,n=vI(t);if(n<0||n>r)throw VI("Wrong offset");if(n+(i=void 0===i?r-n:mI(i))>r)throw VI("Wrong length");NI(this,{buffer:e,byteLength:i,byteOffset:n}),uI||(this.buffer=e,this.byteLength=i,this.byteOffset=n)}).prototype,uI&&(qI(DI,"byteLength"),qI(MI,"buffer"),qI(MI,"byteLength"),qI(MI,"byteOffset")),pI(UI,{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 WI(JI(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return WI(JI(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return GI(JI(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return GI(JI(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){QI(this,1,e,HI,t)},setUint8:function(e,t){QI(this,1,e,HI,t)},setInt16:function(e,t){QI(this,2,e,zI,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){QI(this,2,e,zI,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){QI(this,4,e,KI,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){QI(this,4,e,KI,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){QI(this,4,e,YI,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){QI(this,8,e,XI,t,arguments.length>2?arguments[2]:void 0)}});AI(DI,"ArrayBuffer"),AI(MI,"DataView");var nR={ArrayBuffer:DI,DataView:MI},oR=Br,aR=T,sR=o,cR=Pt,uR=Wi,dR=qi,lR=Qd,hR=nR.ArrayBuffer,pR=nR.DataView,_R=pR.prototype,fR=aR(hR.prototype.slice),vR=aR(_R.getUint8),mR=aR(_R.setUint8);oR({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:sR((function(){return!new hR(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(fR&&void 0===t)return fR(cR(this),e);for(var i=cR(this).byteLength,r=uR(e,i),n=uR(void 0===t?i:t,i),o=new(lR(this,hR))(dR(n-r)),a=new pR(this),s=new pR(o),c=0;r<n;)mR(s,c++,vR(a,r++));return o}});var SR,yR,gR,ER={exports:{}},bR=KT,TR=a,IR=r,RR=F,AR=j,CR=Ue,OR=rn,wR=he,NR=Gt,PR=Ht.exports,DR=Rt.f,kR=W,MR=Qp,UR=ms,LR=Qe,xR=Be,VR=IR.Int8Array,FR=VR&&VR.prototype,BR=IR.Uint8ClampedArray,jR=BR&&BR.prototype,GR=VR&&MR(VR),HR=FR&&MR(FR),zR=Object.prototype,KR=IR.TypeError,WR=LR("toStringTag"),YR=xR("TYPED_ARRAY_TAG"),XR=xR("TYPED_ARRAY_CONSTRUCTOR"),qR=bR&&!!UR&&"Opera"!==OR(IR.opera),JR=!1,QR={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ZR={BigInt64Array:8,BigUint64Array:8},$R=function(e){if(!AR(e))return!1;var t=OR(e);return CR(QR,t)||CR(ZR,t)};for(SR in QR)(gR=(yR=IR[SR])&&yR.prototype)?NR(gR,XR,yR):qR=!1;for(SR in ZR)(gR=(yR=IR[SR])&&yR.prototype)&&NR(gR,XR,yR);if((!qR||!RR(GR)||GR===Function.prototype)&&(GR=function(){throw KR("Incorrect invocation")},qR))for(SR in QR)IR[SR]&&UR(IR[SR],GR);if((!qR||!HR||HR===zR)&&(HR=GR.prototype,qR))for(SR in QR)IR[SR]&&UR(IR[SR].prototype,HR);if(qR&&MR(jR)!==HR&&UR(jR,HR),TR&&!CR(HR,WR))for(SR in JR=!0,DR(HR,WR,{get:function(){return AR(this)?this[YR]:void 0}}),QR)IR[SR]&&NR(IR[SR],YR,SR);var eA={NATIVE_ARRAY_BUFFER_VIEWS:qR,TYPED_ARRAY_CONSTRUCTOR:XR,TYPED_ARRAY_TAG:JR&&YR,aTypedArray:function(e){if($R(e))return e;throw KR("Target is not a typed array")},aTypedArrayConstructor:function(e){if(RR(e)&&(!UR||kR(GR,e)))return e;throw KR(wR(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,r){if(TR){if(i)for(var n in QR){var o=IR[n];if(o&&CR(o.prototype,e))try{delete o.prototype[e]}catch(i){try{o.prototype[e]=t}catch(e){}}}HR[e]&&!i||PR(HR,e,i?t:qR&&FR[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,i){var r,n;if(TR){if(UR){if(i)for(r in QR)if((n=IR[r])&&CR(n,e))try{delete n[e]}catch(e){}if(GR[e]&&!i)return;try{return PR(GR,e,i?t:qR&&GR[e]||t)}catch(e){}}for(r in QR)!(n=IR[r])||n[e]&&!i||PR(n,e,t)}},isView:function(e){if(!AR(e))return!1;var t=OR(e);return"DataView"===t||CR(QR,t)||CR(ZR,t)},isTypedArray:$R,TypedArray:GR,TypedArrayPrototype:HR},tA=r,iA=o,rA=Hd,nA=eA.NATIVE_ARRAY_BUFFER_VIEWS,oA=tA.ArrayBuffer,aA=tA.Int8Array,sA=!nA||!iA((function(){aA(1)}))||!iA((function(){new aA(-1)}))||!rA((function(e){new aA,new aA(null),new aA(1.5),new aA(e)}),!0)||iA((function(){return 1!==new aA(new oA(2),1,void 0).length})),cA=j,uA=Math.floor,dA=Number.isInteger||function(e){return!cA(e)&&isFinite(e)&&uA(e)===e},lA=Gi,hA=r.RangeError,pA=function(e){var t=lA(e);if(t<0)throw hA("The argument can't be less than 0");return t},_A=r.RangeError,fA=function(e,t){var i=pA(e);if(i%t)throw _A("Wrong offset");return i},vA=zr,mA=d,SA=Yd,yA=De,gA=Qi,EA=vd,bA=ud,TA=nd,IA=eA.aTypedArrayConstructor,RA=Br,AA=r,CA=d,OA=a,wA=sA,NA=eA,PA=nR,DA=$u,kA=m,MA=Gt,UA=dA,LA=qi,xA=qT,VA=fA,FA=ut,BA=Ue,jA=rn,GA=j,HA=de,zA=ko,KA=W,WA=ms,YA=Fi.f,XA=function(e){var t,i,r,n,o,a,s=SA(this),c=yA(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=bA(c);if(h&&!TA(h))for(a=(o=EA(c,h)).next,c=[];!(n=mA(a,o)).done;)c.push(n.value);for(l&&u>2&&(d=vA(d,arguments[2])),i=gA(c),r=new(IA(s))(i),t=0;i>t;t++)r[t]=l?d(c[t],t):c[t];return r},qA=kn.forEach,JA=Ju,QA=Rt,ZA=n,$A=um,eC=bi.get,tC=bi.set,iC=QA.f,rC=ZA.f,nC=Math.round,oC=AA.RangeError,aC=PA.ArrayBuffer,sC=aC.prototype,cC=PA.DataView,uC=NA.NATIVE_ARRAY_BUFFER_VIEWS,dC=NA.TYPED_ARRAY_CONSTRUCTOR,lC=NA.TYPED_ARRAY_TAG,hC=NA.TypedArray,pC=NA.TypedArrayPrototype,_C=NA.aTypedArrayConstructor,fC=NA.isTypedArray,vC=function(e,t){_C(e);for(var i=0,r=t.length,n=new e(r);r>i;)n[i]=t[i++];return n},mC=function(e,t){iC(e,t,{get:function(){return eC(this)[t]}})},SC=function(e){var t;return KA(sC,e)||"ArrayBuffer"==(t=jA(e))||"SharedArrayBuffer"==t},yC=function(e,t){return fC(e)&&!HA(t)&&t in e&&UA(+t)&&t>=0},gC=function(e,t){return t=FA(t),yC(e,t)?kA(2,e[t]):rC(e,t)},EC=function(e,t,i){return t=FA(t),!(yC(e,t)&&GA(i)&&BA(i,"value"))||BA(i,"get")||BA(i,"set")||i.configurable||BA(i,"writable")&&!i.writable||BA(i,"enumerable")&&!i.enumerable?iC(e,t,i):(e[t]=i.value,e)};OA?(uC||(ZA.f=gC,QA.f=EC,mC(pC,"buffer"),mC(pC,"byteOffset"),mC(pC,"byteLength"),mC(pC,"length")),RA({target:"Object",stat:!0,forced:!uC},{getOwnPropertyDescriptor:gC,defineProperty:EC}),ER.exports=function(e,t,i){var r=e.match(/\d+$/)[0]/8,n=e+(i?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=AA[n],c=s,u=c&&c.prototype,d={},l=function(e,t){iC(e,t,{get:function(){return function(e,t){var i=eC(e);return i.view[o](t*r+i.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=eC(e);i&&(n=(n=nC(n))<0?0:n>255?255:255&n),o.view[a](t*r+o.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};uC?wA&&(c=t((function(e,t,i,n){return DA(e,u),$A(GA(t)?SC(t)?void 0!==n?new s(t,VA(i,r),n):void 0!==i?new s(t,VA(i,r)):new s(t):fC(t)?vC(c,t):CA(XA,c,t):new s(xA(t)),e,c)})),WA&&WA(c,hC),qA(YA(s),(function(e){e in c||MA(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,i,n){DA(e,u);var o,a,s,d=0,h=0;if(GA(t)){if(!SC(t))return fC(t)?vC(c,t):CA(XA,c,t);o=t,h=VA(i,r);var p=t.byteLength;if(void 0===n){if(p%r)throw oC("Wrong length");if((a=p-h)<0)throw oC("Wrong length")}else if((a=LA(n)*r)+h>p)throw oC("Wrong length");s=a/r}else s=xA(t),o=new aC(a=s*r);for(tC(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new cC(o)});d<s;)l(e,d++)})),WA&&WA(c,hC),u=c.prototype=zA(pC)),u.constructor!==c&&MA(u,"constructor",c),MA(u,dC,c),lC&&MA(u,lC,n),d[n]=c,RA({global:!0,forced:c!=s,sham:!uC},d),"BYTES_PER_ELEMENT"in c||MA(c,"BYTES_PER_ELEMENT",r),"BYTES_PER_ELEMENT"in u||MA(u,"BYTES_PER_ELEMENT",r),JA(n)}):ER.exports=function(){},(0,ER.exports)("Uint8",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var bC=De,TC=Wi,IC=Qi,RC=Math.min,AC=[].copyWithin||function(e,t){var i=bC(this),r=IC(i),n=TC(e,r),o=TC(t,r),a=arguments.length>2?arguments[2]:void 0,s=RC((void 0===a?r:TC(a,r))-o,r-n),c=1;for(o<n&&n<o+s&&(c=-1,o+=s-1,n+=s-1);s-- >0;)o in i?i[n]=i[o]:delete i[n],n+=c,o+=c;return i},CC=eA,OC=T(AC),wC=CC.aTypedArray;(0,CC.exportTypedArrayMethod)("copyWithin",(function(e,t){return OC(wC(this),e,t,arguments.length>2?arguments[2]:void 0)}));var NC=kn.every,PC=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("every",(function(e){return NC(PC(this),e,arguments.length>1?arguments[1]:void 0)}));var DC=d,kC=aI,MC=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return DC(kC,MC(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var UC=Qi,LC=Qd,xC=eA.TYPED_ARRAY_CONSTRUCTOR,VC=eA.aTypedArrayConstructor,FC=function(e){return VC(LC(e,e[xC]))},BC=function(e,t){for(var i=0,r=UC(t),n=new e(r);r>i;)n[i]=t[i++];return n},jC=FC,GC=kn.filter,HC=function(e,t){return BC(jC(e),t)},zC=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("filter",(function(e){var t=GC(zC(this),e,arguments.length>1?arguments[1]:void 0);return HC(this,t)}));var KC=kn.find,WC=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("find",(function(e){return KC(WC(this),e,arguments.length>1?arguments[1]:void 0)}));var YC=kn.findIndex,XC=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("findIndex",(function(e){return YC(XC(this),e,arguments.length>1?arguments[1]:void 0)}));var qC=kn.forEach,JC=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("forEach",(function(e){qC(JC(this),e,arguments.length>1?arguments[1]:void 0)}));var QC=ir.includes,ZC=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("includes",(function(e){return QC(ZC(this),e,arguments.length>1?arguments[1]:void 0)}));var $C=ir.indexOf,eO=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("indexOf",(function(e){return $C(eO(this),e,arguments.length>1?arguments[1]:void 0)}));var tO=r,iO=o,rO=T,nO=eA,oO=B_,aO=Qe("iterator"),sO=tO.Uint8Array,cO=rO(oO.values),uO=rO(oO.keys),dO=rO(oO.entries),lO=nO.aTypedArray,hO=nO.exportTypedArrayMethod,pO=sO&&sO.prototype,_O=!iO((function(){pO[aO].call([1])})),fO=!!pO&&pO.values&&pO[aO]===pO.values&&"values"===pO.values.name,vO=function(){return cO(lO(this))};hO("entries",(function(){return dO(lO(this))}),_O),hO("keys",(function(){return uO(lO(this))}),_O),hO("values",vO,_O||!fO,{name:"values"}),hO(aO,vO,_O||!fO,{name:"values"});var mO=eA.aTypedArray,SO=eA.exportTypedArrayMethod,yO=T([].join);SO("join",(function(e){return yO(mO(this),e)}));var gO=Gs,EO=V,bO=Gi,TO=Qi,IO=Un,RO=Math.min,AO=[].lastIndexOf,CO=!!AO&&1/[1].lastIndexOf(1,-0)<0,OO=IO("lastIndexOf"),wO=CO||!OO?function(e){if(CO)return gO(AO,this,arguments)||0;var t=EO(this),i=TO(t),r=i-1;for(arguments.length>1&&(r=RO(r,bO(arguments[1]))),r<0&&(r=i+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:AO,NO=Gs,PO=wO,DO=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return NO(PO,DO(this),t>1?[e,arguments[1]]:[e])}));var kO=kn.map,MO=FC,UO=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("map",(function(e){return kO(UO(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(MO(e))(t)}))}));var LO=Wm.left,xO=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return LO(xO(this),e,t,t>1?arguments[1]:void 0)}));var VO=Wm.right,FO=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return VO(FO(this),e,t,t>1?arguments[1]:void 0)}));var BO=eA.aTypedArray,jO=eA.exportTypedArrayMethod,GO=Math.floor;jO("reverse",(function(){for(var e,t=this,i=BO(t).length,r=GO(i/2),n=0;n<r;)e=t[n],t[n++]=t[--i],t[i]=e;return t}));var HO=r,zO=d,KO=eA,WO=Qi,YO=fA,XO=De,qO=o,JO=HO.RangeError,QO=HO.Int8Array,ZO=QO&&QO.prototype,$O=ZO&&ZO.set,ew=KO.aTypedArray,tw=KO.exportTypedArrayMethod,iw=!qO((function(){var e=new Uint8ClampedArray(2);return zO($O,e,{length:1,0:3},1),3!==e[1]})),rw=iw&&KO.NATIVE_ARRAY_BUFFER_VIEWS&&qO((function(){var e=new QO(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));tw("set",(function(e){ew(this);var t=YO(arguments.length>1?arguments[1]:void 0,1),i=XO(e);if(iw)return zO($O,this,i,t);var r=this.length,n=WO(i),o=0;if(n+t>r)throw JO("Wrong length");for(;o<n;)this[t+o]=i[o++]}),!iw||rw);var nw=FC,ow=oc,aw=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("slice",(function(e,t){for(var i=ow(aw(this),e,t),r=nw(this),n=0,o=i.length,a=new r(o);o>n;)a[n]=i[n++];return a}),o((function(){new Int8Array(1).slice()})));var sw=kn.some,cw=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("some",(function(e){return sw(cw(this),e,arguments.length>1?arguments[1]:void 0)}));var uw=r,dw=T,lw=o,hw=ve,pw=yT,_w=eA,fw=ET,vw=bT,mw=ee,Sw=IT,yw=uw.Array,gw=_w.aTypedArray,Ew=_w.exportTypedArrayMethod,bw=uw.Uint16Array,Tw=bw&&dw(bw.prototype.sort),Iw=!(!Tw||lw((function(){Tw(new bw(2),null)}))&&lw((function(){Tw(new bw(2),{})}))),Rw=!!Tw&&!lw((function(){if(mw)return mw<74;if(fw)return fw<67;if(vw)return!0;if(Sw)return Sw<602;var e,t,i=new bw(516),r=yw(516);for(e=0;e<516;e++)t=e%4,i[e]=515-e,r[e]=e-2*t+3;for(Tw(i,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(i[e]!==r[e])return!0}));Ew("sort",(function(e){return void 0!==e&&hw(e),Rw?Tw(this,e):pw(gw(this),function(e){return function(t,i){return void 0!==e?+e(t,i)||0:i!=i?-1:t!=t?1:0===t&&0===i?1/t>0&&1/i<0?1:-1:t>i}}(e))}),!Rw||Iw);var Aw=qi,Cw=Wi,Ow=FC,ww=eA.aTypedArray;(0,eA.exportTypedArrayMethod)("subarray",(function(e,t){var i=ww(this),r=i.length,n=Cw(e,r);return new(Ow(i))(i.buffer,i.byteOffset+n*i.BYTES_PER_ELEMENT,Aw((void 0===t?r:Cw(t,r))-n))}));var Nw=Gs,Pw=eA,Dw=o,kw=oc,Mw=r.Int8Array,Uw=Pw.aTypedArray,Lw=Pw.exportTypedArrayMethod,xw=[].toLocaleString,Vw=!!Mw&&Dw((function(){xw.call(new Mw(1))}));Lw("toLocaleString",(function(){return Nw(xw,Vw?kw(Uw(this)):Uw(this),kw(arguments))}),Dw((function(){return[1,2].toLocaleString()!=new Mw([1,2]).toLocaleString()}))||!Dw((function(){Mw.prototype.toLocaleString.call([1,2])})));var Fw=eA.exportTypedArrayMethod,Bw=o,jw=T,Gw=r.Uint8Array,Hw=Gw&&Gw.prototype||{},zw=[].toString,Kw=jw([].join);Bw((function(){zw.call({})}))&&(zw=function(){return Kw(this)});var Ww=Hw.toString!=zw;Fw("toString",zw,Ww);var Yw=Br,Xw=kn.findIndex,qw=Vo,Jw=!0;"findIndex"in[]&&Array(1).findIndex((function(){Jw=!1})),Yw({target:"Array",proto:!0,forced:Jw},{findIndex:function(e){return Xw(this,e,arguments.length>1?arguments[1]:void 0)}}),qw("findIndex");var Qw,Zw,$w=Ju,eN=nR.ArrayBuffer;Br({global:!0,forced:r.ArrayBuffer!==eN},{ArrayBuffer:eN}),$w("ArrayBuffer"),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVOKED_BEFORE_JOIN_ROOM="INVOKED_BEFORE_JOIN_ROOM",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_EXCEED_MAX_LENGTH="USER_MESSAGE_EXCEED_MAX_LENGTH",e.USER_MESSAGE_EMPTY_USER="USER_MESSAGE_EMPTY_USER",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN",e.RECONNECT_FAILED="RECONNECT_FAILED"}(Qw||(Qw={})),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"}(Zw||(Zw={}));var tN=function(e,t,i){this.code=e,this.message=t,this.error=i},iN=a,rN=T,nN=po,oN=V,aN=rN(l.f),sN=rN([].push),cN=function(e){return function(t){for(var i,r=oN(t),n=nN(r),o=n.length,a=0,s=[];o>a;)i=n[a++],iN&&!aN(r,i)||sN(s,e?[i,r[i]]:r[i]);return s}},uN={entries:cN(!0),values:cN(!1)}.entries;Br({target:"Object",stat:!0},{entries:function(e){return uN(e)}});var dN=Gi,lN=Jo,hN=U,pN=r.RangeError,_N=function(e){var t=lN(hN(this)),i="",r=dN(e);if(r<0||r==1/0)throw pN("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(i+=t);return i},fN=T,vN=qi,mN=Jo,SN=U,yN=fN(_N),gN=fN("".slice),EN=Math.ceil,bN=function(e){return function(t,i,r){var n,o,a=mN(SN(t)),s=vN(i),c=a.length,u=void 0===r?" ":mN(r);return s<=c||""==u?a:((o=yN(u,EN((n=s-c)/u.length))).length>n&&(o=gN(o,0,n)),e?a+o:o+a)}},TN={start:bN(!1),end:bN(!0)},IN=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Y),RN=TN.end;Br({target:"String",proto:!0,forced:IN},{padEnd:function(e){return RN(this,e,arguments.length>1?arguments[1]:void 0)}});var AN=Uv;Br({target:"Number",stat:!0,forced:Number.parseInt!=AN},{parseInt:AN});Br({target:"ArrayBuffer",stat:!0,forced:!eA.NATIVE_ARRAY_BUFFER_VIEWS},{isView:eA.isView}),Br({global:!0,forced:!KT},{DataView:nR.DataView});var CN=Pt,ON=gd,wN=zr,NN=d,PN=De,DN=function(e,t,i,r){try{return r?t(CN(i)[0],i[1]):t(i)}catch(t){ON(e,"throw",t)}},kN=nd,MN=mn,UN=Qi,LN=Ys,xN=vd,VN=ud,FN=r.Array,BN=function(e){var t=PN(e),i=MN(this),r=arguments.length,n=r>1?arguments[1]:void 0,o=void 0!==n;o&&(n=wN(n,r>2?arguments[2]:void 0));var a,s,c,u,d,l,h=VN(t),p=0;if(!h||this==FN&&kN(h))for(a=UN(t),s=i?new this(a):FN(a);a>p;p++)l=o?n(t[p],p):t[p],LN(s,p,l);else for(d=(u=xN(t,h)).next,s=i?new this:[];!(c=NN(d,u)).done;p++)l=o?DN(u,n,[c.value,p],!0):c.value,LN(s,p,l);return s.length=p,s},jN=BN;Br({target:"Array",stat:!0,forced:!Hd((function(e){Array.from(e)}))},{from:jN});var GN=Br,HN=Wr,zN=T([].reverse),KN=[1,2];GN({target:"Array",proto:!0,forced:String(KN)===String(KN.reverse())},{reverse:function(){return HN(this)&&(this.length=this.length),zN(this)}});var WN=Br,YN=r,XN=T,qN=Gi,JN=jE,QN=_N,ZN=o,$N=YN.RangeError,eP=YN.String,tP=Math.floor,iP=XN(QN),rP=XN("".slice),nP=XN(1..toFixed),oP=function(e,t,i){return 0===t?i:t%2==1?oP(e,t-1,i*e):oP(e*e,t/2,i)},aP=function(e,t,i){for(var r=-1,n=i;++r<6;)n+=t*e[r],e[r]=n%1e7,n=tP(n/1e7)},sP=function(e,t){for(var i=6,r=0;--i>=0;)r+=e[i],e[i]=tP(r/t),r=r%t*1e7},cP=function(e){for(var t=6,i="";--t>=0;)if(""!==i||0===t||0!==e[t]){var r=eP(e[t]);i=""===i?r:i+iP("0",7-r.length)+r}return i};WN({target:"Number",proto:!0,forced:ZN((function(){return"0.000"!==nP(8e-5,3)||"1"!==nP(.9,0)||"1.25"!==nP(1.255,2)||"1000000000000000128"!==nP(0xde0b6b3a7640080,0)}))||!ZN((function(){nP({})}))},{toFixed:function(e){var t,i,r,n,o=JN(this),a=qN(e),s=[0,0,0,0,0,0],c="",u="0";if(a<0||a>20)throw $N("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return eP(o);if(o<0&&(c="-",o=-o),o>1e-21)if(i=(t=function(e){for(var t=0,i=e;i>=4096;)t+=12,i/=4096;for(;i>=2;)t+=1,i/=2;return t}(o*oP(2,69,1))-69)<0?o*oP(2,-t,1):o/oP(2,t,1),i*=4503599627370496,(t=52-t)>0){for(aP(s,0,i),r=a;r>=7;)aP(s,1e7,0),r-=7;for(aP(s,oP(10,r,1),0),r=t-1;r>=23;)sP(s,1<<23),r-=23;sP(s,1<<r),aP(s,1,1),sP(s,2),u=cP(s)}else aP(s,0,i),aP(s,1<<-t,0),u=cP(s)+iP("0",a);return u=a>0?c+((n=u.length)<=a?"0."+iP("0",a-n)+u:rP(u,0,n-a)+"."+rP(u,n-a)):c+u}});var uP=Math.log,dP=Math.LOG10E;Br({target:"Math",stat:!0},{log10:Math.log10||function(e){return uP(e)*dP}});var lP,hP,pP,_P,fP,vP,mP,SP,yP,gP,EP,bP,TP,IP,RP,AP,CP,OP,wP,NP,PP,DP,kP,MP,UP,LP,xP=Br,VP=T,FP=n.f,BP=qi,jP=Jo,GP=Yo,HP=U,zP=Zo,KP=VP("".startsWith),WP=VP("".slice),YP=Math.min,XP=zP("startsWith"),qP=!XP&&!!function(){var e=FP(String.prototype,"startsWith");return e&&!e.writable}();xP({target:"String",proto:!0,forced:!qP&&!XP},{startsWith:function(e){var t=jP(HP(this));GP(e);var i=BP(YP(arguments.length>1?arguments[1]:void 0,t.length)),r=jP(e);return KP?KP(t,r,i):WP(t,i,i+r.length)===r}}),function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(lP||(lP={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(hP||(hP={})),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"}(pP||(pP={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(_P||(_P={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(fP||(fP={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}(vP||(vP={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(mP||(mP={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(SP||(SP={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(yP||(yP={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(gP||(gP={})),function(e){e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO"}(EP||(EP={})),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"}(bP||(bP={})),function(e){e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED",e[e.CONNECTION_STATE_LOST=6]="CONNECTION_STATE_LOST"}(TP||(TP={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(IP||(IP={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(RP||(RP={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(AP||(AP={})),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"}(CP||(CP={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(OP||(OP={})),function(e){e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY"}(wP||(wP={})),function(e){e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH"}(NP||(NP={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(PP||(PP={})),function(e){e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth"}(DP||(DP={})),function(e){e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom"}(kP||(kP={})),function(e){e[e.default=0]="default",e[e.fluent=1]="fluent",e[e.standard=2]="standard",e[e.hd=3]="hd",e[e.standardStereo=4]="standardStereo",e[e.hdMono=5]="hdMono"}(MP||(MP={})),function(e){e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY"}(UP||(UP={}));var JP=new Uint8Array(16);function QP(){if(!LP&&!(LP="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 LP(JP)}var ZP=/^(?:[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 $P(e){return"string"==typeof e&&ZP.test(e)}for(var eD=[],tD=0;tD<256;++tD)eD.push((tD+256).toString(16).substr(1));function iD(e,t,i){var r=(e=e||{}).random||(e.rng||QP)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){i=i||0;for(var n=0;n<16;++n)t[i+n]=r[n];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(eD[e[t+0]]+eD[e[t+1]]+eD[e[t+2]]+eD[e[t+3]]+"-"+eD[e[t+4]]+eD[e[t+5]]+"-"+eD[e[t+6]]+eD[e[t+7]]+"-"+eD[e[t+8]]+eD[e[t+9]]+"-"+eD[e[t+10]]+eD[e[t+11]]+eD[e[t+12]]+eD[e[t+13]]+eD[e[t+14]]+eD[e[t+15]]).toLowerCase();if(!$P(i))throw TypeError("Stringified UUID is invalid");return i}(r)}var rD=new TextDecoder,nD=new TextEncoder,oD=function(){return iD()},aD=function(){return Date.now()};function sD(e){for(var t,i,r,n,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=iv(o),u=c.next();!u.done;u=c.next()){s+=(_=u.value).length}}catch(e){t={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(t)throw t.error}}var d=new e(s),l=0;try{for(var h=iv(o),p=h.next();!p.done;p=h.next()){var _=p.value;d.set(_,l),l+=_.length}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}return d}var cD=function(){return"undefined"==typeof window},uD=function(){function e(){}return e.token2auth=function(t,i,r,n){return n?"Bearer ".concat(n):"Basic ".concat(e.createUnsafeToken(t,i,r))},e.createUnsafeToken=function(e,t,i){return window.btoa([e,t,i].filter((function(e){return null!==e})).join(":"))},e.merge=function(t,i){var r,n;void 0===t&&(t={}),void 0===i&&(i={});try{for(var o=iv(Object.entries(t)),a=o.next();!a.done;a=o.next()){var s=rv(a.value,2),c=s[0],u=s[1];null!==u&&"object"===us(u)?e.merge(t[c],i[c]):void 0!==i[c]&&(t[c]=i[c])}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.ab2str=function(e){return rD.decode(e)},e.ab2obj=function(t){try{var i=e.ab2str(t);return JSON.parse(i)}catch(e){return{}}},e.str2ab=function(e){return nD.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 i=new FileReader;i.onload=function(){return t(i.result)},i.readAsDataURL(new Blob([e]))}))];case 1:return[2,t.sent().split(",",2)[1]]}}))}))},e.b64str2ab=function(e){return 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 dD(){var e="none";return cD()||(null!==window.navigator.userAgent.match("Firefox")?e="mozilla":null!==window.navigator.userAgent.match("Chrome")?(e="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(e="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(e="safari")),e}function lD(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,i){var r=i===t.length-1?"0":"1";return Number.parseInt(r+e.join(""),2)}))}var hD=function(){return Math.floor(65535*Math.random())};function pD(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function _D(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var i=ArrayBuffer.isView(t)?t.buffer:t,r=i.byteLength,n=[];if(r>10){var o=new DataView(i),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return r-1-t})).reverse().map((function(e){return o.getUint8(e)}));n=nv(nv(nv([],rv(a),!1),["..."],!1),rv(s),!1)}else n=Array.from(new Uint8Array(i));return"".concat(t.constructor.name,"(").concat(r,") [").concat(n.join(", "),"]")}if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var fD,vD,mD=function(e){return void 0===e&&(e=!1),ev(void 0,void 0,void 0,(function(){var t,i;return tv(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),t.addTransceiver("audio",{direction:"recvonly"}),t.addTransceiver("video",{direction:"recvonly"}),e&&(t.addTransceiver("audio",{direction:"sendonly"}),t.addTransceiver("video",{direction:"sendonly"})),[4,t.createOffer()];case 1:return i=r.sent(),t.close(),[2,i.sdp];case 2:return r.sent(),[3,3];case 3:return[2]}}))}))},SD=function(e){return new Promise((function(t,i){var r=(e=Array.isArray(e)?e:[]).length,n=[];0===r?i([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){r--,n.push(e),0===r&&i(n)}))}))}))};function yD(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function gD(e){return(e&EP.AUDIO)===EP.AUDIO}function ED(e){return(e&EP.VIDEO)===EP.VIDEO}function bD(e){var t={};return Object.keys(e).forEach((function(i){"object"===us(e[i])?t[i]=bD(e[i]):i.startsWith("_")||(t[i]=e[i])})),t}function TD(e,t){if("boolean"!=typeof e)throw new tN(Qw.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function ID(e,t,i,r){if(void 0===i&&(i=1),void 0===r&&(r=Number.POSITIVE_INFINITY),e<i||e>r||"number"!=typeof e)throw new tN(Qw.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(i,", ").concat(r,"]. integer only"))}function RD(e,t,i,r){if(void 0===i&&(i=1),void 0===r&&(r=Number.POSITIVE_INFINITY),null==e)throw new tN(Qw.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e,t,i){void 0===t&&(t=1);void 0===i&&(i=Number.POSITIVE_INFINITY);return"string"==typeof e&&e.length<=i&&e.length>=t}(e,i,r))throw new tN(Qw.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(i,",").concat(r,"]"))}function AD(e,t,i){if(!i.includes(e))throw new tN(Qw.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(i)))}function CD(e,t){if(ND(e))throw new tN(Qw.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function OD(e,t){if(!(e instanceof ArrayBuffer))throw new tN(Qw.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function wD(e){var t,i;try{var r=navigator.mediaDevices.getSupportedConstraints();try{for(var n=iv(Object.keys(e)),o=n.next();!o.done;o=n.next()){var a=o.value;r[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}}catch(e){}}function ND(e){return null==e}function PD(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new tN(Qw.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function DD(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new tN(Qw.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function kD(e){CD(e,"videoPlayerOption")}function MD(e,t){var i,r;if(void 0===t&&(t=64),!e||0===(null===(i=e)||void 0===i?void 0:i.byteLength))throw new tN(Qw.INVALID_PARAMS,"The message cannot be empty");if((null==(r=e instanceof ArrayBuffer?e:uD.str2ab(JSON.stringify(e)))?void 0:r.byteLength)>1e3*t)throw new tN(Qw.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function UD(e){return![fD.onRemoteStreamStats,fD.onLocalStreamStats,fD.onAudioVolumeIndication,fD.onLocalAudioPropertiesReport,fD.onRemoteAudioPropertiesReport].includes(e)}!function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onUserPublishStream="onUserPublishStream",e.onUserUnpublishStream="onUserUnpublishStream",e.onUserPublishScreen="onUserPublishScreen",e.onUserUnpublishScreen="onUserUnpublishScreen",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onVideoDeviceStateChanged="onVideoDeviceStateChanged",e.onAudioDeviceStateChanged="onAudioDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onStreamMixingEvent="onStreamMixingEvent",e.onAudioPlaybackDeviceTestVolume="onAudioPlaybackDeviceTestVolume",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom",e.onTokenWillExpire="onTokenWillExpire",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived",e.onNetworkQuality="onNetworkQuality",e.onSimulcastSubscribeFallback="onSimulcastSubscribeFallback",e.onRemoteVideoSizeChanged="onRemoteVideoSizeChanged",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged"}(fD||(fD={})),function(e){e[e.ERR_OK=0]="ERR_OK",e[e.ERR_PARAM_INVALID=1]="ERR_PARAM_INVALID",e[e.ERR_FRAME_TIMEOUT=2]="ERR_FRAME_TIMEOUT",e[e.ERR_POSTPROCESS=3]="ERR_POSTPROCESS",e[e.ERR_PUSH_CDN=4]="ERR_PUSH_CDN",e[e.ERR_UNKNOWN=9999]="ERR_UNKNOWN"}(vD||(vD={}));var LD={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function r(){}function n(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new n(r,o||e,a),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,r,n=[];if(0===this._eventsCount)return n;for(r in e=this._events)t.call(e,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,o=r.length,a=new Array(o);n<o;n++)a[n]=r[n].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,n,o,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,n),!0;case 5:return d.fn.call(d.context,t,r,n,o),!0;case 6:return d.fn.call(d.context,t,r,n,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,r);break;case 4:d[u].fn.call(d[u].context,t,r,n);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,r,n){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||n&&!s.once||r&&s.context!==r||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||n&&!s[c].once||r&&s[c].context!==r)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}(LD);var xD=LD.exports,VD=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],FD=!cD()&&window.location.search.includes("_rtc_debug_"),BD=function(){function e(e,t,i){this._module=e,this._indent=t}return e.prototype.print=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(FD){for(var r="",n=0;n<this._indent;n++)r+=" ";console.log.apply(console,nv(["%c".concat("[VERTC]").concat(r,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(VD[this._indent],";")],rv(t),!1))}},e}(),jD=new BD("VERTC",0),GD=function(e){function t(){return e.call(this)||this}return Qf(t,e),t.prototype.safeEmit=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];var n=this.listenerCount(t);try{return e.prototype.emit.apply(this,nv([t],rv(i),!1))}catch(e){return jD.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(n)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return ev(this,void 0,void 0,(function(){var i=this;return tv(this,(function(r){return[2,new Promise((function(r,n){try{i.emit.apply(i,nv(nv([e],rv(t),!1),[r,n],!1))}catch(t){jD.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),n(t)}}))]}))}))},t}(LD.exports.EventEmitter),HD=Ue,zD=function(e){return void 0!==e&&(HD(e,"value")||HD(e,"writable"))},KD=d,WD=j,YD=Pt,XD=zD,qD=n,JD=Qp;Br({target:"Reflect",stat:!0},{get:function e(t,i){var r,n,o=arguments.length<3?t:arguments[2];return YD(t)===o?t[i]:(r=qD.f(t,i))?XD(r)?r.value:void 0===r.get?void 0:KD(r.get,o):WD(n=JD(t))?e(n,i,o):void 0}});var QD=Br,ZD=d,$D=Pt,ek=j,tk=zD,ik=Rt,rk=n,nk=Qp,ok=m;var ak=o((function(){var e=function(){},t=ik.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));QD({target:"Reflect",stat:!0,forced:ak},{set:function e(t,i,r){var n,o,a,s=arguments.length<4?t:arguments[3],c=rk.f($D(t),i);if(!c){if(ek(o=nk(t)))return e(o,i,r,s);c=ok(0)}if(tk(c)){if(!1===c.writable||!ek(s))return!1;if(n=rk.f(s,i)){if(n.get||n.set||!1===n.writable)return!1;n.value=r,ik.f(s,i,n)}else ik.f(s,i,ok(0,r))}else{if(void 0===(a=c.set))return!1;ZD(a,s,r)}return!0}}),(0,ER.exports)("Uint16",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,ER.exports)("Int32",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var sk={};!function(e){var t="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(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 r=t.shift();if(r){if("object"!==us(r))throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(e[n]=r[n])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+r),n);else for(var o=0;o<r;o++)e[n+o]=t[i+o]},flattenChunks:function(e){var t,i,r,n,o,a;for(r=0,t=0,i=e.length;t<i;t++)r+=e[t].length;for(a=new Uint8Array(r),n=0,t=0,i=e.length;t<i;t++)o=e[t],a.set(o,n),n+=o.length;return a}},n={arraySet:function(e,t,i,r,n){for(var o=0;o<r;o++)e[n+o]=t[i+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,r)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,n))},e.setTyped(t)}(sk);var ck={},uk={},dk={},lk=sk;function hk(e){for(var t=e.length;--t>=0;)e[t]=0}var pk=[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],_k=[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],fk=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],vk=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],mk=new Array(576);hk(mk);var Sk=new Array(60);hk(Sk);var yk=new Array(512);hk(yk);var gk=new Array(256);hk(gk);var Ek=new Array(29);hk(Ek);var bk,Tk,Ik,Rk=new Array(30);function Ak(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}function Ck(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Ok(e){return e<256?yk[e]:yk[256+(e>>>7)]}function wk(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function Nk(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,wk(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function Pk(e,t,i){Nk(e,i[2*t],i[2*t+1])}function Dk(e,t){var i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1}function kk(e,t,i){var r,n,o=new Array(16),a=0;for(r=1;r<=15;r++)o[r]=a=a+i[r-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=Dk(o[s]++,s))}}function Mk(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 Uk(e){e.bi_valid>8?wk(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 Lk(e,t,i,r){var n=2*t,o=2*i;return e[n]<e[o]||e[n]===e[o]&&r[t]<=r[i]}function xk(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&Lk(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!Lk(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function Vk(e,t,i){var r,n,o,a,s=0;if(0!==e.last_lit)do{r=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],n=e.pending_buf[e.l_buf+s],s++,0===r?Pk(e,n,t):(Pk(e,(o=gk[n])+256+1,t),0!==(a=pk[o])&&Nk(e,n-=Ek[o],a),Pk(e,o=Ok(--r),i),0!==(a=_k[o])&&Nk(e,r-=Rk[o],a))}while(s<e.last_lit);Pk(e,256,t)}function Fk(e,t){var i,r,n,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,i=0;i<c;i++)0!==o[2*i]?(e.heap[++e.heap_len]=u=i,e.depth[i]=0):o[2*i+1]=0;for(;e.heap_len<2;)o[2*(n=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[n]=0,e.opt_len--,s&&(e.static_len-=a[2*n+1]);for(t.max_code=u,i=e.heap_len>>1;i>=1;i--)xk(e,o,i);n=c;do{i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],xk(e,o,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,o[2*n]=o[2*i]+o[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,o[2*i+1]=o[2*r+1]=n,e.heap[1]=n++,xk(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,n,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,_=t.stat_desc.max_length,f=0;for(o=0;o<=15;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)(o=c[2*c[2*(r=e.heap[i])+1]+1]+1)>_&&(o=_,f++),c[2*r+1]=o,r>u||(e.bl_count[o]++,a=0,r>=p&&(a=h[r-p]),s=c[2*r],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*r+1]+a)));if(0!==f){do{for(o=_-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[_]--,f-=2}while(f>0);for(o=_;0!==o;o--)for(r=e.bl_count[o];0!==r;)(n=e.heap[--i])>u||(c[2*n+1]!==o&&(e.opt_len+=(o-c[2*n+1])*c[2*n],c[2*n+1]=o),r--)}}(e,t),kk(o,u,e.bl_count)}function Bk(e,t,i){var r,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=a,a=t[2*(r+1)+1],++s<c&&n===a||(s<u?e.bl_tree[2*n]+=s:0!==n?(n!==o&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4))}function jk(e,t,i){var r,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),r=0;r<=i;r++)if(n=a,a=t[2*(r+1)+1],!(++s<c&&n===a)){if(s<u)do{Pk(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(Pk(e,n,e.bl_tree),s--),Pk(e,16,e.bl_tree),Nk(e,s-3,2)):s<=10?(Pk(e,17,e.bl_tree),Nk(e,s-3,3)):(Pk(e,18,e.bl_tree),Nk(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}}hk(Rk);var Gk=!1;function Hk(e,t,i,r){Nk(e,0+(r?1:0),3),function(e,t,i,r){Uk(e),r&&(wk(e,i),wk(e,~i)),lk.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}(e,t,i,!0)}dk._tr_init=function(e){Gk||(!function(){var e,t,i,r,n,o=new Array(16);for(i=0,r=0;r<28;r++)for(Ek[r]=i,e=0;e<1<<pk[r];e++)gk[i++]=r;for(gk[i-1]=r,n=0,r=0;r<16;r++)for(Rk[r]=n,e=0;e<1<<_k[r];e++)yk[n++]=r;for(n>>=7;r<30;r++)for(Rk[r]=n<<7,e=0;e<1<<_k[r]-7;e++)yk[256+n++]=r;for(t=0;t<=15;t++)o[t]=0;for(e=0;e<=143;)mk[2*e+1]=8,e++,o[8]++;for(;e<=255;)mk[2*e+1]=9,e++,o[9]++;for(;e<=279;)mk[2*e+1]=7,e++,o[7]++;for(;e<=287;)mk[2*e+1]=8,e++,o[8]++;for(kk(mk,287,o),e=0;e<30;e++)Sk[2*e+1]=5,Sk[2*e]=Dk(e,5);bk=new Ak(mk,pk,257,286,15),Tk=new Ak(Sk,_k,0,30,15),Ik=new Ak(new Array(0),fk,0,19,7)}(),Gk=!0),e.l_desc=new Ck(e.dyn_ltree,bk),e.d_desc=new Ck(e.dyn_dtree,Tk),e.bl_desc=new Ck(e.bl_tree,Ik),e.bi_buf=0,e.bi_valid=0,Mk(e)},dk._tr_stored_block=Hk,dk._tr_flush_block=function(e,t,i,r){var n,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),Fk(e,e.l_desc),Fk(e,e.d_desc),a=function(e){var t;for(Bk(e,e.dyn_ltree,e.l_desc.max_code),Bk(e,e.dyn_dtree,e.d_desc.max_code),Fk(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*vk[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==t?Hk(e,t,i,r):4===e.strategy||o===n?(Nk(e,2+(r?1:0),3),Vk(e,mk,Sk)):(Nk(e,4+(r?1:0),3),function(e,t,i,r){var n;for(Nk(e,t-257,5),Nk(e,i-1,5),Nk(e,r-4,4),n=0;n<r;n++)Nk(e,e.bl_tree[2*vk[n]+1],3);jk(e,e.dyn_ltree,t-1),jk(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Vk(e,e.dyn_ltree,e.dyn_dtree)),Mk(e),r&&Uk(e)},dk._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(gk[i]+256+1)]++,e.dyn_dtree[2*Ok(t)]++),e.last_lit===e.lit_bufsize-1},dk._tr_align=function(e){Nk(e,2,3),Pk(e,256,mk),function(e){16===e.bi_valid?(wk(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 zk=function(e,t,i,r){for(var n=65535&e|0,o=e>>>16&65535|0,a=0;0!==i;){i-=a=i>2e3?2e3:i;do{o=o+(n=n+t[r++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0};var Kk=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();var Wk,Yk=function(e,t,i,r){var n=Kk,o=r+i;e^=-1;for(var a=r;a<o;a++)e=e>>>8^n[255&(e^t[a])];return-1^e},Xk={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"},qk=sk,Jk=dk,Qk=zk,Zk=Yk,$k=Xk;function eM(e,t){return e.msg=$k[t],t}function tM(e){return(e<<1)-(e>4?9:0)}function iM(e){for(var t=e.length;--t>=0;)e[t]=0}function rM(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(qk.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function nM(e,t){Jk._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,rM(e.strm)}function oM(e,t){e.pending_buf[e.pending++]=t}function aM(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function sM(e,t){var i,r,n=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-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],_=u[o+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(i=t)+a]===_&&u[i+a-1]===p&&u[i]===u[o]&&u[++i]===u[o+1]){o+=2,i++;do{}while(u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&o<h);if(r=258-(h-o),o=h-258,r>a){if(e.match_start=t,a=r,r>=s)break;p=u[o+a-1],_=u[o+a]}}}while((t=l[t&d])>c&&0!=--n);return a<=e.lookahead?a:e.lookahead}function cM(e){var t,i,r,n,o,a,s,c,u,d,l=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-262)){qk.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=i=e.hash_size;do{r=e.head[--t],e.head[t]=r>=l?r-l:0}while(--i);t=i=l;do{r=e.prev[--t],e.prev[t]=r>=l?r-l:0}while(--i);n+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=n,d=void 0,(d=a.avail_in)>u&&(d=u),i=0===d?0:(a.avail_in-=d,qk.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=Qk(a.adler,s,d,c):2===a.state.wrap&&(a.adler=Zk(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=i,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)}function uM(e,t){for(var i,r;;){if(e.lookahead<262){if(cM(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-262&&(e.match_length=sM(e,i)),e.match_length>=3)if(r=Jk._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=Jk._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(nM(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(nM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(nM(e,!1),0===e.strm.avail_out)?1:2}function dM(e,t){for(var i,r,n;;){if(e.lookahead<262){if(cM(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-262&&(e.match_length=sM(e,i),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,r=Jk._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(nM(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=Jk._tr_tally(e,0,e.window[e.strstart-1]))&&nM(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Jk._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(nM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(nM(e,!1),0===e.strm.avail_out)?1:2}function lM(e,t,i,r,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=n}function hM(){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 qk.Buf16(1146),this.dyn_dtree=new qk.Buf16(122),this.bl_tree=new qk.Buf16(78),iM(this.dyn_ltree),iM(this.dyn_dtree),iM(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new qk.Buf16(16),this.heap=new qk.Buf16(573),iM(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new qk.Buf16(573),iM(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 pM(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,Jk._tr_init(t),0):eM(e,-2)}function _M(e){var t,i=pM(e);return 0===i&&((t=e.state).window_size=2*t.w_size,iM(t.head),t.max_lazy_match=Wk[t.level].max_lazy,t.good_match=Wk[t.level].good_length,t.nice_match=Wk[t.level].nice_length,t.max_chain_length=Wk[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),i}function fM(e,t,i,r,n,o){if(!e)return-2;var a=1;if(-1===t&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),n<1||n>9||8!==i||r<8||r>15||t<0||t>9||o<0||o>4)return eM(e,-2);8===r&&(r=9);var s=new hM;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new qk.Buf8(2*s.w_size),s.head=new qk.Buf16(s.hash_size),s.prev=new qk.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new qk.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=i,_M(e)}Wk=[new lM(0,0,0,0,(function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(cM(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+i;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,nM(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(nM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(nM(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(nM(e,!1),e.strm.avail_out),1)})),new lM(4,4,8,4,uM),new lM(4,5,16,8,uM),new lM(4,6,32,32,uM),new lM(4,4,16,16,dM),new lM(8,16,32,32,dM),new lM(8,16,128,128,dM),new lM(8,32,128,256,dM),new lM(32,128,258,1024,dM),new lM(32,258,258,4096,dM)],uk.deflateInit=function(e,t){return fM(e,t,8,15,8,0)},uk.deflateInit2=fM,uk.deflateReset=_M,uk.deflateResetKeep=pM,uk.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?-2:(e.state.gzhead=t,0):-2},uk.deflate=function(e,t){var i,r,n,o;if(!e||!e.state||t>5||t<0)return e?eM(e,-2):-2;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||666===r.status&&4!==t)return eM(e,0===e.avail_out?-5:-2);if(r.strm=e,i=r.last_flush,r.last_flush=t,42===r.status)if(2===r.wrap)e.adler=0,oM(r,31),oM(r,139),oM(r,8),r.gzhead?(oM(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),oM(r,255&r.gzhead.time),oM(r,r.gzhead.time>>8&255),oM(r,r.gzhead.time>>16&255),oM(r,r.gzhead.time>>24&255),oM(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),oM(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(oM(r,255&r.gzhead.extra.length),oM(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=Zk(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(oM(r,0),oM(r,0),oM(r,0),oM(r,0),oM(r,0),oM(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),oM(r,3),r.status=113);else{var a=8+(r.w_bits-8<<4)<<8;a|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(a|=32),a+=31-a%31,r.status=113,aM(r,a),0!==r.strstart&&(aM(r,e.adler>>>16),aM(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(n=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>n&&(e.adler=Zk(e.adler,r.pending_buf,r.pending-n,n)),rM(e),n=r.pending,r.pending!==r.pending_buf_size));)oM(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>n&&(e.adler=Zk(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=Zk(e.adler,r.pending_buf,r.pending-n,n)),rM(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,oM(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=Zk(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=Zk(e.adler,r.pending_buf,r.pending-n,n)),rM(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,oM(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=Zk(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&rM(e),r.pending+2<=r.pending_buf_size&&(oM(r,255&e.adler),oM(r,e.adler>>8&255),e.adler=0,r.status=113)):r.status=113),0!==r.pending){if(rM(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&&tM(t)<=tM(i)&&4!==t)return eM(e,-5);if(666===r.status&&0!==e.avail_in)return eM(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&&666!==r.status){var s=2===r.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(cM(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=Jk._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(nM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(nM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(nM(e,!1),0===e.strm.avail_out)?1:2}(r,t):3===r.strategy?function(e,t){for(var i,r,n,o,a=e.window;;){if(e.lookahead<=258){if(cM(e),e.lookahead<=258&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=a[n=e.strstart-1])===a[++n]&&r===a[++n]&&r===a[++n]){o=e.strstart+258;do{}while(r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&n<o);e.match_length=258-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=Jk._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=Jk._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(nM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(nM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(nM(e,!1),0===e.strm.avail_out)?1:2}(r,t):Wk[r.level].func(r,t);if(3!==s&&4!==s||(r.status=666),1===s||3===s)return 0===e.avail_out&&(r.last_flush=-1),0;if(2===s&&(1===t?Jk._tr_align(r):5!==t&&(Jk._tr_stored_block(r,0,0,!1),3===t&&(iM(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),rM(e),0===e.avail_out))return r.last_flush=-1,0}return 4!==t?0:r.wrap<=0?1:(2===r.wrap?(oM(r,255&e.adler),oM(r,e.adler>>8&255),oM(r,e.adler>>16&255),oM(r,e.adler>>24&255),oM(r,255&e.total_in),oM(r,e.total_in>>8&255),oM(r,e.total_in>>16&255),oM(r,e.total_in>>24&255)):(aM(r,e.adler>>>16),aM(r,65535&e.adler)),rM(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)},uk.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?eM(e,-2):(e.state=null,113===t?eM(e,-3):0):-2},uk.deflateSetDictionary=function(e,t){var i,r,n,o,a,s,c,u,d=t.length;if(!e||!e.state)return-2;if(2===(o=(i=e.state).wrap)||1===o&&42!==i.status||i.lookahead)return-2;for(1===o&&(e.adler=Qk(e.adler,t,d,0)),i.wrap=0,d>=i.w_size&&(0===o&&(iM(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new qk.Buf8(i.w_size),qk.arraySet(u,t,d-i.w_size,i.w_size,0),t=u,d=i.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,cM(i);i.lookahead>=3;){r=i.strstart,n=i.lookahead-2;do{i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+3-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++}while(--n);i.strstart=r,i.lookahead=2,cM(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,i.wrap=o,0},uk.deflateInfo="pako deflate (from Nodeca project)";var vM={},mM=sk,SM=!0,yM=!0;try{String.fromCharCode.apply(null,[0])}catch(e){SM=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){yM=!1}for(var gM=new mM.Buf8(256),EM=0;EM<256;EM++)gM[EM]=EM>=252?6:EM>=248?5:EM>=240?4:EM>=224?3:EM>=192?2:1;function bM(e,t){if(t<65534&&(e.subarray&&yM||!e.subarray&&SM))return String.fromCharCode.apply(null,mM.shrinkBuf(e,t));for(var i="",r=0;r<t;r++)i+=String.fromCharCode(e[r]);return i}gM[254]=gM[254]=1,vM.string2buf=function(e){var t,i,r,n,o,a=e.length,s=0;for(n=0;n<a;n++)55296==(64512&(i=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),s+=i<128?1:i<2048?2:i<65536?3:4;for(t=new mM.Buf8(s),o=0,n=0;o<s;n++)55296==(64512&(i=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),i<128?t[o++]=i:i<2048?(t[o++]=192|i>>>6,t[o++]=128|63&i):i<65536?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t},vM.buf2binstring=function(e){return bM(e,e.length)},vM.binstring2buf=function(e){for(var t=new mM.Buf8(e.length),i=0,r=t.length;i<r;i++)t[i]=e.charCodeAt(i);return t},vM.buf2string=function(e,t){var i,r,n,o,a=t||e.length,s=new Array(2*a);for(r=0,i=0;i<a;)if((n=e[i++])<128)s[r++]=n;else if((o=gM[n])>4)s[r++]=65533,i+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&i<a;)n=n<<6|63&e[i++],o--;o>1?s[r++]=65533:n<65536?s[r++]=n:(n-=65536,s[r++]=55296|n>>10&1023,s[r++]=56320|1023&n)}return bM(s,r)},vM.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+gM[e[i]]>t?i:t};var TM=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},IM=uk,RM=sk,AM=vM,CM=Xk,OM=TM,wM=Object.prototype.toString;function NM(e){if(!(this instanceof NM))return new NM(e);this.options=RM.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 OM,this.strm.avail_out=0;var i=IM.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(CM[i]);if(t.header&&IM.deflateSetHeader(this.strm,t.header),t.dictionary){var r;if(r="string"==typeof t.dictionary?AM.string2buf(t.dictionary):"[object ArrayBuffer]"===wM.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=IM.deflateSetDictionary(this.strm,r)))throw new Error(CM[i]);this._dict_set=!0}}function PM(e,t){var i=new NM(t);if(i.push(e,!0),i.err)throw i.msg||CM[i.err];return i.result}NM.prototype.push=function(e,t){var i,r,n=this.strm,o=this.options.chunkSize;if(this.ended)return!1;r=t===~~t?t:!0===t?4:0,"string"==typeof e?n.input=AM.string2buf(e):"[object ArrayBuffer]"===wM.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 RM.Buf8(o),n.next_out=0,n.avail_out=o),1!==(i=IM.deflate(n,r))&&0!==i)return this.onEnd(i),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==r&&2!==r)||("string"===this.options.to?this.onData(AM.buf2binstring(RM.shrinkBuf(n.output,n.next_out))):this.onData(RM.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==i);return 4===r?(i=IM.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==r||(this.onEnd(0),n.avail_out=0,!0)},NM.prototype.onData=function(e){this.chunks.push(e)},NM.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=RM.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},ck.Deflate=NM,ck.deflate=PM,ck.deflateRaw=function(e,t){return(t=t||{}).raw=!0,PM(e,t)},ck.gzip=function(e,t){return(t=t||{}).gzip=!0,PM(e,t)};var DM={},kM=a,MM=Rt,UM=aa,LM=o,xM=RegExp.prototype;kM&&LM((function(){return"sy"!==Object.getOwnPropertyDescriptor(xM,"flags").get.call({dotAll:!0,sticky:!0})}))&&MM.f(xM,"flags",{configurable:!0,get:UM});var VM={},FM=sk,BM=[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],jM=[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],GM=[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],HM=[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],zM=sk,KM=zk,WM=Yk,YM=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A;i=e.state,r=e.next_in,R=e.input,n=r+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=i.dmax,u=i.wsize,d=i.whave,l=i.wnext,h=i.window,p=i.hold,_=i.bits,f=i.lencode,v=i.distcode,m=(1<<i.lenbits)-1,S=(1<<i.distbits)-1;e:do{_<15&&(p+=R[r++]<<_,_+=8,p+=R[r++]<<_,_+=8),y=f[p&m];t:for(;;){if(p>>>=g=y>>>24,_-=g,0===(g=y>>>16&255))A[o++]=65535&y;else{if(!(16&g)){if(0==(64&g)){y=f[(65535&y)+(p&(1<<g)-1)];continue t}if(32&g){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}E=65535&y,(g&=15)&&(_<g&&(p+=R[r++]<<_,_+=8),E+=p&(1<<g)-1,p>>>=g,_-=g),_<15&&(p+=R[r++]<<_,_+=8,p+=R[r++]<<_,_+=8),y=v[p&S];i:for(;;){if(p>>>=g=y>>>24,_-=g,!(16&(g=y>>>16&255))){if(0==(64&g)){y=v[(65535&y)+(p&(1<<g)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(b=65535&y,_<(g&=15)&&(p+=R[r++]<<_,(_+=8)<g&&(p+=R[r++]<<_,_+=8)),(b+=p&(1<<g)-1)>c){e.msg="invalid distance too far back",i.mode=30;break e}if(p>>>=g,_-=g,b>(g=o-a)){if((g=b-g)>d&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(T=0,I=h,0===l){if(T+=u-g,g<E){E-=g;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}}else if(l<g){if(T+=u+l-g,(g-=l)<E){E-=g;do{A[o++]=h[T++]}while(--g);if(T=0,l<E){E-=g=l;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}}}else if(T+=l-g,g<E){E-=g;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}for(;E>2;)A[o++]=I[T++],A[o++]=I[T++],A[o++]=I[T++],E-=3;E&&(A[o++]=I[T++],E>1&&(A[o++]=I[T++]))}else{T=o-b;do{A[o++]=A[T++],A[o++]=A[T++],A[o++]=A[T++],E-=3}while(E>2);E&&(A[o++]=A[T++],E>1&&(A[o++]=A[T++]))}break}}break}}while(r<n&&o<s);r-=E=_>>3,p&=(1<<(_-=E<<3))-1,e.next_in=r,e.next_out=o,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=o<s?s-o+257:257-(o-s),i.hold=p,i.bits=_},XM=function(e,t,i,r,n,o,a,s){var c,u,d,l,h,p,_,f,v,m=s.bits,S=0,y=0,g=0,E=0,b=0,T=0,I=0,R=0,A=0,C=0,O=null,w=0,N=new FM.Buf16(16),P=new FM.Buf16(16),D=null,k=0;for(S=0;S<=15;S++)N[S]=0;for(y=0;y<r;y++)N[t[i+y]]++;for(b=m,E=15;E>=1&&0===N[E];E--);if(b>E&&(b=E),0===E)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(g=1;g<E&&0===N[g];g++);for(b<g&&(b=g),R=1,S=1;S<=15;S++)if(R<<=1,(R-=N[S])<0)return-1;if(R>0&&(0===e||1!==E))return-1;for(P[1]=0,S=1;S<15;S++)P[S+1]=P[S]+N[S];for(y=0;y<r;y++)0!==t[i+y]&&(a[P[t[i+y]]++]=y);if(0===e?(O=D=a,p=19):1===e?(O=BM,w-=257,D=jM,k-=257,p=256):(O=GM,D=HM,p=-1),C=0,y=0,S=g,h=o,T=b,I=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){_=S-I,a[y]<p?(f=0,v=a[y]):a[y]>p?(f=D[k+a[y]],v=O[w+a[y]]):(f=96,v=0),c=1<<S-I,g=u=1<<T;do{n[h+(C>>I)+(u-=c)]=_<<24|f<<16|v|0}while(0!==u);for(c=1<<S-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,y++,0==--N[S]){if(S===E)break;S=t[i+a[y]]}if(S>b&&(C&l)!==d){for(0===I&&(I=b),h+=g,R=1<<(T=S-I);T+I<E&&!((R-=N[T+I])<=0);)T++,R<<=1;if(A+=1<<T,1===e&&A>852||2===e&&A>592)return 1;n[d=C&l]=b<<24|T<<16|h-o|0}}return 0!==C&&(n[h+C]=S-I<<24|64<<16|0),s.bits=b,0};function qM(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function JM(){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 zM.Buf16(320),this.work=new zM.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function QM(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 zM.Buf32(852),t.distcode=t.distdyn=new zM.Buf32(592),t.sane=1,t.back=-1,0):-2}function ZM(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,QM(e)):-2}function $M(e,t){var i,r;return e&&e.state?(r=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,ZM(e))):-2}function eU(e,t){var i,r;return e?(r=new JM,e.state=r,r.window=null,0!==(i=$M(e,t))&&(e.state=null),i):-2}var tU,iU,rU=!0;function nU(e){if(rU){var t;for(tU=new zM.Buf32(512),iU=new zM.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(XM(1,e.lens,0,288,tU,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;XM(2,e.lens,0,32,iU,0,e.work,{bits:5}),rU=!1}e.lencode=tU,e.lenbits=9,e.distcode=iU,e.distbits=5}function oU(e,t,i,r){var n,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new zM.Buf8(o.wsize)),r>=o.wsize?(zM.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>r&&(n=r),zM.arraySet(o.window,t,i-r,n,o.wnext),(r-=n)?(zM.arraySet(o.window,t,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}VM.inflateReset=ZM,VM.inflateReset2=$M,VM.inflateResetKeep=QM,VM.inflateInit=function(e){return eU(e,15)},VM.inflateInit2=eU,VM.inflate=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A=0,C=new zM.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===(i=e.state).mode&&(i.mode=13),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=i.hold,d=i.bits,l=s,h=c,T=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(2&i.wrap&&35615===u){i.check=0,C[0]=255&u,C[1]=u>>>8&255,i.check=WM(i.check,C,2,0),u=0,d=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",i.mode=30;break}if(d-=4,b=8+(15&(u>>>=4)),0===i.wbits)i.wbits=b;else if(b>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<b,e.adler=i.check=1,i.mode=512&u?10:12,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(i.flags=u,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=u>>8&1),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=WM(i.check,C,2,0)),u=0,d=0,i.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.head&&(i.head.time=u),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,i.check=WM(i.check,C,4,0)),u=0,d=0,i.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.head&&(i.head.xflags=255&u,i.head.os=u>>8),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=WM(i.check,C,2,0)),u=0,d=0,i.mode=5;case 5:if(1024&i.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.length=u,i.head&&(i.head.extra_len=u),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=WM(i.check,C,2,0)),u=0,d=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((p=i.length)>s&&(p=s),p&&(i.head&&(b=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),zM.arraySet(i.head.extra,r,o,p,b)),512&i.flags&&(i.check=WM(i.check,r,p,o)),s-=p,o+=p,i.length-=p),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===s)break e;p=0;do{b=r[o+p++],i.head&&b&&i.length<65536&&(i.head.name+=String.fromCharCode(b))}while(b&&p<s);if(512&i.flags&&(i.check=WM(i.check,r,p,o)),s-=p,o+=p,b)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===s)break e;p=0;do{b=r[o+p++],i.head&&b&&i.length<65536&&(i.head.comment+=String.fromCharCode(b))}while(b&&p<s);if(512&i.flags&&(i.check=WM(i.check,r,p,o)),s-=p,o+=p,b)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}u=0,d=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}e.adler=i.check=qM(u),u=0,d=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){u>>>=7&d,d-=7&d,i.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}switch(i.last=1&u,d-=1,3&(u>>>=1)){case 0:i.mode=14;break;case 1:if(nU(i),i.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&u,u=0,d=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(p=i.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;zM.arraySet(n,r,o,p,a),s-=p,o+=p,c-=p,a+=p,i.length-=p;break}i.mode=12;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(i.nlen=257+(31&u),u>>>=5,d-=5,i.ndist=1+(31&u),u>>>=5,d-=5,i.ncode=4+(15&u),u>>>=4,d-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.lens[O[i.have++]]=7&u,u>>>=3,d-=3}for(;i.have<19;)i.lens[O[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,I={bits:i.lenbits},T=XM(0,i.lens,0,19,i.lencode,0,i.work,I),i.lenbits=I.bits,T){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;m=(A=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(S<16)u>>>=v,d-=v,i.lens[i.have++]=S;else{if(16===S){for(R=v+2;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u>>>=v,d-=v,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}b=i.lens[i.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===S){for(R=v+3;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}d-=v,b=0,p=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(R=v+7;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}d-=v,b=0,p=11+(127&(u>>>=v)),u>>>=7,d-=7}if(i.have+p>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;p--;)i.lens[i.have++]=b}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,I={bits:i.lenbits},T=XM(1,i.lens,0,i.nlen,i.lencode,0,i.work,I),i.lenbits=I.bits,T){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,I={bits:i.distbits},T=XM(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,I),i.distbits=I.bits,T){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,YM(e,h),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=i.hold,d=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;m=(A=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(m&&0==(240&m)){for(y=v,g=m,E=S;m=(A=i.lencode[E+((u&(1<<y+g)-1)>>y)])>>>16&255,S=65535&A,!(y+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=y,d-=y,i.back+=y}if(u>>>=v,d-=v,i.back+=v,i.length=S,0===m){i.mode=26;break}if(32&m){i.back=-1,i.mode=12;break}if(64&m){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&m,i.mode=22;case 22:if(i.extra){for(R=i.extra;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;m=(A=i.distcode[u&(1<<i.distbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(0==(240&m)){for(y=v,g=m,E=S;m=(A=i.distcode[E+((u&(1<<y+g)-1)>>y)])>>>16&255,S=65535&A,!(y+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=y,d-=y,i.back+=y}if(u>>>=v,d-=v,i.back+=v,64&m){e.msg="invalid distance code",i.mode=30;break}i.offset=S,i.extra=15&m,i.mode=24;case 24:if(i.extra){for(R=i.extra;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.offset+=u&(1<<i.extra)-1,u>>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===c)break e;if(p=h-c,i.offset>p){if((p=i.offset-p)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}p>i.wnext?(p-=i.wnext,_=i.wsize-p):_=i.wnext-p,p>i.length&&(p=i.length),f=i.window}else f=n,_=a-i.offset,p=i.length;p>c&&(p=c),c-=p,i.length-=p;do{n[a++]=f[_++]}while(--p);0===i.length&&(i.mode=21);break;case 26:if(0===c)break e;n[a++]=i.length,c--,i.mode=21;break;case 27:if(i.wrap){for(;d<32;){if(0===s)break e;s--,u|=r[o++]<<d,d+=8}if(h-=c,e.total_out+=h,i.total+=h,h&&(e.adler=i.check=i.flags?WM(i.check,n,h,a-h):KM(i.check,n,h,a-h)),h=c,(i.flags?u:qM(u))!==i.check){e.msg="incorrect data check",i.mode=30;break}u=0,d=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}u=0,d=0}i.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,i.hold=u,i.bits=d,(i.wsize||h!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&oU(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,i.total+=h,i.wrap&&h&&(e.adler=i.check=i.flags?WM(i.check,n,h,e.next_out-h):KM(i.check,n,h,e.next_out-h)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0===l&&0===h||4===t)&&0===T&&(T=-5),T},VM.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},VM.inflateGetHeader=function(e,t){var i;return e&&e.state?0==(2&(i=e.state).wrap)?-2:(i.head=t,t.done=!1,0):-2},VM.inflateSetDictionary=function(e,t){var i,r=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?-2:11===i.mode&&KM(1,t,r,0)!==i.check?-3:oU(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,0):-2},VM.inflateInfo="pako inflate (from Nodeca project)";var aU={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 sU=VM,cU=sk,uU=vM,dU=aU,lU=Xk,hU=TM,pU=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},_U=Object.prototype.toString;function fU(e){if(!(this instanceof fU))return new fU(e);this.options=cU.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 hU,this.strm.avail_out=0;var i=sU.inflateInit2(this.strm,t.windowBits);if(i!==dU.Z_OK)throw new Error(lU[i]);if(this.header=new pU,sU.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=uU.string2buf(t.dictionary):"[object ArrayBuffer]"===_U.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=sU.inflateSetDictionary(this.strm,t.dictionary))!==dU.Z_OK))throw new Error(lU[i])}function vU(e,t){var i=new fU(t);if(i.push(e,!0),i.err)throw i.msg||lU[i.err];return i.result}fU.prototype.push=function(e,t){var i,r,n,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;r=t===~~t?t:!0===t?dU.Z_FINISH:dU.Z_NO_FLUSH,"string"==typeof e?s.input=uU.binstring2buf(e):"[object ArrayBuffer]"===_U.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 cU.Buf8(c),s.next_out=0,s.avail_out=c),(i=sU.inflate(s,dU.Z_NO_FLUSH))===dU.Z_NEED_DICT&&u&&(i=sU.inflateSetDictionary(this.strm,u)),i===dU.Z_BUF_ERROR&&!0===d&&(i=dU.Z_OK,d=!1),i!==dU.Z_STREAM_END&&i!==dU.Z_OK)return this.onEnd(i),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&i!==dU.Z_STREAM_END&&(0!==s.avail_in||r!==dU.Z_FINISH&&r!==dU.Z_SYNC_FLUSH)||("string"===this.options.to?(n=uU.utf8border(s.output,s.next_out),o=s.next_out-n,a=uU.buf2string(s.output,n),s.next_out=o,s.avail_out=c-o,o&&cU.arraySet(s.output,s.output,n,o,0),this.onData(a)):this.onData(cU.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(d=!0)}while((s.avail_in>0||0===s.avail_out)&&i!==dU.Z_STREAM_END);return i===dU.Z_STREAM_END&&(r=dU.Z_FINISH),r===dU.Z_FINISH?(i=sU.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===dU.Z_OK):r!==dU.Z_SYNC_FLUSH||(this.onEnd(dU.Z_OK),s.avail_out=0,!0)},fU.prototype.onData=function(e){this.chunks.push(e)},fU.prototype.onEnd=function(e){e===dU.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=cU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},DM.Inflate=fU,DM.inflate=vU,DM.inflateRaw=function(e,t){return(t=t||{}).raw=!0,vU(e,t)},DM.ungzip=vU;var mU={};(0,sk.assign)(mU,ck,DM,aU);var SU,yU,gU,EU,bU,TU,IU,RU,AU,CU,OU,wU,NU,PU,DU,kU,MU,UU,LU,xU,VU,FU,BU,jU,GU,HU,zU,KU,WU,YU,XU,qU,JU,QU,ZU,$U,eL,tL,iL,rL,nL,oL,aL,sL,cL,uL,dL,lL=mU;!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"}(SU||(SU={})),function(e){e.RTC="rtc"}(yU||(yU={})),function(e){e.W_5="5"}(gU||(gU={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(EU||(EU={})),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"}(bU||(bU={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(TU||(TU={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(IU||(IU={})),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"}(RU||(RU={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(AU||(AU={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(CU||(CU={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(OU||(OU={})),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"}(wU||(wU={})),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"}(NU||(NU={})),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"}(PU||(PU={})),function(e){e.CALL_JOINROOM="call-joinRoom",e.JOINROOM="joinRoom",e.CALL_RECONNECTED="call-reconnected",e.RECONNECTED="reconnected",e.CALL_PUBLISH="call-publish",e.PUBLISH="publish",e.CALL_UPDATESTREAMATTRIBUTES="call-updateStreamAttributes",e.UPDATESTREAMATTRIBUTES="updateStreamAttributes",e.CALL_UNPUBLISH="call-unpublish",e.UNPUBLISH="unpublish",e.CALL_SUBSCRIBE="call-subscribe",e.SUBSCRIBE="subscribe",e.CALL_UPDATESUBSCRIBE="call-updateSubscribe",e.UPDATESUBSCRIBE="updateSubscribe",e.CALL_UNSUBSCRIBE="call-unsubscribe",e.UNSUBSCRIBE="unsubscribe",e.CALL_UPDATEUSERATTRIBUTES="call-updateUserAttributes",e.UPDATEUSERATTRIBUTES="updateUserAttributes",e.CALL_LEAVEROOM="call-leaveRoom",e.LEAVEROOM="leaveRoom",e.ON_USERCONNECTION="on-userConnection",e.ON_USERDISCONNECTION="on-userDisconnection",e.ON_ONADDSTREAM="on-onAddStream",e.ON_ONPUSHSTREAM="on-onPushStream",e.ON_ONREMOVESTREAM="on-onRemoveStream",e.ON_ONPUSHTRACK="on-onPushTrack",e.ON_ONREMOVETRACK="on-onRemoveTrack",e.ON_ONUPDATEUSERATTRIBUTES="on-onUpdateUserAttributes",e.ON_ONUPDATEROOMATTRIBUTES="on-onUpdateRoomAttributes",e.ON_ONUPDATESTREAMATTRIBUTES="on-onUpdateStreamAttributes",e.ON_STREAMFAILED="on-streamFailed",e.ON_POSTPROCESSINGMESSAGE="on-postProcessingMessage",e.ON_ENGINECONTROLMESSAGE="on-engineControlMessage",e.ON_WEBSOCKETENGINECUSTOMMESSAGE="on-websocketEngineCustomMessage",e.UNKNOWN="unknown",e.CALL_UPDATEPUBLISHSTREAMCHANNEL="call-updatePublishStreamChannel",e.UPDATEPUBLISHSTREAMCHANNEL="updatePublishStreamChannel",e.CALL_UPDATESUBSCRIBESTREAMCHANNEL="call-updateSubscribeStreamChannel",e.UPDATESUBSCRIBESTREAMCHANNEL="updateSubscribeStreamChannel",e.ON_ONSTREAMCHANNELCHANGE="on-onStreamChannelChange",e.P2PDIRECT="p2pdirect",e.INTERNAL_CUSTOM="internal_custom",e.REPORT="report",e.CONNECTION_CONTROL="connection_control",e.ON_INTERNAL_CUSTOM="on_internal_custom",e.CONTROLMESSAGE="controlMessage",e.CALL_LOGIN="call-login",e.LOGIN="login",e.CALL_RECONNECTLOGIN="call-reconnectLogin",e.RECONNECTLOGIN="reconnectLogin",e.CALL_LOGOUT="call-logout",e.LOGOUT="logout",e.CALL_UPDATELOGINTOKEN="call-updateLoginToken",e.UPDATELOGINTOKEN="updateLoginToken",e.CALL_SETSERVERPARAMS="call-setServerParams",e.SETSERVERPARAMS="setServerParams",e.CALL_GETPEERONLINESTATUS="call-getPeerOnlineStatus",e.GETPEERONLINESTATUS="getPeerOnlineStatus",e.ON_ONSCENECONFIG="on-onSceneConfig",e.ON_STREAMCONTROLMESSAGE="on-streamControlMessage",e.CALL_STARTPUSHSTREAM="call-startPushStream",e.STARTPUSHSTREAM="startPushStream",e.CALL_STOPPUSHSTREAM="call-stopPushStream",e.STOPPUSHSTREAM="stopPushStream",e.CALL_STARTPULLSTREAM="call-startPullStream",e.STARTPULLSTREAM="startPullStream",e.CALL_STOPPULLSTREAM="call-stopPullStream",e.STOPPULLSTREAM="stopPullStream",e.CALL_UPDATEPULLSTREAM="call-updatePullStream",e.UPDATEPULLSTREAM="updatePullStream",e.ON_ONSTREAMPUSHEDBYOTHER="on-onStreamPushedByOther",e.CALL_UPDATETOKEN="call-updateToken",e.UPDATETOKEN="updateToken",e.ON_ONTOKENWILLEXPIRE="on-onTokenWillExpire",e.ON_ONPUSHCLIENTCONFIG="on-onPushClientConfig",e.CALL_GETCLIENTCONFIG="call-getClientConfig",e.GETCLIENTCONFIG="getClientConfig"}(DU||(DU={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(kU||(kU={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(MU||(MU={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(UU||(UU={})),function(e){e.W_0="0",e.W_1="1"}(LU||(LU={})),function(e){e.UP="up",e.DOWN="down"}(xU||(xU={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(VU||(VU={})),function(e){e.UP="up",e.DOWN="down"}(FU||(FU={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(BU||(BU={})),function(e){e.W_0="0",e.W_1="1"}(jU||(jU={})),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"}(GU||(GU={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(HU||(HU={})),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"}(zU||(zU={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(KU||(KU={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(WU||(WU={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(YU||(YU={})),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"}(XU||(XU={})),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"}(qU||(qU={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(JU||(JU={})),function(e){e.BEGIN="begin",e.END="end"}(QU||(QU={})),function(e){e.BEGIN="begin",e.END="end"}(ZU||(ZU={})),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"}($U||($U={})),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"}(eL||(eL={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(tL||(tL={})),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"}(iL||(iL={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(rL||(rL={})),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"}(nL||(nL={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(oL||(oL={})),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"}(aL||(aL={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(sL||(sL={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(cL||(cL={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(uL||(uL={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(dL||(dL={}));var hL=function(){function e(e){this.monitor=e}return e.prototype.setStats=function(e){var t=this;Object.keys(e).forEach((function(i){t["_"+i]=e[i]})),this.monitor.StartUp()},Object.defineProperty(e.prototype,"event_key",{get:function(){return this._event_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_id",{get:function(){return this._device_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_app_id",{get:function(){return this._rtc_app_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"product_line",{get:function(){return this._product_line},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_version",{get:function(){return this._report_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"os",{get:function(){return this._os},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_version",{get:function(){return this._rtc_sdk_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_timestamp",{get:function(){return this._rtc_timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_git_commit",{get:function(){return this._rtc_sdk_git_commit},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_id",{get:function(){return this._report_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connection_id",{get:function(){return this._connection_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sid",{get:function(){return this._rtc_sid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"engine_session_id",{get:function(){return this._engine_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_business_id",{get:function(){return this._rtc_business_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"project_key",{get:function(){return this._project_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"network_type",{get:function(){return this._network_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app_version",{get:function(){return this._app_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aid",{get:function(){return this._aid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_model",{get:function(){return this._device_model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_brand",{get:function(){return this._device_brand},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"common_extra_info",{get:function(){return this._common_extra_info},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"had_selected_p2p",{get:function(){return this._had_selected_p2p},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_env_type",{get:function(){return this._rtc_env_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"room_id",{get:function(){return this._room_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_id",{get:function(){return this._user_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_session_id",{get:function(){return this._rtc_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_agent",{get:function(){return this._user_agent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"auto_play_policy",{get:function(){return this._auto_play_policy},enumerable:!1,configurable:!0}),e}(),pL=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 hL(t),cD()||window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(null,!0)})),t}return Qf(t,e),t.prototype.push=function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))},t.prototype.unshift=function(e){this.dataBuffer=e.concat(this.dataBuffer)},t.prototype.send=function(e,t){var i=this;if(e||this.dataBuffer.length){var r={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},n=new XMLHttpRequest;n.timeout=1e4,n.onreadystatechange=function(){if(4===n.readyState){e||(i.posting=!1);var o=void 0;if(200===n.status||304===n.status)try{o=JSON.parse(n.responseText)}catch(e){}o&&0===o.StatusCode?e||t||i.sucSend():e?i.send(e):(i.unshift(r.data),t?i.send():i.errSend())}};var o=qL.LOG_SERVER_URL;if(n.open("POST",o,!0),e||(this.posting=!0),!cD()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",r),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!cD()&&location.search.includes("_rtc_debug_"))n.send(JSON.stringify(r));else{var a=lL.gzip(JSON.stringify(r));n.setRequestHeader("Content-Encoding","gzip"),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.send(a)}}},t.prototype.sucSend=function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)},t.prototype.errSend=function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2},t.prototype.StartUp=function(){var e=this.report_common,t=this.commonStats,i=t.event_key,r=t.device_id,n=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,c=t.rtc_sdk_version,u=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,p=t.engine_session_id,_=t.rtc_business_id,f=t.project_key,v=t.network_type,m=t.app_version,S=t.aid,y=t.device_model,g=t.device_brand,E=t.common_extra_info,b=t.had_selected_p2p,T=t.rtc_env_type,I=t.user_agent,R=t.auto_play_policy;Object.assign(e,{event_key:i,device_id:r,rtc_app_id:n,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:p,rtc_business_id:_,project_key:f,network_type:v,app_version:m,aid:S,device_model:y,device_brand:g,common_extra_info:E,had_selected_p2p:b,rtc_env_type:T,user_agent:I,auto_play_policy:R}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id),this.commonStats.connection_id&&(this.modify_ids.connection_id=this.commonStats.connection_id)},t.prototype.rtcSdkApiCall=function(e,t,i,r){void 0===r&&(r={});var n=Zf(Zf({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSdkCallback=function(e,t,i,r){void 0===r&&(r={});var n=Zf(Zf({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcGetConfig=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=Zf(Zf({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i,host:r,type:n,config_id:o,enable_cloud_proxy:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcReconnect=function(e,t,i,r,n){void 0===n&&(n={});var o=Zf(Zf({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:i,reconnect_type:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcReconnected=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcGetAccess=function(e,t,i,r,n,o,a){void 0===a&&(a={});var s=Zf(Zf({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i,type:r,host:n,connect_session_id:o},this.modify_ids),{common_extra_info:JSON.stringify(a)});this.push(s)},t.prototype.rtcPreIceState=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcNodeChange=function(e,t,i,r){void 0===r&&(r={});var n=Zf(Zf({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSignalingMsgError=function(e,t,i,r){void 0===r&&(r={});var n=Zf(Zf({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSignaling=function(e,t,i,r,n,o){void 0===o&&(o={});var a=Zf(Zf({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:i,signaling_type:r,direction:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcJoinRoom=function(e,t,i,r,n){void 0===n&&(n={});var o=Zf(Zf({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:i,elapse:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcLeaveRoom=function(e,t,i,r){void 0===r&&(r={});var n=Zf(Zf({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcBeginCreateOffer=function(e,t,i,r){void 0===r&&(r={});var n=Zf(Zf({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcCreateOffer=function(e,t,i,r,n,o){void 0===o&&(o={});var a=Zf(Zf({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:i,stream_user_id:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcSetDescription=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=Zf(Zf({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:i,direction:r,stream_id:n,stream_user_id:o,elapse:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcRecvAnswer=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=Zf(Zf({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:i,message:r,direction:n,stream_id:o,stream_user_id:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.firstRemoteAudioRender=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.firstRemoteVideoRender=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcPublishStat=function(e,t,i,r,n){void 0===n&&(n={});var o=Zf(Zf({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:i,message:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcSubscribeStat=function(e,t,i,r,n){void 0===n&&(n={});var o=Zf(Zf({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:i,stream_user_id:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcAudioDevice=function(e,t,i,r){void 0===r&&(r={});var n=Zf(Zf({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcMediaStatistics=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf(Zf(Zf({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcMessageStatistics=function(e,t,i,r){void 0===r&&(r={});var n=Zf(Zf({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now(),dc_user_message:e,dc_room_message:t,media_server_ip:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcError=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcInvokeStatus=function(e,t,i,r,n,o){void 0===o&&(o={});var a=Zf(Zf({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:i,stream_id:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var i=Zf(Zf(Zf({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcMuteRemote=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now(),mute_info:e,media_type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.sdkInitEngine=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.joinRoom=function(e,t,i,r,n){void 0===n&&(n={});var o=Zf(Zf({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:i,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.p2pConnectionStatus=function(e,t,i,r,n,o){void 0===o&&(o={});var a=Zf(Zf({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:i,status:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var i=Zf(Zf({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcDeviceError=function(e,t,i,r,n,o,a,s,c,u,d,l,h,p,_,f,v){void 0===v&&(v={});var m=Zf(Zf({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:i,system_error_code:r,system_api:n,call_parameters:o,location:a,message:s,media_device_id:c,media_device_name:u,elapse:d,scenario:l,event_session_id:h,device_pid:p,device_vid:_,media_mode:f},this.modify_ids),{common_extra_info:JSON.stringify(v)});this.push(m)},t.prototype.rtcVideoDevice=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var i=Zf(Zf(Zf({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcEncodeFirstFrame=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf(Zf(Zf({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcFirstFrameEncoded=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf(Zf(Zf({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcSendFirstPacket=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf(Zf(Zf({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcRecvFirstPacket=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf(Zf(Zf({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcRecvFirstFrame=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf(Zf(Zf({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcDecodeFirstFrame=function(e,t,i){void 0===i&&(i={});var r=Zf(Zf(Zf(Zf({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t}(GD),_L=new pL,fL=new pL,vL=new pL,mL=_L.commonStats,SL=fL.commonStats,yL=vL.commonStats,gL={default:_L,rtm:fL,outsideRoom:vL};function EL(e){void 0===e&&(e="default");for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return function(i,r,n){if("function"==typeof n.value){var o=n.value;n.value=function(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var a={};t.forEach((function(e,t){a[e]=i[t]})),"joinRoom"===r&&mL.setStats({room_id:i[1]}),gL[e].rtcSdkApiCall(r,0,JSON.stringify(_D(i)),a);var s=o.apply(this,i);return"function"==typeof(null==s?void 0:s.then)?s.then((function(t){return gL[e].rtcSdkCallback(r,0,JSON.stringify(_D([t||{}]))),t})).catch((function(t){throw gL[e].rtcSdkCallback(r,t.code,JSON.stringify(t.message)),t})):(gL[e].rtcSdkCallback(r,0,JSON.stringify(_D([s||{}]))),s)}}}}function bL(e,t,i){void 0===i&&(i=0),(e===fD.onUserMessageReceivedOutsideRoom||e===fD.onUserBinaryMessageReceivedOutsideRoom?fL:_L).rtcSdkCallback(e,i,JSON.stringify(t))}function TL(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=!1),(r?fL:_L).rtcInvokeStatus(JSON.stringify(t),i,e,"",0)}var IL=function(){function e(){}return e.prototype.get=function(e){var t=localStorage.getItem(e);if(!t)return null;try{var i=JSON.parse(t);return i.ttl>0&&Date.now()-i.saveTime>i.ttl?(this.delete(e),null):i.message}catch(e){return null}},e.prototype.set=function(e,t,i){void 0===i&&(i=-1);var r={ttl:i,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(r)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),RL=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qf(t,e),t.prototype.getDeviceId=function(){if(cD())return"";var e=this.get("RTC_DEVICE_ID");return e||(e=iD()),this.set("RTC_DEVICE_ID",e),e},t.prototype.setDeviceId=function(e){return[mL,SL,yL].forEach((function(t){return t.setStats({device_id:e})})),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,i){return this.set("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus"),t,1e3*i)},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,i=e.path;return"https://".concat(t).concat(i)}));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.prototype.getAudioProfile=function(){return this.get("engine_BAC")},t.prototype.setAudioProfile=function(e){return this.set("engine_BAC",e)},t}(IL),AL=new RL,CL="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function OL(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var wL="rtc.rtcplus.com".split(","),NL={VERSION:"4.45.0",ICE_CONFIG_REQUEST_URLS_INTERNAL:CL.map(OL),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:"https://web-log-report.rtcplus.com/video/v1/webrtc_log/",CONFIG_REQUEST_DOMAINS:wL,DEVICE_ID:"",OVERSEA:!1};function PL(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(NL.ICE_CONFIG_REQUEST_URLS=t.map(OL))):void("LOG_SERVER_URL"!==e||t!==RP.overseas?"LOG_SERVER_URL"!==e||t!==RP.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?("DEVICE_ID"===e&&AL.setDeviceId(t),NL[e]=t):NL.OVERSEA=t:NL.LOG_SERVER_URL=t:NL.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/":NL.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function DL(e){return"DEVICE_ID"===e?AL.getDeviceId():NL[e]}function kL(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:(null===(i=t.audio)||void 0===i?void 0:i.codec)||WL.audio.codec,bitRate:1e3*((null===(r=t.audio)||void 0===r?void 0:r.kBitRate)||WL.audio.kBitRate),sampleRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.sampleRate)||WL.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||WL.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||WL.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||WL.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||WL.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||WL.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:WL.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||WL.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||WL.video.width,height:(null===(_=t.video)||void 0===_?void 0:_.height)||WL.video.height},layout:{canvas:{bgnd:(null===(f=t.layout)||void 0===f?void 0:f.backgroundColor)||WL.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)||WL.layout.appData}}}}function ML(e,t,i){var r,n,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(r=i.video)||void 0===r?void 0:r.fps)||15,bitrate:1e3*((null===(n=i.video)||void 0===n?void 0:n.kBitRate)||40),width:(null===(o=i.video)||void 0===o?void 0:o.width)||640,height:(null===(a=i.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=i.layout)||void 0===s?void 0:s.interpolationMode)||OP.PREV_FRAME,canvas:{bgColor:(null===(c=i.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=i.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(l=null===(d=i.layout)||void 0===d?void 0:d.regions)||void 0===l?void 0:l.map((function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:e.alpha,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),zorder:e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var UL,LL,xL,VL,FL,BL,jL,GL,HL,zL,KL,WL={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"}},YL={width:640,height:360,frameRate:30,maxKbps:600},XL={width:1920,height:1080,frameRate:15,maxKbps:3e3},qL=NL;!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"}(UL||(UL={})),function(e){e.PushLimitWarn="PushLimitWarn"}(LL||(LL={})),function(e){e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire",e.STREAM_CONTROL_MESSAGE="streamControlMessage",e.ON_SCENE_CONFIG="onSceneConfig"}(xL||(xL={})),function(e){e.RSCP="RSCP"}(VL||(VL={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(FL||(FL={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(BL||(BL={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(jL||(jL={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(HL||(HL={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(zL||(zL={})),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"}(KL||(KL={}));var JL,QL,ZL=((GL={})[KL.SUCCESS]=[0,"success"],GL[KL.TIMEOUT]=[Qw.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],GL[KL.BROKEN]=[Qw.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],GL[KL.NO_RECEIVER]=[Qw.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],GL[KL.NO_RELAYPATH]=[Qw.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],GL[KL.SEND_TO_SERVER_ERROR]=[Qw.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],GL[KL.SERVER_RESPONSE_ERROR]=[Qw.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],GL[KL.NOT_JOIN]=[Qw.USER_MESSAGE_NOT_JOIN,"not join room"],GL[KL.INIT]=[Qw.USER_MESSAGE_INIT,"not init."],GL[KL.NO_CONNECTION]=[Qw.USER_MESSAGE_NO_CONNECTION,"no connection."],GL[KL.EXCEED_MAX_LENGTH]=[Qw.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],GL[KL.EMPTY_USER]=[Qw.USER_MESSAGE_EMPTY_USER,"user id is empty."],GL[KL.NOT_LOGIN]=[Qw.USER_MESSAGE_NOT_LOGIN,"not login."],GL[KL.SERVER_PARAMS_NOTSET]=[Qw.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],GL[KL.UNKNOWN]=[Qw.USER_MESSAGE_UNKNOWN,"unknown."],GL),$L=new BD("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(JL||(JL={})),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"}(QL||(QL={}));var ex=function(e){function t(t){var i=e.call(this)||this;return i._dataChannel=t,i._singlingCache=new Map,i._p2pCache=new Map,i._rttIds={},i._p2pMessageId=0,i._clearDataChannelListener=i._handleHandler(),window.__rtc_mock_signaling__=i.emit.bind(i),i}return Qf(t,e),t.prototype.destroy=function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}},t.prototype.sendSignaling=function(e,t,i){var r=this;return _L.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",kU.UP),new Promise((function(n,o){var a=r._genHeader(i);a.id=lD();var s=a.id.join("-"),c=setTimeout((function(){r._singlingCache.delete(s),o(new tN(Qw.TIME_OUT,"".concat(e," message time out")))}),6e4);r._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),n(e)},error:function(e){clearTimeout(c),o(e)}}),$L.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),r._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:QL.C2GW})},t.prototype.sendP2PMessage=function(e,t){var i=e.msg,r=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i}(e,["msg"]);return 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=i instanceof ArrayBuffer,n=this._sendP2PMessage,o=[Zf({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:HL.SEND,type:zL.P2P,err:KL.SUCCESS},r)],s={binary:e},e?[4,uD.ab2b64str(i)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=i,c.label=3;case 3:return[2,n.apply(this,[Zf.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var i=this;return void 0===t&&(t={}),pD(e.msg)?this._rttIds[e.id]=e.id:e.dir===HL.SEND&&$L.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(r,n){var o=i._genHeader(Zf(Zf({needAck:!0,functionType:QL.C2C},t),{id:lD()}));if(e.dir===HL.SEND){var a=setTimeout((function(){i._p2pCache.delete(e.id),n(new tN(Qw.TIME_OUT,"P2P message timeout"))}),6e4);i._p2pCache.set(e.id,{success:function(e,t){clearTimeout(a),r(t)},error:function(e){clearTimeout(a);var t=rv(ZL[e.err]||[Qw.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),i=t[0],r=t[1];n({code:i,message:e.msg||r})}})}i._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,i){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new tN(Qw.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var r=t.version+(+t.zip<<5)+(+t.encrypt<<6),n=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=uD.str2ab(JSON.stringify([e,i])),a=sD(Uint8Array,nv([r,n],rv(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),i=0,r=t[i++],n=t[i++],o={version:15&r,zip:16==(16&r),encrypt:32==(32&r),needAck:1==(1&n),direction:(2&n)>>1,functionType:(60&n)>>2,binary:64==(64&n)};if(o.needAck||o.direction===JL.ACK){for(;i<=6;i++)if(128!=(128&t[i])){i++;break}o.id=Array.from(t.slice(2,i))}return{header:o,data:t.slice(i)}},t.prototype._feedbackSignaling=function(e,t){var i=this._genHeader({needAck:!0,direction:JL.ACK,id:e.split("-").map((function(e){return+e}))});$L.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),i,"")},t.prototype._handleMessage=function(e){var t,i;return ev(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A,C,O,w,N,P,D,k,M,U,L,x;return tv(this,(function(V){switch(V.label){case 0:r=this._dispartData(e),n=r.header,o=r.data,n.zip&&((a=new lL.Inflate).push(o,!0),o=a.result),s=uD.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&_L.rtcSignalingMsgError(-1,e.message,PU.MESSAGE_PARSE_FAILED),[2]}switch(n.functionType){case QL.C2S:return[3,1];case QL.C2C:return[3,6];case QL.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=n.id)||void 0===t?void 0:t.join("-"))||"",n.direction!==JL.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],$L.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,uD.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=V.sent(),V.label=4;case 4:this.emit(d,Zf({},c)),_L.rtcSignaling(0,s,"on-".concat(d),"Recv",kU.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)===HL.FEEDBACK||pD(null==c?void 0:c.msg)?delete this._rttIds[h]:$L.print("Signal","<<<<<< p2p response",c),c.dir){case HL.SEND:return[3,7];case HL.FEEDBACK:return[3,16]}return[3,17];case 7:return pD(null==c?void 0:c.msg)?[3,15]:(_=(p=c).binary,f=p.msg,v=p.room,m=p.to,S=p.from,y=""===v?_?xL.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:xL.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:_?xL.USER_BINARY_MESSAGE_RECEIVED:xL.USER_MESSAGE_RECEIVED,m?[3,11]:(g=this.emit,E=[xL.ON_CUSTOM_MESSAGE],L={clientId:S,binary:_},_?[4,uD.b64str2ab(f)]:[3,9]));case 8:return b=V.sent(),[3,10];case 9:b=f,V.label=10;case 10:return g.apply(this,E.concat([(L.message=b,L)])),[3,15];case 11:return T=this.emit,I=[y],R=[Zf({},c)],x={},_?[4,uD.b64str2ab(f)]:[3,13];case 12:return A=V.sent(),[3,14];case 13:A=f,V.label=14;case 14:T.apply(this,I.concat([Zf.apply(void 0,R.concat([(x.msg=A,x)]))])),V.label=15;case 15:return this._sendP2PMessage(Zf(Zf({},c),{dir:HL.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===KL.SUCCESS?C.success(c.id,c):C.error(c)),[3,17];case 17:return[3,19];case 18:if(n.direction===JL.ACK)O=(null===(i=n.id)||void 0===i?void 0:i.join("-"))||"",this._handleAckMessage(O,c[0]||{},s);else if(w=rv(c,2),N=w[0],P=w[1],D=void 0===P?{}:P,"RXMediaMsg"===N&&(k=D.type,M=D.data,_L.rtcSignaling(0,s,"on-".concat(k),"Recv",kU.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){$L.print("_handleHandler","dataChannel close",t),e.emit("close",t)},i=function(t){$L.print("_handleHandler","dataChannel error",t),e.emit("close",t)},r=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",i),this._dataChannel.addEventListener("message",r),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",i),e._dataChannel.removeEventListener("message",r)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),Zf({version:2,zip:!1,encrypt:!1,needAck:!0,direction:JL.SEND,functionType:QL.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,i){var r=this._singlingCache.get(e);r&&(this._singlingCache.delete(e),200===t.code?r.success(t):r.error(t),$L.print("Signal","<<<<<< [".concat(r.signalingType,"-ack]"),t)),_L.rtcSignaling(0,i,null==r?void 0:r.signalingType,"Ack",kU.DOWN)},t}(LD.exports.EventEmitter),tx=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,i=e.method,r=e.url,n=e.body,o=void 0===n?{}:n,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,n){var a,c;t.isSending=!0;var d=new XMLHttpRequest;d.open(i,r,!0);try{for(var l=iv(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=rv(h.value,2),_=p[0],f=p[1];d.setRequestHeader(_,f)}}catch(e){a={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(a)throw a.error}}d.onreadystatechange=function(){4===d.readyState&&(t.isSending=!1,200===d.status?e(JSON.parse(d.responseText)):n({message:d.statusText,code:d.status})),0===d.status&&n({code:0,message:"Request abort"})},d.onerror=function(e){t.isSending=!1,n({code:-1,message:d.responseText||"unknown"})},t.timeout&&(d.timeout=t.timeout),u&&(o=JSON.stringify(o)),d.send(o),t.xhr=d}))},e.prototype.get=function(e,t){return this.ajax({method:"GET",url:e,headers:t})},e.prototype.post=function(e,t,i,r){return this.ajax({method:"POST",url:e,body:t,headers:i,stringify:r})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),ix=new BD("ICE Request",3),rx=function(){function e(){this._request=new tx}return e.prototype.getAccessNode=function(e,t,i,r,n,o,a){return ev(this,void 0,void 0,(function(){var s;return tv(this,(function(c){return(s=AL.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,i,r,n,o,a),TL("es.R.node.cache",s),Array.isArray(s)?[2,Promise.resolve(s)]:[2,Promise.resolve([s])]):[2,this.getAccessNodeFromServer(e,t,i,r,n,o,a)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,i,r,n,o,a){return ev(this,void 0,void 0,(function(){var s,c,u=this;return tv(this,(function(d){return s=AL.getAccessUrls(),c=!0,TL("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=qL.ICE_CONFIG_REQUEST_URLS,c=!1,TL("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=qL.ICE_CONFIG_REQUEST_URLS_INTERNAL,c=!1,TL("es.R.req.internal.urls",s)),[2,this.getICEConfigFromServer(s,e,t,i,r,n,o,a).then((function(t){var i=t.nodes;return AL.setAccessNode(e,i,t.ttl||11200),t.dispatchDomains&&AL.setAccessUrls(t.dispatchDomains),i})).catch((function(s){if(c)return TL("es.R.req.fallback",""),AL.clearAccessUrls(),u.getAccessNodeFromServer(e,t,i,r,n,o,a);throw s}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,i,r,n,o,a,s){var c;return ev(this,void 0,void 0,(function(){var i,u,d,l=this;return tv(this,(function(h){return i={appID:t,userID:r,deviceID:n,connectSessionID:oD(),os:"web",sdkVersion:qL.VERSION,isOversea:qL.OVERSEA,expectedAddr:DL("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:s},o&&a&&(i.feedbackInfo=[{feedbackIP:null===(c=a.publicIPs[0])||void 0===c?void 0:c.ip,feedbackReason:{type:"NODE_CHANGED",reason:o}}],delete i.expectedAddr),u=Date.now(),_L.rtcGetAccess(0,JSON.stringify(i),0,wU.REQUEST,e.join(","),i.connectSessionID),d=e.map((function(e,t){return ev(l,void 0,void 0,(function(){var r,n,o;return tv(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this._request.post(e,i)];case 1:return r=a.sent(),[3,3];case 2:throw n=a.sent(),new tN(Qw.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==r.code)throw new tN(Qw.ICE_SERVER_WRONG,"get ICE config failed",{server_code:r.code,message:JSON.stringify(r)});if(!(o=r.nodes[0]))throw new tN(Qw.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:r.code,message:JSON.stringify(r)});return[2,{result:r,firstNode:o,index:t}]}}))}))})),[2,SD(d).then((function(t){var r=t.result;t.firstNode;var n=t.index;return _L.rtcGetAccess(200,JSON.stringify(r),Date.now()-u,wU.RESPONSE,e[n],i.connectSessionID),r})).catch((function(t){var r,n,o=null===(r=t[0])||void 0===r?void 0:r.error;throw _L.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,wU.RESPONSE,e.join(","),i.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(ix.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),nx=function(){function e(){this._request=new tx}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.45.0",deviceType:"web"};this._request.timeout=800;var i=qL.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));_L.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),IU.REQUEST,"",!1);var r=i.map((function(i,r){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(i,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new tN(Qw.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new tN(Qw.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){SD(r).then((function(t){var r=t.result,n=t.index;AL.setH264BlackList(r.web_h264_black_list),_L.rtcGetConfig(200,JSON.stringify(r),0,i[n],IU.RESPONSE,"",!1),e(r.web_h264_black_list)})).catch((function(t){_L.rtcGetConfig(500,t.message,0,"",IU.RESPONSE,"",!1),e(AL.getH264BlackList()||[])}))}))},e.prototype.getAudioProfile=function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.45.0",deviceType:"web"},i=qL.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));_L.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),IU.REQUEST,"",!1);var r=i.map((function(i,r){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(i,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new tN(Qw.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.engine_BAC))throw new tN(Qw.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){SD(r).then((function(t){var r=t.result,n=t.index;AL.setAudioProfile(r.engine_BAC),_L.rtcGetConfig(200,JSON.stringify(r),0,i[n],IU.RESPONSE,"",!1),e(r.engine_BAC)})).catch((function(t){_L.rtcGetConfig(500,t.message,0,"",IU.RESPONSE,"",!1),e(AL.getAudioProfile()||[])}))}))},e}();function ox(e,t){var i=1,r=e;(e.width>t.width||e.height>t.height)&&(i=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,r={width:Math.floor(e.width/i),height:Math.floor(e.height/i)});return Zf(Zf({},r),{scaleResolutionDownBy:i})}var ax=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],sx=[{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 cx={width:160,height:90,frameRate:15,maxkbps:100},ux={width:480,height:270,frameRate:15,maxkbps:400};function dx(e){if(!e.length)return[];var t=e.shift(),i=t.width/t.height,r=0,n=0,o=Zf(Zf({},t),{video_index:n,sub_index:r++});delete o.rid;for(var a=[o],s=0,c=0;c<ax.length;c++)if(ax[c].height<t.height){s=c;break}var u=e.shift();for(c=s;c<ax.length;c++){var d=ax[c];if(u&&d.height<=(null==u?void 0:u.height)){var l=d.height===(null==u?void 0:u.height),h=Zf(Zf({},u),{video_index:++n,sub_index:r++});if(delete h.rid,a.push(h),u=e.shift(),l)continue}a.push(Zf(Zf({},d),{width:Math.floor(d.height*i),video_index:n,sub_index:r++}))}return a}var lx,hx,px,_x,fx="chrome-stable"===dD();!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"}(lx||(lx={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(hx||(hx={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(px||(px={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(_x||(_x={}));var vx,mx,Sx,yx=function(){function e(e){this.peer=e,this.stats=[]}return e.prototype.handleCodec=function(e){return e},e.prototype.handleInboundRtp=function(e){return e},e.prototype.handleOutboundRtp=function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e},e.prototype.handleRemoteInboundRtp=function(e){return e},e.prototype.handleRemoteOutboundRtp=function(e){return e},e.prototype.handleMediaSource=function(e){return e},e.prototype.handleCsrc=function(e){return e},e.prototype.handlePeerConnection=function(e){return e},e.prototype.handleDataChannel=function(e){return e},e.prototype.handleStream=function(e){return e},e.prototype.handleTrack=function(e){return e},e.prototype.handleTransceiver=function(e){return e},e.prototype.handleSender=function(e){return e},e.prototype.handleReceiver=function(e){return e},e.prototype.handleTransport=function(e){return e},e.prototype.handleSctpTransport=function(e){return e},e.prototype.handleCandidatePair=function(e){return e},e.prototype.handleLocalCandidate=function(e){return e},e.prototype.handleRemoteCandidate=function(e){return e},e.prototype.handleCertificate=function(e){return e},e.prototype.handleIceServer=function(e){return e},e.prototype.processStats=function(e){var t=this;e.forEach((function(e){var i;switch(e.type){case lx.candidatePair:i=t.handleCandidatePair;break;case lx.certificate:i=t.handleCertificate;break;case lx.remoteCandidate:i=t.handleRemoteCandidate;break;case lx.remoteInboundRtp:i=t.handleInboundRtp;break;case lx.remoteOutboundRtp:i=t.handleOutboundRtp;break;case lx.sctpTransport:i=t.handleSctpTransport;break;case lx.sender:i=t.handleSender;break;case lx.stream:i=t.handleStream;break;case lx.track:i=t.handleTrack;break;case lx.transceiver:i=t.handleTransceiver;break;case lx.transport:i=t.handleTransport;break;case lx.codec:i=t.handleCodec;break;case lx.csrc:i=t.handleCsrc;break;case lx.dataChannel:i=t.handleDataChannel;break;case lx.iceServer:i=t.handleIceServer;break;case lx.mediaSource:i=t.handleMediaSource;break;case lx.outboundRtp:i=t.handleOutboundRtp;break;case lx.inboundRtp:i=t.handleInboundRtp;break;case lx.peerConnection:i=t.handlePeerConnection;break;case lx.receiver:i=t.handleReceiver;break;case lx.localCandidate:i=t.handleLocalCandidate;break;default:i=function(e){return e}}i=i.bind(t),t.stats.push(i(e))}))},e.prototype.getExtraStats=function(e){return ev(this,void 0,void 0,(function(){var t=this;return tv(this,(function(i){return[2,new Promise((function(i,r){if(!fx||void 0!==window.InstallTrigger)return i(t.stats);try{t.peer.getStats((function(r){r.result().forEach((function(i){if(!gx.includes(i.type)){var r={};i.names().forEach((function(e){r[e]=i.stat(e)})),r.id=i.id,r.type=i.type,r.timestamp=i.timestamp,"ssrc"===r.type&&e&&e.id?e.id===r.googTrackId&&t.stats.push(r):t.stats.push(r)}})),i(t.stats)}))}catch(e){r(e)}}))]}))}))},e.prototype.getStats=function(e,t){return ev(this,void 0,void 0,(function(){var i;return tv(this,(function(r){switch(r.label){case 0:return r.trys.push([0,7,,8]),[4,this.peer.getStats(e)];case 1:i=r.sent(),this.processStats(i),r.label=2;case 2:return r.trys.push([2,5,,6]),t?[3,4]:[4,this.getExtraStats(e)];case 3:r.sent(),r.label=4;case 4:return[3,6];case 5:return r.sent(),[3,6];case 6:return[3,8];case 7:return r.sent(),[3,8];case 8:return[2,this.stats]}}))}))},e}(),gx=["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"],Ex=function(e,t,i){return ev(void 0,void 0,void 0,(function(){var r;return tv(this,(function(n){switch(n.label){case 0:return r=[],e instanceof RTCPeerConnection?[4,new yx(e).getStats(t,i)]:[2,r];case 1:return[2,r=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"}(vx||(vx={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(mx||(mx={})),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"}(Sx||(Sx={}));var bx,Tx=function(){return ev(void 0,void 0,void 0,(function(){var e,t,i,r,n,o,a;return tv(this,(function(s){switch(s.label){case 0:if(bx)return[2,bx];e=[],s.label=1;case 1:return s.trys.push([1,5,,6]),[4,mD()];case 2:return(t=s.sent())?(null==t?void 0:t.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"))||(null==t?void 0:t.includes("profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1"))||(null==t?void 0:t.includes("packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1"))?(i=navigator.userAgent.toLowerCase(),r=!1,n=["heytapbrowser","mqqbrowser","miuibrowser"],[4,(new nx).getH264BlackList()]):[3,4]:[2,e];case 3:for(o=s.sent(),n.push.apply(n,nv([],rv(o),!1)),a=0;a<n.length;a++)i.includes(n[a])&&(r=!0);!r&&e.push("H264"),s.label=4;case 4:return(null==t?void 0:t.includes("VP8"))&&e.push("vp8"),bx=e,[2,e];case 5:return s.sent(),[2,e];case 6:return[2]}}))}))},Ix=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},Rx=new BD("BasicHandler",3),Ax={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!Ix()||void 0},Cx=function(e){function t(t,i){var r=e.call(this)||this;return r._offerIce={},r._answerIce={},r._initSctpEvents=!1,r.monitor=t,r._peerConnection=new RTCPeerConnection(Ax),r._dataChannel=r._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),r._context=i,r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,i;Rx.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){Rx.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,NU["".concat(e.toUpperCase())])},r}return Qf(t,e),t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){Rx.print("destroy"),this.disconnect(),this._context=void 0},t.prototype._simulcast=function(e,t,i,r,n){var o=[],a=function(e){for(var t=0,i=e.width*e.height,r=0;r<sx.length;r++)if(i>=sx[r].totalPixels){t=r;break}if(0===t)return sx[t].maxLayers;var n=sx[t-1].totalPixels;return(n-i)/(n-sx[t].totalPixels)<.1?sx[t-1].maxLayers:sx[t].maxLayers}(t);Rx.print("simulcast() ","maxLayers: %o",a),1===e.videoEncodeConfig.length?(o=function(e,t){var i=[];if(t<=1)return i;var r=1,n=1;return e.width/e.height>16/9?(r=e.width/cx.width,n=e.width/ux.width):(r=e.height/cx.height,n=e.height/ux.height),i.push({maxkbps:cx.maxkbps,scaleResolutionDownBy:r,frameRate:cx.frameRate,width:Math.floor(e.width/r),height:Math.floor(e.height/r)}),t<=2||r>2&&i.unshift({maxkbps:ux.maxkbps,scaleResolutionDownBy:n,frameRate:ux.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),i}(i,a),Rx.print("simulcast() ","simulcastLayers: %o",o)):(o=e.videoEncodeConfig.slice(1).slice(1-a).map((function(e){return Zf({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},ox(i,e))})),Rx.print("simulcast() ","simulcastLayers2: %o",o)),o.forEach((function(e,t){var i={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:e.scaleResolutionDownBy,rid:"".concat(t+1),maxFramerate:e.frameRate};r.sendEncodings&&r.sendEncodings.unshift(i),n.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))},t.prototype.internalPublish=function(e,t){var i=e.stream,r=e.videoTrack,n=e.audioTrack,o=e.enableSimulcast,a=e.pubAudio,s=e.pubVideo,c={direction:"sendonly",streams:[i]},u={direction:"sendonly",streams:[i]},d=[],l=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var h=null==r?void 0:r.getTrack(),p={width:640,height:360,frameRate:30};if(h){var _=null==h?void 0:h.getSettings();p={width:Math.floor(_.width),height:Math.floor(_.height),frameRate:Math.floor(_.frameRate)}}var f=null==e?void 0:e.videoEncodeConfig[0],v=ox(p,f);e.prevScaleResolutionDownBy=v.scaleResolutionDownBy,e.videoInputConfig=p;var m={maxBitrate:1e3*f.maxKbps,scaleResolutionDownBy:v.scaleResolutionDownBy,rid:"0",maxFramerate:f.frameRate||15};u.sendEncodings=[m],d.push({width:v.width,height:v.height,framerate:f.frameRate,maxkbps:f.maxKbps,rid:"0"}),o&&(this._simulcast(e,v,p,u,d),(null==t?void 0:t.simulcastOnDemand)&&(l=dx(nv([],rv(d),!1))),Rx.print("subVideoDesc","desc: %o ",l))}Rx.print("publish videoTransceiverInit videoDescriptions","",u,d);var S=null==n?void 0:n.getTrack();(null==n?void 0:n.mixType)!==mx.PLAYOUT&&(null==n?void 0:n.mixedAudioTrack)&&(S=null==n?void 0:n.mixedAudioTrack),S=a&&S?S:"audio";var y=null==r?void 0:r.getTrack();return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:S,vTrack:y=s&&y?y:"video",audioTransceiverInit:c,videoTransceiverInit:u}}},t.prototype.updateScaleResolutionDownBy=function(e){var t,i,r;return ev(this,void 0,void 0,(function(){var n,o,a,s,c,u,d;return tv(this,(function(l){return Rx.print("updateScaleResolutionDownBy()"),n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver,n&&e.pubVideo&&o?(a=null==n?void 0:n.getSettings(),s={width:Math.floor(a.width),height:Math.floor(a.height),frameRate:Math.floor(a.frameRate)},(c=ox(s,e.videoEncodeConfig[0])).scaleResolutionDownBy===e.prevScaleResolutionDownBy&&Rx.print("updateScaleResolutionDownBy()","no change %o",e.prevScaleResolutionDownBy),(u=null===(i=o.sender)||void 0===i?void 0:i.getParameters())&&(d=c.scaleResolutionDownBy/e.prevScaleResolutionDownBy,u.encodings=null===(r=null==u?void 0:u.encodings)||void 0===r?void 0:r.map((function(t){var i;Math.max(t.scaleResolutionDownBy=(t.scaleResolutionDownBy||1)*d,1);var r=+t.rid||0;return t.maxFramerate=(null===(i=e.videoEncodeConfig[r])||void 0===i?void 0:i.frameRate)||t.maxFramerate,t})),e.prevScaleResolutionDownBy=c.scaleResolutionDownBy,e.videoInputConfig=s,null==o||o.sender.setParameters(u)),[2]):(Rx.print("updateScaleResolutionDownBy()","no pub"),[2])}))}))},t.prototype.getStats=function(e,t){return Ex(this._peerConnection,e,t)},t.prototype.setLocalDescription=function(e,t){var i;return ev(this,void 0,void 0,(function(){var r,n,o,a=this;return tv(this,(function(s){switch(s.label){case 0:r=aD(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:e}))];case 2:return s.sent(),this.monitor.rtcSetDescription(0,e,LU.W_1,"local"===(null==t?void 0:t.streamUserId)?xU.UP:xU.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",aD()-r,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(n=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(n.onstatechange=function(){a.monitor.rtcInvokeStatus("sctp state change TO: ".concat(n.state),0,"sctp","",0)},n.transport&&(n.transport.onstatechange=function(){var e;a.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null===(e=null==n?void 0:n.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),[3,4];case 3:return o=s.sent(),this.monitor.rtcSetDescription(-1,o.message,LU.W_1,"local"===(null==t?void 0:t.streamUserId)?xU.UP:xU.DOWN,"","",aD()-r,{type:"offer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t){return ev(this,void 0,void 0,(function(){var i,r;return tv(this,(function(n){switch(n.label){case 0:i=aD(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e}))];case 2:return n.sent(),this.monitor.rtcSetDescription(0,e,LU.W_0,"local"===(null==t?void 0:t.streamUserId)?xU.UP:xU.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",aD()-i,{type:"answer"}),[3,4];case 3:return r=n.sent(),this.monitor.rtcSetDescription(-1,r.message,LU.W_1,"local"===(null==t?void 0:t.streamUserId)?xU.UP:xU.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",aD()-i,{type:"answer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){return[2]}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t}(LD.exports.EventEmitter),Ox={},wx={},Nx={exports:{}},Px=Nx.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(Px).forEach((function(e){Px[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},i=function(e,i,r){var n=e.name&&e.names;e.push&&!i[e.push]?i[e.push]=[]:n&&!i[e.name]&&(i[e.name]={});var o=e.push?{}:n?i[e.name]:i;!function(e,i,r,n){if(n&&!r)i[n]=t(e[1]);else for(var o=0;o<r.length;o+=1)null!=e[o+1]&&(i[r[o]]=t(e[o+1]))}(r.match(e.reg),o,e.names,e.name),e.push&&i[e.push].push(o)},r=Nx.exports,n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(n).forEach((function(e){var t=e[0],n=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(r[t]||[]).length;s+=1){var c=r[t][s];if(c.reg.test(n))return i(c,a,n)}})),t.media=o,t};var o=function(e,i){var r=i.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&i.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var i=[],r=e.split(" ").map(t),n=0;n<r.length;n+=3)i.push({component:r[n],ip:r[n+1],port:r[n+2]});return i},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var i,r=!1;return"~"!==e[0]?i=t(e):(i=t(e.substring(1,e.length)),r=!0),{scid:i,paused:r}}))}))}}(wx);var Dx=Nx.exports,kx=/%[sdv%]/g,Mx=function(e){var t=1,i=arguments,r=i.length;return e.replace(kx,(function(e){if(t>=r)return e;var n=i[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(n);case"%d":return Number(n);case"%v":return""}}))},Ux=function(e,t,i){var r=[e+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var n=0;n<t.names.length;n+=1){var o=t.names[n];t.name?r.push(i[t.name][o]):r.push(i[t.names[n]])}else r.push(i[t.name]);return Mx.apply(null,r)},Lx=["v","o","s","i","u","e","p","c","b","t","r","z","a"],xx=["i","c","b","a"],Vx=wx,Fx=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var i=t.outerOrder||Lx,r=t.innerOrder||xx,n=[];return i.forEach((function(t){Dx[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(Ux(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(Ux(t,i,e))}))}))})),e.media.forEach((function(e){n.push(Ux("m",Dx.m[0],e)),r.forEach((function(t){Dx[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(Ux(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(Ux(t,i,e))}))}))}))})),n.join("\r\n")+"\r\n"};Ox.write=Fx,Ox.parse=Vx.parse,Ox.parseParams=Vx.parseParams,Ox.parseFmtpConfig=Vx.parseFmtpConfig,Ox.parsePayloads=Vx.parsePayloads,Ox.parseRemoteCandidates=Vx.parseRemoteCandidates,Ox.parseImageAttributes=Vx.parseImageAttributes,Ox.parseSimulcastStreamList=Vx.parseSimulcastStreamList;var Bx=Math.pow(2,32),jx=function(){return Math.floor(Math.random()*Bx+1e3)},Gx=function(e,t,i){return i||(i=jx()),[{id:i,attribute:"cname",value:"kp34Za0H+aVf862l"},{id:i,attribute:"msid",value:"".concat(e.id," ").concat(e.id,"-").concat(t)},{id:i,attribute:"mslabel",value:"".concat(e.id)},{id:i,attribute:"label",value:"".concat(e.id,"-").concat(t)}]};function Hx(e){return e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.bundleOnly,e}var zx=function(e,t,i){var r=Zf(Zf({},e),{invalid:[{value:"realx-exts:rscp"}],media:[t,i]});return delete r.groups,delete r.msidSemantic,Ox.write(r)};function Kx(e){return ev(this,void 0,void 0,(function(){var t,i,r,n,o;return tv(this,(function(a){switch(a.label){case 0:return t={},i=e.publicIPs,r=e.certFingerprint,n=e.iceParams,t.fingerprint={type:"sha-256",hash:r},t.icePwd=n.serverIcePwd,o=t,[4,Wx(n.serverIceUfrag)];case 1:return o.iceUfrag=a.sent(),mL.setStats({connection_id:t.iceUfrag}),t.candidates=function(e){if(!Array.isArray(e))return[];var t=0,i=2130706431,r=[];return e.forEach((function(e){var n={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){r.push(Zf(Zf({},n),{foundation:t++,transport:"udp",port:e,priority:i}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){r.push(Zf(Zf({},n),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:i-1e3}))}))})),r}(i),t.setup="active",t.iceOptions="renomination",[2,t]}}))}))}var Wx=function(e){return ev(void 0,void 0,void 0,(function(){var t,i,r,n,o,a,s;return tv(this,(function(c){switch(c.label){case 0:return t=new TextEncoder,i=t.encode("PREC"),n=Uint8Array.bind,[4,uD.b64str2ab(e)];case 1:return r=new(n.apply(Uint8Array,[void 0,c.sent()])),o=t.encode(Date.now().toString()).slice(-4),(a=new Uint8Array(2))[0]=0,a[1]=1,s=sD(Uint8Array,i,r,o,a),[4,uD.ab2b64str(s.buffer)];case 2:return[2,c.sent()]}}))}))},Yx=T,Xx=Ku,qx=Lv.exports.getWeakData,Jx=Pt,Qx=j,Zx=$u,$x=Md,eV=Ue,tV=bi.set,iV=bi.getterFor,rV=kn.find,nV=kn.findIndex,oV=Yx([].splice),aV=0,sV=function(e){return e.frozen||(e.frozen=new cV)},cV=function(){this.entries=[]},uV=function(e,t){return rV(e.entries,(function(e){return e[0]===t}))};cV.prototype={get:function(e){var t=uV(this,e);if(t)return t[1]},has:function(e){return!!uV(this,e)},set:function(e,t){var i=uV(this,e);i?i[1]=t:this.entries.push([e,t])},delete:function(e){var t=nV(this.entries,(function(t){return t[0]===e}));return~t&&oV(this.entries,t,1),!!~t}};var dV,lV={getConstructor:function(e,t,i,r){var n=e((function(e,n){Zx(e,o),tV(e,{type:t,id:aV++,frozen:void 0}),null!=n&&$x(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=iV(t),s=function(e,t,i){var r=a(e),n=qx(Jx(t),!0);return!0===n?sV(r).set(t,i):n[r.id]=i,e};return Xx(o,{delete:function(e){var t=a(this);if(!Qx(e))return!1;var i=qx(e);return!0===i?sV(t).delete(e):i&&eV(i,t.id)&&delete i[t.id]},has:function(e){var t=a(this);if(!Qx(e))return!1;var i=qx(e);return!0===i?sV(t).has(e):i&&eV(i,t.id)}}),Xx(o,i?{get:function(e){var t=a(this);if(Qx(e)){var i=qx(e);return!0===i?sV(t).get(e):i?i[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),n}},hV=r,pV=T,_V=Ku,fV=Lv.exports,vV=Im,mV=lV,SV=j,yV=Hv,gV=bi.enforce,EV=ei,bV=!hV.ActiveXObject&&"ActiveXObject"in hV,TV=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},IV=vV("WeakMap",TV,mV);if(EV&&bV){dV=mV.getConstructor(TV,"WeakMap",!0),fV.enable();var RV=IV.prototype,AV=pV(RV.delete),CV=pV(RV.has),OV=pV(RV.get),wV=pV(RV.set);_V(RV,{delete:function(e){if(SV(e)&&!yV(e)){var t=gV(this);return t.frozen||(t.frozen=new dV),AV(this,e)||t.frozen.delete(e)}return AV(this,e)},has:function(e){if(SV(e)&&!yV(e)){var t=gV(this);return t.frozen||(t.frozen=new dV),CV(this,e)||t.frozen.has(e)}return CV(this,e)},get:function(e){if(SV(e)&&!yV(e)){var t=gV(this);return t.frozen||(t.frozen=new dV),CV(this,e)?OV(this,e):t.frozen.get(e)}return OV(this,e)},set:function(e,t){if(SV(e)&&!yV(e)){var i=gV(this);i.frozen||(i.frozen=new dV),CV(this,e)?wV(this,e,t):i.frozen.set(e,t)}else wV(this,e,t);return this}})}var NV,PV=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),!cD()&&t.refreshDevices(),t}return Qf(t,e),t.prototype.refreshDevices=function(){return ev(this,void 0,void 0,(function(){var e=this;return tv(this,(function(t){switch(t.label){case 0:return navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2];case 1:return t.sent().forEach((function(t){var i;null===(i=e.deviceMap[t.kind])||void 0===i||i.set(t.deviceId,t)})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e;return 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,i=this;return tv(this,(function(r){switch(r.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return e=r.sent(),t=Array.from(nv(nv(nv([],rv(this.deviceMap.audioinput.values()),!1),rv(this.deviceMap.videoinput.values()),!1),rv(this.deviceMap.audiooutput.values()),!1)),e.forEach((function(e){var t=i.deviceMap[e.kind].get(e.deviceId);i.deviceMap[e.kind].set(e.deviceId,e),t||(e.kind.includes("video")?i.emit(fD.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&i.emit(fD.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),t.forEach((function(t){e.find((function(e){return e.deviceId===t.deviceId&&e.kind===t.kind}))||(i.deviceMap[t.kind].delete(t.deviceId),t.kind.includes("video")?i.emit(fD.onVideoDeviceStateChanged,{mediaDeviceInfo:t,deviceState:"inactive"}):t.kind.includes("audio")&&i.emit(fD.onAudioDeviceStateChanged,{mediaDeviceInfo:t,deviceState:"inactive"}))})),[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 tN(Qw.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 tN(Qw.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasAudioPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasAudioPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasAudioPermission]}}))}))},t.prototype.enumerateDevices=function(){return 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([],rv(this.deviceMap.audioinput.values()),!1),rv(this.deviceMap.videoinput.values()),!1),rv(this.deviceMap.audiooutput.values()),!1))]}}))}))},t.prototype.enumerateAudioCaptureDevices=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())]}}))}))},t.prototype.enumerateVideoCaptureDevices=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.videoinput.values())]}}))}))},t.prototype.enumerateAudioPlaybackDevices=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.audiooutput.values())]}}))}))},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.enumerateDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},Object.defineProperty(t.prototype,"hasAudioPermission",{get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new tN(Qw.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 tN(Qw.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}(GD),DV=new PV,kV=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}(),MV=function(){function e(e){var t=UV.getAudioContextInstance();if(e instanceof MediaStreamTrack){var i=new MediaStream;i.addTrack(e),this._audioSource=t.createMediaStreamSource(i)}else e instanceof AudioNode?this._audioSource=e:(this._audioSource=t.createMediaElementSource(e),this._audioSource.connect(t.destination));var r=t.createAnalyser();this._audioSource.connect(r),this._analyserNode=r,this._ctx=t}return e.prototype.getAudioLevel=function(){var e;"suspended"===(null===(e=this._ctx)||void 0===e?void 0:e.state)&&this._ctx.resume();var t=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(t);var i=0;return t.forEach((function(e){return i=Math.max(i,Math.abs(e-128))})),i/128*255},e.prototype.destroy=function(){this._audioSource.disconnect(),this._analyserNode.disconnect()},e}(),UV=new kV,LV=new BD("VERTC",0),xV=new WeakMap,VV=function(e){return xV.get(e)},FV=function(e){function t(t,i){var r=e.call(this)||this;return r._trackId=t,r.mediaType=i,r}return Qf(t,e),t.prototype.getId=function(){return this._trackId},t}(GD),BV=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n._initListeners(),n}return Qf(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(){_L.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(FV),jV=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n}return Qf(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(FV),GV=function(e){function t(t,i){var r=e.call(this,t,i,"video")||this;return r.dummy=!1,r.resolution={width:0,height:0},r}return Qf(t,e),t.prototype.updateVideoCaptureConfig=function(){return ev(this,void 0,void 0,(function(){var e;return tv(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig&&this.getTrack()?(LV.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),[4,this.getTrack().applyConstraints(this.videoCaptureConfig)]):[2];case 1:return t.sent(),((e=this.getTrack().getSettings()).width&&e.width!==this.resolution.width||e.height&&e.height!==this.resolution.height)&&(this.resolution={width:e.width,height:e.height},this.emit("resolution-change",this.resolution)),[2]}}))}))},t.prototype.replaceTrack=function(e){this.setTrack(e)},t}(BV),HV=function(e){function t(t,i){var r=e.call(this,t,i,"audio")||this;return r.mixType=mx.PLAYOUT_AND_PUBLISH,r}return Qf(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new MV(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?(LV.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}(BV),zV=function(e){function t(t,i){return e.call(this,t,i,"video")||this}return Qf(t,e),t}(jV),KV=function(e){function t(t,i){return e.call(this,t,i,"audio")||this}return Qf(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new MV(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(jV),WV=function(e){function t(t,i){return e.call(this,t,i)||this}return Qf(t,e),t}(HV),YV=function(e){function t(t,i){return e.call(this,t,i)||this}return Qf(t,e),t}(GV),XV=function(e){function t(t,i){return e.call(this,t,i)||this}return Qf(t,e),t}(GV),qV=function(e){function t(t,i){return e.call(this,t,i)||this}return Qf(t,e),t}(HV),JV=function(e){function t(t,i){return e.call(this,t,i)||this}return Qf(t,e),t}(GV),QV=function(e){function t(t,i){return e.call(this,t,i)||this}return Qf(t,e),t}(HV);function ZV(e){var t;return ev(this,void 0,void 0,(function(){var i,r,n,o,a,s;return tv(this,(function(c){switch(c.label){case 0:r=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",c.label=1;case 1:return c.trys.push([1,3,,4]),LV.print("createCameraVideoTrack","constraints:",e),_L.rtcVideoCaptureEvent({event_type:nL.START,media_device_id:r}),n=aD(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return i=c.sent(),_L.rtcVideoCaptureEvent({event_type:nL.START_CAPTURE_RESULT,media_device_id:r,reason:aL.SUCCESS,elapse:aD()-n}),DV.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),_L.rtcVideoCaptureEvent({event_type:nL.RUNNING_FAILED,media_device_id:r,error_code:o.code,reason:o.name+o.message}),new tN(Qw.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=i.getVideoTracks()[0],xV.set(a,i),(s=new YV(a,oD())).videoCaptureConfig=e,[2,s]}}))}))}function $V(e,t){var i;return ev(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p;return tv(this,(function(_){switch(_.label){case 0:LV.print("createCameraVideoTrack","constraints:",e),n=(null===(i=null==e?void 0:e.deviceId)||void 0===i?void 0:i.exact)||"default",a=(o=t||{}).sampleRate,s=o.channel,c=o.agc,u=o.ans,d=o.aec,void 0===e.sampleRate&&(e.sampleRate=a),void 0===e.channelCount&&(e.channelCount=s),void 0===e.autoGainControl&&(e.autoGainControl=c),void 0===e.noiseSuppression&&(e.noiseSuppression=u),void 0===e.echoCancellation&&(e.echoCancellation=d),_.label=1;case 1:return _.trys.push([1,3,,4]),_L.rtcVideoCaptureEvent({event_type:nL.START,media_device_id:n}),l=aD(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return r=_.sent(),_L.rtcVideoCaptureEvent({event_type:nL.START_CAPTURE_RESULT,media_device_id:n,reason:aL.SUCCESS,elapse:aD()-l}),DV.hasAudioPermission=!0,[3,4];case 3:throw h=_.sent(),_L.rtcVideoCaptureEvent({event_type:nL.RUNNING_FAILED,media_device_id:n,error_code:h.code,reason:h.name+h.message}),new tN(Qw.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",h);case 4:return p=r.getAudioTracks()[0],xV.set(p,r),[2,new WV(p,oD())]}}))}))}function eF(e,t){return void 0===e&&(e=!1),ev(this,void 0,void 0,(function(){var i,r,n;return tv(this,(function(o){switch(o.label){case 0:LV.print("createScreenStream","withAudio:",e),o.label=1;case 1:return o.trys.push([1,3,,4]),_L.rtcVideoCaptureEvent({event_type:nL.START,media_device_id:"screen"}),r=aD(),[4,navigator.mediaDevices.getDisplayMedia({video:t||!0,audio:e})];case 2:return i=o.sent(),_L.rtcVideoCaptureEvent({event_type:nL.START_CAPTURE_RESULT,media_device_id:"screen",reason:aL.SUCCESS,elapse:aD()-r}),[3,4];case 3:throw n=o.sent(),_L.rtcVideoCaptureEvent({event_type:nL.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.name+n.message}),new tN(Qw.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,i]}}))}))}!function(e){e[e.NONE=0]="NONE"}(NV||(NV={}));var tF,iF,rF=function(){function e(){}return e.getNalunits=function(t){if(t.length-t.position<4)return[];var i=t.position;return 1===t.getInt32(i)||0===t.getInt16(i)&&1===t.getInt8(i+2)?e.getAnnexbNals(t):e.getAvccNals(t)},e.getAnnexbNals=function(t){for(var i=[],r=e.getHeaderPositionAnnexB(t),n=r.pos,o=n;n<t.length-4;){var a=new Uint8Array(t.buffer.slice(n,n+r.headerLength));r.pos===t.position&&t.skip(r.headerLength),o=(r=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(n+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&i.push(s),t.skip(o-t.position),n=o}return i},e.getAvccNals=function(t){for(var i=[];t.position<t.length-4;){var r=t.getInt32(t.position);if(!(t.length-t.position>=r))break;var n=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+r));t.skip(r);var a={header:n,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&i.push(a)}return i},e.analyseNal=function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}},e.getHeaderPositionAnnexB=function(e){for(var t=e.position,i=0,r=e.length;3!==i&&4!==i&&t<r-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?i=4:1===e.getInt8(t+2)?i=3:t++:t++;return t===r-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?i=4:t=r:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?i=3:t=r)),{pos:t,headerLength:i}},e.getAvcc=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength+11);i[0]=1,i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=255,i[5]=225;var r=6;return i.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),r),r+=2,i.set(e,r),i[r+=e.byteLength]=1,r++,i.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),r),r+=2,i.set(t,r),i},e}(),nF=function(){function e(e){this._position=0,this._dataview=new DataView(e)}return Object.defineProperty(e.prototype,"length",{get:function(){return this.buffer.byteLength},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._dataview.buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),e.prototype.back=function(e){this.position-=e},e.prototype.getUint8=function(e){return this._dataview.getUint8(e)},e.prototype.getInt8=function(e){return this._dataview.getInt8(e)},e.prototype.getInt16=function(e){return this._dataview.getInt16(e)},e.prototype.getUint16=function(e){return this._dataview.getUint16(e)},e.prototype.getUint32=function(e){return this._dataview.getUint32(e)},e.prototype.getInt32=function(e){return this._dataview.getInt32(e)},e.prototype.skip=function(t){for(var i=Math.floor(t/4),r=t%4,n=0;n<i;n++)e.readByte(this,4);r>0&&e.readByte(this,r)},e.readByte=function(e,t,i){var r;switch(t){case 1:r=i?e.getInt8(e.position):e.getUint8(e.position);break;case 2:r=i?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(i)throw new Error("not supported for readByte 3");r=e.getUint8(e.position)<<16,r|=e.getUint8(e.position+1)<<8,r|=e.getUint8(e.position+2);break;case 4:r=i?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(i)throw new Error("not supported for readBody 8");r=e.getUint32(e.position)<<32,r|=e.getUint32(e.position+4);break;default:r=""}return e.position+=t,r},e.prototype.readUint8=function(){return e.readByte(this,1)},e.prototype.readUint16=function(){return e.readByte(this,2)},e.prototype.readUint24=function(){return e.readByte(this,3)},e.prototype.readUint32=function(){return e.readByte(this,4)},e.prototype.readUint64=function(){return e.readByte(this,8)},e.prototype.readInt8=function(){return e.readByte(this,1,!0)},e.prototype.readInt16=function(){return e.readByte(this,2,!0)},e.prototype.readInt32=function(){return e.readByte(this,4,!0)},e.prototype.writeUint32=function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])},e}();!function(e){e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass"}(tF||(tF={})),function(e){e[e.invalid=0]="invalid",e[e.cfgResolution=1]="cfgResolution",e[e.bitstreamHash=2]="bitstreamHash",e[e.screenCodec=3]="screenCodec"}(iF||(iF={}));var oF=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),aF=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]);function sF(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function cF(e,t){void 0===t&&(t=0);for(var i=0;255===e[t]&&t<e.byteLength;)t++,i+=255;return t<e.byteLength&&(i+=e[t++]),[i,t]}var uF=function(){function e(){}return e.generateSEI=function(e,t){void 0===t&&(t=!1);var i=new Uint8Array([0,0,0,1]),r=new Uint8Array([6]),n=new Uint8Array([5]),o=t?oF:aF,a=sF(e.byteLength+o.byteLength),s=function(e){for(var t=[],i=0;i<e.length;i++)e[i]<=3&&0===e[i-1]&&0===e[i-2]&&t.push(3),t.push(e[i]);return new Uint8Array(t)}(e);return new Uint8Array(nv(nv(nv(nv(nv(nv(nv([],rv(i),!1),rv(r),!1),rv(n),!1),rv(a),!1),rv(o),!1),rv(s),!1),[128],!1))},e.decodeSeiBody=function(e){var t=function(e){for(var t=[],i=0;i<e.length;i++)e[i]<=3&&0===e[i-1]&&0===e[i-2]||t.push(e[i]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var i=0;if(5===t[1]||100===t[1]){var r=rv(cF(t,i+=2),2),n=r[0];i=r[1];var o=tF.bypass,a=i+n;return t.byteLength>=aF.byteLength&&n>=aF.byteLength&&t.slice(i,i+aF.byteLength).toString()===aF.toString()?(i+=aF.byteLength,o=tF.external):t.byteLength>=aF.byteLength&&n>=aF.byteLength&&t.slice(i,i+oF.byteLength).toString()===oF.toString()&&(i+=oF.byteLength,o=tF.internal),{type:o,payload:t.slice(i,a)}}}},e.parseInternalSEI=function(e){var t=new Map,i=0;if(e.type===tF.internal){for(;e.payload.byteLength-i>=2;){var r=rv(cF(e.payload,i),2),n=r[0];i=r[1];var o=rv(cF(e.payload,i),2),a=o[0];if(i=o[1],t.get(n)||!(a<e.payload.byteLength-i))break;t.set(n,e.payload.slice(i,i+a))}return t}},e.makeInternalSei=function(e){var t,i,r=[];try{for(var n=iv(e),o=n.next();!o.done;o=n.next()){var a=rv(o.value,2),s=a[0],c=a[1],u=sF(s),d=sF(c.byteLength);r.push(u,d,c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}var l=r.reduce((function(e,t){return e+t.byteLength}),0),h=new Uint8Array(l);return r.reduce((function(e,t){return h.set(t,e),e+t.byteLength}),0),h},e}();Br({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new BD("Stats",2);var dF,lF,hF,pF,_F,fF,vF=function(){function e(e){this._stream=e}return e.prototype.setVar=function(e,t,i){this.client=e,this.handler=t,this.monitor=i},e.prototype.delStatsEvtInterval=function(){clearTimeout(this._timer),this._timer=void 0},e.prototype.destroy=function(){this.delStatsEvtInterval()},e}(),mF=function(e){function t(t){var i=e.call(this,t)||this;return i._stream=t,i}return Qf(t,e),t.prototype.setLocalStreamStatsEvtInterval=function(e,t,i){var r,n,o=this;if(!this._timer){this.setVar(e,t,i),e.once(FL.ABNORMAL_DISCONNECTION,(function(){o.destroy()}));var a={audio:{},video:{}},s=this._stream,c=null===(r=s.audioTrack)||void 0===r?void 0:r.getTrack(),u=null===(n=s.videoTrack)||void 0===n?void 0:n.getTrack();this.getAudioStats(c,a),this.getVideoStats(u,a),this.delStatsEvtInterval();this._timer=setTimeout((function e(){return ev(o,void 0,void 0,(function(){var t,i;return tv(this,(function(r){switch(r.label){case 0:return[4,ev(o,void 0,void 0,(function(){var e,t,i,r,n,o;return tv(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getAudioStats(e,a)];case 1:return i=c.sent(),[4,this.getVideoStats(t,a)];case 2:return r=c.sent(),[2,{audioStats:i,videoStats:r,isScreen:s.isScreen}]}}))}))];case 1:return t=r.sent(),null===(i=this.client)||void 0===i||i.emit("onLocalStreamStats",t),this._timer=setTimeout(e,2e3),[2]}}))}))}),2e3)}},t.prototype.unpublish=function(){this.delStatsEvtInterval()},t.prototype.getAudioStats=function(e,t){return ev(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l;return tv(this,(function(h){switch(h.label){case 0:return i={},r={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.audioMid,s=n.isScreen,c=n.pubAttributes,u={media_type:"audio",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localaudio?"capture_state_on":"capture_state_off"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(d=h.sent()).length?(d.forEach((function(e){var t=e.type,n=e.packetsSent,o=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,d=e.channels,l=e.audioLevel,h=e.googRtt,p=e.mimeType,_=e.availableIncomingBitrate,f=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,S=e.id,y=e.currentRoundTripTime,g=e.state,E=e.writable,b=e.requestsReceived,T=e.responsesReceived,I=e.requestsSent,R=e.consentRequestsSent,A=e.responsesSent,C=e.jitter,O=e.candidateType,w=e.ip,N=e.address,P=e.networkType,D=e.port,k=e.protocol,M=e.nackCount,U=e.retransmittedBytesSent,L=e.retransmittedPacketsSent,x=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType,H=e.fractionLost;"outbound-rtp"===t?(r.packetsSent=n,r.bytesSent=a,u.bytes=a,u.packetsSent=n,u.nackCount=M,u.ssrc=F,u.retransmitted_bytes_sent=U,u.retransmitted_packets_sent=L,r.retransmittedPacketsSent=L):"remote-inbound-rtp"===t?(r.packetsLost=o,u.packetsLost=o,u.jitter=1e3*C,i.rtt=1e3*c,u.rtt=i.rtt,u.round_trip_time_measurements=x,i._fractionLost=H||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=d,u.codecName=p):"media-source"===t?(u.audio_level=l?-10*Math.log10(Math.pow(l,2)):l,u.volume=255*l,u.total_audio_energy=B,u.total_samples_duration=j):"ssrc"===t&&"audio"===G?(u.audio_network_elapse=h,u.send_level=V):"candidate-pair"===t?(u.ice_available_incoming_bitrate=_,u.ice_available_outgoing_bitrate=f,u.ice_bytes_received=v,u.ice_bytes_sent=a,u.ice_nominated=+m,u.ice_pair_id=S,u.ice_pair_rtt=y,u.ice_pair_state=g,u.ice_pair_writable=E,u.recv_ping_requests=b,u.recv_ping_responses=T,u.sent_ping_requests_before_first_response=I,u.sent_ping_requests_total=I+(R||0),u.sent_ping_responses=A):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=w||N,u.local_network_type=P,u.local_port=D,u.protocol=k):"remote-candidate"===t&&(u.remote_candidate_type=O,u.remote_ip=w||N,u.remote_port=D)})),(l=t.audio).timestamp?(void 0!==r.packetsLost&&(i.audioLossRate=(r.packetsLost-l.packetsLost)/(r.packetsSent-l.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,u.fraction_lost=i.audioLossRate),i.statsInterval=r.timestamp-l.timestamp,u.stats_interval=i.statsInterval,i.sendKBitrate=(r.bytesSent-l.bytesSent||0)/i.statsInterval*8,u.bitrate=Math.round(1e3*i.sendKBitrate),u.bandwidth=Math.round(u.bitrate/1024),t.audio=r,this.monitor.rtcMediaStatistics(u,{}),i._retransmittedRate=(r.retransmittedPacketsSent-l.retransmittedPacketsSent)/(r.packetsSent-l.packetsSent),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),[2,i]):(t.audio=r,[2,i])):[2,i]}}))}))},t.prototype.getVideoStats=function(e,t){return ev(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,_,f;return tv(this,(function(v){switch(v.label){case 0:return i={},r={timestamp:Date.now(),simulcast:{}},n=this._stream,o=n.streamId,a=n.videoMid,s=n.isScreen,c=n.pubAttributes,u=n.enableSimulcast,d={media_type:"video",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localvideo?"capture_state_on":"capture_state_off"},e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 1:return(l=v.sent()).length?(h=0,l.forEach((function(e){var t=e.type,n=e.framesEncoded,o=e.packetsLost,a=e.bytesSent,s=e.framesSent,c=e.roundTripTime,l=e.mimeType,p=e.frameWidth,_=e.frameHeight,f=e.packetsSent,v=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,S=e.googAvailableSendBandwidth,y=e.googAvgEncodeMs,g=e.googBucketDelay,E=e.googEncodeUsagePercent,b=e.googFrameRateInput,T=e.availableIncomingBitrate,I=e.availableOutgoingBitrate,R=e.bytesReceived,A=e.nominated,C=e.id,O=e.currentRoundTripTime,w=e.state,N=e.writable,P=e.candidateType,D=e.ip,k=e.address,M=e.networkType,U=e.port,L=e.nackCount,x=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,K=e.responsesSent,W=e.ssrc,Y=e.googTargetEncBitrate,X=e.googTransmitBitrate,q=e.googRtt,J=e.retransmittedPacketsSent,Q=e.encoderImplementation,Z=e.jitter,$=e.rid,ee=e.fractionLost;"outbound-rtp"===t?(u&&($?r.simulcast[$]=e:r.simulcast[h]=e,h++),r.framesEncoded=n,r.bytesSent=a,r.framesSent=s,d.bytes=a,r.packetsSent=f,d.packetsSent=f,d.nackCount=L,d.pli_count=x,d.qp_sum=F,d.ssrc=W,d.retransmitted_packets_sent=J,r.retransmittedPacketsSent=J,d.encoder_implementation=Q):"track"===t?(i.encodedFrameWidth=p,i.encodedFrameHeight=_,d.frame_size_height=_,d.frame_size_width=p):"remote-inbound-rtp"===t?(r.packetsLost=o,i.rtt=1e3*c,d.rtt=i.rtt,d.jitter=Z,d.packetsLost=o,i._fractionLost=ee||0):"codec"===t?(i.codecType=l,d.codecName=l):"candidate-pair"===t?(d.ice_available_incoming_bitrate=T,d.ice_available_outgoing_bitrate=I,d.ice_bytes_received=R,d.ice_bytes_sent=a,d.ice_nominated=+A,d.ice_pair_id=C,d.ice_pair_rtt=O,d.ice_pair_state=w,d.ice_pair_writable=N,d.recv_ping_requests=B,d.recv_ping_responses=j,d.sent_ping_requests_before_first_response=H,d.sent_ping_requests_total=H+z,d.sent_ping_responses=K):"local-candidate"===t?(d.local_candidate_type=P,d.local_ip=D||k,d.local_network_type=M,d.local_port=U,d.protocol=V):"remote-candidate"===t?(d.remote_candidate_type=P,d.remote_ip=D||k,d.remote_port=U):"VideoBwe"===t?(d.encBitratebps=v,d.available_receive_bandwidth=m,d.available_send_bandwidth=S,d.bucket_delay=g,d.retransmitBitratebps=G,d.targetEncBitratebps=Y,d.transmit_bitrate=X,i._sendBandWidth=+S):"ssrc"===t&&(d.video_network_elapse=q,d.avg_encode_ms=y,d.encodeUsage=E,d.frame_rate_input=b,d.orignal_input_Framerate=+b)})),(p=t.video).timestamp?(i.statsInterval=r.timestamp-p.timestamp,d.stats_interval=i.statsInterval,_=Object.keys(r.simulcast),u?(d.sim_enc_width=[],d.sim_enc_height=[],d.sim_enc_bps=[],d.sim_enc_framerate=[],d.sim_rids=[],d.sim_enc_bandwidth=[],d.sim_sent_framerate=[],d.sim_fraction_lost=[],f=!1,_.sort((function(e,t){return+e-+t})).forEach((function(e){var t=r.simulcast[e],n=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,l=t.packetsSent,h=t.qualityLimitationReason,_=t.qualityLimitationDurations,v=t.qualityLimitationResolutionChanges,m=t.retransmittedPacketsSent;void 0!==h&&(d.sim_qualityLimitationReason||(d.sim_qualityLimitationReason=[],d.sim_qualityLimitationDurations=[],d.sim_qualityLimitationResolutionChanges=[]),d.sim_qualityLimitationReason.push(h),d.sim_qualityLimitationDurations.push(_),d.sim_qualityLimitationResolutionChanges.push(v));var S=p.simulcast[e];if(d.sim_enc_width.push(n||0),d.sim_enc_height.push(o||0),S){var y=(a-S.bytesSent||0)/i.statsInterval;d.sim_enc_bps.push(Math.round(8e3*y)),d.sim_enc_bandwidth.push(Math.round(8e3*y/1024));var g=1e3*(s-S.framesEncoded)/i.statsInterval;d.sim_enc_framerate.push(Math.round(g)),d.sim_rids.push(e);var E=void 0!==c?c-S.framesSent:s-S.framesEncoded,b=1e3*E/i.statsInterval;d.sim_sent_framerate.push(Math.round(b));var T=(u-S.packetsLost)/(l-S.packetsSent);i._retransmittedRate=(m-S.retransmittedPacketsSent)/(l-S.packetsSent),T=Number.isNaN(T)?0:T,d.sim_fraction_lost.push(T),n>0&&!f&&(i.sentKBitrate=8*y,i.encoderOutputFrameRate=g,i.encodedFrameCount=E,i.sentFrameRate=b,i.videoLossRate=T,f=!0)}})),this.monitor.rtcMediaStatistics(d,{})):(i.encodedFrameCount=void 0!==r.framesSent?r.framesSent-p.framesSent:r.framesEncoded-p.framesEncoded,i.sentKBitrate=(r.bytesSent-p.bytesSent||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.sentKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.encoderOutputFrameRate=1e3*(r.framesEncoded-p.framesEncoded)/i.statsInterval,d.frame_rate_encoded=Math.round(i.encoderOutputFrameRate),i.sentFrameRate=1e3*i.encodedFrameCount/i.statsInterval,d.frame_rate_sent=Math.round(i.sentFrameRate),i.videoLossRate=(r.packetsLost-p.packetsLost)/(r.packetsSent-p.packetsSent),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,d.fraction_lost=i.videoLossRate,i._retransmittedRate=(r.retransmittedPacketsSent-p.retransmittedPacketsSent)/(r.packetsSent-p.packetsSent),this.monitor.rtcMediaStatistics(d,{})),t.video=r,i._fractionLost=Math.max(i._fractionLost,i.videoLossRate),[2,i]):(t.video=r,[2,i])):[2,i]}}))}))},t}(vF),SF=function(e){function t(t){var i=e.call(this,t)||this;return i._videoInWaiting=!1,i}return Qf(t,e),Object.defineProperty(t,"audioStallConfig",{set:function(e){t.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,t.audioStallRatio=null==e?void 0:e.audio_stall_ratio},enumerable:!1,configurable:!0}),t.prototype.setRemoteStreamStatsEvtInterval=function(e,i,r){var n,o;return ev(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,_,f,v,m=this;return tv(this,(function(S){switch(S.label){case 0:return this._timer?[2]:(this.setVar(e,i,r),e.once(FL.ABNORMAL_DISCONNECTION,(function(){m.destroy()})),this._audioStallInterval=t.audioStallInterval||100,this._audioStallRatio=t.audioStallRatio||.6,a={audio:{},video:{}},s=this._stream,c=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),u=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),this.getRemoteVideoStats(u,a),[4,this.getRemoteAudioStats(c,a)]);case 1:return S.sent(),this.delStatsEvtInterval(),d=0,l=0,p=[],_=0,this._setAudioStallCount=function(){if(m._audioStallInterval>0&&void 0!==a.audio.concealedSamples){var e=a.audio.concealedSamples,t=a.audio.totalSamplesReceived,i=aD(),r={isStall:!1,counted:!1,diff:0},n=.5*m._audioStallInterval;m._audioStallCount=function(){return ev(m,void 0,void 0,(function(){var o,a,c,u,h,f,v,m,S,y,g,E,b,T,I;return tv(this,(function(R){switch(R.label){case 0:return o=s.hasAudio,a=s.subAudio,o&&a?(c=null===(I=s.audioTrack)||void 0===I?void 0:I.getTrack(),u=Date.now(),[4,this.handler.getStats(c,!0)]):(r.isStall=!1,r.counted=!1,p.push({reason:"hasAudio: ".concat(o,", subAudio: ").concat(a)}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:_}]);case 1:return h=R.sent(),f=Date.now(),v=aD(),(m=v-i)<n?(p.push({diff:m,start:i,end:v,get_stats_cost:f-u,get_stats_start:u,get_stats_end:f,reason:"diff(".concat(m,") < minInterval(").concat(n,")")}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:_}]):(S=h.length,y=h.find((function(e){return"inbound-rtp"===e.type})),y?(g=y.concealedSamples,E=y.totalSamplesReceived,T=E-t,(b=g-e)>=0&&T>=0&&b>=this._audioStallRatio*T?(p.push({concealed:b,received:T,diff:m,start:i,end:v,get_stats_cost:f-u,get_stats_start:u,get_stats_end:f,is_stall:!0}),r.isStall?(r.counted?l+=m:(l=l+r.diff+m,d++),r.counted=!0):m>=200?(l+=m,d++,r.counted=!0):(r.counted=!1,r.diff=m),r.isStall=!0):(p.push({concealed:b,received:T,diff:m,start:i,end:v,get_stats_cost:f-u,get_stats_start:u,get_stats_end:f}),r.isStall=!1,r.counted=!1),e=g,t=E,i=v,_++,[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:_}]):(p.push({diff:m,start:i,end:v,get_stats_cost:f-u,get_stats_start:u,get_stats_end:f,reason:S?"no inbound-rtp":"no report"}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:_}]))}}))}))},h=function(){return ev(m,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),this._audioStallCount?[4,this._audioStallCount()]:[3,2];case 1:e.sent(),this._audioStallTimer=setTimeout(h,this._audioStallInterval),e.label=2;case 2:return[2]}}))}))},m._audioStallTimer=setTimeout(h,m._audioStallInterval)}},this._setAudioStallCount(),f=function(){return ev(m,void 0,void 0,(function(){var e,t,i,r,n,o;return tv(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getRemoteAudioStats(e,a)];case 1:return i=c.sent(),d=0,l=0,p=[],_=0,[4,this.getRemoteVideoStats(t,a)];case 2:return r=c.sent(),[2,{audioStats:i,videoStats:r,isScreen:s.isScreen,userId:s.userId}]}}))}))},v=function(){return ev(m,void 0,void 0,(function(){var e,t;return tv(this,(function(i){switch(i.label){case 0:return[4,f()];case 1:return e=i.sent(),null===(t=this.client)||void 0===t||t.emit("onRemoteStreamStats",e),h&&(this._audioStallTimer=setTimeout(h,this._audioStallInterval)),this._timer=setTimeout(v,2e3),[2]}}))}))},this._timer=setTimeout(v,2e3),[2]}}))}))},t.prototype.delStatsEvtInterval=function(){e.prototype.delStatsEvtInterval.call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0},t.prototype.unsubscribe=function(){this.delStatsEvtInterval(),this._videoInWaiting=!1},t.prototype.getRemoteAudioStats=function(e,t){return ev(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y;return tv(this,(function(g){switch(g.label){case 0:return i={},r={},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.audioMid,u=n.subMediaType,d=n._attributes,l={media_type:"audio",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:c,connection_status:navigator.onLine,mute_state:gD(u)?"mute_state_off":"mute_state_on",remote_user_capture_state:d.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:d.localaudio&&d.audiostream?"mute_state_off":"mute_state_on"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(h=g.sent()).length?(h.forEach((function(e){var t=e.type,n=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,h=e.totalSamplesReceived,p=e.concealedSamples,_=e.silentConcealedSamples,f=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,S=e.currentRoundTripTime,y=e.audioLevel,g=e.totalAudioEnergy,E=e.totalSamplesDuration,b=e.mimeType,T=e.googDecodingNormal,I=e.fecPacketsReceived,R=e.availableIncomingBitrate,A=e.availableOutgoingBitrate,C=e.bytesSent,O=e.nominated,w=e.id,N=e.writable,P=e.jitter,D=e.candidateType,k=e.ip,M=e.address,U=e.networkType,L=e.port,x=e.protocol,V=e.audioOutputLevel,F=e.requestsReceived,B=e.responsesReceived,j=e.requestsSent,G=e.consentRequestsSent,H=e.responsesSent,z=e.ssrc,K=e.kind;"inbound-rtp"===t?(r.packetsLost=n,r.packetsReceived=o,l.packetsReceived=o,r.bytesReceived=a,l.bytes=a,void 0!==s&&(i.jitterBufferDelay=s/c*1e3,l.average_jitter_buffer_delay_ms=i.jitterBufferDelay),void 0!==h&&(r.totalSamplesReceived=h,i.concealedSamples=p,r.concealedSamples=p,r.silentConcealedSamples=_,l.concealedSamples=p,i.concealmentEvents=f,l.totalSamplesReceived=h),void 0!==I&&(l.fec_packets_received=I),l.jitter=1e3*P,l.ssrc=z):"codec"===t?(i.recordSampleRate=u,d&&(i.numChannels=d),l.codecName=b):"candidate-pair"===t?(l.ice_available_incoming_bitrate=R,l.ice_available_outgoing_bitrate=A,l.ice_bytes_received=a,l.ice_bytes_sent=C,l.ice_nominated=+O,l.ice_pair_id=w,l.ice_pair_rtt=S,l.rtt=1e3*S,l.ice_pair_state=m,l.ice_pair_writable=N,l.recv_ping_requests=F,l.recv_ping_responses=B,l.sent_ping_requests_before_first_response=j,l.sent_ping_requests_total=j+(G||0),l.sent_ping_responses=H,"succeeded"===m&&(i.rtt=1e3*S,i.total_rtt=1e3*v)):"track"===t&&"audio"===K?(l.audio_level=y?-10*Math.log10(Math.pow(y,2)):y,l.volume=255*y,l.total_audio_energy=g,l.totalAudioDuration=E):"ssrc"===t?(l.decodingNormal=T,l.recvAudioLevel=V):"local-candidate"===t?(l.local_candidate_type=D,l.local_ip=k||M,l.local_network_type=U,l.local_port=L,l.protocol=x):"remote-candidate"===t&&(l.remote_candidate_type=D,l.remote_ip=k||M,l.remote_port=L)})),(p=t.audio).timestamp?(_={},void 0!==r.concealedSamples&&(l.interval_concealed_samples=r.concealedSamples-p.concealedSamples,l.interval_samples_received=r.totalSamplesReceived-p.totalSamplesReceived,l.interval_silent_concealed_samples=r.silentConcealedSamples-p.silentConcealedSamples),this._audioStallInterval>0&&void 0!==p.concealedSamples?(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),this._audioStallCount?[4,this._audioStallCount()]:[3,3]):[3,3]):(r.timestamp=Date.now(),t.audio=r,[2,i])):[2,i];case 2:f=g.sent(),v=f.stall_count,m=f.stall_duration,S=f.stall_list,y=f.stats_count,_.stall_list=S,_.stats_count=y,l.concealedSamples===l.interval_concealed_samples&&l.totalSamplesReceived===l.interval_samples_received?(l.stall_count=0,l.stall_duration=0):(l.stall_count=v,l.stall_duration=m),i.stallCount=l.stall_count,i.stallDuration=l.stall_duration,g.label=3;case 3:return r.timestamp=Date.now(),i.audioLossRate=(r.packetsLost-p.packetsLost)/(r.packetsReceived-p.packetsReceived+(r.packetsLost-p.packetsLost)),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,l.packetsLost=Math.round(r.packetsLost-p.packetsLost),l.fraction_lost=i.audioLossRate,l.packets_lost_rate=i.audioLossRate,i.statsInterval=r.timestamp-p.timestamp,l.stats_interval=i.statsInterval,i.receivedKBitrate=(r.bytesReceived-p.bytesReceived||0)/i.statsInterval*8,l.bitrate=Math.round(1e3*i.receivedKBitrate),l.bandwidth=Math.round(l.bitrate/1024),void 0!==r.concealedSamples&&(i.receivedSampleRate=1e3*l.interval_samples_received/i.statsInterval),t.audio=r,this.monitor.rtcMediaStatistics(l,{},_),[2,i]}}))}))},t.prototype.getRemoteVideoStats=function(e,t){return ev(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h;return tv(this,(function(p){switch(p.label){case 0:return i={},r={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.subMediaType,u=n._attributes,d={media_type:"video",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:this._stream.videoMid,connection_status:navigator.onLine,mute_state:ED(c)?"mute_state_off":"mute_state_on",remote_user_capture_state:u.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:u.localvideo&&u.videostream?"mute_state_off":"mute_state_on"},e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 1:return(l=p.sent()).length?(l.forEach((function(e){var t=e.type,n=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,c=e.bytesReceived,u=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,_=e.firCount,f=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,S=e.nominated,y=e.id,g=e.currentRoundTripTime,E=e.state,b=e.writable,T=e.candidateType,I=e.ip,R=e.address,A=e.networkType,C=e.port,O=e.nackCount,w=e.pliCount,N=e.protocol,P=e.requestsReceived,D=e.responsesReceived,k=e.requestsSent,M=e.consentRequestsSent,U=e.responsesSent,L=e.ssrc;e.kind;var x=e.jitter,V=e.framesReceived,F=e.keyFramesDecoded,B=e.totalDecodeTime,j=e.decoderImplementation,G=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(r.packetsLost=a,d.packetsLost=a,r.packetsReceived=s,d.packetsReceived=s,r.bytesReceived=c,d.bytes=c,r.framesDecoded=u,void 0!==l&&(r.jitterBufferDelay=l/h*1e3,d.average_jitter_buffer_delay_ms=r.jitterBufferDelay),d.fir_count=_,d.nackCount=O,r.nackCount=O,d.pli_count=w,d.ssrc=L,d.jitter=x,d.framesReceived=V,r.framesReceived=V,d.framesDecoded=u,d.key_frames_decoded=F,d.total_decode_time=B,d.decoder_name=j,d.last_packet_received_timestamp=G):"track"===t&&void 0!==o?(i.width=o,d.frame_size_width=o,i.height=n,d.frame_size_height=n,void 0!==V&&(d.framesReceived=V,r.framesReceived=V)):"codec"===t?d.codecName=p:"candidate-pair"===t?(d.ice_available_incoming_bitrate=f,d.ice_available_outgoing_bitrate=v,d.ice_bytes_received=c,d.ice_bytes_sent=m,d.ice_nominated=+S,d.ice_pair_id=y,d.ice_pair_rtt=g,d.rtt=1e3*g,i.rtt=d.rtt,d.ice_pair_state=E,d.ice_pair_writable=b,d.recv_ping_requests=P,d.recv_ping_responses=D,d.sent_ping_requests_before_first_response=k,d.sent_ping_requests_total=k+(M||0),d.sent_ping_responses=U):"local-candidate"===t?(d.local_candidate_type=T,d.local_ip=I||R,d.local_network_type=A,d.local_port=C,d.protocol=N):"remote-candidate"===t&&(d.remote_candidate_type=T,d.remote_ip=I||R,d.remote_port=C)})),(h=t.video).timestamp?(i.videoLossRate=(r.packetsLost-h.packetsLost)/(r.packetsReceived-h.packetsReceived+(r.packetsLost-h.packetsLost)),i._retransmittedRate=(r.nackCount-h.nackCount)/(r.packetsReceived-h.packetsReceived+(r.packetsLost-h.packetsLost)),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,d.fraction_lost=i.videoLossRate,d.packets_lost_rate=i.videoLossRate,i.statsInterval=r.timestamp-h.timestamp,d.stats_interval=i.statsInterval,i.receivedKBitrate=(r.bytesReceived-h.bytesReceived||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.decoderOutputFrameRate=1e3*(r.framesDecoded-h.framesDecoded)/i.statsInterval,i.receivedFrameRate=1e3*(r.framesReceived-h.framesReceived)/i.statsInterval,d.frame_rate_decoded=Math.round(i.decoderOutputFrameRate),d.frame_rate_received=d.frame_rate_decoded,t.video=r,this.processStall(this._stream,d,i,s),this.monitor.rtcMediaStatistics(d,{}),[2,i]):(t.video=r,[2,i])):[2,i]}}))}))},t.prototype.processStall=function(e,t,i,r){var n=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(n+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,n=this._videoInWaiting?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=n,r?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,i.stallCount=n,i.stallDuration=o},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1},t}(vF);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(dF||(dF={})),function(e){e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_PUBLISH_STATE_CHANGE="on_user_publish_state_change",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error",e.ON_NETWORK_QUALITY="on_network_quality",e.ON_SIMULCAST_SUBSCRIBE_FALLBACK="on_simulcast_subscribe_fallback",e.ON_REMOTE_VIDEO_SIZE_CHANGED="on_remote_video_size_changed",e.RECONNECT_FAILED="reconnect_failed"}(lF||(lF={})),function(e){e.TranscodeStateChanged="TranscodeStateChanged",e.TranscodeStarted="TranscodeStarted",e.TranscodeUpdated="TranscodeUpdated",e.TranscodeStoped="TranscodeStoped"}(hF||(hF={})),function(e){e[e.START=1]="START",e[e.START_SUCCESS=2]="START_SUCCESS",e[e.START_FAILED=3]="START_FAILED",e[e.UPDATE=4]="UPDATE",e[e.UPDATE_SUCCESS=5]="UPDATE_SUCCESS",e[e.UPDATE_FAILED=6]="UPDATE_FAILED",e[e.STOP=7]="STOP",e[e.STOP_SUCCESS=8]="STOP_SUCCESS",e[e.STOP_FAILED=9]="STOP_FAILED"}(pF||(pF={})),function(e){e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB"}(_F||(_F={})),function(e){e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB"}(fF||(fF={}));var yF,gF=new BD("Stream",0);!function(e){e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED"}(yF||(yF={}));var EF,bF,TF,IF,RF=function(){function e(){this.isScreen=!1,this.seiList=[],this.videoEncodeConfig=[YL],this.subVideoDescriptions=[],this.enableSimulcast=!1,this.prevScaleResolutionDownBy=1,this.pubAudio=!1,this.pubVideo=!1,this.stream=new MediaStream,this.videoInputConfig={width:640,height:360,frameRate:30},this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new mF(this)}return Object.defineProperty(e.prototype,"hasPublished",{get:function(){return this.videoTransceiver&&this.audioTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),e.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(Ix()){var i=t.createEncodedStreams(),r=i.readable,n=i.writable,o=new TransformStream({transform:function(t,i){var r=e.seiList[0];if(r){var n=uF.generateSEI(r.content),o=new Uint8Array(n.byteLength+t.data.byteLength);0===r.repeatCount&&e.seiList.splice(0,1),r.repeatCount--,o.set(new Uint8Array(t.data)),o.set(n,t.data.byteLength),t.data=o.buffer,i.enqueue(t)}else i.enqueue(t)}});r.pipeThrough(o).pipeTo(n)}}else gF.print("no sender found when trying to bind encodedTransform")},e.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,i=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(i)}else gF.print("no sender found when trying to bind encodedTransform")},e.prototype.clean=function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]},e.prototype.switchTrackEnableState=function(e,t){var i;"audio"===e?i=this.audioTrack:"video"===e&&(i=this.videoTrack);var r=null==i?void 0:i.getTrack();return!(!r||(null==r?void 0:r.enabled)===t)&&(r.enabled=t,!0)},e}(),AF=function(e){function t(t,i,r,n,o){void 0===o&&(o=NP.LOW);var a=e.call(this)||this;return a.userPriority=o,a.originalStreamIndex=0,a.userId=t,a.isScreen=r,a.streamId=i,a.hasAudio=n.audiostream&&n.localaudio,a.hasVideo=n.videostream&&n.localvideo,a._attributes=n,a.subVideo=!1,a.subAudio=!1,a._sequenceId=0,a.subMediaType=NV.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=yF.INIT,a.statsReport=new SF(a),a}return Qf(t,e),Object.defineProperty(t.prototype,"sequenceId",{get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSubscribed",{get:function(){return this.streamState===yF.SUB_ED},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),i=t.readable,r=t.writable;i.pipeThrough(new TransformStream({transform:function(t,i){var r=rF.getNalunits(new nF(t.data)).find((function(e){return e.sei}));if(r){var n=uF.decodeSeiBody(r.body);n&&n.type!==tF.internal&&e.safeEmit("onSEIMessage",n.payload)}i.enqueue(t)}})).pipeTo(r)}else gF.print("no receiver found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,i=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(i)}else gF.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,i,r;if((null===(i=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===i?void 0:i.id)===this.streamId){var n=e.track;"video"===(null==n?void 0:n.kind)?this._setVideoTrack(n):"audio"===(null===(r=e.track)||void 0===r?void 0:r.kind)&&this._setAudioTrack(n),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){var e;gF.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()},t.prototype.resetHasSubscribed=function(){this.streamState=yF.INIT},t.prototype.setRemoteUserPriority=function(e){this.userPriority=e},t.prototype.getStreamPriority=function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e},t.prototype.getSubscribeFallbackParams=function(e){if(e!==wP.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,fF.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===wP.AUDIO_ONLY)return[EP.VIDEO,fF.UNSUB]}return null},t.prototype.getSubscribeRecoverParams=function(){if(this.originalMediaType&&ED(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,fF.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,fF.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null},t.prototype._setStream=function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}},t.prototype._setAudioTrack=function(e){var t,i;(null===(i=null===(t=this.audioTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new KV(e,oD()),this.emit("ontrack",this.audioTrack))},t.prototype._setVideoTrack=function(e){var t,i;(null===(i=null===(t=this.videoTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new zV(e,oD()),this.emit("ontrack",this.videoTrack))},t.prototype._getSubLayerBySpatialLayer=function(e){var t=this._attributes,i=t.videoDescriptions,r=t.subVideoDescriptions,n=void 0===r?[]:r,o=i[e],a=o.width,s=o.height,c=n.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}},t}(GD),CF=new BD("queue",4);!function(e){e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE"}(TF||(TF={})),function(e){e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack"}(IF||(IF={}));var OF,wF,NF,PF=((EF={})[IF.publish]="unpublish",EF[IF.unpublish]="publish",EF[IF.subscribe]="unsubscribe",EF[IF.unsubscribe]="subscribe",EF[IF.pushtrack]="removetrack",EF[IF.removetrack]="pushtrack",EF),DF=((bF={})[IF.publish]=TF.ADD,bF[IF.subscribe]=TF.ADD,bF[IF.pushtrack]=TF.ADD,bF[IF.unpublish]=TF.CLOSE,bF[IF.unsubscribe]=TF.CLOSE,bF[IF.removetrack]=TF.CLOSE,bF),kF=function(e){function t(){var t=e.call(this)||this;return t._queue=[],t}return Qf(t,e),Object.defineProperty(t.prototype,"queue",{get:function(){return this._queue},enumerable:!1,configurable:!0}),t.prototype.enqueue=function(e){var t=this._queue.length,i="";return this._queue=this._queue.filter((function(t){return t.streamId!==e.streamId||e.action!==PF[t.action]||(i=t.streamId,CF.print("offsetStreamId",i),!1)})),this._queue.length===t&&this._queue.push(e),1===this._queue.length&&this.emit("start"),i},t.prototype.dequeue=function(){if(!this._queue.length)return null;for(var e=DF[this._queue[0].action],t=1;t<this._queue.length;t++)if(DF[this._queue[t].action]!==e)return{sdpStrategy:e,items:this._queue.splice(0,t)};return{sdpStrategy:e,items:this._queue.splice(0,this._queue.length)}},t}(xD),MF=new BD("ChromeHandler",3),UF=Ix(),LF=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="chrome",r._queueBusy=!1,r._mid=0,r._offerMlines=[],r._answerMlines=[],r._inactiveMlineIndex=[],r._msidIndexMap={},r._mlinesCache={},r._sdpQueue=new kF,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(MF.print("dequeue start"),r.dequeue())})),r}return Qf(t,e),t.prototype.connect=function(e){var t,i;return ev(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return tv(this,(function(d){switch(d.label){case 0:return MF.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},r=this,[4,Kx(e)];case 1:return r._answerIce=d.sent(),[4,this._peerConnection.createOffer()];case 2:return n=d.sent(),o=Ox.parse(n.sdp),a=rv(o.media,1),s=a[0],this._offerIce.fingerprint=o.fingerprint||s.fingerprint,delete o.media,this._offerSession=Zf({},o),this._answerSession=Zf({},o),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),c=this._mid++,this._offerMlines=[Zf(Zf(Zf({},s),this._offerIce),{mid:"".concat(c)})],this._answerMlines=[Zf(Zf(Zf({},s),this._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(c)})],this.setDescription(),[4,new Promise((function(e,t){u._dataChannel.onopen=function(){MF.print("connect","dataChannel open"),TL("es.dc.open",""),e("")},u._dataChannel.onerror=function(e){_L.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,PU.INVALID_DATA),TL("es.dc.error",""),t(e)},u._dataChannel.onclose=function(e){TL("es.dc.close",""),t(e)},u._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==u._peerConnection.iceConnectionState&&"closed"!==u._peerConnection.iceConnectionState&&"failed"!==u._peerConnection.connectionState||t(e)}))}))];case 3:return d.sent(),MF.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){e.prototype.destroy.call(this),this._mlinesCache={}},t.prototype.publish=function(t,i){return ev(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E;return tv(this,(function(b){return r=t.stream,n=t.enableSimulcast,o=e.prototype.internalPublish.call(this,t,i),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,u="".concat(this._mid++),d="".concat(this._mid++),l=Zf(Zf(Zf({},this._aSendonlyOfferTpl),this._offerIce),{mid:u,msid:"".concat(r.id," ").concat(r.id,"-audio"),ssrcs:Gx(r,"audio")}),h=Zf(Zf(Zf({},this._vSendonlyOfferTpl),this._offerIce),{mid:d,msid:"".concat(r.id," ").concat(r.id,"-video")}),n?(MF.print("subVideoDesc","desc: %o ",s),delete h.ssrcGroups,delete h.ssrcs,p=[],h.rids=a.map((function(e){var t=e.rid;return p.unshift(t),{id:t,direction:"send"}})),h.simulcast={dir1:"send",list1:p.join(";")}):(_=function(e,t){var i=jx(),r=jx();return{ssrcs:[i,r].reduce((function(i,r){return i.concat(Gx(e,t,r))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(i," ").concat(r)}]}}(r,"video"),f=_.ssrcs,v=_.ssrcGroups,h.ssrcs=f,h.ssrcGroups=v),(null==i?void 0:i.audioRed)&&Array.isArray(l.rtp)&&-1!==(m=l.rtp.findIndex((function(e){return"red"===e.codec})))&&(S=rv(l.rtp.splice(m,1),1),y=S[0],l.rtp.unshift(y)),(g=null==l?void 0:l.rtp.find((function(e){return"opus"===e.codec})))&&l.fmtp&&(E=l.fmtp.find((function(e){return e.payload===g.payload})))&&this._context&&(E.config+=this._context.audioProfileManager.getOpusConfigStr()),this._mlinesCache[t.stream.id]=[l,h],[2,{partialSdp:zx(this._offerSession,l,h),audioMid:u,videoMid:d,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}))}))},t.prototype.subscribe=function(e,t){return ev(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l;return tv(this,(function(h){switch(h.label){case 0:return MF.print("subscribe","mids: ",t),i="incroffer",r="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl?[3,3]:[4,mD(!0)];case 1:if(!(n=h.sent()))throw new tN(Qw.NOT_SUPPORTED,"Get offer Error");return[4,this.createAVMlineOfferTpl(n)];case 2:h.sent(),h.label=3;case 3:return this._mlinesCache[e.streamId]?(o=rv(this._mlinesCache[e.streamId],2),a=o[0],s=o[1],[2,{partialSdp:zx(this._offerSession,a,s),audioMid:a.mid,videoMid:s.mid,type:i,semantics:r}]):(c="".concat(this._mid++),u="".concat(this._mid++),d=Zf(Zf(Zf({},this._aRecvonlyOfferTpl),this._offerIce),{mid:c}),l=Zf(Zf(Zf({},this._vRecvonlyOfferTpl),this._offerIce),{mid:u}),this._mlinesCache[e.streamId]=[d,l],[2,{partialSdp:zx(this._offerSession,d,l),audioMid:c,videoMid:u,type:i,semantics:r,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}}])}}))}))},t.prototype.handleAck=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return MF.print("handleAck()","item: %o",e),[2,this._sdpQueue.enqueue(e)]}))}))},t.prototype.dequeue=function(){return ev(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s=this;return tv(this,(function(c){switch(c.label){case 0:return this._queueBusy=!0,e=this._sdpQueue.dequeue(),MF.print("dequeue()","ret: %o",e),e?(t=e.items,i=e.sdpStrategy,r=[],n=[],i===TF.ADD?(delete(o=Zf({},this._answerIce)).candidates,t.forEach((function(e){return ev(s,void 0,void 0,(function(){var t,i,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T;return tv(this,(function(I){switch(I.label){case 0:return t=e.action,i=e.transceiverInit,a=e.signalingAck,s=e.stream,(c=s instanceof AF)&&(null==a?void 0:a.sequenceId)<s.sequenceId?[2]:(u={},d={},l=Ox.parse(a.sdp),Array.isArray(l.media)&&(h="",l.media.sort((function(e,t){var i;return null===(i=null==e?void 0:e.type)||void 0===i?void 0:i.localeCompare(null==t?void 0:t.type)})).forEach((function(e){"audio"===(e=Zf(Zf({},e),o)).type?(u=e,MF.print("audioMsid",e.msid),e.msid&&(h=e.msid.replace("audio","video"))):(d=e,MF.print("videoMsid",h),h&&(d.msid=h,h=""))}))),p=s.streamId,t===IF.publish&&(p=null===(b=s.stream)||void 0===b?void 0:b.id),_=rv(this._mlinesCache[p],2),f=_[0],v=_[1],i?(s.audioTransceiver=this._peerConnection.addTransceiver(i.aTrack,i.audioTransceiverInit),s.videoTransceiver=this._peerConnection.addTransceiver(i.vTrack,i.videoTransceiverInit),(m=this._inactiveMlineIndex.shift())||(m=this._offerMlines.length),this._offerMlines[m]=Zf(Zf({},f),{mid:u.mid}),this._answerMlines[m]=u,(S=this._inactiveMlineIndex.shift())||(S=this._offerMlines.length),this._offerMlines[S]=Zf(Zf({},v),{mid:d.mid}),this._answerMlines[S]=d,this._msidIndexMap[s.streamId]=[m,S],UF&&(s.initAudioEncodedTransform(),s.initVideoEncodedTransform()),r.push(s.streamId||""),n.push(c?s.userId:"local"),[3,5]):[3,1]);case 1:return c?(y=rv(this._msidIndexMap[s.streamId]||[],2),g=y[0],E=y[1],g&&E?(null===(T=this._offerMlines[g])||void 0===T?void 0:T.mid)===u.mid?[3,3]:(this._offerMlines[g]=Hx(this._offerMlines[g]),this._offerMlines[E]=Hx(this._offerMlines[E]),this._answerMlines[g]=Hx(this._answerMlines[g]),this._answerMlines[E]=Hx(this._answerMlines[E]),[4,this.setDescription()]):[3,4]):[3,5];case 2:I.sent(),this._offerMlines[g]=Zf(Zf({},this._aRecvonlyOfferTpl),{mid:u.mid}),this._offerMlines[E]=Zf(Zf({},this._vRecvonlyOfferTpl),{mid:d.mid}),MF.print("enqueue","hack: %o",s.streamId),I.label=3;case 3:return this._answerMlines[g]=u,this._answerMlines[E]=d,[3,5];case 4:MF.print("dequeue","pushtrack before subscribe: %o",s.userId),I.label=5;case 5:return c&&(s.sequenceId=null==a?void 0:a.sequenceId),[2]}}))}))}))):(a={},t.forEach((function(e){var t,i=e.audioMid,r=e.videoMid;a[i]=i,a[r]=r,delete s._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return a[e.mid]&&(e=Hx(e),s._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return a[e.mid]&&(e=Hx(e)),e}))),[4,this.setDescription(r.length?{streamId:r.join(","),streamUserId:n.join(",")}:void 0)]):(this._queueBusy=!1,[2]);case 1:return c.sent(),MF.print("dequeue","loop"),this.dequeue(),[2]}}))}))},t.prototype.setDescription=function(e){return ev(this,void 0,void 0,(function(){var t,i;return tv(this,(function(r){switch(r.label){case 0:return MF.print("setDescription","_offerMlines: %o, _answerMlines: %o",this._offerMlines,this._answerMlines),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,t=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&t.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=t.join(" "),this._answerSession.groups[0].mids=t.join(" ")),i=aD(),e&&_L.rtcBeginCreateOffer("local"===e.streamUserId?MU.UP:MU.DOWN,e.streamId,e.streamUserId),[4,this._peerConnection.createOffer()];case 1:return r.sent(),e&&_L.rtcCreateOffer(0,"local"===e.streamUserId?UU.UP:UU.DOWN,e.streamId,e.streamUserId,aD()-i),[4,this.setLocalDescription(Ox.write(this._offerSession),e)];case 2:return r.sent(),[4,this.setRemoteDescription(Ox.write(this._answerSession),e)];case 3:return r.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return ev(this,void 0,void 0,(function(){var e,t,i;return tv(this,(function(r){switch(r.label){case 0:return[4,mD(!0)];case 1:if(!(e=r.sent()))throw new tN(Qw.NOT_SUPPORTED,"Get offer Error");return this.createAVMlineOfferTpl(e),t=Ox.parse(e),i=[],t.media=t.media.filter((function(e){return"recvonly"===e.direction&&(i.push(e.mid+""),!0)})),t.groups=[{mids:i.join(" "),type:"BUNDLE"}],[2,{sdp:Ox.write(t),semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.rollback=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return delete this._mlinesCache[e],[2]}))}))},t.prototype.createAVMlineOfferTpl=function(e){var t=this;Ox.parse(e).media.forEach((function(e){"audio"===e.type?"sendonly"===e.direction?t._aSendonlyOfferTpl=e:t._aRecvonlyOfferTpl=e:"video"===e.type&&("sendonly"===e.direction?t._vSendonlyOfferTpl=e:t._vRecvonlyOfferTpl=e)}))},t}(Cx),xF=new BD("FirefoxHandler",3),VF=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="firefox",r}return Qf(t,e),t.prototype.connect=function(e){var t,i;return ev(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return tv(this,(function(d){switch(d.label){case 0:return xF.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},r=this,[4,Kx(e)];case 1:return r._answerIce=d.sent(),[4,this._peerConnection.createOffer()];case 2:return n=d.sent(),o=Ox.parse(n.sdp),a=rv(o.media,1),s=a[0],this._offerIce.fingerprint=o.fingerprint||s.fingerprint,o.media=o.media.map((function(e){return Zf(Zf({},e),u._offerIce)})),(c=Zf({},o)).fingerprint=this._answerIce.fingerprint,c.media=c.media.map((function(e){return Zf(Zf(Zf({},e),u._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}})})),[4,this.setLocalDescription(Ox.write(o))];case 3:return d.sent(),[4,this.setRemoteDescription(Ox.write(c))];case 4:return d.sent(),[4,new Promise((function(e,t){u._dataChannel.onopen=function(){xF.print("connect","dataChannel open"),TL("es.dc.open",""),e("")},u._dataChannel.onerror=function(e){_L.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,PU.INVALID_DATA),TL("es.dc.error",""),t(e)},u._dataChannel.onclose=function(e){TL("es.dc.close",""),t(e)},u._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==u._peerConnection.iceConnectionState&&"closed"!==u._peerConnection.iceConnectionState&&"failed"!==u._peerConnection.connectionState||t(e)}))}))];case 5:return d.sent(),xF.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.publish=function(t,i){var r,n;return ev(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,_,f,v=this;return tv(this,(function(m){switch(m.label){case 0:return o=e.prototype.internalPublish.call(this,t,i),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(c.aTrack,c.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(c.vTrack,c.videoTransceiverInit),u=aD(),_L.rtcBeginCreateOffer(MU.UP,"",""),[4,this._peerConnection.createOffer()];case 1:return d=m.sent(),_L.rtcCreateOffer(0,UU.UP,"","",aD()-u),(l=Ox.parse(d.sdp)).media=null===(r=l.media)||void 0===r?void 0:r.map((function(e){return Zf(Zf({},e),v._offerIce)})),[4,this.setLocalDescription(Ox.write(l))];case 2:return m.sent(),h=t.audioTransceiver.mid,p=t.videoTransceiver.mid,_=null,f=null,l.media=null===(n=l.media)||void 0===n?void 0:n.map((function(e){if("".concat(e.mid)===h){var t=null==(_=e)?void 0:_.rtp.find((function(e){return"opus"===e.codec}));if(t&&_.fmtp){var i=_.fmtp.find((function(e){return e.payload===t.payload}));i&&v._context&&(i.config+=v._context.audioProfileManager.getOpusConfigStr())}}else"".concat(e.mid)===p&&(f=e);return e})),[4,this.setLocalDescription(Ox.write(l))];case 3:return m.sent(),[2,{partialSdp:zx(l,_,f),audioMid:h,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}}))}))},t.prototype.subscribe=function(e){var t,i;return ev(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d=this;return tv(this,(function(l){switch(l.label){case 0:return xF.print("subscribe()"),e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),r=aD(),_L.rtcBeginCreateOffer(MU.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:return n=l.sent(),_L.rtcCreateOffer(0,UU.UP,e.streamId,e.userId,aD()-r),(o=Ox.parse(n.sdp)).media=null===(t=o.media)||void 0===t?void 0:t.map((function(e){return Zf(Zf({},e),d._offerIce)})),[4,this.setLocalDescription(Ox.write(o),{streamId:e.streamId||"",streamUserId:e.userId})];case 2:return l.sent(),a=e.audioTransceiver.mid,s=e.videoTransceiver.mid,c=null,u=null,null===(i=o.media)||void 0===i||i.forEach((function(e){"".concat(e.mid)===a?c=e:"".concat(e.mid)===s&&(u=e)})),[2,{partialSdp:zx(o,c,u),audioMid:a,videoMid:s,type:"incroffer",semantics:"unified-plan"}]}}))}))},t.prototype.handleAck=function(e){var t,i;return ev(this,void 0,void 0,(function(){var r,n,o,a,s,c=this;return tv(this,(function(u){return e.action===IF.unpublish||e.action===IF.unsubscribe||(r=e.signalingAck,n={},(o=Ox.parse(null===(t=this._peerConnection.remoteDescription)||void 0===t?void 0:t.sdp)).media.forEach((function(e){n[e.mid]=e})),Ox.parse(null==r?void 0:r.sdp).media.forEach((function(e){n[e.mid]=Zf(Zf({},e),c._answerIce)})),a=[],(s=Ox.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media.forEach((function(e){a.push(n[e.mid])})),o.groups=s.groups,o.media=a,this.setRemoteDescription(Ox.write(o))),[2,""]}))}))},t.prototype.getDefaultSdp=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){return[2,{semantics:"unified-plan",sdp:"",type:"offer"}]}))}))},t.prototype.rollback=function(e,t){var i,r;return ev(this,void 0,void 0,(function(){var e,n,o;return tv(this,(function(a){switch(a.label){case 0:return xF.print("subscribe()"),t.audioTransceiver&&t.videoTransceiver?(t.audioTransceiver.stop(),t.videoTransceiver.stop(),e=[],(n=Ox.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media=n.media.map((function(i){return"".concat(i.mid)!==t.audioMid&&"".concat(i.mid)!==t.videoMid||(i=Hx(i)),"inactive"!==i.direction&&e.push(i.mid),i})),(o=Ox.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media=n.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=Hx(e)),e})),n.groups&&o.groups&&(n.groups[0].mids=e.join(" "),o.groups[0].mids=e.join(" ")),[4,this.setLocalDescription(Ox.write(n))]):[3,3];case 1:return a.sent(),[4,this.setRemoteDescription(Ox.write(o))];case 2:a.sent(),a.label=3;case 3:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return[4,this._peerConnection.createOffer()];case 1:return e.sent(),this._peerConnection.localDescription&&this._peerConnection.remoteDescription?[4,this._peerConnection.setLocalDescription(this._peerConnection.localDescription)]:[3,4];case 2:return e.sent(),[4,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},t}(Cx),FF="mozilla"===dD(),BF=function(e,t){return FF?new VF(e,t):new LF(e,t)},jF=new BD("Locker",2),GF=1,HF=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=GF++,e&&(this.name=e),jF.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,jF.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var i=new Promise((function(i){e=function(){t.locks-=1,jF.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),i()}})),r=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return i})),r},e}();!function(e){e[e.communication=0]="communication",e[e.live_broadcasting=1]="live_broadcasting",e[e.game=2]="game",e[e.cloud_game=3]="cloud_game",e[e.low_latency=4]="low_latency",e[e.chat=5]="chat",e[e.chat_room=6]="chat_room",e[e.lw_together=7]="lw_together",e[e.game_hd=8]="game_hd",e[e.co_host=9]="co_host",e[e.interactive_podcast=10]="interactive_podcast",e[e.ktv=11]="ktv",e[e.chorus=12]="chorus",e[e.vr_chat=13]="vr_chat",e[e.game_streaming=14]="game_streaming",e[e.lan_live_streaming=15]="lan_live_streaming",e[e.meeting=16]="meeting",e[e.meeting_room=17]="meeting_room",e[e.classroom=18]="classroom"}(wF||(wF={})),function(e){e.IES_living="IES_living",e.FeedShare="FeedShare",e.fluent="fluent",e.IES_chatroom="IES_chatroom",e.standard="standard",e.IES_PK="IES_PK",e.IES_KTV="IES_KTV"}(NF||(NF={}));var zF,KF=((OF={})[kP.communication]=[wF.communication],OF[kP.chat]=[wF.communication],OF[kP.chatRoom]=[wF.live_broadcasting,NF.IES_chatroom],OF[kP.coHost]=[wF.live_broadcasting,NF.IES_PK],OF[kP.meeting]=[wF.meeting],OF[kP.classRoom]=[wF.communication],OF),WF=new BD("MediaServerClient",2);!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(zF||(zF={}));var YF,XF=function(e,t){WF.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)},qF=function(e){function t(t,i){void 0===i&&(i=_L);var r=e.call(this)||this;return r._ontrackCallbackMap=new Map,r._subResolves={},r.supportConcurrent=!1,r._pubConfig={},r._subConfig={},r._roomProfile=kP.communication,r._subStreamQueue={},r.monitor=i,r._pubSubLock=new HF("pubSubLock"),r._joinLeaveLock=new HF("joinLeaveLock"),r._state=zF.DISCONNECTED,r._roomAttributes={multiChatMode:!1,bigRoomMode:!1},r._context=t,r.on("SUB_END",(function(e){return r._handleSubStreamQueue(e)})),r}return Qf(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){WF.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(FL.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[xL.ON_ADD_STREAM,xL.ON_REMOVE_STREAM,xL.USER_CONNECTION,xL.USER_DISCONNECTION,xL.ON_UPDATE_STREAM_ATTRIBUTES,xL.ON_UPDATE_ROOM_ATTRIBUTES,xL.ON_PUSH_TRACK,xL.ON_REMOVE_TRACK,xL.NODE_CHANGE,xL.ON_CUSTOM_MESSAGE,xL.USER_MESSAGE_RECEIVED,xL.USER_BINARY_MESSAGE_RECEIVED,xL.POST_PROCESSING_MESSAGE,xL.ON_USER_TOKEN_WILL_EXPIRE,xL.STREAM_CONTROL_MESSAGE,xL.ON_SCENE_CONFIG,VL.RSCP].forEach((function(e){var i;null===(i=t._dataChannelSignal)||void 0===i||i.on(e,(function(i){t.safeEmit(e,i)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){WF.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(FL.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(FL.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.connect=function(e,t,i,r){var n;return void 0===t&&(t=""),void 0===i&&(i=""),void 0===r&&(r={}),ev(this,void 0,void 0,(function(){var o,a,s,c,u,d=this;return tv(this,(function(l){switch(l.label){case 0:return this.connectionState=zF.CONNECTING,this._appId=e,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),r.node?(o=[r.node],TL("es.join.nodeChange",r),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new rx,[4,null===(n=this._iceConfigRequestManager)||void 0===n?void 0:n.getAccessNode(e,t,i,AL.getDeviceId(),null==r?void 0:r.reason,null==r?void 0:r.feedbackNode,this._useCloudProxy)];case 2:if(!(o=l.sent()))throw TL("es.join.getNodeFailed",""),new tN(Qw.ICE_SERVER_WRONG,"get ICE config failed");TL("es.join.getNodeSuccess",o),l.label=3;case 3:this._addHandlerEvents(),Promise.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),l.label=4;case 4:return l.trys.push([4,6,,7]),s=!1,c=o.map((function(e){var t=BF(d.monitor,d._context);return t.connect(e).then((function(i){s?t.destroy():(s=!0,a=i,d.safeEmit("prevIceNode",e),d._handler=t,d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(){t.destroy()}))})),[4,SD(c)];case 5:return l.sent(),WF.print("join","establish peerConnection success"),[3,7];case 6:throw u=l.sent(),this.connectionState=zF.DISCONNECTED,new tN(Qw.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",u);case 7:if(!a)throw this.connectionState=zF.DISCONNECTED,new tN(Qw.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");return this._dataChannelSignal=new ex(a),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[2]}}))}))},t.prototype.join=function(e,t,i,r){var n,o,a,s,c,u,d,l,h,p;return void 0===t&&(t={}),void 0===i&&(i=!1),ev(this,void 0,void 0,(function(){var _,f,v,m,S,y,g,E=this;return tv(this,(function(b){switch(b.label){case 0:return WF.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,i,r),this._appId=e.appId,this._token=e.token,this._roomId=e.roomId,this._clientId=e.userInfo.userId,this._businessId=e.userInfo.businessId,this._userInfo=e.userInfo,this._useCloudProxy=e.useCloudProxy,this._roomProfile=e.roomProfile,this._sessionId=t.sessionId,[4,this.connect(this._appId,this._roomId,this._clientId,t)];case 1:return b.sent(),y={Authorization:uD.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId||"",timestamp:Date.now(),controlMessage:r,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role}},g={},[4,Tx()];case 2:return y.params=(g.supportedCodecs=b.sent(),g.deviceType="web",g.userAgent=window.navigator.userAgent,g.sdkVersion=qL.VERSION,g.deviceId=AL.getDeviceId(),g.appId=this._appId,g.roomId=this._roomId,g.userId=this._clientId,g.businessId=this._businessId,g.enable_cloud_proxy=this._useCloudProxy,g.channelProfile=KF[this._roomProfile]?KF[this._roomProfile][0]:0,g),y.options={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0},_=y,"chrome-stable"!==dD()&&"safari"!==dD()?[3,4]:(f=_,[4,null===(n=this._handler)||void 0===n?void 0:n.getDefaultSdp()]);case 3:f.sdpInfo=b.sent(),_.options.enableUnBundleMode=!0,b.label=4;case 4:Promise.resolve().then((function(){return E.emit("onSendingJoinMessageHook")})),b.label=5;case 5:return b.trys.push([5,7,,8]),v=i?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(v,_)];case 6:return m=b.sent(),WF.print("join","send join message success"),this._authorization=_.Authorization,this.connectionState=zF.CONNECTED,SF.audioStallConfig=null===(o=m.config)||void 0===o?void 0:o.engine_WEB,this._pubConfig.audioRed=!!(null===(s=null===(a=m.config)||void 0===a?void 0:a.engine_WEB)||void 0===s?void 0:s.pub_audio_red),this._subConfig.muteReplaceUnsub=!!(null===(c=m.config)||void 0===c?void 0:c.mute_replace_unsub),this._pubConfig.simulcastOnDemand=!(!1===(null===(l=null===(d=null===(u=m.config)||void 0===u?void 0:u.engine_VPM)||void 0===d?void 0:d.ondemand)||void 0===l?void 0:l.enable)),null===(h=this._context)||void 0===h||h.audioProfileManager.updateEngineBAC(null===(p=m.config)||void 0===p?void 0:p.engine_BAC),[2,m];case 7:if(S=b.sent(),this.connectionState=zF.DISCONNECTED,(null==S?void 0:S.code)>=700&&(null==S?void 0:S.code)<800)throw new tN(Qw.INVALID_TOKEN,(null==S?void 0:S.message)||"Invalid token");if(200!==(null==S?void 0:S.code))throw new tN(Qw.JOIN_ROOM_FAILED,(null==S?void 0:S.message)||"Join room failed");return[3,8];case 8:return[2]}}))}))},t.prototype.publish=function(e){var t,i,r,n,o,a,s,c,u,d;return ev(this,void 0,void 0,(function(){var l,h,p,_,f,v,m,S,y;return tv(this,(function(g){switch(g.label){case 0:WF.print("publish()","localStream: %o",e),l=e.videoTrack,h=e.audioTrack,p=aD(),_="",f="",g.label=1;case 1:return g.trys.push([1,4,,5]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(v=g.sent()))throw new tN(Qw.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return _=v.audioMid,f=v.videoMid,e.pubAttributes={localaudio:!!h,localvideo:!!l,videostream:e.pubVideo,audiostream:e.pubAudio,extvideo:!!(l instanceof JV),extaudio:!!(h instanceof QV)},m={attributes:Zf({videoDescriptions:v.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:_,videoMid:f,sdpInfo:{msid:e.stream.id,type:v.type,sdp:v.partialSdp,semantics:v.semantics}},e.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(m.attributes.subVideoDescriptions=v.subVideoDescriptions),[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("publish",m)];case 3:if(200!==(null==(S=g.sent())?void 0:S.code))throw new tN(Qw.PUBLISH_FAILED,(null==S?void 0:S.message)||"publish failed");return _L.rtcRecvAnswer(0,VU.INCRANSWER,(null===(r=null==S?void 0:S.relayMessage)||void 0===r?void 0:r.sequenceId)||0,null===(n=null==S?void 0:S.relayMessage)||void 0===n?void 0:n.sdp,FU.UP,"",""),null===(o=this._handler)||void 0===o||o.handleAck({action:IF.publish,streamId:S.streamId,audioMid:_,videoMid:f,transceiverInit:v.transceiverInit,signalingAck:{audioMid:null===(a=null==S?void 0:S.relayMessage)||void 0===a?void 0:a.audioMid,videoMid:null===(s=null==S?void 0:S.relayMessage)||void 0===s?void 0:s.videoMid,sdp:null===(c=null==S?void 0:S.relayMessage)||void 0===c?void 0:c.sdp,sequenceId:null===(u=null==S?void 0:S.relayMessage)||void 0===u?void 0:u.sequenceId},stream:e}),e.streamId=S.streamId,e.videoMid=f,e.audioMid=_,e.subVideoDescriptions=v.subVideoDescriptions,this.monitor.rtcPublishStat(BU.SUCCESS,jU.W_0,p,GU.UNKNOWN),e.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 4:throw(y=g.sent())instanceof Error&&this.monitor.rtcPublishStat(BU.FAIL,jU.W_0,p,y.message),null===(d=this._handler)||void 0===d||d.rollback(e.stream.id,e),y;case 5:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,i,r,n,o,a,s;return ev(this,void 0,void 0,(function(){var c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A,C,O,w,N,P,D,k,M;return tv(this,(function(U){switch(U.label){case 0:WF.print("updatePubTrack()","localStream: %o",e),c=e.videoTrack,u=e.audioTrack,d=e.pubAudio,l=e.pubVideo,h=null==u?void 0:u.getTrack(),p=null==c?void 0:c.getTrack(),l&&p?null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack(p):null===(i=e.videoTransceiver)||void 0===i||i.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateScaleResolutionDownBy(e),d&&h?(f=(_=u).mixType,(v=_.mixedAudioTrack)&&f!==mx.PLAYOUT&&!0===h.enabled&&(h=v),null===(n=e.audioTransceiver)||void 0===n||n.sender.replaceTrack(h)):null===(o=e.audioTransceiver)||void 0===o||o.sender.replaceTrack(null),m={localaudio:!!u,localvideo:!!c,videostream:l,audiostream:d,extvideo:!!(c instanceof JV),extaudio:!!(u instanceof QV)},S={};try{for(y=iv(Object.entries(m)),g=y.next();!g.done;g=y.next())E=rv(g.value,2),b=E[0],(T=E[1])!==Reflect.get(e.pubAttributes,b)&&Reflect.set(S,b,T)}catch(e){k={error:e}}finally{try{g&&!g.done&&(M=y.return)&&M.call(y)}finally{if(k)throw k.error}}return Object.keys(S).length?(e.observer&&(I=e.observer,R=S.audiostream,A=S.videostream,C=S.localaudio,w=S.extaudio,N=S.extvideo,void 0!==(O=S.localvideo)?void 0!==N?I.setPushVideo(N):I.setEnableVideo(O):void 0!==A&&I.setUnmuteVideo(A),void 0!==C?void 0!==w?I.setPushAudio(w):I.setEnableAudio(C):void 0!==R&&I.setUnmuteAudio(R)),e.pubAttributes=m,P={roomId:this._roomId,streamId:e.streamId,attributes:S},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateStreamAttributes",P)]):[2];case 1:if(200!==(null==(D=U.sent())?void 0:D.code))throw new tN(Qw.UPDATE_TRACK_FAILED,(null==D?void 0:D.message)||"update track failed");return"mozilla"!==dD()?[3,3]:[4,null===(s=this._handler)||void 0===s?void 0:s.setCurrentDescription()];case 2:U.sent(),U.label=3;case 3:return[2]}}))}))},t.prototype.updateToken=function(e){var t,i,r;return ev(this,void 0,void 0,(function(){var n,o;return tv(this,(function(a){switch(a.label){case 0:if(WF.print("updateToken()","newToken: %o",e),this._token=e,!this._appId||!(null===(t=this._userInfo)||void 0===t?void 0:t.userId)||!this._roomId)return[2];n={roomId:this._roomId,userId:null===(i=this._userInfo)||void 0===i?void 0:i.userId,appId:this._appId,token:"Bearer ".concat(e)},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateToken",n)];case 2:if(200!==(null==(o=a.sent())?void 0:o.code))throw new tN(Qw.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new tN(Qw.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 4:return[2]}}))}))},t.prototype.unpublish=function(e){var t,i,r;return ev(this,void 0,void 0,(function(){var n;return tv(this,(function(o){return WF.print("unpublish()","localStream: %o",e),n={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},null===(t=this._dataChannelSignal)||void 0===t||t.sendSignaling("unpublish",n),null===(i=this._handler)||void 0===i||i.handleAck({action:IF.unpublish,audioMid:e.audioMid,videoMid:e.videoMid,stream:e,streamId:e.streamId}),e.statsReport.unpublish(),null===(r=this._handler)||void 0===r||r.rollback(e.stream.id,e),[2]}))}))},t.prototype.subscribe=function(e,t,i){return ev(this,void 0,void 0,(function(){var r=this;return tv(this,(function(n){return[2,new Promise((function(n,o){return ev(r,void 0,void 0,(function(){var r,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A,C,O,w,N,P,D,k,M,U,L,x=this;return tv(this,(function(V){switch(V.label){case 0:if(e.streamState===yF.SUB_ED)return[2,this._updateSubTrack(e,t,fF.SUB).then(n,o)];if(e.streamState===yF.SUB_ING)return this._subStreamQueue[e.streamId]||(this._subStreamQueue[e.streamId]=[]),WF.print("_subStreamQueue","streamId: %o, enqueue",e.streamId),this._subStreamQueue[e.streamId].push({fn:this.subscribe,args:[e,t,i],resolve:n,reject:o}),[2];if(WF.print("subscribe()","mediaType: %o",t),XF("subscribe()",e),e.streamState=yF.SUB_ING,r=!1,a=!1,gD(t)&&(a=!0),ED(t)&&(r=!0),!r&&this._multiChatMode())return[2,n(null)];s=aD(),c=e.audioMid,u=e.videoMid,l=e.paused,h=e.subVideo,V.label=1;case 1:return V.trys.push([1,8,,9]),c&&u?[4,null===(R=this._handler)||void 0===R?void 0:R.subscribe(e,{audioMid:c,videoMid:u})]:[3,3];case 2:return d=V.sent(),[3,5];case 3:return[4,null===(A=this._handler)||void 0===A?void 0:A.subscribe(e)];case 4:if(!(d=V.sent()))throw new tN(Qw.ADD_TRANSCEIVER_FAILED,"add transceiver failed");c=d.audioMid,u=d.videoMid,V.label=5;case 5:return e.paused=!r,e.subVideo=r,p={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:u,audioMid:c,sdpInfo:{sdp:null==d?void 0:d.partialSdp,semantics:null==d?void 0:d.semantics,type:null==d?void 0:d.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||a,video:r},qualityLayer:{spatialLayer:(null==i?void 0:i.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==i?void 0:i.spatialSubLayer)||-1}}},[4,null===(C=this._dataChannelSignal)||void 0===C?void 0:C.sendSignaling("subscribe",p)];case 6:if(200!==(null==(_=V.sent())?void 0:_.code))throw new tN(Qw.SUBSCRIBE_FAILED,(null==_?void 0:_.message)||"subscribe failed");return f=[],v=!this._multiChatMode(),m=!e.videoTrack,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),m&&f.push(new Promise((function(t,i){x._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new tN(Qw.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function i(n){"video"===n.mediaType&&(WF.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),v&&f.push(new Promise((function(t,i){x._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new tN(Qw.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(WF.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),S=function(t){e.ontrack(t)},null===(O=this._handler)||void 0===O||O.on("ontrack",S),this._ontrackCallbackMap.set(e,S),y=null==_?void 0:_.relayMessage,g=y.audioMid,E=y.videoMid,(I={})[c]=g,I[u]=E,b=I,WF.print("sub midmap",e.userId,b),e.videoMid=E,e.audioMid=g,e._workaround_1_=!1,e.subMediaType=t,e.streamState=yF.SUB_ED,_L.rtcRecvAnswer(0,VU.INCRANSWER,(null===(w=null==_?void 0:_.relayMessage)||void 0===w?void 0:w.sequenceId)||0,null===(N=null==_?void 0:_.relayMessage)||void 0===N?void 0:N.sdp,FU.DOWN,e.streamId,e.userId),null===(P=this._handler)||void 0===P||P.handleAck({action:IF.subscribe,streamId:e.streamId,audioMid:c,videoMid:u,transceiverInit:null==d?void 0:d.transceiverInit,signalingAck:{audioMid:null===(D=null==_?void 0:_.relayMessage)||void 0===D?void 0:D.audioMid,videoMid:null===(k=null==_?void 0:_.relayMessage)||void 0===k?void 0:k.videoMid,sdp:null===(M=null==_?void 0:_.relayMessage)||void 0===M?void 0:M.sdp,sequenceId:null===(U=null==_?void 0:_.relayMessage)||void 0===U?void 0:U.sequenceId},stream:e}),[4,Promise.all(f)];case 7:return V.sent(),this._multiChatMode()||(e.subAudio=a),this.monitor.rtcSubscribeStat(HU.SUCCESS,s,zU.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),n(null),this.emit("SUB_END",e.streamId),[3,9];case 8:return(T=V.sent())instanceof Error&&this.monitor.rtcSubscribeStat(HU.FAIL,s,T.message,e.userId),e.paused=l,e.subVideo=h,e.streamState=yF.INIT,null===(L=this._handler)||void 0===L||L.rollback(e.streamId,e),o(T),this.emit("SUB_END",e.streamId),[3,9];case 9:return[2]}}))}))}))]}))}))},t.prototype._handleSubStreamQueue=function(e){var t,i=this;if(null===(t=this._subStreamQueue[e])||void 0===t?void 0:t.length){WF.print("_subStreamQueue","streamId: %o, exec",e);var r=this._subStreamQueue[e].shift(),n=r.fn,o=r.args,a=r.resolve,s=r.reject;n.apply(this,o).then(a,s).finally((function(){return i._handleSubStreamQueue(e)}))}else WF.print("_subStreamQueue","streamId: %o, END",e)},t.prototype.controlMessage=function(e){var t;return ev(this,void 0,void 0,(function(){var i;return tv(this,(function(r){switch(r.label){case 0:return WF.print("controlMessage()","params: %o",e),i=e,"transcode"===e.type&&(i.roomId=this._roomId),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",i)];case 1:return r.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return ev(this,void 0,void 0,(function(){return tv(this,(function(i){switch(i.label){case 0:return WF.print("updateUserAttributes()","attributes: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:e})];case 1:return i.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,i,r){return ev(this,void 0,void 0,(function(){return tv(this,(function(n){return[2,this._updateSubTrack(e,t,i,r||e.subLayer)]}))}))},t.prototype._updateSubTrack=function(e,t,i,r){var n,o,a,s,c;return void 0===r&&(r={spatialLayer:0,spatialSubLayer:-1}),ev(this,void 0,void 0,(function(){var u,d,l,h,p;return tv(this,(function(_){switch(_.label){case 0:return WF.print("updateSubTrack()","mediaType: %o, subLayer: %o",t,r),XF("updateSubTrack()",e),u=0,u=i===fF.SUB?e.subMediaType|t:e.subMediaType-(e.subMediaType&t),WF.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",e.subMediaType,i,t,u),e.subMediaType===u&&WF.print("updateSubTrack","mediaType no change"),d=!1,l=!1,gD(u)&&(l=!0),ED(u)&&(d=!0),h={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:d,audio:!!this._multiChatMode()||l},qualityLayer:{spatialLayer:null!==(n=r.spatialLayer)&&void 0!==n?n:0,temporalLayer:0,spatialSubLayer:null!==(o=r.spatialSubLayer)&&void 0!==o?o:-1}}},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateSubscribe",h)];case 1:if(200!==(null==(p=_.sent())?void 0:p.code))throw new tN(Qw.UPDATE_TRACK_FAILED,(null==p?void 0:p.message)||"update track failed");return e.paused=!d,this._multiChatMode()||(null===(s=e.observer)||void 0===s||s.setUnmuteAudio(l),e.subAudio=l),null===(c=e.observer)||void 0===c||c.setUnmuteVideo(d),e.subVideo=d,e.subMediaType=u,e.subLayer=r,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var i,r,n,o,a;return ev(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,_,f,v,m,S=this;return tv(this,(function(y){switch(y.label){case 0:if(WF.print("subscribe4pushTrack()","streamInfo: %o",t),XF("subscribe4pushTrack()",e),s=null==t?void 0:t.message,c=s.audioMid,u=s.videoMid,d=s.sequenceId,e.subAudio=!0,d<e.sequenceId)return WF.print("subscribe4pushTrack","sequenceId return",d,e.sequenceId),[2];l=e.audioMid,h=e.videoMid,null===(i=e.observer)||void 0===i||i.setPushTrack(!0),y.label=1;case 1:return y.trys.push([1,7,,8]),l&&h?[4,null===(r=this._handler)||void 0===r?void 0:r.subscribe(e,{audioMid:l,videoMid:h})]:[3,3];case 2:return p=y.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(p=y.sent()))throw new tN(Qw.ADD_TRANSCEIVER_FAILED,"add transceiver failed");l=p.audioMid,h=p.videoMid,y.label=5;case 5:return(m={})[l]=c,m[h]=u,_=m,WF.print("onpushtrack midmap",e.userId,_),e.audioMid=c,e.videoMid=u,e.sequenceId=d,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),f=[],e.audioTrack||f.push(new Promise((function(t,i){S._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new tN(Qw.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(WF.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),v=function(t){e.ontrack(t)},null===(o=this._handler)||void 0===o||o.on("ontrack",v),this._ontrackCallbackMap.set(e,v),null===(a=this._handler)||void 0===a||a.handleAck({action:IF.pushtrack,streamId:e.streamId,audioMid:l,videoMid:h,stream:e,transceiverInit:null==p?void 0:p.transceiverInit,signalingAck:null==t?void 0:t.message}),[4,Promise.all(f)];case 6:return y.sent(),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 7:throw y.sent();case 8:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var i,r,n;return ev(this,void 0,void 0,(function(){return tv(this,(function(o){return XF("unsubscribe4removeTrack()",e),WF.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(WF.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):(null===(i=e.observer)||void 0===i||i.setPushTrack(!1),null===(r=this._handler)||void 0===r||r.handleAck({action:IF.removetrack,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e}),null===(n=this._handler)||void 0===n||n.rollback(e.streamId,e),this._subResolves[e.streamId]&&this._subResolves[e.streamId].forEach((function(e){return e(0)})),WF.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),e.statsReport.unsubscribe(),[2]))}))}))},t.prototype.unsubscribe=function(e,t,i){var r,n,o,a,s;return void 0===i&&(i=!1),ev(this,void 0,void 0,(function(){var c,u,d;return tv(this,(function(l){switch(l.label){case 0:return XF("unsubscribe()",e),c=e.subMediaType-(e.subMediaType&t),i||!this._subConfig.muteReplaceUnsub&&c===NV.NONE?(u={roomId:this._roomId,streamId:e.streamId,userId:e.userId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unsubscribe",u),e.streamState=yF.INIT,this._subStreamQueue[e.streamId]&&(this._subStreamQueue[e.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[e.streamId]),e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),null===(n=e.observer)||void 0===n||n.setSubscribeVideo(!1),e.subAudio?[3,2]:(null===(o=e.observer)||void 0===o||o.setSubscribeAudio(!1),[4,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:IF.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})])):[2,this._updateSubTrack(e,t,fF.UNSUB)];case 1:d=l.sent(),null===(s=this._handler)||void 0===s||s.rollback(e.streamId,e),this._subResolves[d]&&this._subResolves[d].forEach((function(e){return e(0)})),WF.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),l.label=2;case 2:return[2]}}))}))},t.prototype.removeOnTrackListener=function(e){var t,i=this._ontrackCallbackMap.get(e);i&&(null===(t=this._handler)||void 0===t||t.off("ontrack",i),this._ontrackCallbackMap.delete(e))},t.prototype.handleRemoveStream=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(i){return XF("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==UL.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,e.hasSubscribed?(this.unsubscribe(e,EP.AUDIO_AND_VIDEO,!0),[2]):[2]}))}))},t.prototype.leave=function(){var e;return ev(this,void 0,void 0,(function(){var t,i,r;return tv(this,(function(n){switch(n.label){case 0:return WF.print("leave()"),this.connectionState!==zF.CONNECTED?[3,7]:(this.connectionState=zF.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]);case 1:i=n.sent(),n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("leaveRoom",t)];case 3:return n.sent(),this.connectionState=zF.DISCONNECTED,[3,6];case 4:throw r=n.sent(),this.connectionState=zF.CONNECTED,r;case 5:return i(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new tN(Qw.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,i,r,n;return ev(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,_,f,v,m,S=this;return tv(this,(function(y){switch(y.label){case 0:return[4,null===(t=this._handler)||void 0===t?void 0:t.subscribe(e)];case 1:if(!(o=y.sent()))throw new tN(Qw.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return a=aD(),s=o.audioMid,c=o.videoMid,u={appId:this._appId,streamId:e.streamId,audio:!0,video:!0,data:!0,audioMid:s,videoMid:c,sdpInfo:{sdp:null==o?void 0:o.partialSdp,semantics:null==o?void 0:o.semantics,type:null==o?void 0:o.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("startPullStream",u)];case 2:return d=y.sent(),l=[],this._subResolves[e.streamId]=[],l.push(new Promise((function(t,i){S._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new tN(Qw.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),5e3);e.on("ontrack",(function i(n){"video"===n.mediaType&&(WF.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),l.push(new Promise((function(t,i){S._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new tN(Qw.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),5e3);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(WF.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),h=function(t){e.ontrack(t)},null===(r=this._handler)||void 0===r||r.on("ontrack",h),this._ontrackCallbackMap.set(e,h),p=null==d?void 0:d.relayMessage,_=p.audioMid,f=p.videoMid,v=p.sequenceId,m=p.sdp,e.videoMid=f,e.audioMid=_,e.sequenceId=v,e._workaround_1_=!1,e.paused=!1,e.streamState=yF.SUB_ED,e.subAudio=!0,e.subVideo=!0,null===(n=this._handler)||void 0===n||n.handleAck({action:IF.subscribe,streamId:e.streamId,audioMid:s,videoMid:c,transceiverInit:null==o?void 0:o.transceiverInit,signalingAck:{audioMid:_,videoMid:f,sdp:m,sequenceId:v},stream:e}),[4,Promise.all(l)];case 3:return y.sent(),this.monitor.rtcSubscribeStat(HU.SUCCESS,a,zU.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,i,r;return ev(this,void 0,void 0,(function(){var n;return tv(this,(function(o){switch(o.label){case 0:XF("unsubscribePublicStream()",e),n={appId:this._appId,streamId:e.streamId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("stopPullStream",n)];case 2:case 3:return o.sent(),[3,4];case 4:return e.streamState=yF.INIT,e.subVideo=!1,e.subAudio=!1,null===(i=this._handler)||void 0===i||i.handleAck({action:IF.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e}),null===(r=this._handler)||void 0===r||r.rollback(e.streamId,e),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.destroy=function(){var e,t,i;WF.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,this._context=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(i=this._iceConfigRequestManager)||void 0===i||i.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState=zF.DISCONNECTED,this.emit("INTERRUPT")},t.prototype.sendUserMessage=function(e,t){var i;return null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})},t.prototype.sendRoomMessage=function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)},t.prototype._multiChatMode=function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode},Object.defineProperty(t.prototype,"handler",{get:function(){return this._handler},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomAttributes",{get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e},enumerable:!1,configurable:!0}),$f([ZF],t.prototype,"join",null),$f([QF,JF],t.prototype,"publish",null),$f([QF,JF],t.prototype,"updatePubTrack",null),$f([QF,JF],t.prototype,"unpublish",null),$f([QF,JF],t.prototype,"subscribe",null),$f([JF],t.prototype,"controlMessage",null),$f([JF],t.prototype,"updateUserAttributes",null),$f([JF],t.prototype,"updateSubTrack",null),$f([JF],t.prototype,"subscribe4pushTrack",null),$f([JF],t.prototype,"unsubscribe4removeTrack",null),$f([QF,JF],t.prototype,"unsubscribe",null),$f([JF],t.prototype,"handleRemoveStream",null),$f([QF],t.prototype,"subscribePublicStream",null),$f([QF],t.prototype,"unsubscribePublicStream",null),t}(GD);function JF(e,t,i){var r=i.value;return i.value=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return ev(this,void 0,void 0,(function(){return tv(this,(function(i){switch(i.label){case 0:return this._handler&&this._state===zF.CONNECTED?[4,r.apply(this,e)]:[3,2];case 1:return i.sent(),[3,3];case 2:throw new tN(Qw.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},i}function QF(e,t,i){var r=i.value;return i.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(i){switch(i.label){case 0:return[4,this._pubSubLock.lock()];case 1:t=i.sent(),this.supportConcurrent&&t(),i.label=2;case 2:return i.trys.push([2,,4,5]),[4,r.apply(this,e)];case 3:return[2,i.sent()];case 4:return this.supportConcurrent||t(),[7];case 5:return[2]}}))}))},i}function ZF(e,t,i){var r=i.value;return i.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ev(this,void 0,void 0,(function(){var t,i=this;return tv(this,(function(n){return t=!1,[2,new Promise((function(n,o){return ev(i,void 0,void 0,(function(){var i,a;return tv(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new tN(Qw.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.apply(this,e)];case 2:return i=s.sent(),n(i),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},i}!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.RECEIVED=3]="RECEIVED"}(YF||(YF={}));var $F,eB=function(){function e(e,t){this._audioEventSessionId=hD(),this._videoEventSessionId=hD(),this._isScreen=!1,this._audioFirstFrameState=YF.INITIAL,this._videoFirstFrameState=YF.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:XU.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:XU.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._publishVideo=!1,this._publishAudio=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._stream=e,this._handler=t,this.getTransportDelay()}return e.prototype.beginRecvFrame=function(e,t){var i,r,n,o,a;return 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=!0,u=XU.LOGIN,d=XU.UNMUTE,l=XU.SUBSCRIBE,h=XU.PUSH_TRACK,[u,d,l,h].indexOf(t)>=0&&(s=0,c=!1),e===YU.AUDIO?(c||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},p={media_type:e,event_type:WU.BEGIN_RECV,type:t,start:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,transport_delay:s},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){_.stopRecvFrame(YU.AUDIO,qU.TIMEOUT),_._firstAudioFrameInterval&&window.clearInterval(_._firstAudioFrameInterval)}),this._timeout),_L.rtcFirstFrame(p),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=YF.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===YU.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)?YU.SCREEN_VIDEO:e,event_type:WU.BEGIN_RECV,type:t,start:null===(o=this._currentVideoRecv)||void 0===o?void 0:o.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(a=this._stream)||void 0===a?void 0:a.userId,transport_delay:s},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){_.stopRecvFrame(YU.VIDEO,qU.TIMEOUT),_._firstVideoFrameInterval&&window.clearInterval(_._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),_L.rtcFirstFrame(p),this._videoFirstFrameState=YF.BEGIN,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0),[2]}}))}))},e.prototype.stopRecvFrame=function(e,t){var i,r,n,o,a,s,c;if(e===YU.AUDIO){if(this._audioFirstFrameState!==YF.BEGIN)return;var u={event_type:WU.RECV_END,media_type:e,start:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.startTime,reason:t,result:!1,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioRecv)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,_L.rtcFirstFrame(u),this._audioFirstFrameState=YF.STOPPED}else if(e===YU.VIDEO){if(this._videoFirstFrameState!==YF.BEGIN)return;u={event_type:WU.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?YU.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,_L.rtcFirstFrame(u),this._videoFirstFrameState=YF.STOPPED}},e.prototype.recvFrameFinish=function(e){var t,i,r;return ev(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p;return tv(this,(function(_){switch(_.label){case 0:return[4,this.getTransportDelay()];case 1:if(_.sent(),n=this._transportDelay,o=XU.LOGIN,a=XU.UNMUTE,s=XU.SUBSCRIBE,c=XU.PUSH_TRACK,e===YU.AUDIO){if(this._audioFirstFrameState!==YF.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:WU.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),_L.rtcFirstFrame(p),this._audioFirstFrameState=YF.RECEIVED}else if(e===YU.VIDEO){if(this._videoFirstFrameState!==YF.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:WU.RECV_END,media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?YU.SCREEN_VIDEO:e,start:h,result:!0,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,event_session_id:this._videoEventSessionId,type:l,transport_delay:n},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),_L.rtcFirstFrame(p),this._videoFirstFrameState=YF.RECEIVED}return[2]}}))}))},e.prototype.setLogin=function(e,t){var i,r,n,o;void 0===t&&(t={audio:!0,video:!0}),this._login!==e&&(this._login=e,e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&t.audio&&this.beginRecvFrame(YU.AUDIO,XU.LOGIN),e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&t.video&&this.beginRecvFrame(YU.VIDEO,XU.LOGIN),!e&&(null===(n=this._stream)||void 0===n?void 0:n.hasAudio)&&this.stopRecvFrame(YU.AUDIO,qU.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(YU.VIDEO,qU.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(YU.AUDIO,XU.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(YU.AUDIO,qU.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(YU.AUDIO,XU.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(YU.AUDIO,qU.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(YU.AUDIO,XU.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(YU.AUDIO,qU.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(YU.VIDEO,XU.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(YU.VIDEO,qU.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(YU.VIDEO,XU.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(YU.VIDEO,qU.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(YU.VIDEO,XU.ENABLE):this.stopRecvFrame(YU.VIDEO,qU.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(YU.AUDIO,XU.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(YU.AUDIO,XU.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(YU.VIDEO,XU.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(YU.VIDEO,XU.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(YU.VIDEO,XU.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(YU.VIDEO,qU.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(YU.AUDIO,XU.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(YU.AUDIO,qU.UNPUBLISH)},e.prototype.setAutoSubscribe=function(e){this._autoSubscribe=e},e.prototype.setAutoSubscribeVideo=function(e){this._autoSubscribeVideo=e},e.prototype.setAutoSubscribeAudio=function(e){this._autoSubscribeAudio=e},e.prototype.setSubscribeAudio=function(e){var t,i;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(YU.AUDIO,XU.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&this.stopRecvFrame(YU.AUDIO,qU.UNSUBSCRIBE)},e.prototype.setSubscribeVideo=function(e){var t,i;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(YU.VIDEO,XU.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasVideo)&&this.stopRecvFrame(YU.VIDEO,qU.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(YU.AUDIO,XU.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(YU.AUDIO,qU.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,i,r,n,o,a,s,c;return tv(this,(function(u){switch(u.label){case 0:return(null===(r=this._handler)||void 0===r?void 0:r.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())?[4,Ex(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.videoTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(i=e.find((function(e){return"inbound-rtp"===e.type})))&&i.framesReceived>t){if(-1===t)return t=i.framesReceived,[2];this.recvFrameFinish(YU.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,i,r,n,o,a,s,c;return tv(this,(function(u){switch(u.label){case 0:return(null===(r=this._handler)||void 0===r?void 0:r.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())?[4,Ex(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.audioTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(i=e.find((function(e){return"inbound-rtp"===e.type})))&&i.totalSamplesReceived>t){if(-1===t)return t=i.totalSamplesReceived,[2];this.recvFrameFinish(YU.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 i,r,n;return tv(this,(function(o){switch(o.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)?[4,Ex(null===(t=this._handler)||void 0===t?void 0:t.pc)]:[3,2];case 1:i=o.sent(),r=i.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(n=i.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==r?void 0:r.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*n.currentRoundTripTime/2)),o.label=2;case 2:return[2]}}))}))},e.prototype.reset=function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:XU.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:XU.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"}($F||($F={}));var tB,iB,rB,nB,oB=function(){function e(e,t){this._audioEventSessionId=hD(),this._videoEventSessionId=hD(),this._currentAudioSend={startTime:0,eventSessionId:0,type:XU.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:XU.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=$F.INITIAL,this._videoFirstFrameState=$F.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var i,r,n,o=this;if(e===YU.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:WU.BEGIN_SEND,type:t,start:null===(i=this._currentAudioSend)||void 0===i?void 0:i.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){o.stopSendFrame(YU.AUDIO,qU.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),_L.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=$F.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===YU.VIDEO){this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};a={media_type:(null===(r=this._stream)||void 0===r?void 0:r.isScreen)?YU.SCREEN_VIDEO:e,event_type:WU.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(YU.VIDEO,qU.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),_L.rtcFirstFrame(a),this._videoFirstFrameState=$F.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}},e.prototype.stopSendFrame=function(e,t){var i,r,n,o,a;if(e===YU.AUDIO){if(this._audioFirstFrameState!==$F.BEGIN)return;var s={event_type:WU.SENT_END,media_type:e,start:null===(i=this._currentAudioSend)||void 0===i?void 0:i.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(r=this._currentAudioSend)||void 0===r?void 0:r.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,_L.rtcFirstFrame(s),this._audioFirstFrameState=$F.STOPPED}else if(e===YU.VIDEO){if(this._videoFirstFrameState!==$F.BEGIN)return;s={event_type:WU.SENT_END,media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?YU.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,_L.rtcFirstFrame(s),this._videoFirstFrameState=$F.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===YU.AUDIO){if(this._audioFirstFrameState!==$F.BEGIN)return;if(!this._currentAudioSend)return;var i=this._currentAudioSend,r=i.type,n=i.startTime,o={event_type:WU.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:r};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),_L.rtcFirstFrame(o),this._audioFirstFrameState=$F.SENT}else if(e===YU.VIDEO){if(this._videoFirstFrameState!==$F.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;r=a.type,n=a.startTime,o={event_type:WU.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?YU.SCREEN_VIDEO:e,start:n,result:!0,event_session_id:this._videoEventSessionId,type:r};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),_L.rtcFirstFrame(o),this._videoFirstFrameState=$F.SENT}},e.prototype.setLogin=function(e){var t,i;this._login!==e&&(this._login=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(YU.VIDEO,XU.LOGIN),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(YU.AUDIO,XU.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(YU.AUDIO,qU.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(YU.VIDEO,qU.LEAVE_ROOM))},e.prototype.setPublish=function(e){var t,i;this._publish!==e&&(this._publish=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(YU.VIDEO,XU.PUBLISH),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(YU.AUDIO,XU.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(YU.AUDIO,qU.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(YU.VIDEO,qU.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(YU.AUDIO,XU.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(YU.AUDIO,qU.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(YU.AUDIO,XU.ENABLE),!e&&this._audioSending&&this.stopSendFrame(YU.AUDIO,qU.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(YU.VIDEO,XU.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(YU.VIDEO,qU.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(YU.VIDEO,XU.ENABLE),!e&&this._videoSending&&this.stopSendFrame(YU.VIDEO,qU.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(YU.AUDIO,qU.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(YU.AUDIO,qU.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(YU.AUDIO,XU.PUSH),!e&&this._audioSending&&this.stopSendFrame(YU.AUDIO,qU.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(YU.VIDEO,qU.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(YU.VIDEO,qU.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(YU.VIDEO,XU.PUSH),!e&&this._videoSending&&this.stopSendFrame(YU.VIDEO,qU.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(YU.AUDIO,qU.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(YU.VIDEO,qU.AUDIENCE))},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype.setPCSessionId=function(e){this._pcSessionId=e},e.prototype.setHandler=function(e){this._handler=e},e.prototype._getFirstVideoFrameStats=function(){var e,t,i,r,n,o;return 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===(i=null===(t=this._stream)||void 0===t?void 0:t.videoTrack)||void 0===i?void 0:i.getTrack())?[4,Ex(null===(r=this._handler)||void 0===r?void 0:r.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._getFirstAudioFrameStats=function(){var e,t,i,r,n,o;return 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===(i=null===(t=this._stream)||void 0===t?void 0:t.audioTrack)||void 0===i?void 0:i.getTrack())?[4,Ex(null===(r=this._handler)||void 0===r?void 0:r.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._watchForFirstVideoFrameSend=function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval((function(){return ev(e,void 0,void 0,(function(){var e;return tv(this,(function(i){switch(i.label){case 0:return[4,this._getFirstVideoFrameStats()];case 1:if((e=i.sent())&&e.framesSent>t){if(-1===t)return t=e.framesSent,[2];this.sendFrameFinish(YU.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(i){switch(i.label){case 0:return[4,this._getFirstAudioFrameStats()];case 1:if((e=i.sent())&&e.packetsSent>t){if(-1===t)return t=e.packetsSent,[2];this.sendFrameFinish(YU.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=$F.INITIAL,this._videoFirstFrameState=$F.INITIAL,this._currentAudioSend={startTime:0,eventSessionId:0,type:XU.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:XU.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===$F.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===$F.BEGIN},enumerable:!1,configurable:!0}),e}();!function(e){e[e.UNKOWN=0]="UNKOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(iB||(iB={})),function(e){e[e.INVALID=0]="INVALID",e[e.GOOD=1]="GOOD",e[e.MEDIUM=2]="MEDIUM",e[e.POOR=3]="POOR"}(rB||(rB={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(nB||(nB={}));var aB=((tB={})[nB.AUDIO]={delay:1200,stallRadio:.3},tB[nB.VIDEO]={delay:1200,stallRadio:.6},tB[nB.SCREEN_AUDIO]={delay:1600,stallRadio:.8},tB[nB.SCREEN_VIDEO]={delay:1600,stallRadio:.8},tB),sB=function(){function e(){this._preUplinkStats=new Map,this._preDownlinkStats=new Map,this._connectionState=zF.CONNECTED}return e.prototype.updateUplinkStats=function(e){var t=e.audioStats,i=e.videoStats,r=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var n=r?nB.SCREEN_AUDIO:nB.AUDIO,o=t.rtt,a=t._fractionLost,s=t._retransmittedRate,c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,nv(nv([],rv(u),!1),[c],!1).slice(-2))}if(i.sentKBitrate>0&&i.rtt){n=r?nB.SCREEN_VIDEO:nB.VIDEO,o=i.rtt,a=i._fractionLost;i.videoLossRate;var d=i._sendBandWidth;s=i._retransmittedRate;0===d&&(a=Math.max(.65,a));c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,nv(nv([],rv(u),!1),[c],!1).slice(-2))}this._startNetworkQualityReport()},e.prototype.updateDownlinkStats=function(e,t){if(t){var i,r,n=this._getStreamActiveState(t),o=n.audioActive,a=n.videoActive,s=e.audioStats,c=e.videoStats,u=e.isScreen,d=e.userId;if(o&&s.rtt)if(0===s.receivedKBitrate)i=PP.VBAD;else{var l=s.rtt,h=s.audioLossRate,p=s.stallDuration,_=s.statsInterval,f=s.e2eDelay,v=p/_,m=u?nB.SCREEN_AUDIO:nB.AUDIO,S=this._getQosLevel(l,h||0,c._retransmittedRate||0),y=this._getDownlinkQoE(m,v,f);i=this._getNetworkQuality(S,y)}if(a)if(0===c.receivedKBitrate||0===c.rtt)r=PP.VBAD;else{l=c.rtt;var g=c.videoLossRate,E=(p=c.stallDuration,_=c.statsInterval,f=c.e2eDelay,c._retransmittedRate);v=p/_,m=u?nB.SCREEN_VIDEO:nB.VIDEO,S=this._getQosLevel(l,g||0,E||0),y=this._getDownlinkQoE(m,v,f);r=this._getNetworkQuality(S,y)}var b=i&&r?Math.ceil((i+r)/2):i||r;if(b){var T="".concat(d).concat(u?"_screen":""),I=this._preDownlinkStats.get(T)||[b];this._preDownlinkStats.set(T,nv(nv([],rv(I),!1),[b],!1).slice(-2)),this._startNetworkQualityReport()}}},e.prototype.setConnectionState=function(e){this._connectionState=e},e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._delayTimer&&(window.clearTimeout(this._delayTimer),delete this._delayTimer),this._preUplinkStats.clear(),this._preDownlinkStats.clear()},e.prototype._startNetworkQualityReport=function(){var e=this;this._delayTimer||this._timer||(this._preUplinkStats.size>0||this._preDownlinkStats.size>0)&&(this._delayTimer=window.setTimeout((function(){delete e._delayTimer,e._reportNetworkQuality(),e._timer=window.setInterval((function(){e._reportNetworkQuality()}),2e3)}),300))},e.prototype._reportNetworkQuality=function(){var e,t,i=this;if(this._connectionState!==zF.CONNECTED)e=t=PP.VBAD;else{var r=this._getBetterQualityAndRemoveOldest(nB.AUDIO,"up"),n=this._getBetterQualityAndRemoveOldest(nB.VIDEO,"up");e=r&&n?Math.ceil((r+n)/2):r||n||this._getBetterQualityAndRemoveOldest(nB.SCREEN_VIDEO,"up")||this._getBetterQualityAndRemoveOldest(nB.SCREEN_AUDIO,"up")||PP.UNKNOWN;var o=Array.from(this._preDownlinkStats.keys()).map((function(e){return i._getBetterQualityAndRemoveOldest(e,"down")})).filter((function(e){return e}));t=Math.ceil(o.reduce((function(e,t){return t+e}),0)/o.length)||PP.UNKNOWN}this.reportor&&this.reportor(e,t)},e.prototype._getNetworkQuality=function(e,t){return t===rB.GOOD?Math.max(e-2,1):t===rB.MEDIUM?e:Math.min(e+1,5)},e.prototype._getQosLevel=function(e,t,i){var r;return r=e<=250&&t<=.15?iB.EXCELLENT:e<=500&&t<=.3?iB.GOOD:e<=750&&t<=.45?iB.POOR:e<=1e3&&t<=.6?iB.BAD:iB.VBAD,i>.5?r=Math.max(r,iB.BAD):i>.35?r=Math.max(r,iB.POOR):i>.15&&(r=Math.max(r,iB.GOOD)),r},e.prototype._getUplinkQoE=function(e,t){var i=rB.INVALID;switch(e){case nB.AUDIO:case nB.VIDEO:i=t<.05?rB.GOOD:t<.1?rB.MEDIUM:rB.POOR;break;case nB.SCREEN_VIDEO:case nB.SCREEN_AUDIO:i=t<.04?rB.GOOD:t<.08?rB.MEDIUM:rB.POOR}return i},e.prototype._getDownlinkQoE=function(e,t,i){var r=aB[e];return t>r.stallRadio||i>r.delay||t>r.stallRadio/2&&i>r.delay/2?rB.POOR:(t>r.stallRadio/2||r.delay,rB.MEDIUM)},e.prototype._getBetterQualityAndRemoveOldest=function(e,t){var i=PP.UNKNOWN,r="up"===t?this._preUplinkStats:this._preDownlinkStats,n=r.get(e);if(n){var o=n.filter((function(e){return e}));o.length>0&&(i=Math.min.apply(Math,nv([],rv(o),!1))),n.shift(),0===n.length&&r.delete(e)}return i},e.prototype._getStreamActiveState=function(e){var t=e.subMediaType,i=e._attributes,r=e.subVideo;return{audioActive:e.subAudio&&gD(t)&&i.localaudio&&i.audiostream,videoActive:r&&ED(t)&&i.localvideo&&i.videostream}},e}(),cB=function(){function e(e){this._room=e,this._remoteVideoSizeCache={},this._remoteScreenSizeCache={},this._start()}return e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}},e.prototype._start=function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},i={};e._room.remoteStreams.forEach((function(r,n){r.forEach((function(r){var o,a=null===(o=r.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=r.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[n]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,p=a.getSettings(),_=p.width,f=void 0===_?0:_,v=p.height,m=void 0===v?0:v;h===m&&d===f||e.onchange&&e.onchange(n,r.isScreen,f,m),delete s[n],(r.isScreen?i:t)[n]={width:f,height:m}}}))})),Object.keys(e._remoteVideoSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!1,0,0)})),Object.keys(e._remoteScreenSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=i}),1e3))},e}(),uB=kn.every;Br({target:"Array",proto:!0,forced:!Un("every")},{every:function(e){return uB(this,e,arguments.length>1?arguments[1]:void 0)}});var dB=new BD("SubscribeFallbackManager",2),lB=function(){function e(e){this._room=e,this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,this._inSubscribeRecoverChecking=!1,this._forbidSubRecover=!1,this._forbidSubRecoverDuration=1e4}return e.prototype.updateNetworkQuality=function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===PP.BAD||e===PP.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*PP.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===PP.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")},e.prototype.destroy=function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback},e.prototype._subscribeFallbackOrRecover=function(e){return ev(this,void 0,void 0,(function(){var t,i,r,n,o,a,s,c,u,d=this;return tv(this,(function(l){switch(l.label){case 0:if(this._isSubscribeFallbackOrRecover||this._room.connectionState!==zF.CONNECTED)return[2];if(this._room.subscribeFallbackOption!==wP.AUDIO_ONLY&&this._room.subscribeFallbackOption!==wP.VIDEO_STREAM_LOW)return[3,5];if(t=new Map,this._room.remoteStreams.forEach((function(i){i.forEach((function(i){if(i.hasSubscribed){var r="fallback"===e?i.getSubscribeFallbackParams(d._room.subscribeFallbackOption):i.getSubscribeRecoverParams();if(r){var n=i.getStreamPriority(),o=t.get(n)||[];o.push({stream:i,fallbackOrRecoverOption:r}),t.set(n,o)}}}))})),!(t.size>0))return[3,5];if(dB.print("_subscribeFallbackOrRecover()","start subscribe ".concat(e,".")),i=Array.from(t.keys()).sort((function(e,t){return e-t}))["fallback"===e?0:t.size-1],r=rv(t.get(i)||[],1),!(n=r[0]))return[3,5];o=n.stream,a=n.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,s=o.subLayer.spatialLayer,c=o.subVideo,dB.print("_subscribeFallbackOrRecover()","".concat(o.userId,"'s stream will be ").concat(e," to: MediaType=").concat(a[0]," subState=").concat(a[1]," subLayer=").concat(a[2])),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,SD([(u=this._room).updateSubTrack.apply(u,nv([o],rv(a),!1)).then((function(){"recover"===e?d._startSubscribeRecoverCheck():dB.print("_subscribeFallbackOrRecover()","fallback success."),d.onSubscribeFallback&&d.onSubscribeFallback({userId:o.userId,isScreen:o.isScreen,beforeEnable:c,beforeVideoIndex:s,afterEnable:o.subVideo,afterVideoIndex:o.subLayer.spatialLayer,reason:"fallback"===e?DP.SubscribeFallbackByBandwidth:DP.SubscribeRecoverByBandwidth})})),(h=2e3,new Promise((function(e){window.setTimeout(e,h)})))])];case 2:case 3:return l.sent(),[3,4];case 4:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,l.label=5;case 5:return[2]}var h}))}))},e.prototype._startSubscribeRecoverCheck=function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=1e4,delete e._subRecoverCheckTimer,dB.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)},e.prototype._stopSubscribeRecoverCheck=function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1},e.prototype._startForbidSubRecover=function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),dB.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)},e.prototype._stopForbidSubRecover=function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)},e}(),hB=new BD("Room",1),pB=function(e){function t(t,i){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._waitForNewToken=!1,r._userDuplicateLoginTimerMap=new Map,r._hasPublished=!1,r._roomConfig=t,r._mediaServerClient=new qF(i),r._reconnectRecord=new _B,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new sB,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(r),r._videoSizeObserver=new cB(r),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(r),r._subFallbackManager=new lB(r),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(r),r._context=i,r}return Qf(t,e),Object.defineProperty(t.prototype,"hasScreenPublished",{get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasPublished",{get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._mediaServerClient.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){return this._remoteUsers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){return this._remoteStreams},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localStream",{get:function(){return this._localStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenStream",{get:function(){return this._localScreenStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomInfo",{get:function(){return this._roomInfo},enumerable:!1,configurable:!0}),t.prototype._addHandlerEventHandler=function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T=this;null===(e=this._mediaServerClient)||void 0===e||e.on(xL.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(xL.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(xL.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(xL.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(xL.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(xL.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(xL.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(xL.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(xL.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(xL.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(xL.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(xL.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(xL.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(xL.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(xL.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(xL.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(VL.RSCP,this._onPublishOnDemand.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(FL.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(FL.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on("onRemoteStreamStats",(function(e){T._networkQualityManager.updateDownlinkStats(e,T._findRemoteStreamByScreen(e.userId,e.isScreen)),T.emit(lF.ON_REMOTE_STREAM_STATS,bD(e))})),null===(g=this._mediaServerClient)||void 0===g||g.on("onLocalStreamStats",(function(e){T._networkQualityManager.updateUplinkStats(e),T.emit(lF.ON_LOCAL_STREAM_STATS,bD(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e})),null===(b=this._mediaServerClient)||void 0===b||b.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,i,r,n,o){return ev(this,void 0,void 0,(function(){var a=this;return tv(this,(function(s){return mL.setStats({rtc_app_id:e,room_id:t,user_id:r.userId}),hB.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=function(e){var t;_L.joinRoom(ZU.END,a,!0,"",{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),s(e)},this._joinRejectCallback=function(e){var t;_L.joinRoom(ZU.END,a,!1,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)},this._liveControlMessage=n,this._roomInfo={appId:e,roomId:t,token:i,userInfo:r,useCloudProxy:o,roomProfile:this._roomConfig.roomProfileType},a=aD(),this.setSessionId(),_L.joinRoom(ZU.BEGIN,a,!1,"",{enable_cloud_proxy:null===(u=this._roomInfo)||void 0===u?void 0:u.useCloudProxy}),this._join(this._joinResolveCallback,this._joinRejectCallback,!1),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,i){return void 0===i&&(i=!1),ev(this,void 0,void 0,(function(){var r,n,o;return tv(this,(function(a){switch(a.label){case 0:r=aD(),hB.print("_join()"),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},i,this._liveControlMessage)];case 2:return n=a.sent(),this._mediaServerClient.roomAttributes=n.roomAttributes,this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e({users:n.clients,streams:n.streams}),this._isReconnecting=!1,_L.rtcJoinRoom(0,"web","web",aD()-r),this._onJoinSucc(n,i),[3,4];case 3:return(o=a.sent()).code!==Qw.OPERATION_CANCEL&&"function"==typeof t?[2,t(o)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,i,r,n){var o,a,s,c,u,d;return ev(this,void 0,void 0,(function(){var l,h,p,_;return tv(this,(function(f){switch(f.label){case 0:return hB.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new RF,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new oB(this._localScreenStream,this._mediaServerClient.handler))),l=!1,h=!1,p=!1,_=!1,!this._localScreenStream.videoTrack&&t?(t instanceof JV&&(h=!0),l=!0):this._localScreenStream.videoTrack&&!t&&(l=!1),!this._localScreenStream.audioTrack&&i?(i instanceof QV&&(_=!0),p=!0):this._localScreenStream.audioTrack&&!i&&(p=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=i,this._localScreenStream.videoEncodeConfig=e,r&&(gD(r)&&(this._localScreenStream.pubAudio=n===_F.PUB),ED(r)&&(this._localScreenStream.pubVideo=n===_F.PUB),hB.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo?this._localScreenStream.hasPublished?[3,2]:(null===(a=this._localScreenStream.observer)||void 0===a||a.setPublish(!0),[4,this._mediaServerClient.publish(this._localScreenStream)]):(null===(o=this._localScreenStream)||void 0===o?void 0:o.hasPublished)?[2,this.unpublishScreen()]:[2];case 1:return f.sent(),[3,4];case 2:return h?null===(s=this._localScreenStream.observer)||void 0===s||s.setPushVideo(l):null===(c=this._localScreenStream.observer)||void 0===c||c.setEnableVideo(l),_?null===(u=this._localScreenStream.observer)||void 0===u||u.setPushAudio(p):null===(d=this._localScreenStream.observer)||void 0===d||d.setEnableAudio(p),[4,this.updatePubScreenTrack()];case 3:f.sent(),f.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return hB.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 hB.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?(null===(e=this._localScreenStream.observer)||void 0===e||e.setPublish(!1),[4,this._mediaServerClient.unpublish(this._localScreenStream)]):[3,2];case 1:t.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,t.label=2;case 2:return[2]}}))}))},t.prototype.liveControlMessage=function(e){var t;return ev(this,void 0,void 0,(function(){var i=this;return tv(this,(function(r){switch(r.label){case 0:return hB.print("controlMessage","Invoke controlMessage"),null===(t=e.transcodeMeta)||void 0===t||t.layout.regions.forEach((function(e){i.roomInfo&&(e.roomID=i.roomInfo.roomId)})),this._liveControlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return r.sent(),"stopped"===e.action&&delete this._liveControlMessage,[2]}}))}))},t.prototype.publicStreamControlMessage=function(e){return 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 hB.print("updateUserAttributes","Invoke updateUserAttributes"),e.role&&this._roomInfo&&(this._roomInfo.userInfo.role=e.role),[4,this._mediaServerClient.updateUserAttributes(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.publish=function(e,t,i,r,n,o,a){var s,c,u,d,l,h;return void 0===a&&(a=!1),ev(this,void 0,void 0,(function(){var p,_,f,v,m,S;return tv(this,(function(y){switch(y.label){case 0:if(hB.print("publish","Invoke publish"),p=!1,this._localStream||(this._localStream=new RF,this._mediaServerClient.handler&&(this._localStream.observer=new oB(this._localStream,this._mediaServerClient.handler)),p=!0),this._localStream.videoTrack=i,this._localStream.audioTrack=r,this._localStream.videoEncodeConfig=e,this._localStream.enableSimulcast=t,n&&(gD(n)&&(this._localStream.pubAudio=o===_F.PUB),ED(n)&&(this._localStream.pubVideo=o===_F.PUB),hB.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished)return[3,5];if(!this._localStream.pubAudio&&!this._localStream.pubVideo)return[2];y.label=1;case 1:return y.trys.push([1,3,,4]),a?null===(s=this._localStream.observer)||void 0===s||s.setLogin(!0):p&&(_=!!this._localStream.videoTrack,f=!!this._localStream.audioTrack,v=this._localStream.videoTrack instanceof JV,m=this._localStream.audioTrack instanceof QV,this._roomConfig.isAutoPublish&&!this._hasPublished?(_&&(v?null===(c=this._localStream.observer)||void 0===c||c.setPushVideo(!0):null===(u=this._localStream.observer)||void 0===u||u.setEnableVideo(!0)),f&&(m?null===(d=this._localStream.observer)||void 0===d||d.setPushAudio(!0):null===(l=this._localStream.observer)||void 0===l||l.setEnableAudio(!0))):null===(h=this._localStream.observer)||void 0===h||h.setPublish(!0)),[4,this._mediaServerClient.publish(this._localStream)];case 2:return y.sent(),this._hasPublished=!0,this.emit(lF.ON_PUBLISH_RESULT,{isScreen:!1,state:mP.PUBLISH_SUCC}),[3,4];case 3:throw S=y.sent(),this.emit(lF.ON_PUBLISH_RESULT,{isScreen:!1,state:mP.PUBLISH_FAIL}),S;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:y.sent(),y.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return hB.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 hB.print("unpublish","Invoke unpublish"),this._localStream?[4,this._mediaServerClient.unpublish(this._localStream)]:[3,2];case 1:e.sent(),this._localStream.clean(),this._localStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.subscribe=function(e,t,i){return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(n){switch(n.label){case 0:return hB.print("subscribe","remoteStream %o",e),r=void 0,i&&(r=this._getSubLayer(i,e)),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,i,r){var n;return ev(this,void 0,void 0,(function(){return tv(this,(function(o){return hB.print("updateSubTrack","Invoke updateSubTrack"),[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(e,t,i,r)]}))}))},t.prototype.updateSubVideoConfig=function(e,t){var i,r,n;return ev(this,void 0,void 0,(function(){var o,a;return tv(this,(function(s){return!(o=this._findRemoteStreamByScreen(e,!1))||!o.hasSubscribed||(null===(r=null===(i=null==o?void 0:o.attributes)||void 0===i?void 0:i.videoDescriptions)||void 0===r?void 0:r.length)<=1?[2]:(a=this._getSubLayer(t,o),o.originalStreamIndex=a.spatialLayer,[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(o,o.subMediaType,fF.SUB,a)])}))}))},t.prototype._getSubLayer=function(e,t){for(var i,r,n,o,a,s=null==t?void 0:t.attributes,c=s.videoDescriptions,u=s.subVideoDescriptions,d=Array.isArray(u)?u:c,l=-1,h=e.width*e.height,p=0;p<(null==d?void 0:d.length);p++)if(h>=(null===(i=d[p])||void 0===i?void 0:i.width)*(null===(r=d[p])||void 0===r?void 0:r.height)){l=p;break}var _=d[0];if(-1===l)_=d[l=d.length-1];else if(0!==l){var f=d[l-1].width*d[l-1].height,v=(f-h)/(f-d[l].width*d[l].height);_=v<.1?d[l-1]:d[l],l=v<.1?l-1:l}return a=null!==(n=null==_?void 0:_.sub_index)&&void 0!==n?n:-1,{spatialLayer:null!==(o=null==_?void 0:_.video_index)&&void 0!==o?o:l,spatialSubLayer:a}},t.prototype.unsubscribe=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(i){switch(i.label){case 0:return hB.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e,t)];case 1:return i.sent(),[2]}}))}))},t.prototype.leave=function(e){var t;return void 0===e&&(e=!1),ev(this,void 0,void 0,(function(){var i,r,n,o,a,s,c;return tv(this,(function(u){switch(u.label){case 0:hB.print("leave","Invoke leave"),i=aD(),u.label=1;case 1:u.trys.push([1,3,,4]),clearTimeout(this._reconnectTimer);try{for(r=iv(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())o=n.value,Array.isArray(o)&&o.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(e){s={error:e}}finally{try{n&&!n.done&&(c=r.return)&&c.call(r)}finally{if(s)throw s.error}}return this._localStream&&(null===(t=this._localStream.observer)||void 0===t||t.setLogin(!1)),[4,this._mediaServerClient.leave()];case 2:return u.sent(),this.destroy(),_L.rtcLeaveRoom(0,"",aD()-i),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&_L.rtcLeaveRoom(-1,a.message,aD()-i),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteUserPriority=function(e,t){var i,r;null===(i=this.remoteStreams.get(e))||void 0===i||i.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(r=this.userPriorityMap)||void 0===r||r.set(e,t)},t.prototype.destroy=function(){var e,t,i,r;hB.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;try{for(var n=iv(this._remoteStreams),o=n.next();!o.done;o=n.next()){var a=rv(o.value,2)[1];Array.isArray(a)&&a.forEach((function(e){e&&e.clean()}))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._remoteStreams=new Map,this._localStream&&(null===(i=this._localStream)||void 0===i||i.clean(),this._localStream=void 0),this._localScreenStream&&(null===(r=this._localScreenStream)||void 0===r||r.clean(),this._localScreenStream=void 0),this._context=void 0,this._reconnectRecord=new _B,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy()},t.prototype.updateToken=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return hB.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e),[4,this._mediaServerClient.updateToken(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return ev(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return tv(this,(function(c){t=[];try{for(i=iv(this._remoteStreams.values()),r=i.next();!r.done;r=i.next())n=r.value,Array.isArray(n)&&n.forEach((function(i){if(i.hasSubscribed){var r=s.updateSubTrack(i,e,fF.UNSUB);r&&t.push(r)}}))}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return ev(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return tv(this,(function(c){t=[];try{for(i=iv(this._remoteStreams.values()),r=i.next();!r.done;r=i.next())n=r.value,Array.isArray(n)&&n.forEach((function(i){if(i.hasSubscribed&&i.hasSubscribed){var r=s.updateSubTrack(i,e,fF.SUB);r&&t.push(r)}}))}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.sendUserMessage=function(e,t){var i;return null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendUserMessage(e,t)},t.prototype.setSessionId=function(){this._sessionId=iD(),mL.setStats({rtc_session_id:this._sessionId})},t.prototype.sendRoomMessage=function(e,t){var i,r;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===(i=this._roomInfo)||void 0===i?void 0:i.userInfo.userId,binary:t,message:""},t?(o=n,[4,uD.ab2b64str(e)]):[3,2];case 1:return o.message=a.sent(),[3,3];case 2:n.message=e,a.label=3;case 3:return[2,null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendRoomMessage(n)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){hB.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new qF(this._context),this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var i,r,n,o,a,s=this;hB.print("JoinSuccess()"),this._serverConfig=e.config;var c=[],u=[],d=[],l=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var i=s._remoteUsers.get(t.clientId);i?i._stillExist=!0:c.push(t)}}));try{for(var h=iv(this._remoteUsers.values()),p=h.next();!p.done;p=h.next()){var _=p.value;_._stillExist||u.push({clientId:_.userId}),delete _._stillExist}}catch(e){i={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(i)throw i.error}}e.streams.forEach((function(e){var t=s._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):l.push(e)}));try{for(var f=iv(this._remoteStreams.values()),v=f.next();!v.done;v=f.next()){var m=v.value;Array.isArray(m)&&m.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:UL.clientDisconnected})}))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}setTimeout((function(){u.forEach((function(e){return s._onUserDisconnection(e)})),c.forEach((function(e){return s._onUserConnection(e)})),d.forEach((function(e){return s._onRemoveStream(e)})),l.forEach((function(e){return s._onAddStream(e,!0,!1)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,i=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));try{for(var r=iv(this._remoteStreams.values()),n=r.next();!n.done;n=r.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return ev(i,void 0,void 0,(function(){var t;return tv(this,(function(i){switch(i.label){case 0:if(!e.hasSubscribed)return[3,4];e.resetHasSubscribed(),i.label=1;case 1:return i.trys.push([1,3,,4]),hB.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType)];case 2:return i.sent(),hB.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(lF.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=i.sent(),hB.print("failed resubscribe ".concat(e.userId," with ").concat(e.subMediaType,", error:").concat(t)),e.clean(),null==e||e.resetHasSubscribed(),[3,4];case 4:return[2]}}))}))}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype._findRemoteStream=function(e,t){var i=this._remoteStreams.get(e);return Array.isArray(i)?i.find((function(e){return e.streamId===t})):null},t.prototype._findRemoteStreamByScreen=function(e,t){var i=this._remoteStreams.get(e);return Array.isArray(i)?i.find((function(e){return e.isScreen===t})):null},t.prototype._onAddStream=function(e,t,i){var r,n,o,a,s,c,u,d,l,h,p;if(void 0===t&&(t=!0),void 0===i&&(i=!0),e.clientId!==(null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId)){var _=this._findRemoteStream(e.clientId,e.streamId);if(!_){_=new AF(e.clientId,e.streamId,e.screen,e.attributes,null===(n=this.userPriorityMap)||void 0===n?void 0:n.get(e.clientId)),this._initStreamListeners(_);var f=this._remoteStreams.get(e.clientId);f?f.push(_):this._remoteStreams.set(e.clientId,[_])}if(this._mediaServerClient.handler&&(_.observer=new eB(_,this._mediaServerClient.handler)),!_.isScreen&&(i&&_.hasVideo&&(_.attributes.extvideo?(null===(o=_.observer)||void 0===o||o.setExternalVideoSource(!0),null===(a=_.observer)||void 0===a||a.setPushVideo(!0)):(null===(s=_.observer)||void 0===s||s.setExternalVideoSource(!1),null===(c=_.observer)||void 0===c||c.setPublishVideo(!0))),i&&_.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(_.attributes.extaudio?(null===(u=_.observer)||void 0===u||u.setExternalAudioSource(!0),null===(d=_.observer)||void 0===d||d.setPushAudio(!0)):(null===(l=_.observer)||void 0===l||l.setExternalAudioSource(!1),null===(h=_.observer)||void 0===h||h.setPublishAudio(!0))),!0===t&&!1===i)){var v=this._roomConfig,m=v.isAutoSubscribeAudio,S=v.isAutoSubscribeVideo;null===(p=_.observer)||void 0===p||p.setLogin(!0,{audio:!!m,video:!!S})}return t&&this.safeEmit(xL.ON_ADD_STREAM,{stream:_}),_}},t.prototype._onUserConnection=function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof i)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(i);var r={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,Zf({},r)),this.safeEmit(xL.USER_CONNECTION,{userInfo:r})}},t.prototype._onUserDisconnection=function(e){var t,i=this,r=e.clientId,n=e.tag,o=e.code;if(r)if(r===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;n===BL.kickedByAdmin?a=Qw.KICKED_OUT:n===BL.onUserTokenDidExpire?a=Qw.TOKEN_EXPIRED:n===BL.userDuplicateLogin&&(a=Qw.DUPLICATE_LOGIN),o===jL.roomDismissByAdmin&&(a=Qw.ROOM_DISMISS),a&&this.safeEmit(lF.ON_ROOM_ERROR,{errorCode:a})}else{var s=pP.DROPPED;n===BL.userLeave?s=pP.QUIT:n===BL.kickedByAdmin?s=pP.KICKED_BY_ADMIN:n===BL.roleChanged&&(s=pP.SWITCH_TO_INVISIBLE);var c=function(){i._remoteUsers.delete(r),i.safeEmit(lF.ON_USER_LEAVE,{userInfo:{userId:r},reason:s})};if(n===BL.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(r);null!=u||self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(r,d)}else c()}},t.prototype._onRemoveStream=function(e){var t,i,r,n,o=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=this._remoteStreams.get(e.clientId);if(a){var s=a.find((function(t){return t.streamId==e.streamId}));s&&(null===(i=this._mediaServerClient)||void 0===i||i.handleRemoveStream(s,e).then((function(){if(!(null==s?void 0:s._workaround_1_)){var t=o._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),o._remoteStreams.set(e.clientId,t)}})).finally((function(){o.safeEmit(xL.ON_REMOVE_STREAM,{stream:s,reason:e.message})})),s.hasVideo&&(null===(r=s.observer)||void 0===r||r.setPublishVideo(!1)),s.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(null===(n=s.observer)||void 0===n||n.setPublishAudio(!1)))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t,i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y=e.clientId,g=e.streamId,E=e.attributes,b=this._findRemoteStream(y,g);if(b){var T=b.attributes,I=Zf(Zf({},T),E),R=!1,A=I.localaudio!==T.localaudio,C=!1,O=!1,w=I.localvideo!==T.localvideo,N=!1,P=NV.NONE,D=NV.NONE;I.audiostream!==T.audiostream&&(R=I.localaudio,C=!!I.audiostream,I.audiostream?P|=EP.AUDIO:D|=EP.AUDIO),I.videostream!==T.videostream&&(O=I.localvideo,N=!!I.videostream,I.videostream?P|=EP.VIDEO:D|=EP.VIDEO),P&&this.safeEmit(lF.ON_USER_PUBLISH_STATE_CHANGE,{userId:y,mediaType:P,isScreen:b.isScreen,pubState:_F.PUB,remoteStream:b}),D&&this.safeEmit(lF.ON_USER_PUBLISH_STATE_CHANGE,{userId:y,mediaType:D,isScreen:b.isScreen,pubState:_F.UNPUB,remoteStream:b}),I.localaudio!==T.localaudio&&(I.localaudio?(I.extaudio?(null===(t=b.observer)||void 0===t||t.setExternalAudioSource(!0),null===(i=b.observer)||void 0===i||i.setPushAudio(!0)):(null===(r=b.observer)||void 0===r||r.setExternalAudioSource(!1),null===(n=b.observer)||void 0===n||n.setEnableAudio(!0)),this.safeEmit(lF.ON_USER_START_AUDIO_CAPTURE,{userId:y})):(I.extaudio?(null===(o=b.observer)||void 0===o||o.setExternalAudioSource(!0),null===(a=b.observer)||void 0===a||a.setPushAudio(!1)):(null===(s=b.observer)||void 0===s||s.setExternalAudioSource(!1),null===(c=b.observer)||void 0===c||c.setEnableAudio(!1)),!b.isScreen&&this.safeEmit(lF.ON_USER_STOP_AUDIO_CAPTURE,{userId:y}))),I.localvideo!==T.localvideo&&(I.localvideo?(I.extvideo?(null===(u=b.observer)||void 0===u||u.setExternalVideoSource(!0),null===(d=b.observer)||void 0===d||d.setPushVideo(!0)):(null===(l=b.observer)||void 0===l||l.setExternalVideoSource(!1),null===(h=b.observer)||void 0===h||h.setEnableVideo(!0)),this.safeEmit(lF.ON_USER_START_VIDEO_CAPTURE,{userId:y})):(I.extvideo?(null===(p=b.observer)||void 0===p||p.setExternalVideoSource(!0),null===(_=b.observer)||void 0===_||_.setPushVideo(!1)):(null===(f=b.observer)||void 0===f||f.setExternalVideoSource(!1),null===(v=b.observer)||void 0===v||v.setEnableVideo(!1)),!b.isScreen&&this.safeEmit(lF.ON_USER_STOP_VIDEO_CAPTURE,{userId:y}))),R&&!A&&(null===(m=b.observer)||void 0===m||m.setRemoteUnmuteAudio(C)),O&&!w&&(null===(S=b.observer)||void 0===S||S.setRemoteUnmuteVideo(N)),b.attributes=I}},t.prototype._onPushTrack=function(e){var t=this,i=e.clientId,r=e.streamId,n=this._findRemoteStream(i,r);n||(n=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){return t.safeEmit(lF.SUBSCRIBE_PUSH_TRACK,{stream:n})})).catch((function(e){hB.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,i=e.clientId,r=e.streamId,n=e.message,o=this._findRemoteStream(i,r);o&&this._mediaServerClient.unsubscribe4removeTrack(o,n).then((function(){var e;if(o._workaround_1_){var n=null===(e=t._remoteStreams.get(i))||void 0===e?void 0:e.filter((function(e){return e.streamId!==r}));t._remoteStreams.set(i,n||[])}t.safeEmit(lF.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){hB.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,i=e.nodes,r=e.reason;AL.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(i)&&i.length?this._getAccessNode=i[0]:this._getAccessFeedback=r,_L.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(r)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,i=this;this._isReconnecting=!0;try{for(var r=iv(this._remoteStreams.values()),n=r.next();!n.done;n=r.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return e.clean()}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}_L.rtcReconnect(1002,RU.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,AU.PEERCONNECTION),this._join((function(){_L.rtcReconnected(CU.PEERCONNECTION_RECONNECTED,OU.PEERCONNECTION)}),(function(e){i._reconnectRecord.record(e),i._reconnectRecord.shouldReconnect?(hB.print("Reconnecting error, will reconnect after 3s",e),i._reconnectTimer=window.setTimeout(i._reconnect.bind(i),3e3)):(i.safeEmit(lF.RECONNECT_FAILED),i.destroy())}),!0)},t.prototype._handleAbnormalDisconnection=function(){hB.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._onConnectionStateChange=function(e){var t,i=this;if(e.next===zF.DISCONNECTED)t=TP.CONNECTION_STATE_DISCONNECTED;else if(e.next===zF.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?TP.CONNECTION_STATE_RECONNECTED:TP.CONNECTION_STATE_CONNECTED;else{if(e.next!==zF.CONNECTING)return;t=this._isReconnecting?TP.CONNECTION_STATE_RECONNECTING:TP.CONNECTION_STATE_CONNECTING}e.prev===zF.CONNECTED&&e.next===zF.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){i.safeEmit(FL.ON_CONNECTION_STATE_CHANGE,{state:TP.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(FL.ON_CONNECTION_STATE_CHANGE,{state:t})},t.prototype._initStreamListeners=function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(i){var r;t.emit(lF.ON_SEI_MESSAGED_RECEIVED,{sei:i,remoteStreamKey:{userId:e.userId,roomId:null===(r=t._roomInfo)||void 0===r?void 0:r.roomId,streamIndex:e.isScreen?gP.STREAM_INDEX_SCREEN:gP.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(xL.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(xL.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(xL.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){if(e.body){var t=e.body,i=t.error||0,r=pF.START,n=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(r=pF.START_FAILED);break;case"TranscodeStateChanged":r=0!==t.error?pF.START_FAILED:pF.START_SUCCESS;break;case"TranscodeStopped":r=0!==t.error?pF.STOP_FAILED:pF.STOP_SUCCESS;break;case"TranscodeUpdated":r=0!==t.error?pF.UPDATE_FAILED:pF.UPDATE_SUCCESS}this.safeEmit(xL.POST_PROCESSING_MESSAGE,{code:i,protocol:t.protocol,error:t.error,eventType:r,message:n[i]})}this.safeEmit(xL.POST_PROCESSING_MESSAGE,{code:i,message:n[i],type:e.type})}},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(xL.ON_USER_TOKEN_WILL_EXPIRE,null)},t.prototype._onSceneConfig=function(e){var t,i,r=e.multiSceneConfig,n=KF[this._roomConfig.roomProfileType][1];if(r){var o=r[n];o&&o.engine_BAC&&(null===(t=this._context)||void 0===t||t.audioProfileManager.updateEngineBAC(o.engine_BAC)),o&&o.engine_ANM&&(null===(i=this._context)||void 0===i||i.audioProfileManager.updateEngineANM(o.engine_ANM))}},t.prototype._onStreamControlMessage=function(e){var t,i;e.type===LL.PushLimitWarn&&((null===(t=this._localStream)||void 0===t?void 0:t.pubAudio)||(null===(i=this._localStream)||void 0===i?void 0:i.pubVideo)||this.unpublish())},t.prototype._onPublishOnDemand=function(e){var t,i,r,n,o,a,s,c,u,d,l;if(!1!==(null===(r=null===(i=null===(t=this._serverConfig)||void 0===t?void 0:t.engine_VPM)||void 0===i?void 0:i.ondemand)||void 0===r?void 0:r.enable)&&(null===(n=this._localStream)||void 0===n?void 0:n.enableSimulcast)&&(null===(o=this._localStream)||void 0===o?void 0:o.videoTransceiver)){var h=null===(a=this._localStream)||void 0===a?void 0:a.stream.id,p=null===(s=this._localStream)||void 0===s?void 0:s.videoTransceiver.sender,_=p.getParameters();if(Array.isArray(_.encodings)&&Array.isArray(e)){var f={};hB.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null===(t=null==e?void 0:e.StreamIds)||void 0===t?void 0:t.includes(h)){var i=null==e?void 0:e.Metadata.SubvideoIndex;f[i]=i}}));var v={};null===(u=null===(c=this._localStream)||void 0===c?void 0:c.subVideoDescriptions)||void 0===u||u.forEach((function(e){void 0!==f[e.sub_index]&&(v[e.video_index]=e)}));var m=(null===(l=null===(d=p.track)||void 0===d?void 0:d.getSettings())||void 0===l?void 0:l.height)||720,S=[];_.encodings=_.encodings.map((function(e){return e.rid&&(v[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/v[e.rid].height,1),S.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy})):(S.push({type:0,rid:e.rid}),e.active=!1)),e})),_L.rtcInvokeStatus(JSON.stringify(S),0,"rscp",h,0)}p.setParameters(_)}},t.prototype._reportNetworkQuality=function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(lF.ON_NETWORK_QUALITY,e,t)},t.prototype._emitVideoSizeChange=function(e,t,i,r){var n;this.emit(lF.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(n=this.roomInfo)||void 0===n?void 0:n.roomId,userId:e,streamIndex:t?gP.STREAM_INDEX_SCREEN:gP.STREAM_INDEX_MAIN},{width:i,height:r})},t.prototype._emitSubscribeFallback=function(e){this.emit(lF.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)},t}(GD),_B=function(){function e(){this._all_201_count=0,this._has_4xx=!1}return Object.defineProperty(e.prototype,"shouldReconnect",{get:function(){return!(this._all_201_count>=3||this._has_4xx)},enumerable:!1,configurable:!0}),e.prototype.record=function(e){var t=!1,i=!1;if(Array.isArray(e)){var r=0;e.map((function(e){var t,n,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(n=e.error)||void 0===n?void 0:n.code)<500&&(i=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&r++})),r===e.length&&(t=!0),t&&this._all_201_count++,i&&(this._has_4xx=!0)}},e.prototype.clear=function(){this._all_201_count=0,this._has_4xx=!1},e}(),fB=function(e,t){void 0===t&&(t={});var i=document.createElement(e);return t.id&&(i.id=t.id),t.classList&&t.classList.forEach((function(e){i.classList.add(e)})),t.style&&Object.assign(i.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=rv(e,2),r=t[0],n=t[1];"muted"===r?i.muted=!0:i.setAttribute(r,n)})),i},vB=function(e,t){return void 0===t&&(t={}),t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var i=rv(t,2),r=i[0],n=i[1];e.setAttribute(r,n)})),e},mB=new BD("Player",0),SB=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],yB={playsinline:"","webkit-playsinline":""},gB={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},EB=new(function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var i="audio"===e?yB:gB;if("video"===e&&this.videoCache.length>0){if(r=this.videoCache.pop())return vB(r,{style:t,attributes:i}),r}else if("audio"===e&&this.audioCache.length>0){var r;if(r=this.audioCache.pop())return vB(r,{style:t,attributes:i}),r}return fB(e,{style:t,attributes:i})},e.prototype.recycle=function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)},e}()),bB=function(e){function t(t){var i=e.call(this)||this;i.mirrorType=IP.MIRROR_TYPE_NONE,i.played=!1,i._emitPlayFailed=!1,i.emitVideoEvent=function(e){var t,r,n={type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:e.type,currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0,isScreen:i.isScreen};i.emit("playback_event",n)},i._internalPlay=function(){var e;if(null===(e=i._videoDom)||void 0===e?void 0:e.paused){var t=i._videoDom.play();(null==t?void 0:t.then)&&t.catch((function(e){var t,r;i._emitPlayFailed||(i._emitPlayFailed=!0,_L.rtcError("video autoplay failed, userId: ".concat(i.userId),-1e3),i.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:"autoplay-error",currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0}))}))}};var r=t.renderDom,n=t.userId;i.renderMode=void 0!==t.renderMode?t.renderMode:yP.RENDER_MODE_FIT;var o="string"==typeof r?document.getElementById(r):r;if(!o)throw new tN(Qw.CANT_FIND_DOM,"can't find dom");return i._containerDom=o,i.userId=n,i.isScreen=!!t.isScreen,i._initVideo(),i}return Qf(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=EB.getOrCreate("video",{width:"100%",height:"100%"}),this._videoDom.id="".concat(this.userId,"_").concat(oD()),this.renderMode===yP.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===IP.MIRROR_TYPE_RENDER)),this._containerDom.appendChild(this._videoDom),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&SB.forEach((function(t){var i;null===(i=e._videoDom)||void 0===i||i.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._videoDom&&(SB.forEach((function(t){var i;null===(i=e._videoDom)||void 0===i||i.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(i){var r;if("timeupdate"===i.eventName){var n=e.isScreen?1.5:.5;if(0===(null===(r=t._videoDom)||void 0===r?void 0:r.currentTime))return;if(void 0===t.__cumulativeTime)return void(t.__cumulativeTime=t._videoDom.currentTime);if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>n;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var i;return ev(this,void 0,void 0,(function(){var r,n,o=this;return tv(this,(function(a){return r=this._videoDom,mB.print("playVideo","play video track: ".concat(this.userId)),r&&r.srcObject instanceof MediaStream&&r.srcObject.getTrackById(null===(i=e.getTrack())||void 0===i?void 0:i.id)||(r||(this._initVideo(),r=this._videoDom),mB.print("playVideo","play video by dom: ".concat(null==r?void 0:r.id)),(n=new MediaStream).addTrack(e.getTrack()),r.srcObject=n,r&&!this._containerDom.contains(r)&&this._containerDom.appendChild(r),r.addEventListener("canplay",this._internalPlay),r.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return o._internalPlay()})),t&&this._recordFrame(t),this.played=!0),[2]}))}))},t.prototype.updateSrcObject=function(e){var t=e.getTrack();if(t&&this._videoDom){var i=new MediaStream;i.addTrack(t),this._videoDom.srcObject=i}},t.prototype.manuallyPlay=function(){if(mB.print("Invoke VideoPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._videoDom)throw new tN(Qw.INVALID_PARAMS,"Player not found");return this._videoDom.play()},t.prototype.mirror=function(e){mB.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?IP.MIRROR_TYPE_RENDER:IP.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;mB.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom)),this.__cumulativeTime=void 0,this.played=!1},t.prototype.destroy=function(){mB.print("destroy","video player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._videoDom&&(EB.recycle(this._videoDom),delete this._videoDom)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(LD.exports.EventEmitter),TB=function(e){function t(t,i){var r=void 0===i?{divId:void 0,muted:!1}:i,n=r.divId,o=r.muted,a=e.call(this)||this;if(a.muted=!1,a._emitPlayFailed=!1,a.played=!1,a.emitAudioEvent=function(e){var t,i,r={type:"audio",rawEvent:e,readyState:(null===(t=a._audioDom)||void 0===t?void 0:t.readyState)||0,userId:a.userId,eventName:e.type,currentTime:(null===(i=a._audioDom)||void 0===i?void 0:i.currentTime)||0};a.emit("playback_event",r)},a._internalPlay=function(){var e,t;if(TL("_internalPlay",{paused:null===(e=a._audioDom)||void 0===e?void 0:e.paused}),null===(t=a._audioDom)||void 0===t?void 0:t.paused)try{var i=a._audioDom.play();(null==i?void 0:i.then)&&i.catch((function(e){a._autoPlayError(e)})).then((function(){TL("_internalPlay successfully",{userId:a.userId})}))}catch(e){a._autoPlayError(e)}},n){var s=document.getElementById(n);if(!s)throw new tN(Qw.CANT_FIND_DOM,"can't find dom");a._containerDom=s}else a._containerDom=document.body;return a.userId=t,a.muted=o,a._initAudio(),a}return Qf(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=EB.getOrCreate("audio",{display:"none"}),this._audioDom.volume=this.muted?0:1,this._audioDom.id="".concat(this.userId,"_").concat(oD()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&SB.forEach((function(t){var i;null===(i=e._audioDom)||void 0===i||i.addEventListener(t,e.emitAudioEvent)}))},t.prototype._removeListeners=function(){var e=this;this._audioDom&&(SB.forEach((function(t){var i;null===(i=e._audioDom)||void 0===i||i.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))},t.prototype.playAudio=function(e){var t;return ev(this,void 0,void 0,(function(){var i,r,n=this;return tv(this,(function(o){return mB.print("playAudio","play audio track: ".concat(this.userId)),(i=this._audioDom)&&i.srcObject instanceof MediaStream&&i.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)||(i||(this._initAudio(),i=this._audioDom),(r=new MediaStream).addTrack(e.getTrack()),i.srcObject=r,null==i||i.addEventListener("canplay",this._internalPlay),null==i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return n._internalPlay()})),this.played=!0),[2]}))}))},t.prototype._autoPlayError=function(e){var t,i;this._emitPlayFailed||(this._emitPlayFailed=!0,_L.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(i=this._audioDom)||void 0===i?void 0:i.currentTime)||0}))},t.prototype.manuallyPlay=function(){var e;if(mB.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new tN(Qw.INVALID_PARAMS,"Player not found");null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return(null==t?void 0:t.then)?t:Promise.resolve(t)},t.prototype.setPlaybackDevice=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(i){switch(i.label){case 0:return mB.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,DV.enumerateAudioPlaybackDevices()];case 1:return t=i.sent(),t.map((function(e){return e.deviceId})).includes(e)&&this._audioDom&&this._audioDom.setSinkId?[4,this._audioDom.setSinkId(e)]:[2];case 2:return i.sent(),[2]}}))}))},t.prototype.stop=function(){var e=this._containerDom;mB.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){mB.print("destroy","audio player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._audioDom&&(EB.recycle(this._audioDom),delete this._audioDom)},t}(LD.exports.EventEmitter),IB=function(){function e(){this.userMessage={},this.roomMessage={},this._setTimer()}return e.prototype._setTimer=function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()},e.prototype._reportAndgReset=function(){this._report(),this._reset()},e.prototype._report=function(){var e=this;_L.rtcMessageStatistics(Object.keys(this.userMessage).map((function(t){return e.userMessage[t]})),Object.keys(this.roomMessage).map((function(t){return e.roomMessage[t]})),"")},e.prototype._reset=function(){this.userMessage={},this.roomMessage={}},e.prototype._checkInitUserMessage=function(e,t){this.userMessage["".concat(t,"-").concat(e)]||(this.userMessage["".concat(t,"-").concat(e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_cost_time:0,dc_cost_e2s:0,dc_cost_s2s:0,dc_least_time:1/0,dc_most_time:0,dc_cost_peer_s2e:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_message_type:t,dc_send_binary:0})},e.prototype._sendUserMessage=function(e,t,i){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_send_total++,i&&this.userMessage["".concat(t,"-").concat(e)].dc_send_binary++},e.prototype._recvUserMessage=function(e,t){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_recv_total++},e.prototype._sendUserFail=function(e,t){var i=this.userMessage["".concat(t,"-").concat(e)];i&&i.dc_send_fail++},e.prototype._sendUserAck=function(e,t,i,r,n){var o=this.userMessage["".concat(t,"-").concat(e)];o&&(o.dc_send_ack++,o.dc_cost_time+=i,o.dc_cost_s2s+=r||0,o.dc_cost_peer_s2e+=n,o.dc_cost_e2s+=i-(r||0)-n,i<=100?(o.dc_send_ack_100++,o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=200?(o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=400?(o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=1e3&&o.dc_send_ack_1s++,i<o.dc_least_time&&(o.dc_least_time=i),i>o.dc_most_time&&(o.dc_most_time=i))},e.prototype.sendRoomMessage=function(e,t){this.roomMessage[e]||(this.roomMessage[e]={dc_room_id:e,dc_send_total:0,dc_send_ack:0,dc_cost_time:0,dc_least_time:1/0,dc_most_time:0,dc_send_fail:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_send_binary:0}),this.roomMessage[e].dc_send_total++,t&&this.roomMessage[e].dc_send_binary++},e.prototype.sendRoomFail=function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++},e.prototype.sendRoomAck=function(e,t){var i=this.roomMessage[e];i&&(i.dc_send_ack++,i.dc_cost_time+=t,t<i.dc_least_time&&(i.dc_least_time=t),t>i.dc_most_time&&(i.dc_most_time=t),t<=100?(i.dc_send_ack_100++,i.dc_send_ack_200++,i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=200?(i.dc_send_ack_200++,i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=400?(i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=1e3&&i.dc_send_ack_1s++)},e.prototype.sendP2PMessage=function(e,t){this._sendUserMessage(e,rL.P2P,t)},e.prototype.recvP2PMessage=function(e){this._recvUserMessage(e,rL.P2P)},e.prototype.sendP2PFail=function(e){this._sendUserFail(e,rL.P2P)},e.prototype.sendP2PAck=function(e,t,i,r){this._sendUserAck(e,rL.P2P,t,i,r)},e.prototype.sendP2POutRoomMessage=function(e,t){this._sendUserMessage(e,rL.P2P_OUTSIDE_ROOM,t)},e.prototype.recvP2POutRoomMessage=function(e){this._recvUserMessage(e,rL.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomFail=function(e){this._sendUserFail(e,rL.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomAck=function(e,t,i,r){this._sendUserAck(e,rL.P2P_OUTSIDE_ROOM,t,i,r)},e.prototype.sendP2serverMessage=function(e){this._sendUserMessage("",rL.P2SERVER,e)},e.prototype.sendP2serverFail=function(){this._sendUserFail("",rL.P2SERVER)},e.prototype.sendP2serveAck=function(e){this._sendUserAck("",rL.P2SERVER,e,0,0)},e.prototype.countP2PMessage=function(e,t,i,r,n){this.sendP2PMessage(t,i),e?this.sendP2PAck(t,Date.now()-r,n.s2s_time,n.s2e_time):this.sendP2PFail(t)},e.prototype.countRoomMessage=function(e,t,i,r){this.sendRoomMessage(t,i),e?this.sendRoomAck(t,Date.now()-r):this.sendRoomFail(t)},e.prototype.countUserMessageOutsideRoom=function(e,t,i,r,n){this.sendP2POutRoomMessage(t,i),e?this.sendP2POutRoomAck(t,Date.now()-r,n.s2s_time,n.s2e_time):this.sendP2POutRoomFail(t)},e.prototype.countServerMessage=function(e,t,i){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-i):this.sendP2serverFail()},e.prototype.destroy=function(){this._reset(),clearTimeout(this._timer)},e}(),RB="object"==("undefined"==typeof global?"undefined":us(global))&&global&&global.Object===Object&&global,AB="object"==("undefined"==typeof self?"undefined":us(self))&&self&&self.Object===Object&&self,CB=RB||AB||Function("return this")(),OB=CB.Symbol,wB=Object.prototype,NB=wB.hasOwnProperty,PB=wB.toString,DB=OB?OB.toStringTag:void 0;var kB=Object.prototype.toString;var MB=OB?OB.toStringTag:void 0;function UB(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":MB&&MB in Object(e)?function(e){var t=NB.call(e,DB),i=e[DB];try{e[DB]=void 0;var r=!0}catch(e){}var n=PB.call(e);return r&&(t?e[DB]=i:delete e[DB]),n}(e):function(e){return kB.call(e)}(e)}function LB(e){return null!=e&&"object"==us(e)}var xB=Array.isArray;function VB(e){var t=us(e);return null!=e&&("object"==t||"function"==t)}function FB(e){return e}function BB(e){if(!VB(e))return!1;var t=UB(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var jB=CB["__core-js_shared__"],GB=function(){var e=/[^.]+$/.exec(jB&&jB.keys&&jB.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var HB=Function.prototype.toString;var zB=/^\[object .+?Constructor\]$/,KB=Function.prototype,WB=Object.prototype,YB=KB.toString,XB=WB.hasOwnProperty,qB=RegExp("^"+YB.call(XB).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function JB(e){return!(!VB(e)||(t=e,GB&&GB in t))&&(BB(e)?qB:zB).test(function(e){if(null!=e){try{return HB.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function QB(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}var ZB=Date.now;var $B,ej,tj,ij=function(){try{var e=function(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return JB(i)?i:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),rj=ij,nj=rj?function(e,t){return rj(e,"toString",{configurable:!0,enumerable:!1,value:(i=t,function(){return i}),writable:!0});var i}:FB,oj=($B=nj,ej=0,tj=0,function(){var e=ZB(),t=16-(e-tj);if(tj=e,t>0){if(++ej>=800)return arguments[0]}else ej=0;return $B.apply(void 0,arguments)}),aj=/^(?:0|[1-9]\d*)$/;function sj(e,t){var i=us(e);return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&aj.test(e))&&e>-1&&e%1==0&&e<t}function cj(e,t,i){"__proto__"==t&&rj?rj(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}function uj(e,t){return e===t||e!=e&&t!=t}var dj=Object.prototype.hasOwnProperty;function lj(e,t,i){var r=e[t];dj.call(e,t)&&uj(r,i)&&(void 0!==i||t in e)||cj(e,t,i)}var hj=Math.max;function pj(e,t){return oj(function(e,t,i){return t=hj(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,o=hj(r.length-t,0),a=Array(o);++n<o;)a[n]=r[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=r[n];return s[t]=i(a),QB(e,this,s)}}(e,t,FB),e+"")}function _j(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function fj(e){return null!=e&&_j(e.length)&&!BB(e)}var vj=Object.prototype;function mj(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||vj)}function Sj(e){return LB(e)&&"[object Arguments]"==UB(e)}var yj=Object.prototype,gj=yj.hasOwnProperty,Ej=yj.propertyIsEnumerable,bj=Sj(function(){return arguments}())?Sj:function(e){return LB(e)&&gj.call(e,"callee")&&!Ej.call(e,"callee")};var Tj="object"==("undefined"==typeof exports?"undefined":us(exports))&&exports&&!exports.nodeType&&exports,Ij=Tj&&"object"==("undefined"==typeof module?"undefined":us(module))&&module&&!module.nodeType&&module,Rj=Ij&&Ij.exports===Tj?CB.Buffer:void 0,Aj=(Rj?Rj.isBuffer:void 0)||function(){return!1},Cj={};Cj["[object Float32Array]"]=Cj["[object Float64Array]"]=Cj["[object Int8Array]"]=Cj["[object Int16Array]"]=Cj["[object Int32Array]"]=Cj["[object Uint8Array]"]=Cj["[object Uint8ClampedArray]"]=Cj["[object Uint16Array]"]=Cj["[object Uint32Array]"]=!0,Cj["[object Arguments]"]=Cj["[object Array]"]=Cj["[object ArrayBuffer]"]=Cj["[object Boolean]"]=Cj["[object DataView]"]=Cj["[object Date]"]=Cj["[object Error]"]=Cj["[object Function]"]=Cj["[object Map]"]=Cj["[object Number]"]=Cj["[object Object]"]=Cj["[object RegExp]"]=Cj["[object Set]"]=Cj["[object String]"]=Cj["[object WeakMap]"]=!1;var Oj="object"==("undefined"==typeof exports?"undefined":us(exports))&&exports&&!exports.nodeType&&exports,wj=Oj&&"object"==("undefined"==typeof module?"undefined":us(module))&&module&&!module.nodeType&&module,Nj=wj&&wj.exports===Oj&&RB.process,Pj=function(){try{var e=wj&&wj.require&&wj.require("util").types;return e||Nj&&Nj.binding&&Nj.binding("util")}catch(e){}}(),Dj=Pj&&Pj.isTypedArray,kj=Dj?function(e){return function(t){return e(t)}}(Dj):function(e){return LB(e)&&_j(e.length)&&!!Cj[UB(e)]},Mj=kj,Uj=Object.prototype.hasOwnProperty;function Lj(e,t){var i=xB(e),r=!i&&bj(e),n=!i&&!r&&Aj(e),o=!i&&!r&&!n&&Mj(e),a=i||r||n||o,s=a?function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}(e.length,String):[],c=s.length;for(var u in e)!t&&!Uj.call(e,u)||a&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||sj(u,c))||s.push(u);return s}var xj=function(e,t){return function(i){return e(t(i))}}(Object.keys,Object),Vj=xj,Fj=Object.prototype.hasOwnProperty;function Bj(e){return fj(e)?Lj(e):function(e){if(!mj(e))return Vj(e);var t=[];for(var i in Object(e))Fj.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}var jj=Object.prototype.hasOwnProperty;function Gj(e){if(!VB(e))return function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}(e);var t=mj(e),i=[];for(var r in e)("constructor"!=r||!t&&jj.call(e,r))&&i.push(r);return i}var Hj,zj=(Hj=function(e,t){!function(e,t,i,r){var n=!i;i||(i={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=r?r(i[s],e[s],s,i,e):void 0;void 0===c&&(c=e[s]),n?cj(i,s,c):lj(i,s,c)}}(t,function(e){return fj(e)?Lj(e,!0):Gj(e)}(t),e)},pj((function(e,t){var i=-1,r=t.length,n=r>1?t[r-1]:void 0,o=r>2?t[2]:void 0;for(n=Hj.length>3&&"function"==typeof n?(r--,n):void 0,o&&function(e,t,i){if(!VB(i))return!1;var r=us(t);return!!("number"==r?fj(i)&&sj(t,i.length):"string"==r&&t in i)&&uj(i[t],e)}(t[0],t[1],o)&&(n=r<3?void 0:n,r=1),e=Object(e);++i<r;){var a=t[i];a&&Hj(e,a,i,n)}return e}))),Kj=zj;function Wj(e,t){return function(e,t){for(var i=-1,r=null==e?0:e.length,n=Array(r);++i<r;)n[i]=t(e[i],i,e);return n}(t,(function(t){return e[t]}))}function Yj(e){return null==e?[]:Wj(e,Bj(e))}var Xj=o,qj=Qe("iterator"),Jj=!Xj((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,i="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),i+=r+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[qj]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==i||"x"!==new URL("http://x",void 0).host})),Qj=T,Zj=/[^\0-\u007E]/,$j=/[.\u3002\uFF0E\uFF61]/g,eG="Overflow: input needs wider integers to process",tG=r.RangeError,iG=Qj($j.exec),rG=Math.floor,nG=String.fromCharCode,oG=Qj("".charCodeAt),aG=Qj([].join),sG=Qj([].push),cG=Qj("".replace),uG=Qj("".split),dG=Qj("".toLowerCase),lG=function(e){return e+22+75*(e<26)},hG=function(e,t,i){var r=0;for(e=i?rG(e/700):e>>1,e+=rG(e/t);e>455;)e=rG(e/35),r+=36;return rG(r+36*e/(e+38))},pG=function(e){var t=[];e=function(e){for(var t=[],i=0,r=e.length;i<r;){var n=oG(e,i++);if(n>=55296&&n<=56319&&i<r){var o=oG(e,i++);56320==(64512&o)?sG(t,((1023&n)<<10)+(1023&o)+65536):(sG(t,n),i--)}else sG(t,n)}return t}(e);var i,r,n=e.length,o=128,a=0,s=72;for(i=0;i<e.length;i++)(r=e[i])<128&&sG(t,nG(r));var c=t.length,u=c;for(c&&sG(t,"-");u<n;){var d=2147483647;for(i=0;i<e.length;i++)(r=e[i])>=o&&r<d&&(d=r);var l=u+1;if(d-o>rG((2147483647-a)/l))throw tG(eG);for(a+=(d-o)*l,o=d,i=0;i<e.length;i++){if((r=e[i])<o&&++a>2147483647)throw tG(eG);if(r==o){for(var h=a,p=36;;){var _=p<=s?1:p>=s+26?26:p-s;if(h<_)break;var f=h-_,v=36-_;sG(t,nG(lG(_+f%v))),h=rG(f/v),p+=36}sG(t,nG(lG(h))),s=hG(a,l,u==c),a=0,u++}}a++,o++}return aG(t,"")},_G=Br,fG=r,vG=K,mG=d,SG=T,yG=Jj,gG=Ht.exports,EG=Ku,bG=vc,TG=h_,IG=bi,RG=$u,AG=F,CG=Ue,OG=zr,wG=rn,NG=Pt,PG=j,DG=Jo,kG=ko,MG=m,UG=vd,LG=ud,xG=$d,VG=yT,FG=Qe("iterator"),BG=IG.set,jG=IG.getterFor("URLSearchParams"),GG=IG.getterFor("URLSearchParamsIterator"),HG=vG("fetch"),zG=vG("Request"),KG=vG("Headers"),WG=zG&&zG.prototype,YG=KG&&KG.prototype,XG=fG.RegExp,qG=fG.TypeError,JG=fG.decodeURIComponent,QG=fG.encodeURIComponent,ZG=SG("".charAt),$G=SG([].join),eH=SG([].push),tH=SG("".replace),iH=SG([].shift),rH=SG([].splice),nH=SG("".split),oH=SG("".slice),aH=/\+/g,sH=Array(4),cH=function(e){return sH[e-1]||(sH[e-1]=XG("((?:%[\\da-f]{2}){"+e+"})","gi"))},uH=function(e){try{return JG(e)}catch(t){return e}},dH=function(e){var t=tH(e,aH," "),i=4;try{return JG(t)}catch(e){for(;i;)t=tH(t,cH(i--),uH);return t}},lH=/[!'()~]|%20/g,hH={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},pH=function(e){return hH[e]},_H=function(e){return tH(QG(e),lH,pH)},fH=TG((function(e,t){BG(this,{type:"URLSearchParamsIterator",iterator:UG(jG(e).entries),kind:t})}),"Iterator",(function(){var e=GG(this),t=e.kind,i=e.iterator.next(),r=i.value;return i.done||(i.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),i}),!0),vH=function(e){this.entries=[],this.url=null,void 0!==e&&(PG(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===ZG(e,0)?oH(e,1):e:DG(e)))};vH.prototype={type:"URLSearchParams",bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,i,r,n,o,a,s,c=LG(e);if(c)for(i=(t=UG(e,c)).next;!(r=mG(i,t)).done;){if(o=(n=UG(NG(r.value))).next,(a=mG(o,n)).done||(s=mG(o,n)).done||!mG(o,n).done)throw qG("Expected sequence with length 2");eH(this.entries,{key:DG(a.value),value:DG(s.value)})}else for(var u in e)CG(e,u)&&eH(this.entries,{key:u,value:DG(e[u])})},parseQuery:function(e){if(e)for(var t,i,r=nH(e,"&"),n=0;n<r.length;)(t=r[n++]).length&&(i=nH(t,"="),eH(this.entries,{key:dH(iH(i)),value:dH($G(i,"="))}))},serialize:function(){for(var e,t=this.entries,i=[],r=0;r<t.length;)e=t[r++],eH(i,_H(e.key)+"="+_H(e.value));return $G(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var mH=function(){RG(this,SH);var e=arguments.length>0?arguments[0]:void 0;BG(this,new vH(e))},SH=mH.prototype;if(EG(SH,{append:function(e,t){xG(arguments.length,2);var i=jG(this);eH(i.entries,{key:DG(e),value:DG(t)}),i.updateURL()},delete:function(e){xG(arguments.length,1);for(var t=jG(this),i=t.entries,r=DG(e),n=0;n<i.length;)i[n].key===r?rH(i,n,1):n++;t.updateURL()},get:function(e){xG(arguments.length,1);for(var t=jG(this).entries,i=DG(e),r=0;r<t.length;r++)if(t[r].key===i)return t[r].value;return null},getAll:function(e){xG(arguments.length,1);for(var t=jG(this).entries,i=DG(e),r=[],n=0;n<t.length;n++)t[n].key===i&&eH(r,t[n].value);return r},has:function(e){xG(arguments.length,1);for(var t=jG(this).entries,i=DG(e),r=0;r<t.length;)if(t[r++].key===i)return!0;return!1},set:function(e,t){xG(arguments.length,1);for(var i,r=jG(this),n=r.entries,o=!1,a=DG(e),s=DG(t),c=0;c<n.length;c++)(i=n[c]).key===a&&(o?rH(n,c--,1):(o=!0,i.value=s));o||eH(n,{key:a,value:s}),r.updateURL()},sort:function(){var e=jG(this);VG(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,i=jG(this).entries,r=OG(e,arguments.length>1?arguments[1]:void 0),n=0;n<i.length;)r((t=i[n++]).value,t.key,this)},keys:function(){return new fH(this,"keys")},values:function(){return new fH(this,"values")},entries:function(){return new fH(this,"entries")}},{enumerable:!0}),gG(SH,FG,SH.entries,{name:"entries"}),gG(SH,"toString",(function(){return jG(this).serialize()}),{enumerable:!0}),bG(mH,"URLSearchParams"),_G({global:!0,forced:!yG},{URLSearchParams:mH}),!yG&&AG(KG)){var yH=SG(YG.has),gH=SG(YG.set),EH=function(e){if(PG(e)){var t,i=e.body;if("URLSearchParams"===wG(i))return t=e.headers?new KG(e.headers):new KG,yH(t,"content-type")||gH(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),kG(e,{body:MG(0,DG(i)),headers:MG(0,t)})}return e};if(AG(HG)&&_G({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return HG(e,arguments.length>1?EH(arguments[1]):{})}}),AG(zG)){var bH=function(e){return RG(this,WG),new zG(e,arguments.length>1?EH(arguments[1]):{})};WG.constructor=bH,bH.prototype=WG,_G({global:!0,forced:!0},{Request:bH})}}var TH,IH={URLSearchParams:mH,getState:jG},RH=Br,AH=a,CH=Jj,OH=r,wH=zr,NH=T,PH=uo.f,DH=Ht.exports,kH=$u,MH=Ue,UH=Ns,LH=BN,xH=$s,VH=J_.codeAt,FH=function(e){var t,i,r=[],n=uG(cG(dG(e),$j,"."),".");for(t=0;t<n.length;t++)i=n[t],sG(r,iG(Zj,i)?"xn--"+pG(i):i);return aG(r,".")},BH=Jo,jH=vc,GH=$d,HH=IH,zH=bi,KH=zH.set,WH=zH.getterFor("URL"),YH=HH.URLSearchParams,XH=HH.getState,qH=OH.URL,JH=OH.TypeError,QH=OH.parseInt,ZH=Math.floor,$H=Math.pow,ez=NH("".charAt),tz=NH(/./.exec),iz=NH([].join),rz=NH(1..toString),nz=NH([].pop),oz=NH([].push),az=NH("".replace),sz=NH([].shift),cz=NH("".split),uz=NH("".slice),dz=NH("".toLowerCase),lz=NH([].unshift),hz=/[a-z]/i,pz=/[\d+-.a-z]/i,_z=/\d/,fz=/^0x/i,vz=/^[0-7]+$/,mz=/^\d+$/,Sz=/^[\da-f]+$/i,yz=/[\0\t\n\r #%/:<>?@[\\\]^|]/,gz=/[\0\t\n\r #/:<>?@[\\\]^|]/,Ez=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,bz=/[\t\n\r]/g,Tz=function(e){var t,i,r,n;if("number"==typeof e){for(t=[],i=0;i<4;i++)lz(t,e%256),e=ZH(e/256);return iz(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,i=1,r=null,n=0,o=0;o<8;o++)0!==e[o]?(n>i&&(t=r,i=n),r=null,n=0):(null===r&&(r=o),++n);return n>i&&(t=r,i=n),t}(e),i=0;i<8;i++)n&&0===e[i]||(n&&(n=!1),r===i?(t+=i?":":"::",n=!0):(t+=rz(e[i],16),i<7&&(t+=":")));return"["+t+"]"}return e},Iz={},Rz=UH({},Iz,{" ":1,'"':1,"<":1,">":1,"`":1}),Az=UH({},Rz,{"#":1,"?":1,"{":1,"}":1}),Cz=UH({},Az,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Oz=function(e,t){var i=VH(e,0);return i>32&&i<127&&!MH(t,e)?e:encodeURIComponent(e)},wz={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Nz=function(e,t){var i;return 2==e.length&&tz(hz,ez(e,0))&&(":"==(i=ez(e,1))||!t&&"|"==i)},Pz=function(e){var t;return e.length>1&&Nz(uz(e,0,2))&&(2==e.length||"/"===(t=ez(e,2))||"\\"===t||"?"===t||"#"===t)},Dz=function(e){return"."===e||"%2e"===dz(e)},kz={},Mz={},Uz={},Lz={},xz={},Vz={},Fz={},Bz={},jz={},Gz={},Hz={},zz={},Kz={},Wz={},Yz={},Xz={},qz={},Jz={},Qz={},Zz={},$z={},eK=function(e,t,i){var r,n,o,a=BH(e);if(t){if(n=this.parse(a))throw JH(n);this.searchParams=null}else{if(void 0!==i&&(r=new eK(i,!0)),n=this.parse(a,null,r))throw JH(n);(o=XH(new YH)).bindURL(this),this.searchParams=o}};eK.prototype={type:"URL",parse:function(e,t,i){var r,n,o,a,s,c=this,u=t||kz,d=0,l="",h=!1,p=!1,_=!1;for(e=BH(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=az(e,Ez,"")),e=az(e,bz,""),r=LH(e);d<=r.length;){switch(n=r[d],u){case kz:if(!n||!tz(hz,n)){if(t)return"Invalid scheme";u=Uz;continue}l+=dz(n),u=Mz;break;case Mz:if(n&&(tz(pz,n)||"+"==n||"-"==n||"."==n))l+=dz(n);else{if(":"!=n){if(t)return"Invalid scheme";l="",u=Uz,d=0;continue}if(t&&(c.isSpecial()!=MH(wz,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&wz[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=Wz:c.isSpecial()&&i&&i.scheme==c.scheme?u=Lz:c.isSpecial()?u=Bz:"/"==r[d+1]?(u=xz,d++):(c.cannotBeABaseURL=!0,oz(c.path,""),u=Qz)}break;case Uz:if(!i||i.cannotBeABaseURL&&"#"!=n)return"Invalid scheme";if(i.cannotBeABaseURL&&"#"==n){c.scheme=i.scheme,c.path=xH(i.path),c.query=i.query,c.fragment="",c.cannotBeABaseURL=!0,u=$z;break}u="file"==i.scheme?Wz:Vz;continue;case Lz:if("/"!=n||"/"!=r[d+1]){u=Vz;continue}u=jz,d++;break;case xz:if("/"==n){u=Gz;break}u=Jz;continue;case Vz:if(c.scheme=i.scheme,n==TH)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=xH(i.path),c.query=i.query;else if("/"==n||"\\"==n&&c.isSpecial())u=Fz;else if("?"==n)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=xH(i.path),c.query="",u=Zz;else{if("#"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=xH(i.path),c.path.length--,u=Jz;continue}c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=xH(i.path),c.query=i.query,c.fragment="",u=$z}break;case Fz:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,u=Jz;continue}u=Gz}else u=jz;break;case Bz:if(u=jz,"/"!=n||"/"!=ez(l,d+1))continue;d++;break;case jz:if("/"!=n&&"\\"!=n){u=Gz;continue}break;case Gz:if("@"==n){h&&(l="%40"+l),h=!0,o=LH(l);for(var f=0;f<o.length;f++){var v=o[f];if(":"!=v||_){var m=Oz(v,Cz);_?c.password+=m:c.username+=m}else _=!0}l=""}else if(n==TH||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=LH(l).length+1,l="",u=Hz}else l+=n;break;case Hz:case zz:if(t&&"file"==c.scheme){u=Xz;continue}if(":"!=n||p){if(n==TH||"/"==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=qz,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=Kz,t==zz)return}break;case Kz:if(!tz(_z,n)){if(n==TH||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var S=QH(l,10);if(S>65535)return"Invalid port";c.port=c.isSpecial()&&S===wz[c.scheme]?null:S,l=""}if(t)return;u=qz;continue}return"Invalid port"}l+=n;break;case Wz:if(c.scheme="file","/"==n||"\\"==n)u=Yz;else{if(!i||"file"!=i.scheme){u=Jz;continue}if(n==TH)c.host=i.host,c.path=xH(i.path),c.query=i.query;else if("?"==n)c.host=i.host,c.path=xH(i.path),c.query="",u=Zz;else{if("#"!=n){Pz(iz(xH(r,d),""))||(c.host=i.host,c.path=xH(i.path),c.shortenPath()),u=Jz;continue}c.host=i.host,c.path=xH(i.path),c.query=i.query,c.fragment="",u=$z}}break;case Yz:if("/"==n||"\\"==n){u=Xz;break}i&&"file"==i.scheme&&!Pz(iz(xH(r,d),""))&&(Nz(i.path[0],!0)?oz(c.path,i.path[0]):c.host=i.host),u=Jz;continue;case Xz:if(n==TH||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&Nz(l))u=Jz;else if(""==l){if(c.host="",t)return;u=qz}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=qz}continue}l+=n;break;case qz:if(c.isSpecial()){if(u=Jz,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=TH&&(u=Jz,"/"!=n))continue}else c.fragment="",u=$z;else c.query="",u=Zz;break;case Jz:if(n==TH||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(s=dz(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||oz(c.path,"")):Dz(l)?"/"==n||"\\"==n&&c.isSpecial()||oz(c.path,""):("file"==c.scheme&&!c.path.length&&Nz(l)&&(c.host&&(c.host=""),l=ez(l,0)+":"),oz(c.path,l)),l="","file"==c.scheme&&(n==TH||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)sz(c.path);"?"==n?(c.query="",u=Zz):"#"==n&&(c.fragment="",u=$z)}else l+=Oz(n,Az);break;case Qz:"?"==n?(c.query="",u=Zz):"#"==n?(c.fragment="",u=$z):n!=TH&&(c.path[0]+=Oz(n,Iz));break;case Zz:t||"#"!=n?n!=TH&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":Oz(n,Iz)):(c.fragment="",u=$z);break;case $z:n!=TH&&(c.fragment+=Oz(n,Rz))}d++}},parseHost:function(e){var t,i,r;if("["==ez(e,0)){if("]"!=ez(e,e.length-1))return"Invalid host";if(t=function(e){var t,i,r,n,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return ez(e,l)};if(":"==h()){if(":"!=ez(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=i=0;i<4&&tz(Sz,h());)t=16*t+QH(h(),16),l++,i++;if("."==h()){if(0==i)return;if(l-=i,u>6)return;for(r=0;h();){if(n=null,r>0){if(!("."==h()&&r<4))return;l++}if(!tz(_z,h()))return;for(;tz(_z,h());){if(o=QH(h(),10),null===n)n=o;else{if(0==n)return;n=10*n+o}if(n>255)return;l++}c[u]=256*c[u]+n,2!=++r&&4!=r||u++}if(4!=r)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(uz(e,1,-1)),!t)return"Invalid host";this.host=t}else if(this.isSpecial()){if(e=FH(e),tz(yz,e))return"Invalid host";if(t=function(e){var t,i,r,n,o,a,s,c=cz(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(i=[],r=0;r<t;r++){if(""==(n=c[r]))return e;if(o=10,n.length>1&&"0"==ez(n,0)&&(o=tz(fz,n)?16:8,n=uz(n,8==o?1:2)),""===n)a=0;else{if(!tz(10==o?mz:8==o?vz:Sz,n))return e;a=QH(n,o)}oz(i,a)}for(r=0;r<t;r++)if(a=i[r],r==t-1){if(a>=$H(256,5-t))return null}else if(a>255)return null;for(s=nz(i),r=0;r<i.length;r++)s+=i[r]*$H(256,3-r);return s}(e),null===t)return"Invalid host";this.host=t}else{if(tz(gz,e))return"Invalid host";for(t="",i=LH(e),r=0;r<i.length;r++)t+=Oz(i[r],Iz);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return MH(wz,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&Nz(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,i=e.username,r=e.password,n=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==n?(u+="//",e.includesCredentials()&&(u+=i+(r?":"+r:"")+"@"),u+=Tz(n),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+iz(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw JH(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new tK(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+Tz(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(BH(e)+":",kz)},getUsername:function(){return this.username},setUsername:function(e){var t=LH(BH(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<t.length;i++)this.username+=Oz(t[i],Cz)}},getPassword:function(){return this.password},setPassword:function(e){var t=LH(BH(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<t.length;i++)this.password+=Oz(t[i],Cz)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?Tz(e):Tz(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,Hz)},getHostname:function(){var e=this.host;return null===e?"":Tz(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,zz)},getPort:function(){var e=this.port;return null===e?"":BH(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=BH(e))?this.port=null:this.parse(e,Kz))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+iz(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,qz))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=BH(e))?this.query=null:("?"==ez(e,0)&&(e=uz(e,1)),this.query="",this.parse(e,Zz)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=BH(e))?("#"==ez(e,0)&&(e=uz(e,1)),this.fragment="",this.parse(e,$z)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var tK=function(e){var t=kH(this,iK),i=GH(arguments.length,1)>1?arguments[1]:void 0,r=KH(t,new eK(e,!1,i));AH||(t.href=r.serialize(),t.origin=r.getOrigin(),t.protocol=r.getProtocol(),t.username=r.getUsername(),t.password=r.getPassword(),t.host=r.getHost(),t.hostname=r.getHostname(),t.port=r.getPort(),t.pathname=r.getPathname(),t.search=r.getSearch(),t.searchParams=r.getSearchParams(),t.hash=r.getHash())},iK=tK.prototype,rK=function(e,t){return{get:function(){return WH(this)[e]()},set:t&&function(e){return WH(this)[t](e)},configurable:!0,enumerable:!0}};if(AH&&PH(iK,{href:rK("serialize","setHref"),origin:rK("getOrigin"),protocol:rK("getProtocol","setProtocol"),username:rK("getUsername","setUsername"),password:rK("getPassword","setPassword"),host:rK("getHost","setHost"),hostname:rK("getHostname","setHostname"),port:rK("getPort","setPort"),pathname:rK("getPathname","setPathname"),search:rK("getSearch","setSearch"),searchParams:rK("getSearchParams"),hash:rK("getHash","setHash")}),DH(iK,"toJSON",(function(){return WH(this).serialize()}),{enumerable:!0}),DH(iK,"toString",(function(){return WH(this).serialize()}),{enumerable:!0}),qH){var nK=qH.createObjectURL,oK=qH.revokeObjectURL;nK&&DH(tK,"createObjectURL",wH(nK,qH)),oK&&DH(tK,"revokeObjectURL",wH(oK,qH))}jH(tK,"URL"),RH({global:!0,forced:!CH,sham:!AH},{URL:tK});var aK,sK=function(e,t){return ev(void 0,void 0,void 0,(function(){var i;return tv(this,(function(r){switch(r.label){case 0:i=new Audio(URL.createObjectURL(new Blob([e],t))),r.label=1;case 1:return r.trys.push([1,3,,4]),i.muted=!0,[4,i.play()];case 2:return r.sent(),i.pause(),[2,!0];case 3:return r.sent(),[2,!1];case 4:return[2]}}))}))},cK=function(){function e(e){this._sharedAudioContext=new AudioContext,this._audioDestination=this._sharedAudioContext.createMediaStreamDestination(),this._localGainNode=this._sharedAudioContext.createGain(),this._bufferGainNode=this._sharedAudioContext.createGain(),this._failedAudioList=[],this.mixingMap=new Map,this.resourcesCache=new Map,this.volumeConfig=new Map,this.cachedBuffer=[],this._context=e,this._localGainNode.gain.value=1}return e.prototype.mixMediaStream=function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)},e.prototype.startAudioMixing=function(e,t,i){return ev(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,_,f,v,m=this;return tv(this,(function(S){switch(S.label){case 0:if(r=i.playCount,AD(n=i.type,"mixingType",Yj(mx)),!(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:Sx.AUDIO_MIXING_STATE_STOPPED,error:Zw.AUDIO_MIXING_ERROR_OK});try{s.gainNode.disconnect(this._audioDestination),s.audioSource.disconnect(s.gainNode)}catch(e){}}return(u=this.resourcesCache.get(e))&&u.filePath===t?(c=u.getAudioNode(),[3,4]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw m._context.emitMessage({mixId:e,state:Sx.AUDIO_MIXING_STATE_FAILED,error:Zw.AUDIO_MIXING_ERROR_START_FAILED}),new tN(Qw.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:return d=S.sent(),l=void 0,t.endsWith("mp3")?l={type:"audio/mpeg"}:t.endsWith("aac")&&(l={type:"audio/aac"}),[4,sK(d,l)];case 3:if(!S.sent())throw this._context.emitMessage({mixId:e,state:Sx.AUDIO_MIXING_STATE_FAILED,error:Zw.AUDIO_MIXING_ERROR_START_FAILED}),new tN(Qw.LOAD_RESOURCES_FAILED,"invalid audio resource");(c=new Audio).crossOrigin="anonymous",c.src=URL.createObjectURL(new Blob([d],l)),S.label=4;case 4:r<=0?c.loop=!0:r>0&&(h=r,c.onended=function(){--h>0?c.play():(m.mixingMap.delete(e),m._context.emitMessage({mixId:e,state:Sx.AUDIO_MIXING_STATE_FINISHED,error:Zw.AUDIO_MIXING_ERROR_OK}))}),S.label=5;case 5:return S.trys.push([5,7,,8]),[4,c.play()];case 6:return S.sent(),[3,8];case 7:return p=S.sent(),console.error(p),this._failedAudioList.push(c),this._context.onAutoPlayFailed(),[3,8];case 8:if(_=this._sharedAudioContext.createMediaElementSource(c),f=this._sharedAudioContext.createGain(),v=this.volumeConfig.get(e),f.gain.value=v?v/100:1,_.connect(f).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:_,audioNode:c,gainNode:f,type:"file"}),n===mx.PUBLISH)try{f.disconnect(this._sharedAudioContext.destination)}catch(e){}else f.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],i.type),this._context.emitMessage({mixId:e,state:Sx.AUDIO_MIXING_STATE_PLAYING,error:Zw.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:Sx.AUDIO_MIXING_STATE_STOPPED,error:Zw.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:Sx.AUDIO_MIXING_STATE_PAUSED,error:Zw.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:Sx.AUDIO_MIXING_STATE_PLAYING,error:Zw.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return ev(this,void 0,void 0,(function(){var i,r=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 t.arrayBuffer();throw r._context.emitMessage({mixId:e,state:Sx.AUDIO_MIXING_STATE_FAILED,error:Zw.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new tN(Qw.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(t){throw r._context.emitMessage({mixId:e,state:Sx.AUDIO_MIXING_STATE_FAILED,error:Zw.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new tN(Qw.LOAD_RESOURCES_FAILED,"Load resources failed",t)}))];case 1:return i=n.sent(),[4,sK(i)];case 2:if(!n.sent())throw this._context.emitMessage({mixId:e,state:Sx.AUDIO_MIXING_STATE_FAILED,error:Zw.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new tN(Qw.LOAD_RESOURCES_FAILED,"Load resources failed");return this._context.emitMessage({mixId:e,state:Sx.AUDIO_MIXING_STATE_PRELOADED,error:Zw.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(e,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([i])))},filePath:t}),[2]}}))}))},e.prototype.unloadAudioMixing=function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)},e.prototype.getAudioMixingVolume=function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0},e.prototype.setAudioMixingVolume=function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var i=this.mixingMap.get(e);i&&(i.gainNode.gain.value=Number(t)/100)},e.prototype.getAudioMixingDuration=function(e){var t=this.mixingMap.get(e),i=this.mixingMap.get(e);return t||i?t?1e3*t.audioNode.duration:i?1e3*i.audioNode.duration:0:0},e.prototype.getAudioMixingCurrentPosition=function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0},e.prototype.setAudioMixingPosition=function(e,t){var i=this.mixingMap.get(e);i&&(i.audioNode.currentTime=t/1e3,i.audioNode.play())},e.prototype.enableAudioMixingBuffer=function(e){AD(e,"type",Yj(mx));var t=this._context.getLocalAudioTrack();if(t){var i=VV(t.getTrack());if(i&&this.mixMediaStream(i),e===mx.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:Sx.AUDIO_MIXING_STATE_PCM_ENABLED,error:Zw.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:Sx.AUDIO_MIXING_STATE_PCM_DISABLED,error:Zw.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;if(!(this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0))){this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode);try{this._audioBufferSource.start()}catch(e){this._failedAudioList.push(this._audioBufferSource)}this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var i=t.cachedBuffer.shift();i&&t.pushAudioMixingBuffer(i)}}}},e.prototype.stopAll=function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(e){}this.mixingMap.forEach((function(t,i){e.stopAudioMixing(i)}))},Object.defineProperty(e.prototype,"mixTrack",{get:function(){return this._audioDestination.stream.getAudioTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sharedAudioContext",{get:function(){return this._sharedAudioContext},enumerable:!1,configurable:!0}),e.prototype.resumeLocalPlay=function(){return ev(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s;return tv(this,(function(c){switch(c.label){case 0:e=[],c.label=1;case 1:c.trys.push([1,10,11,12]),t=iv(this._failedAudioList),i=t.next(),c.label=2;case 2:if(i.done)return[3,9];r=i.value,c.label=3;case 3:return c.trys.push([3,7,,8]),r instanceof HTMLAudioElement?(r.muted=!1,[4,r.play()]):[3,5];case 4:return c.sent(),[3,6];case 5:r.start(),c.label=6;case 6:return[3,8];case 7:return n=c.sent(),e.push(r),console.error(n),this._context.onAutoPlayFailed(),[3,9];case 8:return i=t.next(),[3,2];case 9:return[3,12];case 10:return o=c.sent(),a={error:o},[3,12];case 11:try{i&&!i.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 12:return this._failedAudioList=e,[2]}}))}))},e.prototype.destroy=function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()},$f([EL("default","id","filePath","options")],e.prototype,"startAudioMixing",null),$f([EL("default","id")],e.prototype,"stopAudioMixing",null),$f([EL("default","id")],e.prototype,"pauseAudioMixing",null),$f([EL("default","id")],e.prototype,"resumeAudioMixing",null),$f([EL("default","id")],e.prototype,"preloadAudioMixing",null),$f([EL("default","id")],e.prototype,"unloadAudioMixing",null),$f([EL("default","id")],e.prototype,"getAudioMixingVolume",null),$f([EL("default","id","volume")],e.prototype,"setAudioMixingVolume",null),$f([EL("default","id")],e.prototype,"getAudioMixingDuration",null),$f([EL("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),$f([EL("default","id","position")],e.prototype,"setAudioMixingPosition",null),$f([EL("default","type")],e.prototype,"enableAudioMixingBuffer",null),$f([EL()],e.prototype,"disableAudioMixingBuffer",null),$f([EL("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(aK||(aK={}));var uK=new BD("RTMClient",1),dK=function(e){function t(t){var i=e.call(this)||this;return i._appId=t,i._dataChannelSignal=null,i._handler=null,i._dataChannelSignalState=zF.DISCONNECTED,i._loginSessionId=null,i._userId=null,i._token=null,i._isReconnecting=!1,i._reconnectTimer=null,i._loginResolveCallback=null,i._loginRejectCallback=null,i._iceConfigNode=null,i._wait_login_token=!1,i}return Qf(t,e),t.prototype.login=function(e,t){var i=this;return new Promise((function(r,n){if(uK.print("login","invoke login, token: %o, userId: %o",e,t),i._loginSessionId)throw new tN(Qw.ALREADY_LOGIN,"Already logined");if(i._loginResolveCallback)throw new tN(Qw.LOGIN_FAILED,"Is logging in, please try again later.");i._userId=t,i._token=e,SL.setStats({rtc_app_id:i._appId,user_id:t}),i._loginResolveCallback=r,i._loginRejectCallback=n,i._dataChannelSignal?i._login():(uK.print("login","init dataChannelSingling"),i._dataChannelSignalState=zF.CONNECTING,i._createDataChannelSignaling(t).then((function(e){i._dataChannelSignal=e,i._login()})).catch((function(){i._onDisconnect()})))}))},t.prototype.logout=function(){var 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 tN(Qw.NOT_LOGIN,"login first");return[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:QL.C2RTM}).catch((function(){}))];case 1:return t.sent(),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(i){return this._token=e,[2,new Promise((function(e,i){t._wait_login_token?(t._loginResolveCallback=e,t._loginRejectCallback=i,t._login()):e()}))]}))}))},t.prototype.getPeerOnlineStatus=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(i){switch(i.label){case 0:if(!this._loginSessionId||!this._userId)throw new tN(Qw.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:QL.C2RTM})];case 1:return[2,null==(t=i.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(i){if(!this._loginSessionId||!this._userId)throw new tN(Qw.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:e,room:"",msg:t})]}))}))},t.prototype.setServerParams=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(i){switch(i.label){case 0:if(!this._loginSessionId||!this._userId)throw new tN(Qw.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:QL.C2RTM})];case 1:return i.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){if(!this._loginSessionId||!this._userId)throw new tN(Qw.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:zL.BUSINESS_SERVER,msg:e})]}))}))},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=oD();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:uD.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:qL.VERSION,deviceId:AL.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:QL.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).catch((function(t){var i,r,n=t||{},o=n.code,a=n.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(i=Qw.INVALID_PARAMS,r="Invalid userId"):(i=Qw.INVALID_TOKEN,r="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(i=Qw.LOGIN_FAILED,r="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new tN(i,a||r))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){var t,i;return ev(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return tv(this,(function(d){switch(d.label){case 0:if(r=new rx,n=this._iceConfigNode)return[3,4];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,null==r?void 0:r.getAccessNode(this._appId,"",e,AL.getDeviceId(),"")];case 2:if(o=d.sent(),!(n=o[0]))throw new Error;return[3,4];case 3:throw d.sent(),TL("rtm.login.getNodeFailed","",0,!0),new tN(Qw.ICE_SERVER_WRONG,"get ICE config failed");case 4:TL("rtm.login.getNodeSuccess",n,0,!0),uK.print("_createDataChannelSignaling()","get node success",n),this._handler=BF(fL),null===(t=this._handler)||void 0===t||t.once("disconnect",(function(){uK.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),u._onDisconnect()})),d.label=5;case 5:return d.trys.push([5,7,,8]),[4,null===(i=this._handler)||void 0===i?void 0:i.connect(n)];case 6:return a=d.sent(),uK.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=zF.CONNECTED,[3,8];case 7:throw s=d.sent(),this._iceConfigNode=null,this._dataChannelSignalState=zF.DISCONNECTED,new tN(Qw.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",s);case 8:return c=new ex(a),uK.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){uK.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(xL.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(xL.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(xL.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(xL.NODE_CHANGE,(function(e){TL("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(u._iceConfigNode=e.nodes[0]),u._loginResolveCallback&&u._loginRejectCallback?u._login():u._reconnect()})),[2,c]}}))}))},t.prototype._closeDataChannelSignaling=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null},t.prototype._checkDataChannelSignal=function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==zF.CONNECTED)throw new tN(Qw.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=zF.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&&(uK.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){uK.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){uK.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}(LD.exports.EventEmitter),lK=function(e){function t(t){var i=e.call(this)||this;return i._appId=t,i.remoteStreams=new Map,i}return Qf(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 qF,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,i=this;return tv(this,(function(r){switch(r.label){case 0:if(this.remoteStreams.get(e))throw new tN(Qw.REPEAT_PLAY,"repeat play public media stream");return(t=new AF(e,e,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var r=function(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var i={seiCount:0,seis:[]},r=!1,n=2;n<t.byteLength;){var o=t.getUint16(n);if(n+=2,t.byteLength-n<o){r=!0;break}var a=new Uint8Array(e.buffer,n,o);if(n+=o,t.byteLength-n>0&&t.byteLength-n<=2){r=!0;break}i.seiCount++,i.seis.push(a)}return r&&(i.seiCount=1,i.seis=[e]),i}(e),n=0;n<r.seiCount;n++)i.emit(lF.ON_SEI_MESSAGED_RECEIVED,{sei:r.seis[n],publicStreamId:t.streamId})})),[4,this._mediaServerClient.subscribePublicStream(t)];case 1:return r.sent(),this.remoteStreams.set(e,t),[2,t]}}))}))},t.prototype.stopPlayPublicStream=function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)},t.prototype.destroy=function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()},t.prototype._handleReconnected=function(){return ev(this,void 0,void 0,(function(){var e,t,i,r,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(lF.RESUBSCRIBE,{stream:t})}))},t=this;try{for(i=iv(this.remoteStreams),r=i.next();!r.done;r=i.next())n=rv(r.value,1),o=n[0],e(o)}catch(e){a={error:e}}finally{try{r&&!r.done&&(s=i.return)&&s.call(i)}finally{if(a)throw a.error}}return[2]}))}))},t.prototype._reconnect=function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)},t.prototype._bindEvents=function(){var e,t,i=this;null===(e=this._mediaServerClient)||void 0===e||e.on(FL.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){i.emit("onRemoteStreamStats",e)}))},t}(GD),hK=new BD("AudioDeviceManager",1),pK=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._isAudioPlaybackDeviceTesting=!1,t._isAudioDeviceRecordTesting=!1,t}return Qf(t,e),t.prototype.startAudioPlaybackDeviceTest=function(e,t){return ev(this,void 0,void 0,(function(){var i;return tv(this,(function(r){switch(r.label){case 0:if(this._isAudioPlaybackDeviceTesting||this._isAudioDeviceRecordTesting)throw new tN(Qw.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");this._isAudioPlaybackDeviceTesting=!0,hK.print("startAudioPlaybackDeviceTest()","Invoke"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._playAudioFile(e,{loop:!0})];case 2:return r.sent(),[3,4];case 3:throw i=r.sent(),this.stopAudioPlaybackDeviceTest(),i;case 4:return this._startEmitAudioPlaybackDeviceTestVolume(t),[2]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){this._isAudioPlaybackDeviceTesting&&(hK.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(i){switch(i.label){case 0:if(this._isAudioDeviceRecordTesting)throw new tN(Qw.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");return this._isAudioDeviceRecordTesting=!0,hK.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){hK.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),t._stopAudioCaptureAndRecoder()}),3e4),[4,this._startAudioCaptureAndRecoder(e)];case 1:return i.sent(),delete this._audioCaptureAndRecoderResolve,[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){hK.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()},t.prototype.stopAudioDevicePlayTest=function(){this._isAudioDeviceRecordTesting&&(hK.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.getRecordTrack=function(){return this._audioTrack},t.prototype.destroy=function(){hK.print("destroy()","Invoke"),e.prototype.removeAllListeners.call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()},t.prototype._playAudioFile=function(e,t){var i=this;return new Promise((function(r,n){i._audioElement=fB("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),i._audioElement.loop=t.loop,hK.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),i._audioElement.oncanplay=function(){hK.print("_playAudioFile()","oncanplay"),r()},i._audioElement.onerror=function(e){var t,r;n(new tN(Qw.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(r=null===(t=i._audioElement)||void 0===t?void 0:t.error)||void 0===r?void 0:r.message))))}}))},t.prototype._destroyAudioElement=function(){this._audioElement&&(hK.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&&(hK.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new MV(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&&(hK.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,i,r=this;return tv(this,(function(n){switch(n.label){case 0:return t=this,[4,$V({})];case 1:return t._audioTrack=n.sent(),i=VV(this._audioTrack.getTrack()),hK.print("startAudioDeviceRecordTest()","create microphone track success!"),[2,new Promise((function(t,n){r._mediaRecorder=new MediaRecorder(i),r._mediaRecorder.ondataavailable=function(i){return ev(r,void 0,void 0,(function(){var r,o,a,s=this;return tv(this,(function(c){switch(c.label){case 0:if(!this._isAudioDeviceRecordTesting)return[3,5];hK.print("startAudioDeviceRecordTest()","get recorded file."),r=new Blob([i.data]),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._playAudioFile(URL.createObjectURL(r),{loop:!1})];case 2:return c.sent(),[3,4];case 3:return o=c.sent(),[2,n(o)];case 4:return this._startEmitAudioPlaybackDeviceTestVolume(e),null===(a=this._audioElement)||void 0===a||a.addEventListener("ended",(function(){s.stopAudioDevicePlayTest(),t()})),this._audioCaptureAndRecoderResolve=t,[3,6];case 5:t(),c.label=6;case 6:return[2]}}))}))},r._mediaRecorder.onerror=function(e){n(new tN(Qw.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},r._mediaRecorder.start()}))]}}))}))},t.prototype._stopAudioCaptureAndRecoder=function(){var e;this._mediaRecorder&&("recording"===this._mediaRecorder.state&&this._mediaRecorder.stop(),delete this._mediaRecorder),null===(e=this._audioTrack)||void 0===e||e.close(),delete this._audioTrack},t}(LD.exports.EventEmitter),_K=function(){function e(){this.engineBAC={},this.engineANM={},this._init()}return e.prototype._init=function(){return ev(this,void 0,void 0,(function(){var e,t;return tv(this,(function(i){switch(i.label){case 0:return e=new nx,t=this,[4,e.getAudioProfile()];case 1:return t.engineBAC=i.sent(),[2]}}))}))},e.prototype.updateEngineBAC=function(e){e&&(this.engineBAC={codec:this.engineBAC.codec,play:Zf(Zf({},this.engineBAC.play),e.play),record:Zf(Zf({},this.engineBAC.record),e.record)},this.setAEC(!!e.aec),this.setAGC(!!e.agc))},e.prototype.updateEngineANM=function(e){e&&(this.engineANM={bitrate:e.enc_param.bitrate,channel:e.enc_param.chn})},e.prototype.setAudioProfile=function(e){var t,i,r;switch(e){case MP.fluent:i=16e3,t=24e3;break;case MP.standard:i=48e3,t=48e3;break;case MP.hd:i=48e3,t=128e3,r=2;break;case MP.standardStereo:i=48e3,t=8e4,r=2;break;case MP.hdMono:i=48e3,t=128e3}t&&(this.bitrate=t),r&&(this.channel=r),i&&(this.sampleRate=i)},e.prototype.setBitrate=function(e){e>128e3&&(e=128e3),this.bitrate=e},e.prototype.setAEC=function(e){this.aec=e},e.prototype.setAGC=function(e){this.agc=e},e.prototype.setANS=function(e){this.ans=e},e.prototype.getOpusConfigStr=function(){var e,t,i=";";return this.bitrate&&(i+="maxaveragebitrate=".concat(this.bitrate,";")),(this.sampleRate||(null===(e=this.engineBAC.record)||void 0===e?void 0:e.sr))&&(i+="maxplaybackrate=".concat(this.sampleRate||this.engineBAC.record.sr,";sprop-maxcapturerate=").concat(this.sampleRate||this.engineBAC.record.sr,";")),((this.channel||1)>1||(null===(t=this.engineBAC.record)||void 0===t?void 0:t.chn)>1)&&(i+="stereo=1;sprop-stereo=1;"),i.slice(0,-1)},Object.defineProperty(e.prototype,"config",{get:function(){var e,t,i;return{bitrate:this.bitrate||this.engineANM.bitrate,channel:this.channel||(null===(e=this.engineBAC.record)||void 0===e?void 0:e.chn)||(null===(t=this.engineANM)||void 0===t?void 0:t.chn)||1,aec:!!this.aec,agc:!!this.agc,ans:!!this.ans,sampleRate:this.sampleRate||(null===(i=this.engineBAC.record)||void 0===i?void 0:i.sr)}},enumerable:!1,configurable:!0}),e}(),fK=new BD("Engine",0),vK=function(e){function t(t,i){var r=e.call(this)||this;return r._visibility=!0,r._remoteVideoPlayer=new Map,r._remoteScreenPlayer=new Map,r._remoteAudioPlayer=new Map,r._publicStreamAudioPlayer=new Map,r._publicStreamVideoPlayer=new Map,r._publicStreamIds=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._enableSimulcast=!1,r._videoStreamEncodeConfig=[YL],r._screenStreamEncodeConfig=[XL],r._pauseAllSubscribeState={audio:!1,video:!1},r._audioPropertiesReportTimer=null,r._mirrorType=IP.MIRROR_TYPE_RENDER,r._audioDeviceManager=new pK,r._audioProfileManager=new _K,r._remoteVideoConfig=new Map,r._userPriorityMap=new Map,r._subscribeFallbackOption=wP.DISABLE,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=mx.PLAYOUT_AND_PUBLISH),ev(r,void 0,void 0,(function(){var i;return tv(this,(function(r){switch(r.label){case 0:return fK.print("_updateMixAudioTrack()"),this._localAudioTrack?(e?(this._localAudioTrack.mixType=t,this._localAudioTrack.mixedAudioTrack=e):(delete this._localAudioTrack.mixType,delete this._localAudioTrack.mixedAudioTrack),(null===(i=this._room)||void 0===i?void 0:i.hasPublished)?[4,this._updatePublish()]:[3,2]):(e&&(this._tempMixingAudioTrack={track:e,type:t}),[2]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(fD.onAudioMixingStateChanged,e)},r._onAudioMixingAutoplayFailed=function(){r.safeEmit(fD.onAutoplayFailed,{})},r._appId=t,r._pubLock=new HF("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new cK({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=r,window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=r,r._trackSourceType={video:lP.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:lP.VIDEO_SOURCE_TYPE_INTERNAL,audio:hP.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:hP.AUDIO_SOURCE_TYPE_INTERNAL},r._config=i,r._rtmClient=new dK(t),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new IB,r}return Qf(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t,i,r;return ev(this,void 0,void 0,(function(){var n,o,a,s;return tv(this,(function(c){switch(c.label){case 0:return fK.print("updateToken()","token: %s",e),RD(e,"token"),this.waitForNewToken&&(null===(t=this._room)||void 0===t?void 0:t._roomInfo)&&this._tempRoomConfig?(n=null===(i=this._room)||void 0===i?void 0:i._roomInfo,o=n.roomId,a=n.userInfo,s=this._tempRoomConfig,delete this._tempRoomConfig,[4,this.joinRoom(e,o,a,s)]):[3,2];case 1:return[2,c.sent()];case 2:if(!this._room)throw new tN(Qw.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");return[4,null===(r=this._room)||void 0===r?void 0:r.updateToken(e)];case 3:return c.sent(),[2]}}))}))},t.prototype.setVideoCaptureDevice=function(e){return ev(this,void 0,void 0,(function(){var t,i;return tv(this,(function(r){switch(r.label){case 0:return fK.print("setVideoCaptureDevice()","deviceId: %s",e),RD(e,"deviceId"),this._localVideoTrack?(t=this._videoStreamConstraints,"user"===e||"environment"===e||"left"===e||"right"===e?(delete t.deviceId,t.facingMode=e):t.deviceId={exact:e},this._videoStreamConstraints=t,[4,ZV(t)]):(this._localVideoDeviceId=e,[2,Promise.resolve()]);case 1:return i=r.sent(),this._initLocalTrackEvents(i),this._localVideoTrack.close(),this._localVideoTrack=i,this._videoPlayer&&this._videoPlayer.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(i),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},t.prototype.setAudioCaptureDevice=function(e){return ev(this,void 0,void 0,(function(){var t,i;return tv(this,(function(r){switch(r.label){case 0:return fK.print("setAudioCaptureDevice()","deviceId: %s",e),RD(e,"deviceId"),this._localAudioTrack?((t=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=t,[4,$V(t,this._audioProfileManager)]):(this._localAudioDeviceId=e,[2,Promise.resolve()]);case 1:return i=r.sent(),this._initLocalTrackEvents(i),this._localAudioTrack.close(),this._localAudioTrack=i,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){DV.on(fD.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),DV.on(fD.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A,C,O=this;null===(e=this._room)||void 0===e||e.on(xL.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(xL.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._room)||void 0===i||i.on(xL.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._room)||void 0===r||r.on(lF.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(n=this._room)||void 0===n||n.on(lF.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(lF.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(xL.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(xL.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(xL.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(xL.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(xL.POST_PROCESSING_MESSAGE,(function(e){!function(e){return"2.0"===e.protocol}(e)?"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e):O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message})})),null===(l=this._room)||void 0===l||l.on(FL.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(lF.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(p=this._room)||void 0===p||p.on(lF.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(lF.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(lF.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(v=this._room)||void 0===v||v.on(lF.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=O._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&O.safeEmit(fD.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(lF.ON_REMOTE_STREAM_STATS,(function(e){O.safeEmit(fD.onRemoteStreamStats,e)})),null===(S=this._room)||void 0===S||S.on(lF.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(fD.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(lF.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(g=this._room)||void 0===g||g.on(lF.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(fD.onUserStartAudioCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(lF.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(fD.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(lF.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(fD.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(lF.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(fD.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(lF.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(fD.onSEIMessageReceived,e)})),null===(R=this._room)||void 0===R||R.on(lF.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(fD.onRemoteVideoSizeChanged,e,t)})),null===(A=this._room)||void 0===A||A.on(lF.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(fD.onSimulcastSubscribeFallback,e)})),null===(C=this._room)||void 0===C||C.on(lF.RECONNECT_FAILED,(function(){O.safeEmit(fD.onError,{errorCode:Qw.RECONNECT_FAILED})}))},t.prototype.safeEmit=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];return UD(t)&&bL(t,_D(i)),e.prototype.safeEmit.apply(this,nv([t],rv(i),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.joinRoom=function(e,t,i,r){return ev(this,void 0,void 0,(function(){var n,o,a,s;return tv(this,(function(c){switch(c.label){case 0:if(fK.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,i,r),ND(e)||RD(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new tN(Qw.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){CD(e,"userInfo"),PD(e.userId),ND(e.extraInfo)||RD(e.extraInfo,"userInfo.extraInfo",1,200)}(i),n={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:kP.communication},Kj(n,r),function(e){CD(e,"roomConfig"),TD(e.isAutoPublish,"roomConfig.isAutoPublish"),TD(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),TD(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(n),!this._room||this._room.connectionState===zF.DISCONNECTED)return[3,1];throw new tN(Qw.REPEAT_JOIN,"Already joined");case 1:this._room=new pB(r,{audioProfileManager:this._audioProfileManager}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),o=this._liveTranscodeConfig&&kL("started",this._liveTranscodeConfig),c.label=2;case 2:return c.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,Zf(Zf({},i),{businessId:this._businessId,role:this._visibility?aK.NORMAL_USER:aK.SILENT_USER}),o,this._useCloudProxy)];case 3:return a=c.sent(),this._roomConfig=r,this._tempRoomConfig&&delete this._tempRoomConfig,(null==r?void 0:r.isAutoPublish)&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:EP.AUDIO_AND_VIDEO}):this.safeEmit(fD.onAutoPublishResult,{isScreen:!1,state:mP.PUBLISH_FAIL})),[2,a];case 4:throw(s=c.sent()).code===Qw.INVALID_TOKEN&&(this._tempRoomConfig=r),s;case 5:return[2]}}))}))},t.prototype.leaveRoom=function(e){var t,i;return void 0===e&&(e=!1),ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:return fK.print("leaveRoom()"),e?[4,null===(t=this._room)||void 0===t?void 0:t.leave(e)]:[3,2];case 1:return r.sent(),[3,3];case 2:null===(i=this._room)||void 0===i||i.leave(e).catch(),r.label=3;case 3:return this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map,[2]}}))}))},t.prototype.destroy=function(){var e,t,i;fK.print("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,null===(t=this._videoPlayer)||void 0===t||t.destroy(),this._videoPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[YL],this._screenStreamEncodeConfig=[XL],this._pauseAllSubscribeState={audio:!1,video:!1},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._localImgVideoTrack&&(this._localImgVideoTrack.stop(),this._localImgVideoTrack=void 0),this._localImgScreenTrack&&(this._localImgScreenTrack.stop(),this._localImgScreenTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(i=this._outsideRoom)||void 0===i||i.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear()},t.prototype.publishStream=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return fK.print("publishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),ED(e)&&!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=(i=this._localImgVideoTrack,new YV(i,oD())),this._localVideoTrack.dummy=!0),[4,this._updatePublish({mediaType:e})];case 1:return t.sent(),[2]}var i}))}))},t.prototype.unpublishStream=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return fK.print("unpublishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updatePublish({mediaType:e,pubState:_F.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.publishScreen=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(i){switch(i.label){case 0:fK.print("publishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),i.label=1;case 1:return i.trys.push([1,3,,4]),ED(e)&&!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=(r=this._localImgScreenTrack,new XV(r,oD())),this._localScreenVideoTrack.dummy=!0),[4,this._updateScreenPublish({mediaType:e,pubState:_F.PUB})];case 2:return i.sent(),[3,4];case 3:throw(t=i.sent())instanceof tN?t:new tN(Qw.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}var r}))}))},t.prototype.unpublishScreen=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return fK.print("unpublishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updateScreenPublish({mediaType:e,pubState:_F.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.subscribeStream=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(i){return fK.print("subscribeStream()","userId: %o, mediaType: %o",e,t),[2,this._subscribe(!1,e,t)]}))}))},t.prototype._subscribe=function(e,t,i){var r,n,o,a,s;return ev(this,void 0,void 0,(function(){var c,u,d,l,h;return tv(this,(function(p){switch(p.label){case 0:if(this._checkMediaType(i),this._assertNotInRoom(),c=this._room.remoteStreams.get(t),!(u=null==c?void 0:c.find((function(t){return t.isScreen===e}))))throw new tN(Qw.STREAM_NOT_EXIST,"stream not exist");return this._pauseAllSubscribeState.audio&&(i-=i&EP.AUDIO),this._pauseAllSubscribeState.video&&(i-=i&EP.VIDEO),fK.print("subscribeStream()","due to pauseAll mediaType: %o",i),d=u.hasSubscribed,l=this._remoteVideoConfig.get(t)||(null===(r=this._roomConfig)||void 0===r?void 0:r.remoteVideoConfig),u.originalMediaType=i,[4,this._room.subscribe(u,i,l)];case 1:return p.sent(),gD(i)&&this._updateAudioPlayerState(u),ED(i)&&this._updateVideoPlayerState(u),e||!(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)&&!(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo)||(u.audioTrack||u.videoTrack)&&(h={userId:t,isScreen:!1,state:vP.SUBSCRIBE_SUCC},this.safeEmit(fD.onAutoSubscribeResult,h)),!d&&gD(i)&&(null===(a=u.observer)||void 0===a||a.setSubscribeAudio(!0)),!d&&ED(i)&&(null===(s=u.observer)||void 0===s||s.setSubscribeVideo(!0)),[2]}}))}))},t.prototype.unsubscribeStream=function(e,t){return ev(this,void 0,void 0,(function(){var i,r;return tv(this,(function(n){if(fK.print("unsubscribeStream()","userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),i=this._room.remoteStreams.get(e),!(null==(r=null==i?void 0:i.find((function(e){return!e.isScreen})))?void 0:r.hasSubscribed))throw new tN(Qw.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.subscribeScreen=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(i){return fK.print("subscribeScreen() userId: %o, mediaType: %o",e,t),[2,this._subscribe(!0,e,t)]}))}))},t.prototype.unsubscribeScreen=function(e,t){return ev(this,void 0,void 0,(function(){var i,r;return tv(this,(function(n){if(fK.print("unsubscribeScreen() userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),i=this._room.remoteStreams.get(e),!(null==(r=null==i?void 0:i.find((function(e){return e.isScreen})))?void 0:r.hasSubscribed))throw new tN(Qw.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.setRemoteVideoConfig=function(e,t){var i;return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return fK.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",e,t),PD(e),function(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new tN(Qw.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}(t),this._remoteVideoConfig.set(e,t),[2,null===(i=this._room)||void 0===i?void 0:i.updateSubVideoConfig(e,t).then((function(){}))]}))}))},t.prototype.startVideoCapture=function(e){var t,i,r;return ev(this,void 0,void 0,(function(){var n,o,a,s,c,u,d=this;return tv(this,(function(l){switch(l.label){case 0:if(fK.print("startVideoCapture()","deviceId: %s",e),ND(e)||RD(e,"deviceId"),e=e||this._localVideoDeviceId,this._localVideoTrack&&!this._localVideoTrack.dummy)throw new tN(Qw.REPEAT_CAPTURE,"Has already capture");return n=this._videoStreamConstraints,e&&("user"===e||"environment"===e||"left"===e||"right"===e?n.facingMode=e:n.deviceId={exact:e},this._videoStreamConstraints=n),[4,ZV(n)];case 1:return o=l.sent(),this._initLocalTrackEvents(o),this._localVideoTrack=o,null===(t=this._videoPlayer)||void 0===t||t.playVideo(o),a={},(s=null==o?void 0:o.getTrack())&&(a=s.getSettings(),c={width:a.width,height:a.height},this._localVideoTrack.resolution=c,setTimeout((function(){return d.safeEmit(fD.onLocalVideoSizeChanged,{streamIndex:gP.STREAM_INDEX_MAIN,info:c})}))),this._room?(u=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||u)&&(this._visibility?this._updatePublish():this.safeEmit(fD.onAutoPublishResult,{isScreen:!1,state:mP.PUBLISH_FAIL})),null===(r=null===(i=this._room.localStream)||void 0===i?void 0:i.observer)||void 0===r||r.setEnableVideo(!0),[2,a]):[2,a]}}))}))},t.prototype.stopVideoCapture=function(){var e,t,i,r,n;return ev(this,void 0,void 0,(function(){return tv(this,(function(o){switch(o.label){case 0:if(fK.print("stopVideoCapture()"),this._trackSourceType.video===lP.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tN(Qw.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");return null===(e=this._videoPlayer)||void 0===e||e.stop(),null===(t=this._localVideoTrack)||void 0===t||t.close(),this._localImgVideoTrack&&this._localVideoTrack?(null===(i=this._localVideoTrack)||void 0===i||i.setTrack(this._localImgVideoTrack),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:o.sent(),o.label=2;case 2:return null===(n=null===(r=this._room.localStream)||void 0===r?void 0:r.observer)||void 0===n||n.setEnableVideo(!1),[2]}}))}))},t.prototype.startAudioCapture=function(e){var t,i;return ev(this,void 0,void 0,(function(){var r,n,o;return tv(this,(function(a){switch(a.label){case 0:if(fK.print("startAudioCapture()","deviceId: $o",e),ND(e)||RD(e,"deviceId"),e=e||this._localAudioDeviceId,this._localAudioTrack)throw new tN(Qw.REPEAT_CAPTURE,"Has already capture");return r=this._audioStreamConstraints,e&&(r.deviceId={exact:e},this._audioStreamConstraints=r),[4,$V(r,this._audioProfileManager)];case 1:return n=a.sent(),this._initLocalTrackEvents(n),this._localAudioTrack=n,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(fD.onAutoPublishResult,{isScreen:!1,state:mP.PUBLISH_FAIL})),null===(i=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===i||i.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.stopAudioCapture=function(){var e,t,i;return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:if(fK.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===hP.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tN(Qw.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:r.sent(),r.label=2;case 2:return null===(i=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===i||i.setEnableAudio(!1),[2]}}))}))},t.prototype.getAudioMixingManager=function(){return fK.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,i,r,n,o;return void 0===e&&(e={}),ev(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p=this;return tv(this,(function(_){switch(_.label){case 0:if(fK.print("startScreenCapture()","config: %o",e),(null===(t=this._localScreenVideoTrack)||void 0===t?void 0:t.dummy)||null===(i=this._localScreenVideoTrack)||void 0===i||i.close(),this._localScreenVideoTrack=void 0,a=e.enableAudio,s=void 0!==a&&a,this._trackSourceType.screenVideo===lP.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tN(Qw.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===hP.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tN(Qw.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,eF(s,this._screenStreamEncodeConfig[0])];case 1:return c=_.sent(),this._localScreenVideoTrack=new XV(c.getVideoTracks()[0],oD()),(u=null===(r=this._localScreenVideoTrack)||void 0===r?void 0:r.getTrack())&&(d=u.getSettings(),l={width:d.width,height:d.height},this._localScreenVideoTrack.resolution=l,setTimeout((function(){return p.safeEmit(fD.onLocalVideoSizeChanged,{streamIndex:gP.STREAM_INDEX_SCREEN,info:{width:d.width,height:d.height}})}))),(h=c.getAudioTracks()).length&&(this._localScreenAudioTrack=new qV(h[0],oD()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),(null===(o=this._room)||void 0===o?void 0:o.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,3];case 2:_.sent(),_.label=3;case 3:return[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,i,r;return ev(this,void 0,void 0,(function(){return tv(this,(function(n){switch(n.label){case 0:return fK.print("stopScreenCapture()"),null===(e=this._screenPlayer)||void 0===e||e.stop(),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localImgScreenTrack&&this._localScreenVideoTrack?(this._localScreenVideoTrack.setTrack(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0):this._localScreenVideoTrack=void 0,null===(i=this._localScreenAudioTrack)||void 0===i||i.close(),this._localScreenAudioTrack=void 0,(null===(r=this._room)||void 0===r?void 0:r.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var i,r,n,o;if(fK.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),AD(e,"streamIndex",[gP.STREAM_INDEX_MAIN,gP.STREAM_INDEX_SCREEN]),t&&t.renderDom){var a=Zf({userId:this._getUserId()},t);return kD(a),e!=gP.STREAM_INDEX_MAIN||this._videoPlayer?e!=gP.STREAM_INDEX_SCREEN||this._screenPlayer?void 0:(this._screenPlayer=new bB(Zf(Zf({},a),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)!==UP.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement):(this._videoPlayer=new bB(a),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==UP.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement)}e==gP.STREAM_INDEX_MAIN?(null===(i=this._videoPlayer)||void 0===i||i.destroy(),delete this._videoPlayer):(null===(r=this._screenPlayer)||void 0===r||r.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return ev(this,void 0,void 0,(function(){var i;return tv(this,(function(r){switch(r.label){case 0:fK.print("startLiveTranscoding()","transcode: %o",e),RD(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(fD.onStreamMixingEvent,{event:pF.START,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(kL("started",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof tN?i:new tN(Qw.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return ev(this,void 0,void 0,(function(){var i;return tv(this,(function(r){switch(r.label){case 0:if(fK.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=Kj(this._liveTranscodeConfig,e),r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(fD.onStreamMixingEvent,{event:pF.UPDATE,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(kL("layoutChanged",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof tN?i:new tN(Qw.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(i){switch(i.label){case 0:if(fK.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,i.label=1;case 1:return i.trys.push([1,3,,4]),this.safeEmit(fD.onStreamMixingEvent,{event:pF.STOP,error:0,message:""}),[4,null===(e=this._room)||void 0===e?void 0:e.liveControlMessage({action:"stopped",type:"transcode"})];case 2:return i.sent(),[3,4];case 3:throw(t=i.sent())instanceof tN?t:new tN(Qw.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return fK.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(mL.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){var t,i;return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:if(fK.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==zF.CONNECTED)throw new tN(Qw.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?aK.NORMAL_USER:aK.SILENT_USER})];case 3:return r.sent(),this._visibility=e,e&&(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoPublish)&&this._updatePublish({mediaType:EP.AUDIO_AND_VIDEO}),[2]}}))}))},t.prototype._initPlayerEvents=function(e,t){var i=this;void 0===t&&(t=!1),e.on("playback_event",(function(r){var n,o,a,s;switch(null===(o=null===(n=i._room)||void 0===n?void 0:n.remoteStreams.get(r.userId||""))||void 0===o||o.find((function(e){return!e.isScreen})),r.eventName){case"timeupdate":return;case"loadeddata":if("audio"===r.type)t?i.safeEmit(fD.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):i.safeEmit(fD.onAudioFirstFrameDecoded,{userId:e.userId}),_L.firstRemoteAudioRender("",r.userId||"");else{var c={userId:e.userId,height:(null===(a=e.domElement)||void 0===a?void 0:a.videoHeight)||0,width:(null===(s=e.domElement)||void 0===s?void 0:s.videoWidth)||0};t?(c.publicStreamId=c.userId,delete c.userId,i.safeEmit(fD.onFirstPublicStreamVideoFrameDecoded,c),i.safeEmit(fD.onFirstPublicStreamVideoFrameRendered,c)):(i.safeEmit(fD.onVideoFirstFrameDecoded,c),i.safeEmit(fD.onVideoFirstFrameRendered,c)),_L.firstRemoteVideoRender("",r.userId||"")}break;case"autoplay-error":return t&&(r.publicStreamId=r.userId),void i.safeEmit(fD.onAutoplayFailed,{userId:r.userId||r.publicStreamId,kind:e instanceof bB?"video":"audio"})}i.safeEmit(fD.onPlayerEvent,r)}))},t.prototype._initLocalTrackEvents=function(e,t){var i=this;void 0===t&&(t=!1),e.on("track-ended",(function(e){var t=!1;e!==i._localScreenAudioTrack&&e!==i._localScreenVideoTrack||(t=!0),i.safeEmit(fD.onTrackEnded,{kind:e.getTrack().kind,isScreen:t})})),e.on("resolution-change",(function(e){i.safeEmit(fD.onLocalVideoSizeChanged,{streamIndex:t?gP.STREAM_INDEX_SCREEN:gP.STREAM_INDEX_MAIN,info:e})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var i,r,n,o,a,s;fK.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),AD(e,"streamIndex",[gP.STREAM_INDEX_MAIN,gP.STREAM_INDEX_SCREEN]),kD(t);var c=t.userId;if(e==gP.STREAM_INDEX_MAIN){if(null===(i=this._remoteVideoPlayer.get(c))||void 0===i||i.destroy(),!t.renderDom)return;var u=new bB(t);return this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(n=null===(r=this._room)||void 0===r?void 0:r.remoteStreams.get(c))||void 0===n?void 0:n.find((function(e){return!e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}if(null===(o=this._remoteScreenPlayer.get(c))||void 0===o||o.destroy(),t.renderDom){var d;u=new bB(Zf(Zf({},t),{isScreen:!0}));return this._remoteScreenPlayer.set(c,u),this._initPlayerEvents(u),(d=null===(s=null===(a=this._room)||void 0===a?void 0:a.remoteStreams.get(c))||void 0===s?void 0:s.find((function(e){return e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}},t.prototype.setLocalVideoMirrorType=function(e){fK.print("setLocalVideoMirrorType()","mirrorType: %o",e),AD(e,"mirrorType",[IP.MIRROR_TYPE_NONE,IP.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(i){switch(i.label){case 0:return fK.print("setAudioPlaybackDevice()","deviceId: %s",e),RD(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(fK.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,DV.getDeviceById(e)];case 1:if(!(t=i.sent()))throw new tN(Qw.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),this._audioPlaybackDeviceId=e,t&&this.safeEmit(fD.onAudioPlaybackDeviceChanged,t),_L.rtcAudioDevice(KU.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e){var t,i;return ev(this,void 0,void 0,(function(){var r,n,o;return tv(this,(function(a){switch(a.label){case 0:return fK.print("play()","userId | publicStreamId: %s",e),o=null===(i=null===(t=this._room)||void 0===t?void 0:t.remoteStreams.get(e||""))||void 0===i?void 0:i.find((function(e){return!e.isScreen})),r=this._remoteAudioPlayer.get(e||""),n=this._remoteVideoPlayer.get(e||""),r||(r=this._publicStreamAudioPlayer.get(e||"")),n||(n=this._publicStreamVideoPlayer.get(e||"")),e||!this._audioMixingManager?[3,2]:[4,this._audioMixingManager.resumeLocalPlay()];case 1:a.sent(),a.label=2;case 2:return!e&&this._videoPlayer&&(n=this._videoPlayer),n?n.played?[4,n.manuallyPlay()]:[3,4]:[3,5];case 3:return a.sent(),[3,5];case 4:o&&o.videoTrack?n.playVideo(o.videoTrack,o):!e&&this._localVideoTrack&&(n.mirror(!!this._mirrorType),n.playVideo(this._localVideoTrack)),a.label=5;case 5:return r?r.played?[4,r.manuallyPlay()]:[3,7]:[3,8];case 6:return a.sent(),[3,8];case 7:o&&o.audioTrack&&r.playAudio(o.audioTrack),a.label=8;case 8:return[2]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return ev(this,void 0,void 0,(function(){var t,i=this;return tv(this,(function(r){return fK.print("pauseAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?[2,Promise.resolve()]:(t=function(){gD(e)&&(i._pauseAllSubscribeState.audio=!0),ED(e)&&(i._pauseAllSubscribeState.video=!0)},this._room?[2,this._room.pauseAllSubscribedStream(e).then((function(){t()}))]:(t(),[2,Promise.resolve()]))}))}))},t.prototype.resumeAllSubscribedStream=function(e){return ev(this,void 0,void 0,(function(){var t,i=this;return tv(this,(function(r){return fK.print("resumeAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video?(t=function(){gD(e)&&(i._pauseAllSubscribeState.audio=!1),ED(e)&&(i._pauseAllSubscribeState.video=!1)},this._room?[2,this._room.resumeAllSubscribedStream(e).then((function(){var e,r;t(),null===(r=null===(e=i._room)||void 0===e?void 0:e.remoteStreams)||void 0===r||r.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){i._updateAudioPlayerState(e),i._updateVideoPlayerState(e)}))}))}))]:(t(),[2,Promise.resolve()])):[2,Promise.resolve()]}))}))},t.prototype.sendUserMessage=function(e,t){var i;return ev(this,void 0,void 0,(function(){var r,n=this;return tv(this,(function(o){if(PD(e),MD(t),!this._room||this._room.connectionState!==zF.CONNECTED)throw new tN(Qw.IM_BEFORE_JOIN,"join first");return r=Date.now(),[2,null===(i=this._room.sendUserMessage(e,t))||void 0===i?void 0:i.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!1,r,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!1,r),t}))]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){var i;return ev(this,void 0,void 0,(function(){var r,n=this;return tv(this,(function(o){if(PD(e),OD(t,"message"),MD(t),!this._room||this._room.connectionState!==zF.CONNECTED)throw new tN(Qw.IM_BEFORE_JOIN,"join first");return r=Date.now(),[2,null===(i=this._room.sendUserMessage(e,t))||void 0===i?void 0:i.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!0,r,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!0,r),t}))]}))}))},t.prototype.sendRoomMessage=function(e){return ev(this,void 0,void 0,(function(){var t,i=this;return tv(this,(function(r){if(MD(e),!this._room||this._room.connectionState!==zF.CONNECTED)throw new tN(Qw.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e).then((function(e){var r,n;return i._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e})).catch((function(e){var r,n;throw i._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e}))]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return ev(this,void 0,void 0,(function(){var t,i=this;return tv(this,(function(r){if(MD(e),!this._room||this._room.connectionState!==zF.CONNECTED)throw new tN(Qw.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e,!0).then((function(e){var r,n;return i._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e})).catch((function(e){var r,n;throw i._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e}))]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),ev(this,void 0,void 0,(function(){var i;return tv(this,(function(r){switch(r.label){case 0:return fK.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,wD(e),i=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=e,i&&(this._audioStreamConstraints.deviceId=i),this._localAudioTrack?(this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,[4,null===(t=this._localAudioTrack)||void 0===t?void 0:t.updateAudioCaptureConfig()]):[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),ev(this,void 0,void 0,(function(){var i;return tv(this,(function(r){switch(r.label){case 0:return fK.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,wD(e),i=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=e,i&&(this._videoStreamConstraints.deviceId=i),this._localVideoTrack?(this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,[4,null===(t=this._localVideoTrack)||void 0===t?void 0:t.updateVideoCaptureConfig()]):[3,2];case 1:r.sent(),this._updatePublish(),r.label=2;case 2:return[2]}}))}))},t.prototype.enableSimulcastMode=function(e){return fK.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0},t.prototype.setVideoEncoderConfig=function(e){var t;return ev(this,void 0,void 0,(function(){return tv(this,(function(i){return fK.print("setVideoEncoderConfig()"," descriptions: %o",e),Array.isArray(e)||(e=[e]),e.length>3&&(e=e.slice(0,3)),e.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._videoStreamEncodeConfig=e,(null===(t=this._room)||void 0===t?void 0:t.hasPublished)&&this._updatePublish(),[2]}))}))},t.prototype.setScreenEncoderConfig=function(e){var t;return ev(this,void 0,void 0,(function(){return tv(this,(function(i){return fK.print("setScreenEncoderConfig()","description: %o",e),this._screenStreamEncodeConfig=[e],this._localScreenVideoTrack&&(this._localScreenVideoTrack.videoCaptureConfig=e,this._localScreenVideoTrack.updateVideoCaptureConfig()),(null===(t=this._room)||void 0===t?void 0:t.hasScreenPublished)&&this._updateScreenPublish(),[2]}))}))},t.prototype.sendSEIMessage=function(e,t,i){var r,n,o,a,s,c;fK.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,i),AD(e,"streamIndex",[gP.STREAM_INDEX_MAIN,gP.STREAM_INDEX_SCREEN]),ID(i,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(uD.str2ab(t)):t;if(t.length){var d;if(e===gP.STREAM_INDEX_MAIN){if(!(null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.hasPublished))return;d=null===(o=this._room)||void 0===o?void 0:o.localStream}else{if(!(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished))return;d=null===(c=this._room)||void 0===c?void 0:c.localScreenStream}if(u.byteLength>4096)fK.print("sei size must not bigger than 4KB");else{var l=oD();d.seiList.push({content:u,uuid:l,repeatCount:i}),setTimeout((function(){if(d){var e=d.seiList.findIndex((function(e){return e.uuid===l}));e&&d.seiList.splice(e,1)}}),2e3)}}else fK.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;fK.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var i=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,r;i=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var r;if(0!==e.length){var n=e.find((function(e){return!1===e.isScreen})),o=null===(r=null==n?void 0:n.audioTrack)||void 0===r?void 0:r.getAudioLevel();i.push({userId:t,volume:o||0})}}));var n=null===(r=t._localAudioTrack)||void 0===r?void 0:r.getAudioLevel();i.push({userId:t._getUserId(),volume:n||0}),t.safeEmit(fD.onAudioVolumeIndication,{speakers:i})}),e)},t.prototype.enableAudioPropertiesReport=function(e){var t=this;void 0===e&&(e={}),fK.print("enableAudioPropertiesReport()","config %o: ",e);var i=e.interval,r=void 0===i?100:i,n=e.enableInBackground,o=void 0===n||n;this._stopAudioPropertiesReport(),r<=0||(r=Math.max(100,r),this._audioPropertiesReportTimer=self.setInterval((function(){if(o||"hidden"!==document.visibilityState){var e=[],i=t._audioDeviceManager.getRecordTrack()||t._localAudioTrack;if(i){var r=i.getAudioLevel();e.push({streamIndex:gP.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:r,nonlinearVolume:yD(r)}})}if(t._localScreenAudioTrack){r=t._localScreenAudioTrack.getAudioLevel();e.push({streamIndex:gP.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:r,nonlinearVolume:yD(r)}})}if(t.safeEmit(fD.onLocalAudioPropertiesReport,e),t._room){var n=[];t._room.remoteStreams.forEach((function(e,i){e.forEach((function(e){var r,o;if(e.audioTrack){var a=e.audioTrack.getAudioLevel();n.push({streamKey:{userId:i,streamIndex:e.isScreen?gP.STREAM_INDEX_SCREEN:gP.STREAM_INDEX_MAIN,roomId:null===(o=null===(r=t._room)||void 0===r?void 0:r.roomInfo)||void 0===o?void 0:o.roomId},audioPropertiesInfo:{linearVolume:a,nonlinearVolume:yD(a)}})}}))})),t.safeEmit(fD.onRemoteAudioPropertiesReport,n)}}}),r))},t.prototype.setVideoSourceType=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S;return ev(this,void 0,void 0,(function(){var y,g,E;return tv(this,(function(b){switch(b.label){case 0:return fK.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),AD(e,"streamIndex",[gP.STREAM_INDEX_MAIN,gP.STREAM_INDEX_SCREEN]),AD(t,"VideoSourceType",[lP.VIDEO_SOURCE_TYPE_EXTERNAL,lP.VIDEO_SOURCE_TYPE_INTERNAL]),y=e===gP.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[y]===t?[3,4]:(this._trackSourceType[y]=t,fK.print("setVideoSourceType","set ".concat(y," source type to ").concat(t)),this._localVideoTrack&&e===gP.STREAM_INDEX_MAIN?(E=!1,t===lP.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,g=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,E?null===(a=null===(o=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!1):null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushVideo(!1),(null===(d=this._room)||void 0===d?void 0:d.hasPublished)||g?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:b.sent(),b.label=2;case 2:return this._localScreenVideoTrack&&e===gP.STREAM_INDEX_SCREEN?(E=!1,t===lP.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localScreenVideoTrack.close()),null===(l=this._screenPlayer)||void 0===l||l.stop(),this._localScreenVideoTrack=void 0,E?null===(_=null===(p=null===(h=this._room)||void 0===h?void 0:h.localScreenStream)||void 0===p?void 0:p.observer)||void 0===_||_.setEnableVideo(!1):null===(m=null===(v=null===(f=this._room)||void 0===f?void 0:f.localScreenStream)||void 0===v?void 0:v.observer)||void 0===m||m.setPushVideo(!1),(null===(S=this._room)||void 0===S?void 0:S.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:b.sent(),b.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var i,r,n,o,a,s,c,u;return ev(this,void 0,void 0,(function(){var d;return tv(this,(function(l){switch(l.label){case 0:if(fK.print("setExternalVideoTrack()","index: %o, track: %o",e,t),AD(e,"streamIndex",[gP.STREAM_INDEX_MAIN,gP.STREAM_INDEX_SCREEN]),e!==gP.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==lP.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tN(Qw.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new JV(t,oD()),this._initLocalTrackEvents(this._localVideoTrack),null===(i=this._videoPlayer)||void 0===i||i.playVideo(this._localVideoTrack),d=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||d?[4,this._updatePublish()]:[3,2];case 1:l.sent(),l.label=2;case 2:if(e!==gP.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==lP.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tN(Qw.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new JV(t,oD()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushVideo(!0),(null===(u=this._room)||void 0===u?void 0:u.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v;return ev(this,void 0,void 0,(function(){var m,S,y;return tv(this,(function(g){switch(g.label){case 0:return fK.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),AD(e,"streamIndex",[gP.STREAM_INDEX_MAIN,gP.STREAM_INDEX_SCREEN]),AD(t,"audioSourceType",[hP.AUDIO_SOURCE_TYPE_EXTERNAL,hP.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===gP.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,fK.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===gP.STREAM_INDEX_MAIN?(y=!1,this._trackSourceType.audio===hP.AUDIO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,S=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,y?null===(o=null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setEnableAudio(!1):null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushAudio(!1),(null===(u=this._room)||void 0===u?void 0:u.hasPublished)||S?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:g.sent(),g.label=2;case 2:return this._localScreenAudioTrack&&e===gP.STREAM_INDEX_SCREEN?(y=!1,this._trackSourceType.audio===hP.AUDIO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,y?null===(h=null===(l=null===(d=this._room)||void 0===d?void 0:d.localScreenStream)||void 0===l?void 0:l.observer)||void 0===h||h.setEnableAudio(!1):null===(f=null===(_=null===(p=this._room)||void 0===p?void 0:p.localScreenStream)||void 0===_?void 0:_.observer)||void 0===f||f.setPushAudio(!1),(null===(v=this._room)||void 0===v?void 0:v.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:g.sent(),g.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var i,r,n,o,a,s,c,u,d;return ev(this,void 0,void 0,(function(){var l;return tv(this,(function(h){switch(h.label){case 0:if(fK.print("setExternalAudioTrack()","index: %o, track: %o",e,t),AD(e,"streamIndex",[gP.STREAM_INDEX_MAIN,gP.STREAM_INDEX_SCREEN]),e!==gP.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==hP.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tN(Qw.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new QV(t,oD()),this._initLocalTrackEvents(this._localAudioTrack),l=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,null===(o=null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setPushAudio(!0),(null===(a=this._room)||void 0===a?void 0:a.hasPublished)||l?[4,this._updatePublish()]:[3,2];case 1:h.sent(),h.label=2;case 2:if(e!==gP.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==hP.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tN(Qw.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new QV(t,oD()),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(i){return fK.print("login()","token: %o, userInfo: %o",e,t),ND(e)||RD(e,"token"),PD(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 fK.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 fK.print("updateLoginToken()","token: %o",e),ND(e)||RD(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 fK.print("getPeerOnlineStatus()","userId: %o",e),PD(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return ev(this,void 0,void 0,(function(){var i,r=this;return tv(this,(function(n){PD(e),MD(t),i=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return r._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!1,i,t),t.id})).catch((function(t){throw r._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,i),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,i),t}return[2]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return ev(this,void 0,void 0,(function(){var i,r=this;return tv(this,(function(n){PD(e),OD(t,"message"),MD(t),i=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return r._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!0,i,t),t.id})).catch((function(t){throw r._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,i),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,i),t}return[2]}))}))},t.prototype.setServerParams=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(i){return fK.print("setServerParams()","signature: %o, url: %0",e,t),RD(e,"signature"),RD(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return ev(this,void 0,void 0,(function(){var t,i=this;return tv(this,(function(r){RD(e,"message"),MD(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){i._messageStatisticsObserver.countServerMessage(!0,!1,t)})).catch((function(e){throw i._messageStatisticsObserver.countServerMessage(!1,!1,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!1,t),e}return[2]}))}))},t.prototype.sendServerBinaryMessage=function(e){return ev(this,void 0,void 0,(function(){var t,i=this;return tv(this,(function(r){OD(e,"message"),MD(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){i._messageStatisticsObserver.countServerMessage(!0,!0,t)})).catch((function(e){throw i._messageStatisticsObserver.countServerMessage(!1,!0,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!0,t),e}return[2]}))}))},t.prototype.startCloudProxy=function(e){if(this._room)throw new tN(Qw.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;fK.print("startCloudProxy()",e),RD(e.logProxy,"logProxy"),RD(e.accessProxy,"accessProxy"),RD(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=DL("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=DL("LOG_SERVER_URL"),this._originConfigServerUrls=DL("CONFIG_REQUEST_DOMAINS"),PL("ICE_CONFIG_REQUEST_URLS",e.accessProxy),PL("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),PL("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new tN(Qw.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");fK.print("stopCloudProxy()"),PL("ICE_CONFIG_REQUEST_URLS",[]),PL("LOG_SERVER_URL",this._originLogServerUrl),PL("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 i,r=this;return tv(this,(function(n){if(fK.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),DD(e),!this._room||this._room.connectionState!==zF.CONNECTED)throw new tN(Qw.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new tN(Qw.REPEAT_PUSH,"repeat push public media stream");return i=ML(e,"started",t),[2,this._room.publicStreamControlMessage(i).then((function(){r._publicStreamIds.set(e,e)}))]}))}))},t.prototype.updatePublicStreamParam=function(e,t){return ev(this,void 0,void 0,(function(){var i;return tv(this,(function(r){if(fK.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),DD(e),!this._room||this._room.connectionState!==zF.CONNECTED)throw new tN(Qw.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return i=ML(e,"layoutChanged",t),[2,this._room.publicStreamControlMessage(i)]}))}))},t.prototype.stopPushPublicStream=function(e){return ev(this,void 0,void 0,(function(){var t=this;return tv(this,(function(i){if(fK.print("startPushPublicStream()","publicStreamId: %o",e),DD(e),!this._room||this._room.connectionState!==zF.CONNECTED)throw new tN(Qw.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return[2,this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:e}).then((function(){t._publicStreamIds.delete(e)}))]}))}))},t.prototype.startPlayPublicStream=function(e){var t,i,r;return ev(this,void 0,void 0,(function(){var n,o,a,s=this;return tv(this,(function(c){switch(c.label){case 0:return DD(e),this._outsideRoom?[3,2]:(this._outsideRoom=new lK(this._appId),this._outsideRoom.on(lF.RESUBSCRIBE,(function(e){var t,i,r=e.stream;if(r){var n=s._publicStreamAudioPlayer.get(r.streamId);n&&r.audioTrack&&(n.stop(),n.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var o=s._publicStreamVideoPlayer.get(r.streamId);o&&r.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(t=this._outsideRoom)||void 0===t||t.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,s.safeEmit(fD.onPublicStreamStats,e)})),null===(i=this._outsideRoom)||void 0===i||i.on(lF.ON_SEI_MESSAGED_RECEIVED,(function(e){s.safeEmit(fD.onPublicStreamSEIMessageReceived,e)})),[4,this._outsideRoom.connect()]);case 1:c.sent(),c.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return n=c.sent(),(o=this._publicStreamVideoPlayer.get(e))&&(null==n?void 0:n.videoTrack)&&o.playVideo(n.videoTrack,n),!(a=this._publicStreamAudioPlayer.get(e))&&(null==n?void 0:n.audioTrack)&&(a=new TB(e,{muted:(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)===UP.VIDEO_ONLY}),this._initPlayerEvents(a,!0),a.playAudio(n.audioTrack),this._publicStreamAudioPlayer.set(e,a)),[2]}}))}))},t.prototype.stopPlayPublicStream=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(i){return this._outsideRoom?(this._outsideRoom.stopPlayPublicStream(e),(t=this._publicStreamAudioPlayer.get(e))&&(t.destroy(),this._publicStreamAudioPlayer.delete(e)),[2]):[2]}))}))},t.prototype.setAudioProfile=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return this._audioProfileManager.setAudioProfile(e),[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var i,r,n;fK.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var o=this._publicStreamVideoPlayer.get(e);if(!(null==t?void 0:t.renderDom)&&o)return o.destroy(),void this._publicStreamVideoPlayer.delete(e);if(!o){o=new bB(Zf(Zf({},t),{userId:e})),this._initPlayerEvents(o,!0),this._publicStreamVideoPlayer.set(e,o);var a=null===(r=null===(i=this._outsideRoom)||void 0===i?void 0:i.remoteStreams)||void 0===r?void 0:r.get(e);(null==a?void 0:a.videoTrack)&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==UP.PLAY_MANUALLY&&o.playVideo(a.videoTrack,a)}},t.prototype.setDummyCaptureImagePath=function(e,t){return ev(this,void 0,void 0,(function(){var i=this;return tv(this,(function(r){return[2,new Promise((function(r,n){RD(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 tN(Qw.UNEXPECTED_ERROR,"Not support canvas"));t.width=o.width,t.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(i._dummyTimer),i._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=t.captureStream(5).getVideoTracks()[0];e===gP.STREAM_INDEX_MAIN?i._localImgVideoTrack=s:i._localImgScreenTrack=s,r()}catch(e){n(new tN(Qw.UNEXPECTED_ERROR,e.message))}},o.onerror=function(){n(new tN(Qw.UNEXPECTED_ERROR,"Load image error"))}}))]}))}))},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(WL))},t.prototype._updatePublish=function(e){return void 0===e&&(e={}),ev(this,void 0,void 0,(function(){var t,i,r;return tv(this,(function(n){switch(n.label){case 0:if(fK.print("_updatePublish()","config: %o",e),t={mediaType:void 0,invokeByJoinRoom:!1,pubState:_F.PUB},e=Zf(Zf({},t),e),!this._visibility)throw new tN(Qw.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==zF.CONNECTED)return i(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,e.mediaType,e.pubState,e.invokeByJoinRoom)];case 3:return n.sent(),[3,6];case 4:throw(r=n.sent())instanceof tN?r:new tN(Qw.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype.startAudioPlaybackDeviceTest=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(i){switch(i.label){case 0:return fK.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",e,t),RD(e,"filePath"),ID(t,"indicationInterval"),[4,this._audioDeviceManager.startAudioPlaybackDeviceTest(e,t)];case 1:return[2,i.sent()]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){fK.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 fK.print("startAudioDeviceRecordTest()","indicationInterval: %o",e),ID(e,"indicationInterval"),[4,this._audioDeviceManager.startAudioDeviceRecordTest(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){fK.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()},t.prototype.stopAudioDevicePlayTest=function(){fK.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()},t.prototype.setRemoteUserPriority=function(e,t){var i;fK.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{PD(e),AD(t,"priority",[NP.HIGH,NP.MEDIUM,NP.LOW])}catch(e){return console.warn(e),!1}return this._userPriorityMap.set(e,t),null===(i=this._room)||void 0===i||i.setRemoteUserPriority(e,t),!0},t.prototype.setSubscribeFallbackOption=function(e){fK.print("setSubscribeFallbackOption()","option: %o",e);try{AD(e,"option",[wP.DISABLE,wP.VIDEO_STREAM_LOW,wP.AUDIO_ONLY])}catch(e){return console.warn(e),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)},t.prototype._updateScreenPublish=function(e){return void 0===e&&(e={}),ev(this,void 0,void 0,(function(){var t,i,r;return tv(this,(function(n){switch(n.label){case 0:return fK.print("_updateScreenPublish()"),t={mediaType:void 0,pubState:_F.PUB},e=Zf(Zf({},t),e),[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==zF.CONNECTED)return i(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,e.mediaType,e.pubState)];case 3:return n.sent(),[3,6];case 4:throw(r=n.sent())instanceof tN?r:new tN(Qw.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){var t,i;fK.print("_updateAudioPlayerState()");var r,n=e.userId,o=e.isScreen;if(r=o?this._remoteAudioPlayer.get("".concat(n,"_screen")):this._remoteAudioPlayer.get(n),e.audioTrack){if(!r){var a=o?"".concat(n,"_screen"):n;r=new TB(a,{muted:(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)===UP.VIDEO_ONLY}),this._initPlayerEvents(r),this._remoteAudioPlayer.set(a,r),this._audioPlaybackDeviceId&&r.setPlaybackDevice(this._audioPlaybackDeviceId)}(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==UP.PLAY_MANUALLY&&r.playAudio(e.audioTrack)}else null==r||r.stop()},t.prototype._updateVideoPlayerState=function(e){var t;fK.print("_updateVideoPlayerState()");var i,r=e.userId;i=e.isScreen?this._remoteScreenPlayer.get(r):this._remoteVideoPlayer.get(r),e.videoTrack?i&&(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)!==UP.PLAY_MANUALLY&&i.playVideo(e.videoTrack,e):(null==i?void 0:i.played)&&(null==i||i.stop())},t.prototype._onAddStream=function(e){var t=e.stream,i=null==t?void 0:t.attributes,r=i.localaudio,n=i.audiostream,o=i.localvideo,a=i.videostream,s=NV.NONE;n&&(s|=EP.AUDIO),a&&(s|=EP.VIDEO),s&&((null==t?void 0:t.isScreen)?this.safeEmit(fD.onUserPublishScreen,{userId:t.userId,mediaType:s}):(this.safeEmit(fD.onUserPublishStream,{userId:t.userId,mediaType:s}),this._handleAutoSubscribe(t,!0)),(null==t?void 0:t.isScreen)||(r&&this.safeEmit(fD.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(fD.onUserStartVideoCapture,{userId:t.userId})))},t.prototype._handleAutoSubscribe=function(e,t){var i,r,n,o,a=NV.NONE;(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)&&(a|=EP.AUDIO),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(a|=EP.VIDEO),fK.print("_onAddStream","autoSubType: ".concat(a)),a&&(t&&gD(a)&&(null===(n=e.observer)||void 0===n||n.setAutoSubscribeAudio(!0)),t&&ED(a)&&(null===(o=e.observer)||void 0===o||o.setAutoSubscribeVideo(!0)),this._subscribe(!1,e.userId,a))},t.prototype._onRemoveStream=function(e){var t,i=this,r=e.stream,n=null!==(t=mK[e.reason])&&void 0!==t?t:bP.STREAM_REMOVE_REASON_OTHER,o=r.isScreen?fD.onUserUnpublishScreen:fD.onUserUnpublishStream,a=EP.AUDIO_AND_VIDEO;(null==r?void 0:r._workaround_1_)&&(a=EP.VIDEO),this.safeEmit(o,{userId:r.userId,mediaType:a,reason:n}),this._getRemotePlayer(r.userId,r.isScreen).forEach((function(e){if(!(null==r?void 0:r._workaround_1_)){var t=r.isScreen?"".concat(r.userId,"_screen"):r.userId;i._remoteAudioPlayer.delete(t),r.isScreen?i._remoteScreenPlayer.delete(r.userId):i._remoteVideoPlayer.delete(r.userId),null==e||e.destroy()}}))},t.prototype._onUserConnection=function(e){this.safeEmit(fD.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(fD.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(fD.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onNetworkQuality=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.safeEmit.apply(this,nv([fD.onNetworkQuality],rv(e),!1))},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===TP.CONNECTION_STATE_CONNECTED&&this.safeEmit(fD.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(fD.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(fD.onVideoFirstFrameDecoded,e)},t.prototype._onVideoDeviceStateChange=function(e){this.safeEmit(fD.onVideoDeviceStateChanged,e)},t.prototype._onAudioDeviceStateChange=function(e){this.safeEmit(fD.onAudioDeviceStateChanged,e)},t.prototype._onUserPublishStateChange=function(e){var t=e.userId,i=e.isScreen,r=e.mediaType,n=e.pubState,o=e.remoteStream,a={userId:t,mediaType:r};i?n===_F.PUB?this.safeEmit(fD.onUserPublishScreen,a):this.safeEmit(fD.onUserUnpublishScreen,Zf(Zf({},a),{reason:bP.STREAM_REMOVE_REASON_UNPUBLISH})):n===_F.PUB?(this.safeEmit(fD.onUserPublishStream,a),this._handleAutoSubscribe(o,!0)):this.safeEmit(fD.onUserUnpublishStream,Zf(Zf({},a),{reason:bP.STREAM_REMOVE_REASON_UNPUBLISH}))},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(fD.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(fD.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(fD.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(fD.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(fD.onLiveTranscodingResult,e)},t.prototype._onStreamMixingEvent=function(e){this.safeEmit(fD.onStreamMixingEvent,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(fD.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(fD.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(fD.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(fD.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(fD.onError,{errorCode:Qw.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(fD.onError,{errorCode:Qw.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,i=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteStreams)&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){i.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))}))),i},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){var e,t,i=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteUsers)&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){i.push({userId:e.userId})}))),i},enumerable:!1,configurable:!0}),t.prototype._handleAudioDeviceManager=function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(fD.onAudioPlaybackDeviceTestVolume,t)}))},t.prototype._assertNotInRoom=function(){if(!this._room||this._room.connectionState!==zF.CONNECTED)throw new tN(Qw.INVOKED_BEFORE_JOIN_ROOM,"join first")},t.prototype._checkMediaType=function(e){AD(e,"mediaType",[EP.AUDIO,EP.VIDEO,EP.AUDIO_AND_VIDEO])},t.prototype._getUserId=function(){var e,t;return(null===(t=null===(e=this._room)||void 0===e?void 0:e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"},$f([EL()],t.prototype,"updateToken",null),$f([EL()],t.prototype,"setVideoCaptureDevice",null),$f([EL()],t.prototype,"setAudioCaptureDevice",null),$f([EL()],t.prototype,"joinRoom",null),$f([EL()],t.prototype,"leaveRoom",null),$f([EL()],t.prototype,"destroy",null),$f([EL()],t.prototype,"publishStream",null),$f([EL()],t.prototype,"unpublishStream",null),$f([EL()],t.prototype,"publishScreen",null),$f([EL()],t.prototype,"unpublishScreen",null),$f([EL()],t.prototype,"subscribeStream",null),$f([EL()],t.prototype,"unsubscribeStream",null),$f([EL()],t.prototype,"subscribeScreen",null),$f([EL()],t.prototype,"unsubscribeScreen",null),$f([EL()],t.prototype,"setRemoteVideoConfig",null),$f([EL()],t.prototype,"startVideoCapture",null),$f([EL()],t.prototype,"stopVideoCapture",null),$f([EL()],t.prototype,"startAudioCapture",null),$f([EL()],t.prototype,"stopAudioCapture",null),$f([EL()],t.prototype,"getAudioMixingManager",null),$f([EL()],t.prototype,"startScreenCapture",null),$f([EL()],t.prototype,"stopScreenCapture",null),$f([EL()],t.prototype,"setLocalVideoPlayer",null),$f([EL()],t.prototype,"startLiveTranscoding",null),$f([EL()],t.prototype,"updateLiveTranscoding",null),$f([EL()],t.prototype,"stopLiveTranscoding",null),$f([EL()],t.prototype,"setBusinessId",null),$f([EL()],t.prototype,"setUserVisibility",null),$f([EL()],t.prototype,"setRemoteVideoPlayer",null),$f([EL()],t.prototype,"setLocalVideoMirrorType",null),$f([EL()],t.prototype,"setAudioPlaybackDevice",null),$f([EL()],t.prototype,"play",null),$f([EL()],t.prototype,"pauseAllSubscribedStream",null),$f([EL()],t.prototype,"resumeAllSubscribedStream",null),$f([EL()],t.prototype,"sendUserMessage",null),$f([EL()],t.prototype,"sendUserBinaryMessage",null),$f([EL()],t.prototype,"sendRoomMessage",null),$f([EL()],t.prototype,"sendRoomBinaryMessage",null),$f([EL()],t.prototype,"setAudioCaptureConfig",null),$f([EL()],t.prototype,"setVideoCaptureConfig",null),$f([EL()],t.prototype,"enableSimulcastMode",null),$f([EL()],t.prototype,"setVideoEncoderConfig",null),$f([EL()],t.prototype,"setScreenEncoderConfig",null),$f([EL()],t.prototype,"sendSEIMessage",null),$f([EL()],t.prototype,"setAudioVolumeIndicationInterval",null),$f([EL()],t.prototype,"enableAudioPropertiesReport",null),$f([EL()],t.prototype,"setVideoSourceType",null),$f([EL()],t.prototype,"setExternalVideoTrack",null),$f([EL()],t.prototype,"setAudioSourceType",null),$f([EL()],t.prototype,"setExternalAudioTrack",null),$f([EL("rtm")],t.prototype,"login",null),$f([EL("rtm")],t.prototype,"logout",null),$f([EL("rtm")],t.prototype,"updateLoginToken",null),$f([EL("rtm")],t.prototype,"getPeerOnlineStatus",null),$f([EL("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),$f([EL("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),$f([EL("rtm")],t.prototype,"setServerParams",null),$f([EL("rtm")],t.prototype,"sendServerMessage",null),$f([EL("rtm")],t.prototype,"sendServerBinaryMessage",null),$f([EL()],t.prototype,"startCloudProxy",null),$f([EL()],t.prototype,"stopCloudProxy",null),$f([EL()],t.prototype,"startPushPublicStream",null),$f([EL()],t.prototype,"updatePublicStreamParam",null),$f([EL()],t.prototype,"stopPushPublicStream",null),$f([EL("outsideRoom")],t.prototype,"startPlayPublicStream",null),$f([EL("outsideRoom")],t.prototype,"stopPlayPublicStream",null),$f([EL()],t.prototype,"setAudioProfile",null),$f([EL("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),$f([EL()],t.prototype,"setDummyCaptureImagePath",null),$f([EL()],t.prototype,"startAudioPlaybackDeviceTest",null),$f([EL()],t.prototype,"stopAudioPlaybackDeviceTest",null),$f([EL()],t.prototype,"startAudioDeviceRecordTest",null),$f([EL()],t.prototype,"stopAudioDeviceRecordAndPlayTest",null),$f([EL()],t.prototype,"stopAudioDevicePlayTest",null),$f([EL()],t.prototype,"setRemoteUserPriority",null),$f([EL()],t.prototype,"setSubscribeFallbackOption",null),t}(GD),mK={"client unpublished":bP.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":bP.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":bP.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":bP.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":bP.STREAM_REMOVE_REASON_REPUBLISH},SK=new BD("VERTC",0);[mL,SL,yL].forEach((function(e){return e.setStats({rtc_sdk_version:qL.VERSION,product_line:yU.RTC,report_version:gU.W_5,os:EU.WEB,device_id:AL.getDeviceId(),user_agent:cD()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var yK=function(e,t){return SK.print("createEngine","Invoke VERTC.createEngine"),RD(e,"appId"),[mL,SL,yL].forEach((function(i){return i.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),_L.sdkInitEngine(Date.now(),QU.BEGIN),new vK(e,t)},gK=function(e){if(SK.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof vK))throw new tN(Qw.INVALID_ENGINE,"Invalid engine object");e.destroy(),_L.sdkInitEngine(Date.now(),QU.END)},EK=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,DV.enumerateDevices()]}))}))},bK=function(e){return void 0===e&&(e={video:!0,audio:!0}),ev(void 0,void 0,void 0,(function(){var t,i,r,n,o;return tv(this,(function(a){switch(a.label){case 0:if(t=e.video,i=e.audio,r={video:!1,audio:!1},!t)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),n=r,[4,DV.getVideoPermission()];case 2:return n.video=a.sent(),[3,4];case 3:return a.sent(),[3,4];case 4:if(!i)return[3,8];a.label=5;case 5:return a.trys.push([5,7,,8]),o=r,[4,DV.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,r]}}))}))},TK=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,DV.enumerateAudioCaptureDevices()]}))}))},IK=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,DV.enumerateVideoCaptureDevices()]}))}))},RK=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,DV.enumerateAudioPlaybackDevices()]}))}))},AK=function(){return qL.VERSION},CK=function(){return _L.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]),!cD()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,Tx()]:[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]}}))}))},OK=function(){return _L.rtcSdkApiCall("getSupportedCodecs",0,""),ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return[4,Tx()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!cD()&&location.search.includes("_rtc_autotest_");var wK=new function(){this.getSdkVersion=AK,this.createEngine=yK,this.destroyEngine=gK,this.enumerateDevices=EK,this.enableDevices=bK,this.enumerateAudioCaptureDevices=TK,this.enumerateVideoCaptureDevices=IK,this.enumerateAudioPlaybackDevices=RK,this.getParameter=DL,this.setParameter=PL,this.isSupported=CK,this.getSupportedCodecs=OK,this.events=fD,this.ErrorCode=Qw,this.platform="BytePlus",this._monitor=_L};export{vx as AudioMixingDualMonoMode,mx as AudioMixingType,MP as AudioProfileType,hP as AudioSourceType,_P as ChannelProfile,TP as ConnectionState,DP as FallbackOrRecoverReason,RP as LogChannel,EP as MediaType,SP as MirrorMode,IP as MirrorType,PP as NetworkQuality,OP as PublicInterpolationMode,CP as PublicStreamType,mP as PublishState,UP as RTCAutoPlayPolicy,NP as RemoteUserPriority,kP as RoomProfileType,gP as StreamIndex,bP as StreamRemoveReason,wP as SubscribeFallbackOption,fP as SubscribeMode,vP as SubscribeState,AP as USER_ONLINE_STATUS,pP as UserOfflineReason,yP as VideoRenderMode,lP as VideoSourceType,wK as default};