trtc-sdk-v5 5.19.2 → 5.19.3-beta.2

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.
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).TRTCDebugDialog=t()}(this,function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=function(e){return e&&e.Math===Math&&e},i=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof e&&e)||t("object"==typeof e&&e)||function(){return this}()||Function("return this")(),r={},n=function(e){try{return!!e()}catch(t){return!0}},a=!n(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}),o=!n(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}),s=o,c=Function.prototype.call,l=s?c.bind(c):function(){return c.apply(c,arguments)},d={},u={}.propertyIsEnumerable,h=Object.getOwnPropertyDescriptor,p=h&&!u.call({1:2},1);d.f=p?function(e){var t=h(this,e);return!!t&&t.enumerable}:u;var f,m,g=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},_=o,v=Function.prototype,y=v.call,E=_&&v.bind.bind(y,y),b=_?E:function(e){return function(){return y.apply(e,arguments)}},w=b,I=w({}.toString),T=w("".slice),S=function(e){return T(I(e),8,-1)},A=n,R=S,k=Object,C=b("".split),D=A(function(){return!k("z").propertyIsEnumerable(0)})?function(e){return"String"===R(e)?C(e,""):k(e)}:k,O=function(e){return null==e},L=O,N=TypeError,P=function(e){if(L(e))throw new N("Can't call method on "+e);return e},x=D,M=P,U=function(e){return x(M(e))},F="object"==typeof document&&document.all,B=void 0===F&&void 0!==F?function(e){return"function"==typeof e||e===F}:function(e){return"function"==typeof e},V=B,H=function(e){return"object"==typeof e?null!==e:V(e)},j=i,z=B,W=function(e,t){return arguments.length<2?(i=j[e],z(i)?i:void 0):j[e]&&j[e][t];var i},G=b({}.isPrototypeOf),q=i.navigator,K=q&&q.userAgent,Y=K?String(K):"",X=i,Z=Y,J=X.process,Q=X.Deno,$=J&&J.versions||Q&&Q.version,ee=$&&$.v8;ee&&(m=(f=ee.split("."))[0]>0&&f[0]<4?1:+(f[0]+f[1])),!m&&Z&&(!(f=Z.match(/Edge\/(\d+)/))||f[1]>=74)&&(f=Z.match(/Chrome\/(\d+)/))&&(m=+f[1]);var te=m,ie=te,re=n,ne=i.String,ae=!!Object.getOwnPropertySymbols&&!re(function(){var e=Symbol("symbol detection");return!ne(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ie&&ie<41}),oe=ae&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,se=W,ce=B,le=G,de=Object,ue=oe?function(e){return"symbol"==typeof e}:function(e){var t=se("Symbol");return ce(t)&&le(t.prototype,de(e))},he=String,pe=function(e){try{return he(e)}catch(t){return"Object"}},fe=B,me=pe,ge=TypeError,_e=function(e){if(fe(e))return e;throw new ge(me(e)+" is not a function")},ve=_e,ye=O,Ee=function(e,t){var i=e[t];return ye(i)?void 0:ve(i)},be=l,we=B,Ie=H,Te=TypeError,Se={exports:{}},Ae=i,Re=Object.defineProperty,ke=function(e,t){try{Re(Ae,e,{value:t,configurable:!0,writable:!0})}catch(i){Ae[e]=t}return t},Ce=i,De=ke,Oe="__core-js_shared__",Le=Se.exports=Ce[Oe]||De(Oe,{});(Le.versions||(Le.versions=[])).push({version:"3.49.0",mode:"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Ne=Se.exports,Pe=Ne,xe=function(e,t){return Pe[e]||(Pe[e]=t||{})},Me=P,Ue=Object,Fe=function(e){return Ue(Me(e))},Be=Fe,Ve=b({}.hasOwnProperty),He=Object.hasOwn||function(e,t){return Ve(Be(e),t)},je=b,ze=0,We=Math.random(),Ge=je(1.1.toString),qe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ge(++ze+We,36)},Ke=xe,Ye=He,Xe=qe,Ze=ae,Je=oe,Qe=i.Symbol,$e=Ke("wks"),et=Je?Qe.for||Qe:Qe&&Qe.withoutSetter||Xe,tt=function(e){return Ye($e,e)||($e[e]=Ze&&Ye(Qe,e)?Qe[e]:et("Symbol."+e)),$e[e]},it=l,rt=H,nt=ue,at=Ee,ot=function(e,t){var i,r;if("string"===t&&we(i=e.toString)&&!Ie(r=be(i,e)))return r;if(we(i=e.valueOf)&&!Ie(r=be(i,e)))return r;if("string"!==t&&we(i=e.toString)&&!Ie(r=be(i,e)))return r;throw new Te("Can't convert object to primitive value")},st=TypeError,ct=tt("toPrimitive"),lt=function(e,t){if(!rt(e)||nt(e))return e;var i,r=at(e,ct);if(r){if(void 0===t&&(t="default"),i=it(r,e,t),!rt(i)||nt(i))return i;throw new st("Can't convert object to primitive value")}return void 0===t&&(t="number"),ot(e,t)},dt=lt,ut=ue,ht=function(e){var t=dt(e,"string");return ut(t)?t:t+""},pt=H,ft=i.document,mt=pt(ft)&&pt(ft.createElement),gt=function(e){return mt?ft.createElement(e):{}},_t=gt,vt=!a&&!n(function(){return 7!==Object.defineProperty(_t("div"),"a",{get:function(){return 7}}).a}),yt=a,Et=l,bt=d,wt=g,It=U,Tt=ht,St=He,At=vt,Rt=Object.getOwnPropertyDescriptor;r.f=yt?Rt:function(e,t){if(e=It(e),t=Tt(t),At)try{return Rt(e,t)}catch(i){}if(St(e,t))return wt(!Et(bt.f,e,t),e[t])};var kt={},Ct=a&&n(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype}),Dt=H,Ot=String,Lt=TypeError,Nt=function(e){if(Dt(e))return e;throw new Lt(Ot(e)+" is not an object")},Pt=a,xt=vt,Mt=Ct,Ut=Nt,Ft=ht,Bt=TypeError,Vt=Object.defineProperty,Ht=Object.getOwnPropertyDescriptor,jt="enumerable",zt="configurable",Wt="writable";kt.f=Pt?Mt?function(e,t,i){if(Ut(e),t=Ft(t),Ut(i),"function"==typeof e&&"prototype"===t&&"value"in i&&Wt in i&&!i[Wt]){var r=Ht(e,t);r&&r[Wt]&&(e[t]=i.value,i={configurable:zt in i?i[zt]:r[zt],enumerable:jt in i?i[jt]:r[jt],writable:!1})}return Vt(e,t,i)}:Vt:function(e,t,i){if(Ut(e),t=Ft(t),Ut(i),xt)try{return Vt(e,t,i)}catch(r){}if("get"in i||"set"in i)throw new Bt("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var Gt=kt,qt=g,Kt=a?function(e,t,i){return Gt.f(e,t,qt(1,i))}:function(e,t,i){return e[t]=i,e},Yt={exports:{}},Xt=a,Zt=He,Jt=Function.prototype,Qt=Xt&&Object.getOwnPropertyDescriptor,$t=Zt(Jt,"name"),ei={EXISTS:$t,PROPER:$t&&"something"===function(){}.name,CONFIGURABLE:$t&&(!Xt||Xt&&Qt(Jt,"name").configurable)},ti=B,ii=Ne,ri=b(Function.toString);ti(ii.inspectSource)||(ii.inspectSource=function(e){return ri(e)});var ni,ai,oi,si=ii.inspectSource,ci=B,li=i.WeakMap,di=ci(li)&&/native code/.test(String(li)),ui=qe,hi=xe("keys"),pi=function(e){return hi[e]||(hi[e]=ui(e))},fi={},mi=di,gi=i,_i=H,vi=Kt,yi=He,Ei=Ne,bi=pi,wi=fi,Ii="Object already initialized",Ti=gi.TypeError,Si=gi.WeakMap;if(mi||Ei.state){var Ai=Ei.state||(Ei.state=new Si);Ai.get=Ai.get,Ai.has=Ai.has,Ai.set=Ai.set,ni=function(e,t){if(Ai.has(e))throw new Ti(Ii);return t.facade=e,Ai.set(e,t),t},ai=function(e){return Ai.get(e)||{}},oi=function(e){return Ai.has(e)}}else{var Ri=bi("state");wi[Ri]=!0,ni=function(e,t){if(yi(e,Ri))throw new Ti(Ii);return t.facade=e,vi(e,Ri,t),t},ai=function(e){return yi(e,Ri)?e[Ri]:{}},oi=function(e){return yi(e,Ri)}}var ki={set:ni,get:ai,has:oi,enforce:function(e){return oi(e)?ai(e):ni(e,{})},getterFor:function(e){return function(t){var i;if(!_i(t)||(i=ai(t)).type!==e)throw new Ti("Incompatible receiver, "+e+" required");return i}}},Ci=b,Di=n,Oi=B,Li=He,Ni=a,Pi=ei.CONFIGURABLE,xi=si,Mi=ki.enforce,Ui=ki.get,Fi=String,Bi=Object.defineProperty,Vi=Ci("".slice),Hi=Ci("".replace),ji=Ci([].join),zi=Ni&&!Di(function(){return 8!==Bi(function(){},"length",{value:8}).length}),Wi=String(String).split("String"),Gi=Yt.exports=function(e,t,i){"Symbol("===Vi(Fi(t),0,7)&&(t="["+Hi(Fi(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(t="get "+t),i&&i.setter&&(t="set "+t),(!Li(e,"name")||Pi&&e.name!==t)&&(Ni?Bi(e,"name",{value:t,configurable:!0}):e.name=t),zi&&i&&Li(i,"arity")&&e.length!==i.arity&&Bi(e,"length",{value:i.arity});try{i&&Li(i,"constructor")&&i.constructor?Ni&&Bi(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(n){}var r=Mi(e);return Li(r,"source")||(r.source=ji(Wi,"string"==typeof t?t:"")),e};Function.prototype.toString=Gi(function(){return Oi(this)&&Ui(this).source||xi(this)},"toString");var qi=Yt.exports,Ki=B,Yi=kt,Xi=qi,Zi=ke,Ji=function(e,t,i,r){r||(r={});var n=r.enumerable,a=void 0!==r.name?r.name:t;if(Ki(i)&&Xi(i,a,r),r.global)n?e[t]=i:Zi(t,i);else{try{r.unsafe?e[t]&&(n=!0):delete e[t]}catch(o){}n?e[t]=i:Yi.f(e,t,{value:i,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return e},Qi={},$i=Math.ceil,er=Math.floor,tr=Math.trunc||function(e){var t=+e;return(t>0?er:$i)(t)},ir=function(e){var t=+e;return t!=t||0===t?0:tr(t)},rr=ir,nr=Math.max,ar=Math.min,or=function(e,t){var i=rr(e);return i<0?nr(i+t,0):ar(i,t)},sr=ir,cr=Math.min,lr=function(e){var t=sr(e);return t>0?cr(t,9007199254740991):0},dr=lr,ur=function(e){return dr(e.length)},hr=U,pr=or,fr=ur,mr=function(e){return function(t,i,r){var n=hr(t),a=fr(n);if(0===a)return!e&&-1;var o,s=pr(r,a);if(e&&i!=i){for(;a>s;)if((o=n[s++])!=o)return!0}else for(;a>s;s++)if((e||s in n)&&n[s]===i)return e||s||0;return!e&&-1}},gr={includes:mr(!0),indexOf:mr(!1)},_r=He,vr=U,yr=gr.indexOf,Er=fi,br=b([].push),wr=function(e,t){var i,r=vr(e),n=0,a=[];for(i in r)!_r(Er,i)&&_r(r,i)&&br(a,i);for(;t.length>n;)_r(r,i=t[n++])&&(~yr(a,i)||br(a,i));return a},Ir=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Tr=wr,Sr=Ir.concat("length","prototype");Qi.f=Object.getOwnPropertyNames||function(e){return Tr(e,Sr)};var Ar={};Ar.f=Object.getOwnPropertySymbols;var Rr=W,kr=Qi,Cr=Ar,Dr=Nt,Or=b([].concat),Lr=Rr("Reflect","ownKeys")||function(e){var t=kr.f(Dr(e)),i=Cr.f;return i?Or(t,i(e)):t},Nr=He,Pr=Lr,xr=r,Mr=kt,Ur=function(e,t,i){for(var r=Pr(t),n=Mr.f,a=xr.f,o=0;o<r.length;o++){var s=r[o];Nr(e,s)||i&&Nr(i,s)||n(e,s,a(t,s))}},Fr=n,Br=B,Vr=/#|\.prototype\./,Hr=function(e,t){var i=zr[jr(e)];return i===Gr||i!==Wr&&(Br(t)?Fr(t):!!t)},jr=Hr.normalize=function(e){return String(e).replace(Vr,".").toLowerCase()},zr=Hr.data={},Wr=Hr.NATIVE="N",Gr=Hr.POLYFILL="P",qr=Hr,Kr=i,Yr=r.f,Xr=Kt,Zr=Ji,Jr=ke,Qr=Ur,$r=qr,en=function(e,t){var i,r,n,a,o,s=e.target,c=e.global,l=e.stat;if(i=c?Kr:l?Kr[s]||Jr(s,{}):Kr[s]&&Kr[s].prototype)for(r in t){if(a=t[r],n=e.dontCallGetSet?(o=Yr(i,r))&&o.value:i[r],!$r(c?r:s+(l?".":"#")+r,e.forced)&&void 0!==n){if(typeof a==typeof n)continue;Qr(a,n)}(e.sham||n&&n.sham)&&Xr(a,"sham",!0),Zr(i,r,a,e)}},tn={};tn[tt("toStringTag")]="z";var rn="[object z]"===String(tn),nn=B,an=S,on=tt("toStringTag"),sn=Object,cn="Arguments"===an(function(){return arguments}()),ln=rn?an: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(i){}}(t=sn(e),on))?i:cn?an(t):"Object"===(r=an(t))&&nn(t.callee)?"Arguments":r},dn=ln,un=String,hn=function(e){if("Symbol"===dn(e))throw new TypeError("Cannot convert a Symbol value to a string");return un(e)},pn=qi,fn=kt,mn=function(e,t,i){return i.get&&pn(i.get,t,{getter:!0}),i.set&&pn(i.set,t,{setter:!0}),fn.f(e,t,i)},gn=en,_n=a,vn=l,yn=b,En=He,bn=B,wn=G,In=hn,Tn=mn,Sn=Ur,An=i.Symbol,Rn=An&&An.prototype;if(_n&&bn(An)&&(!("description"in Rn)||void 0!==An().description)){var kn={},Cn=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:In(arguments[0]),t=wn(Rn,this)?new An(e):void 0===e?An():An(e);return""===e&&(kn[t]=!0),t};Sn(Cn,An);var Dn=Cn.for;Cn.for={for:function(e){var t=In(e),i=vn(Dn,this,t);return""===t&&(kn[i]=!0),i}}.for,Cn.prototype=Rn,Rn.constructor=Cn;var On="Symbol(description detection)"===String(An("description detection")),Ln=yn(Rn.valueOf),Nn=yn(Rn.toString),Pn=/^Symbol\((.*)\)[^)]+$/,xn=yn("".replace),Mn=yn("".slice);Tn(Rn,"description",{configurable:!0,get:function(){var e=Ln(this);if(En(kn,e))return"";var t=Nn(e),i=On?Mn(t,7,-1):xn(t,Pn,"$1");return""===i?void 0:i}}),gn({global:!0,constructor:!0,forced:!0},{Symbol:Cn})}var Un={},Fn=wr,Bn=Ir,Vn=Object.keys||function(e){return Fn(e,Bn)},Hn=a,jn=Ct,zn=kt,Wn=Nt,Gn=U,qn=Vn;Un.f=Hn&&!jn?Object.defineProperties:function(e,t){Wn(e);for(var i,r=Gn(t),n=qn(t),a=n.length,o=0;a>o;)zn.f(e,i=n[o++],r[i]);return e};var Kn,Yn=W("document","documentElement"),Xn=Nt,Zn=Un,Jn=Ir,Qn=fi,$n=Yn,ea=gt,ta="prototype",ia="script",ra=pi("IE_PROTO"),na=function(){},aa=function(e){return"<"+ia+">"+e+"</"+ia+">"},oa=function(e){e.write(aa("")),e.close();var t=e.parentWindow.Object;return e=null,t},sa=function(){try{Kn=new ActiveXObject("htmlfile")}catch(n){}var e,t,i;sa="undefined"!=typeof document?document.domain&&Kn?oa(Kn):(t=ea("iframe"),i="java"+ia+":",t.style.display="none",$n.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(aa("document.F=Object")),e.close(),e.F):oa(Kn);for(var r=Jn.length;r--;)delete sa[ta][Jn[r]];return sa()};Qn[ra]=!0;var ca=Object.create||function(e,t){var i;return null!==e?(na[ta]=Xn(e),i=new na,na[ta]=null,i[ra]=e):i=sa(),void 0===t?i:Zn.f(i,t)},la=tt,da=ca,ua=kt.f,ha=la("unscopables"),pa=Array.prototype;void 0===pa[ha]&&ua(pa,ha,{configurable:!0,value:da(null)});var fa=function(e){pa[ha][e]=!0},ma=en,ga=gr.includes,_a=n,va=fa,ya=_a(function(){return!Array(1).includes()}),Ea=_a(function(){return[,1].includes(void 0,1)});ma({target:"Array",proto:!0,forced:ya||Ea},{includes:function(e){return ga(this,e,arguments.length>1?arguments[1]:void 0)}}),va("includes");var ba,wa,Ia,Ta={},Sa=!n(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Aa=He,Ra=B,ka=Fe,Ca=Sa,Da=pi("IE_PROTO"),Oa=Object,La=Oa.prototype,Na=Ca?Oa.getPrototypeOf:function(e){var t=ka(e);if(Aa(t,Da))return t[Da];var i=t.constructor;return Ra(i)&&t instanceof i?i.prototype:t instanceof Oa?La:null},Pa=n,xa=B,Ma=H,Ua=Na,Fa=Ji,Ba=tt("iterator"),Va=!1;[].keys&&("next"in(Ia=[].keys())?(wa=Ua(Ua(Ia)))!==Object.prototype&&(ba=wa):Va=!0);var Ha=!Ma(ba)||Pa(function(){var e={};return ba[Ba].call(e)!==e});Ha&&(ba={}),xa(ba[Ba])||Fa(ba,Ba,function(){return this});var ja={IteratorPrototype:ba,BUGGY_SAFARI_ITERATORS:Va},za=kt.f,Wa=He,Ga=tt("toStringTag"),qa=function(e,t,i){e&&!i&&(e=e.prototype),e&&!Wa(e,Ga)&&za(e,Ga,{configurable:!0,value:t})},Ka=ja.IteratorPrototype,Ya=ca,Xa=g,Za=qa,Ja=Ta,Qa=function(){return this},$a=function(e,t,i,r){var n=t+" Iterator";return e.prototype=Ya(Ka,{next:Xa(+!r,i)}),Za(e,n,!1),Ja[n]=Qa,e},eo=b,to=_e,io=H,ro=function(e){return io(e)||null===e},no=String,ao=TypeError,oo=function(e,t,i){try{return eo(to(Object.getOwnPropertyDescriptor(e,t)[i]))}catch(r){}},so=H,co=P,lo=function(e){if(ro(e))return e;throw new ao("Can't set "+no(e)+" as a prototype")},uo=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=oo(Object.prototype,"__proto__","set"))(i,[]),t=i instanceof Array}catch(r){}return function(i,r){return co(i),lo(r),so(i)?(t?e(i,r):i.__proto__=r,i):i}}():void 0),ho=en,po=l,fo=B,mo=$a,go=Na,_o=uo,vo=qa,yo=Kt,Eo=Ji,bo=Ta,wo=ei.PROPER,Io=ei.CONFIGURABLE,To=ja.IteratorPrototype,So=ja.BUGGY_SAFARI_ITERATORS,Ao=tt("iterator"),Ro="keys",ko="values",Co="entries",Do=function(){return this},Oo=function(e,t,i,r,n,a,o){mo(i,t,r);var s,c,l,d=function(e){if(e===n&&m)return m;if(!So&&e&&e in p)return p[e];switch(e){case Ro:case ko:case Co:return function(){return new i(this,e)}}return function(){return new i(this)}},u=t+" Iterator",h=!1,p=e.prototype,f=p[Ao]||p["@@iterator"]||n&&p[n],m=!So&&f||d(n),g="Array"===t&&p.entries||f;if(g&&(s=go(g.call(new e)))!==Object.prototype&&s.next&&(go(s)!==To&&(_o?_o(s,To):fo(s[Ao])||Eo(s,Ao,Do)),vo(s,u,!0)),wo&&n===ko&&f&&f.name!==ko&&(Io?yo(p,"name",ko):(h=!0,m=function(){return po(f,this)})),n)if(c={values:d(ko),keys:a?m:d(Ro),entries:d(Co)},o)for(l in c)(So||h||!(l in p))&&Eo(p,l,c[l]);else ho({target:t,proto:!0,forced:So||h},c);return p[Ao]!==m&&Eo(p,Ao,m,{name:n}),bo[t]=m,c},Lo=function(e,t){return{value:e,done:t}},No=U,Po=fa,xo=Ta,Mo=ki,Uo=kt.f,Fo=Oo,Bo=Lo,Vo=a,Ho="Array Iterator",jo=Mo.set,zo=Mo.getterFor(Ho),Wo=Fo(Array,"Array",function(e,t){jo(this,{type:Ho,target:No(e),index:0,kind:t})},function(){var e=zo(this),t=e.target,i=e.index++;if(!t||i>=t.length)return e.target=null,Bo(void 0,!0);switch(e.kind){case"keys":return Bo(i,!1);case"values":return Bo(t[i],!1)}return Bo([i,t[i]],!1)},"values"),Go=xo.Arguments=xo.Array;if(Po("keys"),Po("values"),Po("entries"),Vo&&"values"!==Go.name)try{Uo(Go,"name",{value:"values"})}catch(kU){}var qo=_e,Ko=Fe,Yo=D,Xo=ur,Zo=TypeError,Jo="Reduce of empty array with no initial value",Qo=function(e){return function(t,i,r,n){var a=Ko(t),o=Yo(a),s=Xo(a);if(qo(i),0===s&&r<2)throw new Zo(Jo);var c=e?s-1:0,l=e?-1:1;if(r<2)for(;;){if(c in o){n=o[c],c+=l;break}if(c+=l,e?c<0:s<=c)throw new Zo(Jo)}for(;e?c>=0:s>c;c+=l)c in o&&(n=i(n,o[c],c,a));return n}},$o={left:Qo(!1),right:Qo(!0)},es=n,ts=function(e,t){var i=[][e];return!!i&&es(function(){i.call(null,t||function(){return 1},1)})},is=i,rs=Y,ns=S,as=function(e){return rs.slice(0,e.length)===e},os=as("Bun/")?"BUN":as("Cloudflare-Workers")?"CLOUDFLARE":as("Deno/")?"DENO":as("Node.js/")?"NODE":is.Bun&&"string"==typeof Bun.version?"BUN":is.Deno&&"object"==typeof Deno.version?"DENO":"process"===ns(is.process)?"NODE":is.window&&is.document?"BROWSER":"REST",ss="NODE"===os,cs=$o.left;en({target:"Array",proto:!0,forced:!ss&&te>79&&te<83||!ts("reduce")},{reduce:function(e){var t=arguments.length;return cs(this,e,t,t>1?arguments[1]:void 0)}});var ls=S,ds=Array.isArray||function(e){return"Array"===ls(e)},us=en,hs=ds,ps=b([].reverse),fs=[1,2];us({target:"Array",proto:!0,forced:String(fs)===String(fs.reverse())},{reverse:function(){return hs(this)&&(this.length=this.length),ps(this)}});var ms="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,gs=Ji,_s=function(e,t,i){for(var r in t)gs(e,r,t[r],i);return e},vs=G,ys=TypeError,Es=function(e,t){if(vs(t,e))return e;throw new ys("Incorrect invocation")},bs=ir,ws=lr,Is=RangeError,Ts=function(e){if(void 0===e)return 0;var t=bs(e),i=ws(t);if(t!==i)throw new Is("Wrong length or index");return i},Ss=Math.sign||function(e){var t=+e;return 0===t||t!=t?t:t<0?-1:1},As=4503599627370496,Rs=Ss,ks=function(e){return e+As-As},Cs=Math.abs,Ds=function(e,t,i,r){var n=+e,a=Cs(n),o=Rs(n);if(a<r)return o*ks(a/r/t)*r*t;var s=(1+t/2220446049250313e-31)*a,c=s-(s-a);return c>i||c!=c?Infinity*o:o*c},Os=Math.fround||function(e){return Ds(e,1.1920928955078125e-7,34028234663852886e22,11754943508222875e-54)},Ls=Array,Ns=Math.abs,Ps=Math.pow,xs=Math.floor,Ms=Math.log,Us=Math.LN2,Fs={pack:function(e,t,i){var r,n,a,o=Ls(i),s=8*i-t-1,c=(1<<s)-1,l=c>>1,d=23===t?Ps(2,-24)-Ps(2,-77):0,u=e<0||0===e&&1/e<0?1:0,h=0;for((e=Ns(e))!=e||Infinity===e?(n=e!=e?1:0,r=c):(r=xs(Ms(e)/Us),e*(a=Ps(2,-r))<1&&(r--,a*=2),(e+=r+l>=1?d/a:d*Ps(2,1-l))*a>=2&&(r++,a/=2),r+l>=c?(n=0,r=c):r+l>=1?(n=(e*a-1)*Ps(2,t),r+=l):(n=e*Ps(2,l-1)*Ps(2,t),r=0));t>=8;)o[h++]=255&n,n/=256,t-=8;for(r=r<<t|n,s+=t;s>0;)o[h++]=255&r,r/=256,s-=8;return o[h-1]|=128*u,o},unpack:function(e,t){var i,r=e.length,n=8*r-t-1,a=(1<<n)-1,o=a>>1,s=n-7,c=r-1,l=e[c--],d=127&l;for(l>>=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-o;else{if(d===a)return i?NaN:l?-Infinity:Infinity;i+=Ps(2,t),d-=o}return(l?-1:1)*i*Ps(2,d-t)}},Bs=Fe,Vs=or,Hs=ur,js=function(e){for(var t=Bs(this),i=Hs(t),r=arguments.length,n=Vs(r>1?arguments[1]:void 0,i),a=r>2?arguments[2]:void 0,o=void 0===a?i:Vs(a,i);o>n;)t[n++]=e;return t},zs=b([].slice),Ws=B,Gs=H,qs=uo,Ks=function(e,t,i){var r,n;return qs&&Ws(r=t.constructor)&&r!==i&&Gs(n=r.prototype)&&n!==i.prototype&&qs(e,n),e},Ys=i,Xs=b,Zs=a,Js=ms,Qs=Kt,$s=mn,ec=_s,tc=n,ic=Es,rc=ir,nc=Ts,ac=Os,oc=Fs,sc=Na,cc=uo,lc=js,dc=zs,uc=Ks,hc=Ur,pc=qa,fc=ki,mc=ei.PROPER,gc=ei.CONFIGURABLE,_c="ArrayBuffer",vc="DataView",yc="prototype",Ec="Wrong index",bc=fc.getterFor(_c),wc=fc.getterFor(vc),Ic=fc.set,Tc=Ys[_c],Sc=Tc,Ac=Sc&&Sc[yc],Rc=Ys[vc],kc=Rc&&Rc[yc],Cc=Object.prototype,Dc=Ys.Array,Oc=Ys.RangeError,Lc=Xs(lc),Nc=Xs([].reverse),Pc=oc.pack,xc=oc.unpack,Mc=function(e){return[255&e]},Uc=function(e){return[255&e,e>>8&255]},Fc=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},Bc=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Vc=function(e){return Pc(ac(e),23,4)},Hc=function(e){return Pc(e,52,8)},jc=function(e,t,i){$s(e[yc],t,{configurable:!0,get:function(){return i(this)[t]}})},zc=function(e,t,i,r){var n=wc(e),a=nc(i),o=!!r;if(a+t>n.byteLength)throw new Oc(Ec);var s=n.bytes,c=a+n.byteOffset,l=dc(s,c,c+t);return o?l:Nc(l)},Wc=function(e,t,i,r,n,a){var o=wc(e),s=nc(i),c=r(+n),l=!!a;if(s+t>o.byteLength)throw new Oc(Ec);for(var d=o.bytes,u=s+o.byteOffset,h=0;h<t;h++)d[u+h]=c[l?h:t-h-1]};if(Js){var Gc=mc&&Tc.name!==_c;tc(function(){Tc(1)})&&tc(function(){new Tc(-1)})&&!tc(function(){return new Tc,new Tc(1.5),new Tc(NaN),1!==Tc.length||Gc&&!gc})?Gc&&gc&&Qs(Tc,"name",_c):((Sc=function(e){return ic(this,Ac),uc(new Tc(nc(e)),this,Sc)})[yc]=Ac,Ac.constructor=Sc,hc(Sc,Tc)),cc&&sc(kc)!==Cc&&cc(kc,Cc);var qc=new Rc(new Sc(2)),Kc=Xs(kc.setInt8);qc.setInt8(0,2147483648),qc.setInt8(1,2147483649),!qc.getInt8(0)&&qc.getInt8(1)||ec(kc,{setInt8:function(e,t){Kc(this,e,t<<24>>24)},setUint8:function(e,t){Kc(this,e,t<<24>>24)}},{unsafe:!0})}else Ac=(Sc=function(e){ic(this,Ac);var t=nc(e);Ic(this,{type:_c,bytes:Lc(Dc(t),0),byteLength:t}),Zs||(this.byteLength=t,this.detached=!1)})[yc],kc=(Rc=function(e,t,i){ic(this,kc),ic(e,Ac);var r=bc(e),n=r.byteLength,a=rc(t);if(a<0||a>n)throw new Oc("Wrong offset");if(a+(i=void 0===i?n-a:nc(i))>n)throw new Oc("Wrong length");Ic(this,{type:vc,buffer:e,byteLength:i,byteOffset:a,bytes:r.bytes}),Zs||(this.buffer=e,this.byteLength=i,this.byteOffset=a)})[yc],Zs&&(jc(Sc,"byteLength",bc),jc(Rc,"buffer",wc),jc(Rc,"byteLength",wc),jc(Rc,"byteOffset",wc)),ec(kc,{getInt8:function(e){return zc(this,1,e)[0]<<24>>24},getUint8:function(e){return zc(this,1,e)[0]},getInt16:function(e){var t=zc(this,2,e,arguments.length>1&&arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=zc(this,2,e,arguments.length>1&&arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return Bc(zc(this,4,e,arguments.length>1&&arguments[1]))},getUint32:function(e){return Bc(zc(this,4,e,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(e){return xc(zc(this,4,e,arguments.length>1&&arguments[1]),23)},getFloat64:function(e){return xc(zc(this,8,e,arguments.length>1&&arguments[1]),52)},setInt8:function(e,t){Wc(this,1,e,Mc,t)},setUint8:function(e,t){Wc(this,1,e,Mc,t)},setInt16:function(e,t){Wc(this,2,e,Uc,t,arguments.length>2&&arguments[2])},setUint16:function(e,t){Wc(this,2,e,Uc,t,arguments.length>2&&arguments[2])},setInt32:function(e,t){Wc(this,4,e,Fc,t,arguments.length>2&&arguments[2])},setUint32:function(e,t){Wc(this,4,e,Fc,t,arguments.length>2&&arguments[2])},setFloat32:function(e,t){Wc(this,4,e,Vc,t,arguments.length>2&&arguments[2])},setFloat64:function(e,t){Wc(this,8,e,Hc,t,arguments.length>2&&arguments[2])}});pc(Sc,_c),pc(Rc,vc);var Yc={ArrayBuffer:Sc,DataView:Rc},Xc=W,Zc=mn,Jc=a,Qc=tt("species"),$c=function(e){var t=Xc(e);Jc&&t&&!t[Qc]&&Zc(t,Qc,{configurable:!0,get:function(){return this}})},el=$c,tl="ArrayBuffer",il=Yc[tl];en({global:!0,constructor:!0,forced:i[tl]!==il},{ArrayBuffer:il}),el(tl);var rl=S,nl=b,al=function(e){if("Function"===rl(e))return nl(e)},ol=en,sl=al,cl=n,ll=Nt,dl=or,ul=lr,hl=Yc.ArrayBuffer,pl=Yc.DataView,fl=pl.prototype,ml=sl(hl.prototype.slice),gl=sl(fl.getUint8),_l=sl(fl.setUint8);ol({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:cl(function(){return!new hl(2).slice(1,void 0).byteLength})},{slice:function(e,t){if(ml&&void 0===t)return ml(ll(this),e);for(var i=ll(this).byteLength,r=dl(e,i),n=dl(void 0===t?i:t,i),a=new hl(ul(n-r)),o=new pl(this),s=new pl(a),c=0;r<n;)_l(s,c++,gl(o,r++));return a}});var vl=i,yl=b,El=n,bl=B,wl=ln,Il=si,Tl=function(){},Sl=W("Reflect","construct"),Al=/^\s*(?:class|function)\b/,Rl=yl(Al.exec),kl=!Al.test(Tl),Cl=function(e){if(!bl(e))return!1;try{return Sl(Tl,[],e),!0}catch(kU){return!1}},Dl=function(e){if(!bl(e))return!1;switch(wl(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return kl||!!Rl(Al,Il(e))}catch(kU){return!0}};Dl.sham=!0;var Ol,Ll,Nl,Pl,xl=!Sl||El(function(){var e;return Cl(Cl.call)||!Cl(Object)||!Cl(function(){e=!0})||e})?Dl:Cl,Ml=xl,Ul=pe,Fl=TypeError,Bl=function(e){if(Ml(e))return e;throw new Fl(Ul(e)+" is not a constructor")},Vl=Nt,Hl=Bl,jl=O,zl=tt("species"),Wl=function(e,t){var i,r=Vl(e).constructor;return void 0===r||jl(i=Vl(r)[zl])?t:Hl(i)},Gl=o,ql=Function.prototype,Kl=ql.apply,Yl=ql.call,Xl="object"==typeof Reflect&&Reflect.apply||(Gl?Yl.bind(Kl):function(){return Yl.apply(Kl,arguments)}),Zl=_e,Jl=o,Ql=al(al.bind),$l=function(e,t){return Zl(e),void 0===t?e:Jl?Ql(e,t):function(){return e.apply(t,arguments)}},ed=TypeError,td=function(e,t){if(e<t)throw new ed("Not enough arguments");return e},id=Y,rd=/ipad|iphone|ipod/i.test(id)&&/applewebkit/i.test(id),nd=i,ad=Xl,od=$l,sd=B,cd=He,ld=n,dd=Yn,ud=zs,hd=gt,pd=td,fd=rd,md=ss,gd=nd.setImmediate,_d=nd.clearImmediate,vd=nd.process,yd=nd.Dispatch,Ed=nd.Function,bd=nd.MessageChannel,wd=nd.String,Id=0,Td={},Sd="onreadystatechange";ld(function(){Ol=nd.location});var Ad=function(e){if(cd(Td,e)){var t=Td[e];delete Td[e],t()}},Rd=function(e){return function(){Ad(e)}},kd=function(e){Ad(e.data)},Cd=function(e){nd.postMessage(wd(e),Ol.protocol+"//"+Ol.host)};gd&&_d||(gd=function(e){pd(arguments.length,1);var t=sd(e)?e:Ed(e),i=ud(arguments,1);return Td[++Id]=function(){ad(t,void 0,i)},Ll(Id),Id},_d=function(e){delete Td[e]},md?Ll=function(e){vd.nextTick(Rd(e))}:yd&&yd.now?Ll=function(e){yd.now(Rd(e))}:bd&&!fd?(Pl=(Nl=new bd).port2,Nl.port1.onmessage=kd,Ll=od(Pl.postMessage,Pl)):nd.addEventListener&&sd(nd.postMessage)&&!nd.importScripts&&Ol&&"file:"!==Ol.protocol&&!ld(Cd)?(Ll=Cd,nd.addEventListener("message",kd,!1)):Ll=Sd in hd("script")?function(e){dd.appendChild(hd("script"))[Sd]=function(){dd.removeChild(this),Ad(e)}}:function(e){setTimeout(Rd(e),0)});var Dd={set:gd,clear:_d},Od=i,Ld=a,Nd=Object.getOwnPropertyDescriptor,Pd=function(e){if(!Ld)return Od[e];var t=Nd(Od,e);return t&&t.value},xd=function(){this.head=null,this.tail=null};xd.prototype={add:function(e){var t={item:e,next:null},i=this.tail;i?i.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var Md,Ud,Fd,Bd,Vd,Hd=xd,jd=/ipad|iphone|ipod/i.test(Y)&&"undefined"!=typeof Pebble,zd=/web0s(?!.*chrome)/i.test(Y),Wd=i,Gd=Pd,qd=$l,Kd=Dd.set,Yd=Hd,Xd=rd,Zd=jd,Jd=zd,Qd=ss,$d=Wd.MutationObserver||Wd.WebKitMutationObserver,eu=Wd.document,tu=Wd.process,iu=Wd.Promise,ru=Gd("queueMicrotask");if(!ru){var nu=new Yd,au=function(){var e,t;for(Qd&&(e=tu.domain)&&e.exit();t=nu.get();)try{t()}catch(kU){throw nu.head&&Md(),kU}e&&e.enter()};Xd||Qd||Jd||!$d||!eu?!Zd&&iu&&iu.resolve?((Bd=iu.resolve(void 0)).constructor=iu,Vd=qd(Bd.then,Bd),Md=function(){Vd(au)}):Qd?Md=function(){tu.nextTick(au)}:(Kd=qd(Kd,Wd),Md=function(){Kd(au)}):(Ud=!0,Fd=eu.createTextNode(""),new $d(au).observe(Fd,{characterData:!0}),Md=function(){Fd.data=Ud=!Ud}),ru=function(e){nu.head||Md(),nu.add(e)}}var ou=ru,su=function(e){try{return{error:!1,value:e()}}catch(kU){return{error:!0,value:kU}}},cu=i.Promise,lu=i,du=cu,uu=B,hu=qr,pu=si,fu=tt,mu=os,gu=te;du&&du.prototype;var _u=fu("species"),vu=!1,yu=uu(lu.PromiseRejectionEvent),Eu=hu("Promise",function(){var e=pu(du),t=e!==String(du);if(!t&&66===gu)return!0;if(!gu||gu<51||!/native code/.test(e)){var i=new du(function(e){e(1)}),r=function(e){e(function(){},function(){})};if((i.constructor={})[_u]=r,!(vu=i.then(function(){})instanceof r))return!0}return!(t||"BROWSER"!==mu&&"DENO"!==mu||yu)}),bu={CONSTRUCTOR:Eu,REJECTION_EVENT:yu,SUBCLASSING:vu},wu={},Iu=_e,Tu=TypeError,Su=function(e){var t,i;this.promise=new e(function(e,r){if(void 0!==t||void 0!==i)throw new Tu("Bad Promise constructor");t=e,i=r}),this.resolve=Iu(t),this.reject=Iu(i)};wu.f=function(e){return new Su(e)};var Au,Ru,ku,Cu,Du=en,Ou=ss,Lu=i,Nu=vl,Pu=l,xu=Ji,Mu=uo,Uu=qa,Fu=$c,Bu=_e,Vu=B,Hu=H,ju=Es,zu=Wl,Wu=Dd.set,Gu=ou,qu=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(kU){}},Ku=su,Yu=Hd,Xu=ki,Zu=cu,Ju=wu,Qu="Promise",$u=bu.CONSTRUCTOR,eh=bu.REJECTION_EVENT,th=bu.SUBCLASSING,ih=Xu.getterFor(Qu),rh=Xu.set,nh=Zu&&Zu.prototype,ah=Zu,oh=nh,sh=Lu.TypeError,ch=Lu.document,lh=Lu.process,dh=Ju.f,uh=dh,hh=!!(ch&&ch.createEvent&&Lu.dispatchEvent),ph="unhandledrejection",fh=function(e){var t;return!(!Hu(e)||!Vu(t=e.then))&&t},mh=function(e,t){var i,r,n,a=t.value,o=1===t.state,s=o?e.ok:e.fail,c=e.resolve,l=e.reject,d=e.domain;try{s?(o||(2===t.rejection&&Eh(t),t.rejection=1),!0===s?i=a:(d&&d.enter(),i=s(a),d&&(d.exit(),n=!0)),i===e.promise?l(new sh("Promise-chain cycle")):(r=fh(i))?Pu(r,i,c,l):c(i)):l(a)}catch(kU){d&&!n&&d.exit(),l(kU)}},gh=function(e,t){e.notified||(e.notified=!0,Gu(function(){for(var i,r=e.reactions;i=r.get();)mh(i,e);e.notified=!1,t&&!e.rejection&&vh(e)}))},_h=function(e,t,i){var r,n;hh?((r=ch.createEvent("Event")).promise=t,r.reason=i,r.initEvent(e,!1,!0),Lu.dispatchEvent(r)):r={promise:t,reason:i},!eh&&(n=Lu["on"+e])?n(r):e===ph&&qu("Unhandled promise rejection",i)},vh=function(e){Pu(Wu,Lu,function(){var t,i=e.facade,r=e.value;if(yh(e)&&(t=Ku(function(){Ou?lh.emit("unhandledRejection",r,i):_h(ph,i,r)}),e.rejection=Ou||yh(e)?2:1,t.error))throw t.value})},yh=function(e){return 1!==e.rejection&&!e.parent},Eh=function(e){Pu(Wu,Lu,function(){var t=e.facade;Ou?lh.emit("rejectionHandled",t):_h("rejectionhandled",t,e.value)})},bh=function(e,t,i){return function(r){e(t,r,i)}},wh=function(e,t,i){e.done||(e.done=!0,i&&(e=i),e.value=t,e.state=2,gh(e,!0))},Ih=function(e,t,i){if(!e.done){e.done=!0,i&&(e=i);try{if(e.facade===t)throw new sh("Promise can't be resolved itself");var r=fh(t);r?Gu(function(){var i={done:!1};try{Pu(r,t,bh(Ih,i,e),bh(wh,i,e))}catch(kU){wh(i,kU,e)}}):(e.value=t,e.state=1,gh(e,!1))}catch(kU){wh({done:!1},kU,e)}}};if($u&&(oh=(ah=function(e){ju(this,oh),Bu(e),Pu(Au,this);var t=ih(this);try{e(bh(Ih,t),bh(wh,t))}catch(kU){wh(t,kU)}}).prototype,(Au=function(e){rh(this,{type:Qu,done:!1,notified:!1,parent:!1,reactions:new Yu,rejection:!1,state:0,value:null})}).prototype=xu(oh,"then",function(e,t){var i=ih(this),r=dh(zu(this,ah));return i.parent=!0,r.ok=!Vu(e)||e,r.fail=Vu(t)&&t,r.domain=Ou?lh.domain:void 0,0===i.state?i.reactions.add(r):Gu(function(){mh(r,i)}),r.promise}),Ru=function(){var e=new Au,t=ih(e);this.promise=e,this.resolve=bh(Ih,t),this.reject=bh(wh,t)},Ju.f=dh=function(e){return e===ah||e===ku?new Ru(e):uh(e)},Vu(Zu)&&nh!==Object.prototype)){Cu=nh.then,th||xu(nh,"then",function(e,t){var i=this;return new ah(function(e,t){Pu(Cu,i,e,t)}).then(e,t)},{unsafe:!0});try{delete nh.constructor}catch(kU){}Mu&&Mu(nh,oh)}Du({global:!0,constructor:!0,wrap:!0,forced:$u},{Promise:ah}),ku=Nu.Promise,Uu(ah,Qu,!1),Fu(Qu);var Th=Ta,Sh=tt("iterator"),Ah=Array.prototype,Rh=function(e){return void 0!==e&&(Th.Array===e||Ah[Sh]===e)},kh=ln,Ch=Ee,Dh=O,Oh=Ta,Lh=tt("iterator"),Nh=function(e){if(!Dh(e))return Ch(e,Lh)||Ch(e,"@@iterator")||Oh[kh(e)]},Ph=l,xh=_e,Mh=Nt,Uh=pe,Fh=Nh,Bh=TypeError,Vh=function(e,t){var i=arguments.length<2?Fh(e):t;if(xh(i))return Mh(Ph(i,e));throw new Bh(Uh(e)+" is not iterable")},Hh=l,jh=Nt,zh=Ee,Wh=function(e,t,i){var r,n;jh(e);try{if(!(r=zh(e,"return"))){if("throw"===t)throw i;return i}r=Hh(r,e)}catch(kU){n=!0,r=kU}if("throw"===t)throw i;if(n)throw r;return jh(r),i},Gh=$l,qh=l,Kh=Nt,Yh=pe,Xh=Rh,Zh=ur,Jh=G,Qh=Vh,$h=Nh,ep=Wh,tp=TypeError,ip=function(e,t){this.stopped=e,this.result=t},rp=ip.prototype,np=function(e,t,i){var r,n,a,o,s,c,l,d=i&&i.that,u=!(!i||!i.AS_ENTRIES),h=!(!i||!i.IS_RECORD),p=!(!i||!i.IS_ITERATOR),f=!(!i||!i.INTERRUPTED),m=Gh(t,d),g=function(e){var t=r;return r=void 0,t&&ep(t,"normal"),new ip(!0,e)},_=function(e){return u?(Kh(e),f?m(e[0],e[1],g):m(e[0],e[1])):f?m(e,g):m(e)};if(h)r=e.iterator;else if(p)r=e;else{if(!(n=$h(e)))throw new tp(Yh(e)+" is not iterable");if(Xh(n)){for(a=0,o=Zh(e);o>a;a++)if((s=_(e[a]))&&Jh(rp,s))return s;return new ip(!1)}r=Qh(e,n)}for(c=h?e.next:r.next;!(l=qh(c,r)).done;){var v=l.value;try{s=_(v)}catch(kU){if(!r)throw kU;ep(r,"throw",kU)}if("object"==typeof s&&s&&Jh(rp,s))return s}return new ip(!1)},ap=tt("iterator"),op=!1;try{var sp=0,cp={next:function(){return{done:!!sp++}},return:function(){op=!0}};cp[ap]=function(){return this},Array.from(cp,function(){throw 2})}catch(kU){}var lp=function(e,t){try{if(!t&&!op)return!1}catch(kU){return!1}var i=!1;try{var r={};r[ap]=function(){return{next:function(){return{done:i=!0}}}},e(r)}catch(kU){}return i},dp=cu,up=bu.CONSTRUCTOR||!lp(function(e){dp.all(e).then(void 0,function(){})}),hp=l,pp=_e,fp=wu,mp=su,gp=np;en({target:"Promise",stat:!0,forced:up},{all:function(e){var t=this,i=fp.f(t),r=i.resolve,n=i.reject,a=mp(function(){var i=pp(t.resolve),a=[],o=0,s=1;gp(e,function(e){var c=o++,l=!1;s++,hp(i,t,e).then(function(e){l||(l=!0,a[c]=e,--s||r(a))},n)}),--s||r(a)});return a.error&&n(a.value),i.promise}});var _p=en,vp=bu.CONSTRUCTOR,yp=cu,Ep=W,bp=B,wp=Ji,Ip=yp&&yp.prototype;if(_p({target:"Promise",proto:!0,forced:vp,real:!0},{catch:function(e){return this.then(void 0,e)}}),bp(yp)){var Tp=Ep("Promise").prototype.catch;Ip.catch!==Tp&&wp(Ip,"catch",Tp,{unsafe:!0})}var Sp=l,Ap=_e,Rp=wu,kp=su,Cp=np;en({target:"Promise",stat:!0,forced:up},{race:function(e){var t=this,i=Rp.f(t),r=i.reject,n=kp(function(){var n=Ap(t.resolve);Cp(e,function(e){Sp(n,t,e).then(i.resolve,r)})});return n.error&&r(n.value),i.promise}});var Dp=wu;en({target:"Promise",stat:!0,forced:bu.CONSTRUCTOR},{reject:function(e){var t=Dp.f(this);return(0,t.reject)(e),t.promise}});var Op=Nt,Lp=H,Np=wu,Pp=function(e,t){if(Op(e),Lp(t)&&t.constructor===e)return t;var i=Np.f(e);return(0,i.resolve)(t),i.promise},xp=en,Mp=bu.CONSTRUCTOR,Up=Pp;W("Promise"),xp({target:"Promise",stat:!0,forced:Mp},{resolve:function(e){return Up(this,e)}});var Fp=en,Bp=cu,Vp=n,Hp=W,jp=B,zp=Wl,Wp=Pp,Gp=Ji,qp=Bp&&Bp.prototype;if(Fp({target:"Promise",proto:!0,real:!0,forced:!!Bp&&Vp(function(){qp.finally.call({then:function(){}},function(){})})},{finally:function(e){var t=zp(this,Hp("Promise")),i=jp(e);return this.then(i?function(i){return Wp(t,e()).then(function(){return i})}:e,i?function(i){return Wp(t,e()).then(function(){throw i})}:e)}}),jp(Bp)){var Kp=Hp("Promise").prototype.finally;qp.finally!==Kp&&Gp(qp,"finally",Kp,{unsafe:!0})}var Yp=H,Xp=S,Zp=tt("match"),Jp=function(e){var t;return Yp(e)&&(void 0!==(t=e[Zp])?!!t:"RegExp"===Xp(e))},Qp=n,$p=i.RegExp,ef=!Qp(function(){var e=!0;try{$p(".","d")}catch(kU){e=!1}var t={},i="",r=e?"dgimsy":"gimsy",n=function(e,r){Object.defineProperty(t,e,{get:function(){return i+=r,!0}})},a={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in e&&(a.hasIndices="d"),a)n(o,a[o]);return Object.getOwnPropertyDescriptor($p.prototype,"flags").get.call(t)!==r||i!==r}),tf={correct:ef},rf=Nt,nf=function(){var e=rf(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},af=l,of=He,sf=G,cf=tf,lf=nf,df=RegExp.prototype,uf=cf.correct?function(e){return e.flags}:function(e){return cf.correct||!sf(df,e)||of(e,"flags")?e.flags:af(lf,e)},hf=n,pf=i.RegExp,ff=hf(function(){var e=pf("a","y");return e.lastIndex=2,null!==e.exec("abcd")}),mf=ff||hf(function(){return!pf("a","y").sticky}),gf=ff||hf(function(){var e=pf("^r","gy");return e.lastIndex=2,null!==e.exec("str")}),_f={BROKEN_CARET:gf,MISSED_STICKY:mf,UNSUPPORTED_Y:ff},vf=kt.f,yf=n,Ef=i.RegExp,bf=yf(function(){var e=Ef(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)}),wf=n,If=i.RegExp,Tf=wf(function(){var e=If("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")}),Sf=a,Af=i,Rf=b,kf=qr,Cf=Ks,Df=Kt,Of=ca,Lf=Qi.f,Nf=G,Pf=Jp,xf=hn,Mf=uf,Uf=_f,Ff=function(e,t,i){i in e||vf(e,i,{configurable:!0,get:function(){return t[i]},set:function(e){t[i]=e}})},Bf=Ji,Vf=n,Hf=He,jf=ki.enforce,zf=$c,Wf=bf,Gf=Tf,qf=tt("match"),Kf=Af.RegExp,Yf=Kf.prototype,Xf=Af.SyntaxError,Zf=Rf(Yf.exec),Jf=Rf("".charAt),Qf=Rf("".replace),$f=Rf("".indexOf),em=Rf("".slice),tm=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,im=/a/g,rm=/a/g,nm=new Kf(im)!==im,am=Uf.MISSED_STICKY,om=Uf.UNSUPPORTED_Y,sm=Sf&&(!nm||am||Wf||Gf||Vf(function(){return rm[qf]=!1,Kf(im)!==im||Kf(rm)===rm||"/a/i"!==String(Kf(im,"i"))}));if(kf("RegExp",sm)){for(var cm=function(e,t){var i,r,n,a,o,s,c=Nf(Yf,this),l=Pf(e),d=void 0===t,u=[],h=e;if(!c&&l&&d&&e.constructor===cm)return e;if((l||Nf(Yf,e))&&(e=e.source,d&&(t=Mf(h))),e=void 0===e?"":xf(e),t=void 0===t?"":xf(t),h=e,Wf&&"dotAll"in im&&(r=!!t&&$f(t,"s")>-1)&&(t=Qf(t,/s/g,"")),i=t,am&&"sticky"in im&&(n=!!t&&$f(t,"y")>-1)&&om&&(t=Qf(t,/y/g,"")),Gf&&(a=function(e){for(var t,i=e.length,r=0,n="",a=[],o=Of(null),s=!1,c=!1,l=0,d="";r<i;r++){if("\\"===(t=Jf(e,r))){if(t+=Jf(e,++r),!c&&"\\"===Jf(t,1)){n+="\\x5c";continue}}else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:n+=t,Zf(tm,em(e,r+1))?(r+=2,c=!0,l++):"?"!==Jf(e,r+1)&&l++;continue;case">"===t&&c:if(""===d||Hf(o,d))throw new Xf("Invalid capture group name");o[d]=!0,a[a.length]=[d,l],c=!1,d="";continue}c?d+=t:n+=t}for(var u=0;u<a.length;u++)for(var h="\\k<"+a[u][0]+">",p="\\"+a[u][1];$f(n,h)>-1;)n=Qf(n,h,p);return[n,a]}(e),e=a[0],u=a[1]),o=Cf(Kf(e,t),c?this:Yf,cm),(r||n||u.length)&&(s=jf(o),r&&(s.dotAll=!0,s.raw=cm(function(e){for(var t,i=e.length,r=0,n="",a=!1;r<i;r++)"\\"!==(t=Jf(e,r))?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),n+=t):n+="[\\s\\S]":n+=t+Jf(e,++r);return n}(e),i)),n&&(s.sticky=!0),u.length&&(s.groups=u)),e!==h)try{Df(o,"source",""===h?"(?:)":h)}catch(kU){}return o},lm=Lf(Kf),dm=0;lm.length>dm;)Ff(cm,Kf,lm[dm++]);Yf.constructor=cm,cm.prototype=Yf,Bf(Af,"RegExp",cm,{constructor:!0})}zf("RegExp");var um=l,hm=b,pm=hn,fm=nf,mm=_f,gm=ca,_m=ki.get,vm=bf,ym=Tf,Em=xe("native-string-replace",String.prototype.replace),bm=RegExp.prototype.exec,wm=bm,Im=hm("".charAt),Tm=hm("".indexOf),Sm=hm("".replace),Am=hm("".slice),Rm=function(){var e=/a/,t=/b*/g;return um(bm,e,"a"),um(bm,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),km=mm.BROKEN_CARET,Cm=void 0!==/()??/.exec("")[1],Dm=function(e,t){for(var i=e.groups=gm(null),r=0;r<t.length;r++){var n=t[r];i[n[0]]=e[n[1]]}};(Rm||Cm||km||vm||ym)&&(wm=function(e){var t,i,r,n=this,a=_m(n),o=pm(e),s=a.raw;if(s)return s.lastIndex=n.lastIndex,t=um(wm,s,o),n.lastIndex=s.lastIndex,t&&a.groups&&Dm(t,a.groups),t;var c=a.groups,l=km&&n.sticky,d=um(fm,n),u=n.source,h=0,p=o;if(l){d=Sm(d,"y",""),-1===Tm(d,"g")&&(d+="g"),p=Am(o,n.lastIndex);var f=n.lastIndex>0&&Im(o,n.lastIndex-1);n.lastIndex>0&&(!n.multiline||n.multiline&&"\n"!==f&&"\r"!==f&&"\u2028"!==f&&"\u2029"!==f)&&(u="(?: (?:"+u+"))",p=" "+p,h++),i=new RegExp("^(?:"+u+")",d)}Cm&&(i=new RegExp("^"+u+"$(?!\\s)",d)),Rm&&(r=n.lastIndex);var m=um(bm,l?i:n,p);return l?m?(m.input=o,m[0]=Am(m[0],h),m.index=n.lastIndex,n.lastIndex+=m[0].length):n.lastIndex=0:Rm&&m&&(n.lastIndex=n.global?m.index+m[0].length:r),Cm&&m&&m.length>1&&um(Em,m[0],i,function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(m[e]=void 0)}),m&&c&&Dm(m,c),m});var Om=wm;en({target:"RegExp",proto:!0,forced:/./.exec!==Om},{exec:Om});var Lm=mn,Nm=tf,Pm=nf;a&&!Nm.correct&&(Lm(RegExp.prototype,"flags",{configurable:!0,get:Pm}),Nm.correct=!0);var xm=ir,Mm=hn,Um=P,Fm=RangeError,Bm=Math.floor,Vm=b,Hm=lr,jm=hn,zm=P,Wm=Vm(function(e){var t=Mm(Um(this)),i="",r=xm(e);if(r<0||Infinity===r)throw new Fm("Wrong number of repetitions");for(;r>0;(r=Bm(r/2))&&(t+=t))r%2&&(i+=t);return i}),Gm=Vm("".slice),qm=Math.ceil,Km=function(e){return function(t,i,r){var n=jm(zm(t)),a=Hm(i),o=n.length;if(a<=o)return n;var s,c,l=void 0===r?" ":jm(r);return""===l?n:((c=Wm(l,qm((s=a-o)/l.length))).length>s&&(c=Gm(c,0,s)),e?n+c:c+n)}},Ym={start:Km(!1),end:Km(!0)},Xm=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Y),Zm=Ym.start;en({target:"String",proto:!0,forced:Xm},{padStart:function(e){return Zm(this,e,arguments.length>1?arguments[1]:void 0)}});var Jm=l,Qm=Ji,$m=Om,eg=n,tg=tt,ig=Kt,rg=tg("species"),ng=RegExp.prototype,ag=b,og=ir,sg=hn,cg=P,lg=ag("".charAt),dg=ag("".charCodeAt),ug=ag("".slice),hg=function(e){return function(t,i){var r,n,a=sg(cg(t)),o=og(i),s=a.length;return o<0||o>=s?e?"":void 0:(r=dg(a,o))<55296||r>56319||o+1===s||(n=dg(a,o+1))<56320||n>57343?e?lg(a,o):r:e?ug(a,o,o+2):n-56320+(r-55296<<10)+65536}},pg={codeAt:hg(!1),charAt:hg(!0)},fg=pg.charAt,mg=b,gg=Fe,_g=Math.floor,vg=mg("".charAt),yg=mg("".replace),Eg=mg("".slice),bg=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,wg=/\$([$&'`]|\d{1,2})/g,Ig=function(e,t,i,r,n,a){var o=i+e.length,s=r.length,c=wg;return void 0!==n&&(n=gg(n),c=bg),yg(a,c,function(a,c){var l;switch(vg(c,0)){case"$":return"$";case"&":return e;case"`":return Eg(t,0,i);case"'":return Eg(t,o);case"<":l=n[Eg(c,1,-1)];break;default:var d=+c;if(0===d)return a;if(d>s){var u=_g(d/10);return 0===u?a:u<=s?void 0===r[u-1]?vg(c,1):r[u-1]+vg(c,1):a}l=r[d-1]}return void 0===l?"":l})},Tg=l,Sg=Nt,Ag=B,Rg=S,kg=Om,Cg=TypeError,Dg=Xl,Og=l,Lg=b,Ng=function(e,t,i,r){var n=tg(e),a=!eg(function(){var t={};return t[n]=function(){return 7},7!==""[e](t)}),o=a&&!eg(function(){var t=!1,i=/a/;if("split"===e){var r={};r[rg]=function(){return i},(i={constructor:r,flags:""})[n]=/./[n]}return i.exec=function(){return t=!0,null},i[n](""),!t});if(!a||!o||i){var s=/./[n],c=t(n,""[e],function(e,t,i,r,n){var o=t.exec;return o===$m||o===ng.exec?a&&!n?{done:!0,value:Jm(s,t,i,r)}:{done:!0,value:Jm(e,i,t,r)}:{done:!1}});Qm(String.prototype,e,c[0]),Qm(ng,n,c[1])}r&&ig(ng[n],"sham",!0)},Pg=n,xg=Nt,Mg=B,Ug=H,Fg=ir,Bg=lr,Vg=hn,Hg=P,jg=function(e,t,i){return t+(i&&fg(e,t).length||1)},zg=Ee,Wg=Ig,Gg=uf,qg=function(e,t){var i=e.exec;if(Ag(i)){var r=Tg(i,e,t);return null!==r&&Sg(r),r}if("RegExp"===Rg(e))return Tg(kg,e,t);throw new Cg("RegExp#exec called on incompatible receiver")},Kg=tt("replace"),Yg=Math.max,Xg=Math.min,Zg=Lg([].concat),Jg=Lg([].push),Qg=Lg("".indexOf),$g=Lg("".slice),e_=function(e){return void 0===e?e:String(e)},t_="$0"==="a".replace(/./,"$0"),i_=!!/./[Kg]&&""===/./[Kg]("a","$0"),r_=!Pg(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")});Ng("replace",function(e,t,i){var r=i_?"$":"$0";return[function(e,i){var r=Hg(this),n=Ug(e)?zg(e,Kg):void 0;return n?Og(n,e,r,i):Og(t,Vg(r),e,i)},function(e,n){var a=xg(this),o=Vg(e),s=Mg(n);s||(n=Vg(n));var c=Vg(Gg(a));if("string"==typeof n&&!~Qg(n,r)&&!~Qg(n,"$<")&&!~Qg(c,"y")){var l=i(t,a,o,n);if(l.done)return l.value}var d,u=!!~Qg(c,"g");u&&(d=!!~Qg(c,"u")||!!~Qg(c,"v"),a.lastIndex=0);for(var h,p=[];null!==(h=qg(a,o))&&(Jg(p,h),u);){""===Vg(h[0])&&(a.lastIndex=jg(o,Bg(a.lastIndex),d))}for(var f="",m=0,g=0;g<p.length;g++){for(var _,v=Vg((h=p[g])[0]),y=Yg(Xg(Fg(h.index),o.length),0),E=[],b=1;b<h.length;b++)Jg(E,e_(h[b]));var w=h.groups;if(s){var I=Zg([v],E,y,o);void 0!==w&&Jg(I,w),_=Vg(Dg(n,void 0,I))}else _=Wg(v,o,y,E,w,n);y>=m&&(f+=$g(o,m,y)+_,m=y+v.length)}return f+$g(o,m)}]},!r_||!t_||i_);var n_="\t\n\v\f\r                 \u2028\u2029\ufeff",a_=P,o_=hn,s_=n_,c_=b("".replace),l_=RegExp("^["+s_+"]+"),d_=RegExp("(^|[^"+s_+"])["+s_+"]+$"),u_=function(e){return function(t){var i=o_(a_(t));return 1&e&&(i=c_(i,l_,"")),2&e&&(i=c_(i,d_,"$1")),i}},h_={start:u_(1),end:u_(2),trim:u_(3)},p_=ei.PROPER,f_=n,m_=n_,g_=h_.trim;en({target:"String",proto:!0,forced:function(e){return f_(function(){return!!m_[e]()||"​…᠎"!=="​…᠎"[e]()||p_&&m_[e].name!==e})}("trim")},{trim:function(){return g_(this)}});var __,v_,y_,E_={exports:{}},b_=ms,w_=a,I_=i,T_=B,S_=H,A_=He,R_=ln,k_=pe,C_=Kt,D_=Ji,O_=mn,L_=G,N_=Na,P_=uo,x_=tt,M_=qe,U_=ki.enforce,F_=ki.get,B_=I_.Int8Array,V_=B_&&B_.prototype,H_=I_.Uint8ClampedArray,j_=H_&&H_.prototype,z_=B_&&N_(B_),W_=V_&&N_(V_),G_=Object.prototype,q_=I_.TypeError,K_=x_("toStringTag"),Y_=M_("TYPED_ARRAY_TAG"),X_="TypedArrayConstructor",Z_=b_&&!!P_&&"Opera"!==R_(I_.opera),J_=!1,Q_={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},$_={BigInt64Array:8,BigUint64Array:8},ev=function(e){var t=N_(e);if(S_(t)){var i=F_(t);return i&&A_(i,X_)?i[X_]:ev(t)}},tv=function(e){if(!S_(e))return!1;var t=R_(e);return A_(Q_,t)||A_($_,t)};for(__ in Q_)(y_=(v_=I_[__])&&v_.prototype)?U_(y_)[X_]=v_:Z_=!1;for(__ in $_)(y_=(v_=I_[__])&&v_.prototype)&&(U_(y_)[X_]=v_);if((!Z_||!T_(z_)||z_===Function.prototype)&&(z_=function(){throw new q_("Incorrect invocation")},Z_))for(__ in Q_)I_[__]&&P_(I_[__],z_);if((!Z_||!W_||W_===G_)&&(W_=z_.prototype,Z_))for(__ in Q_)I_[__]&&P_(I_[__].prototype,W_);if(Z_&&N_(j_)!==W_&&P_(j_,W_),w_&&!A_(W_,K_))for(__ in J_=!0,O_(W_,K_,{configurable:!0,get:function(){return S_(this)?this[Y_]:void 0}}),Q_)I_[__]&&C_(I_[__].prototype,Y_,__);var iv={NATIVE_ARRAY_BUFFER_VIEWS:Z_,TYPED_ARRAY_TAG:J_&&Y_,aTypedArray:function(e){if(tv(e))return e;throw new q_("Target is not a typed array")},aTypedArrayConstructor:function(e){if(T_(e)&&(!P_||L_(z_,e)))return e;throw new q_(k_(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,r){if(w_){if(i)for(var n in Q_){var a=I_[n];if(a&&A_(a.prototype,e))try{delete a.prototype[e]}catch(kU){try{a.prototype[e]=t}catch(o){}}}W_[e]&&!i||D_(W_,e,i?t:Z_&&V_[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,i){var r,n;if(w_){if(P_){if(i)for(r in Q_)if((n=I_[r])&&A_(n,e))try{delete n[e]}catch(kU){}if(z_[e]&&!i)return;try{return D_(z_,e,i?t:Z_&&z_[e]||t)}catch(kU){}}for(r in Q_)!(n=I_[r])||n[e]&&!i||D_(n,e,t)}},getTypedArrayConstructor:ev,isView:function(e){if(!S_(e))return!1;var t=R_(e);return"DataView"===t||A_(Q_,t)||A_($_,t)},isTypedArray:tv,TypedArray:z_,TypedArrayPrototype:W_},rv=i,nv=n,av=lp,ov=iv.NATIVE_ARRAY_BUFFER_VIEWS,sv=rv.ArrayBuffer,cv=rv.Int8Array,lv=!ov||!nv(function(){cv(1)})||!nv(function(){new cv(-1)})||!av(function(e){new cv,new cv(null),new cv(1.5),new cv(e)},!0)||nv(function(){return 1!==new cv(new sv(2),1,void 0).length}),dv=H,uv=Math.floor,hv=Number.isInteger||function(e){return!dv(e)&&isFinite(e)&&uv(e)===e},pv=ir,fv=RangeError,mv=function(e){var t=pv(e);if(t<0)throw new fv("The argument can't be less than 0");return t},gv=RangeError,_v=function(e,t){var i=mv(e);if(i%t)throw new gv("Wrong offset");return i},vv=Math.floor,yv=ln,Ev=lt,bv=TypeError,wv=function(e){var t=Ev(e,"number");if("number"==typeof t)throw new bv("Can't convert number to bigint");return BigInt(t)},Iv=$l,Tv=l,Sv=_e,Av=Bl,Rv=Fe,kv=ur,Cv=Vh,Dv=Nh,Ov=Rh,Lv=function(e){var t=yv(e);return"BigInt64Array"===t||"BigUint64Array"===t},Nv=iv.aTypedArrayConstructor,Pv=wv,xv=function(e){var t=Av(this),i=arguments.length,r=i>1?arguments[1]:void 0,n=void 0!==r;n&&Sv(r);var a,o,s,c,l,d,u,h,p=Rv(e),f=Dv(p);if(f&&!Ov(f))for(h=(u=Cv(p,f)).next,p=[];!(d=Tv(h,u)).done;)p.push(d.value);for(n&&i>2&&(r=Iv(r,arguments[2])),o=kv(p),s=new(Nv(t))(o),c=Lv(s),a=0;o>a;a++)l=n?r(p[a],a):p[a],s[a]=c?Pv(l):+l;return s},Mv=ds,Uv=xl,Fv=H,Bv=tt("species"),Vv=Array,Hv=function(e){var t;return Mv(e)&&(t=e.constructor,(Uv(t)&&(t===Vv||Mv(t.prototype))||Fv(t)&&null===(t=t[Bv]))&&(t=void 0)),void 0===t?Vv:t},jv=a,zv=kt,Wv=g,Gv=function(e,t,i){jv?zv.f(e,t,Wv(0,i)):e[t]=i},qv=$l,Kv=D,Yv=Fe,Xv=ur,Zv=function(e,t){return new(Hv(e))(0===t?0:t)},Jv=Gv,Qv=function(e){var t=1===e,i=2===e,r=3===e,n=4===e,a=6===e,o=7===e,s=5===e||a;return function(c,l,d){for(var u,h,p=Yv(c),f=Kv(p),m=Xv(f),g=qv(l,d),_=0,v=0,y=t?Zv(c,m):i||o?Zv(c,0):void 0;m>_;_++)if((s||_ in f)&&(h=g(u=f[_],_,p),e))if(t)Jv(y,_,h);else if(h)switch(e){case 3:return!0;case 5:return u;case 6:return _;case 2:Jv(y,v++,u)}else switch(e){case 4:return!1;case 7:Jv(y,v++,u)}return a?-1:r||n?n:y}},$v={forEach:Qv(0),map:Qv(1),filter:Qv(2),some:Qv(3),every:Qv(4),find:Qv(5),findIndex:Qv(6),filterReject:Qv(7)},ey=ur,ty=en,iy=i,ry=l,ny=a,ay=lv,oy=iv,sy=Yc,cy=Es,ly=g,dy=Kt,uy=hv,hy=Ts,py=_v,fy=function(e){var t=+e;if(t!=t||t<=0)return 0;if(t>=255)return 255;var i=vv(t);return i+.5<t?i+1:t<i+.5||i%2==0?i:i+1},my=ht,gy=He,_y=ln,vy=H,yy=ue,Ey=ca,by=G,wy=uo,Iy=Qi.f,Ty=xv,Sy=$v.forEach,Ay=$c,Ry=mn,ky=kt,Cy=r,Dy=function(e,t,i){for(var r=0,n=arguments.length>2?i:ey(t),a=new e(n);n>r;)a[r]=t[r++];return a},Oy=Ks,Ly=ki.get,Ny=ki.set,Py=ki.enforce,xy=ky.f,My=Cy.f,Uy=iy.RangeError,Fy=sy.ArrayBuffer,By=Fy.prototype,Vy=sy.DataView,Hy=oy.NATIVE_ARRAY_BUFFER_VIEWS,jy=oy.TYPED_ARRAY_TAG,zy=oy.TypedArray,Wy=oy.TypedArrayPrototype,Gy=oy.isTypedArray,qy="BYTES_PER_ELEMENT",Ky="Wrong length",Yy=function(e,t){Ry(e,t,{configurable:!0,get:function(){return Ly(this)[t]}})},Xy=function(e){var t;return by(By,e)||"ArrayBuffer"===(t=_y(e))||"SharedArrayBuffer"===t},Zy=function(e,t){return Gy(e)&&!yy(t)&&t in e&&uy(+t)&&t>=0},Jy=function(e,t){return t=my(t),Zy(e,t)?ly(2,e[t]):My(e,t)},Qy=function(e,t,i){return t=my(t),!(Zy(e,t)&&vy(i)&&gy(i,"value"))||gy(i,"get")||gy(i,"set")||i.configurable||gy(i,"writable")&&!i.writable||gy(i,"enumerable")&&!i.enumerable?xy(e,t,i):(e[t]=i.value,e)};ny?(Hy||(Cy.f=Jy,ky.f=Qy,Yy(Wy,"buffer"),Yy(Wy,"byteOffset"),Yy(Wy,"byteLength"),Yy(Wy,"length")),ty({target:"Object",stat:!0,forced:!Hy},{getOwnPropertyDescriptor:Jy,defineProperty:Qy}),E_.exports=function(e,t,i){var r=e.match(/\d+/)[0]/8,n=e+(i?"Clamped":"")+"Array",a="get"+e,o="set"+e,s=iy[n],c=s,l=c&&c.prototype,d={},u=function(e,t){xy(e,t,{get:function(){return function(e,t){var i=Ly(e);return i.view[a](t*r+i.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var a=Ly(e);a.view[o](t*r+a.byteOffset,i?fy(n):n,!0)}(this,t,e)},enumerable:!0})};Hy?ay&&(c=t(function(e,t,i,n){return cy(e,l),Oy(vy(t)?Xy(t)?void 0!==n?new s(t,py(i,r),n):void 0!==i?new s(t,py(i,r)):new s(t):Gy(t)?Dy(c,t):ry(Ty,c,t):new s(hy(t)),e,c)}),wy&&wy(c,zy),Sy(Iy(s),function(e){e in c||dy(c,e,s[e])}),c.prototype=l):(c=t(function(e,t,i,n){cy(e,l);var a,o,s,d=0,h=0;if(vy(t)){if(!Xy(t))return Gy(t)?Dy(c,t):ry(Ty,c,t);a=t,h=py(i,r);var p=t.byteLength;if(void 0===n){if(p%r)throw new Uy(Ky);if((o=p-h)<0)throw new Uy(Ky)}else if((o=hy(n)*r)+h>p)throw new Uy(Ky);s=o/r}else s=hy(t),a=new Fy(o=s*r);for(Ny(e,{buffer:a,byteOffset:h,byteLength:o,length:s,view:new Vy(a)});d<s;)u(e,d++)}),wy&&wy(c,zy),l=c.prototype=Ey(Wy)),l.constructor!==c&&dy(l,"constructor",c),Py(l).TypedArrayConstructor=c,jy&&dy(l,jy,n);var h=c!==s;d[n]=c,ty({global:!0,constructor:!0,forced:h,sham:!Hy},d),qy in c||dy(c,qy,r),qy in l||dy(l,qy,r),Ay(n)}):E_.exports=function(){};var $y=E_.exports;$y("Float32",function(e){return function(t,i,r){return e(this,t,i,r)}}),$y("Int32",function(e){return function(t,i,r){return e(this,t,i,r)}}),$y("Uint8",function(e){return function(t,i,r){return e(this,t,i,r)}}),$y("Uint16",function(e){return function(t,i,r){return e(this,t,i,r)}}),$y("Uint32",function(e){return function(t,i,r){return e(this,t,i,r)}});var eE=js,tE=wv,iE=ln,rE=l,nE=n,aE=iv.aTypedArray,oE=iv.exportTypedArrayMethod,sE=b("".slice);oE("fill",function(e){var t=arguments.length;aE(this);var i="Big"===sE(iE(this),0,3)?tE(e):+e;return rE(eE,this,i,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)},nE(function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e})),(0,iv.exportTypedArrayStaticMethod)("from",xv,lv);var cE=i,lE=l,dE=iv,uE=ur,hE=_v,pE=Fe,fE=n,mE=cE.RangeError,gE=cE.Int8Array,_E=gE&&gE.prototype,vE=_E&&_E.set,yE=dE.aTypedArray,EE=dE.exportTypedArrayMethod,bE=!fE(function(){var e=new Uint8ClampedArray(2);return lE(vE,e,{length:1,0:3},1),3!==e[1]}),wE=bE&&dE.NATIVE_ARRAY_BUFFER_VIEWS&&fE(function(){var e=new gE(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]});EE("set",function(e){yE(this);var t=hE(arguments.length>1?arguments[1]:void 0,1),i=pE(e);if(bE)return lE(vE,this,i,t);var r=this.length,n=uE(i),a=0;if(n+t>r)throw new mE("Wrong length");for(;a<n;)this[t+a]=i[a++]},!bE||wE);var IE=zs,TE=Math.floor,SE=function(e,t){var i=e.length;if(i<8)for(var r,n,a=1;a<i;){for(n=a,r=e[a];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==a++&&(e[n]=r)}else for(var o=TE(i/2),s=SE(IE(e,0,o),t),c=SE(IE(e,o),t),l=s.length,d=c.length,u=0,h=0;u<l||h<d;)e[u+h]=u<l&&h<d?t(s[u],c[h])<=0?s[u++]:c[h++]:u<l?s[u++]:c[h++];return e},AE=SE,RE=Y.match(/firefox\/(\d+)/i),kE=!!RE&&+RE[1],CE=/MSIE|Trident/.test(Y),DE=Y.match(/AppleWebKit\/(\d+)\./),OE=!!DE&&+DE[1],LE=al,NE=n,PE=_e,xE=AE,ME=kE,UE=CE,FE=te,BE=OE,VE=iv.aTypedArray,HE=iv.exportTypedArrayMethod,jE=i.Uint16Array,zE=jE&&LE(jE.prototype.sort),WE=!(!zE||NE(function(){zE(new jE(2),null)})&&NE(function(){zE(new jE(2),{})})),GE=!!zE&&!NE(function(){if(FE)return FE<74;if(ME)return ME<67;if(UE)return!0;if(BE)return BE<602;var e,t,i=new jE(516),r=Array(516);for(e=0;e<516;e++)t=e%4,i[e]=515-e,r[e]=e-2*t+3;for(zE(i,function(e,t){return(e/4|0)-(t/4|0)}),e=0;e<516;e++)if(i[e]!==r[e])return!0});HE("sort",function(e){return void 0!==e&&PE(e),GE?zE(this,e):xE(VE(this),function(e){return function(t,i){return void 0!==e?+e(t,i)||0:i!=i?t!=t?0:-1:t!=t?1:0===t&&0===i?1/t>0?1/i>0?0:1:1/i>0?-1:0:t>i?1:t<i?-1:0}}(e))},!GE||WE);var qE=en,KE=l,YE=b,XE=P,ZE=B,JE=H,QE=Jp,$E=hn,eb=Ee,tb=uf,ib=Ig,rb=tt("replace"),nb=TypeError,ab=YE("".indexOf);YE("".replace);var ob=YE("".slice),sb=Math.max;qE({target:"String",proto:!0},{replaceAll:function(e,t){var i,r,n,a,o,s,c,l,d,u=XE(this),h=0,p="";if(JE(e)){if(QE(e)&&(i=$E(XE(tb(e))),!~ab(i,"g")))throw new nb("`.replaceAll` does not allow non-global regexes");if(r=eb(e,rb))return KE(r,e,u,t)}for(n=$E(u),a=$E(e),(o=ZE(t))||(t=$E(t)),s=a.length,c=sb(1,s),l=ab(n,a);-1!==l;)d=o?$E(t(a,l,n)):ib(a,n,l,[],void 0,t),p+=ob(n,h,l)+d,h=l+s,l=l+c>n.length?-1:ab(n,a,l+c);return h<n.length&&(p+=ob(n,h)),p}});var cb={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},lb=gt("span").classList,db=lb&&lb.constructor&&lb.constructor.prototype,ub=db===Object.prototype?void 0:db,hb=$v.forEach,pb=ts("forEach")?[].forEach:function(e){return hb(this,e,arguments.length>1?arguments[1]:void 0)},fb=i,mb=cb,gb=ub,_b=pb,vb=Kt,yb=function(e){if(e&&e.forEach!==_b)try{vb(e,"forEach",_b)}catch(kU){e.forEach=_b}};for(var Eb in mb)mb[Eb]&&yb(fb[Eb]&&fb[Eb].prototype);yb(gb);var bb=i,wb=cb,Ib=ub,Tb=Wo,Sb=Kt,Ab=qa,Rb=tt("iterator"),kb=Tb.values,Cb=function(e,t){if(e){if(e[Rb]!==kb)try{Sb(e,Rb,kb)}catch(kU){e[Rb]=kb}if(Ab(e,t,!0),wb[t])for(var i in Tb)if(e[i]!==Tb[i])try{Sb(e,i,Tb[i])}catch(kU){e[i]=Tb[i]}}};for(var Db in wb)Cb(bb[Db]&&bb[Db].prototype,Db);Cb(Ib,"DOMTokenList");var Ob=Dd.clear;en({global:!0,bind:!0,enumerable:!0,forced:i.clearImmediate!==Ob},{clearImmediate:Ob});var Lb=i,Nb=Xl,Pb=B,xb=os,Mb=Y,Ub=zs,Fb=td,Bb=Lb.Function,Vb=/MSIE .\./.test(Mb)||"BUN"===xb&&function(){var e=Lb.Bun.version.split(".");return e.length<3||"0"===e[0]&&(e[1]<3||"3"===e[1]&&"0"===e[2])}(),Hb=en,jb=i,zb=Dd.set,Wb=function(e,t){var i=t?2:1;return Vb?function(r,n){var a=Fb(arguments.length,1)>i,o=Pb(r)?r:Bb(r),s=a?Ub(arguments,i):[],c=a?function(){Nb(o,this,s)}:o;return t?e(c,n):e(c)}:e},Gb=jb.setImmediate?Wb(zb,!1):zb;Hb({global:!0,bind:!0,enumerable:!0,forced:jb.setImmediate!==Gb},{setImmediate:Gb});var qb=pg.charAt,Kb=hn,Yb=ki,Xb=Oo,Zb=Lo,Jb="String Iterator",Qb=Yb.set,$b=Yb.getterFor(Jb);Xb(String,"String",function(e){Qb(this,{type:Jb,string:Kb(e),index:0})},function(){var e,t=$b(this),i=t.string,r=t.index;return r>=i.length?Zb(void 0,!0):(e=qb(i,r),t.index+=e.length,Zb(e,!1))});var ew=n,tw=a,iw=tt("iterator"),rw=!ew(function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,i=new URLSearchParams("a=1&a=2&b=3"),r="";return e.pathname="c%20d",t.forEach(function(e,i){t.delete("b"),r+=i+e}),i.delete("a",2),i.delete("b",void 0),!t.size&&!tw||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[iw]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==r||"x"!==new URL("https://x",void 0).host}),nw=a,aw=b,ow=l,sw=n,cw=Vn,lw=Ar,dw=d,uw=Fe,hw=D,pw=Object.assign,fw=Object.defineProperty,mw=aw([].concat),gw=!pw||sw(function(){if(nw&&1!==pw({b:1},pw(fw({},"a",{enumerable:!0,get:function(){fw(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},i=Symbol("assign detection"),r="abcdefghijklmnopqrst";return e[i]=7,r.split("").forEach(function(e){t[e]=e}),7!==pw({},e)[i]||cw(pw({},t)).join("")!==r})?function(e,t){for(var i=uw(e),r=arguments.length,n=1,a=lw.f,o=dw.f;r>n;)for(var s,c=hw(arguments[n++]),l=a?mw(cw(c),a(c)):cw(c),d=l.length,u=0;d>u;)s=l[u++],nw&&!ow(o,c,s)||(i[s]=c[s]);return i}:pw,_w=Nt,vw=Wh,yw=a,Ew=ds,bw=TypeError,ww=Object.getOwnPropertyDescriptor,Iw=yw&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(kU){return kU instanceof TypeError}}(),Tw=$l,Sw=l,Aw=Fe,Rw=function(e,t,i,r){try{return r?t(_w(i)[0],i[1]):t(i)}catch(kU){vw(e,"throw",kU)}},kw=Rh,Cw=xl,Dw=ur,Ow=Gv,Lw=Iw?function(e,t){if(Ew(e)&&!ww(e,"length").writable)throw new bw("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},Nw=Vh,Pw=Nh,xw=Wh,Mw=Array,Uw=b,Fw=2147483647,Bw=/[^\0-\u007E]/,Vw=/[.\u3002\uFF0E\uFF61]/g,Hw="Overflow: input needs wider integers to process",jw=RangeError,zw=Uw(Vw.exec),Ww=Math.floor,Gw=String.fromCharCode,qw=Uw("".charCodeAt),Kw=Uw([].join),Yw=Uw([].push),Xw=Uw("".replace),Zw=Uw("".split),Jw=Uw("".toLowerCase),Qw=function(e){return e+22+75*(e<26)},$w=function(e,t,i){var r=0;for(e=i?Ww(e/700):e>>1,e+=Ww(e/t);e>455;)e=Ww(e/35),r+=36;return Ww(r+36*e/(e+38))},eI=function(e){var t=[];e=function(e){for(var t=[],i=0,r=e.length;i<r;){var n=qw(e,i++);if(n>=55296&&n<=56319&&i<r){var a=qw(e,i++);56320==(64512&a)?Yw(t,((1023&n)<<10)+(1023&a)+65536):(Yw(t,n),i--)}else Yw(t,n)}return t}(e);var i,r,n=e.length,a=128,o=0,s=72;for(i=0;i<e.length;i++)(r=e[i])<128&&Yw(t,Gw(r));var c=t.length,l=c;for(c&&Yw(t,"-");l<n;){var d=Fw;for(i=0;i<e.length;i++)(r=e[i])>=a&&r<d&&(d=r);var u=l+1;if(d-a>Ww((Fw-o)/u))throw new jw(Hw);for(o+=(d-a)*u,a=d,i=0;i<e.length;i++){if((r=e[i])<a&&++o>Fw)throw new jw(Hw);if(r===a){for(var h=o,p=36;;){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var m=h-f,g=36-f;Yw(t,Gw(Qw(f+m%g))),h=Ww(m/g),p+=36}Yw(t,Gw(Qw(h))),s=$w(o,u,l===c),o=0,l++}}o++,a++}return Kw(t,"")},tI=en,iI=b,rI=or,nI=RangeError,aI=String.fromCharCode,oI=String.fromCodePoint,sI=iI([].join);tI({target:"String",stat:!0,arity:1,forced:!!oI&&1!==oI.length},{fromCodePoint:function(e){for(var t,i=[],r=arguments.length,n=0;r>n;){if(rI(t=+arguments[n],1114111)!==t)throw new nI(t+" is not a valid code point");i[n++]=t<65536?aI(t):aI(55296+((t-=65536)>>10),t%1024+56320)}return sI(i,"")}});var cI=en,lI=i,dI=Pd,uI=W,hI=l,pI=b,fI=a,mI=rw,gI=Ji,_I=mn,vI=_s,yI=qa,EI=$a,bI=ki,wI=Es,II=B,TI=He,SI=$l,AI=ln,RI=Nt,kI=H,CI=hn,DI=ca,OI=g,LI=Vh,NI=Nh,PI=Lo,xI=td,MI=AE,UI=tt("iterator"),FI="URLSearchParams",BI=FI+"Iterator",VI=bI.set,HI=bI.getterFor(FI),jI=bI.getterFor(BI),zI=dI("fetch"),WI=dI("Request"),GI=dI("Headers"),qI=WI&&WI.prototype,KI=GI&&GI.prototype,YI=lI.TypeError,XI=lI.encodeURIComponent,ZI=String.fromCharCode,JI=uI("String","fromCodePoint"),QI=parseInt,$I=pI("".charAt),eT=pI([].join),tT=pI([].push),iT=pI("".replace),rT=pI([].shift),nT=pI([].splice),aT=pI("".split),oT=pI("".slice),sT=pI(/./.exec),cT=/\+/g,lT=/^[0-9a-f]+$/i,dT=function(e,t){var i=oT(e,t,t+2);return sT(lT,i)?QI(i,16):NaN},uT=function(e){for(var t=0,i=128;i>0&&0!==(e&i);i>>=1)t++;return t},hT=function(e){var t=null,i=e.length;switch(i){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return null===t||t>1114111||t>=55296&&t<=57343||t<(i>3?65536:i>2?2048:i>1?128:0)?null:t},pT=function(e){for(var t=(e=iT(e,cT," ")).length,i="",r=0;r<t;){var n=$I(e,r);if("%"===n){if("%"===$I(e,r+1)||r+3>t){i+="%",r++;continue}var a=dT(e,r+1);if(a!=a){i+=n,r++;continue}r+=2;var o=uT(a);if(0===o)n=ZI(a);else{if(1===o||o>4){i+="�",r++;continue}for(var s=[a],c=1;c<o&&!(++r+3>t||"%"!==$I(e,r));){var l=dT(e,r+1);if(l!=l||l>191||l<128)break;if(1===c){if(224===a&&l<160)break;if(237===a&&l>159)break;if(240===a&&l<144)break;if(244===a&&l>143)break}tT(s,l),r+=2,c++}if(s.length!==o){i+="�";continue}var d=hT(s);if(null===d){for(var u=0;u<o;u++)i+="�";r++;continue}n=JI(d)}}i+=n,r++}return i},fT=/[!'()~]|%20/g,mT={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},gT=function(e){return mT[e]},_T=function(e){return iT(XI(e),fT,gT)},vT=EI(function(e,t){VI(this,{type:BI,target:HI(e).entries,index:0,kind:t})},FI,function(){var e=jI(this),t=e.target,i=e.index++;if(!t||i>=t.length)return e.target=null,PI(void 0,!0);var r=t[i];switch(e.kind){case"keys":return PI(r.key,!1);case"values":return PI(r.value,!1)}return PI([r.key,r.value],!1)},!0),yT=function(e){this.entries=[],this.url=null,void 0!==e&&(kI(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===$I(e,0)?oT(e,1):e:CI(e)))};yT.prototype={type:FI,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,i,r,n,a,o,s,c=this.entries,l=NI(e);if(l)for(i=(t=LI(e,l)).next;!(r=hI(i,t)).done;){if(a=(n=LI(RI(r.value))).next,(o=hI(a,n)).done||(s=hI(a,n)).done||!hI(a,n).done)throw new YI("Expected sequence with length 2");tT(c,{key:CI(o.value),value:CI(s.value)})}else for(var d in e)TI(e,d)&&tT(c,{key:d,value:CI(e[d])})},parseQuery:function(e){if(e)for(var t,i,r=this.entries,n=aT(e,"&"),a=0;a<n.length;)(t=n[a++]).length&&(i=aT(t,"="),tT(r,{key:pT(rT(i)),value:pT(eT(i,"="))}))},serialize:function(){for(var e,t=this.entries,i=[],r=0;r<t.length;)e=t[r++],tT(i,_T(e.key)+"="+_T(e.value));return eT(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var ET=function(){wI(this,bT);var e=VI(this,new yT(arguments.length>0?arguments[0]:void 0));fI||(this.size=e.entries.length)},bT=ET.prototype;if(vI(bT,{append:function(e,t){var i=HI(this);xI(arguments.length,2),tT(i.entries,{key:CI(e),value:CI(t)}),fI||this.size++,i.updateURL()},delete:function(e){for(var t=HI(this),i=xI(arguments.length,1),r=t.entries,n=CI(e),a=i<2?void 0:arguments[1],o=void 0===a?a:CI(a),s=0;s<r.length;){var c=r[s];c.key!==n||void 0!==o&&c.value!==o?s++:nT(r,s,1)}fI||(this.size=r.length),t.updateURL()},get:function(e){var t=HI(this).entries;xI(arguments.length,1);for(var i=CI(e),r=0;r<t.length;r++)if(t[r].key===i)return t[r].value;return null},getAll:function(e){var t=HI(this).entries;xI(arguments.length,1);for(var i=CI(e),r=[],n=0;n<t.length;n++)t[n].key===i&&tT(r,t[n].value);return r},has:function(e){for(var t=HI(this).entries,i=xI(arguments.length,1),r=CI(e),n=i<2?void 0:arguments[1],a=void 0===n?n:CI(n),o=0;o<t.length;){var s=t[o++];if(s.key===r&&(void 0===a||s.value===a))return!0}return!1},set:function(e,t){var i=HI(this);xI(arguments.length,2);for(var r,n=i.entries,a=!1,o=CI(e),s=CI(t),c=0;c<n.length;c++)(r=n[c]).key===o&&(a?nT(n,c--,1):(a=!0,r.value=s));a||tT(n,{key:o,value:s}),fI||(this.size=n.length),i.updateURL()},sort:function(){var e=HI(this);MI(e.entries,function(e,t){return e.key>t.key?1:-1}),e.updateURL()},forEach:function(e){for(var t,i=HI(this).entries,r=SI(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 vT(this,"keys")},values:function(){return new vT(this,"values")},entries:function(){return new vT(this,"entries")}},{enumerable:!0}),gI(bT,UI,bT.entries,{name:"entries"}),gI(bT,"toString",function(){return HI(this).serialize()},{enumerable:!0}),fI&&_I(bT,"size",{get:function(){return HI(this).entries.length},configurable:!0,enumerable:!0}),yI(ET,FI),cI({global:!0,constructor:!0,forced:!mI},{URLSearchParams:ET}),!mI&&II(GI)){var wT=pI(KI.has),IT=pI(KI.set),TT=function(e){if(kI(e)){var t,i=e.body;if(AI(i)===FI)return t=e.headers?new GI(e.headers):new GI,wT(t,"content-type")||IT(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),DI(e,{body:OI(0,CI(i)),headers:OI(0,t)})}return e};if(II(zI)&&cI({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return zI(e,arguments.length>1?TT(arguments[1]):{})}}),II(WI)){var ST=function(e){return wI(this,qI),new WI(e,arguments.length>1?TT(arguments[1]):{})};qI.constructor=ST,ST.prototype=qI,cI({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:ST})}}var AT,RT=en,kT=a,CT=rw,DT=i,OT=$l,LT=b,NT=Ji,PT=mn,xT=Es,MT=He,UT=gw,FT=function(e){var t=Cw(this),i=arguments.length,r=i>1?arguments[1]:void 0,n=void 0!==r;n&&(r=Tw(r,i>2?arguments[2]:void 0));var a,o,s,c,l,d,u=Aw(e),h=Pw(u),p=0;if(!h||this===Mw&&kw(h))for(a=Dw(u),o=t?new this(a):Mw(a);a>p;p++)d=n?r(u[p],p):u[p],Ow(o,p,d);else for(o=t?new this:[],l=(c=Nw(u,h)).next;!(s=Sw(l,c)).done;p++){d=n?Rw(c,r,[s.value,p],!0):s.value;try{Ow(o,p,d)}catch(kU){xw(c,"throw",kU)}}return Lw(o,p),o},BT=zs,VT=pg.codeAt,HT=function(e){var t,i,r=[],n=Zw(Xw(Jw(e),Vw,"."),".");for(t=0;t<n.length;t++)i=n[t],Yw(r,zw(Bw,i)?"xn--"+eI(i):i);return Kw(r,".")},jT=hn,zT=qa,WT=td,GT={URLSearchParams:ET,getState:HI},qT=ki,KT=qT.set,YT=qT.getterFor("URL"),XT=GT.URLSearchParams,ZT=GT.getState,JT=DT.URL,QT=DT.TypeError,$T=DT.encodeURIComponent,eS=DT.parseInt,tS=Math.floor,iS=Math.pow,rS=LT("".charAt),nS=LT(/./.exec),aS=LT([].join),oS=LT(1.1.toString),sS=LT([].pop),cS=LT([].push),lS=LT("".replace),dS=LT([].shift),uS=LT("".split),hS=LT("".slice),pS=LT("".toLowerCase),fS=LT([].unshift),mS="Invalid scheme",gS="Invalid host",_S="Invalid port",vS=/[a-z]/i,yS=/[\d+\-.a-z]/i,ES=/\d/,bS=/^0x/i,wS=/^[0-7]+$/,IS=/^\d+$/,TS=/^[\da-f]+$/i,SS=/[\0\t\n\r #%/:<>?@[\\\]^|]/,AS=/[\0\t\n\r #/:<>?@[\\\]^|]/,RS=/^[\u0000-\u0020]+/,kS=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,CS=/[\t\n\r]/g,DS=function(e){var t,i,r,n;if("number"==typeof e){for(t=[],i=0;i<4;i++)fS(t,e%256),e=tS(e/256);return aS(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,i=1,r=null,n=0,a=0;a<8;a++)0!==e[a]?(n>i&&(t=r,i=n),r=null,n=0):(null===r&&(r=a),++n);return n>i?r:t}(e),i=0;i<8;i++)n&&0===e[i]||(n&&(n=!1),r===i?(t+=i?":":"::",n=!0):(t+=oS(e[i],16),i<7&&(t+=":")));return"["+t+"]"}return e},OS={},LS=UT({},OS,{" ":1,'"':1,"#":1,"<":1,">":1}),NS=UT({},LS,{"'":1}),PS=UT({},OS,{" ":1,'"':1,"<":1,">":1,"`":1}),xS=UT({},PS,{"#":1,"?":1,"{":1,"}":1,"^":1}),MS=UT({},xS,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),US=function(e,t){var i=VT(e,0);return i>=32&&i<127&&!MT(t,e)?e:"'"===e&&MT(t,e)?"%27":$T(e)},FS={ftp:21,file:null,http:80,https:443,ws:80,wss:443},BS=function(e,t){var i;return 2===e.length&&nS(vS,rS(e,0))&&(":"===(i=rS(e,1))||!t&&"|"===i)},VS=function(e){var t;return e.length>1&&BS(hS(e,0,2))&&(2===e.length||"/"===(t=rS(e,2))||"\\"===t||"?"===t||"#"===t)},HS=function(e){return"."===e||"%2e"===pS(e)},jS=function(e){return".."===(e=pS(e))||"%2e."===e||".%2e"===e||"%2e%2e"===e},zS={},WS={},GS={},qS={},KS={},YS={},XS={},ZS={},JS={},QS={},$S={},eA={},tA={},iA={},rA={},nA={},aA={},oA={},sA={},cA={},lA={},dA=function(e,t,i){var r,n,a,o=jT(e);if(t){if(n=this.parse(o))throw new QT(n);this.searchParams=null}else{if(void 0!==i&&(r=new dA(i,!0)),n=this.parse(o,null,r))throw new QT(n);(a=ZT(new XT)).bindURL(this),this.searchParams=a}};dA.prototype={type:"URL",parse:function(e,t,i){var r,n,a,o,s=this,c=t||zS,l=0,d="",u=!1,h=!1,p=!1;for(e=jT(e),t||(s.scheme="",s.username="",s.password="",s.host=null,s.port=null,s.path=[],s.query=null,s.fragment=null,s.cannotBeABaseURL=!1,e=lS(e,RS,""),e=lS(e,kS,"$1")),e=lS(e,CS,""),r=FT(e);l<=r.length;){switch(n=r[l],c){case zS:if(!n||!nS(vS,n)){if(t)return mS;c=GS;continue}d+=pS(n),c=WS;break;case WS:if(n&&nS(yS,n))d+=pS(n);else{if(":"!==n){if(t)return mS;d="",c=GS,l=0;continue}if(t&&(s.isSpecial()!==MT(FS,d)||"file"===d&&(s.includesCredentials()||null!==s.port)||"file"===s.scheme&&""===s.host))return;if(s.scheme=d,t)return void(s.isSpecial()&&FS[s.scheme]===s.port&&(s.port=null));d="","file"===s.scheme?c=iA:s.isSpecial()&&i&&i.scheme===s.scheme?c=qS:s.isSpecial()?c=ZS:"/"===r[l+1]?(c=KS,l++):(s.cannotBeABaseURL=!0,cS(s.path,""),c=sA)}break;case GS:if(!i||i.cannotBeABaseURL&&"#"!==n)return mS;if(i.cannotBeABaseURL&&"#"===n){s.scheme=i.scheme,s.path=BT(i.path),s.query=i.query,s.fragment="",s.cannotBeABaseURL=!0,c=lA;break}c="file"===i.scheme?iA:YS;continue;case qS:if("/"!==n||"/"!==r[l+1]){c=YS;continue}c=JS,l++;break;case KS:if("/"===n){c=QS;break}c=oA;continue;case YS:if(s.scheme=i.scheme,n===AT)s.username=i.username,s.password=i.password,s.host=i.host,s.port=i.port,s.path=BT(i.path),s.query=i.query;else if("/"===n||"\\"===n&&s.isSpecial())c=XS;else if("?"===n)s.username=i.username,s.password=i.password,s.host=i.host,s.port=i.port,s.path=BT(i.path),s.query="",c=cA;else{if("#"!==n){s.username=i.username,s.password=i.password,s.host=i.host,s.port=i.port,s.path=BT(i.path),s.path.length&&s.path.length--,c=oA;continue}s.username=i.username,s.password=i.password,s.host=i.host,s.port=i.port,s.path=BT(i.path),s.query=i.query,s.fragment="",c=lA}break;case XS:if(!s.isSpecial()||"/"!==n&&"\\"!==n){if("/"!==n){s.username=i.username,s.password=i.password,s.host=i.host,s.port=i.port,c=oA;continue}c=QS}else c=JS;break;case ZS:if(c=JS,"/"!==n||"/"!==r[l+1])continue;l++;break;case JS:if("/"!==n&&"\\"!==n){c=QS;continue}break;case QS:if("@"===n){u&&(d="%40"+d),u=!0,a=FT(d);for(var f=0;f<a.length;f++){var m=a[f];if(":"!==m||p){var g=US(m,MS);p?s.password+=g:s.username+=g}else p=!0}d=""}else if(n===AT||"/"===n||"?"===n||"#"===n||"\\"===n&&s.isSpecial()){if(u&&""===d)return"Invalid authority";l-=FT(d).length+1,d="",c=$S}else d+=n;break;case $S:case eA:if(t&&"file"===s.scheme){c=nA;continue}if(":"!==n||h){if(n===AT||"/"===n||"?"===n||"#"===n||"\\"===n&&s.isSpecial()){if(s.isSpecial()&&""===d)return gS;if(t&&""===d&&(s.includesCredentials()||null!==s.port))return;if(o=s.parseHost(d))return o;if(d="",c=aA,t)return;continue}"["===n?h=!0:"]"===n&&(h=!1),d+=n}else{if(""===d)return gS;if(t===eA)return;if(o=s.parseHost(d))return o;d="",c=tA}break;case tA:if(!nS(ES,n)){if(n===AT||"/"===n||"?"===n||"#"===n||"\\"===n&&s.isSpecial()||t){if(""!==d){var _=eS(d,10);if(_>65535)return _S;s.port=s.isSpecial()&&_===FS[s.scheme]?null:_,d=""}if(t)return;c=aA;continue}return _S}d+=n;break;case iA:if(s.scheme="file",s.host="","/"===n||"\\"===n)c=rA;else{if(!i||"file"!==i.scheme){c=oA;continue}switch(n){case AT:s.host=i.host,s.path=BT(i.path),s.query=i.query;break;case"?":s.host=i.host,s.path=BT(i.path),s.query="",c=cA;break;case"#":s.host=i.host,s.path=BT(i.path),s.query=i.query,s.fragment="",c=lA;break;default:s.host=i.host,VS(aS(BT(r,l),""))||(s.path=BT(i.path),s.shortenPath()),c=oA;continue}}break;case rA:if("/"===n||"\\"===n){c=nA;break}i&&"file"===i.scheme&&(s.host=i.host,!VS(aS(BT(r,l),""))&&BS(i.path[0],!0)&&cS(s.path,i.path[0])),c=oA;continue;case nA:if(n===AT||"/"===n||"\\"===n||"?"===n||"#"===n){if(!t&&BS(d))c=oA;else if(""===d){if(s.host="",t)return;c=aA}else{if(o=s.parseHost(d))return o;if("localhost"===s.host&&(s.host=""),t)return;d="",c=aA}continue}d+=n;break;case aA:if(s.isSpecial()){if(c=oA,"/"!==n&&"\\"!==n)continue}else if(t||"?"!==n)if(t||"#"!==n){if(n!==AT&&(c=oA,"/"!==n))continue}else s.fragment="",c=lA;else s.query="",c=cA;break;case oA:if(n===AT||"/"===n||"\\"===n&&s.isSpecial()||!t&&("?"===n||"#"===n)){if(jS(d)?(s.shortenPath(),"/"===n||"\\"===n&&s.isSpecial()||cS(s.path,"")):HS(d)?"/"===n||"\\"===n&&s.isSpecial()||cS(s.path,""):("file"===s.scheme&&!s.path.length&&BS(d)&&(null!==s.host&&""!==s.host&&(s.host=""),d=rS(d,0)+":"),cS(s.path,d)),d="","file"===s.scheme&&(n===AT||"?"===n||"#"===n))for(;s.path.length>1&&""===s.path[0];)dS(s.path);"?"===n?(s.query="",c=cA):"#"===n&&(s.fragment="",c=lA)}else d+=US(n,xS);break;case sA:"?"===n?(s.query="",c=cA):"#"===n?(s.fragment="",c=lA):n!==AT&&(s.path[0]+=US(n,OS));break;case cA:t||"#"!==n?n!==AT&&(s.query+=US(n,s.isSpecial()?NS:LS)):(s.fragment="",c=lA);break;case lA:n!==AT&&(s.fragment+=US(n,PS))}l++}},parseHost:function(e){var t,i,r;if("["===rS(e,0)){if("]"!==rS(e,e.length-1))return gS;if(t=function(e){var t,i,r,n,a,o,s,c=[0,0,0,0,0,0,0,0],l=0,d=null,u=0,h=function(){return rS(e,u)};if(":"===h()){if(":"!==rS(e,1))return;u+=2,d=++l}for(;h();){if(8===l)return;if(":"!==h()){for(t=i=0;i<4&&nS(TS,h());)t=16*t+eS(h(),16),u++,i++;if("."===h()){if(0===i)return;if(u-=i,l>6)return;for(r=0;h();){if(n=null,r>0){if(!("."===h()&&r<4))return;u++}if(!nS(ES,h()))return;for(;nS(ES,h());){if(a=eS(h(),10),null===n)n=a;else{if(0===n)return;n=10*n+a}if(n>255)return;u++}c[l]=256*c[l]+n,2!==++r&&4!==r||l++}if(4!==r)return;break}if(":"===h()){if(u++,!h())return}else if(h())return;c[l++]=t}else{if(null!==d)return;u++,d=++l}}if(null!==d)for(o=l-d,l=7;0!==l&&o>0;)s=c[l],c[l--]=c[d+o-1],c[d+--o]=s;else if(8!==l)return;return c}(hS(e,1,-1)),!t)return gS;this.host=t}else if(this.isSpecial()){if(e=HT(e),nS(SS,e))return gS;if(function(e){var t,i,r=uS(e,".");if(""===r[r.length-1]){if(1===r.length)return!1;r.length--}return t=r[r.length-1],!!nS(IS,t)||!!nS(bS,t)&&(""===(i=hS(t,2))||!!nS(TS,i))}(e)){if(t=function(e){var t,i,r,n,a,o,s,c=uS(e,".");if(c.length&&""===c[c.length-1]&&c.length--,(t=c.length)>4)return null;for(i=[],r=0;r<t;r++){if(""===(n=c[r]))return null;if(a=10,n.length>1&&"0"===rS(n,0)&&(a=nS(bS,n)?16:8,n=hS(n,8===a?1:2)),""===n)o=0;else{if(!nS(10===a?IS:8===a?wS:TS,n))return null;o=eS(n,a)}cS(i,o)}for(r=0;r<t;r++)if(o=i[r],r===t-1){if(o>=iS(256,5-t))return null}else if(o>255)return null;for(s=sS(i),r=0;r<i.length;r++)s+=i[r]*iS(256,3-r);return s}(e),null===t)return gS;this.host=t}else this.host=e}else{if(nS(AS,e))return gS;for(t="",i=FT(e),r=0;r<i.length;r++)t+=US(i[r],OS);this.host=t}},cannotHaveUsernamePasswordPort:function(){return null===this.host||""===this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return MT(FS,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&BS(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,i=e.username,r=e.password,n=e.host,a=e.port,o=e.path,s=e.query,c=e.fragment,l=t+":";return null!==n?(l+="//",e.includesCredentials()&&(l+=i+(r?":"+r:"")+"@"),l+=DS(n),null!==a&&(l+=":"+a)):"file"===t&&(l+="//"),null===n&&!e.cannotBeABaseURL&&o.length>1&&""===o[0]&&(l+="/."),l+=e.cannotBeABaseURL?o[0]:o.length?"/"+aS(o,"/"):"",null!==s&&(l+="?"+s),null!==c&&(l+="#"+c),l},setHref:function(e){var t=this.parse(e);if(t)throw new QT(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new uA(this.path[0]).origin}catch(kU){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+DS(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(jT(e)+":",zS)},getUsername:function(){return this.username},setUsername:function(e){var t=FT(jT(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<t.length;i++)this.username+=US(t[i],MS)}},getPassword:function(){return this.password},setPassword:function(e){var t=FT(jT(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<t.length;i++)this.password+=US(t[i],MS)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?DS(e):DS(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,$S)},getHostname:function(){var e=this.host;return null===e?"":DS(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,eA)},getPort:function(){var e=this.port;return null===e?"":jT(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=jT(e))?this.port=null:this.parse(e,tA))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+aS(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,aA))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=jT(e))?this.query=null:("?"===rS(e,0)&&(e=hS(e,1)),this.query="",this.parse(e,cA)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=jT(e))?("#"===rS(e,0)&&(e=hS(e,1)),this.fragment="",this.parse(e,lA)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var uA=function(e){var t=xT(this,hA),i=WT(arguments.length,1)>1?arguments[1]:void 0,r=KT(t,new dA(e,!1,i));kT||(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())},hA=uA.prototype,pA=function(e,t){return{get:function(){return YT(this)[e]()},set:t&&function(e){return YT(this)[t](e)},configurable:!0,enumerable:!0}};if(kT&&(PT(hA,"href",pA("serialize","setHref")),PT(hA,"origin",pA("getOrigin")),PT(hA,"protocol",pA("getProtocol","setProtocol")),PT(hA,"username",pA("getUsername","setUsername")),PT(hA,"password",pA("getPassword","setPassword")),PT(hA,"host",pA("getHost","setHost")),PT(hA,"hostname",pA("getHostname","setHostname")),PT(hA,"port",pA("getPort","setPort")),PT(hA,"pathname",pA("getPathname","setPathname")),PT(hA,"search",pA("getSearch","setSearch")),PT(hA,"searchParams",pA("getSearchParams")),PT(hA,"hash",pA("getHash","setHash"))),NT(hA,"toJSON",function(){return YT(this).serialize()},{enumerable:!0}),NT(hA,"toString",function(){return YT(this).serialize()},{enumerable:!0}),JT){var fA=JT.createObjectURL,mA=JT.revokeObjectURL;fA&&NT(uA,"createObjectURL",OT(fA,JT)),mA&&NT(uA,"revokeObjectURL",OT(mA,JT))}zT(uA,"URL"),RT({global:!0,constructor:!0,forced:!CT,sham:!kT},{URL:uA});var gA=l;en({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return gA(URL.prototype.toString,this)}});var _A,vA,yA=Object.create,EA=Object.defineProperty,bA=Object.defineProperties,wA=Object.getOwnPropertyDescriptor,IA=Object.getOwnPropertyDescriptors,TA=Object.getOwnPropertyNames,SA=Object.getOwnPropertySymbols,AA=Object.getPrototypeOf,RA=Object.prototype.hasOwnProperty,kA=Object.prototype.propertyIsEnumerable,CA=(e,t,i)=>t in e?EA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,DA=(e,t)=>{for(var i in t||(t={}))RA.call(t,i)&&CA(e,i,t[i]);if(SA)for(var i of SA(t))kA.call(t,i)&&CA(e,i,t[i]);return e},OA=(e,t)=>bA(e,IA(t)),LA=(_A=function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')},"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(_A,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):_A),NA=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),PA=(e,t)=>{for(var i in t)EA(e,i,{get:t[i],enumerable:!0})},xA=(e,t,i)=>(i=null!=e?yA(AA(e)):{},((e,t,i,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of TA(t))!RA.call(e,n)&&n!==i&&EA(e,n,{get:()=>t[n],enumerable:!(r=wA(t,n))||r.enumerable});return e})(!t&&e&&e.__esModule?i:EA(i,"default",{value:e,enumerable:!0}),e)),MA=(e,t,i,r)=>{for(var n,a=r>1?void 0:r?wA(t,i):t,o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r?n(t,i,a):n(a))||a);return r&&a&&EA(t,i,a),a},UA=(e,t,i)=>CA(e,"symbol"!=typeof t?t+"":t,i),FA=NA((e,t)=>{!function(i){"object"==typeof e&&void 0!==t?t.exports=i():"function"==typeof define&&define.amd?define([],i):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JSZip=i()}(function(){return function e(t,i,r){function n(o,s){if(!i[o]){if(!t[o]){var c="function"==typeof LA&&LA;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var d=i[o]={exports:{}};t[o][0].call(d.exports,function(e){return n(t[o][1][e]||e)},d,d.exports,e,t,i,r)}return i[o].exports}for(var a="function"==typeof LA&&LA,o=0;o<r.length;o++)n(r[o]);return n}({1:[function(e,t,i){var r=e("./utils"),n=e("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(e){for(var t,i,n,o,s,c,l,d=[],u=0,h=e.length,p=h,f="string"!==r.getTypeOf(e);u<e.length;)p=h-u,n=f?(t=e[u++],i=u<h?e[u++]:0,u<h?e[u++]:0):(t=e.charCodeAt(u++),i=u<h?e.charCodeAt(u++):0,u<h?e.charCodeAt(u++):0),o=t>>2,s=(3&t)<<4|i>>4,c=1<p?(15&i)<<2|n>>6:64,l=2<p?63&n:64,d.push(a.charAt(o)+a.charAt(s)+a.charAt(c)+a.charAt(l));return d.join("")},i.decode=function(e){var t,i,r,o,s,c,l=0,d=0,u="data:";if(e.substr(0,5)===u)throw new Error("Invalid base64 input, it looks like a data url.");var h,p=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===a.charAt(64)&&p--,e.charAt(e.length-2)===a.charAt(64)&&p--,p%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=n.uint8array?new Uint8Array(0|p):new Array(0|p);l<e.length;)t=a.indexOf(e.charAt(l++))<<2|(o=a.indexOf(e.charAt(l++)))>>4,i=(15&o)<<4|(s=a.indexOf(e.charAt(l++)))>>2,r=(3&s)<<6|(c=a.indexOf(e.charAt(l++))),h[d++]=t,64!==s&&(h[d++]=i),64!==c&&(h[d++]=r);return h}},{"./support":30,"./utils":32}],2:[function(e,t,i){var r=e("./external"),n=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function s(e,t,i,r,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=r,this.compressedContent=n}s.prototype={getContentWorker:function(){var e=new n(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new n(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(e,t,i){return e.pipe(new a).pipe(new o("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){var r=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){var r=e("./utils"),n=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}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,i){var r=n,a=0+i;e^=-1;for(var o=0;o<a;o++)e=e>>>8^r[255&(e^t[o])];return-1^e}(0|t,e,e.length):function(e,t,i){var r=n,a=0+i;e^=-1;for(var o=0;o<a;o++)e=e>>>8^r[255&(e^t.charCodeAt(o))];return-1^e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){var r;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),a=e("./utils"),o=e("./stream/GenericWorker"),s=r?"uint8array":"array";function c(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}i.magic="\b\0",a.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},i.compressWorker=function(e){return new c("Deflate",e)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){function r(e,t){var i,r="";for(i=0;i<t;i++)r+=String.fromCharCode(255&e),e>>>=8;return r}function n(e,t,i,n,o,d){var u,h,p=e.file,f=e.compression,m=d!==s.utf8encode,g=a.transformTo("string",d(p.name)),_=a.transformTo("string",s.utf8encode(p.name)),v=p.comment,y=a.transformTo("string",d(v)),E=a.transformTo("string",s.utf8encode(v)),b=_.length!==p.name.length,w=E.length!==v.length,I="",T="",S="",A=p.dir,R=p.date,k={crc32:0,compressedSize:0,uncompressedSize:0};t&&!i||(k.crc32=e.crc32,k.compressedSize=e.compressedSize,k.uncompressedSize=e.uncompressedSize);var C=0;t&&(C|=8),m||!b&&!w||(C|=2048);var D,O,L,N=0,P=0;A&&(N|=16),"UNIX"===o?(P=798,N|=(D=p.unixPermissions,O=A,L=D,D||(L=O?16893:33204),(65535&L)<<16)):(P=20,N|=function(e){return 63&(e||0)}(p.dosPermissions)),u=R.getUTCHours(),u<<=6,u|=R.getUTCMinutes(),u<<=5,u|=R.getUTCSeconds()/2,h=R.getUTCFullYear()-1980,h<<=4,h|=R.getUTCMonth()+1,h<<=5,h|=R.getUTCDate(),b&&(T=r(1,1)+r(c(g),4)+_,I+="up"+r(T.length,2)+T),w&&(S=r(1,1)+r(c(y),4)+E,I+="uc"+r(S.length,2)+S);var x="";return x+="\n\0",x+=r(C,2),x+=f.magic,x+=r(u,2),x+=r(h,2),x+=r(k.crc32,4),x+=r(k.compressedSize,4),x+=r(k.uncompressedSize,4),x+=r(g.length,2),x+=r(I.length,2),{fileRecord:l.LOCAL_FILE_HEADER+x+g+I,dirRecord:l.CENTRAL_FILE_HEADER+r(P,2)+x+r(y.length,2)+"\0\0\0\0"+r(N,4)+r(n,4)+g+I+y}}var a=e("../utils"),o=e("../stream/GenericWorker"),s=e("../utf8"),c=e("../crc32"),l=e("../signature");function d(e,t,i,r){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(d,o),d.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-r-1))/i:100}}))},d.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(e){this.accumulate=!1;var t,i=this.streamFiles&&!e.file.dir,a=n(e,i,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(a.dirRecord),i)this.push({data:(t=e,l.DATA_DESCRIPTOR+r(t.crc32,4)+r(t.compressedSize,4)+r(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:a.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i,n,o,s,c,d,u=this.bytesWritten-e,h=(i=this.dirRecords.length,n=u,o=e,s=this.zipComment,c=this.encodeFileName,d=a.transformTo("string",c(s)),l.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(i,2)+r(i,2)+r(n,4)+r(o,4)+r(d.length,2)+d);this.push({data:h,meta:{percent:100}})},d.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},d.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},d.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},d.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch(r){}return!0},d.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=d},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,i){var r=e("../compressions"),n=e("./ZipFileWorker");i.generateWorker=function(e,t,i){var a=new n(t.streamFiles,i,t.platform,t.encodeFileName),o=0;try{e.forEach(function(e,i){o++;var n=function(e,t){var i=e||t,n=r[i];if(!n)throw new Error(i+" is not a valid compression method !");return n}(i.options.compression,t.compression),s=i.options.compressionOptions||t.compressionOptions||{},c=i.dir,l=i.date;i._compressWorker(n,s).withStreamInfo("file",{name:e,dir:c,date:l,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(a)}),a.entriesCount=o}catch(s){a.error(s)}return a}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new r;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.1",r.loadAsync=function(e,t){return(new r).loadAsync(e,t)},r.external=e("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){var r=e("./utils"),n=e("./external"),a=e("./utf8"),o=e("./zipEntries"),s=e("./stream/Crc32Probe"),c=e("./nodejsUtils");function l(e){return new n.Promise(function(t,i){var r=e.decompressed.getContentWorker().pipe(new s);r.on("error",function(e){i(e)}).on("end",function(){r.streamInfo.crc32!==e.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}t.exports=function(e,t){var i=this;return t=r.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),c.isNode&&c.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var i=new o(t);return i.load(e),i}).then(function(e){var i=[n.Promise.resolve(e)],r=e.files;if(t.checkCRC32)for(var a=0;a<r.length;a++)i.push(l(r[a]));return n.Promise.all(i)}).then(function(e){for(var n=e.shift(),a=n.files,o=0;o<a.length;o++){var s=a[o],c=s.fileNameStr,l=r.resolve(s.fileNameStr);i.file(l,s.decompressed,{binary:!0,optimizedBinaryString:!0,date:s.date,dir:s.dir,comment:s.fileCommentStr.length?s.fileCommentStr:null,unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions,createFolders:t.createFolders}),s.dir||(i.file(l).unsafeOriginalName=c)}return n.zipComment.length&&(i.comment=n.zipComment),i})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var r=e("../utils"),n=e("../stream/GenericWorker");function a(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}r.inherits(a,n),a.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},a.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var r=e("readable-stream").Readable;function n(e,t,i){r.call(this,t),this._helper=e;var n=this;e.on("data",function(e,t){n.push(e)||n._helper.pause(),i&&i(t)}).on("error",function(e){n.emit("error",e)}).on("end",function(){n.push(null)})}e("../utils").inherits(n,r),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,i){t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,i){function r(e,t,i){var r,n=a.getTypeOf(t),s=a.extend(i||{},c);s.date=s.date||new Date,null!==s.compression&&(s.compression=s.compression.toUpperCase()),"string"==typeof s.unixPermissions&&(s.unixPermissions=parseInt(s.unixPermissions,8)),s.unixPermissions&&16384&s.unixPermissions&&(s.dir=!0),s.dosPermissions&&16&s.dosPermissions&&(s.dir=!0),s.dir&&(e=m(e)),s.createFolders&&(r=f(e))&&g.call(this,r,!0);var u="string"===n&&!1===s.binary&&!1===s.base64;i&&void 0!==i.binary||(s.binary=!u),(t instanceof l&&0===t.uncompressedSize||s.dir||!t||0===t.length)&&(s.base64=!1,s.binary=!0,t="",s.compression="STORE",n="string");var _;_=t instanceof l||t instanceof o?t:h.isNode&&h.isStream(t)?new p(e,t):a.prepareContent(e,t,s.binary,s.optimizedBinaryString,s.base64);var v=new d(e,_,s);this.files[e]=v}var n=e("./utf8"),a=e("./utils"),o=e("./stream/GenericWorker"),s=e("./stream/StreamHelper"),c=e("./defaults"),l=e("./compressedObject"),d=e("./zipObject"),u=e("./generate"),h=e("./nodejsUtils"),p=e("./nodejs/NodejsStreamInputAdapter"),f=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},g=function(e,t){return t=void 0!==t?t:c.createFolders,e=m(e),this.files[e]||r.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function _(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var v={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,r;for(t in this.files)r=this.files[t],(i=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(i,r)},filter:function(e){var t=[];return this.forEach(function(i,r){e(i,r)&&t.push(r)}),t},file:function(e,t,i){if(1!==arguments.length)return e=this.root+e,r.call(this,e,t,i),this;if(_(e)){var n=e;return this.filter(function(e,t){return!t.dir&&n.test(e)})}var a=this.files[this.root+e];return a&&!a.dir?a:null},folder:function(e){if(!e)return this;if(_(e))return this.filter(function(t,i){return i.dir&&e.test(t)});var t=this.root+e,i=g.call(this,t),r=this.clone();return r.root=i.name,r},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var i=this.filter(function(t,i){return i.name.slice(0,e.length)===e}),r=0;r<i.length;r++)delete this.files[i[r].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,i={};try{if((i=a.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),"binarystring"===i.type&&(i.type="string"),!i.type)throw new Error("No output type specified.");a.checkSupport(i.type),"darwin"!==i.platform&&"freebsd"!==i.platform&&"linux"!==i.platform&&"sunos"!==i.platform||(i.platform="UNIX"),"win32"===i.platform&&(i.platform="DOS");var r=i.comment||this.comment||"";t=u.generateWorker(this,i,r)}catch(c){(t=new o("error")).error(c)}return new s(t,i.type||"string",i.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=v},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),n=e.charCodeAt(3),a=this.length-4;0<=a;--a)if(this.data[a]===t&&this.data[a+1]===i&&this.data[a+2]===r&&this.data[a+3]===n)return a-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),n=e.charCodeAt(3),a=this.readData(4);return t===a[0]&&i===a[1]&&r===a[2]&&n===a[3]},n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var r=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,i=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)i=(i<<8)+this.byteAt(t);return this.index+=e,i},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var r=e("./Uint8ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var r=e("./ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var r=e("../utils"),n=e("../support"),a=e("./ArrayReader"),o=e("./StringReader"),s=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new s(e):n.uint8array?new c(r.transformTo("uint8array",e)):new a(r.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,i){var r=e("./GenericWorker"),n=e("../utils");function a(e){r.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var r=e("./GenericWorker"),n=e("../crc32");function a(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,n),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(a,n),a.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=r},{}],29:[function(e,t,i){var r=e("../utils"),n=e("./ConvertWorker"),a=e("./GenericWorker"),o=e("../base64"),s=e("../support"),c=e("../external"),l=null;if(s.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(u){}function d(e,t,i){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=i,r.checkSupport(o),this._worker=e.pipe(new n(o)),e.lock()}catch(s){this._worker=new a("error"),this._worker.error(s)}}d.prototype={accumulate:function(e){return function(e,t){return new c.Promise(function(i,n){var a=[],s=e._internalType,c=e._outputType,l=e._mimeType;e.on("data",function(e,i){a.push(e),t&&t(i)}).on("error",function(e){a=[],n(e)}).on("end",function(){try{var e=function(e,t,i){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),i);case"base64":return o.encode(t);default:return r.transformTo(e,t)}}(c,function(e,t){var i,r=0,n=null,a=0;for(i=0;i<t.length;i++)a+=t[i].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(n=new Uint8Array(a),i=0;i<t.length;i++)n.set(t[i],r),r+=t[i].length;return n;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(s,a),l);i(e)}catch(t){n(t)}a=[]}).resume()})}(this,e)},on:function(e,t){var i=this;return"data"===e?this._worker.on(e,function(e){t.call(i,e.data,e.meta)}):this._worker.on(e,function(){r.delay(t,arguments,i)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(r.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,i.nodebuffer="undefined"!=typeof Buffer,i.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)i.blob=!1;else{var r=new ArrayBuffer(0);try{i.blob=0===new Blob([r],{type:"application/zip"}).size}catch(a){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(r),i.blob=0===n.getBlob("application/zip").size}catch(ZA){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(a){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var r=e("./utils"),n=e("./support"),a=e("./nodejsUtils"),o=e("./stream/GenericWorker"),s=new Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function l(){o.call(this,"utf-8 decode"),this.leftOver=null}function d(){o.call(this,"utf-8 encode")}s[254]=s[254]=1,i.utf8encode=function(e){return n.nodebuffer?a.newBufferFrom(e,"utf-8"):function(e){var t,i,r,a,o,s=e.length,c=0;for(a=0;a<s;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(r=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(r-56320),a++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=n.uint8array?new Uint8Array(c):new Array(c),a=o=0;o<c;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(r=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(r-56320),a++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t}(e)},i.utf8decode=function(e){return n.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,i,n,a,o=e.length,c=new Array(2*o);for(t=i=0;t<o;)if((n=e[t++])<128)c[i++]=n;else if(4<(a=s[n]))c[i++]=65533,t+=a-1;else{for(n&=2===a?31:3===a?15:7;1<a&&t<o;)n=n<<6|63&e[t++],a--;1<a?c[i++]=65533:n<65536?c[i++]=n:(n-=65536,c[i++]=55296|n>>10&1023,c[i++]=56320|1023&n)}return c.length!==i&&(c.subarray?c=c.subarray(0,i):c.length=i),r.applyFromCharCode(c)}(e=r.transformTo(n.uint8array?"uint8array":"array",e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+s[e[i]]>t?i:t}(t),c=t;o!==t.length&&(n.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:i.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=l,r.inherits(d,o),d.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=d},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){var r=e("./support"),n=e("./base64"),a=e("./nodejsUtils"),o=e("./external");function s(e){return e}function c(e,t){for(var i=0;i<e.length;++i)t[i]=255&e.charCodeAt(i);return t}e("setimmediate"),i.newBlob=function(e,t){i.checkSupport("blob");try{return new Blob([e],{type:t})}catch(n){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(e),r.getBlob(t)}catch(a){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(e,t,i){var r=[],n=0,a=e.length;if(a<=i)return String.fromCharCode.apply(null,e);for(;n<a;)"array"===t||"nodebuffer"===t?r.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+i,a)))):r.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+i,a)))),n+=i;return r.join("")},stringifyByChar:function(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&1===String.fromCharCode.apply(null,a.allocBuffer(1)).length}catch(e){return!1}}()}};function d(e){var t=65536,r=i.getTypeOf(e),n=!0;if("uint8array"===r?n=l.applyCanBeUsed.uint8array:"nodebuffer"===r&&(n=l.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return l.stringifyByChunk(e,r,t)}catch(a){t=Math.floor(t/2)}return l.stringifyByChar(e)}function u(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}i.applyFromCharCode=d;var h={};h.string={string:s,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return h.string.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:function(e){return c(e,a.allocBuffer(e.length))}},h.array={string:d,array:s,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return a.newBufferFrom(e)}},h.arraybuffer={string:function(e){return d(new Uint8Array(e))},array:function(e){return u(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:s,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return a.newBufferFrom(new Uint8Array(e))}},h.uint8array={string:d,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:s,nodebuffer:function(e){return a.newBufferFrom(e)}},h.nodebuffer={string:d,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return h.nodebuffer.uint8array(e).buffer},uint8array:function(e){return u(e,new Uint8Array(e.length))},nodebuffer:s},i.transformTo=function(e,t){if(t=t||"",!e)return t;i.checkSupport(e);var r=i.getTypeOf(t);return h[r][e](t)},i.resolve=function(e){for(var t=e.split("/"),i=[],r=0;r<t.length;r++){var n=t[r];"."===n||""===n&&0!==r&&r!==t.length-1||(".."===n?i.pop():i.push(n))}return i.join("/")},i.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":r.nodebuffer&&a.isBuffer(e)?"nodebuffer":r.uint8array&&e instanceof Uint8Array?"uint8array":r.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(e){if(!r[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(e){var t,i,r="";for(i=0;i<(e||"").length;i++)r+="\\x"+((t=e.charCodeAt(i))<16?"0":"")+t.toString(16).toUpperCase();return r},i.delay=function(e,t,i){setImmediate(function(){e.apply(i||null,t||[])})},i.inherits=function(e,t){function i(){}i.prototype=t.prototype,e.prototype=new i},i.extend=function(){var e,t,i={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===i[t]&&(i[t]=arguments[e][t]);return i},i.prepareContent=function(e,t,a,s,l){return o.Promise.resolve(t).then(function(e){return r.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise(function(t,i){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=function(e){i(e.target.error)},r.readAsArrayBuffer(e)}):e}).then(function(t){var d,u=i.getTypeOf(t);return u?("arraybuffer"===u?t=i.transformTo("uint8array",t):"string"===u&&(l?t=n.decode(t):a&&!0!==s&&(t=c(d=t,r.uint8array?new Uint8Array(d.length):new Array(d.length)))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),a=e("./signature"),o=e("./zipEntry"),s=e("./support");function c(e){this.files=[],this.loadOptions=e}c.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var i=this.reader.index;this.reader.setIndex(e);var r=this.reader.readString(4)===t;return this.reader.setIndex(i),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=s.uint8array?"uint8array":"array",i=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(i)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,i,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),i=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var r=t-i;if(0<r)this.isSignature(t,a.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=r(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),a=e("./compressedObject"),o=e("./crc32"),s=e("./utf8"),c=e("./compressions"),l=e("./support");function d(e,t){this.options=e,this.loadOptions=t}d.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in c)if(Object.prototype.hasOwnProperty.call(c,t)&&c[t].magic===e)return c[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,i,r,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),i=e.readInt(2),r=e.readData(i),this.extraFields[t]={id:t,length:i,value:r};e.setIndex(n)},handleUTF8:function(){var e=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=s.utf8decode(this.fileName),this.fileCommentStr=s.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var i=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var a=n.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(a)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=r(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:s.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=r(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:s.utf8decode(t.readData(e.length-5))}return null}},t.exports=d},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,i){function r(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}var n=e("./stream/StreamHelper"),a=e("./stream/DataWorker"),o=e("./utf8"),s=e("./compressedObject"),c=e("./stream/GenericWorker");r.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");var r="string"===(i=e.toLowerCase())||"text"===i;"binarystring"!==i&&"text"!==i||(i="string"),t=this._decompressWorker();var a=!this._dataBinary;a&&!r&&(t=t.pipe(new o.Utf8EncodeWorker)),!a&&r&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(s){(t=new c("error")).error(s)}return new n(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof s&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new o.Utf8EncodeWorker)),s.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof s?this._data.getContentWorker():this._data instanceof c?this._data:new a(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],d=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u<l.length;u++)r.prototype[l[u]]=d;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){var i,r,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var a=0,o=new n(d),s=e.document.createTextNode("");o.observe(s,{characterData:!0}),i=function(){s.data=a=++a%2}}else if(e.setImmediate||void 0===e.MessageChannel)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){d(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(d,0)};else{var c=new e.MessageChannel;c.port1.onmessage=d,i=function(){c.port2.postMessage(0)}}var l=[];function d(){var e,t;r=!0;for(var i=l.length;i;){for(t=l,l=[],e=-1;++e<i;)t[e]();i=l.length}r=!1}t.exports=function(e){1!==l.push(e)||r||i()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,i){var r=e("immediate");function n(){}var a={},o=["REJECTED"],s=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==n&&p(this,e)}function d(e,t,i){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function u(e,t,i){r(function(){var r;try{r=t(i)}catch(fL){return a.reject(e,fL)}r===e?a.reject(e,new TypeError("Cannot resolve promise with itself")):a.resolve(e,r)})}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var i=!1;function r(t){i||(i=!0,a.reject(e,t))}function n(t){i||(i=!0,a.resolve(e,t))}var o=f(function(){t(n,r)});"error"===o.status&&r(o.value)}function f(e,t){var i={};try{i.value=e(t),i.status="success"}catch(r){i.status="error",i.value=r}return i}(t.exports=l).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(i){return t.resolve(e()).then(function(){return i})},function(i){return t.resolve(e()).then(function(){throw i})})},l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===o)return this;var i=new this.constructor(n);return this.state!==c?u(i,this.state===s?e:t,this.outcome):this.queue.push(new d(i,e,t)),i},d.prototype.callFulfilled=function(e){a.resolve(this.promise,e)},d.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},d.prototype.callRejected=function(e){a.reject(this.promise,e)},d.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},a.resolve=function(e,t){var i=f(h,t);if("error"===i.status)return a.reject(e,i.value);var r=i.value;if(r)p(e,r);else{e.state=s,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},a.reject=function(e,t){e.state=o,e.outcome=t;for(var i=-1,r=e.queue.length;++i<r;)e.queue[i].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:a.resolve(new this(n),e)},l.reject=function(e){var t=new this(n);return a.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,r=!1;if(!i)return this.resolve([]);for(var o=new Array(i),s=0,c=-1,l=new this(n);++c<i;)d(e[c],c);return l;function d(e,n){t.resolve(e).then(function(e){o[n]=e,++s!==i||r||(r=!0,a.resolve(l,o))},function(e){r||(r=!0,a.reject(l,e))})}},l.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t,i=e.length,r=!1;if(!i)return this.resolve([]);for(var o=-1,s=new this(n);++o<i;)t=e[o],this.resolve(t).then(function(e){r||(r=!0,a.resolve(s,e))},function(e){r||(r=!0,a.reject(s,e))});return s}},{immediate:36}],38:[function(e,t,i){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){var r=e("./zlib/deflate"),n=e("./utils/common"),a=e("./utils/strings"),o=e("./zlib/messages"),s=e("./zlib/zstream"),c=Object.prototype.toString;function l(e){if(!(this instanceof l))return new l(e);this.options=n.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var i=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(o[i]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var d;if(d="string"==typeof t.dictionary?a.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=r.deflateSetDictionary(this.strm,d)))throw new Error(o[i]);this._dict_set=!0}}function d(e,t){var i=new l(t);if(i.push(e,!0),i.err)throw i.msg||o[i.err];return i.result}l.prototype.push=function(e,t){var i,o,s=this.strm,l=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?s.input=a.string2buf(e):"[object ArrayBuffer]"===c.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 n.Buf8(l),s.next_out=0,s.avail_out=l),1!==(i=r.deflate(s,o))&&0!==i)return this.onEnd(i),!(this.ended=!0);0!==s.avail_out&&(0!==s.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(a.buf2binstring(n.shrinkBuf(s.output,s.next_out))):this.onData(n.shrinkBuf(s.output,s.next_out)))}while((0<s.avail_in||0===s.avail_out)&&1!==i);return 4===o?(i=r.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==o||(this.onEnd(0),!(s.avail_out=0))},l.prototype.onData=function(e){this.chunks.push(e)},l.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Deflate=l,i.deflate=d,i.deflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},i.gzip=function(e,t){return(t=t||{}).gzip=!0,d(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){var r=e("./zlib/inflate"),n=e("./utils/common"),a=e("./utils/strings"),o=e("./zlib/constants"),s=e("./zlib/messages"),c=e("./zlib/zstream"),l=e("./zlib/gzheader"),d=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var i=r.inflateInit2(this.strm,t.windowBits);if(i!==o.Z_OK)throw new Error(s[i]);this.header=new l,r.inflateGetHeader(this.strm,this.header)}function h(e,t){var i=new u(t);if(i.push(e,!0),i.err)throw i.msg||s[i.err];return i.result}u.prototype.push=function(e,t){var i,s,c,l,u,h,p=this.strm,f=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;s=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?p.input=a.binstring2buf(e):"[object ArrayBuffer]"===d.call(e)?p.input=new Uint8Array(e):p.input=e,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new n.Buf8(f),p.next_out=0,p.avail_out=f),(i=r.inflate(p,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&m&&(h="string"==typeof m?a.string2buf(m):"[object ArrayBuffer]"===d.call(m)?new Uint8Array(m):m,i=r.inflateSetDictionary(this.strm,h)),i===o.Z_BUF_ERROR&&!0===g&&(i=o.Z_OK,g=!1),i!==o.Z_STREAM_END&&i!==o.Z_OK)return this.onEnd(i),!(this.ended=!0);p.next_out&&(0!==p.avail_out&&i!==o.Z_STREAM_END&&(0!==p.avail_in||s!==o.Z_FINISH&&s!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(c=a.utf8border(p.output,p.next_out),l=p.next_out-c,u=a.buf2string(p.output,c),p.next_out=l,p.avail_out=f-l,l&&n.arraySet(p.output,p.output,c,l,0),this.onData(u)):this.onData(n.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(g=!0)}while((0<p.avail_in||0===p.avail_out)&&i!==o.Z_STREAM_END);return i===o.Z_STREAM_END&&(s=o.Z_FINISH),s===o.Z_FINISH?(i=r.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===o.Z_OK):s!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(p.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=u,i.inflate=h,i.inflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},i.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+r),n);else for(var a=0;a<r;a++)e[n+a]=t[i+a]},flattenChunks:function(e){var t,i,r,n,a,o;for(t=r=0,i=e.length;t<i;t++)r+=e[t].length;for(o=new Uint8Array(r),t=n=0,i=e.length;t<i;t++)a=e[t],o.set(a,n),n+=a.length;return o}},a={arraySet:function(e,t,i,r,n){for(var a=0;a<r;a++)e[n+a]=t[i+a]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,a))},i.setTyped(r)},{}],42:[function(e,t,i){var r=e("./common"),n=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(l){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(l){a=!1}for(var o=new r.Buf8(256),s=0;s<256;s++)o[s]=252<=s?6:248<=s?5:240<=s?4:224<=s?3:192<=s?2:1;function c(e,t){if(t<65537&&(e.subarray&&a||!e.subarray&&n))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var i="",o=0;o<t;o++)i+=String.fromCharCode(e[o]);return i}o[254]=o[254]=1,i.string2buf=function(e){var t,i,n,a,o,s=e.length,c=0;for(a=0;a<s;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(n=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(n-56320),a++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=new r.Buf8(c),a=o=0;o<c;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(n=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(n-56320),a++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t},i.buf2binstring=function(e){return c(e,e.length)},i.binstring2buf=function(e){for(var t=new r.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){var i,r,n,a,s=t||e.length,l=new Array(2*s);for(i=r=0;i<s;)if((n=e[i++])<128)l[r++]=n;else if(4<(a=o[n]))l[r++]=65533,i+=a-1;else{for(n&=2===a?31:3===a?15:7;1<a&&i<s;)n=n<<6|63&e[i++],a--;1<a?l[r++]=65533:n<65536?l[r++]=n:(n-=65536,l[r++]=55296|n>>10&1023,l[r++]=56320|1023&n)}return c(l,r)},i.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+o[e[i]]>t?i:t}},{"./common":41}],43:[function(e,t,i){t.exports=function(e,t,i,r){for(var n=65535&e,a=e>>>16&65535,o=0;0!==i;){for(i-=o=2e3<i?2e3:i;a=a+(n=n+t[r++]|0)|0,--o;);n%=65521,a%=65521}return n|a<<16}},{}],44:[function(e,t,i){t.exports={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}},{}],45:[function(e,t,i){var r=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}();t.exports=function(e,t,i,n){var a=r,o=n+i;e^=-1;for(var s=n;s<o;s++)e=e>>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,i){var r,n=e("../utils/common"),a=e("./trees"),o=e("./adler32"),s=e("./crc32"),c=e("./messages"),l=-2,d=258,u=262,h=113;function p(e,t){return e.msg=c[t],t}function f(e){return(e<<1)-(4<e?9:0)}function m(e){for(var t=e.length;0<=--t;)e[t]=0}function g(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(n.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 _(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,g(e.strm)}function v(e,t){e.pending_buf[e.pending++]=t}function y(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function E(e,t){var i,r,n=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-u?e.strstart-(e.w_size-u):0,l=e.window,h=e.w_mask,p=e.prev,f=e.strstart+d,m=l[a+o-1],g=l[a+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(l[(i=t)+o]===g&&l[i+o-1]===m&&l[i]===l[a]&&l[++i]===l[a+1]){a+=2,i++;do{}while(l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&a<f);if(r=d-(f-a),a=f-d,o<r){if(e.match_start=t,s<=(o=r))break;m=l[a+o-1],g=l[a+o]}}}while((t=p[t&h])>c&&0!=--n);return o<=e.lookahead?o:e.lookahead}function b(e){var t,i,r,a,c,l,d,h,p,f,m=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-u)){for(n.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=i=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--i;);for(t=i=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--i;);a+=m}if(0===e.strm.avail_in)break;if(l=e.strm,d=e.window,h=e.strstart+e.lookahead,f=void 0,(p=a)<(f=l.avail_in)&&(f=p),i=0===f?0:(l.avail_in-=f,n.arraySet(d,l.input,l.next_in,f,h),1===l.state.wrap?l.adler=o(l.adler,d,f,h):2===l.state.wrap&&(l.adler=s(l.adler,d,f,h)),l.next_in+=f,l.total_in+=f,f),e.lookahead+=i,e.lookahead+e.insert>=3)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+3-1])&e.hash_mask,e.prev[c&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=c,c++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<u&&0!==e.strm.avail_in)}function w(e,t){for(var i,r;;){if(e.lookahead<u){if(b(e),e.lookahead<u&&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-u&&(e.match_length=E(e,i)),e.match_length>=3)if(r=a._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){for(e.match_length--;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,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=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(_(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(_(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_(e,!1),0===e.strm.avail_out)?1:2}function I(e,t){for(var i,r,n;;){if(e.lookahead<u){if(b(e),e.lookahead<u&&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-u&&(e.match_length=E(e,i),e.match_length<=5&&(1===e.strategy||3===e.match_length&&4096<e.strstart-e.match_start)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-3,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++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),0!=--e.prev_length;);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(_(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=a._tr_tally(e,0,e.window[e.strstart-1]))&&_(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=a._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(_(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_(e,!1),0===e.strm.avail_out)?1:2}function T(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 S(){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 n.Buf16(1146),this.dyn_dtree=new n.Buf16(122),this.bl_tree=new n.Buf16(78),m(this.dyn_ltree),m(this.dyn_dtree),m(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(16),this.heap=new n.Buf16(573),m(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(573),m(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function A(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:h,e.adler=2===t.wrap?0:1,t.last_flush=0,a._tr_init(t),0):p(e,l)}function R(e){var t,i=A(e);return 0===i&&((t=e.state).window_size=2*t.w_size,m(t.head),t.max_lazy_match=r[t.level].max_lazy,t.good_match=r[t.level].good_length,t.nice_match=r[t.level].nice_length,t.max_chain_length=r[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 k(e,t,i,r,a,o){if(!e)return l;var s=1;if(-1===t&&(t=6),r<0?(s=0,r=-r):15<r&&(s=2,r-=16),a<1||9<a||8!==i||r<8||15<r||t<0||9<t||o<0||4<o)return p(e,l);8===r&&(r=9);var c=new S;return(e.state=c).strm=e,c.wrap=s,c.gzhead=null,c.w_bits=r,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=a+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+3-1)/3),c.window=new n.Buf8(2*c.w_size),c.head=new n.Buf16(c.hash_size),c.prev=new n.Buf16(c.w_size),c.lit_bufsize=1<<a+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new n.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=t,c.strategy=o,c.method=i,R(e)}r=[new T(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(b(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,_(e,!1),0===e.strm.avail_out)||e.strstart-e.block_start>=e.w_size-u&&(_(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(_(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(_(e,!1),e.strm.avail_out),1)}),new T(4,4,8,4,w),new T(4,5,16,8,w),new T(4,6,32,32,w),new T(4,4,16,16,I),new T(8,16,32,32,I),new T(8,16,128,128,I),new T(8,32,128,256,I),new T(32,128,258,1024,I),new T(32,258,258,4096,I)],i.deflateInit=function(e,t){return k(e,t,8,15,8,0)},i.deflateInit2=k,i.deflateReset=R,i.deflateResetKeep=A,i.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?l:(e.state.gzhead=t,0):l},i.deflate=function(e,t){var i,n,o,c;if(!e||!e.state||5<t||t<0)return e?p(e,l):l;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&4!==t)return p(e,0===e.avail_out?-5:l);if(n.strm=e,i=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,v(n,31),v(n,139),v(n,8),n.gzhead?(v(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),v(n,255&n.gzhead.time),v(n,n.gzhead.time>>8&255),v(n,n.gzhead.time>>16&255),v(n,n.gzhead.time>>24&255),v(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),v(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(v(n,255&n.gzhead.extra.length),v(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=s(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(v(n,0),v(n,0),v(n,0),v(n,0),v(n,0),v(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),v(n,3),n.status=h);else{var u=8+(n.w_bits-8<<4)<<8;u|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(u|=32),u+=31-u%31,n.status=h,y(n,u),0!==n.strstart&&(y(n,e.adler>>>16),y(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending!==n.pending_buf_size));)v(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,v(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,v(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&g(e),n.pending+2<=n.pending_buf_size&&(v(n,255&e.adler),v(n,e.adler>>8&255),e.adler=0,n.status=h)):n.status=h),0!==n.pending){if(g(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&f(t)<=f(i)&&4!==t)return p(e,-5);if(666===n.status&&0!==e.avail_in)return p(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var E=2===n.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(b(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(_(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(_(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var i,r,n,o,s=e.window;;){if(e.lookahead<=d){if(b(e),e.lookahead<=d&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0<e.strstart&&(r=s[n=e.strstart-1])===s[++n]&&r===s[++n]&&r===s[++n]){o=e.strstart+d;do{}while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&n<o);e.match_length=d-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=a._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(_(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(_(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_(e,!1),0===e.strm.avail_out)?1:2}(n,t):r[n.level].func(n,t);if(3!==E&&4!==E||(n.status=666),1===E||3===E)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===E&&(1===t?a._tr_align(n):5!==t&&(a._tr_stored_block(n,0,0,!1),3===t&&(m(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),g(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(v(n,255&e.adler),v(n,e.adler>>8&255),v(n,e.adler>>16&255),v(n,e.adler>>24&255),v(n,255&e.total_in),v(n,e.total_in>>8&255),v(n,e.total_in>>16&255),v(n,e.total_in>>24&255)):(y(n,e.adler>>>16),y(n,65535&e.adler)),g(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?0:1)},i.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&t!==h&&666!==t?p(e,l):(e.state=null,t===h?p(e,-3):0):l},i.deflateSetDictionary=function(e,t){var i,r,a,s,c,d,u,h,p=t.length;if(!e||!e.state||2===(s=(i=e.state).wrap)||1===s&&42!==i.status||i.lookahead)return l;for(1===s&&(e.adler=o(e.adler,t,p,0)),i.wrap=0,p>=i.w_size&&(0===s&&(m(i.head),i.strstart=0,i.block_start=0,i.insert=0),h=new n.Buf8(i.w_size),n.arraySet(h,t,p-i.w_size,i.w_size,0),t=h,p=i.w_size),c=e.avail_in,d=e.next_in,u=e.input,e.avail_in=p,e.next_in=0,e.input=t,b(i);i.lookahead>=3;){for(r=i.strstart,a=i.lookahead-2;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++,--a;);i.strstart=r,i.lookahead=2,b(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=d,e.input=u,e.avail_in=c,i.wrap=s,0},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){t.exports=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}},{}],48:[function(e,t,i){t.exports=function(e,t){var i,r,n,a,o,s,c,l,d,u,h,p,f,m,g,_,v,y,E,b,w,I,T,S,A;i=e.state,r=e.next_in,S=e.input,n=r+(e.avail_in-5),a=e.next_out,A=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=i.dmax,l=i.wsize,d=i.whave,u=i.wnext,h=i.window,p=i.hold,f=i.bits,m=i.lencode,g=i.distcode,_=(1<<i.lenbits)-1,v=(1<<i.distbits)-1;e:do{f<15&&(p+=S[r++]<<f,f+=8,p+=S[r++]<<f,f+=8),y=m[p&_];t:for(;;){if(p>>>=E=y>>>24,f-=E,0==(E=y>>>16&255))A[a++]=65535&y;else{if(!(16&E)){if(!(64&E)){y=m[(65535&y)+(p&(1<<E)-1)];continue t}if(32&E){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}b=65535&y,(E&=15)&&(f<E&&(p+=S[r++]<<f,f+=8),b+=p&(1<<E)-1,p>>>=E,f-=E),f<15&&(p+=S[r++]<<f,f+=8,p+=S[r++]<<f,f+=8),y=g[p&v];i:for(;;){if(p>>>=E=y>>>24,f-=E,!(16&(E=y>>>16&255))){if(!(64&E)){y=g[(65535&y)+(p&(1<<E)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(w=65535&y,f<(E&=15)&&(p+=S[r++]<<f,(f+=8)<E&&(p+=S[r++]<<f,f+=8)),c<(w+=p&(1<<E)-1)){e.msg="invalid distance too far back",i.mode=30;break e}if(p>>>=E,f-=E,(E=a-o)<w){if(d<(E=w-E)&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(T=h,(I=0)===u){if(I+=l-E,E<b){for(b-=E;A[a++]=h[I++],--E;);I=a-w,T=A}}else if(u<E){if(I+=l+u-E,(E-=u)<b){for(b-=E;A[a++]=h[I++],--E;);if(I=0,u<b){for(b-=E=u;A[a++]=h[I++],--E;);I=a-w,T=A}}}else if(I+=u-E,E<b){for(b-=E;A[a++]=h[I++],--E;);I=a-w,T=A}for(;2<b;)A[a++]=T[I++],A[a++]=T[I++],A[a++]=T[I++],b-=3;b&&(A[a++]=T[I++],1<b&&(A[a++]=T[I++]))}else{for(I=a-w;A[a++]=A[I++],A[a++]=A[I++],A[a++]=A[I++],2<(b-=3););b&&(A[a++]=A[I++],1<b&&(A[a++]=A[I++]))}break}}break}}while(r<n&&a<s);r-=b=f>>3,p&=(1<<(f-=b<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=a<s?s-a+257:257-(a-s),i.hold=p,i.bits=f}},{}],49:[function(e,t,i){var r=e("../utils/common"),n=e("./adler32"),a=e("./crc32"),o=e("./inffast"),s=e("./inftrees"),c=-2;function l(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function d(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function u(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 r.Buf32(852),t.distcode=t.distdyn=new r.Buf32(592),t.sane=1,t.back=-1,0):c}function h(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,u(e)):c}function p(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||15<t)?c:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,h(e))):c}function f(e,t){var i,r;return e?(r=new d,(e.state=r).window=null,0!==(i=p(e,t))&&(e.state=null),i):c}var m,g,_=!0;function v(e){if(_){var t;for(m=new r.Buf32(512),g=new r.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(s(1,e.lens,0,288,m,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(2,e.lens,0,32,g,0,e.work,{bits:5}),_=!1}e.lencode=m,e.lenbits=9,e.distcode=g,e.distbits=5}function y(e,t,i,n){var a,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new r.Buf8(o.wsize)),n>=o.wsize?(r.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(a=o.wsize-o.wnext)&&(a=n),r.arraySet(o.window,t,i-n,a,o.wnext),(n-=a)?(r.arraySet(o.window,t,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=a))),0}i.inflateReset=h,i.inflateReset2=p,i.inflateResetKeep=u,i.inflateInit=function(e){return f(e,15)},i.inflateInit2=f,i.inflate=function(e,t){var i,d,u,h,p,f,m,g,_,E,b,w,I,T,S,A,R,k,C,D,O,L,N,P,x=0,M=new r.Buf8(4),U=[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 c;12===(i=e.state).mode&&(i.mode=13),p=e.next_out,u=e.output,m=e.avail_out,h=e.next_in,d=e.input,f=e.avail_in,g=i.hold,_=i.bits,E=f,b=m,L=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;_<16;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(2&i.wrap&&35615===g){M[i.check=0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0),_=g=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&g)<<8)+(g>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&g)){e.msg="unknown compression method",i.mode=30;break}if(_-=4,O=8+(15&(g>>>=4)),0===i.wbits)i.wbits=O;else if(O>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<O,e.adler=i.check=1,i.mode=512&g?10:12,_=g=0;break;case 2:for(;_<16;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(i.flags=g,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=g>>8&1),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0)),_=g=0,i.mode=3;case 3:for(;_<32;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}i.head&&(i.head.time=g),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,M[2]=g>>>16&255,M[3]=g>>>24&255,i.check=a(i.check,M,4,0)),_=g=0,i.mode=4;case 4:for(;_<16;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}i.head&&(i.head.xflags=255&g,i.head.os=g>>8),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0)),_=g=0,i.mode=5;case 5:if(1024&i.flags){for(;_<16;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}i.length=g,i.head&&(i.head.extra_len=g),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0)),_=g=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(f<(w=i.length)&&(w=f),w&&(i.head&&(O=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),r.arraySet(i.head.extra,d,h,w,O)),512&i.flags&&(i.check=a(i.check,d,w,h)),f-=w,h+=w,i.length-=w),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===f)break e;for(w=0;O=d[h+w++],i.head&&O&&i.length<65536&&(i.head.name+=String.fromCharCode(O)),O&&w<f;);if(512&i.flags&&(i.check=a(i.check,d,w,h)),f-=w,h+=w,O)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===f)break e;for(w=0;O=d[h+w++],i.head&&O&&i.length<65536&&(i.head.comment+=String.fromCharCode(O)),O&&w<f;);if(512&i.flags&&(i.check=a(i.check,d,w,h)),f-=w,h+=w,O)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;_<16;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(g!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}_=g=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(;_<32;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}e.adler=i.check=l(g),_=g=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,i.hold=g,i.bits=_,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){g>>>=7&_,_-=7&_,i.mode=27;break}for(;_<3;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}switch(i.last=1&g,_-=1,3&(g>>>=1)){case 0:i.mode=14;break;case 1:if(v(i),i.mode=20,6!==t)break;g>>>=2,_-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}g>>>=2,_-=2;break;case 14:for(g>>>=7&_,_-=7&_;_<32;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if((65535&g)!=(g>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&g,_=g=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(w=i.length){if(f<w&&(w=f),m<w&&(w=m),0===w)break e;r.arraySet(u,d,h,w,p),f-=w,h+=w,m-=w,p+=w,i.length-=w;break}i.mode=12;break;case 17:for(;_<14;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(i.nlen=257+(31&g),g>>>=5,_-=5,i.ndist=1+(31&g),g>>>=5,_-=5,i.ncode=4+(15&g),g>>>=4,_-=4,286<i.nlen||30<i.ndist){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(;_<3;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}i.lens[U[i.have++]]=7&g,g>>>=3,_-=3}for(;i.have<19;)i.lens[U[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,N={bits:i.lenbits},L=s(0,i.lens,0,19,i.lencode,0,i.work,N),i.lenbits=N.bits,L){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(;A=(x=i.lencode[g&(1<<i.lenbits)-1])>>>16&255,R=65535&x,!((S=x>>>24)<=_);){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(R<16)g>>>=S,_-=S,i.lens[i.have++]=R;else{if(16===R){for(P=S+2;_<P;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(g>>>=S,_-=S,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}O=i.lens[i.have-1],w=3+(3&g),g>>>=2,_-=2}else if(17===R){for(P=S+3;_<P;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}_-=S,O=0,w=3+(7&(g>>>=S)),g>>>=3,_-=3}else{for(P=S+7;_<P;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}_-=S,O=0,w=11+(127&(g>>>=S)),g>>>=7,_-=7}if(i.have+w>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;w--;)i.lens[i.have++]=O}}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,N={bits:i.lenbits},L=s(1,i.lens,0,i.nlen,i.lencode,0,i.work,N),i.lenbits=N.bits,L){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,N={bits:i.distbits},L=s(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,N),i.distbits=N.bits,L){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(6<=f&&258<=m){e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,i.hold=g,i.bits=_,o(e,b),p=e.next_out,u=e.output,m=e.avail_out,h=e.next_in,d=e.input,f=e.avail_in,g=i.hold,_=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;A=(x=i.lencode[g&(1<<i.lenbits)-1])>>>16&255,R=65535&x,!((S=x>>>24)<=_);){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(A&&!(240&A)){for(k=S,C=A,D=R;A=(x=i.lencode[D+((g&(1<<k+C)-1)>>k)])>>>16&255,R=65535&x,!(k+(S=x>>>24)<=_);){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}g>>>=k,_-=k,i.back+=k}if(g>>>=S,_-=S,i.back+=S,i.length=R,0===A){i.mode=26;break}if(32&A){i.back=-1,i.mode=12;break}if(64&A){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&A,i.mode=22;case 22:if(i.extra){for(P=i.extra;_<P;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}i.length+=g&(1<<i.extra)-1,g>>>=i.extra,_-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;A=(x=i.distcode[g&(1<<i.distbits)-1])>>>16&255,R=65535&x,!((S=x>>>24)<=_);){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(!(240&A)){for(k=S,C=A,D=R;A=(x=i.distcode[D+((g&(1<<k+C)-1)>>k)])>>>16&255,R=65535&x,!(k+(S=x>>>24)<=_);){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}g>>>=k,_-=k,i.back+=k}if(g>>>=S,_-=S,i.back+=S,64&A){e.msg="invalid distance code",i.mode=30;break}i.offset=R,i.extra=15&A,i.mode=24;case 24:if(i.extra){for(P=i.extra;_<P;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}i.offset+=g&(1<<i.extra)-1,g>>>=i.extra,_-=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===m)break e;if(w=b-m,i.offset>w){if((w=i.offset-w)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}I=w>i.wnext?(w-=i.wnext,i.wsize-w):i.wnext-w,w>i.length&&(w=i.length),T=i.window}else T=u,I=p-i.offset,w=i.length;for(m<w&&(w=m),m-=w,i.length-=w;u[p++]=T[I++],--w;);0===i.length&&(i.mode=21);break;case 26:if(0===m)break e;u[p++]=i.length,m--,i.mode=21;break;case 27:if(i.wrap){for(;_<32;){if(0===f)break e;f--,g|=d[h++]<<_,_+=8}if(b-=m,e.total_out+=b,i.total+=b,b&&(e.adler=i.check=i.flags?a(i.check,u,b,p-b):n(i.check,u,b,p-b)),b=m,(i.flags?g:l(g))!==i.check){e.msg="incorrect data check",i.mode=30;break}_=g=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;_<32;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(g!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}_=g=0}i.mode=29;case 29:L=1;break e;case 30:L=-3;break e;case 31:return-4;default:return c}return e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,i.hold=g,i.bits=_,(i.wsize||b!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&y(e,e.output,e.next_out,b-e.avail_out)?(i.mode=31,-4):(E-=e.avail_in,b-=e.avail_out,e.total_in+=E,e.total_out+=b,i.total+=b,i.wrap&&b&&(e.adler=i.check=i.flags?a(i.check,u,b,e.next_out-b):n(i.check,u,b,e.next_out-b)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0==E&&0===b||4===t)&&0===L&&(L=-5),L)},i.inflateEnd=function(e){if(!e||!e.state)return c;var t=e.state;return t.window&&(t.window=null),e.state=null,0},i.inflateGetHeader=function(e,t){var i;return e&&e.state&&2&(i=e.state).wrap?((i.head=t).done=!1,0):c},i.inflateSetDictionary=function(e,t){var i,r=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?c:11===i.mode&&n(1,t,r,0)!==i.check?-3:y(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,0):c},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){var r=e("../utils/common"),n=[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],a=[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],o=[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],s=[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];t.exports=function(e,t,i,c,l,d,u,h){var p,f,m,g,_,v,y,E,b,w=h.bits,I=0,T=0,S=0,A=0,R=0,k=0,C=0,D=0,O=0,L=0,N=null,P=0,x=new r.Buf16(16),M=new r.Buf16(16),U=null,F=0;for(I=0;I<=15;I++)x[I]=0;for(T=0;T<c;T++)x[t[i+T]]++;for(R=w,A=15;1<=A&&0===x[A];A--);if(A<R&&(R=A),0===A)return l[d++]=20971520,l[d++]=20971520,h.bits=1,0;for(S=1;S<A&&0===x[S];S++);for(R<S&&(R=S),I=D=1;I<=15;I++)if(D<<=1,(D-=x[I])<0)return-1;if(0<D&&(0===e||1!==A))return-1;for(M[1]=0,I=1;I<15;I++)M[I+1]=M[I]+x[I];for(T=0;T<c;T++)0!==t[i+T]&&(u[M[t[i+T]]++]=T);if(v=0===e?(N=U=u,19):1===e?(N=n,P-=257,U=a,F-=257,256):(N=o,U=s,-1),I=S,_=d,C=T=L=0,m=-1,g=(O=1<<(k=R))-1,1===e&&852<O||2===e&&592<O)return 1;for(;;){for(y=I-C,b=u[T]<v?(E=0,u[T]):u[T]>v?(E=U[F+u[T]],N[P+u[T]]):(E=96,0),p=1<<I-C,S=f=1<<k;l[_+(L>>C)+(f-=p)]=y<<24|E<<16|b,0!==f;);for(p=1<<I-1;L&p;)p>>=1;if(0!==p?(L&=p-1,L+=p):L=0,T++,0==--x[I]){if(I===A)break;I=t[i+u[T]]}if(R<I&&(L&g)!==m){for(0===C&&(C=R),_+=S,D=1<<(k=I-C);k+C<A&&!((D-=x[k+C])<=0);)k++,D<<=1;if(O+=1<<k,1===e&&852<O||2===e&&592<O)return 1;l[m=L&g]=R<<24|k<<16|_-d}}return 0!==L&&(l[_+L]=I-C<<24|64<<16),h.bits=R,0}},{"../utils/common":41}],51:[function(e,t,i){t.exports={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"}},{}],52:[function(e,t,i){var r=e("../utils/common");function n(e){for(var t=e.length;0<=--t;)e[t]=0}var a=256,o=286,s=30,c=15,l=[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],d=[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],u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],h=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],p=new Array(576);n(p);var f=new Array(60);n(f);var m=new Array(512);n(m);var g=new Array(256);n(g);var _=new Array(29);n(_);var v,y,E,b=new Array(s);function w(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 I(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function T(e){return e<256?m[e]:m[256+(e>>>7)]}function S(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function A(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,S(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 R(e,t,i){A(e,i[2*t],i[2*t+1])}function k(e,t){for(var i=0;i|=1&e,e>>>=1,i<<=1,0<--t;);return i>>>1}function C(e,t,i){var r,n,a=new Array(16),o=0;for(r=1;r<=c;r++)a[r]=o=o+i[r-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=k(a[s]++,s))}}function D(e){var t;for(t=0;t<o;t++)e.dyn_ltree[2*t]=0;for(t=0;t<s;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 O(e){8<e.bi_valid?S(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function L(e,t,i,r){var n=2*t,a=2*i;return e[n]<e[a]||e[n]===e[a]&&r[t]<=r[i]}function N(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&L(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!L(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function P(e,t,i){var r,n,o,s,c=0;if(0!==e.last_lit)for(;r=e.pending_buf[e.d_buf+2*c]<<8|e.pending_buf[e.d_buf+2*c+1],n=e.pending_buf[e.l_buf+c],c++,0===r?R(e,n,t):(R(e,(o=g[n])+a+1,t),0!==(s=l[o])&&A(e,n-=_[o],s),R(e,o=T(--r),i),0!==(s=d[o])&&A(e,r-=b[o],s)),c<e.last_lit;);R(e,256,t)}function x(e,t){var i,r,n,a=t.dyn_tree,o=t.stat_desc.static_tree,s=t.stat_desc.has_stree,l=t.stat_desc.elems,d=-1;for(e.heap_len=0,e.heap_max=573,i=0;i<l;i++)0!==a[2*i]?(e.heap[++e.heap_len]=d=i,e.depth[i]=0):a[2*i+1]=0;for(;e.heap_len<2;)a[2*(n=e.heap[++e.heap_len]=d<2?++d:0)]=1,e.depth[n]=0,e.opt_len--,s&&(e.static_len-=o[2*n+1]);for(t.max_code=d,i=e.heap_len>>1;1<=i;i--)N(e,a,i);for(n=l;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],N(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,a[2*n]=a[2*i]+a[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,a[2*i+1]=a[2*r+1]=n,e.heap[1]=n++,N(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,n,a,o,s,l=t.dyn_tree,d=t.max_code,u=t.stat_desc.static_tree,h=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(a=0;a<=c;a++)e.bl_count[a]=0;for(l[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)m<(a=l[2*l[2*(r=e.heap[i])+1]+1]+1)&&(a=m,g++),l[2*r+1]=a,d<r||(e.bl_count[a]++,o=0,f<=r&&(o=p[r-f]),s=l[2*r],e.opt_len+=s*(a+o),h&&(e.static_len+=s*(u[2*r+1]+o)));if(0!==g){do{for(a=m-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[m]--,g-=2}while(0<g);for(a=m;0!==a;a--)for(r=e.bl_count[a];0!==r;)d<(n=e.heap[--i])||(l[2*n+1]!==a&&(e.opt_len+=(a-l[2*n+1])*l[2*n],l[2*n+1]=a),r--)}}(e,t),C(a,d,e.bl_count)}function M(e,t,i){var r,n,a=-1,o=t[1],s=0,c=7,l=4;for(0===o&&(c=138,l=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=o,o=t[2*(r+1)+1],++s<c&&n===o||(s<l?e.bl_tree[2*n]+=s:0!==n?(n!==a&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=n,l=(s=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4))}function U(e,t,i){var r,n,a=-1,o=t[1],s=0,c=7,l=4;for(0===o&&(c=138,l=3),r=0;r<=i;r++)if(n=o,o=t[2*(r+1)+1],!(++s<c&&n===o)){if(s<l)for(;R(e,n,e.bl_tree),0!=--s;);else 0!==n?(n!==a&&(R(e,n,e.bl_tree),s--),R(e,16,e.bl_tree),A(e,s-3,2)):s<=10?(R(e,17,e.bl_tree),A(e,s-3,3)):(R(e,18,e.bl_tree),A(e,s-11,7));a=n,l=(s=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4)}}n(b);var F=!1;function B(e,t,i,n){var a,o,s;A(e,0+(n?1:0),3),o=t,s=i,O(a=e),S(a,s),S(a,~s),r.arraySet(a.pending_buf,a.window,o,s,a.pending),a.pending+=s}i._tr_init=function(e){F||(function(){var e,t,i,r,n,a=new Array(16);for(r=i=0;r<28;r++)for(_[r]=i,e=0;e<1<<l[r];e++)g[i++]=r;for(g[i-1]=r,r=n=0;r<16;r++)for(b[r]=n,e=0;e<1<<d[r];e++)m[n++]=r;for(n>>=7;r<s;r++)for(b[r]=n<<7,e=0;e<1<<d[r]-7;e++)m[256+n++]=r;for(t=0;t<=c;t++)a[t]=0;for(e=0;e<=143;)p[2*e+1]=8,e++,a[8]++;for(;e<=255;)p[2*e+1]=9,e++,a[9]++;for(;e<=279;)p[2*e+1]=7,e++,a[7]++;for(;e<=287;)p[2*e+1]=8,e++,a[8]++;for(C(p,287,a),e=0;e<s;e++)f[2*e+1]=5,f[2*e]=k(e,5);v=new w(p,l,257,o,c),y=new w(f,d,0,s,c),E=new w(new Array(0),u,0,19,7)}(),F=!0),e.l_desc=new I(e.dyn_ltree,v),e.d_desc=new I(e.dyn_dtree,y),e.bl_desc=new I(e.bl_tree,E),e.bi_buf=0,e.bi_valid=0,D(e)},i._tr_stored_block=B,i._tr_flush_block=function(e,t,i,r){var n,o,s=0;0<e.level?(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<a;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),x(e,e.l_desc),x(e,e.d_desc),s=function(e){var t;for(M(e,e.dyn_ltree,e.l_desc.max_code),M(e,e.dyn_dtree,e.d_desc.max_code),x(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*h[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?B(e,t,i,r):4===e.strategy||o===n?(A(e,2+(r?1:0),3),P(e,p,f)):(A(e,4+(r?1:0),3),function(e,t,i,r){var n;for(A(e,t-257,5),A(e,i-1,5),A(e,r-4,4),n=0;n<r;n++)A(e,e.bl_tree[2*h[n]+1],3);U(e,e.dyn_ltree,t-1),U(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),P(e,e.dyn_ltree,e.dyn_dtree)),D(e),r&&O(e)},i._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*(g[i]+a+1)]++,e.dyn_dtree[2*T(t)]++),e.last_lit===e.lit_bufsize-1},i._tr_align=function(e){var t;A(e,2,3),R(e,256,p),16===(t=e).bi_valid?(S(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,i){t.exports=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}},{}],54:[function(e,t,i){(function(e){!function(e){if(!e.setImmediate){var t,i,r,n,a=1,o={},s=!1,c=e.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(e);l=l&&l.setTimeout?l:e,t="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick(function(){u(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?(n="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",h,!1):e.attachEvent("onmessage",h),function(t){e.postMessage(n+t,"*")}):e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){u(e.data)},function(e){r.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(i=c.documentElement,function(e){var t=c.createElement("script");t.onreadystatechange=function(){u(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):function(e){setTimeout(u,0,e)},l.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var i=new Array(arguments.length-1),r=0;r<i.length;r++)i[r]=arguments[r+1];var n={callback:e,args:i};return o[a]=n,t(a),a++},l.clearImmediate=d}function d(e){delete o[e]}function u(e){if(s)setTimeout(u,0,e);else{var t=o[e];if(t){s=!0;try{!function(e){var t=e.callback,i=e.args;switch(i.length){case 0:t();break;case 1:t(i[0]);break;case 2:t(i[0],i[1]);break;case 3:t(i[0],i[1],i[2]);break;default:t.apply(void 0,i)}}(t)}finally{d(e),s=!1}}}}function h(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(n)&&u(+t.data.slice(n.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)})}),BA=NA((e,t)=>{var i=Object.prototype.hasOwnProperty,r="~";function n(){}function a(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,i,n,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new a(i,n||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){0===--e._eventsCount?e._events=new n:delete e._events[t]}function c(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)i.call(e,t)&&n.push(r?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.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,a=i.length,o=new Array(a);n<a;n++)o[n]=i[n].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},c.prototype.emit=function(e,t,i,n,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c,l,d=this._events[s],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){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,a),!0;case 6:return d.fn.call(d.context,t,i,n,a,o),!0}for(l=1,c=new Array(u-1);l<u;l++)c[l-1]=arguments[l];d.fn.apply(d.context,c)}else{var h,p=d.length;for(l=0;l<p;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),u){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,i);break;case 4:d[l].fn.call(d[l].context,t,i,n);break;default:if(!c)for(h=1,c=new Array(u-1);h<u;h++)c[h-1]=arguments[h];d[l].fn.apply(d[l].context,c)}}return!0},c.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},c.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},c.prototype.removeListener=function(e,t,i,n){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!n||o.once)&&(!i||o.context===i)&&s(this,a);else{for(var c=0,l=[],d=o.length;c<d;c++)(o[c].fn!==t||n&&!o[c].once||i&&o[c].context!==i)&&l.push(o[c]);l.length?this._events[a]=1===l.length?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,void 0!==t&&(t.exports=c)}),VA=NA((e,t)=>{var i=t.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(i).forEach(function(e){i[e].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})}),HA=NA(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 a=e.push?{}:n?i[e.name]:i;(function(e,i,r,n){if(n&&!r)i[n]=t(e[1]);else for(var a=0;a<r.length;a+=1)null!=e[a+1]&&(i[r[a]]=t(e[a+1]))})(r.match(e.reg),a,e.names,e.name),e.push&&i[e.push].push(a)},r=VA(),n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},a=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(n).forEach(function(e){var t=e[0],n=e.slice(2);"m"===t&&(a.push({rtp:[],fmtp:[]}),o=a[a.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,o,n)}}),t.media=a,t};var a=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(a,{})},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(a,{})})},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}})})}}),jA=NA((e,t)=>{var i=VA(),r=/%[sdv%]/g,n=function(e){var t=1,i=arguments,n=i.length;return e.replace(r,function(e){if(t>=n)return e;var r=i[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(r);case"%d":return Number(r);case"%v":return""}})},a=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 a=0;a<t.names.length;a+=1){var o=t.names[a];t.name?r.push(i[t.name][o]):r.push(i[t.names[a]])}else r.push(i[t.name]);return n.apply(null,r)},o=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];t.exports=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||o,n=t.innerOrder||s,c=[];return r.forEach(function(t){i[t].forEach(function(i){i.name in e&&null!=e[i.name]?c.push(a(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach(function(e){c.push(a(t,i,e))})})}),e.media.forEach(function(e){c.push(a("m",i.m[0],e)),n.forEach(function(t){i[t].forEach(function(i){i.name in e&&null!=e[i.name]?c.push(a(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach(function(e){c.push(a(t,i,e))})})})}),c.join("\r\n")+"\r\n"}}),zA=NA(e=>{var t=HA(),i=jA(),r=VA();e.grammar=r,e.write=i,e.parse=t.parse,e.parseParams=t.parseParams,e.parseFmtpConfig=t.parseFmtpConfig,e.parsePayloads=t.parsePayloads,e.parseRemoteCandidates=t.parseRemoteCandidates,e.parseImageAttributes=t.parseImageAttributes,e.parseSimulcastStreamList=t.parseSimulcastStreamList}),WA=((vA=WA||{}).ROOM_DESTROY="1",vA.JOIN_START="21",vA.JOIN_SCHEDULE_SUCCESS="22",vA.JOIN_SIGNAL_CONNECTION_START="23",vA.JOIN_SIGNAL_CONNECTION_END="24",vA.JOIN_SEND_CMD="25",vA.JOIN_RECEIVED_CMD_RES="26",vA.JOIN_SUCCESS="27",vA.JOIN_FAILED="28",vA.WHIP_REQUEST_COST="29",vA.WHIP_PULL_RESULT="30",vA.LEAVE_START="51",vA.LEAVE_SEND_CMD="52",vA.LEAVE_SUCCESS="53",vA.PUBLISH_START="61",vA.SEND_FIRST_VIDEO_FRAME="62",vA.PUBLISH_FAILED="63",vA.SUBSCRIBE_START="81",vA.SUBSCRIBE_SUCCESS="82",vA.SUBSCRIBE_FAILED="84",vA.UNSUBSCRIBE_SUCCESS="83",vA.LOCAL_TRACK_CAPTURE_START="101",vA.LOCAL_TRACK_CAPTURE_SUCCESS="102",vA.LOCAL_TRACK_CAPTURE_FAILED="103",vA.LOCAL_TRACK_PUBLISHED="104",vA.LOCAL_TRACK_UNPUBLISHED="105",vA.LOCAL_TRACK_REPLACED="106",vA.SWITCH_DEVICE_SUCCESS="107",vA.TRACK_MUTED="108",vA.TRACK_UNMUTED="109",vA.REMOTE_TRACK_SUBSCRIBED="110",vA.REMOTE_TRACK_UNSUBSCRIBED="111",vA.LOCAL_TRACK_RECAPTURE="112",vA.LOCAL_AUDIO_STARTED="113",vA.LOCAL_AUDIO_STOPPED="114",vA.REMOTE_AUDIO_STARTED="115",vA.REMOTE_AUDIO_STOPPED="116",vA.LOCAL_TRACK_STOPPED="117",vA.LOCAL_VIDEO_TRACK_PREPROCESSED="118",vA.VIDEO_MANAGER_UPDATE_TIMEOUT="119",vA.PLAY_TRACK_START="151",vA.PLAYER_STATE_CHANGED="152",vA.VIDEO_LOADED_DATA="153",vA.AUTOPLAY_DIALOG_CLICK_CONFIRM="154",vA.AUDIO_CONTEXT_LONG_SUSPENDED="155",vA.REMOTE_VIDEO_PLAY_START="156",vA.REMOTE_VIDEO_PLAY_FINISH="157",vA.SIGNAL_CONNECTION_STATE_CHANGED="201",vA.PEER_CONNECTION_STATE_CHANGED="202",vA.SINGLE_CONNECTION_STAT="203",vA.SPC_RECONNECTED="204",vA.HEARTBEAT_REPORT="251",vA.RECEIVED_PUBLISHED_USER_LIST="252",vA.REMOTE_PUBLISH_STATE_CHANGED="253",vA.AUDIO_LEVEL_INTERVAL="260",vA.NETWORK_QUALITY="261",vA.VIDEO_CODEC_IMPLEMENTATION_CHANGED="262",vA.QUALITY_LIMITATION_CHANGED="263",vA.LOG="264",vA.AUDIO_PROCESSOR_DEBUG="265",vA.SSO_SWITCH="266",vA.SEI_MESSAGE="267",vA.USER_PAUSE_IN_PIP="268",vA.USER_RESUME_IN_PIP="269",vA.ENTER_PICTURE_IN_PICTURE="270",vA.LEAVE_PICTURE_IN_PICTURE="271",vA.REMOTE_VIDEO_FIRST_UNMUTE="272",vA.REMOTE_VIDEO_FIRST_FRAME_METRICS="273",vA.SWITCH_ROOM_START="401",vA.SWITCH_ROOM_SUCCESS="407",vA.SWITCH_ROOM_FAILED="408",vA);function GA(e){return qA((t,i)=>async function(){for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];let a=await t.apply(this,r);return await e.call(this,...r),a})}function qA(e){return function(t,i,r){return r.value=e(r.value,i),r}}var KA=new WeakMap;function YA(e,t){return qA((i,r)=>function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];let o=KA.get(this);o||(o=new Map,KA.set(this,o));let s=t(...n),c=o.get(s);if(!c||c<=0){i.apply(this,n);let t=setTimeout(()=>{var e;null==(e=KA.get(this))||e.delete(s)},e);o.set(s,t)}else{clearTimeout(c);let t=window.setTimeout(()=>{var e;i.apply(this,n),null==(e=KA.get(this))||e.delete(s)},e);o.set(s,t)}})}var XA,ZA,JA=((XA=JA||{})[XA.none=0]="none",XA[XA.horizontal=1]="horizontal",XA[XA.vertical=2]="vertical",XA),QA="5.0.0",$A="undefined"!=typeof importScripts,eR="undefined"!=typeof registerProcessor,tR="https://".concat("web.sdk.qcloud.com","/trtc/webrtc/doc"),iR="https://cloud.tencent.com/document/product/647/85386",rR="https://trtc.io/document/56025",nR="jssdk_log",aR="qcloud",oR=((ZA=oR||{})[ZA.TRACE=0]="TRACE",ZA[ZA.DEBUG=1]="DEBUG",ZA[ZA.INFO=2]="INFO",ZA[ZA.WARN=3]="WARN",ZA[ZA.ERROR=4]="ERROR",ZA[ZA.NONE=5]="NONE",ZA),sR={unknown:0,wifi:1,"4g":2,"3g":3,"2g":4,wired:5,"5g":6},cR={width:640,height:480,frameRate:15,bitrate:500},lR=3840,dR=2160,uR="canvas",hR="audio",pR="video",fR="screen",mR="big",gR="auxiliary",_R="mute",vR="unmute",yR="ended",ER="playing",bR="pause",wR="error",IR="loadstart",TR="loadeddata",SR="loadedmetadata",AR="audioinput",RR="videoinput",kR="enterpictureinpicture",CR="leavepictureinpicture",DR="fullscreenchange",OR="resize",LR="player-error",NR="load-worklet",PR="getUserMedia-retry",xR="default",MR=2e3,UR=["width","height","frameRate","facingMode","sampleRate","sampleSize","channelCount","deviceId","min","max"],FR={alpha:!0,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0,powerPreference:"low-power"};function BR(e){let{frame:t,streamType:i}=e;return{frame:t,messages:[{type:"dump",isAudio:!1,data:t.data,userId:"",streamType:i}]}}function VR(e){let{frame:t,userId:i,streamType:r}=e;return{frame:t,messages:[{type:"dump",isAudio:!1,data:t.data,userId:i,streamType:r}]}}function HR(e){let{frame:t,streamType:i}=e;return{frame:t,messages:[{type:"dump",isAudio:!0,data:t.data,userId:"",streamType:i}]}}function jR(e){let{frame:t,userId:i,streamType:r}=e;return{frame:t,messages:[{type:"dump",isAudio:!0,data:t.data,userId:i,streamType:r}]}}var zR="Log",WR="Network",GR="Dump",qR="Dump (PCM)",KR="Dump (Opus)",YR="Dumping",XR="End",ZR="Upload Log",JR="Export Log",QR="Hide",$R="goBottom",ek="backTop",tk="Clear Log",ik="Uplink",rk="Downlink",nk="No Data",ak="Basic",ok="Duration",sk="Video",ck="Audio",lk="Screen",dk={"play() error: NotAllowedError:":{tips:e=>e.includes("main <video>")||e.includes("main <audio>")?"Remote stream auto play is restricted and playback fails":"Local stream playback failure, generally only occurs in Android WeChat devices, no need to handle",color:"red",class:"red"},"updateStream() try to recover local stream":{tips:"Device acquisition exception, automatic recovery is in progress"},"updateStream() recover local stream successfully":{tips:"Device acquisition exception, automatic recovery is successful"},"updateStream() failed to recover local stream":{tips:"Device acquisition exception, automatic recovery failed"},"main stream - video track is muted":{tips:"Indicates that the received video data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - audio track is muted":{tips:"Indicates that the received audio data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"auxiliary stream - video track is muted":{tips:"Indicates that the received screen sharing data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - video track is unable to provide media output":{tips:"Indicates that the received video data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - audio track is unable to provide media output":{tips:"Indicates that the received audio data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"auxiliary stream - video track is unable to provide media output":{tips:"Indicates that the received screen sharing data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - video track is unmuted":{tips:"Received enough playback video data"},"main stream - audio track is unmuted":{tips:"Received enough playback audio data"},"auxiliary stream - video track is unmuted":{tips:"Received enough playback screen sharing data"},"main stream - audio player track is ended":{tips:"Remote audio track stopped"},"main stream - video player track is ended":{tips:"Remote video track stopped"},"auxiliary stream - video player track is ended":{tips:"Received enough playback screen sharing data"},"stream - video track is muted":{tips:"Camera capture is paused, usually due to the device being occupied by other applications or the browser media permission being revoked. The client needs to re-capture.",color:"orange"},"stream - video track is unable to provide media output":{tips:"The camera acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked, and the customer needs to re-acquire. SDK v4.11.4+ will automatically resume acquisition without customer intervention",color:"orange"},"video track is unable to provide media output":{tips:e=>e.includes("↓")?"The remote track is temporarily unable to decode data, which may be caused by network fluctuations":"The camera acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked. The SDK will automatically resume the acquisition.",color:"orange"},"stream - video player track is ended":{tips:"The camera acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"video player track is ended":{tips:"The camera acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"stream - audio track is muted":{tips:"Microphone capture is paused, usually due to the device being occupied by other applications or the browser media permission being revoked. The client needs to re-capture.",color:"orange"},"audio track is unable to provide media output":{tips:e=>e.includes("↓")?"The remote track is temporarily unable to decode data, which may be caused by network fluctuations":"Microphone acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked. The SDK will automatically resume the acquisition.",color:"orange"},"stream - audio track is unable to provide media output":{tips:"The microphone acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked. The SDK will automatically resume the acquisition.",color:"orange"},"stream - audio player track is ended":{tips:"The microphone acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"audio player track is ended":{tips:"The microphone acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"is adding audio track to current published local stream":{tips:"add audio track",color:"orange"},"is removing audio track from current published local stream":{tips:"remove audio track",color:"orange"},"is removing video track from current published local stream":{tips:"remove video track",color:"orange"},"is adding video track to current published local stream":{tips:"add video track",color:"orange"},"is replacing audio track to current published local main stream":{tips:"replace audio track",color:"orange"},"is replacing video track to current published local main stream":{tips:"replace video track",color:"orange"},"downlink network quality change":{tips:"Downstream network quality change: 1: excellent, 2: good, 3: average, 4: poor, 5: extremely poor"},"uplink network quality change":{tips:"Upstream network quality change: 1: excellent, 2: good, 3: average, 4: poor, 5: extremely poor"},"localStream mute video":{tips:"mute upstream video stream",color:"orange"},"localStream unmute video":{tips:"unmute upstream video stream",color:"orange"},"localStream mute audio":{tips:"mute upstream audio stream",color:"orange"},"localStream unmute audio":{tips:"unmute upstream audio stream",color:"orange"},"black detected":{tips:"Detect black screen, which means fps = 0. It is usually caused by network, and the network will be recovered after a while. If the network is normal but has not been restored, it is an abnormal situation."},'main stream start to play with options: {"muted":true}':{tips:"Play the remote stream in silent mode. Generally, the remote stream does not need to be played in silent mode. You need to confirm whether the parameters passed in the client stream.play API call are correct.",color:"orange"},"main stream - audio player is starting playing":{tips:"Remote stream audio playback success",color:"#0dd90d",class:"success"},"main stream - video player is starting playing":{tips:"Remote stream video playback success",color:"#0dd90d",class:"success"},"video player is playing":{tips:"Local video playback success",color:"#0dd90d",class:"success"},"audio player is playing":{tips:"Local audio playback success",color:"#0dd90d",class:"success"},"stream - video player is starting playing":{tips:"Local video playback success",color:"#0dd90d",class:"success"},"stream - audio player is starting playing":{tips:"Local audio playback success",color:"#0dd90d",class:"success"},"switch camera success":{tips:"Switch camera success",color:"#0dd90d",class:"success"},"switch microphone success":{tips:"Switch microphone success",color:"#0dd90d",class:"success"},gotStream:{tips:"Local stream capture success"},"local stream is published successfully":{tips:"Publish success",color:"#0dd90d",class:"success"},"encoderImplementation change to OpenH264":{tips:"Use software encoding"},"encoderImplementation change to ExternalEncoder":{tips:"Use hardware encoding"},"getUserMedia with constraints":{tips:"Start media (camera/microphone) capture"},"getDisplayMedia with constraints":{tips:"Start screen sharing capture"},"client-banned":{tips:"Kicked out of the room",color:"red",class:"red",textColor:"#fff"},user_timeout:{tips:"The backend is too long without receiving SDK heartbeat, which is usually caused by the JS thread being blocked for a long time. If the reproduction probability is high, the application browser Performance tool analyzes where the JS thread is blocked.",color:"red",class:"red",textColor:"#fff"},"schedule failed":{tips:"Signaling request failed, does not affect the normal room entry process, SDK will connect to the default signaling domain."},"updateStream() video flag is true, but no camera detected, set video to false":{tips:"When trying to resume camera acquisition, the camera acquisition is not resumed because it is detected that there is no camera.",color:"orange",class:"orange",textColor:"#fff"},"qualityLimitationReason change to bandwidth":{tips:"bandwidth estimation is not enough to limit the quality of the encoding, which may cause the code rate, frame rate, and resolution to be lowered.",color:"orange",class:"orange",textColor:"#fff"},"qualityLimitationReason change to cpu":{tips:"cpu load is too high to limit the quality of the encoding, which may cause the code rate, frame rate, and resolution to be lowered.",color:"orange",class:"orange",textColor:"#fff"},"visibility change: hidden":{tips:"User page switched to backend, in mobile devices, this will cause the device to pause the capture, and it will be restored when the user switches backend to the frontend.",color:"orange",class:"orange",textColor:"#fff"},"visibility change: visible":{tips:"User page switched to frontend",color:"orange",class:"orange",textColor:"#fff"},"main stream - audio player is paused":{tips:"The remote stream audio playback is paused, which usually has two possibilities:\n 1. The business side passes in the div tag container for playing audio and video to be removed by the business side from the DOM.\n 2. If the user is in Chrome 70 and below, when the div container is moved, the playback will be paused.",color:"orange",class:"orange",textColor:"#fff"},"main stream - video player is paused":{tips:"The remote stream video playback is paused, which usually has two possibilities:\n 1. The business side passes in the div tag container for playing audio and video to be removed by the business side from the DOM.\n 2. If the user is in Chrome 70 and below, when the div container is moved, the playback will be paused.",color:"orange",class:"orange",textColor:"#fff"},'"displaySurface":"window"':{tips:"Screen sharing captures the application window",color:"blue",class:"blue",textColor:"#fff"},'"displaySurface":"monitor"':{tips:"Screen sharing captures the entire screen",color:"blue",class:"blue",textColor:"#fff"},'"displaySurface":"browser"':{tips:"Screen sharing captures a certain tab page",color:"blue",class:"blue",textColor:"#fff"},updateMediaSettings:{tips:"The resolution and frame rate below are the actual resolution and frame rate captured",color:"blue",class:"blue",textColor:"#fff"},"main stream start to play with":{tips:"Call remoteStream.play interface",color:"blue",class:"blue",textColor:"#fff"},"stream start to play with":{tips:"Call localStream.play interface",color:"blue",class:"blue",textColor:"#fff"},"main setAudioVolume to 0":{tips:"Business side calls remoteStream.setAudioVolume(0) interface to set the playback volume to 0, which will cause the playback to be silent",color:"orange",class:"orange",textColor:"#fff"},"screen sharing was stopped because the video track is ended":{tips:"Screen sharing capture stopped, possible reasons: user clicks the stop button, the window/page shared by the user is closed, etc.",color:"orange",class:"orange",textColor:"#fff"},"Join() => joining room":{tips:"Call client.join interface",color:"blue",class:"blue",textColor:"#fff"},"publish() => publishing local stream":{tips:"Call client.publish interface",color:"blue",class:"blue",textColor:"#fff"},"subscribe() => subscribe to":{tips:"Call client.subscribe interface",color:"blue",class:"blue",textColor:"#fff"},"switchRole() => switch role":{tips:"Call client.switchRole interface",color:"blue",class:"blue",textColor:"#fff"}};["enterRoom","exitRoom","switchRole","destroy","startLocalAudio","updateLocalAudio","stopLocalAudio","startLocalVideo","updateLocalVideo","stopLocalVideo","startScreenShare","updateScreenShare","stopScreenShare","startRemoteVideo","updateRemoteVideo","stopRemoteVideo","muteRemoteAudio","setRemoteAudioVolume"].forEach(e=>{dk["".concat(e,"()")]={tips:"Call trtc.".concat(e),color:"blue",class:"blue",textColor:"#fff"}});var uk,hk=Object.keys(dk),pk=xA(FA()),fk=((uk=fk||{})[uk.INVALID_PARAMETER=4096]="INVALID_PARAMETER",uk[uk.INVALID_OPERATION=4097]="INVALID_OPERATION",uk[uk.NOT_SUPPORTED=4098]="NOT_SUPPORTED",uk[uk.DEVICE_NOT_FOUND=4099]="DEVICE_NOT_FOUND",uk[uk.INITIALIZE_FAILED=4100]="INITIALIZE_FAILED",uk[uk.SIGNAL_CHANNEL_SETUP_FAILED=16385]="SIGNAL_CHANNEL_SETUP_FAILED",uk[uk.SIGNAL_CHANNEL_ERROR=16386]="SIGNAL_CHANNEL_ERROR",uk[uk.ICE_TRANSPORT_ERROR=16387]="ICE_TRANSPORT_ERROR",uk[uk.JOIN_ROOM_FAILED=16388]="JOIN_ROOM_FAILED",uk[uk.CREATE_OFFER_FAILED=16389]="CREATE_OFFER_FAILED",uk[uk.SIGNAL_CHANNEL_RECONNECTION_FAILED=16390]="SIGNAL_CHANNEL_RECONNECTION_FAILED",uk[uk.UPLINK_RECONNECTION_FAILED=16391]="UPLINK_RECONNECTION_FAILED",uk[uk.DOWNLINK_RECONNECTION_FAILED=16392]="DOWNLINK_RECONNECTION_FAILED",uk[uk.REMOTE_STREAM_NOT_EXIST=16400]="REMOTE_STREAM_NOT_EXIST",uk[uk.CLIENT_BANNED=16448]="CLIENT_BANNED",uk[uk.SERVER_TIMEOUT=16449]="SERVER_TIMEOUT",uk[uk.SUBSCRIPTION_TIMEOUT=16450]="SUBSCRIPTION_TIMEOUT",uk[uk.PLAY_NOT_ALLOWED=16451]="PLAY_NOT_ALLOWED",uk[uk.DEVICE_AUTO_RECOVER_FAILED=16452]="DEVICE_AUTO_RECOVER_FAILED",uk[uk.START_PUBLISH_CDN_FAILED=16453]="START_PUBLISH_CDN_FAILED",uk[uk.STOP_PUBLISH_CDN_FAILED=16454]="STOP_PUBLISH_CDN_FAILED",uk[uk.START_MIX_TRANSCODE_FAILED=16455]="START_MIX_TRANSCODE_FAILED",uk[uk.STOP_MIX_TRANSCODE_FAILED=16456]="STOP_MIX_TRANSCODE_FAILED",uk[uk.NOT_SUPPORTED_H264=16457]="NOT_SUPPORTED_H264",uk[uk.SWITCH_ROLE_FAILED=16458]="SWITCH_ROLE_FAILED",uk[uk.API_CALL_TIMEOUT=16459]="API_CALL_TIMEOUT",uk[uk.SCHEDULE_FAILED=16460]="SCHEDULE_FAILED",uk[uk.API_CALL_ABORTED=16461]="API_CALL_ABORTED",uk[uk.SPC_INITIALIZED_FAILED=16462]="SPC_INITIALIZED_FAILED",uk[uk.VIDEO_MANAGER_ERROR=16463]="VIDEO_MANAGER_ERROR",uk[uk.SWITCH_ROOM_FAILED=16464]="SWITCH_ROOM_FAILED",uk[uk.VIDEO_ENCODE_FAILED=16465]="VIDEO_ENCODE_FAILED",uk[uk.AUDIO_ENCODE_FAILED=16466]="AUDIO_ENCODE_FAILED",uk[uk.WHIP_REQUEST_FAILED=16467]="WHIP_REQUEST_FAILED",uk[uk.UNKNOWN=65535]="UNKNOWN",uk),mk=fk,gk=class extends Error{constructor(e){let{name:t="RtcError",message:i,code:r=mk.UNKNOWN,extraCode:n=0,constraint:a}=e,o="<".concat(function(e){for(let t in mk)if(mk[t]===e)return t;return"UNKNOWN"}(r)," 0x").concat(r.toString(16),">"),s="".concat(i).concat(a?" constraint: ".concat(a):"").concat(null!=i&&i.includes(o)?"":" ".concat(o));super(s),UA(this,"code"),UA(this,"extraCode"),UA(this,"message"),UA(this,"originMessage"),UA(this,"name"),UA(this,"constraint"),this.code=r,this.extraCode=n,this.name=t,this.message=s,this.constraint=a,this.originMessage=i}getCode(){return this.code}getExtraCode(){return this.extraCode}toString(){return this.originMessage}},_k=gk,vk=function(){return Date.now()+0},yk=function(){let e=new Date;return e.setTime(vk()),e.toLocaleString()};PA({},{REPORT_TYPE:()=>UO,buildSSOPackage:()=>FO,bytes2ms:()=>MD,calculateScaleResolutionDownNumber:()=>LO,calculateWatermarkSize:()=>PO,concatArrayBuffers:()=>BO,convertObjectNumberToInt:()=>RO,copyProperties:()=>xD,deepClone:()=>_O,deepCloneBasic:()=>MO,deepMerge:()=>gO,delay:()=>kO,detectImageType:()=>zO,fibonacci:()=>zD,formatedTime:()=>EO,getConstructorName:()=>rO,getContainerFromElement:()=>yO,getEnv:()=>TD,getFirst16Bits:()=>HO,getInternalVersion:()=>lO,getLast16Bits:()=>VO,getLoggerUrl:()=>RD,getMediaStreamTrackInfo:()=>OO,getMuteStateFromFlag:()=>pO,getNetworkType:()=>CD,getNumNetworkType:()=>PD,getReconnectionTimeout:()=>WD,getStringByteLength:()=>IO,getTestSignalDomain:()=>SD,getTurnServer:()=>fO,getUint32Version:()=>AO,getValueType:()=>GD,getVersionFromInternalVersion:()=>dO,getViewListFromView:()=>vO,glog:()=>VD,ipv4ToUint32:()=>mO,isArray:()=>QD,isAudioWorkletSupported:()=>nO,isBoolean:()=>ZD,isConstructor:()=>iO,isEmpty:()=>hO,isFunction:()=>qD,isLangChinese:()=>HD,isMediaStreamTrack:()=>$D,isNumber:()=>XD,isObject:()=>JD,isOverseaSdkAppId:()=>AD,isPlainObject:()=>jD,isPortrait:()=>TO,isPromise:()=>tO,isRemoteTrack:()=>eO,isRotate90Or270:()=>NO,isSameSubnet:()=>ID,isSetSinkIdSupported:()=>aO,isString:()=>YD,isUndefined:()=>KD,isValidIP:()=>wD,isVideoMixerOutputTrack:()=>jO,loadImage:()=>SO,loadVideo:()=>xO,ms2bytes:()=>FD,ms2samples:()=>BD,normalizeUrl:()=>DO,performanceNow:()=>sO,promiseAny:()=>oO,samples2ms:()=>UD,setNetworkTypeFromWebRTC:()=>ND,stringify:()=>bO,stringifyIncludeValue:()=>wO,throttlePromise:()=>CO});var Ek=function(e,t,i,r){return new(i||(i=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(t){a(t)}}function s(e){try{c(r.throw(e))}catch(t){a(t)}}function c(e){e.done?n(e.value):function(e){return e instanceof i?e:new i(function(t){t(e)})}(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},bk=Symbol(32),wk=Symbol(16),Ik=Symbol(8),Tk=class{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return Ek(this,void 0,void 0,function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise((t,i)=>{var r;this.reject=i,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)},this.demand(e,!0)||null===(r=this.pull)||void 0===r||r.call(this,e)})})}readU32(){return this.read(bk)}readU16(){return this.read(wk)}readU8(){return this.read(Ik)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null,t=this.buffer.subarray(this.consumed),i=0,r=e=>t.length<(i=e);if("number"==typeof this.need){if(r(this.need))return;e=t.subarray(0,i)}else if(this.need===bk){if(r(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===wk){if(r(2))return;e=t[0]<<8|t[1]}else if(this.need===Ik){if(r(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(r(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,i)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(r(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,i)),e=this.need}return this.consumed+=i,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise(e=>this.pull=e);this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){let t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{let e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}};Tk.U32=bk,Tk.U16=wk,Tk.U8=Ik;var Sk=128;function Ak(e){let t=new Tk;for(;e>=128;)t.malloc(1)[0]=255&e|Sk,e>>>=7;return t.malloc(1)[0]=255&e,t.buffer||new Uint8Array(0)}function Rk(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=new Tk,r=t<<3;switch(typeof e){case"boolean":let n=i.malloc(2);n[0]=r,n[1]=e?1:0;break;case"number":i.malloc(1)[0]=r,i.write(Ak(e));break;case"string":i.malloc(1)[0]=2|r;let a=(new TextEncoder).encode(e);i.write(Ak(a.length));let o=i.malloc(a.length);for(let e=0;e<a.length;e++)o[e]=a[e];break;case"object":let s=new Tk;if(Array.isArray(e))for(let t=0;t<e.length;t++){let i=Rk(e[t],t+1);i&&s.write(i)}else{let t=1;for(let i in e){let r=Rk(e[i],t++);r&&s.write(r)}}0===t?s.buffer&&i.write(s.buffer):(i.malloc(1)[0]=2|r,s.buffer&&(i.write(Ak(s.buffer.length)),i.write(s.buffer)))}return i.buffer||new Uint8Array(0)}var kk=class{constructor(){UA(this,"buffer"),this.buffer=[]}get data(){return this.buffer}get length(){return this.buffer.length}writeInt32(e){this.buffer.push(e>>>24&255),this.buffer.push(e>>>16&255),this.buffer.push(e>>>8&255),this.buffer.push(255&e)}writeInt16(e){this.buffer.push(e>>>8&255),this.buffer.push(255&e)}writeByte(e){this.buffer.push(255&e)}writeBytes(e){for(let t=0;t<e.length;t++)this.buffer.push(e[t])}};function Ck(e,t,i){e[i]=t>>>24&255,e[i+1]=t>>>16&255,e[i+2]=t>>>8&255,e[i+3]=255&t}function Dk(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function Ok(e,t){return e[t]}function Lk(e,t,i){return(new TextDecoder).decode(function(e,t,i){return e.slice(t,t+i)}(e,t,i))}var Nk=0,Pk=2654435769,xk=16,Mk=2,Uk=7;function Fk(e,t){let i=new kk,r=function(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"AVQualityReportSvc.C2S";return{version:arguments.length>4&&void 0!==arguments[4]?arguments[4]:2e3,encryption:arguments.length>5&&void 0!==arguments[5]?arguments[5]:2,d2:"",d2Len:0,uinType:arguments.length>6&&void 0!==arguments[6]?arguments[6]:30,uin:"",uinLen:0,reqHead:{seqNumber:i,appId:e,appidAtThird:new Uint8Array(0),a2:"",a2Len:0,serviceCmd:r,serviceCmdLen:0,cookie:"",cookieLen:0,imei:"",imeiLen:0,ksid:"",ksidLen:0,clientVersionInfo:"",clientVersionInfoLen:0},busiBuff:t}}(t,e,Nk);Nk=Nk+1&2147483647,i.writeInt32(0),i.writeInt32(r.version),i.writeByte(r.encryption);let n=(new TextEncoder).encode(r.d2);i.writeInt32(n.length+4),n&&i.writeBytes(n),i.writeByte(r.uinType);let a=(new TextEncoder).encode(r.uin);i.writeInt32(a.length+4),a.length&&i.writeBytes(a);let o=new kk;o.writeInt32(0),o.writeInt32(r.reqHead.seqNumber),o.writeInt32(r.reqHead.appId),o.writeByte(r.reqHead.appId>>>24&255),o.writeByte(r.reqHead.appId>>>16&255),o.writeByte(r.reqHead.appId>>>8&255),o.writeByte(255&r.reqHead.appId);for(let v=4;v<16;v++)o.writeByte(0);let s=(new TextEncoder).encode(r.reqHead.a2);o.writeInt32(s.length+4),s.length&&o.writeBytes(s);let c=(new TextEncoder).encode(r.reqHead.serviceCmd);o.writeInt32(c.length+4),c.length&&o.writeBytes(c);let l=(new TextEncoder).encode(r.reqHead.cookie);o.writeInt32(l.length+4),l.length&&o.writeBytes(l);let d=(new TextEncoder).encode(r.reqHead.imei);o.writeInt32(d.length+4),d.length&&o.writeBytes(d);let u=(new TextEncoder).encode(r.reqHead.ksid);o.writeInt32(u.length+4),u.length&&o.writeBytes(u);let h=(new TextEncoder).encode(r.reqHead.clientVersionInfo);o.writeInt16(h.length+2),h.length&&o.writeBytes(h);let p=o.length;o.data[0]=p>>>24&255,o.data[1]=p>>>16&255,o.data[2]=p>>>8&255,o.data[3]=255&p,YD(e)&&(e=(new TextEncoder).encode(e)),o.writeInt32(e.length+4),e.length&&o.writeBytes(e);let f=new Uint8Array(o.data),m=null;1===r.encryption?m=(new TextEncoder).encode(r.uin):2===r.encryption&&(m=new Uint8Array(16)),m&&(f=function(e,t){let i=e.length,r=(i+1+Mk+Uk)%8;r&&(r=8-r);let n=i+1+Mk+Uk+r,a=new Uint8Array(n),o=0,s=new Uint8Array(8),c=new Uint8Array(8),l=new Uint8Array(8),d=0;s[0]=248&Math.floor(256*Math.random())|r,d=1;for(let h=0;h<r;h++)s[d]=255&Math.floor(256*Math.random()),d+=1;for(let h=0;h<Mk;)if(d<8&&(s[d]=255&Math.floor(256*Math.random()),d+=1,h+=1),8===d){Bk(s,t,c,l,a,o),o+=8,d=0;for(let e=0;e<8;e++)l[e]=a[o-8+e]}let u=0;for(;u<i;)if(d<8&&(s[d]=e[u],d+=1,u+=1),8===d){Bk(s,t,c,l,a,o),o+=8,d=0;for(let e=0;e<8;e++)l[e]=a[o-8+e]}for(let h=0;h<Uk;)if(d<8&&(s[d]=0,d+=1,h+=1),8===d){Bk(s,t,c,l,a,o),o+=8,d=0;for(let e=0;e<8;e++)l[e]=a[o-8+e]}return a}(f,m)),i.writeBytes(f);let g=new Uint8Array(i.data),_=g.length;return g[0]=_>>>24&255,g[1]=_>>>16&255,g[2]=_>>>8&255,g[3]=255&_,g}function Bk(e,t,i,r,n,a){for(let o=0;o<8;o++)e[o]^=r[o];!function(e,t,i,r){let n=Dk(e,0),a=Dk(e,4),o=[];for(let c=0;c<4;c++)o[c]=Dk(t,4*c);let s=0;for(let c=0;c<xk;c++)s+=Pk,s>>>=0,n+=(a<<4)+o[0]^a+s^(a>>>5)+o[1],n>>>=0,a+=(n<<4)+o[2]^n+s^(n>>>5)+o[3],a>>>=0;Ck(i,n,r),Ck(i,a,r+4)}(e,t,n,a);for(let o=0;o<8;o++)n[a+o]^=i[o];for(let o=0;o<8;o++)i[o]=e[o]}var Vk="undefined"==typeof navigator?"":navigator.userAgent,Hk=e=>new RegExp(e,"i").test(Vk),jk=e=>{if(Hk(e)){let t=new RegExp("".concat(e,"\\/([\\d.]+)")),i=Vk.match(t);if(i&&i[1])return i[1]}return""},zk=e=>{if(Hk(e)){let t=new RegExp("".concat(e,"\\/(\\d+)")),i=Vk.match(t);if(i&&i[1])return parseFloat(i[1])}return NaN},Wk=/AppleWebKit\/([\d.]+)/i.exec(Vk);Wk&&parseFloat(Wk[1]);var Gk=Hk("iPad"),qk="undefined"!=typeof navigator&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&Hk("Macintosh"),Kk=Hk("iPhone")&&!Gk,Yk=Hk("iPod"),Xk=Kk||Gk||Yk||qk,Zk=()=>{try{return Xk&&navigator.maxTouchPoints>1&&navigator.vendor.includes("Apple")}catch(_A){return Xk}},Jk=Hk("Android"),Qk=function(){if(Jk){let e=Vk.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(e){let t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);if(t&&i)return parseFloat("".concat(e[1],".").concat(e[2]));if(t)return t}}return NaN}();Jk&&Hk("webkit");var $k=Hk("Firefox"),eC=jk("Firefox"),tC=zk("Firefox"),iC=Hk("Edge"),rC=jk("Edge"),nC=Hk("Edg"),aC=jk("Edg"),oC=zk("Edg"),sC=Hk("SogouMobileBrowser"),cC=jk("SogouMobileBrowser"),lC=Hk("MetaSr\\s"),dC=jk("MetaSr\\s"),uC=Hk("TBS"),hC=jk("TBS"),pC=Hk("XWEB"),fC=jk("XWEB");Hk("MSIE\\s8\\.0");var mC=Hk("MSIE\\/\\d+");!function(){if(mC){let e=/MSIE\s(\d+)\.\d/.exec(Vk),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(Vk)&&/rv:11.0/.test(Vk)&&(t=11),t}}();var gC=Hk("(micromessenger|webbrowser)"),_C=jk("MicroMessenger"),vC=!uC&&Hk("MQQBrowser")&&Hk("COVC"),yC=!uC&&Hk("MQQBrowser")&&!Hk("COVC"),EC=yC||vC?jk("MQQBrowser"):"",bC=!uC&&Hk(" QQBrowser"),wC=jk(" QQBrowser"),IC=!uC&&Hk("QQBrowserLite"),TC=jk("QQBrowserLite"),SC=!uC&&Hk("MQBHD"),AC=jk("MQBHD"),RC=Hk("Windows"),kC=!Xk&&Hk("MAC OS X"),CC=!Jk&&Hk("Linux"),DC=Hk("CrOS");Hk("MicroMessenger"),Hk("UCBrowser");var OC=Hk("Electron"),LC=Hk("MiuiBrowser"),NC=jk("MiuiBrowser"),PC=Hk("HuaweiBrowser"),xC=Hk("Huawei")||Hk("HUAWEI"),MC=Hk("Honor")||Hk("HONOR"),UC=jk("HuaweiBrowser"),FC=Hk("SamsungBrowser"),BC=jk("SamsungBrowser"),VC=Hk("HeyTapBrowser"),HC=jk("HeyTapBrowser"),jC=Hk("VivoBrowser"),zC=jk("VivoBrowser"),WC=Hk("OpenHarmony");jk("OpenHarmony");var GC=()=>zk("Chrome"),qC=Hk("CriOS"),KC=Hk("Chrome"),YC=!iC&&!lC&&!sC&&!uC&&!pC&&!nC&&!bC&&!LC&&!PC&&!FC&&!VC&&!jC&&KC,XC=Hk("HeadlessChrome"),ZC=GC(),JC=KC&&ZC>=128&&ZC<=143,QC=jk("Chrome"),$C=zk("Electron"),eD=!KC&&!yC&&!vC&&!IC&&!SC&&Hk("Safari"),tD=eD||Xk,iD=jk("Version"),rD=/Android.*(wv|.0.0.0)/.test(Vk),nD=(()=>{if(qk)return iD;if(Xk){let e=Vk.match(/OS (\d+)_(\d+)/i);if(e&&e[1]){let t=e[1];return e[2]&&(t+=".".concat(e[2])),t}}return""})();function aD(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.split(".").map(e=>Number(e)),n=t.split(".").map(e=>Number(e));for(let a=0;a<Math.max(r.length,n.length);a++){let e=r[a]||0,t=n[a]||0;if(e>t)return!0;if(e<t)return!1}return i}var oD=Number(nD.split(".")[0]),sD="15.1"===nD,cD=(()=>{let e=Number(nD.split(".")[0]);return 14===e||13===e})(),lD=qC&&"11.1.1"===iD,dD="undefined"!=typeof location&&("file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname),uD=(()=>{let e;return()=>{if(void 0===e)try{e=!!window.localStorage}catch(t){e=!1}return e}})(),hD=function(){let e=new Map([[$k,["Firefox",eC]],[nC,["Edg",aC]],[YC,["Chrome",QC]],[qC,["ChiOS",jk("CriOS")]],[eD&&!qC,["Safari",iD]],[uC,["TBS",hC]],[pC,["XWEB",fC]],[gC&&Kk,["WeChat",_C]],[bC,["QQ(Win)",wC]],[yC,["QQ(Mobile)",EC]],[vC,["QQ(Mobile X5)",EC]],[IC,["QQ(Mac)",TC]],[SC,["QQ(iPad)",AC]],[LC,["MI",NC]],[PC,["HW",UC]],[FC,["Samsung",BC]],[VC,["OPPO",HC]],[jC,["VIVO",zC]],[iC,["EDGE",rC]],[sC,["SogouMobile",cC]],[lC,["Sogou",dC]]]),t="unknown",i="unknown";return e.has(!0)&&([t,i]=e.get(!0)),{name:t,version:i}}();var pD=null;function fD(){return pD&&"boolean"==typeof pD.mobile?pD.mobile:Jk||Xk||Kk||Gk||WC}var mD="";function gD(){try{if(mD)return mD;let e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return"";let i=t.getExtension("WEBGL_debug_renderer_info");if(i){let e=t.getParameter(i.UNMASKED_VENDOR_WEBGL),r=t.getParameter(i.UNMASKED_RENDERER_WEBGL);return mD="".concat(e," ").concat(r)}return""}catch(_A){return""}}function _D(){return function(){let e=/;\s*([^;)]+)\s+Build\//,t=Vk.match(e);return null!=t&&t[1]?t[1].trim():null}()||""}var vD=new Map([[Jk,"Android"],[Xk,"iOS"],[RC,"Windows"],[kC,"MacOS"],[CC,"Linux"],[DC,"ChromeOS"]]),yD=function(){return vD.get(!0)?vD.get(!0):"unknown"};function ED(){return RC?1:Jk?2:kC?3:Xk?4:CC?5:DC?6:WC?7:0}var bD=()=>{let e=yD();return Xk?e+="/".concat(nD):Jk&&(e+="/".concat(Qk)),e+="/".concat(hD.name,"/").concat(eD&&!qC?hD.version:hD.version.split(".")[0]),e};function wD(e){return!!e&&!!(/^\d{1,3}(\.\d{1,3}){3}$/.test(e)||e.includes(":")&&/^[0-9a-fA-F:]+$/.test(e))}function ID(e,t){if(!wD(e)||!wD(t))return e===t;let i=e=>e.includes(":");if(i(e)!==i(t))return e===t;if(i(e)){return e.split(":").slice(0,3).join(":")===t.split(":").slice(0,3).join(":")}return e.split(".").slice(0,3).join(".")===t.split(".").slice(0,3).join(".")}var TD=function(){return new URLSearchParams(location.search).get("trtc_env")||""},SD=function(e){return e.includes(".")?e:"".concat(e).concat(".rtc.qq.com")},AD=e=>Number(e)<14e8,RD=function(e,t){let i;i=AD(e)?"https://apisgp.my-imcloud.com":"https://yun.tim.qq.com";let r=Math.floor(Math.random()*2**31);return"".concat(i,"/v5/AVQualityReportSvc/C2S?random=").concat(r,"&sdkappid=").concat(e,"&cmdtype=").concat(t)},kD="unknown";function CD(){!function(){var e;if(!OD){OD=!0;try{null==(e=navigator.connection)||e.addEventListener("typechange",DD)}catch(t){}}}();let{userAgent:e,connection:t}=navigator,i=(e.match(/NetType\/\S+/)||[])[0]||"";i=i.toLowerCase().replace("nettype/",""),"3gnet"===i&&(i="3g");let r=t&&t.type&&t.type.toLowerCase(),n=t&&t.effectiveType&&t.effectiveType.toLowerCase();return"slow-2"===n&&(n="2g"),r?LD(r,n):kD}function DD(){oL.warn("netType changed",CD())}var OD=!1;function LD(e,t){if(sR[e])return e;switch(e){case"cellular":case"wimax":return t||"unknown";case"ethernet":return"wired";default:return"unknown"}}function ND(e){kD=LD(e)}function PD(){return sR[CD()]}function xD(e,t){for(let i of Reflect.ownKeys(t))if("constructor"!==i&&"prototype"!==i&&"name"!==i){let r=Object.getOwnPropertyDescriptor(t,i)||"";Object.defineProperty(e,i,r)}return e}function MD(e){return UD(e/4,arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)}function UD(e){return 1e3*e/(arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)}function FD(e){return 4*BD(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)}function BD(e){return e*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)/1e3}var VD="undefined"!=typeof window&&"function"==typeof window.glog?window.glog:()=>{},HD=()=>{let e=navigator.language;return e=e.substring(0,2),"zh"===e},jD=function(e){if(!e||"object"!=typeof e||"[object Object]"!=Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);if(null===t)return!0;let i=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)};function zD(e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return e<=1?t:zD(e-1,t,(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)+t)}function WD(e){return e>8?3e4:1e3*zD(e)}function GD(e){return Reflect.apply(Object.prototype.toString,e,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}var qD=e=>"function"==typeof e,KD=e=>void 0===e,YD=e=>"string"==typeof e,XD=e=>"number"==typeof e,ZD=e=>"boolean"==typeof e,JD=e=>"object"===GD(e),QD=e=>"array"===GD(e),$D=e=>GD(e)==="MediaStreamTrack".toLowerCase(),eO=e=>e.isRemote,tO=e=>"promise"===GD(e),iO=e=>qD(e)&&e.prototype.constructor===e,rO=e=>iO(e)?e.prototype.constructor.name:"",nO="undefined"!=typeof AudioWorkletNode,aO="undefined"!=typeof HTMLMediaElement&&"setSinkId"in HTMLMediaElement.prototype;function oO(e){return new Promise((t,i)=>{let r=[];e.forEach(n=>{n.then(t).catch(t=>{r.push(t),r.length===e.length&&i(r)})})})}function sO(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}var cO=e=>+e<10?"0".concat(e):e,lO=e=>{let t=e.match(/^\d+\.\d+\.\d+/)[0];if(!t)return e;let i=t.split("."),r=cO(i[1])+cO(i[2]);return i[1]-15>0&&(i[1]="15"),i[2]-15>0&&(i[2]="15"),"".concat(i.join("."),".").concat(r)},dO=e=>{let t=e.split(".");if(4!==t.length)return e;let i=t[0],r=t[3];if(r.length<4)return e;let n=parseInt(r.substring(0,r.length-2),10),a=parseInt(r.substring(r.length-2),10);return"".concat(i,".").concat(n,".").concat(a)},uO=Object.prototype.hasOwnProperty;function hO(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e||"function"==typeof e||Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(jD(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(let t in e)if(uO.call(e,t))return!1;return!0}return!1}function pO(e,t){return{userId:t,hasAudio:!!(8&e),hasVideo:!!(1&e),hasAuxiliary:!!(4&e),hasSmall:!!(2&e),audioMuted:!!(64&e),videoMuted:!!(16&e),audioAvailable:!(!(8&e)||64&e),videoAvailable:!(!(1&e)||16&e),hasDatachannel:!!(256&e)}}function fO(e){let t={urls:e.url.startsWith("turn:")||e.url.startsWith("turns:")?e.url:"turn:".concat(e.url)};return!KD(e.username)&&!KD(e.credential)&&(t.username=e.username,t.credential=e.credential,t.credentialType="password",KD(e.credentialType)||(t.credentialType=e.credentialType)),t}function mO(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!YD(e))return 0;let i=e.split(".");return t?(Number(i[0])<<24|Number(i[1])<<16|Number(i[2])<<8|Number(i[3]))>>>0:(Number(i[3])<<24|Number(i[2])<<16|Number(i[1])<<8|Number(i[0]))>>>0}var gO=function(e,t,i,r){if(!JD(e)||!JD(t))return 0;let n,a=0,o=Object.keys(t);for(let s=0,c=o.length;s<c;s++)if(n=o[s],!(KD(t[n])||i&&i.includes(n)))if(JD(e[n])&&JD(t[n]))a+=gO(e[n],t[n],i,r);else{if(r&&r.includes(t[n]))continue;e[n]!==t[n]&&(e[n]=_O(t[n]),a+=1)}return a};function _O(e){if(QD(e)){let t=[];return e.forEach((e,i)=>{t[i]=_O(e)}),t}if(JD(e)){let t={};return Object.keys(e).forEach(i=>{t[i]=_O(e[i])}),t}return e}var vO=e=>{let t=[];if(QD(e))t=[...e];else if(YD(e)){let i=document.getElementById(e);i&&t.push(i)}else e&&t.push(e);return t},yO=e=>YD(e)?document.getElementById(e):e,EO=()=>(e=>{let t=e=>e<10?"0".concat(e):"".concat(e),i=e.getFullYear(),r=e.getMonth()+1,n=e.getDate(),a=t(e.getHours()),o=t(e.getMinutes()),s=t(e.getSeconds());return"".concat(i,"/").concat(r,"/").concat(n," ").concat(a,":").concat(o,":").concat(s)})(new Date);function bO(e,t){let{keysToInclude:i,keysToExclude:r}=t;try{if(QD(e))return"[".concat(e.map(e=>bO(e,{keysToInclude:i,keysToExclude:r})).join(","),"]");if(!jD(e)||!QD(i)&&!QD(r))return JSON.stringify(e);let t={},n=new Set(i),a=new Set(r);return Object.keys(e).forEach(o=>{(0===a.size&&n.has(o)||0===n.size&&!a.has(o))&&(t[o]=jD(e[o])||QD(e[o])?JSON.parse(bO(e[o],{keysToExclude:r,keysToInclude:i})):e[o])}),JSON.stringify(t)}catch(XA){return"{}"}}function wO(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return Object.keys(e).forEach(r=>{t===e[r]&&i.push(r)}),bO(e,{keysToInclude:i})}function IO(e){return e.replace(/[\u4e00-\u9fa5]/g,"aa").length}var TO=()=>{var e,t,i,r;return null!=(e=window.screen)&&e.orientation?!(null==(r=null==(i=null==(t=window.screen)?void 0:t.orientation)?void 0:i.type)||!r.includes("portrait")):0===window.orientation||180===window.orientation},SO=async e=>new Promise((t,i)=>{let r;if(YD(e))r=new Image,r.crossOrigin="anonymous",r.src=e;else if(r=e,r.complete)return void t(r);r.onload=()=>t(r),r.onerror=()=>{i(new _k({code:mk.INVALID_PARAMETER,message:"load image failed, url: ".concat(e)}))}}),AO=e=>{let t=e.split(".");return+t[0]<<24|+t[1]<<16|+t[2]<<8|+t[3]},RO=e=>(Object.keys(e).forEach(t=>{XD(e[t])&&(t.startsWith("uint")||t.startsWith("int"))?e[t]=Math.floor(e[t]):(jD(e[t])||QD(e[t]))&&RO(e[t])}),e);function kO(e,t){return new Promise(i=>{let r=setTimeout(i,e);t&&t(r)})}function CO(e,t){let i=null;return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return i||(i=e.apply(t||this,n),i.finally(()=>i=null),i)}}function DO(e){return e.replace(/(^|[^:])\/{2,}/g,"$1/")}function OO(e){var t;try{let{width:i,height:r,frameRate:n,sampleRate:a,sampleSize:o,channelCount:s}=null==(t=e.getSettings)?void 0:t.call(e),c=e.kind===hR?"".concat(a,"x").concat(o,"@").concat(s):"".concat(i,"x").concat(r,"@").concat(n),l=e.stats?" stats: ".concat(JSON.stringify(e.stats).replaceAll('"',"")):"";return"".concat(e.id," ").concat(e.readyState," muted:").concat(e.muted," ").concat(e.kind," ").concat(e.label," ").concat(c).concat(l)}catch(nM){return""}}function LO(e,t){return e.width*e.height===t.width*t.height?1:fD()&&TO()&&t.width>t.height&&e.height>t.width?Math.max(e.width/t.height,e.height/t.width,1):Math.max(e.width/t.width,e.height/t.height,1)}function NO(e){return 90===e||270===e}function PO(e,t,i,r,n){let a=e,o=t;if(JD(n))a=(null==n?void 0:n.width)||a,o=(null==n?void 0:n.height)||o;else if(XD(n))a=e*n,o=t*n;else if("contain"===n||"cover"===n){let s=e/t,c=s>i/r;"contain"===n?c?(a=i,o=i/s):(a=r*s,o=r):c?(o=r,a=r*s):(a=i,o=i/s)}return{width:a,height:o}}async function xO(e){return new Promise((t,i)=>{let r=document.createElement("video");r.crossOrigin="anonymous",r.src=e,r.muted=!0,r.loop=!0,r.playsInline=!0,r.play().then(()=>t(r)),r.onerror=()=>{i(r.error)}})}function MO(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){let i=[];return t.set(e,i),e.forEach((e,r)=>{i[r]=MO(e,t)}),i}if("[object Object]"===Object.prototype.toString.call(e)){let i={};return t.set(e,i),Reflect.ownKeys(e).forEach(r=>{i[r]=MO(e[r],t)}),i}return e}var UO=(e=>(e[e.END_REPORT=2001]="END_REPORT",e[e.LOG=2002]="LOG",e[e.KEY_METRIC_REPORT=2003]="KEY_METRIC_REPORT",e))(UO||{});function FO(e,t,i,r){try{let n=function(e,t,i,r){let n={data:e,random:Math.floor(2147483648*Math.random()),sdkAppId:i};return KD(r)||(n=OA(DA({},n),{gzip:+r})),{uint32_sdkappid:0,uint64_from_uin:0,uint32_timestamp:0,uint32_seq:0,msg_common_info:{msg_device_info:{enum_device_type:0,str_device_brand:"",str_device_model:"",str_device_board:"",str_device_cpu_abi:""},msg_system_info:{enum_os_type:0,str_os_version:"",msg_network_info:0},msg_network_info:{enum_network_type:0}},msg_report_content:{uint32_type:t,bytes_report_data:JSON.stringify(n)}}}(e,t,i,r);return Fk(Rk(n),i)}catch(n){return JSON.stringify(e)}}function BO(e,t){let i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer}function VO(e){return(65535&e)>>>0}function HO(e){return(4294901760&e)>>>0}function jO(e,t){return oL.debug("isVideoMixerOutputTrack",e,t,e===(null==t?void 0:t.videoMixerOutputTrack)),!(!e||null==t||!t.isUsingVideoMixerInternalTrack)&&!(!t.videoMixerOutputTrack||e!==t.videoMixerOutputTrack)}function zO(e){var t;if(!e)return{animated:!1};if(e.startsWith("data:")){let t=e.match(/^data:(image\/[^;,]+)/);if(t){let e=t[1].toLowerCase();return{animated:"image/gif"===e||"image/apng"===e,mimeType:e}}return{animated:!1}}if(e.startsWith("blob:"))return{animated:!1};try{let i=null==(t=new URL(e,"https://placeholder.invalid").pathname.split(".").pop())?void 0:t.toLowerCase();if("gif"===i)return{animated:!0,mimeType:"image/gif"};if("apng"===i)return{animated:!0,mimeType:"image/apng"}}catch(nM){}return{animated:!1}}function WO(e){let t=function(e){try{let t={},i=0;t.totalLength=Dk(e,i),i+=4,t.version=Dk(e,i),i+=4,t.encryption=Ok(e,i),i+=1,t.uinType=Ok(e,i),i+=1,t.uinLength=Dk(e,i),i+=4,t.uin=t.uinLength>4?Lk(e,i,t.uinLength-4):"",i+=t.uinLength-4;let r=e.slice(i);if(2===t.encryption){e=function(e,t){let i=0,r=new Uint8Array(8).fill(0),n=new Uint8Array(e.slice(0,8)),a=GO(n,t),o=7&a[0],s=e.length-1-o-Mk-Uk,c=new Uint8Array(s),l=0,d=r,u=e.slice(0,8);i=8;let h=1;h+=o;for(let f=1;f<=Mk;)if(h<8)h++,f++;else if(8===h){let r=qO(e,i,d,u,a,t);d=r.ivPreCrypt,u=r.ivCurCrypt,a=r.debiBuf,i=r.bufPos,h=0}let p=s;for(;p>0;)if(h<8)c[l++]=a[h]^d[h],h++,p--;else if(8===h){let r=qO(e,i,d,u,a,t);d=r.ivPreCrypt,u=r.ivCurCrypt,a=r.debiBuf,i=r.bufPos,h=0}for(let f=1;f<=Uk;)if(h<8)a[h],d[h],h++,f++;else if(8===h){if(i>=e.length)break;let r=qO(e,i,d,u,a,t);if(!r.success)break;d=r.ivPreCrypt,u=r.ivCurCrypt,a=r.debiBuf,i=r.bufPos,h=0}return c}(r,new Uint8Array(16).fill(0)),t.decrypted=!0,i=0}else e=r,i=0;return t.rspHeadLength=Dk(e,i),i+=4,t.seqNo=Dk(e,i),i+=4,t.retCode=Dk(e,i),i+=4,t.retStrLength=Dk(e,i),i+=4,t.retStr=t.retStrLength?Lk(e,i,t.retStrLength-4):"",i+=t.retStrLength-4,t.serviceCmdLength=Dk(e,i),i+=4,t.serviceCmd=t.serviceCmdLength?Lk(e,i,t.serviceCmdLength-4):"",i+=t.serviceCmdLength-4,t.cookieLength=Dk(e,i),i+=4,t.cookie=t.cookieLength?Lk(e,i,t.cookieLength-4):"",i+=t.cookieLength-4,t.flag=Dk(e,i),i+=4,t.busiBuffLength=Dk(e,i),i+=4,t.busiBuff=t.busiBuffLength?Lk(e,i,t.busiBuffLength-4):"",i+=t.busiBuffLength-4,t}catch(t){}}(e);return null==t?void 0:t.busiBuff}function GO(e,t){let i=e[0]<<24|e[1]<<16|e[2]<<8|e[3],r=e[4]<<24|e[5]<<16|e[6]<<8|e[7];i>>>=0,r>>>=0;let n=Pk*xk>>>0;for(let a=0;a<xk;a++)r-=(i<<4)+t[2]^i+n^(i>>>5)+t[3],r>>>=0,i-=(r<<4)+t[0]^r+n^(r>>>5)+t[1],i>>>=0,n-=Pk,n>>>=0;return new Uint8Array([i>>>24&255,i>>>16&255,i>>>8&255,255&i,r>>>24&255,r>>>16&255,r>>>8&255,255&r])}function qO(e,t,i,r,n,a){if(t+8>e.length)return{success:!1};let o=new Uint8Array(r),s=e.slice(t,t+8),c=new Uint8Array(8);for(let l=0;l<8;l++)c[l]=n[l]^s[l];return{success:!0,ivPreCrypt:o,ivCurCrypt:s,debiBuf:GO(c,a),bufPos:t+8}}var KO="undefined"!=typeof TextDecoder?new TextDecoder:void 0;function YO(e){let{url:t,body:i,method:r="POST",timeout:n,priority:a}=e;return new Promise((e,o)=>{if("fetch"in window)return fetch(t,{method:r,body:i,priority:a}).then(e=>e.clone().json().then(e=>({data:e}),()=>e.arrayBuffer().then(e=>({data:WO(new Uint8Array(e))||(KO?KO.decode(e):e)})))).then(e,o);let s=new XMLHttpRequest;s.onreadystatechange=()=>{if(4===s.readyState)if(s.status>=200&&s.status<300)try{let t=JSON.parse(s.response);e({data:t})}catch(t){e({data:s.response})}else o({status:s.status,statusText:s.statusText||"request failed!"})},s.timeout=n||5e3,s.open(r,t,!0),s.send(i)})}var XO=Object.prototype.hasOwnProperty,ZO=e=>"function"==typeof e,JO=e=>void 0===e,QO=e=>e.isRemote;function $O(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e||"function"==typeof e||Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(function(e){if(!e||"object"!=typeof e||"[object Object]"!=Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);if(null===t)return!0;let i=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(let t in e)if(XO.call(e,t))return!1;return!0}return!1}var eL=function(e){let{retryFunction:t,settings:i,onError:r,onRetrying:n,onRetryFailed:a,onRetrySuccess:o,context:s}=e;return function(){for(var e=arguments.length,c=new Array(e),l=0;l<e;l++)c[l]=arguments[l];let{retries:d=5,timeout:u=1e3}=i,h=0,p=-1,f=0,m=async(e,i)=>{let l=s||this;try{let i=await t.apply(l,c);h>0&&o&&o.call(this,h),h=0,e(i)}catch(g){let t=()=>{clearTimeout(p),h=0,f=2,i(g)},o=()=>{2!==f&&h<(ZO(d)?d():d)?(h++,f=1,ZO(n)&&n.call(this,h,t),p=window.setTimeout(()=>{p=-1,m(e,i)},ZO(u)?u(h):u)):(t(),ZO(a)&&a.call(this,g))};ZO(r)?r.call(this,{error:g,retry:o,reject:i,retryFuncArgs:c,retriedCount:h}):o()}};return new Promise(m)}},tL=class e{constructor(e){UA(this,"_parentPath"),UA(this,"userId"),UA(this,"remoteUserId"),UA(this,"id"),UA(this,"sdkAppId"),UA(this,"type"),UA(this,"isLocal"),this.id=e.id,this.userId=e.userId,this.sdkAppId=e.sdkAppId,this.remoteUserId=e.remoteUserId,this.isLocal=!(e=>"boolean"==typeof e)(e.isLocal)||e.isLocal,this.type=this.isLocal?"":e.type}getFullId(){return this._parentPath&&this.id?"".concat(this._parentPath,"-").concat(this.id):this._parentPath?this._parentPath:this.id}createChild(t){let i=new e({id:t.id,userId:JO(t.userId)?this.userId:t.userId,sdkAppId:JO(t.sdkAppId)?this.sdkAppId:t.sdkAppId,type:JO(t.type)?this.type:t.type,isLocal:JO(t.isLocal)?this.isLocal:t.isLocal,remoteUserId:JO(t.remoteUserId)?this.remoteUserId:t.remoteUserId});return i.bindParent(this),i}bindParent(e){let t=e.getFullId();this._parentPath!==t&&(this._parentPath=t,this.userId=e.userId||this.userId,this.sdkAppId=e.sdkAppId||this.sdkAppId,this.debug("bindParent: ".concat(e.id)))}setUserId(e){this.userId=e}setSdkAppId(e){this.sdkAppId=e}log(e,t){let i=this.isLocal?this.userId:this.remoteUserId,r=this.getFullId();t.unshift("[".concat(this.isLocal?"↑":"↓").concat(this.type&&"main"!==this.type?"*":"").concat(r).concat(i?"|".concat(i):"","]")),oL.log(e,t,JO(this.userId)||$O(this.userId),this.userId,this.sdkAppId)}info(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(2,t)}debug(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(1,t)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(3,t)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(4,t)}},iL=new(xA(BA(),1).default),rL=WA,nL=new class{constructor(){UA(this,"enable",!1),UA(this,"ssoFailCount",0),iL.on("22",e=>{let{schedule:t}=e;var i;null!=(i=null==t?void 0:t.config)&&i.sso&&iL.emit("266",{enable:!0})}),iL.on("266",e=>{let{enable:t}=e;this.enable=t})}handleUploadFailed(){this.ssoFailCount++,this.ssoFailCount>3&&iL.emit("266",{enable:!1})}},aL=class e{constructor(){UA(this,"_isEnableUploadLog",!0),UA(this,"_localJoinedUser",new Map),UA(this,"_queue",[]),UA(this,"_timeoutId",-1),UA(this,"_logLevel",1),UA(this,"_logLevelToUpload",2),!$A&&!eR&&(this.checkURLParam(),this.installEvents())}get isAbleToUpload(){return this._isEnableUploadLog&&-1!==this._timeoutId}installEvents(){iL.on(rL.JOIN_SCHEDULE_SUCCESS,e=>{let{schedule:t}=e;var i;null!=(i=null==t?void 0:t.config)&&i.logLevelToUpload&&oR[t.config.logLevelToUpload]&&(this._logLevelToUpload=t.config.logLevelToUpload)}),iL.on(rL.JOIN_START,e=>{let{params:t}=e;this.addJoinedUser({userId:t.userId,sdkAppId:t.sdkAppId}),this.startUpload()}),iL.on(rL.LEAVE_SUCCESS,e=>{let{room:t}=e;this.deleteJoinedUser(t.userId)})}startUpload(){-1===this._timeoutId&&this.uploadInterval()}addJoinedUser(e){this._localJoinedUser.set(e.userId,e),this.startUpload()}deleteJoinedUser(e){this._localJoinedUser.delete(e)}uploadInterval(){this.upload().catch(()=>{}),this._timeoutId=window.setTimeout(()=>this.uploadInterval(),5e3)}getLogsToUpload(){let e={map:new Map,splicedQueue:[]};if(this._queue[0].forAllJoinedClients&&0===this._localJoinedUser.size)return e;let t=0;for(;t<this._queue.length&&50!==t;t++){let i=this._queue[t];if(i.forAllJoinedClients)this._localJoinedUser.forEach(t=>{let{userId:r,sdkAppId:n}=t;e.map.has(r)?e.map.get(r).logs.push(i):e.map.set(r,{userId:r,sdkAppId:n,logs:[i]})});else if(YD(i.userId)&&XD(i.sdkAppId)){let{userId:t,sdkAppId:r}=i;e.map.has(t)?e.map.get(t).logs.push(i):e.map.set(t,{userId:t,sdkAppId:r,logs:[i]})}}return e.map.size>0&&(e.splicedQueue=this._queue.splice(0,t)),e}async upload(){if(0===this._queue.length||!this._isEnableUploadLog)return;let{map:e,splicedQueue:t}=this.getLogsToUpload();if(0===e.size)return;try{let t=[...e.values()];for(let e=0;e<t.length;e++){let{userId:i,sdkAppId:r,logs:n}=t[e],a={timestamp:yk(),sdkAppId:String(r),userId:i,version:QA,log:n.map(e=>e.log).join("\n")},o=JSON.stringify(a),s=nL.enable?FO(a,2002,r):o;await this.uploadLogWithRetry(s,r,s instanceof Uint8Array,o),n.forEach(e=>e.uploaded=!0)}}catch(r){}let i=t.filter(e=>!e.uploaded);i.length>0&&(this._queue=i.concat(this._queue))}uploadLogWithRetry(e,t,i,r){return eL({retryFunction:()=>YO({url:RD(t,nR),body:e,timeout:5e3,priority:"low"}).then(e=>{i&&"ok"!==e.data&&(nL.handleUploadFailed(),this.uploadLogWithRetry(r,t,!1,r))}),settings:{retries:3,timeout:2e3},onError:e=>{let{retry:t}=e;t()}})()}getPrefix(e){let t=new Date;return t.setTime(vk()),"[".concat(function(e){let t=String(e.getMilliseconds());return"padStart"in String.prototype&&(t=t.toString().padStart(3,"0")),"".concat(e.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1"),":").concat(t)}(t),"] <").concat(oR[e],">")}getLogLevel(){return this._logLevel}setLogLevel(e){KD(oR[e])||(this._logLevel!==e&&this.info("setLogLevel",e),this._logLevel=e)}enableUploadLog(){this._isEnableUploadLog=!0}disableUploadLog(){this.warn("disableUploadLog"),this._isEnableUploadLog=!1}logChunkToString(e){if(YD(e))return e;try{return e instanceof Error?e.toString():JSON.stringify(e)}catch(nM){return""}}addLogToQueue(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0,a={log:t.reduce((e,t)=>"".concat(e," ").concat(this.logChunkToString(t)).trim(),""),level:e,userId:r,sdkAppId:n,forAllJoinedClients:i};iL.emit(rL.LOG,{log:a}),this._isEnableUploadLog&&e>=this._logLevelToUpload&&this._queue.push(a)}log(t,i){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;var o;if(i.unshift(this.getPrefix(t)),this.addLogToQueue(t,i,r,n,a),t<this._logLevel)return;let s=(null==(o=oR[t])?void 0:o.toLowerCase())||"info";e.PRINT_LOG_TAG?console[s]("%cTRTC%c%s","padding: 1px 4px;border-radius: 3px;color: #fff;background: #1E88E5;","display: inline",...i):console[s](...i)}debug(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(1,t)}info(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(2,t)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(3,t)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(4,t)}createLogger(e){if(e.parent instanceof tL){let t=e,{parent:i}=t,r=((e,t)=>{var i={};for(var r in e)RA.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&SA)for(var r of SA(e))t.indexOf(r)<0&&kA.call(e,r)&&(i[r]=e[r]);return i})(t,["parent"]),n=new tL(r);return n.bindParent(i),n}return new tL(e)}checkURLParam(){let e=new URLSearchParams(location.search).get("logLevelToUpload"),t=e?Number(e):-1;oR[t]&&(this._logLevelToUpload=t)}getQueue(){return this._queue}};UA(aL,"PRINT_LOG_TAG",!(Xk||Jk||XC));var oL=new aL,sL=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},cL=new class{constructor(){UA(this,"_prefix","TRTC"),UA(this,"_queue",new Map)}getRealKey(e){return"".concat(this._prefix,"_").concat(e)}checkStorage(){uD()&&(setInterval(this.doFlush.bind(this),2e4),Object.keys(localStorage).filter(e=>{if(e.startsWith(this._prefix))try{let t=localStorage.getItem(e);if(!t)return!1;let i=JSON.parse(t);if(i&&i.expiresIn<Date.now())return!0}catch(t){return!1}return!1}).forEach(e=>localStorage.removeItem(e)))}doFlush(){if(uD())try{for(let[e,t]of this._queue)localStorage.setItem(e,JSON.stringify(t))}catch(e){oL.warn(e)}}getItem(e){if(!uD())return null;try{let t=localStorage.getItem(this.getRealKey(e));if(!t)return null;let i=JSON.parse(t);return i&&i.expiresIn>=Date.now()?i.value:null}catch(nM){oL.warn(nM)}}setItem(e,t){if(uD())try{let i={expiresIn:Date.now()+6048e5,value:t};this._queue.set(this.getRealKey(e),i)}catch(XA){oL.warn(XA)}}deleteItem(e){if(!uD())return!1;try{return e=this.getRealKey(e),this._queue.delete(e),localStorage.removeItem(e),!0}catch(nM){return oL.warn(nM),!1}}clear(){if(uD())try{localStorage.clear()}catch(e){oL.warn(e)}}};PA({},{HTTPS_API:()=>BL,IS_GET_CAPABILITIES_FROM_INPUTDEVICE_SUPPORTED:()=>cN,IS_GET_CAPABILITIES_SUPPORTED:()=>sN,IS_GET_SETTINGS_SUPPORTED:()=>oN,IS_GET_SYNCHRONIZATION_SOURCES_SUPPORTED:()=>aN,IS_INSERTABLE_STREAM_SUPPORTED:()=>lN,IS_JITTER_BUFFER_TARGET_SUPPORTED:()=>wN,IS_RTC_RTP_SENDER_SUPPORTED:()=>iN,IS_SCRIPT_TRANSFORM_SUPPORTED:()=>dN,IS_SEI_SUPPORTED:()=>uN,IS_SPC_SUPPORTED:()=>eN,basis:()=>_N,capabilityCheck:()=>EN,checkSystemRequirementsInternal:()=>LL,decodeSupportStatus:()=>OL,detectH264SupportedByFakeStreaming:()=>UL,detectVideoCodecCapabilities:()=>SN,detectVideoDecoderCapabilities:()=>RN,detectVideoEncoderCapabilities:()=>AN,encodeSupportStatus:()=>DL,getBrowserInfo:()=>wL,getDisplayResolution:()=>HL,getH264ProfileLevelIds:()=>kN,isAddTransceiverSupported:()=>$L,isBrowserSupported:()=>IL,isCanvasCaptureStreamAPISupported:()=>WL,isCanvasSmallStreamSupported:()=>GL,isGetReceiversSupported:()=>ZL,isGetSendersSupported:()=>JL,isGetTransceiversSupported:()=>QL,isGetUserMediaSupported:()=>jL,isMediaDevicesSupported:()=>SL,isMediaSessionSupported:()=>fN,isMediaStreamTrackGeneratorSupported:()=>CL,isMediaStreamTrackProcessorSupported:()=>kL,isReplaceTrackSupported:()=>rN,isRequestVideoFrameCallbackSupported:()=>bN,isSIMDSupported:()=>gN,isScaleResolutionDownBySupported:()=>qL,isScaleResolutionDownToSupported:()=>KL,isScreenCaptureApiAvailable:()=>PL,isSelectedCandidatePair:()=>VL,isSetParametersSupported:()=>nN,isSetSinkIdSupported:()=>xL,isSmallStreamSupported:()=>YL,isStopTransceiverSupported:()=>tN,isTRTCSupported:()=>NL,isUnifiedPlanDefault:()=>XL,isUsedInHttpProtocol:()=>RL,isWebAudioSupported:()=>zL,isWebCodecSupported:()=>pN,isWebCodecsSupported:()=>TL,isWebRTCSupported:()=>hN,isWebTransportSupported:()=>mN});var lL={AVOID_REPEATED_CALL:"AVOID_REPEATED_CALL",INVALID_PARAMETER_REQUIRED:"INVALID_PARAMETER_REQUIRED",INVALID_PARAMETER_TYPE:"INVALID_PARAMETER_TYPE",INVALID_PARAMETER_EMPTY:"INVALID_PARAMETER_EMPTY",INVALID_PARAMETER_INSTANCE:"INVALID_PARAMETER_INSTANCE",INVALID_PARAMETER_RANGE:"INVALID_PARAMETER_RANGE",INVALID_PARAMETER_MIN:"INVALID_PARAMETER_MIN",INVALID_PARAMETER_MAX:"INVALID_PARAMETER_MAX",INVALID_PARAMETER_STREAMTYPE:"INVALID_PARAMETER_STREAMTYPE",API_CALL_TIMEOUT:"API_CALL_TIMEOUT",SIGNAL_CHANNEL_RECONNECTION_FAILED:"SIGNAL_CHANNEL_RECONNECTION_FAILED",SIGNAL_CHANNEL_SETUP_FAILED:"SIGNAL_CHANNEL_SETUP_FAILED",ERROR_MESSAGE:"ERROR_MESSAGE",EXCHANGE_SDP_TIMEOUT:"EXCHANGE_SDP_TIMEOUT",DOWNLINK_RECONNECTION_FAILED:"DOWNLINK_RECONNECTION_FAILED",EXCHANGE_SDP_FAILED:"EXCHANGE_SDP_FAILED",UPDATE_OFFER_TIMEOUT:"UPDATE_OFFER_TIMEOUT",UPLINK_RECONNECTION_FAILED:"UPLINK_RECONNECTION_FAILED",INVALID_RECORDID:"INVALID_RECORDID",INVALID_PURE_AUDIO:"INVALID_PURE_AUDIO",INVALID_STREAMID:"INVALID_STREAMID",INVALID_USER_DEFINE_RECORDID:"INVALID_USER_DEFINE_RECORDID",INVALID_USER_DEFINE_PUSH_ARGS:"INVALID_USER_DEFINE_PUSH_ARGS",INVALID_PROXY:"INVALID_PROXY",INVALID_JOIN:"INVALID_JOIN",INVALID_ROOMID_STRING:"INVALID_ROOMID_STRING",INVALID_ROOMID_INTEGER:"INVALID_ROOMID_INTEGER",INVALID_SIGNAL_CHANNEL:"INVALID_SIGNAL_CHANNEL",JOIN_ROOM_TIMEOUT:"JOIN_ROOM_TIMEOUT",JOIN_ROOM_FAILED:"JOIN_ROOM_FAILED",REJOIN_ROOM_FAILED:"REJOIN_ROOM_FAILED",INVALID_DESTROY:"INVALID_DESTROY",INVALID_PUBLISH:"INVALID_PUBLISH",INVALID_UNPUBLISH:"INVALID_UNPUBLISH",INVALID_AUDIENCE:"INVALID_AUDIENCE",INVALID_INITIALIZE:"INVALID_INITIALIZE",INVALID_DUPLICATE_PUBLISHING:"INVALID_DUPLICATE_PUBLISHING",INVALID_SUBSCRIBE_UNDEFINED:"INVALID_SUBSCRIBE_UNDEFINED",INVALID_SUBSCRIBE_LOCAL:"INVALID_SUBSCRIBE_LOCAL",INVALID_REMOTE_STREAM:"INVALID_REMOTE_STREAM",SUBSCRIBE_FAILED:"SUBSCRIBE_FAILED",INVALID_ROLE:"INVALID_ROLE",INVALID_PARAMETER_SWITCH_ROLE:"INVALID_PARAMETER_SWITCH_ROLE",INVALID_OPERATION_SWITCH_ROLE:"INVALID_OPERATION_SWITCH_ROLE",SWITCH_ROLE_TIMEOUT:"SWITCH_ROLE_TIMEOUT",SWITCH_ROLE_FAILED:"SWITCH_ROLE_FAILED",CLIENT_BANNED:"CLIENT_BANNED",INVALID_OPERATION_START_PUBLISH_CDN:"INVALID_OPERATION_START_PUBLISH_CDN",INVALID_OPERATION_STOP_PUBLISH_CDN:"INVALID_OPERATION_STOP_PUBLISH_CDN",INVALID_STREAM_ID:"INVALID_STREAM_ID",START_PUBLISH_CDN_FAILED:"START_PUBLISH_CDN_FAILED",STOP_PUBLISH_CDN_FAILED:"STOP_PUBLISH_CDN_FAILED",START_MIX_TRANSCODE:"START_MIX_TRANSCODE",STOP_MIX_TRANSCODE:"STOP_MIX_TRANSCODE",INVALID_AUDIO_VOLUME:"INVALID_AUDIO_VOLUME",ENABLE_SMALL_STREAM_PUBLISHED:"ENABLE_SMALL_STREAM_PUBLISHED",DISABLE_SMALL_STREAM_PUBLISHED:"DISABLE_SMALL_STREAM_PUBLISHED",NOT_SUPPORTED_SMALL_STREAM:"NOT_SUPPORTED_SMALL_STREAM",INVALID_SMALL_STREAM_PROFILE:"INVALID_SMALL_STREAM_PROFILE",INVALID_PARAMETER_REMOTE_STREAM:"INVALID_PARAMETER_REMOTE_STREAM",INVALID_OPERATION_CHANGE_SMALL:"INVALID_OPERATION_CHANGE_SMALL",REMOTE_NOT_PUBLISH_SMALL_STREAM:"REMOTE_NOT_PUBLISH_SMALL_STREAM",INVALID_SWITCH_DEVICE:"INVALID_SWITCH_DEVICE",INVALID_SWITCH_DEVICE_PUBLISHING:"INVALID_SWITCH_DEVICE_PUBLISHING",INVALID_REPLACE_TRACK:"INVALID_REPLACE_TRACK",INVALID_INITIALIZE_LOCAL_STREAM:"INVALID_INITIALIZE_LOCAL_STREAM",INVALID_ADD_TRACK_REPETITIVE:"INVALID_ADD_TRACK_REPETITIVE",INVALID_ADD_TRACK_REMOVING:"INVALID_ADD_TRACK_REMOVING",INVALID_ADD_TRACK_PUBLISHING:"INVALID_ADD_TRACK_PUBLISHING",INVALID_STREAM_INITIALIZED:"INVALID_STREAM_INITIALIZED",INVALID_ADD_TRACK_NUMBER:"INVALID_ADD_TRACK_NUMBER",INVALID_REMOVE_AUDIO_TRACK:"INVALID_REMOVE_AUDIO_TRACK",INVALID_REMOVE_AUDIO_ADDING:"INVALID_REMOVE_AUDIO_ADDING",INVALID_REMOVE_AUDIO_ON:"INVALID_REMOVE_AUDIO_ON",INVALID_REMOVE_TRACK_PUBLISHING:"INVALID_REMOVE_TRACK_PUBLISHING",INVALID_REMOVE_TRACK_NOT_TRACK:"INVALID_REMOVE_TRACK_NOT_TRACK",INVALID_REMOVE_TRACK_NUMBER:"INVALID_REMOVE_TRACK_NUMBER",INVALID_REPLACE_TRACK_NO_TRACK:"INVALID_REPLACE_TRACK_NO_TRACK",REPEAT_JOIN:"REPEAT_JOIN",CLIENT_DESTROYED:"CLIENT_DESTROYED",NOT_BUG_PACKAGE:"NOT_BUG_PACKAGE",START_MIX_TRANSCODE_FAILED:"START_MIX_TRANSCODE_FAILED",STOP_MIX_TRANSCODE_FAILED:"STOP_MIX_TRANSCODE_FAILED",MIX_TRANSCODE_NOT_STARTED:"MIX_TRANSCODE_NOT_STARTED",CANNOT_LESS_THAN_ZERO:"CANNOT_LESS_THAN_ZERO",MIX_PARAMS_VIDEO_FRAMERATE:"MIX_PARAMS_VIDEO_FRAMERATE",MIX_PARAMS_VIDEO_GOP:"MIX_PARAMS_VIDEO_GOP",MIX_PARAMS_AUDIO_BITRATE:"MIX_PARAMS_AUDIO_BITRATE",MIX_PARAMS_USER_Z_ORDER:"MIX_PARAMS_USER_Z_ORDER",MIX_PARAMS_NOT_SELF:"MIX_PARAMS_NOT_SELF",MIX_PARAMS_USER_STREAM:"MIX_PARAMS_USER_STREAM",INVALID_PLAY:"INVALID_PLAY",INVALID_ELEMENT_ID:"INVALID_ELEMENT_ID",INVALID_ELEMENT_ID_TYPE:"INVALID_ELEMENT_ID_TYPE",PLAY_FAILED:"PLAY_FAILED",INVALID_USERID:"INVALID_USERID",INVALID_CREATE_STREAM_SOURCE:"INVALID_CREATE_STREAM_SOURCE",INVALID_CREATE_STREAM_SCREEN:"INVALID_CREATE_STREAM_SCREEN",INVALID_CREATE_STREAM_AUDIO:"INVALID_CREATE_STREAM_AUDIO",INVALID_CREATE_STREAM_SCREEN_AUDIO:"INVALID_CREATE_STREAM_SCREEN_AUDIO",NOT_SUPPORTED_HTTP:"NOT_SUPPORTED_HTTP",NOT_SUPPORTED_WEBRTC:"NOT_SUPPORTED_WEBRTC",NOT_SUPPORTED_PROFILE:"NOT_SUPPORTED_PROFILE",NOT_SUPPORTED_MEDIA:"NOT_SUPPORTED_MEDIA",NOT_SUPPORTED_H264ENCODE:"NOT_SUPPORTED_H264ENCODE",NOT_SUPPORTED_H264DECODE:"NOT_SUPPORTED_H264DECODE",NOT_SUPPORTED_TRACK:"NOT_SUPPORTED_TRACK",NOT_SUPPORTED_SWITCH_DEVICE:"NOT_SUPPORTED_SWITCH_DEVICE",NOT_SUPPORTED_CAPTURE:"NOT_SUPPORTED_CAPTURE",NOT_SUPPORTED_AUX:"NOT_SUPPORTED_AUX",MICROPHONE_NOT_FOUND:"MICROPHONE_NOT_FOUND",CAMERA_NOT_FOUND:"CAMERA_NOT_FOUND",SIGNAL_RESPONSE_FAILED:"SIGNAL_RESPONSE_FAILED",CATCH_HANDLER_ERROR:"CATCH_HANDLER_ERROR",API_NOT_EXIST:"API_NOT_EXIST",CONNECTION_CLOSED:"CONNECTION_CLOSED",SUBSCRIBE_ALL_FALSE:"SUBSCRIBE_ALL_FALSE",SEI_NOT_SUPPORT:"SEI_NOT_SUPPORT",SEI_DISABLED:"SEI_DISABLED",SEI_BEFORE_PUBLISH:"SEI_BEFORE_PUBLISH",SEI_NOT_VIDEO:"SEI_NOT_VIDEO",CALL_FREQUENCY_LIMIT:"CALL_FREQUENCY_LIMIT",CONNECTION_ABORTED:"CONNECTION_ABORTED",API_CALL_ABORTED:"API_CALL_ABORTED",DUPLICATE_AUX:"DUPLICATE_AUX",SWITCH_PLAYBACK_QUALITY_TIMEOUT:"SWITCH_PLAYBACK_QUALITY_TIMEOUT"},dL={AVOID_REPEATED_CALL:e=>"previous ".concat(e.name,"() is ongoing, please avoid repeated calls."),INVALID_PARAMETER_REQUIRED(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' is a required param when calling ").concat(r,"(), received: ").concat(n,".")},INVALID_PARAMETER_TYPE(e){let{key:t,rule:i,fnName:r,value:n}=e,a="".concat(t||i.name),o="";return o=Array.isArray(i.type)?i.type.join("|"):i.type,"'".concat(a,"' must be type of ").concat(o," when calling ").concat(r,"(), received type: ").concat(GD(n),".")},INVALID_PARAMETER_EMPTY(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' cannot be '").concat(n,"' when calling ").concat(r,"().")},INVALID_PARAMETER_INSTANCE(e){let{key:t,rule:i,fnName:r,value:n}=e,a="".concat(t||i.name),o="".concat(i.instanceOf.name||i.instanceOf);return"'".concat(a,"' must be instanceof ").concat(o," when calling ").concat(r,"(), received type: ").concat(GD(n),".")},INVALID_PARAMETER_RANGE(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' must be one of ").concat(i.values.join("|")," when calling ").concat(r,"(), received: ").concat(n,".")},INVALID_PARAMETER_MIN(e){let{key:t,rule:i,fnName:r,value:n}=e;return"the min value of ".concat(t||i.name," is ").concat(i.min,", received: ").concat(n,".")},INVALID_PARAMETER_MAX(e){let{key:t,rule:i,fnName:r,value:n}=e;return"the max value of ".concat(t||i.name," is ").concat(i.max,", received: ").concat(n,".")},API_CALL_TIMEOUT:e=>"".concat(e.commandDesc||e.command," timeout observed."),SIGNAL_CHANNEL_RECONNECTION_FAILED:"signal channel reconnection failed, please check your network.",SIGNAL_CHANNEL_SETUP_FAILED:e=>"SignalChannel setup failure: (errorCode: ".concat(e.errorCode,", errorMsg: ").concat(e.errorMsg," })."),ERROR_MESSAGE(e){let t="".concat(e.type," failed");return e.message&&(t="".concat(t,": ").concat(e.message,".")),t},EXCHANGE_SDP_TIMEOUT:"exchange sdp timeout.",DOWNLINK_RECONNECTION_FAILED:"downlink reconnection failed, please check your network and re-join room.",EXCHANGE_SDP_FAILED:e=>"exchange sdp failed ".concat(e.errMsg,"."),UPDATE_OFFER_TIMEOUT:"update offer timeout observed.",UPLINK_RECONNECTION_FAILED:"uplink reconnection failed, please check your network and publish again.",INVALID_RECORDID:"recordId must be an integer number.",INVALID_PURE_AUDIO:"pureAudioPushMode must be 1 or 2.",INVALID_STREAMID:"streamId must be a sting literal within 64 bytes, and not be empty.",INVALID_USER_DEFINE_RECORDID:"userDefineRecordId must be a sting literal contains (a-zA-Z),(0-9), underline and hyphen, within 64 bytes, and not be empty.",INVALID_USER_DEFINE_PUSH_ARGS:"userDefinePushArgs must be a sting literal within 256 bytes, and not be empty.",INVALID_PROXY:'proxy server url must start with "wss://".',INVALID_JOIN:"duplicate join() called.",INVALID_ROOMID_STRING:e=>"'".concat(e,"' must be validate string when useStringRoomId is true."),INVALID_ROOMID_INTEGER:e=>"'".concat(e,"' must be an integer between [1, 4294967294] when useStringRoomId is false."),INVALID_SIGNAL_CHANNEL:"SignalChannel is not ready yet.",JOIN_ROOM_TIMEOUT:"join room timeout.",JOIN_ROOM_FAILED(e){let{error:t,code:i}=e;return"Failed to join room - ".concat(t," code: ").concat(i)},REJOIN_ROOM_FAILED:e=>"reJoin room: ".concat(e.roomId," failed, please check your network."),INVALID_DESTROY:"please call leave() before destroy().",INVALID_PUBLISH:"please call join() before publish().",INVALID_UNPUBLISH:"stream has not been published yet.",INVALID_AUDIENCE:'no permission to publish() under live/audience, please call switchRole("anchor") firstly before publish().',INVALID_INITIALIZE:"cannot publish stream because stream is not initialized, is switching device, or has been closed.",INVALID_DUPLICATE_PUBLISHING:e=>"duplicate ".concat(e," stream publishing, please unpublish your prev ").concat(e," stream and then re-publish."),INVALID_SUBSCRIBE_UNDEFINED:"stream is undefined or null.",INVALID_SUBSCRIBE_LOCAL:"stream cannot be LocalStream.",INVALID_REMOTE_STREAM:"remoteStream does not exist because it has been unpublished by remote peer.",SUBSCRIBE_FAILED(e){let{message:t,userId:i,streamType:r}=e;return"failed to subscribe ".concat(i," ").concat(r," stream, reason: ").concat(t,".")},INVALID_ROLE:"switchRole can only be called in live mode.",INVALID_PARAMETER_SWITCH_ROLE:"role could only be set to a value as anchor or audience.",INVALID_OPERATION_SWITCH_ROLE:"please call join() before switchRole().",SWITCH_ROLE_TIMEOUT:"switchRole timeout.",SWITCH_ROLE_FAILED:e=>"switchRole failed, errCode: ".concat(e.code," errMsg: ").concat(e.message,"."),CLIENT_BANNED:e=>"client was banned because of ".concat(e.message,"."),INVALID_OPERATION_START_PUBLISH_CDN:"please call startPublishCDNStream() after join room and publish the local stream.",INVALID_OPERATION_STOP_PUBLISH_CDN:"please call startPublishCDNStream() before stopPublishCDNStream().",START_PUBLISH_CDN_FAILED:e=>"startPublishCDNStream failed, errMsg: ".concat(e.message,"."),STOP_PUBLISH_CDN_FAILED:e=>"stopPublishCDNStream failed, errMsg: ".concat(e.message,"."),INVALID_STREAM_ID:e=>"'".concat(e,"' can only consist of uppercase and lowercase english letters (a-zA-Z), numbers (0-9), hyphens and underscores."),START_MIX_TRANSCODE:"please call startMixTranscode() after join().",STOP_MIX_TRANSCODE:"please call stopMixTranscode() after startMixTranscode().",INVALID_AUDIO_VOLUME:"interval must be a number.",ENABLE_SMALL_STREAM_PUBLISHED:"Cannot enable small stream after localStream published.",DISABLE_SMALL_STREAM_PUBLISHED:"Cannot disable small stream after localStream published.",NOT_SUPPORTED_SMALL_STREAM:"your browser does not support opening small stream.",INVALID_SMALL_STREAM_PROFILE:"small stream profile is invalid.",INVALID_PARAMETER_REMOTE_STREAM:"remoteStream is invalid.",INVALID_OPERATION_CHANGE_SMALL:"cannot switch to the small stream without subscribing to the video of remoteStream.",REMOTE_NOT_PUBLISH_SMALL_STREAM:"remote peer does not publish small stream.",INVALID_SWITCH_DEVICE:"cannot switch device on current stream.",INVALID_SWITCH_DEVICE_PUBLISHING:"cannot switch device when publishing localStream.",INVALID_REPLACE_TRACK:"cannot replace track when publishing localStream.",INVALID_INITIALIZE_LOCAL_STREAM:"local stream has not initialized yet.",INVALID_ADD_TRACK_REPETITIVE:"previous addTrack is ongoing, please avoid repetitive execution.",INVALID_ADD_TRACK_REMOVING:"cannot add track when a track is removing.",INVALID_ADD_TRACK_PUBLISHING:"cannot add track when publishing localStream.",INVALID_STREAM_INITIALIZED:"your local stream haven't been initialized yet.",INVALID_ADD_TRACK_NUMBER:"a Stream has at most one audio track and one video track.",INVALID_REMOVE_AUDIO_TRACK:"remove audio track is not supported on your browser.",INVALID_REMOVE_AUDIO_ADDING:"cannot remove track when a track is adding.",INVALID_REMOVE_AUDIO_ON:"previous removeTrack is ongoing, please avoid repetitive execution.",INVALID_REMOVE_TRACK_PUBLISHING:"cannot remove track when publishing localStream.",INVALID_REMOVE_TRACK_NOT_TRACK:"localStream has not this track.",INVALID_REMOVE_TRACK_NUMBER:"remove the only video track is not supported, please use replaceTrack or muteVideo.",INVALID_REPLACE_TRACK_NO_TRACK:e=>"cannot replace ".concat(e.kind," track because stream has not ").concat(e.kind," track"),NOT_BUG_PACKAGE:"You need to buy packages, refer to tencent console.",START_MIX_TRANSCODE_FAILED:e=>"startMixTranscode failed, errMsg: ".concat(e.message,"."),STOP_MIX_TRANSCODE_FAILED:e=>"stopMixTranscode failed, errMsg: ".concat(e.message,"."),MIX_TRANSCODE_NOT_STARTED:"mixTranscode has not been started.",CANNOT_LESS_THAN_ZERO(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' cannot be less than 0 when calling ").concat(r,"().")},MIX_PARAMS_VIDEO_FRAMERATE:"'config.videoFramerate' should be an integer between 0 and 30, excluding 0.",MIX_PARAMS_VIDEO_GOP:"'config.videoGOP' should be an integer between 1 and 8.",MIX_PARAMS_AUDIO_BITRATE:"'config.audioBitrate' should be an integer between 32 and 192.",MIX_PARAMS_USER_Z_ORDER:e=>"'".concat(e,"' is required and must be between 1 and 15."),MIX_PARAMS_NOT_SELF:"'config.mixUsers' must contain self.",MIX_PARAMS_USER_STREAM:"'config.videoWidth' and 'config.videoHeight' of output stream should be contain all mix stream.",INVALID_PLAY:"duplicate play() call observed, please stop() firstly.",INVALID_ELEMENT_ID:e=>{let{key:t,fnName:i}=e;return"'".concat(t,"' is not found in the document object when calling ").concat(i,"().")},INVALID_ELEMENT_ID_TYPE:e=>{let{key:t,fnName:i,type:r}=e;return"the element corresponding to '".concat(t,"' must be instanceof HTMLElement when calling ").concat(i,"(), received: ").concat(r,".")},PLAY_FAILED:e=>"".concat(e.media," play failed, browser exception: ").concat(e.error.toString()),INVALID_USERID:"userId cannot be all spaces.",INVALID_CREATE_STREAM_SOURCE:"LocalStream must be created by createStream() with either audio/video or audioSource/videoSource, but can not be mixed with audio/video and audioSource/videoSource.",INVALID_CREATE_STREAM_SCREEN:"screen/video cannot be both true.",INVALID_CREATE_STREAM_AUDIO:"audio/screenAudio cannot be both true.",INVALID_CREATE_STREAM_SCREEN_AUDIO:"when screen is true, screenAudio can be configured.",NOT_SUPPORTED_HTTP:"http protocol does not support the ability to capture microphone, camera and screen. please use https to deploy your page.",NOT_SUPPORTED_WEBRTC:"your browser or environment does not support full WebRTC capabilities.",NOT_SUPPORTED_PROFILE:"your browser does not support setVideoProfile.",NOT_SUPPORTED_MEDIA:"your browser or environment does not support navigator.mediaDevices.",NOT_SUPPORTED_H264ENCODE:"your device does not support H.264 encoding.",NOT_SUPPORTED_H264DECODE:"your device does not support H.264 decoding.",NOT_SUPPORTED_TRACK:e=>"".concat(e,"Track is not supported on your browser."),NOT_SUPPORTED_SWITCH_DEVICE:"switchDevice is not supported on your browser.",NOT_SUPPORTED_CAPTURE:"Your browser or environment does not support screen sharing, please check whether the browser version.",MICROPHONE_NOT_FOUND:"no microphone detected, please check your microphone.",CAMERA_NOT_FOUND:"no camera detected, please check your camera.",SIGNAL_RESPONSE_FAILED:e=>"".concat(e.signalResponse," failed, response code is ").concat(e.code," , errMsg: ").concat(e.message,"."),CATCH_HANDLER_ERROR(e){let{name:t,event:i}=e;return"an error was caught in ".concat(t,".on('").concat(i,"', handler), please check your code in 'handler'.")},API_NOT_EXIST(e){let{name:t}=e;return"experimental api ".concat(t," does not exist.")},REPEAT_JOIN:e=>"please avoid repeated join.",CONNECTION_CLOSED:"remoteStream has been unsubscribed or unpublished by remote user.",SUBSCRIBE_ALL_FALSE:"cannot subscribe when both audio & video are false, use client.unsubscribe() instead",CLIENT_DESTROYED(e){let{funName:t}=e;return"failed to call ".concat(t,"() because client was destroyed.")},SEI_NOT_SUPPORT:e=>"not support to sendSEIMessage".concat(!1===e?" without using h264 codec":""),SEI_DISABLED:"SEI is disabled",SEI_BEFORE_PUBLISH:"please call sendSEIMessage() after publish() success",SEI_NOT_VIDEO:"cannot send sei when localStream has not video.",CALL_FREQUENCY_LIMIT:e=>{let{isSize:t,name:i,timesInSecond:r,maxSizeInSecond:n}=e;return"api ".concat(i," call ").concat(t?"size":"times"," is over ").concat(t?"".concat(n," bytes"):r," in a second.")},CONNECTION_ABORTED:e=>"connection aborted due to: ".concat(e),API_CALL_ABORTED(e){let t;return t=e.message.includes("REMOTE_STREAM_NOT_EXIST")?"Subscribe ".concat(e.userId," ").concat(e.streamType," stream aborted, reason: remote user ").concat(e.userId," unpublished stream."):"API aborted, reason: ".concat(e.message),t},DUPLICATE_AUX:"only one auxiliary stream can be published in a room.",NOT_SUPPORTED_AUX:"publish auxiliary stream is not supported on your browser.",INVALID_PARAMETER_STREAMTYPE:e=>"'streamType' is required when 'userId' is not '*', calling ".concat(e,"()"),SWITCH_PLAYBACK_QUALITY_TIMEOUT:e=>"switchPlaybackQuality timeout: waiting for first frame of user ".concat(e.userId,".")},uL=(e,t)=>t?"".concat(tR,"/").concat(e,"/").concat(t):"".concat(tR,"/").concat(e,"/index.html"),hL=()=>{if(window.TRTC_ERROR_INFO&&window.TRTC_ERROR_LINK)return{TRTC_ERROR_INFO:window.TRTC_ERROR_INFO,TRTC_ERROR_LINK:window.TRTC_ERROR_LINK};let e=null==localStorage?void 0:localStorage.getItem("trtc_error_assistance");if(e){e=JSON.parse(e);let t=document.createElement("script");t.type="text/javascript",t.text=e.message,document.body.appendChild(t);let i=window.TRTC_ERROR_INFO,r=window.TRTC_ERROR_LINK;return document.body.removeChild(t),{TRTC_ERROR_INFO:i,TRTC_ERROR_LINK:r}}return{}};function pL(e){let{key:t,data:i,link:r,addDocLink:n=!0}=e,a="",o="",s="";qD(dL[t])?a=dL[t](i):YD(dL[t])&&(a=dL[t]);let{TRTC_ERROR_INFO:c,TRTC_ERROR_LINK:l}=hL();r?s="".concat(r.className,".html#").concat(r.fnName):l&&l[t]&&(qD(l[t])?s=l[t](i):YD(l[t])&&(s=l[t]));let d=a;return HD()&&(c&&c[t]&&(qD(c[t])?o=c[t](i):YD(c[t])&&(o=c[t])),o&&(d=n?"".concat(o,"\n请查看文档: ").concat(uL("zh-cn",s),"\n\n"):"".concat(o,"\n\n"),d+=a)),n&&(d+=" \nRefer to: ".concat(uL("en",s),"\n")),d}var fL,mL=xA(zA(),1),gL=class{constructor(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];UA(this,"countMap",new Map),UA(this,"distributionMap",new Map),UA(this,"version"),UA(this,"log",oL.createLogger({id:"kv"})),e&&(iL.on("102",e=>{let{track:t,cost:i}=e;this.addSuccessEvent({key:t.kind===hR?501700:511700,cost:i})}),iL.on("103",e=>{let{track:t,error:i}=e;this.addFailedEvent({key:t.kind===hR?501700:511700,error:i})}),iL.on("266",e=>{let{enable:t}=e;this.log.info("".concat(t?"enable":"disable"," sso")),t?this.addSuccessEvent({key:525701}):this.addFailedEvent({key:525701})}))}getReportData(e,t){let i={msg_sdk_basic_info:{uint32_sdk_version:AO(this.version||QA),uint32_terminal_type:15,bytes_device_name:"",bytes_os_version:"",uint32_framework:30,uint32_network_type:0},stats_count:[...this.countMap.entries()].map(e=>{let[t,i]=e;return{uint32_key:t,uint32_count:i}}),stats_distribution:[...this.distributionMap.entries()].map(e=>{let[t,i]=e;return{uint32_key:t,distribution_items:[...i.entries()].map(e=>{let[t,i]=e;return{uint32_item_key:t,uint32_item_value:i}})}}),str_user_sig:e,bytes_report_token:t};return this.countMap.clear(),this.distributionMap.clear(),i}clear(){this.countMap.clear(),this.distributionMap.clear()}isEnumKey(e){let t=+String(e).slice(-3);return t>=700&&t<799}isErrorCodeKey(e){let t=+String(e).slice(-3);return t>=600&&t<699}isCountKey(e){let t=+String(e).slice(-3);return t>=0&&t<599}isNumberKey(e){let t=+String(e).slice(-3);return t>=800&&t<899}addCount(e){let{key:t,useUV:i=!1}=e;this.isCountKey(t)?i&&this.countMap.has(t)||this.countMap.set(t,(this.countMap.get(t)||0)+1):this.log.debug("".concat(t," is not count key, last 3 number should be 0~599"))}addEnum(e){let{key:t,value:i,useUV:r=!0}=e;var n;if(!this.isEnumKey(t))return this.log.debug("".concat(t," is not enum key, last 3 number should be 700~799"));if(r&&this.countMap.has(t))return;this.countMap.set(t,(this.countMap.get(t)||0)+1);let a=(null==(n=this.distributionMap)?void 0:n.get(t))||new Map;a.set(i,(a.get(i)||0)+1),this.distributionMap.set(t,a)}addNumber(e){let{key:t,value:i,split:r=100,useUV:n=!1,max:a=5e3}=e;var o;if(!this.isNumberKey(t))return this.log.debug("".concat(t," is not number key, last 3 number should be 800~899"));if(n&&this.countMap.has(t))return;i>a&&(i=a),this.countMap.set(t,(this.countMap.get(t)||0)+1);let s=(null==(o=this.distributionMap)?void 0:o.get(t))||new Map,c=0;if(XD(r))c=Math.floor(i/r);else for(let l=r.length-1;l>0;l--)if(i>r[l]){c=l;break}s.set(c,(s.get(c)||0)+1),this.distributionMap.set(t,s)}addSuccessEvent(e){let{key:t,cost:i,timeKey:r,split:n}=e;if(t&&(this.addEnum({key:t,value:1,useUV:!1}),i)){let e=+String(t).slice(-3);e<800&&e>=700?this.addNumber({key:r||t+100,value:i,split:n}):r||this.log.debug("time stat ignored, ".concat(t))}}addFailedEvent(e){let{key:t,error:i}=e;if(!t)return;let r=mk.UNKNOWN;i&&(XD(i)?r=i:(!KD(i.extraCode)||!KD(i.code))&&(r=i.extraCode||i.code)),this.addEnum({key:t,value:0,useUV:!1}),this.addEnum({key:t,value:Math.abs(r),useUV:!1})}},_L=((fL=_L||{})[fL.DECODER_TYPE=514700]="DECODER_TYPE",fL[fL.DECODER_HW_SW=514701]="DECODER_HW_SW",fL[fL.DECODE_RESULT=514702]="DECODE_RESULT",fL[fL.DECODE_FAILED_OS=514703]="DECODE_FAILED_OS",fL[fL.DOWNGRADE_RESULT=514704]="DOWNGRADE_RESULT",fL[fL.DOWNGRADE_WEBCODECS_VIDEO=514705]="DOWNGRADE_WEBCODECS_VIDEO",fL[fL.DOWNGRADE_WEBCODECS_2D=514706]="DOWNGRADE_WEBCODECS_2D",fL[fL.DOWNGRADE_WASM_WEGBL=514707]="DOWNGRADE_WASM_WEGBL",fL[fL.DOWNGRADE_WASM_VIDEO=514708]="DOWNGRADE_WASM_VIDEO",fL[fL.DOWNGRADE_WASM_2D=514709]="DOWNGRADE_WASM_2D",fL[fL.DECODE_H264_RESULT=514710]="DECODE_H264_RESULT",fL[fL.DECODE_H265_RESULT=514711]="DECODE_H265_RESULT",fL[fL.DECODE_VP8_RESULT=514712]="DECODE_VP8_RESULT",fL[fL.DECODE_CAPABILITIES=514713]="DECODE_CAPABILITIES",fL[fL.H264_PROFILE_LEVEL_ID_HIGH=514714]="H264_PROFILE_LEVEL_ID_HIGH",fL[fL.H264_PROFILE_LEVEL_ID_MAIN=514715]="H264_PROFILE_LEVEL_ID_MAIN",fL[fL.RENDER_FREEZE_RATE=514850]="RENDER_FREEZE_RATE",fL[fL.DATA_FREEZE_RATE=514851]="DATA_FREEZE_RATE",fL[fL.VIDEO_CONSUME_RENDER_RATE=514852]="VIDEO_CONSUME_RENDER_RATE",fL),vL=new gL(!0);new gL(!1);var yL=vL,EL={result:!1,detail:{isBrowserSupported:!1,isWebRTCSupported:!1,isWebCodecsSupported:!1,isMediaDevicesSupported:!1,isScreenShareSupported:!1,isSmallStreamSupported:!1,isH264EncodeSupported:!1,isVp8EncodeSupported:!1,isH265EncodeSupported:!1,isH264DecodeSupported:!1,isVp8DecodeSupported:!1,isH265DecodeSupported:!1}},bL=new Map([[$k,["Firefox",eC]],[nC,["Edg",aC]],[YC,["Chrome",QC]],[eD,["Safari",iD]],[uC,["TBS",hC]],[pC,["XWEB",fC]],[gC&&Kk,["WeChat",_C]],[bC,["QQ(Win)",wC]],[yC,["QQ(Mobile)",EC]],[vC,["QQ(Mobile X5)",EC]],[IC,["QQ(Mac)",TC]],[SC,["QQ(iPad)",AC]],[LC,["MI",NC]],[PC,["HW",UC]],[FC,["Samsung",BC]],[VC,["OPPO",HC]],[jC,["VIVO",zC]],[iC,["EDGE",rC]],[sC,["SogouMobile",cC]],[lC,["Sogou",dC]]]);function wL(){let e=bL.get(!0);return{browserName:e?e[0]:"unknown",browserVersion:e?e[1]:"unknown"}}var IL=function(){return!(iC||nC&&oC<80||$k&&tC<56)},TL=function(){return["VideoDecoder","VideoEncoder","AudioEncoder","AudioDecoder"].every(e=>e in window)},SL=function(){if(!navigator.mediaDevices)return RL()||oL.error(dL.NOT_SUPPORTED_MEDIA),!1;let e=["getUserMedia","enumerateDevices"];return e.filter(e=>e in navigator.mediaDevices).length===e.length},AL=!1;function RL(){return"http:"===location.protocol&&!dD&&(AL||oL.error(pL({key:lL.NOT_SUPPORTED_HTTP})),AL=!0,!0)}var kL=function(){return(null==window?void 0:window.OffscreenCanvas)&&(null==window?void 0:window.MediaStreamTrackProcessor)&&(null==window?void 0:window.MediaStreamTrackGenerator)},CL=function(){return!(null==window||!window.MediaStreamTrackGenerator)},DL=async function(){var e,t,i;if(EL.detail.isH264EncodeSupported&&EL.detail.isVp8EncodeSupported)return{isH264EncodeSupported:EL.detail.isH264EncodeSupported,isVp8EncodeSupported:EL.detail.isVp8EncodeSupported,isH265EncodeSupported:EL.detail.isH265EncodeSupported};let r,n=!1,a=!1,o=!1;try{let s=new RTCPeerConnection,c=document.createElement(uR);c.getContext("2d");let l=c.captureStream(0);return s.addTrack(l.getVideoTracks()[0],l),r=await s.createOffer(),n=-1!==(null==(e=r.sdp)?void 0:e.toLowerCase().indexOf("h264")),a=-1!==(null==(t=r.sdp)?void 0:t.toLowerCase().indexOf("vp8")),o=-1!==(null==(i=r.sdp)?void 0:i.toLowerCase().indexOf("h265")),s.close(),{isH264EncodeSupported:n,isVp8EncodeSupported:a,isH265EncodeSupported:o}}catch(s){return{isH264EncodeSupported:!1,isVp8EncodeSupported:!1,isH265EncodeSupported:!1}}},OL=async function(){var e;if(EL.detail.isH264DecodeSupported&&EL.detail.isVp8DecodeSupported)return{isH264DecodeSupported:EL.detail.isH264DecodeSupported,isVp8DecodeSupported:EL.detail.isVp8DecodeSupported,isH265DecodeSupported:EL.detail.isH265DecodeSupported};let t,i=!1,r=!1;try{let n=new RTCPeerConnection;$L()?(n.addTransceiver(pR,{direction:"recvonly"}),t=await n.createOffer()):t=await n.createOffer({offerToReceiveVideo:!0}),-1!==t.sdp.toLowerCase().indexOf("h264")&&!(rD&&ZC<79)&&(i=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0);let a=-1!==(null==(e=t.sdp)?void 0:e.toLowerCase().indexOf("h265"));return n.close(),{isH264DecodeSupported:i,isVp8DecodeSupported:r,isH265DecodeSupported:a}}catch(n){return{isH264DecodeSupported:!1,isVp8DecodeSupported:!1,isH265DecodeSupported:!1}}};var LL=CO(async e=>{let t=Date.now(),i=hN(),r=SL(),n=TL();if(EL.detail.isWebRTCSupported=i,EL.detail.isMediaDevicesSupported=r,EL.detail.isWebCodecsSupported=n,EL.detail.isScreenShareSupported=PL(),EL.detail.isSmallStreamSupported=YL(),37===e)return Object.assign(EL.detail,await async function(){return FL||(FL=new Promise(async e=>{let t={isH264EncodeSupported:!1,isH264DecodeSupported:!1,isVp8EncodeSupported:!1,isVp8DecodeSupported:!1};if(!TL())return void e(t);let i=null,r=null,n=null,a=()=>{n&&clearTimeout(n),i=null,r=null};try{i=document.createElement("canvas"),r=i.getContext("2d"),i.width=320,i.height=240;let o=0,s=()=>{!r||!i||(r.fillStyle="hsl(".concat(o%360,", 50%, 50%)"),r.fillRect(0,0,i.width,i.height),r.fillStyle="white",r.font="20px Arial",r.fillText("Frame ".concat(o),10,30),o++)};n=setTimeout(()=>{a(),e(t)},5e3);let c=[{type:"h264",encodeConfig:{codec:"avc1.42E01E",avc:{format:"annexb"},width:320,height:240,bitrate:1e6},decodeConfig:{codec:"avc1.42E01E",avc:{format:"annexb"}}},{type:"vp8",encodeConfig:{codec:"vp8",width:320,height:240,bitrate:1e6},decodeConfig:{codec:"vp8"}}];(await Promise.all(c.map(async e=>{let t,r={type:e.type,encodeSupported:!1,decodeSupported:!1};try{t=await new Promise(async(t,n)=>{try{let a=new VideoEncoder({output:e=>{t(e),r.encodeSupported=!0},error:n});a.configure(e.encodeConfig),s();let o=new VideoFrame(i,{timestamp:0});a.encode(o,{keyFrame:!0}),o.close(),await a.flush(),a.close()}catch(a){n(a)}})}catch(p){return oL.warn("".concat(e.type," encoder error:"),p),r}try{await new Promise(async(i,n)=>{try{let a=new VideoDecoder({output:e=>{r.decodeSupported=!0,i(0),e.close()},error:n});a.configure(e.decodeConfig),a.decode(t),await a.flush(),a.close()}catch(a){n(a)}})}catch(p){oL.warn("".concat(e.type," decoder error:"),p)}return r}))).forEach(e=>{"h264"===e.type?(t.isH264EncodeSupported=e.encodeSupported,t.isH264DecodeSupported=e.decodeSupported):"vp8"===e.type&&(t.isVp8EncodeSupported=e.encodeSupported,t.isVp8DecodeSupported=e.decodeSupported)}),a(),e(t)}catch(o){a(),oL.warn("detectWebCodecsSupported failed:",o),e(t)}}),FL)}()),EL.detail.isBrowserSupported=n,EL.result=r&&n,EL.result||oL.error("".concat(navigator.userAgent," ").concat(wO(EL.detail,!1))),yN(e),yL.addNumber({key:523800,value:Date.now()-t}),EL;if(EL.result&&EL.detail.isH264EncodeSupported&&EL.detail.isVp8EncodeSupported&&EL.detail.isH265EncodeSupported&&EL.detail.isH264DecodeSupported&&EL.detail.isVp8DecodeSupported&&EL.detail.isH265DecodeSupported)return EL;let a=IL(),{encode:o,decode:s}=await async function(){let[e,t]=await Promise.all([DL(),OL()]);return{encode:{h264:e.isH264EncodeSupported,vp8:e.isVp8EncodeSupported,h265:e.isH265EncodeSupported},decode:{h264:t.isH264DecodeSupported,vp8:t.isVp8DecodeSupported,h265:t.isH265DecodeSupported}}}(),{h264:c,vp8:l}=o,{h264:d}=s,{h265:u}=o,{vp8:h,h265:p}=s;if(!c||!l){let e=await DL();oL.warn("detect encode again h264:".concat(c," vp8:").concat(l," result: ").concat(JSON.stringify(e))),c=e.isH264EncodeSupported,l=e.isVp8EncodeSupported}if(c&&d&&Jk&&KC&&!pC&&!uC&&(!VC||115!==ZC)){let{encode:e,decode:t}=await UL();c=e,d=t}return EL.result=a&&i&&r&&(c||l)&&(d||h),EL.detail.isBrowserSupported=a,EL.detail.isWebRTCSupported=i,EL.detail.isH264EncodeSupported=c,EL.detail.isVp8EncodeSupported=l,EL.detail.isH265EncodeSupported=u,EL.detail.isH264DecodeSupported=d,EL.detail.isVp8DecodeSupported=h,EL.detail.isH265DecodeSupported=p,EL.result||oL.error("".concat(navigator.userAgent," ").concat(wO(EL.detail,!1))),yN(),yL.addNumber({key:523800,value:Date.now()-t}),EL}),NL=function(){return EL.result},PL=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)},xL="undefined"!=typeof HTMLMediaElement&&"setSinkId"in HTMLMediaElement.prototype,ML=null;async function UL(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3;return ML||(ML=new Promise(async t=>{let i={encode:!1,decode:!1},r=()=>{};try{let n=document.createElement("canvas"),a=n.getContext("2d");n.width=640,n.height=480;let o=setInterval(()=>{a.fillText("test",Math.floor(640*Math.random()),Math.floor(480*Math.random()))},66),s=-1,c=-1;r=()=>{clearInterval(s),clearInterval(o),clearTimeout(c),d.close(),u.close(),l.getTracks().forEach(e=>e.stop())},c=setTimeout(()=>{r(),t(i)},e);let l=n.captureStream(),d=new RTCPeerConnection({}),u=new RTCPeerConnection({offerToReceiveAudio:!0,offerToReceiveVideo:!0});d.addEventListener("icecandidate",e=>u.addIceCandidate(e.candidate)),u.addEventListener("icecandidate",e=>d.addIceCandidate(e.candidate)),d.addTrack(l.getVideoTracks()[0],l);let h=await d.createOffer();await d.setLocalDescription(h),await u.setRemoteDescription(h);let p=await u.createAnswer(),f=mL.default.parse(p.sdp),m=f.media[0].rtp.findIndex(e=>"H264"===e.codec);f.media[0].rtp=[f.media[0].rtp[m]],f.media[0].fmtp=f.media[0].fmtp.filter(e=>e.payload===f.media[0].rtp[0].payload),f.media[0].rtcpFb&&(f.media[0].rtcpFb=f.media[0].rtcpFb.filter(e=>e.payload===f.media[0].rtp[0].payload)),p.sdp=mL.default.write(f),await u.setLocalDescription(p),await d.setRemoteDescription(p),s=setInterval(async()=>{i.encode&&i.decode&&(r(),t(i));let e=d.getSenders()[0],n=u.getReceivers()[0];if(!e||!n)return;let[a,o]=await Promise.all([e.getStats(),n.getStats()]);i.encode||a.forEach(e=>{"outbound-rtp"===e.type&&(e.mediaType===pR||e.kind===pR)&&e.bytesSent>0&&(i.encode=!0)}),i.decode||o.forEach(e=>{"inbound-rtp"===e.type&&(e.mediaType===pR||e.kind===pR)&&e.bytesReceived>0&&(i.decode=!0)})},100)}catch(n){r(),oL.warn("detectH264Supported failed",n),t({encode:!0,decode:!0})}}).then(e=>(e.encode||(e.decode=!0),(!e.encode||!e.decode)&&oL.warn("detectH264Supported encode: ".concat(e.encode," decode: ").concat(e.decode," ").concat("")),e)),ML)}var FL=null;var BL=(e,t,i)=>{"http:"===location.protocol&&!dD&&(e[t]=()=>{throw new _k({code:mk.INVALID_OPERATION,message:dL.NOT_SUPPORTED_HTTP})})},VL=function(e){return!("candidate-pair"!==e.type||!e.nominated||"in-progress"!==e.state&&"succeeded"!==e.state)&&!(ZD(e.selected)&&!e.selected)};function HL(){let e="";if(screen.width){let t=screen.width?screen.width*window.devicePixelRatio:"",i=screen.height?screen.height*window.devicePixelRatio:"";e+="".concat(t," * ").concat(i)}return e}function jL(){return navigator.getUserMedia||navigator.mediaDevices&&navigator.mediaDevices.getUserMedia}function zL(){let e={isSupported:!1},t=["AudioContext","webkitAudioContext","mozAudioContext","msAudioContext"];for(let i=0;i<t.length;i++)if(t[i]in window){e.isSupported=!0;break}return e.isSupported}function WL(){return"captureStream"in HTMLCanvasElement.prototype}function GL(){return!(gC||Xk||ZC&&ZC<63)&&!(!IL()||!WL())}function qL(){return!(ZC<74||iC||oD<11||tC<46)}function KL(){return KC&&ZC>=131}function YL(){return GL()||qL()}var XL=function(){if(KD(window.RTCRtpTransceiver)||!$L()||!("currentDirection"in RTCRtpTransceiver.prototype))return!1;let e=null,t=!1;try{e=new RTCPeerConnection({sdpSemantics:"unified-plan"}),e.addTransceiver(hR),t=!0}catch(nM){}return null==e||e.close(),t};function ZL(){return"RTCPeerConnection"in window&&"getReceivers"in window.RTCPeerConnection.prototype}function JL(){return"RTCPeerConnection"in window&&"getSenders"in window.RTCPeerConnection.prototype}function QL(){return"RTCPeerConnection"in window&&"getTransceivers"in window.RTCPeerConnection.prototype}function $L(){return!(11===oD&&!lD)&&("RTCPeerConnection"in window&&"addTransceiver"in window.RTCPeerConnection.prototype)}var eN=!(!$L()||KC&&ZC<86);function tN(){return"RTCRtpTransceiver"in window&&"stop"in window.RTCRtpTransceiver.prototype}var iN="RTCRtpSender"in window;function rN(){return iN&&"replaceTrack"in window.RTCRtpSender.prototype}function nN(){return iN&&"setParameters"in window.RTCRtpSender.prototype&&JL()}var aN="RTCRtpReceiver"in window&&"getSynchronizationSources"in window.RTCRtpReceiver.prototype,oN=window.MediaStreamTrack&&"getSettings"in MediaStreamTrack.prototype,sN=window.MediaStreamTrack&&"getCapabilities"in MediaStreamTrack.prototype,cN="undefined"!=typeof InputDeviceInfo&&"getCapabilities"in InputDeviceInfo.prototype,lN=iN&&"createEncodedStreams"in window.RTCRtpSender.prototype&&GC()>=86,dN="RTCRtpScriptTransform"in window,uN=iN&&(lN||dN),hN=function(){return["RTCPeerConnection","webkitRTCPeerConnection","RTCIceGatherer"].filter(e=>e in window).length>0};function pN(){let e={AudioDecoder:!1,AudioEncoder:!1,VideoDecoder:!1,VideoEncoder:!1,ImageDecoder:!1};return KD(window.AudioDecoder)||(e.AudioDecoder=!0),KD(window.AudioEncoder)||(e.AudioEncoder=!0),KD(window.VideoDecoder)||(e.VideoDecoder=!0),KD(window.VideoEncoder)||(e.VideoEncoder=!0),KD(window.ImageDecoder)||(e.ImageDecoder=!0),e}function fN(){return"mediaSession"in navigator&&!KD(navigator.mediaSession.setActionHandler)}function mN(){return!KD(window.WebTransport)}function gN(){return"undefined"!=typeof WebAssembly&&WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))}function _N(){let e={browser:"".concat(hD.name,"/").concat(hD.version),os:yD(),displayResolution:HL(),isScreenShareSupported:PL(),isWebRTCSupported:hN(),isGetUserMediaSupported:jL(),isWebAudioSupported:zL(),isWebSocketsSupported:"WebSocket"in window&&2===window.WebSocket.CLOSING,isWebCodecSupported:pN(),isMediaSessionSupported:fN(),isWebTransportSupported:mN()};return navigator.userAgent.includes("miniProgram")&&(e.browser="mini/".concat(e.browser)),e}var vN="checkResult";function yN(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30;cL.setItem(vN+e,{ua:navigator.userAgent,checkResult:EL})}function EN(e){RL();let t=cL.getItem(vN+e);t&&t.ua===navigator.userAgent&&t.checkResult&&function(e,t){return!!JD(e)&&Object.keys(t).every(t=>t in e)}(t.checkResult.detail,EL.detail)&&(EL=t.checkResult),LL(e)}function bN(){return"requestVideoFrameCallback"in HTMLVideoElement.prototype}var wN="RTCRtpReceiver"in window&&"jitterBufferTarget"in window.RTCRtpReceiver.prototype;function IN(e){return{h264:1,h265:2,vp8:3,vp9:4,av1:5}[e]}var TN=!1;async function SN(){var e;try{if(TN||null==(e=null==navigator?void 0:navigator.mediaCapabilities)||!e.encodingInfo)return;let t=ED(),i=gC||pC?4:KC?1:eD?2:$k?3:0;if(0===t||0===i)return;TN=!0;let r=["H264","VP8","VP9","AV1","H265"],[n,a]=await Promise.all([AN(r),RN(r)]);n&&Object.keys(n).forEach(e=>{let r=IN(e.toLowerCase());yL.addEnum({key:513707,value:+"".concat(r).concat(+n[e].supported).concat(+n[e].powerEfficient).concat(t).concat(i),useUV:!1})}),a&&Object.keys(a).forEach(e=>{let r=IN(e.toLowerCase());yL.addEnum({key:514713,value:+"".concat(r).concat(+a[e].supported).concat(+a[e].powerEfficient).concat(t).concat(i),useUV:!1})});let{sender:o,receiver:s}=kN();yL.addEnum({key:513708,value:+"".concat(t).concat(i).concat(+o.high),useUV:!1}),yL.addEnum({key:513709,value:+"".concat(t).concat(i).concat(+o.main),useUV:!1}),yL.addEnum({key:514714,value:+"".concat(t).concat(i).concat(+s.high),useUV:!1}),yL.addEnum({key:514715,value:+"".concat(t).concat(i).concat(+s.main),useUV:!1})}catch(t){oL.info("detectVideoCodecCapabilities failed",t)}}async function AN(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1920,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1080,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:3e3,a={};try{for(let o of e){let e=await navigator.mediaCapabilities.encodingInfo({type:"webrtc",video:{contentType:"video/".concat(o),width:t,height:i,bitrate:n,framerate:r}});a[o]=e}}catch(ZA){}return a}async function RN(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1920,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1080,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:3e3,a={};try{for(let o of e){let e=await navigator.mediaCapabilities.decodingInfo({type:"webrtc",video:{contentType:"video/".concat(o),width:t,height:i,bitrate:n,framerate:r}});a[o]=e}}catch(ZA){}return a}function kN(){let e={sender:{base:!1,main:!1,high:!1},receiver:{base:!1,main:!1,high:!1}};try{if(RTCRtpSender&&"function"==typeof RTCRtpSender.getCapabilities){let t=RTCRtpSender.getCapabilities("video");t&&t.codecs&&t.codecs.filter(e=>"video/h264"===e.mimeType.toLowerCase()).forEach(t=>{if(t.sdpFmtpLine){let i=t.sdpFmtpLine.match(/profile-level-id=([0-9a-fA-F]+)/);if(i&&i[1])switch(i[1].slice(0,2)){case"42":e.sender.base=!0;break;case"4d":e.sender.main=!0;break;case"64":e.sender.high=!0}}})}if(RTCRtpReceiver&&"function"==typeof RTCRtpReceiver.getCapabilities){let t=RTCRtpReceiver.getCapabilities("video");t&&t.codecs&&t.codecs.filter(e=>"video/h264"===e.mimeType.toLowerCase()).forEach(t=>{if(t.sdpFmtpLine){let i=t.sdpFmtpLine.match(/profile-level-id=([0-9a-fA-F]+)/);if(i&&i[1])switch(i[1].slice(0,2)){case"42":e.receiver.base=!0;break;case"4d":e.receiver.main=!0;break;case"64":e.receiver.high=!0}}})}}catch(t){oL.warn("get H264 profile levelId failed",t)}return e}var CN=xA(BA(),1),DN=Symbol("instance"),ON=Symbol("cacheResult"),LN=class{constructor(e,t,i){this.oldState=e,this.newState=t,this.action=i,this.aborted=!1}abort(e){this.aborted=!0,UN.call(e,this.oldState,new Error("action '".concat(this.action,"' aborted")))}toString(){return"".concat(this.action,"ing")}},NN=class extends Error{constructor(e,t,i){super(t),this.state=e,this.message=t,this.cause=i}};var PN=new Map;function xN(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(r,n,a)=>{let o=i.action||n;if(!i.context){let i=PN.get(r)||[];PN.has(r)||PN.set(r,i),i.push({from:e,to:t,action:o})}let s=a.value;a.value=function(){let r=this;for(var n=arguments.length,a=new Array(n),c=0;c<n;c++)a[c]=arguments[c];if(i.context&&(r=FN.get("function"==typeof i.context?i.context.call(this,...a):i.context)),r.state===t)return i.sync?r[ON]:Promise.resolve(r[ON]);r.state instanceof LN&&r.state.action==i.abortAction&&r.state.abort(r);let l=null;Array.isArray(e)?0==e.length?r.state instanceof LN&&r.state.abort(r):("string"!=typeof r.state||!e.includes(r.state))&&(l=new NN(r._state,"".concat(r.name," ").concat(o," to ").concat(t," failed: current state ").concat(r._state," not from ").concat(e.join("|")))):e!==r.state&&(l=new NN(r._state,"".concat(r.name," ").concat(o," to ").concat(t," failed: current state ").concat(r._state," not from ").concat(e)));let d=e=>{if(i.fail&&i.fail.call(this,e),i.sync){if(i.ignoreError)return e;throw e}return i.ignoreError?Promise.resolve(e):Promise.reject(e)};if(l)return d(l);let u=r.state,h=new LN(u,t,o);UN.call(r,h);let p=e=>{var n;return r[ON]=e,h.aborted||(UN.call(r,t),null===(n=i.success)||void 0===n||n.call(this,r[ON])),e},f=e=>(UN.call(r,u,e),d(e));try{let e=s.apply(this,a);return function(e){return"object"==typeof e&&e&&"then"in e}(e)?e.then(p).catch(f):i.sync?p(e):Promise.resolve(p(e))}catch(m){return f(new NN(r._state,"".concat(r.name," ").concat(o," from ").concat(e," to ").concat(t," failed: ").concat(m),m instanceof Error?m:new Error(String(m))))}}}}var MN="undefined"!=typeof window&&window.__AFSM__?(e,t)=>{window.dispatchEvent(new CustomEvent(e,{detail:t}))}:"undefined"!=typeof importScripts?(e,t)=>{postMessage({type:e,payload:t})}:()=>{};function UN(e,t){let i=this._state;this._state=e;let r=e.toString();e&&this.emit(r,i),this.emit(FN.STATECHANGED,e,i,t),this.updateDevTools({value:e,old:i,err:t instanceof Error?t.message:String(t)})}var FN=class e extends CN.default{constructor(t,i,r){super(),this.name=t,this.groupName=i,this._state=e.INIT,t||(t=Date.now().toString(36)),r?Object.setPrototypeOf(this,r):r=Object.getPrototypeOf(this),i||(this.groupName=this.constructor.name);let n=r[DN];n?this.name=n.name+"-"+n.count++:r[DN]={name:this.name,count:0},this.updateDevTools({diagram:this.stateDiagram})}get stateDiagram(){let e=Object.getPrototypeOf(this),t=PN.get(e)||[],i=new Set,r=[],n=[],a=new Set,o=Object.getPrototypeOf(e);PN.has(o)&&(o.stateDiagram.forEach(e=>i.add(e)),o.allStates.forEach(e=>a.add(e))),t.forEach(e=>{let{from:t,to:i,action:a}=e;"string"==typeof t?r.push({from:t,to:i,action:a}):t.length?t.forEach(e=>{r.push({from:e,to:i,action:a})}):n.push({to:i,action:a})}),r.forEach(e=>{let{from:t,to:r,action:n}=e;a.add(t),a.add(r),a.add(n+"ing"),i.add("".concat(t," --\x3e ").concat(n,"ing : ").concat(n)),i.add("".concat(n,"ing --\x3e ").concat(r," : ").concat(n," 🟢")),i.add("".concat(n,"ing --\x3e ").concat(t," : ").concat(n," 🔴"))}),n.forEach(e=>{let{to:t,action:r}=e;i.add("".concat(r,"ing --\x3e ").concat(t," : ").concat(r," 🟢")),a.forEach(e=>{e!==t&&i.add("".concat(e," --\x3e ").concat(r,"ing : ").concat(r))})});let s=[...i];return Object.defineProperties(e,{stateDiagram:{value:s},allStates:{value:a}}),s}static get(t){let i;return"string"==typeof t?(i=e.instances.get(t),i||e.instances.set(t,i=new e(t,void 0,Object.create(e.prototype)))):(i=e.instances2.get(t),i||e.instances2.set(t,i=new e(t.constructor.name,void 0,Object.create(e.prototype)))),i}static getState(t){var i;return null===(i=e.get(t))||void 0===i?void 0:i.state}updateDevTools(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};MN(e.UPDATEAFSM,Object.assign({name:this.name,group:this.groupName},t))}get state(){return this._state}set state(e){UN.call(this,e)}};FN.STATECHANGED="stateChanged",FN.UPDATEAFSM="updateAFSM",FN.INIT="[*]",FN.ON="on",FN.OFF="off",FN.instances=new Map,FN.instances2=new WeakMap;var BN="undefined"!=typeof window,VN=BN&&window.requestIdleCallback||function(e){let t=Date.now();return setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1e3)},HN=BN&&window.cancelIdleCallback||function(e){clearTimeout(e)},jN=BN&&(window.cancelAnimationFrame||window.mozCancelAnimationFrame),zN=class e{static generateTaskID(){return this.currentTaskID++}static run(e,t,i){null!=i&&i.fps&&(i.delay=i.delay||Number((1e3/i.fps).toFixed(2))),i=DA("interval"===e?{delay:2e3,count:0,backgroundTask:!0}:"ric"===e?{delay:1e4,count:0}:"raf"===e?{fps:60,delay:16.6,count:0,backgroundTask:!0}:{delay:2e3,count:0,backgroundTask:!0},i);let r=OA(DA({taskID:this.generateTaskID(),loopCount:0,intervalID:null,timeoutID:null,rafID:null,ricID:null,taskName:e,callback:t},i),{delay:i.delay});return this.taskMap.set(r.taskID,r),this[e](r),r.taskID}static interval(t){return t.intervalID=setInterval(()=>{t.callback(),t.loopCount+=1,e.isBreakLoop(t)},t.delay)}static intervalInWorker(t){e.sharedWorker||(e.sharedWorker=new Worker(URL.createObjectURL(new Blob(["\n const timers = new Map();\n self.onmessage = function(e) {\n const { taskId, delay, type } = e.data;\n if (type === 'start') {\n timers.set(taskId, setInterval(() => {\n self.postMessage({ type: 'tick', taskId });\n }, delay));\n } else if (type === 'stop') {\n clearInterval(timers.get(taskId));\n timers.delete(taskId);\n }\n };\n "],{type:"application/javascript"}))),e.sharedWorker.onmessage=t=>{var i;if("tick"===t.data.type){let r=e.workerTasks.get(t.data.taskId);r&&(e.isBreakLoop(r)?(null==(i=e.sharedWorker)||i.postMessage({type:"stop",taskId:r.taskID}),e.workerTasks.delete(r.taskID)):(r.callback(),r.loopCount+=1))}}),e.workerTasks.set(t.taskID,t),e.sharedWorker.postMessage({taskId:t.taskID,delay:t.delay,type:"start"})}static timeout(t){let i=()=>{if(t.callback(),t.loopCount+=1,!e.isBreakLoop(t))return t.timeoutID=setTimeout(i,t.delay)};return t.timeoutID=setTimeout(i,t.delay)}static ric(t){let i,r=sO(),n=()=>{if(i=sO()-r,i>=t.delay&&(r=sO()-Math.floor(i%t.delay),t.callback(),t.loopCount+=1),!e.isBreakLoop(t))return t.ricID=VN(n,{timeout:t.delay})};return t.ricID=VN(n,{timeout:t.delay})}static raf(t){let i,r=sO(),n=()=>document.hidden&&t.backgroundTask?(i=sO()-r,r=sO(),t.callback(),t.loopCount+=1,e.isBreakLoop(t)?void 0:t.timeoutID=setTimeout(n,t.delay-Math.floor(i%t.delay))):(i=sO()-r,i>=t.delay&&(r=sO()-Math.floor(i%t.delay),t.callback(),t.loopCount+=1),e.isBreakLoop(t)?void 0:t.rafID=requestAnimationFrame(n));if(t.rafID=requestAnimationFrame(n),t.backgroundTask){let e=()=>{if(document.hidden){let e=sO()-r;e>=t.delay?n():t.timeoutID=setTimeout(n,t.delay-e)}};document.addEventListener("visibilitychange",e),t.onVisibilitychange=e,document.hidden&&e()}return t.taskID}static hasTask(e){return this.taskMap.has(e)}static clearTask(e){if(!this.taskMap.has(e))return!0;let{intervalID:t,timeoutID:i,rafID:r,ricID:n,onVisibilitychange:a}=this.taskMap.get(e);return t&&clearInterval(t),i&&clearTimeout(i),r&&jN&&jN(r),n&&HN(n),a&&document.removeEventListener("visibilitychange",a),this.taskMap.delete(e),!0}static isBreakLoop(e){return!this.hasTask(e.taskID)||0!==e.count&&e.loopCount>=e.count&&(this.clearTask(e.taskID),!0)}};UA(zN,"taskMap",new Map),UA(zN,"currentTaskID",1),UA(zN,"sharedWorker",null),UA(zN,"workerTasks",new Map);var WN=zN,GN={LOAD_START:IR,LOADED_DATA:TR,LOADED_META_DATA:SR,MEDIA_TRACK_CHANGED:"media-track-changed",PLAYER_STATE_CHANGED:"player-state-changed",ERROR:"error",AUTOPLAY_FAILED:"autoplay-failed",RESIZE:OR,TIME_UPDATE:"time-update",LEAVE_PICTURE_IN_PICTURE:CR,ENTER_PICTURE_IN_PICTURE:kR,USER_RESUME_IN_PIP_OR_FULL_SCREEN:"user-resume-in-pip-or-full-screen",USER_PAUSE_IN_PIP_OR_FULL_SCREEN:"user-pause-in-pip-or-full-screen",ENTER_FULL_SCREEN:"enter-full-screen",LEAVE_FULL_SCREEN:"leave-full-screen",VOLUME_CHANGE:"volume-change"},qN={};PA(qN,{create:()=>YN,remove:()=>XN});var KN=new WeakMap;function YN(e,t){KN.has(e)||KN.set(e,[]);let i=KN.get(e),r={add:(e,n)=>("addEventListener"in t?(i.push(t.removeEventListener.bind(t,e,n)),t.addEventListener(e,n)):(i.push(t.off.bind(t,e,n)),t.on(e,n)),r)};return r}function XN(e){let t=KN.get(e);t&&(t.forEach(e=>e()),KN.delete(e))}var ZN=new class{constructor(){UA(this,"_roomIdMap",new Map),UA(this,"_configs"),"undefined"==typeof registerProcessor&&(this._configs={sdkAppId:"",userId:"",version:QA,env:aR,browserVersion:hD.name+hD.version,ua:navigator.userAgent})}setConfig(e){let{sdkAppId:t,env:i,userId:r,roomId:n}=e;t!==this._configs.sdkAppId&&(this._configs.sdkAppId=String(t)),this._configs.env=i,this._configs.userId=r,this._roomIdMap.set(r,String(n))}logSuccessEvent(e){dD||!oL.isAbleToUpload||this._configs.env===aR&&this.uploadEventToKibana(OA(DA({},e),{result:"success"}))}logFailedEvent(e){if(dD||!oL.isAbleToUpload)return;let{eventType:t,code:i,error:r,userId:n}=e,a={roomId:this._roomIdMap.get(n||this._configs.userId),userId:n,eventType:t,result:"failed",code:i||(null==r?void 0:r.extraCode)||(null==r?void 0:r.code)||mk.UNKNOWN};this._configs.env===aR&&this.uploadEventToKibana(OA(DA({},a),{error:r}))}uploadEventToKibana(e){let t="stat-".concat(e.eventType,"-").concat(e.result);("delta-join"===e.eventType||"delta-leave"===e.eventType||"delta-publish"===e.eventType)&&(t="".concat(e.eventType,":").concat(e.delta)),this.uploadEvent({log:t,userId:e.userId}),"failed"===e.result&&(t="stat-".concat(e.eventType,"-").concat(e.result,"-").concat(e.code),this.uploadEvent({log:t,userId:e.userId,error:e.error}))}uploadEvent(e){let{log:t,userId:i,error:r}=e,n={timestamp:yk(),sdkAppId:this._configs.sdkAppId,userId:i||this._configs.userId,version:QA,log:t};r&&(n.errorInfo=r.message,r.stack&&(n.errorInfo+="\n".concat(r.stack)));let a=nL.enable?FO(n,2002,Number(this._configs.sdkAppId)):JSON.stringify(n);this.sendRequest(RD(this._configs.sdkAppId,nR),a)}sendRequest(e,t){setTimeout(()=>YO({url:e,body:t,priority:"low"}).catch(()=>{}),2e3)}},JN=new WeakMap;var QN=class extends FN{constructor(e,t){super(e.id,"".concat(t,"-player")),this.options=e,this.kind=t,UA(this,"id"),UA(this,"element",null),UA(this,"track"),UA(this,"url"),UA(this,"attr"),UA(this,"mode"),UA(this,"muted"),UA(this,"_log"),UA(this,"isPausedByUserCall",!1),UA(this,"_pausedRetryCount"),UA(this,"_isElementPlayingFired",!1),UA(this,"_interval"),UA(this,"_delayDestroyTimeoutId",0),UA(this,"_playSuccessResolve"),UA(this,"_isReplayByRecreateMediaStreamCalled",!1),UA(this,"isPlayCalled",!1),UA(this,"isInAutoPlayFailedState",!1),UA(this,"isBindAutoPlayEvent",!1),this.id=e.id,this._log=e.log,this.track=e.track,this.muted=e.muted,this._pausedRetryCount=5,this._state="STOPPED",this.bindTrackEvents(),this._log.info("create ".concat(t,"-player ").concat(this.id))}get isPlaying(){var e;return"PLAYING"===this._state&&!1===(null==(e=this.element)?void 0:e.paused)}get isPaused(){var e;return"PAUSED"===this._state||!0===(null==(e=this.element)?void 0:e.paused)}get isStopped(){return"STOPPED"===this._state}setAttr(e){this.attr=e}setUrl(e){this.track&&(this.unbindTrackEvents(),this.element&&(this.element.srcObject=null),this.track=null),e!==this.url&&(this.url=e,null!==e&&this.element&&(this.element.crossOrigin="anonymous",this.element.src=e))}async play(){if(!this.isPlaying)try{this.isPlayCalled=!0,this._delayDestroyTimeoutId&&(clearTimeout(this._delayDestroyTimeoutId),this._delayDestroyTimeoutId=0,this.element&&(this.element.muted=this.muted),this.bindTrackEvents(),this.bindElementEvents()),this.bindAutoPlayEvent(),await new Promise((e,t)=>{this._playSuccessResolve=e,this.element.play().then(e,t)})}catch(nM){let t=pL({key:lL.PLAY_FAILED,data:{media:this.kind,error:nM}});if(this._log.warn(nM),t.includes("NotAllowedError"))throw this.isInAutoPlayFailedState=!0,new _k({code:mk.PLAY_NOT_ALLOWED,message:t})}}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t;this.isPlayCalled=!1,this.isPausedByUserCall=!1,this._isElementPlayingFired=!1,this.unbindEvents(),e>0&&!tD?this._delayDestroyTimeoutId||(this.element&&(this.element.muted=!0),null==(t=this.element)||t.remove(),this._log.info("destroy element after 3 * ".concat(e)),this._delayDestroyTimeoutId=setTimeout(()=>this.destroyElement(),3*e)):this.destroyElement(),this.handleStopped(yR),this._interval>0&&WN.clearTask(this._interval)}destroyElement(){this.element&&(this._log.debug("destroy element"),this.element.remove(),this.element.src="",this.element.srcObject=null,this.element=null),clearTimeout(this._delayDestroyTimeoutId),this._delayDestroyTimeoutId=0}pause(){this._log.info("pause"),this.isPausedByUserCall=!0,this.doPause()}doPause(){var e;null==(e=this.element)||e.pause()}resume(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isPausedByUserCall=!1,this.doResume(e)}doResume(){return this._log.info("resume"),this.isPausedByUserCall||this.isPlaying?Promise.resolve():sD?this.replay():this.play().catch(()=>{})}setMuted(e){this.element&&(this.element.muted=e),this.muted=e}replay(){return this.stop(),this.play().catch(()=>{})}bindElementEvents(){if(this.element){let e=this.handleElementEvent.bind(this);return YN(this.element,this.element).add(ER,e).add(yR,e).add(bR,e).add(wR,e).add(IR,e).add(TR,e).add(SR,e)}}bindTrackEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.track;if(e){let t=this.handleTrackEvent.bind(this);null==qN||qN.create(e,e).add(yR,t).add(_R,t).add(vR,t),e.readyState===yR&&this.handleTrackEvent({type:yR}),e.muted&&this.handleTrackEvent({type:_R})}}bindAutoPlayEvent(){this.isBindAutoPlayEvent||(iL.on(rL.AUTOPLAY_DIALOG_CLICK_CONFIRM,this.resume,this),this.isBindAutoPlayEvent=!0)}unbindTrackEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.track;e&&XN(e)}unbindEvents(){this.element&&XN(this.element),this.unbindTrackEvents(),iL.off(rL.AUTOPLAY_DIALOG_CLICK_CONFIRM,this.resume,this),this.isBindAutoPlayEvent=!1}handleElementEvent(e){switch(e.type){case ER:gP()||(this.isInAutoPlayFailedState=!1),this._isElementPlayingFired=!0,this._log.info("".concat(this.kind," player is playing")),this.handlePlaying(ER),this._interval&&(WN.clearTask(this._interval),this._interval=-1);break;case yR:this._log.info("".concat(this.kind," player is ended")),this.handleStopped(yR);break;case bR:this._log.info("".concat(this.kind," player is paused")),this.handlePaused(bR);break;case wR:if(this.element&&this.element.error){this.handlePaused(wR);let{code:e,message:t}=this.element.error;this._log.error("".concat(this.kind," ").concat(this._log.isLocal?"local":"remote"," MediaError code: ").concat(e," message: ").concat(t," userAgent: ").concat(navigator.userAgent)),ZN.uploadEvent({log:"stat-".concat(this.kind,"-").concat(LR,"-").concat(e,"-").concat(navigator.userAgent),error:this.element.error}),MC||xC?this.emit(GN.ERROR,this.element.error):this.replayByRecreateMediaStream(this.element.error)}break;case TR:this.kind===pR&&this.emit(GN.LOADED_DATA);break;case SR:this.kind===pR&&this.emit(GN.LOADED_META_DATA);break;case IR:this.emit(GN.LOAD_START)}}replayByRecreateMediaStream(e){if(!this._isReplayByRecreateMediaStreamCalled)return this._isReplayByRecreateMediaStreamCalled=!0,this.doReplayByRecreateMediaStream(1e3).then(()=>{this._log.warn("replayByRecreateMediaStream success"),ZN.uploadEvent({log:"stat-replayByRecreateMediaStream-success"}),yL.addSuccessEvent({key:this.kind===hR?506700:516700})}).catch(()=>{var t;this._log.error("replayByRecreateMediaStream failed"),ZN.uploadEvent({log:"stat-replayByRecreateMediaStream-failed"}),yL.addFailedEvent({key:this.kind===hR?506700:516700,error:null==(t=this.element)?void 0:t.error}),this.emit(GN.ERROR,e)})}doReplayByRecreateMediaStream(e){return this._log.warn("delay ".concat(e,"ms to recreate mediaStream")),new Promise((t,i)=>{kO(e).then(()=>{this.element&&(this.element.srcObject=null,this.element.srcObject=new MediaStream([this.track]),this._log.warn("recreated mediaStream"),this.element.onerror=()=>{var e,t,r;this._log.warn("element onerror ".concat(null==(t=null==(e=this.element)?void 0:e.error)?void 0:t.code," fired after recreated mediaStream")),i(null==(r=this.element)?void 0:r.error)}),kO(5e3).then(()=>{var e,r;(!this.isPlaying||null!=(e=this.element)&&e.error)&&i(null==(r=this.element)?void 0:r.error),t()})})}).finally(()=>{this.element&&(this.element.onerror=null)})}async handleTrackEvent(e){let t=e.type;switch(this.options.enableLogTrackState&&this._log[t===vR?"info":"warn"]("track ".concat(t)),t){case yR:this.handleStopped(yR);break;case _R:this.handlePaused(_R);break;case vR:this.mode>0?this.handlePlaying(this.mode.toString()):this.element&&(this.element.paused&&!this.isPausedByUserCall&&(this._log.warn("track unmuted and element is paused, resume"),await this.doResume()),this.element&&!this.element.paused&&this._isElementPlayingFired&&this.handlePlaying(vR))}}handlePlaying(e){var t;return this._log.debug("handlePlaying",e),null==(t=this._playSuccessResolve)||t.call(this,e),e}handlePaused(e){return this._log.debug("handlePaused",e),e}handleStopped(e){return this._log.debug("handleStopped",e),e}getElement(){return this.element}};UA(QN,"PlayerEvent",GN),MA([function(e){let{settings:t={retries:5,timeout:2e3},onError:i,onRetrying:r,onRetryFailed:n}=e;return function(e,a,o){let s=eL({retryFunction:o.value,settings:t,onError(t){let{error:r,retry:n,reject:o,retryFuncArgs:s}=t;var c;i?i.call(this,r,()=>{var t;null!=(t=JN.get(e))&&t.has(a)?n():o(r)},o,s):null!=(c=JN.get(e))&&c.has(a)?n():o(r)},onRetrying(t,i){var n;ZO(r)&&r.call(this,t,i),null!=(n=JN.get(e))&&n.has(a)&&(JN.get(e).get(a).stopRetry=i)},onRetryFailed:n});return o.value=function(){let t=JN.get(e);for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];return t?t.set(a,{args:r}):JN.set(e,new Map([[a,{args:r}]])),s.apply(this,r).finally(()=>{var t;return null==(t=JN.get(e))?void 0:t.delete(a)})},o}}({settings:{retries:2,timeout:0},onError(e,t,i,r){r[0]=(r[0]||1e3)+1e3,t()}})],QN.prototype,"doReplayByRecreateMediaStream",1),MA([xN([],"PLAYING",{sync:!0,success(e){this.emit(GN.PLAYER_STATE_CHANGED,{type:this.kind,state:"PLAYING",reason:e})}})],QN.prototype,"handlePlaying",1),MA([xN("PLAYING","PAUSED",{ignoreError:!0,sync:!0,success(e){this.emit(GN.PLAYER_STATE_CHANGED,{type:this.kind,state:"PAUSED",reason:e})}})],QN.prototype,"handlePaused",1),MA([xN([],"STOPPED",{sync:!0,success(e){this.emit(GN.PLAYER_STATE_CHANGED,{type:this.kind,state:"STOPPED",reason:e})}})],QN.prototype,"handleStopped",1);var $N="trtc_autoplay",eP="".concat($N,"_mask"),tP="".concat($N,"_wrapper"),iP="".concat($N,"_header"),rP="".concat($N,"_content"),nP="".concat($N,"_action_wrapper"),aP="".concat($N,"_question"),oP="".concat($N,"_collapse"),sP="".concat($N,"_action_confirm"),cP="".concat($N,"_detail"),lP="#2473E8",dP="dialog",uP="".concat(dP,"-show"),hP="".concat(dP,"-1"),pP="".concat(dP,"-2"),fP=!1,mP=!1,gP=()=>mP,_P="".concat(tR,"/").concat(HD()?"zh-cn":"en","/tutorial-21-advanced-auto-play-policy.html"),vP="<br><a href='".concat(_P,"' target='_blank'>").concat(HD()?"其他方案?":"Any other solution?","</a>"),yP="".concat(HD()?"浏览器自动播放策略:在用户与页面产生交互(点击、触摸)之前,浏览器禁止播放有声媒体。该弹窗用于帮助用户恢复音视频播放。".concat(vP):"Autoplay Policy: Before user interacts with the web page (clicking, touching), page will not be allowed to play media with sound. This Dialog is used to help users resume playback. ".concat(vP)),EP=class{constructor(){if(UA(this,"content","音视频播放被浏览器拦截,请点击“恢复播放”。"),UA(this,"_dialogNode",null),UA(this,"_bodyPosition",""),UA(this,"_showDetail",!1),UA(this,"_isCollapseClicked",!1),UA(this,"_isQuestionClicked",!1),HD()||(this.content='Media playback failed. Click the "Resume" to resume playback.'),!fP){let e=document.createElement("style");e.innerHTML=".".concat(eP,"{position:fixed;top:0;left:0;right:0;bottom:0;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center;background:rgba(0,0,0,0.5);z-index:1500;}.").concat(eP," div:not(.").concat(nP,"){display:block !important;}.").concat(tP,"{padding:14px;background:#fff;border-radius:3px;box-shadow:0px 3px 15px #434343;border:1px solid #d1cfcf;max-width:500px;}.").concat(tP," a{color:").concat(lP,";}.").concat(iP,"{overflow:hidden;text-overflow:ellipsis;font-size:16px;font-weight:600;}.").concat(rP,"{margin:8px 0;}.").concat(nP,"{width:100%;display:flex !important;align-items:center;justify-content:right;float:right;}.").concat(oP,"{margin-right:auto;cursor:pointer}.").concat(aP,"{height:100%;line-height:16px;cursor:pointer;}.").concat(sP,"{margin-left:8px;color:#fff;background:").concat(lP,";padding:4px 12px;outline:none;border:1px solid;border-radius:3px;font-weight:bold;}.").concat(sP,":hover{opacity:0.9;}.").concat(oP,",.").concat(sP,",.").concat(rP,",.").concat(aP,"{font-size:14px;}@media screen and (max-width:750px){.").concat(tP,"{width:80vw;}}"),document.head.appendChild(e),fP=!0}this.addDiaLog()}createDiaLog(){let e=document.createElement("template");e.innerHTML='<div class="'.concat(eP,"\"><div class='").concat(tP,"'><div class='").concat(iP,"'>").concat(location.host,"</div><div class='").concat(rP,"'>").concat(this.content,"</div><div class='").concat(cP,'\' style="visibility:hidden;width:100%;height:0;font-size:12px;color:gray;">').concat(yP,"</div><div class='").concat(nP,"'></div></div></div>").trim();let t=document.createElement("button");t.className=sP,t.innerText=HD()?"恢复播放":"Resume",t.onclick=this.onConfirm.bind(this);let i=document.createElement("div");i.className=aP,i.innerHTML='<?xml version="1.0" encoding="UTF-8"?>\n <svg class="icon" width="18" height="18" p-id="2030" t="1639646523624" version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\n <path d="m464 784.35c0 26.51 21.49 48 48 48s48-21.49 48-48-21.49-48-48-48-48 21.49-48 48z" p-id="2031"/>\n <path d="m512 960c-247.04 0-448-200.96-448-448s200.96-448 448-448 448 200.96 448 448-200.96 448-448 448zm0-831.71c-211.58 0-383.71 172.13-383.71 383.71 0 211.55 172.13 383.71 383.71 383.71 211.55 0 383.71-172.16 383.71-383.71 0-211.58-172.16-383.71-383.71-383.71z" p-id="2032"/>\n <path d="m512 673.7c-17.665 0-32.001-14.336-32.001-31.999v-54.112c0-52.353 40-92.352 75.328-127.65 25.887-25.92 52.672-52.672 52.672-74.017 0-53.343-43.072-96.735-95.999-96.735-53.823 0-95.999 41.536-95.999 94.559 0 17.665-14.336 31.999-32.001 31.999s-32.001-14.336-32.001-31.999c0-87.424 71.775-158.56 160-158.56s160 72.095 160 160.74c0 47.904-36.32 84.192-71.424 119.3-27.84 27.776-56.576 56.512-56.576 82.336v54.112c0 17.665-14.336 32.032-32.001 32.032z" p-id="2033"/>\n </svg>\n ',i.onclick=this.onQuestionClick.bind(this);let r=document.createElement("div");r.className=oP,r.innerText="".concat(HD()?"详情 >":"Detail >"),r.onclick=this.onCollapseClick.bind(this);let n=e.content.firstChild,a=n.querySelector(".".concat(nP));return a.appendChild(r),a.appendChild(i),a.appendChild(t),n}addDiaLog(){gP()||(mP=!0,this._dialogNode=this.createDiaLog(),document.body.appendChild(this._dialogNode),this._dialogNode.onclick=this.onConfirm.bind(this),this._dialogNode.querySelector(".".concat(tP)).onclick=e=>e.stopPropagation(),this._bodyPosition=document.body.style.position,document.body.style.position="fixed",oL.info("show autoplay dialog"),ZN.uploadEvent({log:uP}))}deleteDialog(){this._dialogNode&&(document.body.removeChild(this._dialogNode),document.body.style.position=this._bodyPosition,this._dialogNode=null,mP=!1),bP=null}onConfirm(){oL.warn("confirm clicked, try resume stream"),iL.emit(rL.AUTOPLAY_DIALOG_CLICK_CONFIRM),this.deleteDialog()}onCollapseClick(){let e=this._dialogNode.querySelector(".".concat(cP));e.style.visibility="".concat(this._showDetail?"hidden":"visible"),e.style.height="".concat(this._showDetail?0:"fit-content"),this._showDetail=!this._showDetail,this._isCollapseClicked||ZN.uploadEvent({log:hP}),this._isCollapseClicked=!0}onQuestionClick(){window.open(_P,"_blank"),this._isQuestionClicked||ZN.uploadEvent({log:pP}),this._isQuestionClicked=!0}},bP=null;var wP,IP=class extends QN{constructor(e){super(e,pR),UA(this,"stat",{}),UA(this,"_calculateTimeout",-1),UA(this,"hasRvfcFired",!1),UA(this,"viewMirror",!1),UA(this,"objectFit","cover"),UA(this,"container"),UA(this,"canvas"),UA(this,"shouldRenderAlpha",!1),UA(this,"_preSize",{width:0,height:0}),UA(this,"posterImg"),UA(this,"pipWindow"),UA(this,"enterPIPPromise"),UA(this,"_originContainerPosition"),UA(this,"_isResettingSrcObject",!1),UA(this,"_wrapper",null),UA(this,"_useWrapper",!1),this.mode=e.canvas?1:0,this.container=e.container,this.canvas=e.canvas,KD(e.viewMirror)||(this.viewMirror=e.viewMirror),KD(e.objectFit)||(this.objectFit=e.objectFit),this.initializeElement()}get isPlaying(){var e;return!("PLAYING"!==this._state||this.element&&this.element.paused)&&("live"===(null==(e=this.track)?void 0:e.readyState)&&!this.track.muted)}initializeElement(){let e=document.createElement(pR);this.track&&2!==this.mode&&(e.srcObject=new MediaStream([this.track])),e.muted=!0,e.setAttribute("id","video_".concat(this.id)),e.setAttribute("style",this.styleAttribute),this.canvas&&this.canvas.setAttribute("style",this.styleAttribute),e.setAttribute("autoplay","autoplay"),e.setAttribute("playsinline","playsinline"),this.element=e,Jk&&(e.poster="data:,"),this._appendToWrapper(),this.bindElementEvents(),this.calculateStat()}get styleAttribute(){let e=this._useWrapper?"grid-area:1/1;width:100%;height:100%;object-fit:".concat(this.objectFit,";").concat(this.shouldRenderAlpha?"":"background-color:black",";"):"width:100%;height:100%;object-fit:".concat(this.objectFit,";").concat(this.shouldRenderAlpha?"":"background-color:black",";");return this.viewMirror&&(e+="transform:scaleX(-1);"),e}setLiveMode(e){if(this._useWrapper!==e&&(this._useWrapper=e,this.elementToRender&&this.elementToRender.setAttribute("style",this.styleAttribute),this.container&&this.elementToRender))if(e){let e=this._getOrCreateWrapper();e.insertBefore(this.elementToRender,e.firstChild)}else this.container.appendChild(this.elementToRender),this._cleanupWrapper()}setContainer(e){if(this.container===e)return;let t=this._wrapper,i=this.container;this.container=e,this._pausedRetryCount=5,this.track&&this.elementToRender&&this._appendToWrapper(),t&&i&&i!==this.container&&t.isConnected&&0===t.children.length&&t.remove()}_getOrCreateWrapper(){if(!this.container)throw new Error("[VideoPlayer] container is required");let e=this.container.querySelector("[data-trtc-video-wrapper]");return e||(e=document.createElement("div"),e.setAttribute("data-trtc-video-wrapper","true"),e.style.cssText="display:grid;width:100%;height:100%;",this.container.appendChild(e)),this._wrapper=e,e}_appendToWrapper(e){let t=null!=e?e:this.elementToRender;if(this.container&&t)if(this._useWrapper){let e=this._getOrCreateWrapper();e.insertBefore(t,e.firstChild)}else this.container.appendChild(t)}bindElementEvents(){let e=super.bindElementEvents();this.handleElementEvent=this.handleElementEvent.bind(this),this.handleFullscreenChange=this.handleFullscreenChange.bind(this),this.handleVolumeChange=this.handleVolumeChange.bind(this),e&&e.add(kR,this.handleElementEvent).add(CR,this.handleElementEvent).add(OR,this.handleElementEvent),this.element&&(this.element.addEventListener(DR,this.handleFullscreenChange),this.element.addEventListener("webkitbeginfullscreen",this.handleFullscreenChange),this.element.addEventListener("webkitendfullscreen",this.handleFullscreenChange),this.element.addEventListener("volumechange",this.handleVolumeChange))}handleTrackEvent(e){var t;return e.type===_R&&(null!=(t=this.stat)&&t.fps&&(this.stat.fps=0),this.isFullscreen()&&this.resetSrcObjectToReplay()),super.handleTrackEvent(e)}handleFullscreenChange(){this.isFullscreen()?(this._log.info("enter fullscreen"),this.emit(GN.ENTER_FULL_SCREEN)):(this._log.info("leave fullscreen"),this.emit(GN.LEAVE_FULL_SCREEN))}handleVolumeChange(){var e;(this.isPictureInPicture()||this.isFullscreen())&&this.emit(GN.VOLUME_CHANGE,{muted:null==(e=this.element)?void 0:e.muted})}handleElementEvent(e){var t,i,r,n,a,o;if(2===this.mode)return;super.handleElementEvent(e);let s=e.type,c=this.isPictureInPicture(),l=this.isFullscreen(),d=e.isTrusted&&(c&&eD||l);if(s===ER&&d&&!this._isResettingSrcObject&&(this._log.warn("user resume in ".concat(l?"fullscreen":"pip")),this.emit(GN.USER_RESUME_IN_PIP_OR_FULL_SCREEN)),s===bR&&(d&&(this._log.warn("user pause in ".concat(l?"fullscreen":"pip")),this.emit(GN.USER_PAUSE_IN_PIP_OR_FULL_SCREEN)),this.container&&!this.container.isConnected&&(this._log.warn("".concat(this.kind," player has been remove, element ID: ").concat(this.container.id)),kO(500).then(()=>{var e;null!=(e=this.container)&&e.isConnected&&(this._pausedRetryCount=5,this._log.info("view container ".concat(this.container.id," is in dom, reset pausedRetryCount")))})),this._pausedRetryCount>0&&!gP()&&!this.isPausedByUserCall&&!d&&(this._log.info("[".concat(5-this._pausedRetryCount+1,"/").concat(5,"] ").concat(this.kind," player auto resume when paused")),this.doResume(),this._pausedRetryCount--),Xk&&!d&&(this._interval=WN.run("timeout",()=>{this.element&&"PAUSED"===this._state&&!this.isPausedByUserCall&&this.doResume()},{delay:3e3})),this.stat.fps&&(this.stat.fps=0)),this.viewMirror&&this.element){let e=this.element.style.transform;s===kR?this.element.style.transform=e.replace("scaleX(-1)",""):s===CR&&!e.includes("scaleX")&&(this.element.style.transform="".concat(e," scaleX(-1)"))}s===OR&&(this._preSize.height!==(null==(t=this.element)?void 0:t.videoHeight)||this._preSize.width!==(null==(i=this.element)?void 0:i.videoWidth))&&(this._log.info("video size changed to ".concat(null==(r=this.element)?void 0:r.videoWidth,"x").concat(null==(n=this.element)?void 0:n.videoHeight)),this._preSize.height=(null==(a=this.element)?void 0:a.videoHeight)||0,this._preSize.width=(null==(o=this.element)?void 0:o.videoWidth)||0,this.emit(GN.RESIZE,{newWidth:this._preSize.width,newHeight:this._preSize.height})),s===CR&&(this._log.warn("exit pip"),this.isPaused&&!this.isPausedByUserCall&&(this._log.warn("resume after exit pip"),this.doResume()),this.resetSrcObjectToReplay(),this.emit(GN.LEAVE_PICTURE_IN_PICTURE)),s===kR&&this.emit(GN.ENTER_PICTURE_IN_PICTURE)}resetSrcObjectToReplay(){Jk&&JC&&this.isPlayCalled&&this.element&&this.track&&!this.isPausedByUserCall&&(this._log.warn("reset srcObject to replay for android chromium"),this._isResettingSrcObject=!0,this.element.srcObject=new MediaStream([this.track]),this.element.play().catch(e=>{this._log.warn("play failed after reset srcObject",e)}).finally(()=>{this._isResettingSrcObject=!1}))}setCanvas(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i,r;this.canvas!==e&&(null==(i=this.canvas)||i.remove(),null==e||e.setAttribute("style",this.styleAttribute),this.canvas=e,this.mode=e?t:0,2===this.mode&&this.setTrack(e.captureStream().getVideoTracks()[0]),e?(null==(r=this.element)||r.remove(),this._appendToWrapper(e)):this.element&&this._appendToWrapper(this.element))}setAttr(e){let t=Object.assign({autoplay:"autoplay",playsinline:"playsinline",muted:!0},e);t.style=Object.assign({width:"100%",height:"100%"},t.style),super.setAttr(t)}get mirror(){return this.viewMirror}setRect(e,t){this.elementToRender&&(this.elementToRender.style.width="".concat(e,"px"),this.elementToRender.style.height="".concat(t,"px"))}setViewMirror(e){this.elementToRender&&(this.elementToRender.style.transform=e?"scaleX(-1)":""),this.viewMirror=e}setObjectFit(e){this.elementToRender&&(this.elementToRender.style.objectFit="".concat(e)),this.objectFit=e}setPoster(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(i=>{if(!this.element||(this._log.info("setPoster",e.slice(0,10)),""===e?this.element.removeAttribute("poster"):this.element.poster=e,!t||!eD&&!$k))return i();if(""===e)return this.removePosterImg(),i();if(this.posterImg)return i();let r=document.createElement("img");r.src=e;let n=window.getComputedStyle(this.element),a=n.objectFit||this.objectFit,o=1;if(this._useWrapper){let e=parseInt(n.zIndex,10);isNaN(e)||(o=e+1)}r.style.cssText=this._useWrapper?"grid-area:1/1;z-index:".concat(o,";width:100%;height:100%;object-fit:").concat(a,";"):"position:absolute;top:0;left:0;width:100%;height:100%;object-fit:".concat(a,";"),r.onload=async()=>{try{r.decode&&await r.decode(),this.container&&!this._useWrapper&&"static"===window.getComputedStyle(this.container).position&&(this._originContainerPosition=this.container.style.position,this.container.style.position="relative"),this.posterImg=r;let e=this._useWrapper?this._wrapper:this.container;null==e||e.appendChild(r),Zk()&&oD<=17&&this.elementToRender&&(this.elementToRender.style.visibility="hidden")}catch(e){this._log.warn("decode poster image error",e)}return i()},r.onerror=()=>(this._log.warn("load poster image error"),i())})}removePosterImg(){this.posterImg&&(Zk()&&oD<=17&&this.elementToRender&&(this.elementToRender.style.visibility=""),this.posterImg.remove(),URL.revokeObjectURL(this.posterImg.src),!this._useWrapper&&this.container&&!KD(this._originContainerPosition)&&"relative"===this.container.style.position&&(this.container.style.position=this._originContainerPosition),delete this.posterImg)}get hasPoster(){var e;return!!this.posterImg||!(null==(e=this.element)||!e.getAttribute("poster"))}async pause(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];super.pause(),!this.isPictureInPicture()&&!this.hasPoster&&(JC||e&&($k||eD))&&await this.setPoster(this.getVideoFrame(),!0)}resume(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return super.resume(e).then(()=>{var e;(this.posterImg||null!=(e=this.element)&&e.poster)&&this.setPoster("",!0)})}doResume(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isPaused&&e&&this.element&&this.track&&JC&&"video"===this.track.kind&&(this.element.srcObject=new MediaStream([this.track])),super.doResume()}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t;this.isPictureInPicture()&&this.exitPictureInPicture().catch(e=>{}),this.isFullscreen()&&this.exitFullscreen().catch(e=>{}),this.element&&(this.element.removeEventListener(DR,this.handleFullscreenChange),this.element.removeEventListener("webkitbeginfullscreen",this.handleFullscreenChange),this.element.removeEventListener("webkitendfullscreen",this.handleFullscreenChange),this.element.removeEventListener("volumechange",this.handleVolumeChange)),super.stop(e),null==(t=this.canvas)||t.remove(),this.removePosterImg(),this._useWrapper&&this._cleanupWrapper()}_cleanupWrapper(){this._wrapper&&0===this._wrapper.children.length&&this._wrapper.remove(),this._wrapper=null}play(e){if(KD(null==e?void 0:e.isLiveStream)||this.setLiveMode(e.isLiveStream),this.element){if(this.elementToRender&&this.container)if(this._useWrapper){let e=this._getOrCreateWrapper();this.elementToRender.parentElement!==e&&e.insertBefore(this.elementToRender,e.firstChild)}else this.elementToRender.parentElement!==this.container&&this.container.append(this.elementToRender)}else this.initializeElement();return 2===this.mode?Promise.resolve():super.play()}get elementToRender(){return this.canvas||this.element}setTrack(e){e!==this.track&&(this.unbindTrackEvents(),this.track=e,this.emit(GN.MEDIA_TRACK_CHANGED,e),null!==e&&(this.bindTrackEvents(),this.element&&2!==this.mode&&(this.element.srcObject=new MediaStream([e]),this.element.remove()),this._appendToWrapper()))}getVideoFrame(){if(this.canvas)return this.canvas.toDataURL("image/png");if(!this.element)return"";let e=document.createElement("canvas");return e.width=this.element.videoWidth,e.height=this.element.videoHeight,e.getContext("2d").drawImage(this.element,0,0),e.toDataURL("image/png")}getElement(){return this.element}calculateStat(){try{if(bN()&&this.element&&this._calculateTimeout<0){let e=0,t=null,i=(r,n)=>{this.stat.width=n.width,this.stat.height=n.height,t&&(this.stat.fps=Math.round((n.presentedFrames-t.presentedFrames)/(r-e)*1e3)),e=r,t=n,this.hasRvfcFired=!0,this._calculateTimeout=-1,this.element&&(this._calculateTimeout=setTimeout(()=>{var e;return null==(e=this.element)?void 0:e.requestVideoFrameCallback(i)},2e3))};this.element.requestVideoFrameCallback(i)}}catch(nM){this._log.warn("init stat failed",nM)}}async enterFullscreen(){let e=this.elementToRender;if(!e)throw this._log.warn("no element to render, cannot enter fullscreen"),new Error("No element available for fullscreen");if(Xk&&this.isPictureInPicture()){this._log.info("exit pip before entering fullscreen");try{await this.exitPictureInPicture()}catch(XA){this._log.warn("exit pip failed before fullscreen:",XA)}}try{if(e.requestFullscreen)await e.requestFullscreen();else if(e.webkitRequestFullscreen)await e.webkitRequestFullscreen();else if(e.webkitEnterFullscreen)await e.webkitEnterFullscreen();else if(e.mozRequestFullScreen)await e.mozRequestFullScreen();else{if(!e.msRequestFullscreen)throw new Error("Fullscreen API not supported");await e.msRequestFullscreen()}this._log.info("entered fullscreen mode")}catch(XA){throw this._log.error("failed to enter fullscreen:",XA),XA}}async exitFullscreen(){try{if(!this.isFullscreen())return;if(document.exitFullscreen)await document.exitFullscreen();else if(document.webkitExitFullscreen)await document.webkitExitFullscreen();else if(document.mozCancelFullScreen)await document.mozCancelFullScreen();else{if(!document.msExitFullscreen)throw new Error("Exit fullscreen API not supported");await document.msExitFullscreen()}this._log.info("exited fullscreen mode")}catch(nM){throw this._log.error("failed to exit fullscreen:",nM),nM}}isFullscreen(){let e=this.elementToRender;return!!e&&(this.element&&this.element.webkitDisplayingFullscreen?!this.isPictureInPicture():(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)===e)}async toggleFullscreen(){this.isFullscreen()?await this.exitFullscreen():await this.enterFullscreen()}async enterPictureInPicture(){this.enterPIPPromise=this._enterPictureInPicture();try{return await this.enterPIPPromise}finally{delete this.enterPIPPromise}}async _enterPictureInPicture(){try{if(!this.element)throw new Error("No video element available for pip");if(this.canvas&&1!==this.mode)throw new Error("pip is not supported for canvas-only mode");let{element:e}=this;if(e.requestPictureInPicture){this._log.info("requestPictureInPicture");let t=await e.requestPictureInPicture();return this.pipWindow=t,this._log.info("entered pip mode"),this.elementToRender===this.canvas&&(this.canvas.remove(),this._appendToWrapper(this.element)),t}if(e.webkitSetPresentationMode)return this._log.info("webkitSetPresentationMode"),await e.webkitSetPresentationMode("picture-in-picture"),this._log.info("entered pip mode (webkit)"),{};throw new Error("pip API not supported")}catch(nM){throw this._log.error("failed to enter pip:",nM.name,nM.message),nM}}async exitPictureInPicture(){var e;try{if(!this.isPictureInPicture())return;if(delete this.pipWindow,document.pictureInPictureElement&&document.exitPictureInPicture)await document.exitPictureInPicture(),this.elementToRender===this.canvas&&(null==(e=this.element)||e.remove(),this._pausedRetryCount=5,this._appendToWrapper(this.canvas)),this._log.info("exited pip mode");else{if(!this.element||!this.element.webkitSetPresentationMode)throw new Error("Exit pip API not supported or not in PiP mode");await this.element.webkitSetPresentationMode("inline"),this._log.info("exited pip mode (webkit)")}}catch(XA){throw this._log.error("failed to exit pip:",XA),XA}}isPictureInPicture(){if(!this.element)return!1;let{element:e}=this;return document.pictureInPictureElement?document.pictureInPictureElement===e:!!e.webkitPresentationMode&&"picture-in-picture"===e.webkitPresentationMode}async togglePictureInPicture(){this.isPictureInPicture()?await this.exitPictureInPicture():await this.enterPictureInPicture()}};"undefined"!=typeof AudioContext?wP=AudioContext:"undefined"!=typeof webkitAudioContext?wP=webkitAudioContext:"undefined"!=typeof mozAudioContext&&(wP=mozAudioContext);var TP,SP=-1,AP=0,RP=-1,kP=!1,CP=0,DP=-1,OP=-1;!function e(){try{if(TP)return;(TP=new wP({sampleRate:48e3})).onstatechange=()=>{oL.info("context state: ".concat(TP.state).concat("running"!==TP.state?" visibilityState: ".concat(document.visibilityState):"")),LP()},clearTimeout(SP)}catch(_A){oL.error("initAudioContext failed: ".concat(_A," typeof AudioContextClass: ").concat(typeof wP)),SP=setTimeout(e,1e3)}}();var LP=()=>{"suspended"===TP.state?(AP=sO(),-1===RP&&(RP=setTimeout(()=>{"suspended"===TP.state&&(kP=!0,iL.emit("155",{isSuspended:!0}))},1500)),xP(),document.addEventListener("click",LP)):"interrupted"===TP.state?xP():(AP&&(yL.addNumber({key:507800,value:sO()-AP,split:[0,500,1e3,1500,2e3,3e3,4e3,5e3,1e4,3e4],max:6e4}),AP=0),-1!==RP&&(clearTimeout(RP),RP=-1,kP&&(kP=!1,iL.emit("155",{isSuspended:!1}))),document.removeEventListener("visibilitychange",LP),document.removeEventListener("click",LP))},NP=0,PP=-1;function xP(){return new Promise((e,t)=>{if("running"===TP.state)return e();Date.now()-NP<1e3?(clearTimeout(PP),PP=setTimeout(()=>{NP=Date.now(),TP.resume().then(e,t).finally(()=>{MP()})},1e3)):(clearTimeout(PP),NP=Date.now(),TP.resume().then(e,t).finally(()=>{MP()}))}).catch(e=>{oL.warn("context resume failed: ".concat(e)),document.addEventListener("visibilitychange",LP)})}function MP(){if(!Xk||-1!==OP)return;let e=()=>{sO()-CP<500||(TP&&"running"===TP.state&&TP.currentTime===DP&&(oL.warn("context is fake running, auto resume"),TP.suspend().catch(e=>{oL.warn("context suspend failed: ".concat(e))})),DP=TP.currentTime,CP=sO())};OP=setInterval(()=>{e()},2e3),document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&e()})}document.addEventListener("click",LP);var UP=e=>TP;function FP(){}var BP=e=>e();function VP(){this.dispose()}var HP=1,jP=class extends Function{toString(){return"".concat(this.name,"(").concat(this.args.length?[...this.args].join(", "):"",")")}subscribe(e){let t=new ZP(e,this,this.streamId++);return JP.subscribe({id:this.id,end:!1},{nodeId:t.sourceId,streamId:t.id}),this(t),t}},zP=class{constructor(){this.defers=new Set,this.disposed=!1}next(e){}complete(){this.dispose()}error(e){this.dispose()}get bindDispose(){return()=>this.dispose()}dispose(){this.disposed=!0,this.complete=FP,this.error=FP,this.next=FP,this.dispose=FP,this.subscribe=FP,this.doDefer()}subscribe(e){return e instanceof jP?e.subscribe(this):e(this),this}get bindSubscribe(){return e=>this.subscribe(e)}doDefer(){this.defers.forEach(BP),this.defers.clear()}defer(e){this.defers.add(e)}removeDefer(e){this.defers.delete(e)}reset(){this.disposed=!1,delete this.complete,delete this.next,delete this.dispose,delete this.next,delete this.subscribe}resetNext(){delete this.next}resetComplete(){delete this.complete}resetError(){delete this.error}},WP=class extends zP{constructor(e){super(),this.sink=e,e.defer(this.bindDispose)}next(e){this.sink.next(e)}complete(){this.sink.complete()}error(e){this.sink.error(e)}},GP=class extends zP{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:FP,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:FP,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:FP;if(super(),this._next=t,this._error=i,this._complete=r,this.then=FP,e instanceof jP){let n={toString:()=>"subscribe",id:0,source:e};this.defer(()=>{JP.defer(n,0)}),JP.create(n),JP.pipe(n),this.sourceId=n.id,this.subscribe(e),JP.subscribe({id:n.id,end:!0}),t==FP?this._next=e=>JP.next(n,0,e):this.next=e=>{JP.next(n,0,e),t(e)},r==FP?this._complete=()=>JP.complete(n,0):this.complete=()=>{this.dispose(),JP.complete(n,0),r()},i==FP?this._error=e=>JP.complete(n,0,e):this.error=e=>{this.dispose(),JP.complete(n,0,e),i(e)}}else this.subscribe(e)}next(e){this._next(e)}complete(){this.dispose(),this._complete()}error(e){this.dispose(),this._error(e)}};function qP(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return i.reduce((e,t)=>t(e),e)}function KP(e,t,i){if("undefined"!=typeof __FASTRX_DEVTOOLS__){let r=Object.defineProperties(Object.setPrototypeOf(e,jP.prototype),{streamId:{value:0,writable:!0,configurable:!0},name:{value:t,writable:!0,configurable:!0},args:{value:i,writable:!0,configurable:!0},id:{value:0,writable:!0,configurable:!0}});JP.create(r);for(let e=0;e<i.length;e++){let t=i[e];"function"==typeof t&&t instanceof jP&&JP.addSource(r,t)}return r}return e}function YP(e,t){return function(){for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];return i=>{if(i instanceof jP){let n=KP(t=>{let a=new e(t,...r);a.sourceId=n.id,a.subscribe(i)},t,arguments);return n.source=i,JP.pipe(n),n}return t=>i(new e(t,...r))}}}function XP(e,t){window.postMessage({source:"fastrx-devtools-backend",payload:{event:e,payload:t}})}var ZP=class extends WP{constructor(e,t,i){super(e),this.source=t,this.id=i,this.sourceId=e.sourceId,this.defer(()=>{JP.defer(this.source,this.id)})}next(e){JP.next(this.source,this.id,e),this.sink.next(e)}complete(){JP.complete(this.source,this.id),this.sink.complete()}error(e){JP.complete(this.source,this.id,e),this.sink.error(e)}},JP={addSource(e,t){XP("addSource",{id:e.id,name:e.toString(),source:{id:t.id,name:t.toString()}})},next(e,t,i){XP("next",{id:e.id,streamId:t,data:i&&i.toString()})},subscribe(e,t){let{id:i,end:r}=e;XP("subscribe",{id:i,end:r,sink:{nodeId:t&&t.nodeId,streamId:t&&t.streamId}})},complete(e,t,i){XP("complete",{id:e.id,streamId:t,err:i?i.toString():null})},defer(e,t){XP("defer",{id:e.id,streamId:t})},pipe(e){XP("pipe",{name:e.toString(),id:e.id,source:{id:e.source.id,name:e.source.toString()}})},update(e){XP("update",{id:e.id,name:e.toString()})},create(e){e.id||(e.id=HP++),XP("create",{name:e.toString(),id:e.id})}},QP=class extends zP{constructor(e){super(),this.source=e,this.sinks=new Set}add(e){e.defer(()=>this.remove(e)),1===this.sinks.add(e).size&&(this.reset(),this.subscribe(this.source))}remove(e){this.sinks.delete(e),0===this.sinks.size&&this.dispose()}next(e){this.sinks.forEach(t=>t.next(e))}complete(){this.sinks.forEach(e=>e.complete()),this.sinks.clear()}error(e){this.sinks.forEach(t=>t.error(e)),this.sinks.clear()}};function $P(){return e=>{let t=new QP(e);if(e instanceof jP){let i=KP(e=>{t.add(e)},"share",arguments);return t.sourceId=i.id,i.source=e,JP.pipe(i),i}return KP(t.add.bind(t),"share",arguments)}}function ex(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return KP(e=>{let i=new WP(e),r=t.length;i.complete=()=>{0===--r&&e.complete()},t.forEach(i.bindSubscribe)},"merge",arguments)}function tx(e){let t=arguments,i=$P()(KP(t=>{i.next=e=>t.next(e),i.complete=()=>t.complete(),i.error=e=>t.error(e),e&&t.subscribe(e)},"subject",t));return i.next=FP,i.complete=FP,i.error=FP,i}function ix(e,t){return i=>{let r=e=>i.next(e);i.defer(()=>t(r)),e(r)}}function rx(e,t){if("on"in e&&"off"in e)return KP(ix(i=>e.on(t,i),i=>e.off(t,i)),"fromEvent",arguments);if("addListener"in e&&"removeListener"in e)return KP(ix(i=>e.addListener(t,i),i=>e.removeListener(t,i)),"fromEvent",arguments);if("addEventListener"in e)return KP(ix(i=>e.addEventListener(t,i),i=>e.removeEventListener(t,i)),"fromEvent",arguments);throw"target is not a EventDispachter"}var nx=YP(class extends WP{constructor(e,t,i){super(e),this.filter=t,this.thisArg=i}next(e){this.filter.call(this.thisArg,e)&&this.sink.next(e)}},"filter"),ax=YP(class extends WP{constructor(e,t){super(e),this.count=t}next(e){this.sink.next(e),0===--this.count&&(this.doDefer(),this.complete())}},"take"),ox=YP(class extends WP{constructor(e,t){super(e);let i=new WP(e);i.next=()=>{i.doDefer(),e.complete()},i.complete=VP,i.subscribe(t)}},"takeUntil"),sx=YP(class extends WP{constructor(e,t){super(e),this.f=t}next(e){this.f(e)||(this.next=super.next,this.next(e))}},"skipWhile"),cx=YP(class extends WP{constructor(e,t,i){super(e),this.mapper=t,this.thisArg=i}next(e){super.next(this.mapper.call(this.thisArg,e))}},"map"),lx=class extends WP{constructor(e,t,i){super(e),this.data=t,this.context=i}next(e){let t=this.context.combineResults;t?this.sink.next(t(this.data,e)):this.sink.next(e)}tryComplete(){this.context.resetComplete(),this.dispose()}},dx=class e extends WP{constructor(e,t,i){super(e),this.makeSource=t,this.combineResults=i,this.index=0}subInner(t,i){let r=this.currentSink=new i(this.sink,t,this);this.complete===e.prototype.complete&&(this.complete=this.tryComplete),r.complete=r.tryComplete,r.subscribe(this.makeSource(t,this.index++))}complete(){this.sink.complete()}tryComplete(){this.currentSink.resetComplete(),this.dispose()}},ux=class extends lx{},hx=class extends dx{next(e){this.subInner(e,ux),this.next=e=>{this.currentSink.dispose(),this.subInner(e,ux)}}},px=YP(hx,"switchMap");var fx=function(e){return(t,i)=>e(()=>t,i)}(YP(hx,"switchMapTo")),mx=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:FP,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:FP,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:FP;return r=>new GP(r,e,t,i)},gx=YP(class extends WP{constructor(e,t){super(e),t instanceof Function?this.next=i=>{t(i),e.next(i)}:(t.next&&(this.next=i=>{t.next(i),e.next(i)}),t.complete&&(this.complete=()=>{t.complete(),e.complete()}),t.error&&(this.error=i=>{t.error(i),e.error(i)}))}},"tap"),_x=class{constructor(e){this.name=e,UA(this,"node"),UA(this,"node2"),UA(this,"pre",new Set),UA(this,"next",new Set),UA(this,"context"),UA(this,"connectedNodes",new Set),UA(this,"nextInputChannelMap",new Map),UA(this,"_channelCount",1)}get channelCount(){return this._channelCount}set channelCount(e){this._channelCount=e,this.setChannelCount(this.node,e),this.setChannelCount(this.node2,e),this.next.forEach(t=>t.channelCount=e)}setChannelCount(e,t){!e||e instanceof ScriptProcessorNode||(e.channelCountMode="explicit",e.channelCount=t||this.channelCount||1)}setContext(e){this.context=e,this.node&&e.addMixWeight()}removeContext(){var e;this.node&&(null==(e=this.context)||e.reduceMixWeight()),delete this.context}replaceNode(e){var t;if(e!==this.node)try{this.node?this._disconnect():null==(t=this.context)||t.addMixWeight(),this.node=e,this.setChannelCount(this.node),this.preNodeReconnect(),this.reconnect()}catch(XA){oL.error(XA)}}setNode(e,t){var i;if(!this.node)try{null==(i=this.context)||i.addMixWeight(),this.node=e,this.setChannelCount(this.node),t&&(this.node2=t,this.setChannelCount(this.node2)),this.preNodeReconnect(),this.reconnect(),yL.addSuccessEvent({key:502701})}catch(r){oL.error(r),yL.addFailedEvent({key:502701,error:r})}}deleteNode(){var e;if(this.node)try{this._disconnect(),delete this.node,delete this.node2,null==(e=this.context)||e.reduceMixWeight(),this.preNodeReconnect(),yL.addSuccessEvent({key:502702})}catch(nM){oL.error(nM),yL.addFailedEvent({key:502702,error:nM})}}preNodeReconnect(){this.pre.forEach(e=>{e.node?e.reconnect():e.preNodeReconnect()})}connectNext(e){this.next.forEach(t=>{let i=this.nextInputChannelMap.get(t);e._connect(t.node,i)||t.connectNext(e)})}_connect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(!this.node||!e)&&((this.node2||this.node).connect(e,0,t),this.connectedNodes.add(e),!0)}_disconnect(){this.connectedNodes.forEach(e=>{var t;return null==(t=this.node2||this.node)?void 0:t.disconnect(e)}),this.connectedNodes.clear()}reconnect(){this._disconnect(),this.connectNext(this)}pipeTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.next.add(e),e.pre.add(this),this.nextInputChannelMap.set(e,t),e}},vx=class extends _x{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:256;super(),this.fftSize=e,UA(this,"dataArray",new Uint8Array(0))}setNode(e){e.fftSize=this.fftSize,this.dataArray=new Uint8Array(e.frequencyBinCount),super.setNode(e)}getByteTimeDomainData(){var e;return null==(e=this.node)||e.getByteTimeDomainData(this.dataArray),this.dataArray}get level(){var e;return null==(e=this.node)||e.getByteTimeDomainData(this.dataArray),Math.max(...this.dataArray)/128-1}get timeDomainPathData(){let e=this.getByteTimeDomainData(),t=0,i=0,r="M".concat(t,",").concat(i);for(let n=0;n<e.length;n++)i=e[n]/128*100/2,r+="L".concat(t,",").concat(i),t+=1;return r}},yx=class{constructor(){UA(this,"source",new _x),UA(this,"gain",new _x),UA(this,"destination",new _x)}get volume(){var e;return(null==(e=this.gain.node)?void 0:e.gain.value)||1}setVolume(e){1!==e?(this.gain.node||this.gain.setNode(UP().createGain()),this.gain.node.gain.value=e):this.gain.node&&this.gain.deleteNode()}replaceSource(e){try{let t=function(t){try{let e=Ex.get(t);if(e)return e;let i=UP();if(t instanceof HTMLAudioElement)e=i.createMediaElementSource(t);else{if(!(t instanceof MediaStreamTrack))return t;e=i.createMediaStreamSource(new MediaStream([t]))}return Ex.set(t,e),e}catch(e){if(!($k&&e instanceof Error&&"NotSupportedError"===e.name))throw e;oL.warn(e)}}(e);t&&this.source.replaceNode(t)}catch(nM){oL.error(nM)}}get track(){var e;return null==(e=this.stream)?void 0:e.getAudioTracks()[0]}get stream(){var e;return null==(e=this.destination.node)?void 0:e.stream}},Ex=new WeakMap;var bx=class e{constructor(e){UA(this,"_volume",0),UA(this,"_volumeDb",0),UA(this,"_log"),UA(this,"_scriptProcessorNode",null),UA(this,"_audioWorkletNode",null),UA(this,"_interval",200);let{log:t}=e;this._log=t,iL.on(rL.AUDIO_LEVEL_INTERVAL,this.handleAudioLevelInterval,this)}static get isRunning(){return Date.now()-e.lastMessageTime<2e3}get node(){return this._audioWorkletNode||this._scriptProcessorNode}preload(){if(OC&&$C<=22)return this._log.warn("use script processor to avoid memory leak in electron22-"),this.initScriptProcessor();if(!e.workletReady){let t='class VolumeMeterWorklet extends AudioWorkletProcessor{constructor(){super(),this.volume=0,this.intervalTime=200,this.tick=200,this.isStop=!1,this.cache=[],this.sentFirstInfo1=!1,this.unmute=!1,this.port.onmessage=t=>{var e=t.data;switch(e.name){case"chunk":this.cache.push(...e.data),this.sentFirstInfo1||(this.port.postMessage({cl:e.data.length}),this.sentFirstInfo1=!0);break;case"setIntervalTime":this.intervalTime=e.intervalTime;break;case"unmute":this.unmute=!0;break;case"stop":this.isStop=!0}}}process(t,s){t=t[0],s=s[0];if(t||s){if(this.isStop)return!1;var i=s&&s[0]?s[0].length:0,h=this.cache.length,a=(i<h?(s[0].set(this.cache.slice(0,i)),this.cache=this.cache.slice(i)):this.unmute&&s[0].set(t[0]),(i<h?s:t)[0]);if(a){let e=0;for(let t=0;t<a.length;++t)e=Math.max(Math.abs(a[t]),e);s=a.reduce((t,e)=>t+e*e,0)/a.length;this.volume=e,this.tick-=a.length,this.tick<0&&(this.tick+=this.intervalTime/1e3*sampleRate,this.port.postMessage({volume:this.volume,volumeDb:Math.max(10*Math.log10(s)+100,0)/100,cacheLen:h,outputLen:i}))}}return!0}}registerProcessor("volume-meter",VolumeMeterWorklet);',i=URL.createObjectURL(new Blob([t],{type:"application/javascript"}));e.workletReady=async function(e,t){if(!e.audioWorklet)return Promise.reject("audioWorklet is not supported");try{await e.audioWorklet.addModule(t),oL.info("worklet addModule success")}catch(i){throw oL.info("worklet addModule catch error. ".concat(i.message)),i}}(e.audioContext,i).finally(()=>{URL.revokeObjectURL(i)})}return e.workletReady.then(()=>this.initAudioWorklet()).catch(e=>(this._log.error("volumeMeter preload error: ".concat(e)),this.initScriptProcessor()))}initAudioWorklet(){if(!this._audioWorkletNode)try{this._audioWorkletNode=new AudioWorkletNode(e.audioContext,"volume-meter");let t=!1;this._audioWorkletNode.port.onmessage=i=>{e.lastMessageTime=Date.now(),this._volume=i.data.volume||0,this._volumeDb=i.data.volumeDb||0,!t&&i.data.cacheLen&&i.data.outputLen&&(this._log.warn("worklet play success"),t=!0)},this.handleAudioLevelInterval({interval:this._interval})}catch(t){this._log.error("volumeMeter init audio worklet error: ".concat(t)),ZN.logFailedEvent({userId:this._log.userId,eventType:NR,error:t}),this.initScriptProcessor()}}initScriptProcessor(){if(!this._scriptProcessorNode)try{let t=UP();this._scriptProcessorNode=t.createScriptProcessor(2048,1,1),this._scriptProcessorNode.onaudioprocess=t=>{e.lastMessageTime=Date.now();let i=t.inputBuffer.getChannelData(0),r=0,n=0;for(let e=0;e<i.length;++e)r=Math.max(Math.abs(i[e]),r),n+=i[e]*i[e];this._volume=r;let a=n/i.length;this._volumeDb=Math.max(10*Math.log10(a)+100,0)/100},this._scriptProcessorNode.connect(t.destination)}catch(t){this._log.error("volumeMeter init script processor error: ".concat(t))}}destroy(){this._scriptProcessorNode&&(this._scriptProcessorNode.onaudioprocess=null,this._scriptProcessorNode.disconnect()),this._audioWorkletNode&&(this._audioWorkletNode.port.postMessage({name:"stop"}),this._audioWorkletNode.port.onmessage=null,this._audioWorkletNode.port.close(),this._audioWorkletNode.disconnect()),this._audioWorkletNode=null,this._scriptProcessorNode=null,iL.off(rL.AUDIO_LEVEL_INTERVAL,this.handleAudioLevelInterval,this)}getInternalAudioLevel(){return this._volume}getCalculatedVolume(){return parseFloat(this._volume.toFixed(2))}getVolumeDb(){return Math.floor(100*this._volumeDb)}handleAudioLevelInterval(e){var t;let{interval:i}=e;this._interval=i,null==(t=this._audioWorkletNode)||t.port.postMessage({name:"setIntervalTime",intervalTime:i})}};UA(bx,"lastMessageTime",0),UA(bx,"audioContext",UP()),UA(bx,"workletReady");var wx=bx,Ix=class extends _x{constructor(e){super(),UA(this,"_volumeMeter"),this._volumeMeter=new wx(e)}deleteNode(){super.deleteNode(),this._volumeMeter.destroy()}async init(){await this._volumeMeter.preload(),this.setNode(this._volumeMeter.node)}getCalculatedVolume(){return this._volumeMeter.getCalculatedVolume()}getInternalAudioLevel(){return this._volumeMeter.getInternalAudioLevel()}getVolumeDb(){return this._volumeMeter.getVolumeDb()}write(e){if(this.node){let t=e.allocationSize({planeIndex:0}),i=new Float32Array(t>>2);e.copyTo(i,{planeIndex:0}),this.node.port.postMessage({name:"chunk",data:i},[i.buffer]),e.close()}}},Tx=xA(BA(),1),Sx=e=>t=>t.deviceId===e,Ax=["virtual"],Rx=["obs","webcastmate"];function kx(e,t){let i=e.label.toLowerCase();return!(!Ax.some(e=>i.includes(e))||(t||e.kind)===RR&&Rx.some(e=>i.includes(e.toLowerCase())))}function Cx(e,t){let i=e.filter(e=>!kx(e,t));return i.length>0?i:e}var Dx=class{constructor(e,t){UA(this,"kind"),UA(this,"type"),UA(this,"devices",[]),this.kind=e,this.type=t}update(e,t){let i=e.filter(e=>e.kind==="".concat(this.kind).concat(this.type.toLocaleLowerCase()));1===this.devices.length&&Nx(this.devices[0])||t&&(i.forEach(e=>{if(e.deviceId&&!this.devices.find(Sx(e.deviceId))){let i="".concat(this.kind).concat(this.type,"Added");oL.warn("".concat(i,": ").concat(JSON.stringify(e))),t.emit(i,e)}}),this.devices.forEach(e=>{if(e.deviceId&&!i.find(Sx(e.deviceId))){let i="".concat(this.kind).concat(this.type,"Removed");oL.warn("".concat(i,": ").concat(JSON.stringify(e))),t.emit(i,e)}})),this.devices=i}hasDevice(e){return!!this.devices.find(t=>t.deviceId===e)}},Ox=class extends Tx.EventEmitter{constructor(){super(),UA(this,"audioInputs",new Dx(hR,"Input")),UA(this,"videoInputs",new Dx(pR,"Input")),UA(this,"audioOutputs",new Dx(hR,"Output")),this.init(),navigator.mediaDevices&&(navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",()=>this.update()),"ondevicechange"in navigator.mediaDevices||WN.run("interval",()=>{this.update()},{delay:1e4}))}init(){Px().then(e=>{this.audioInputs.update(e),this.videoInputs.update(e),this.audioOutputs.update(e)})}async update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=await Px(e);return this.audioInputs.update(t,this),this.videoInputs.update(t,this),this.audioOutputs.update(t,this),this}hasBlueTooth(){var e;if(1e3*(null==(e=UP())?void 0:e.outputLatency)>150)return!0;let t=["bluetooth","air","wireless","bt","tws","buds","headset","headphone"];return this.audioOutputs.devices.some(e=>t.some(t=>e.label.toLowerCase().includes(t)))||this.audioInputs.devices.some(e=>t.some(t=>e.label.toLowerCase().includes(t)))}},Lx=eR||$A?null:new Ox;function Nx(e){return e.deviceId===e.groupId&&""===e.groupId}async function Px(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(RL()||!SL())return[];let t=await navigator.mediaDevices.enumerateDevices();if(0!==e){let r={audio:!1,video:!1};if(t.forEach(e=>{Nx(e)&&(e.kind===AR?r.audio=!0:e.kind===RR&&(r.video=!0))}),2===e&&(r.audio=!1),1===e&&(r.video=!1),r.audio||r.video){let e;try{e=await navigator.mediaDevices.getUserMedia(r),r.audio&&xP()}catch(i){oL.debug("capture before getDevices failed: ",i)}t=await navigator.mediaDevices.enumerateDevices(),null==e||e.getTracks().forEach(e=>e.stop())}}return t.map((e,t)=>{let i={kind:e.kind,deviceId:e.deviceId,groupId:e.groupId,label:e.label||"".concat(e.kind,"_").concat(t)};return e.deviceId.length>0&&Bx.add("".concat(e.deviceId,"_").concat(e.kind)),e.getCapabilities&&(i.getCapabilities=()=>e.getCapabilities()),i})}function xx(e){var t,i;let r="boolean"==typeof e?e:null!=(t=null==e?void 0:e.requestPermission)&&t,n="boolean"!=typeof e&&(null!=(i=null==e?void 0:e.filterVirtualDevice)&&i);return Lx.update(r?1:0).then(e=>{let{devices:t}=e.audioInputs;return n?Cx(t,AR):t})}function Mx(e){var t,i;let r="boolean"==typeof e?e:null!=(t=null==e?void 0:e.requestPermission)&&t,n="boolean"!=typeof e&&(null!=(i=null==e?void 0:e.filterVirtualDevice)&&i);return Lx.update(r?2:0).then(e=>{let{devices:t}=e.videoInputs;return n?Cx(t,RR):t})}var Ux=!1;async function Fx(){try{Ux||(Ux=!0,oL.info("speakers:".concat((await async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(Xk||eD)&&(e=!1),Lx.update(e?1:0).then(e=>e.audioOutputs.devices)}()).map(e=>" ".concat(e.deviceId.slice(0,8),": ").concat(e.label)))))}catch(_A){}}var Bx=new Set;async function Vx(e){let{newDeviceId:t,oldDeviceId:i,oldGroupId:r,oldLabel:n,kind:a}=e;return t===i&&(a!==hR||t!==xR||await async function(e,t){let i=(await xx()).find(e=>e.deviceId===xR);return!t&&(null==i?void 0:i.groupId)===e||(null==i?void 0:i.groupId)===e&&i.label===t}(r,n))}var Hx,jx=class extends yx{constructor(e){super(),this.log=e,UA(this,"volumeMeter"),UA(this,"volumeMeterAfter3A"),UA(this,"volumeDestination"),UA(this,"analyser",new vx),this.volumeMeter=new Ix({log:this.log}),this.volumeMeterAfter3A=new Ix({log:this.log}),this.volumeDestination=new _x,this.volumeMeter.pipeTo(this.volumeDestination)}destroy(){this.gain.deleteNode(),this.volumeMeter.deleteNode(),this.analyser.deleteNode(),this.source.deleteNode(),this.destination.deleteNode(),this.volumeDestination.deleteNode()}},zx=class extends QN{constructor(e){super(e,hR),UA(this,"_outputDeviceId"),UA(this,"_floatVolume",1),UA(this,"_destination"),UA(this,"pipeline"),UA(this,"volumeMeterMode","worklet"),UA(this,"enableVolumeControlInIOS"),this.enableVolumeControlInIOS=e.enableVolumeControlInIOS,this.mode=0,e.url&&(this.url=e.url),this.pipeline=new jx(this._log)}setTrack(e){}get duration(){var e;return Math.floor(1e3*((null==(e=this.element)?void 0:e.duration)||0))}get currentTime(){var e;return Math.floor(1e3*((null==(e=this.element)?void 0:e.currentTime)||0))}set currentTime(e){this.element&&(this.element.currentTime=e/1e3)}getMediaStream(){return this.pipeline.stream||(this.track?new MediaStream([this.track]):null)}initializeElement(e){if(("15.2"===nD||"15.3"===nD||"15.4"===nD)&&this.muted)return void this._log.info("audioElement is muted.");let t=Hx||new Audio;t.setAttribute("autoplay","autoplay"),t.srcObject=this.getMediaStream(),t.muted=this.muted,this.url&&(t.crossOrigin="anonymous",t.src=this.url),this.element=t,this.setVolume(XD(e)?e/100:this._floatVolume),t===Hx&&(Hx=void 0),this.options.enableTimeupdateEvent&&(this.element.ontimeupdate=()=>this.emit(GN.TIME_UPDATE,this.currentTime)),this.bindElementEvents()}async play(e){if(this.track||this.url){try{!this.pipeline.source.node&&this.track&&this.pipeline.replaceSource(this.track),this.element||this.initializeElement(null==e?void 0:e.volume),this._outputDeviceId&&await this.setSinkId(this._outputDeviceId),"worklet"===this.volumeMeterMode?(this.pipeline.volumeMeter.init(),this.pipeline.volumeMeterAfter3A.init()):"analyser"===this.volumeMeterMode&&this.pipeline.analyser.setNode(UP().createAnalyser()),this._log.info("volumeMeterMode: ".concat(this.volumeMeterMode)),Fx()}catch(XA){this._log.warn("autoplay error occurred before native play(): ".concat(XA)),aD(nD,"18.7",!0)&&this.bindAutoPlayEvent();let t=pL({key:lL.PLAY_FAILED,data:{media:this.kind,error:XA}});if(t.includes("NotAllowedError"))throw this.isInAutoPlayFailedState=!0,new gk({code:mk.PLAY_NOT_ALLOWED,message:t})}return super.play()}}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.pipeline.destroy(),super.stop(e)}setVolume(e){this._floatVolume=e,this.element&&(this.element.volume=e)}async setSinkId(e){var t,i;this._outputDeviceId!==e&&(this._outputDeviceId=e),this.element&&this.element.sinkId!==e&&await(null==(i=(t=this.element).setSinkId)?void 0:i.call(t,e)),this._log.info("setSinkId: ".concat(this._outputDeviceId))}get useDestination(){return!!this.pipeline.stream}setLoop(e){this.element&&(this.element.loop=e)}getAudioLevel(){return this.pipeline.volumeMeter.getCalculatedVolume()}getInternalAudioLevel(){return this.pipeline.volumeMeter.getInternalAudioLevel()}getInternalAudioLevelAfter3A(){return this.pipeline.volumeMeterAfter3A.getInternalAudioLevel()}},Wx=class extends zx{constructor(e){super(e),UA(this,"_sourceElement"),UA(this,"_output",new _x),this.pipeline.source.pipeTo(this.pipeline.gain),this.pipeline.gain.pipeTo(this.pipeline.volumeMeter).pipeTo(this._output),this.pipeline.gain.pipeTo(this.pipeline.destination)}setOutput(){this.mode=1,this._output.setNode(UP().destination)}write(e){this.pipeline.volumeMeter.write(e)}setTrack(e){var t,i,r;(null==(i=null==(t=this.element)?void 0:t.error)?void 0:i.code)!==MediaError.MEDIA_ERR_DECODE&&this.track!==e&&(this.unbindTrackEvents(),this.track=e,this.emit(GN.MEDIA_TRACK_CHANGED,e),e?(this.bindTrackEvents(),this._sourceElement?this._sourceElement.srcObject=new MediaStream([e]):!this.useDestination&&this.element&&(this.element.srcObject=new MediaStream([e])),this.pipeline.source.channelCount=(null==(r=e.getSettings())?void 0:r.channelCount)||1,this.pipeline.replaceSource(e)):this.pipeline.source.deleteNode())}setVolume(e){var t;let i=e<=1&&!Zk();if(this._floatVolume!==e||!(i&&(null==(t=this.element)?void 0:t.volume)===e||!i&&this.pipeline.volume===e))if(this._floatVolume=e,this.useDestination)this.pipeline.setVolume(e),this._log.info("set pipeline volume: ".concat(e));else if(i)this.element?(this._log.info("set element volume: ".concat(e)),this.element.volume=e):this._log.info("set element volume: no element");else{if(Zk()){if(!this.enableVolumeControlInIOS)return;MP()}if($k&&!this.pipeline.source.node)return void this._log.warn("set pipeline volume failed: no source node");this._log.info("start set pipeline volume: ".concat(e)),this.pipeline.setVolume(e),this.element&&!this._sourceElement&&(this._destination||(this._destination=UP().createMediaStreamDestination()),this.pipeline.destination.setNode(this._destination),XN(this.element),this._sourceElement=this.element,this._sourceElement.muted=!0,this.element=null,this.play().catch(e=>{this.emit(GN.AUTOPLAY_FAILED,e)}))}}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.pipeline.destroy();let t=this._sourceElement||this.element;t&&tD&&(Hx=t),this._sourceElement&&(this._sourceElement.srcObject=null,delete this._sourceElement),super.stop(e)}},Gx=class extends FN{constructor(e){let{userId:t,sdkAppId:i,mediaType:r,room:n,PlayerClass:a=(1===r?Wx:IP)}=e;var o;super(),UA(this,"id",sL()),UA(this,"userId",""),UA(this,"isRemote"),UA(this,"mediaType"),UA(this,"room"),UA(this,"user"),UA(this,"_log"),UA(this,"_inputTrack"),UA(this,"_outputTrack"),UA(this,"isPlayCalled",!1),UA(this,"container",null),UA(this,"player"),UA(this,"subVideoPlayerMap"),UA(this,"muted",!1),UA(this,"abortCtrl"),UA(this,"objectFit","cover"),UA(this,"mirror"),UA(this,"rotation"),UA(this,"isScreen",!1),UA(this,"manager"),UA(this,"trackSettings"),UA(this,"isFirstVideoFrameEmitted",!1),this.userId=t||"",this.mediaType=r,this._log=oL.createLogger({parent:null==n?void 0:n.getLogger(),id:"".concat(this.kind[0],"t"),userId:null==(o=n||this.room)?void 0:o.userId,remoteUserId:this instanceof oM?void 0:this.userId,sdkAppId:i,type:2===this.mediaType?"auxiliary":"main",isLocal:this instanceof oM}),this.player=new a({id:this.userId||this.id,track:null,muted:!1,container:null,log:this._log,enableVolumeControlInIOS:null==n?void 0:n.enableVolumeControlInIOS}),this.player.on(GN.PLAYER_STATE_CHANGED,e=>{if(iL.emit(rL.PLAYER_STATE_CHANGED,DA({track:this},e)),this.emit("player-state-changed",e),"PLAYING"===e.state&&this.room){let e=!0;for(let{remoteAudioTrack:t,remoteVideoTrack:i,remoteAuxiliaryTrack:r}of[...this.room.remotePublishedUserMap.values()])if(t.isAvailable&&!t.player.isPlaying||i.isAvailable&&!i.player.isPlaying||r.isAvailable&&!r.player.isPlaying){e=!1;break}e&&gP()&&bP&&bP.deleteDialog()}}),this.kind===pR&&(this.player.on(GN.LOADED_DATA,()=>{this.emitFirstVideoFrameEvent(GN.LOADED_DATA),iL.emit(rL.VIDEO_LOADED_DATA,{track:this})}),this.player.on(GN.LOADED_META_DATA,()=>{this.emitFirstVideoFrameEvent(GN.LOADED_META_DATA)}),this.player.on(GN.MEDIA_TRACK_CHANGED,e=>{var t;null==(t=this.subVideoPlayerMap)||t.forEach(t=>t.setTrack(e))}),this.player.on(GN.RESIZE,e=>{this.emitFirstVideoFrameEvent(GN.RESIZE),this.emit("video-size-changed",DA({userId:this.userId,streamType:2===this.mediaType?"auxiliary":"main"},e))})),this.onTrackMuted=this.onTrackMuted.bind(this),this.onTrackUnmuted=this.onTrackUnmuted.bind(this),this.onTrackEnded=this.onTrackEnded.bind(this),this.onPlayerError&&this.player.on(GN.ERROR,this.onPlayerError.bind(this)),this.player.on(GN.AUTOPLAY_FAILED,this.handleAutoPlayFailed,this)}get log(){return this._log||oL}get kind(){return 1===this.mediaType?hR:pR}get isAudio(){return this.kind===hR}get strMediaType(){return 4===this.mediaType?pR:2===this.mediaType?fR:hR}get streamType(){return 2&this.mediaType?"auxiliary":"main"}get isMediaTrackActive(){return!!this.mediaTrack&&(!this.mediaTrack.muted&&"live"===this.mediaTrack.readyState&&this.mediaTrack.enabled)}async play(e,t){let i=QD(e)?e[0]:e;if(this.isPlayCalled)return this.log.info("play update options: ".concat(JSON.stringify(t))),t&&!KD(t.muted)&&this.setPlayerMute(t.muted),t&&!KD(t.objectFit)&&(this.objectFit=t.objectFit),void(this.player instanceof IP&&(this.player.setObjectFit(this.objectFit),this.container!==i&&i&&(QD(e)&&e.length>=1&&this.container&&e.includes(this.container)&&this.container.contains(this.player.elementToRender)?(e.splice(e.indexOf(this.container),1),e.unshift(this.container)):(this.container=i,this.player.setContainer(i))),QD(e)&&e.length>=1&&await this.playSubContainer(e.slice(1),t)));if(t&&!KD(t.muted)?this.setPlayerMute(t.muted):(!this.isRemote||this.kind===pR)&&this.setPlayerMute(!0),t&&!KD(t.objectFit)&&(this.objectFit=t.objectFit),this.player instanceof IP&&(KD(null==t?void 0:t.isLiveStream)||this.player.setLiveMode(t.isLiveStream),this.player.setObjectFit(this.objectFit),t&&!KD(t.poster)&&this.player.setPoster(t.poster)),this.isPlayCalled=!0,i&&(this.container=i,this.player instanceof IP&&this.player.setContainer(i)),iL.emit(rL.PLAY_TRACK_START,{track:this}),this._outputTrack){this._log.info("play with options: ".concat(JSON.stringify(t)));try{this.player.setTrack(this.playerMediaTrack),await this.player.play(t),QD(e)&&e.length>1&&await this.playSubContainer(e.slice(1),t)}catch(r){throw this.handleAutoPlayFailed(r),r}}else this.log.info("play has not mediaTrack, abort")}setMirror(e,t){if(this.isScreen||this.kind!==pR||KD(e)||e===this.mirror)return;this.mirror=e;let i=this.player;t&&(i=t);let r=this.manager;if(ZD(this.mirror))return i.setViewMirror(this.mirror),void(!this.isRemote&&r&&(r.mirror=!1));switch(this.mirror){case"view":r&&(r.mirror=!1),i.setViewMirror(!0);break;case"publish":r&&(r.mirror=!0),i.setViewMirror(!0);break;case"both":r&&(r.mirror=!0),i.setViewMirror(!1)}}async playSubContainer(e,t){if(!this._outputTrack||this.kind===hR)return;this.subVideoPlayerMap||(this.subVideoPlayerMap=new Map),this.subVideoPlayerMap.forEach((t,i)=>{var r;e.find(e=>i===e)||(t.stop(),null==(r=this.subVideoPlayerMap)||r.delete(i))});for(let[r,n]of e.entries()){let e=this.subVideoPlayerMap.get(n);e?t&&(KD(t.objectFit)||e.setObjectFit(t.objectFit)):this.subVideoPlayerMap.set(n,new IP({id:this.userId||this.id,track:this.playerMediaTrack,container:n,muted:this.player.muted,objectFit:this.objectFit,log:this.log.createChild({id:"vp-sub".concat(r+1)})}))}let i=[...this.subVideoPlayerMap.values()];for(let r of i)r.setViewMirror(this.player.mirror),await r.play()}setAudioOutput(e){return this.player.setSinkId(e)}setAudioVolume(e){this.player.setVolume(e)}getAudioLevel(){return this.player.getAudioLevel()||0}getInternalAudioLevel(){var e;return(null==(e=this.player)?void 0:e.getInternalAudioLevel())||0}stop(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isPlayCalled&&(this.isPlayCalled=!1,this.isFirstVideoFrameEmitted=!1,this._replayTimer&&(clearTimeout(this._replayTimer),this._replayTimer=0),this.player&&(this.log.info("stop ".concat(this.kind," player")),this.player.stop(QO(this)&&!e?this.jitterBufferDelay:0)),this.subVideoPlayerMap&&this.subVideoPlayerMap.size>0&&this.subVideoPlayerMap.forEach(e=>{e.stop()}),this.container=null)}async resume(){var e;this.isPlayCalled&&await(null==(e=this.player)?void 0:e.resume())}close(){this._toInitState(),this.log.info("close"),this.isPlayCalled&&this.stop(!0)}_toInitState(){}setMute(e){this.muted=e,this._inputTrack&&(this._inputTrack.enabled=!e),this._outputTrack&&(this._outputTrack.enabled=!e),this.emit(e?"mute":"unmute",this),iL.emit(e?rL.TRACK_MUTED:rL.TRACK_UNMUTED,{track:this})}setPlayerMute(e){this.player.setMuted(e)}get mediaTrack(){return this._inputTrack||null}get outMediaTrack(){return this._outputTrack||null}get playerMediaTrack(){return this.outMediaTrack}installTrackEvent(e){YN(e,e).add(_R,this.onTrackMuted).add(vR,this.onTrackUnmuted).add(yR,this.onTrackEnded),e.muted&&this.onTrackMuted(),e.readyState===yR&&this.onTrackEnded()}uninstallTrackEvent(e){XN(e)}setInputMediaStreamTrack(e){var t;let i=this._inputTrack;if(e!==i)return this._inputTrack=e,this.trackSettings=null==(t=e.getSettings)?void 0:t.call(e),e.enabled=!this.muted,i&&this.uninstallTrackEvent(i),this.installTrackEvent(e),this.emit("input-media-track-changed",e||null,i||null),this.manager?this.manager.changeInput(this):this.setOutputMediaStreamTrack(e)}setOutputMediaStreamTrack(e){var t;e!==this._outputTrack&&(this.isRemote?this.log.debug("setOutputMediaStreamTrack",e.label):this.log.info("setOutputMediaStreamTrack",null==(t=e.getSettings)?void 0:t.call(e).deviceId,e.label),this._outputTrack=e,this._inputTrack&&(this._outputTrack.contentHint=this._inputTrack.contentHint,this._outputTrack.enabled=this._inputTrack.enabled),this.updatePlayingState(!!e),this.emit("output-media-track-changed",e))}setMediaType(e){this.mediaType=e}updatePlayingState(e){var t,i;if(this.isPlayCalled){if(!e){if(this.player.isStopped)return this.stop(),void this.log.info("playing state updated, stop ".concat(this.kind));if(QO(this)&&this.isAudio&&null!=(t=this.user)&&t.muteState.hasAudio&&null!=(i=this.user)&&i.muteState.audioMuted)return;return this.player.stop(QO(this)?this.jitterBufferDelay:0),void this.log.info("playing state updated, stop ".concat(this.kind))}if(this.player.setTrack(this.playerMediaTrack),this.player.isStopped)return this.player.play().catch(e=>this.handleAutoPlayFailed(e)),void this.log.info("playing state updated, play ".concat(this.kind))}this.log.debug("updatePlayingState abort ".concat(this.isPlayCalled," ").concat(e," ").concat(this.player.isStopped))}async handleAutoPlayFailed(e){var t;this.log.warn("handleAutoPlayFailed",e);let i=()=>{this.resume().then(()=>{document.removeEventListener("click",i,!0)})};(pC||gC)&&(await kO(100),null!=(t=this.player)&&t.isPlaying)||(this.room&&this.room.enableAutoPlayDialog?bP||(bP=new EP):document.addEventListener("click",i,!0),iL.once(rL.LOCAL_TRACK_CAPTURE_SUCCESS,e=>{let{track:t}=e;"audio"===t.kind&&gP()&&!this.player.isPlaying&&this.isRemote&&this.isAvailable&&i()}),this.emit("error",e))}getVideoFrame(){return this.player instanceof IP?this.player.getVideoFrame():""}emitFirstVideoFrameEvent(e){var t,i,r;if(this.isFirstVideoFrameEmitted)return;let n=null==(t=this.mediaTrack)?void 0:t.getSettings(),a=(null==n?void 0:n.width)||(null==(i=this.player.element)?void 0:i.videoWidth)||0,o=(null==n?void 0:n.height)||(null==(r=this.player.element)?void 0:r.videoHeight)||0;e===GN.RESIZE&&!a&&!o||e===GN.LOADED_META_DATA&&!a&&!o||(e===GN.LOADED_DATA&&!a&&!o&&this._log.warn("the dimension of video is 0x0 in first-video-frame event"),this.isFirstVideoFrameEmitted=!0,NO(this.rotation)&&([a,o]=[o,a]),this.emit("first-video-frame",{width:a,height:o,streamType:this.streamType,userId:this.isRemote?this.userId:""}))}onTrackMuted(){this._log.warn("".concat(this.kind," track is unable to provide media output"))}onTrackUnmuted(){this._log.info("".concat(this.kind," track is able to provide media output"))}onTrackEnded(){this._log.warn("".concat(this.kind," track ended, isPlayCalled=").concat(this.isPlayCalled,", isStopped=").concat(this.player.isStopped,", playerState=").concat(this.player._state))}};MA([xN([],FN.INIT,{sync:!0})],Gx.prototype,"_toInitState",1);var qx=Object.prototype.hasOwnProperty;var Kx=function(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e||"function"==typeof e||Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(jD(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(let t in e)if(qx.call(e,t))return!1;return!0}return!1};function Yx(e,t,i){if(0!==t.length&&kx(t[0],i)){let r=Cx(t,i);r[0]!==t[0]&&(e.deviceId={exact:r[0].deviceId},oL.info("avoid virtual ".concat(i,' "').concat(t[0].label,'", use "').concat(r[0].label,'" instead')))}}var Xx=eL({retryFunction:async function(e){let t=function(e){return{audio:Jx(e),video:Qx(e)}}(e);oL.info("getUserMedia with constraints: ".concat(JSON.stringify(t)));let i=[],r=[],n=["label","deviceId","groupId"];if(t.audio&&(i=await xx(),oL.info("microphones: ".concat(bO(i.map(e=>OA(DA({},e),{groupId:e.groupId.substring(0,8)})),{keysToInclude:n}))),!ZD(t.audio)&&!t.audio.deviceId&&Yx(t.audio,i,AR)),t.video&&(r=await Mx(),oL.info("cameras: ".concat(bO(r,{keysToInclude:n}))),!ZD(t.video)&&!t.video.deviceId&&!t.video.facingMode&&Yx(t.video,r,RR),!ZD(t.video)&&"user"===t.video.facingMode&&!t.video.deviceId)){let e=r.filter(e=>!e.label.includes("infrared")).find(e=>e.label.includes("facing front"));e&&(t.video.deviceId=e.deviceId,oL.info("exclude infrared camera: ".concat(JSON.stringify(t))))}try{let i=await navigator.mediaDevices.getUserMedia(t);return sN&&i.getTracks().forEach(t=>{var i;let r=t.getCapabilities();oL.info("".concat(t.kind," capabilities: ").concat(bO(r,{keysToInclude:UR}))),!KD(e.echoCancellation)&&-1===(null==(i=r.echoCancellation)?void 0:i.indexOf(e.echoCancellation))&&oL.warn("Invalid argument for 'echoCancellation'. Expected one of [".concat(JSON.stringify(r.echoCancellation),"], but received '").concat(e.echoCancellation,"'"))}),t.audio&&xP(),i}catch(a){let{message:t}=a;throw"NotFoundError"===a.name&&(e.video&&r&&0===r.length&&(t=pL({key:lL.CAMERA_NOT_FOUND})),e.audio&&i&&0===i.length&&(t=pL({key:lL.MICROPHONE_NOT_FOUND}))),new _k({code:mk.INITIALIZE_FAILED,name:a.name,message:t,constraint:a.constraint})}},settings:{retries:3,timeout:500},onError:e=>{let{error:t,retry:i,reject:r,retryFuncArgs:n,retriedCount:a}=e,o=a+1;"NotReadableError"===t.name||"OverconstrainedError"===t.name||"AbortError"===t.name?(1===o?(n[0].video&&(n[0].maxResolution=!1,(!eD||n[0].width*n[0].height<=2073600)&&n[0].frameRate&&(n[0].frameRate=n[0].frameRate>10?10:5)),n[0].retryWhenExactFailed&&n[0].useExactDeviceId&&(n[0].useExactDeviceId=!1)):2===o?n[0].useDeviceIdOnly=!0:3===o&&!n[0].useExactDeviceId&&(n[0].useTrueAsConstraint=!0),i()):r(t),n[0].microphoneId&&Zx(n[0].microphoneId,!1),n[0].cameraId&&Zx(n[0].cameraId,!0)},onRetrying:e=>{oL.warn("getUserMedia NotReadableError observed, retrying [".concat(e,"/3]"))},onRetryFailed:e=>{ZN.logFailedEvent({eventType:PR,error:e})},onRetrySuccess:e=>{ZN.logSuccessEvent({eventType:PR}),ZN.uploadEvent({log:"stat-".concat(PR,"-success-").concat(e)})}});async function Zx(e,t){let i=(t?await Mx():await xx()).find(t=>t.deviceId===e);i&&qD(i.getCapabilities)&&oL.warn(bO(i.getCapabilities(),{keysToInclude:UR}))}function Jx(e){if(!e.audio)return!1;if(e.useTrueAsConstraint)return!0;let t={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:e.sampleRate};return!Kx(e.microphoneId)&&(t.deviceId=e.useExactDeviceId?{exact:e.microphoneId}:e.microphoneId,e.useDeviceIdOnly)?t:(XD(e.channelCount)&&(t.channelCount=e.channelCount),(ZD(e.echoCancellation)||"remote-only"===e.echoCancellation||"all"===e.echoCancellation)&&(t.echoCancellation=e.echoCancellation),ZD(e.noiseSuppression)&&!e.noiseSuppression&&(t.noiseSuppression=!1),ZD(e.autoGainControl)&&!e.autoGainControl&&(t.autoGainControl=!1),!!Kx(t)||t)}function Qx(e){if(!e.video)return!1;if(e.useTrueAsConstraint)return!0;let{maxResolution:t=!0}=e,i={};return e.cameraId?i.deviceId=e.useExactDeviceId?{exact:e.cameraId}:e.cameraId:e.facingMode&&(i.facingMode=e.facingMode),e.useDeviceIdOnly&&!Kx(i)?i:(e.width&&(i.width={ideal:e.width},t&&!$k&&(i.width.max=e.width)),e.height&&(i.height={ideal:e.height},t&&!$k&&(i.height.max=e.height)),$k&&kC&&e.width&&e.height&&e.width*e.height<101376&&(i.width=e.width,i.height=e.height),e.frameRate&&(i.frameRate=e.frameRate),!!Kx(i)||i)}var $x=Xx,eM=0,tM=class{constructor(e){UA(this,"log"),UA(this,"isRunning",!1),UA(this,"queue",[]);let t="fq".concat(++eM);e&&(t+="|".concat(e)),this.log=oL.createLogger({id:t})}get length(){return this.queue.length}get lastQueueItem(){return 0===this.length?null:this.queue[this.length-1]}push(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,r;let n=DA({},e),a=new Promise((e,t)=>{n.resolve=e,n.reject=t});return n.promise=a,t?this.length<=1?this.queue.push(n):null==(r=null==(i=this.lastQueueItem)?void 0:i.promise)||r.then(n.resolve,n.reject):this.queue.push(n),this.log.debug("push ".concat(this.length),e.funcName,e.args),this.isRunning||this.callNext(),a}shift(){let e=this.queue.shift();return this.log.debug("shift ".concat(this.length),null==e?void 0:e.funcName,null==e?void 0:e.args),e}callNext(){if(this.isRunning||0===this.length)return;let{fn:e,args:t,context:i,resolve:r,reject:n,funcName:a}=this.queue[0];this.log.debug("callNext",this.length,a,t),this.isRunning=!0,e.apply(i,t).then(r,n).finally(()=>{this.isRunning=!1,this.shift(),this.callNext()})}},iM=new WeakMap;function rM(e,t){return qA((i,r)=>function(){let r=e;try{for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];let e=i.apply(this,a),s=sO();return tO(e)?e.then(e=>(t?yL.addSuccessEvent({key:r,cost:sO()-s}):yL.addSuccessEvent({key:r}),e)).catch(e=>{throw yL.addFailedEvent({key:r,error:e}),e}):(yL.addSuccessEvent({key:r}),e)}catch(ZA){throw yL.addFailedEvent({key:r,error:ZA}),ZA}})}var nM,aM=((nM=aM||{})[nM.AUTO_SWITCH_NEW_DEVICE=0]="AUTO_SWITCH_NEW_DEVICE",nM[nM.WAIT_CURRENT_DEVICE=1]="WAIT_CURRENT_DEVICE",nM),oM=class extends Gx{constructor(e,t,i){super({mediaType:e,PlayerClass:t,room:i}),UA(this,"isRemote",!1),UA(this,"deviceId"),UA(this,"groupId",""),UA(this,"label",""),UA(this,"sourceTrack"),UA(this,"enableAutoSwitchWhenRecapturing",!0),UA(this,"filterVirtualDevice",!1),UA(this,"_isRecapturing",!1),UA(this,"_lastRecaptureTime",0),UA(this,"_onMuteTimeoutId",-1),UA(this,"_onVisibilityChangeForRecapture",null),UA(this,"_encodeCheckTimeoutId",-1),UA(this,"_silentCaptureStartTime",0),UA(this,"_hasCapturedDataBefore",!1),UA(this,"_lastSilentRecaptureTime",0),UA(this,"_silentCaptureReported",!1),UA(this,"_lastSilentCheckTotalFrames"),UA(this,"recaptureMode",0),UA(this,"profile"),UA(this,"retryEncodeFailed"),this._checkSilentCapture=this._checkSilentCapture.bind(this),this.on("4",e=>{let{state:t}=e;"started"===t?this.startSilentCaptureDetection():"stopped"===t&&this.stopSilentCaptureDetection()})}get enableEncodeFrame(){return!1}get isPublishing(){return"publishing"===this.state.toString()}get isPublished(){return"publish"===this.state}get isUseCustomSource(){return!(!this.mediaTrack||this.sourceTrack===this.mediaTrack)}encodeFrame(e,t){throw new Error("Method not implemented.")}installTrackEvent(e){e.addEventListener(_R,this.onTrackMuted),e.addEventListener(vR,this.onTrackUnmuted),e.addEventListener(yR,this.onTrackEnded),e.muted&&this.onTrackMuted(),e.readyState===yR&&this.onTrackEnded()}uninstallTrackEvent(e){e.removeEventListener(_R,this.onTrackMuted),e.removeEventListener(vR,this.onTrackUnmuted),e.removeEventListener(yR,this.onTrackEnded)}setStateToReady(){}async capture(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,r;let n=this.sourceTrack;try{let n,a=sO();iL.emit(rL.LOCAL_TRACK_CAPTURE_START,{track:this}),e.customSource?(n=new MediaStream,n.addTrack(e.customSource)):(t||null==(i=this.sourceTrack)||i.stop(),n=await $x(e));let o=n.getTracks()[0];return await this.setInputMediaStreamTrack(o),e.customSource||(this.sourceTrack=o,this.updateDeviceIdInUse(),this.listenDeviceChange()),iL.emit(rL.LOCAL_TRACK_CAPTURE_SUCCESS,{track:this,cost:sO()-a,profile:this.profile,room:null==(r=this.manager)?void 0:r.room}),n}catch(a){throw iL.emit(rL.LOCAL_TRACK_CAPTURE_FAILED,{track:this,error:a}),this.log.error("getUserMedia error observed ".concat(a)),a}finally{t&&(null==n||n.stop())}}setOutputMediaStreamTrack(e){var t;if(super.setOutputMediaStreamTrack(e),this.setStateToReady(),this.isPublishing||this.isPublished)return null==(t=this.room)?void 0:t.replaceTrack(this)}get hasFlag(){var e,t;let i=pO((null==(e=this.room)?void 0:e.localPublishFlag)||0,(null==(t=this.room)?void 0:t.userId)||"");return 4===this.mediaType&&i.hasVideo||1===this.mediaType&&i.hasAudio||2===this.mediaType&&i.hasAuxiliary}async publish(e,t){return this.room=e,this.room.localTracks.add(this),this.emit("4",{mediaType:this.strMediaType,state:"starting",prevState:"stopped"}),this.userId=e.userId,this._log.bindParent(e.getLogger()),await t,this._checkPublishFlag(e)}_checkPublishFlag(e){return new Promise(async(t,i)=>{var r,n,a,o,s;let c=()=>i(new _k({code:mk.API_CALL_ABORTED,message:"publish aborted"}));if(this.hasFlag||this.muted?t():((this.state===FN.INIT||"ready"===this.state)&&c(),qP(rx(e,"local-publish-flag-changed"),nx(()=>this.hasFlag),ox(ex(rx(this,FN.INIT),rx(this,"ready"))),mx(t,i,c))),null!=(a=null==(n=null==(r=this.room)?void 0:r.networkQuality)?void 0:n.hadRecentBadUplink)&&a.call(n,2))return t();let l=e.heartbeatCount,d=(null==(s=null==(o=this.mediaTrack)?void 0:o.stats)?void 0:s.totalFrames)||0;this._encodeCheckTimeoutId=setTimeout(async()=>{var r,n,a,o,s,c,u,h;if(null!=(a=null==(n=null==(r=this.room)?void 0:r.networkQuality)?void 0:n.hadRecentBadUplink)&&a.call(n,2)||e.heartbeatCount-l<3)return t();if(this.isPublished||this.isPublishing){let e=this.kind===hR;if(null!=(o=this.mediaTrack)&&o.stats){let e=this.mediaTrack.stats.totalFrames||0;e-d===0&&this.log.warn("capture totalFrames is 0 during encode check, totalFrames",e)}if(!this.isMediaTrackActive)return this.emit("6",this),i(new _k({message:"".concat(this.strMediaType," encode failed, track is not active"),code:e?mk.AUDIO_ENCODE_FAILED:mk.VIDEO_ENCODE_FAILED}));let r=this.stat.bytesSent>0;if(yL[r?"addSuccessEvent":"addFailedEvent"]({key:e?503700:513702}),!e){let e={H264:513704,H265:513705,VP8:513706}[(null==(c=null==(s=this.room)?void 0:s.videoCodec)?void 0:c.toUpperCase())||"H264"];e&&yL[r?"addSuccessEvent":"addFailedEvent"]({key:e})}if(!r){if(yL.addEnum({key:e?503701:513703,value:ED()}),ZN.uploadEvent({log:"stat-encode-failed-".concat(this.kind,"-").concat(_D()||bD()),userId:this.userId}),this.log.warn(e?"encode failed":"".concat(null==(h=null==(u=this.room)?void 0:u.videoCodec)?void 0:h.toUpperCase()," encode failed")),this.retryEncodeFailed&&(this.log.warn("retry encode"),await this.retryEncodeFailed(this),this.stat.bytesSent>0||this.hasFlag||(await kO(5e3),this.stat.bytesSent>0||this.hasFlag)))return t();this.emit("6",this),i(new _k({message:"".concat(this.strMediaType," encode failed"),code:e?mk.AUDIO_ENCODE_FAILED:mk.VIDEO_ENCODE_FAILED}))}}},1e4)})}unpublish(){this.room&&this.room.localTracks.delete(this),this.log.info("unpublish"),iL.emit(rL.LOCAL_TRACK_UNPUBLISHED,{track:this})}async updateDeviceIdInUse(){if(this.sourceTrack&&oN){let{deviceId:e,groupId:t}=this.sourceTrack.getSettings(),{label:i}=this.sourceTrack;await Vx({newDeviceId:e,oldDeviceId:this.deviceId,oldGroupId:this.groupId,oldLabel:this.label,kind:this.kind})||(this.deviceId=e,this.label=i,t&&(this.groupId=t),Px().then(i=>{let r=i.find(i=>{let r=i.deviceId===e;return t&&(r=r&&i.groupId===t),r});r&&this.emit("2",r)}))}}setProfile(e){this.log.info("setProfile",e),Object.assign(this.profile,e)}isNeedToRecapture(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return!(!this.deviceId||!this.sourceTrack||this.kind===hR&&!function(e){if(e instanceof CanvasCaptureMediaStreamTrack||!(e instanceof MediaStreamTrack))return!1;let t=e.label.toLocaleLowerCase();if(t.includes("mic")||t.includes("麦克风"))return!0;let i="".concat(((null==e?void 0:e.getSettings())||{}).deviceId,"_").concat(AR);return!!Bx.has(i)}(this.sourceTrack)||this.kind===pR&&!function(e){if(e instanceof CanvasCaptureMediaStreamTrack||!(e instanceof MediaStreamTrack))return!1;let t=e.label.toLocaleLowerCase();if(t.includes("camera")||t.includes("webcam"))return!0;let i="".concat(((null==e?void 0:e.getSettings())||{}).deviceId,"_").concat(RR);return!!Bx.has(i)}(this.sourceTrack)||this._isRecapturing||e&&kC&&eD)}onTrackMuted(){if(super.onTrackMuted(),this.isNeedToRecapture(!0)){if(Date.now()-this._lastRecaptureTime<MR)return void setTimeout(()=>this.onTrackMuted(),MR);this._onMuteTimeoutId=setTimeout(async()=>{var e;if(null!=(e=this.sourceTrack)&&e.muted){if((Xk||Jk)&&"visible"!==document.visibilityState)return this._onVisibilityChangeForRecapture=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",this._onVisibilityChangeForRecapture),this._onVisibilityChangeForRecapture=null,kO(1e3).then(async()=>{var e;null!=(e=this.sourceTrack)&&e.muted&&!this._isRecapturing&&(this.log.warn("recapture after visible"),this.recapture(await this.getRecoverCaptureDeviceId()))}))},void document.addEventListener("visibilitychange",this._onVisibilityChangeForRecapture);this.recapture(await this.getRecoverCaptureDeviceId())}},5e3)}}onTrackUnmuted(){super.onTrackUnmuted(),this._onMuteTimeoutId>0&&clearTimeout(this._onMuteTimeoutId),this._onVisibilityChangeForRecapture&&(document.removeEventListener("visibilitychange",this._onVisibilityChangeForRecapture),this._onVisibilityChangeForRecapture=null)}async onTrackEnded(){if(super.onTrackEnded(),this.isNeedToRecapture()&&0===this.recaptureMode){if(Date.now()-this._lastRecaptureTime<MR)return void setTimeout(()=>this.onTrackEnded(),MR);this.emit("7"),this.recapture(await this.getRecoverCaptureDeviceId())}}async recapture(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(this._isRecapturing||!this.sourceTrack)return;this.log.warn("recapture trying");let r=this.sourceTrack;t||null==(i=this.sourceTrack)||i.stop(),this._isRecapturing=!0,this._lastRecaptureTime=Date.now();let n={useExactDeviceId:!0};if("user"===e||"environment"===e)n.facingMode=e;else{let t,i="audio"===this.kind?await xx():await Mx(),r=i.find(t=>t.deviceId===e);if(r)if(this.filterVirtualDevice&&kx(r)){let n=Cx(i)[0];n.deviceId!==r.deviceId?(this.log.warn("avoid virtual device ".concat(r.label,", use ").concat(n.label," instead")),t=n.deviceId):t=e}else t=e;n.deviceId=t}return this.capture(n,t).then(()=>{var e;this._isRecapturing=!1,this.log.warn("recapture success"),this.emit("1",{deviceId:this.deviceId}),iL.emit(rL.LOCAL_TRACK_RECAPTURE,{track:this}),null!=(e=this.sourceTrack)&&e.muted&&(this.log.warn("track still muted after recapture"),this.onTrackMuted())}).catch(e=>{this._isRecapturing=!1,this.log.warn("recapture failed ".concat(e.message)),this.emit("5",e),iL.emit(rL.LOCAL_TRACK_RECAPTURE,{track:this,error:e})}).finally(()=>{t&&(null==r||r.stop())})}async getRecoverCaptureDeviceId(){let e=this instanceof uM;if(e&&this.facingMode)return this.facingMode;let{deviceId:t}=this;if(t){let i=(sM.get(t)||0)+1;if(sM.set(t,i),i>=3&&this.enableAutoSwitchWhenRecapturing){let r=e?await Mx():await xx(),n=(this.filterVirtualDevice?Cx(r):r).find(e=>!sM.has(e.deviceId));n&&(this.log.warn("".concat(t," capture fail ").concat(i," times, change new ").concat(n.deviceId)),t=n.deviceId)}}return t}get isCaptureSilent(){var e,t;if(this.muted||!this.sourceTrack||this.sourceTrack.muted||!this.sourceTrack.enabled||"live"!==this.sourceTrack.readyState)return!1;let i=null==(t=null==(e=this.mediaTrack)?void 0:e.stats)?void 0:t.totalFrames;if(XD(i)){let e=this._lastSilentCheckTotalFrames;return this._lastSilentCheckTotalFrames=i,!!XD(e)&&(!(i>e)&&(!(i<e)||this._checkCaptureSilent()))}return this._checkCaptureSilent()}_checkCaptureSilent(){return!1}resetSilentCaptureState(){}get _isRecaptureSilentEnabled(){var e,t,i,r;let n=null==(r=null==(i=null==(t=null==(e=this.room)?void 0:e.scheduleResult)?void 0:t.config)?void 0:i.extraFields)?void 0:r.recaptureSilent;return!!n&&(this.isAudio?"1"===n||"3"===n:"2"===n||"3"===n)}startSilentCaptureDetection(){var e;null==(e=this.room)||e.on("heartbeat-report",this._checkSilentCapture)}stopSilentCaptureDetection(){var e;null==(e=this.room)||e.off("heartbeat-report",this._checkSilentCapture),this._silentCaptureStartTime=0,this._hasCapturedDataBefore=!1,this._lastSilentRecaptureTime=0,this._silentCaptureReported=!1,this._lastSilentCheckTotalFrames=void 0,this.resetSilentCaptureState()}_checkSilentCapture(){if(fD()&&"visible"!==document.visibilityState)this._silentCaptureStartTime=0;else if(this.isPublished&&!this.muted&&this.sourceTrack&&!this.sourceTrack.muted&&"live"===this.sourceTrack.readyState&&!this._isRecapturing&&!this.isUseCustomSource&&!(this._lastSilentRecaptureTime&&Date.now()-this._lastSilentRecaptureTime<3e4)){if(!this.isCaptureSilent)return this._hasCapturedDataBefore=!0,this._silentCaptureStartTime=0,void(this._silentCaptureReported=!1);if(this._hasCapturedDataBefore)if(this._silentCaptureStartTime){if(sO()-this._silentCaptureStartTime>1e4){if(!this._silentCaptureReported){this._silentCaptureReported=!0;let e=_D()||bD();ZN.uploadEvent({log:"stat-silent-capture-".concat(this.strMediaType,"-").concat(e),userId:this.userId}),this.log.warn("capture silent for ".concat(10,"s"))}if(this._isRecaptureSilentEnabled&&this.deviceId&&!this._lastSilentRecaptureTime){this._lastSilentRecaptureTime=Date.now();let e=e=>{this.off("1",t),this.off("5",i);let r=_D()||bD();ZN.uploadEvent({log:"stat-silent-capture-".concat(this.strMediaType,"-").concat(e?"1":"0","-").concat(r),userId:this.userId})},t=()=>e(!0),i=()=>e(!1);this.on("1",t),this.on("5",i),this.recapture(this.deviceId)}}}else this._silentCaptureStartTime=sO()}}stopCapture(){var e;this.sourceTrack&&(this.sourceTrack.stop(),iL.emit(rL.LOCAL_TRACK_STOPPED,{track:this}),this.uninstallTrackEvent(this.sourceTrack)),this._inputTrack&&this.uninstallTrackEvent(this._inputTrack),null==(e=this.manager)||e.removeInput(this),this._onMuteTimeoutId&&clearTimeout(this._onMuteTimeoutId),this._onVisibilityChangeForRecapture&&(document.removeEventListener("visibilitychange",this._onVisibilityChangeForRecapture),this._onVisibilityChangeForRecapture=null),this.stopSilentCaptureDetection()}close(){super.close(),this.stopCapture()}};MA([xN(FN.INIT,"ready",{ignoreError:!0,sync:!0})],oM.prototype,"setStateToReady",1),MA([function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t,i,r){let n=r.value;return r.value=function(){let t=iM.get(this)||new tM;for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return iM.set(this,t),t.push({fn:n,args:a,context:this,funcName:i},e)},r}}()],oM.prototype,"capture",1),MA([xN("ready","publish",{ignoreError:!0,success(){iL.emit(rL.LOCAL_TRACK_PUBLISHED,{track:this,room:this.room}),this.emit("4",{mediaType:this.strMediaType,state:"started",prevState:"starting"}),this.log.info("published")},fail(e){var t;null==(t=this.room)||t.localTracks.delete(this);let i="error",r=e instanceof _k?e:e.cause instanceof _k?e.cause:e,n=!1;r instanceof _k&&(r.message.includes("timeout")?i="timeout":r.code===mk.API_CALL_ABORTED&&(n=!0,i="api-call")),this.emit("4",{mediaType:this.strMediaType,state:"stopped",prevState:"starting",reason:i,error:r}),this.log[n?"info":"error"]("publish failed",r)}}),rM(521714,!1)],oM.prototype,"publish",1),MA([qA(e=>async function(){let t="publish"===this.state?"started":"starting";e.call(this),this.emit("4",{mediaType:this.strMediaType,state:"stopped",prevState:t,reason:"api-call"}),clearTimeout(this._encodeCheckTimeoutId)}),xN([],"ready",{sync:!0})],oM.prototype,"unpublish",1);var sM=new Map;iL.on(rL.SWITCH_DEVICE_SUCCESS,e=>{e.track.deviceId&&sM.delete(e.track.deviceId)});var cM=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.dataView=e,this.isSEI&&(t?this.addPreventionByte():this.removePreventionByte())}addPreventionByte(){let{seiPayloadStartIndex:e}=this,t=this.dataView.byteLength-2,i=[],r=0;for(let a=e;a<=t;a++){let e=this.dataView.getInt8(a);switch(e){case 0:case 1:case 2:case 3:2===r&&(i.push(3),r=0),0===e?r+=1:r=0,i.push(e);break;default:r=0,i.push(e)}}i.push(this.dataView.getInt8(this.dataView.byteLength-1));let n=new DataView(new Uint8Array([...new Uint8Array(this.dataView.buffer).slice(0,e),...i]).buffer);this.dataView=n}removePreventionByte(){let{seiPayloadStartIndex:e}=this,t=this.dataView.byteLength-1,i=[],r=0;for(let a=e;a<=t;a++)switch(this.dataView.getInt8(a)){case 0:r++,i.push(this.dataView.getInt8(a));break;case 3:2!==r&&i.push(this.dataView.getInt8(a)),r=0;break;default:i.push(this.dataView.getInt8(a)),r=0}let n=new DataView(new Uint8Array([...new Uint8Array(this.dataView.buffer).slice(0,e),...i]).buffer);this.dataView=n}get seiPayloadStartIndex(){let e=6;for(let t=6;t<this.dataView.buffer.byteLength&&(e+=1,255===this.dataView.getUint8(t));t+=1);return e}get seiPayloadType(){return this.isSEI?this.dataView.getUint8(5):null}get seiPayload(){if(!this.isSEI)return null;let e=0,t=6;for(let a=6;a<this.dataView.buffer.byteLength;a+=1){let i=this.dataView.getUint8(a);if(t+=1,255!==i){e+=i;break}e+=255}let i=new ArrayBuffer(e),r=new DataView(i),n=t;for(let a=0;a<i.byteLength;a+=1)r.setInt8(a,this.dataView.getInt8(n+a));return r}get naluType(){let e=this.getStartCodeLength();return e>=this.dataView.byteLength?0:31&this.dataView.getUint8(e)}getStartCodeLength(){return this.dataView.byteLength>=4&&0===this.dataView.getUint8(0)&&0===this.dataView.getUint8(1)&&0===this.dataView.getUint8(2)&&1===this.dataView.getUint8(3)?4:this.dataView.byteLength>=3&&0===this.dataView.getUint8(0)&&0===this.dataView.getUint8(1)&&1===this.dataView.getUint8(2)?3:0}get isIDR(){return 5===this.naluType}get isSPS(){return 7===this.naluType}get isPPS(){return 8===this.naluType}get isSEI(){return 6===this.naluType}},lM=class{constructor(){UA(this,"_seiMessageList",[]),UA(this,"_smallSeiMessageList",[]),UA(this,"_seiPayloadType",243)}encodeSEINalu(e){let t=e.byteLength,i=parseInt(String(t/255),10),r=t%255,n=[];n.push(0,0,0,1,6,this._seiPayloadType);for(let o=0;o<i;o++)n.push(255);n.push(r);let a=new DataView(e);return n.push(...new Uint8Array(a.buffer)),n.push(128),new cM(new DataView(new Uint8Array(n).buffer),!0)}sendSEI(e,t){null!=t&&t.seiPayloadType&&(this._seiPayloadType=t.seiPayloadType),this._seiMessageList.push(e),null!=t&&t.small&&this._smallSeiMessageList.push(e)}isEmpty(){return!this._seiMessageList.length}getNaluCount(e){let t=0,i=0,r=new DataView(e);for(let n=0;n<e.byteLength;n++)switch(r.getUint8(n)){case 0:t++;break;case 1:(2===t||3===t)&&i++,t=0;break;default:t=0}return i}encode(e,t){let i=t?this._smallSeiMessageList:this._seiMessageList;if(i.length>0&&e.data.byteLength>0){let t=9-this.getNaluCount(e.data);if(t<=0)return 0;let r=i.splice(0,t).reverse().map(this.encodeSEINalu.bind(this)),n=r.reduce((e,t)=>e+t.dataView.byteLength,0),a=new ArrayBuffer(n+e.data.byteLength),o=new DataView(a),s=new DataView(e.data),c=0;for(let e=0;e<r.length;e++)for(let t=0;t<r[e].dataView.byteLength;t++)o.setInt8(c++,r[e].dataView.getInt8(t));for(let i=0;i<e.data.byteLength;i++)o.setInt8(c++,s.getInt8(i));return e.data=a,r.length}return 0}},dM=class e extends oM{constructor(e){super(arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,IP,null==e?void 0:e.room),UA(this,"profile",DA({},cR)),UA(this,"avoidCropping",!1),UA(this,"_scaleResolutionDownBy"),UA(this,"_smallTrack"),UA(this,"stat",{bytesSent:0,packetsSent:0,framesEncoded:0,framesSent:0,frameWidth:0,frameHeight:0,fpsCapture:0,framesCaptured:0}),UA(this,"small"),UA(this,"isNeedToSetBandwidth"),UA(this,"muteImage"),UA(this,"manager"),UA(this,"_seiCodec",new lM),this.manager=e;let t=()=>{var e;if(this.isAllowed2k4k(this.profile))this.room&&this.settings.height>=1440&&"publish"===this.state&&this.room.sendAbilityStatus({"2k4k":1});else{let t=AD((null==(e=this.room)?void 0:e.sdkAppId)||0)?rR:iR;this.log.warn("Resolution is reset to 1080p, need to upgrade ability here ".concat(t)),this.setProfile(OA(DA({},this.profile),{width:1920,height:1080})),this.applyProfile()}};this.on("input-media-track-changed",t),this.on("publish",t),this.on("input-media-track-changed",()=>{this.invalidateSmallTrack()}),this.handleCameraAdded=this.handleCameraAdded.bind(this),this.handleCameraRemoved=this.handleCameraRemoved.bind(this)}_checkCaptureSilent(){return 0===(this.stat.fpsCapture||0)}get facingMode(){if(oN&&this.mediaTrack)return this.mediaTrack.getSettings().facingMode}get contentHint(){var e,t;return(null==(e=this._inputTrack)?void 0:e.contentHint)||(null==(t=this.outMediaTrack)?void 0:t.contentHint)||""}get isQosClearFirst(){var e;return"detail"===(null==(e=this._inputTrack)?void 0:e.contentHint)}get hasSmall(){var e;return!(null==(e=this.manager)||!e.hasSmall)||!!this._smallTrack}get smallTrack(){if(!this._smallTrack){let e=this.outMediaTrack;e&&(this._smallTrack=e.clone())}return this._smallTrack}invalidateSmallTrack(){this._smallTrack&&(this._smallTrack.stop(),delete this._smallTrack)}async setMute(e){var t,i,r;if(YD(e)){if(this.muteImage===e)return;await(null==(t=this.manager)?void 0:t.deleteWatermark("mute")),await(null==(i=this.manager)?void 0:i.setWatermark({x:0,y:0,width:this.settings.width,height:this.settings.height,type:"mute",zIndex:999,imageUrl:e,fillVideo:!0})),this.muteImage=e,super.setMute(!1)}else this.muteImage&&(await(null==(r=this.manager)?void 0:r.deleteWatermark("mute")),this.muteImage=void 0),super.setMute(e),this.invalidateSmallTrack()}async capture(e){let{deviceId:t,facingMode:i,useExactDeviceId:r=!0,customSource:n,retryWhenExactFailed:a=!0}=e,o={audio:!1,video:!0,facingMode:i||this.facingMode,cameraId:t,width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate,useExactDeviceId:r,retryWhenExactFailed:a,customSource:n};if("environment"===o.facingMode){let e=await this.getDeviceIdWhenUsingBackCamera();e&&(o.cameraId=e)}return super.capture(o)}setProfile(e){var t;let i=this.fallbackProfile(e);if(this.profile.width!==i.width||this.profile.height!==i.height||this.profile.frameRate!==i.frameRate||this.profile.bitrate!==i.bitrate)if(i.bitrate&&(this.isNeedToSetBandwidth=i.bitrate!==this.profile.bitrate),this.isAllowed2k4k(this.profile))super.setProfile(i);else{let e=AD((null==(t=this.room)?void 0:t.sdkAppId)||0)?rR:iR;this.log.warn("Resolution is reset to 1080p, need to upgrade ability here ".concat(e)),super.setProfile(OA(DA({},this.profile),{width:1920,height:1080}))}}async applyProfile(){var e;if(!this.mediaTrack)return;this.log.info("applyProfile",this.profile);let t=this.settings;return(t.height!==this.profile.height||t.width!==this.profile.width||t.frameRate!==this.profile.frameRate)&&(16===oD&&this.deviceId?await this.recapture(this.deviceId):(await(null==(e=this.sourceTrack||this.mediaTrack)?void 0:e.applyConstraints({width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate})),this.manager&&this.manager.changeInput(this)),this.room&&this.settings.height>=1440&&"publish"===this.state&&this.room.sendAbilityStatus({"2k4k":1})),this.isNeedToSetBandwidth&&this.room&&this.room.setBandWidth?(this.isNeedToSetBandwidth=!1,this.room.setBandWidth({bandwidth:this.profile.bitrate,type:pR,videoType:mR})):void 0}get settings(){let e={width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate},t=this.sourceTrack||this.mediaTrack;return oN&&t&&Object.assign(e,t.getSettings()),e}get scaleResolutionDownBy(){return this._scaleResolutionDownBy?this._scaleResolutionDownBy:LO(this.settings,this.profile)}isAllowed2k4k(e){var t;return!(this.room&&this.room.scheduleResult&&!this.isScreen&&!(e.height*e.width<3686400))||1===(null==(t=this.room.scheduleResult.trtcAutoConf)?void 0:t["2k4k"])}isNeedToSwitchDevice(e){return!(!this.mediaTrack||this.deviceId===e||this.facingMode===e)}async switchDevice(e){try{if(!this.isNeedToSwitchDevice(e)&&!this.isUseCustomSource)return;let t={useExactDeviceId:!0,retryWhenExactFailed:!1};"user"===e||"environment"===e?t.facingMode=e:t.deviceId=e,this.sourceTrack&&this.sourceTrack.stop(),await this.capture(t),iL.emit(rL.SWITCH_DEVICE_SUCCESS,{track:this}),this.log.info("switch camera success")}catch(XA){throw this.log.error("switch camera failed ".concat(XA)),this.deviceId&&this.recapture(this.deviceId),XA}}async getDeviceIdWhenUsingBackCamera(){let e;try{if(xC&&!WC&&cN){let t=(await Mx(!0)).map(e=>{var t;return OA(DA({},e),{capabilities:null==(t=e.getCapabilities)?void 0:t.call(e)})}).filter(e=>{var t,i;return null==(i=null==(t=e.capabilities)?void 0:t.facingMode)?void 0:i.includes("environment")}),i=t[0];t.forEach(e=>{var t,r,n,a;let{capabilities:o}=e;(null!=(t=o.width)&&t.max&&null!=(r=o.height)&&r.max?o.width.max*o.height.max:0)>(null!=(n=i.capabilities.width)&&n.max&&null!=(a=i.capabilities.height)&&a.max?i.capabilities.width.max*i.capabilities.height.max:0)&&(i=e)}),null!=i&&i.capabilities&&(this._log.info("use max resolution back camera",i),e=i.deviceId)}}catch(XA){this._log.warn("get max res camera failed",XA)}return e}async updateSmallConfig(e){var t,i;this._log.info("update small stream config: ".concat(JSON.stringify(e)));let r=this.fallbackProfile(e,!0),n=!this.small||r.width!==this.small.width||r.height!==this.small.height||r.frameRate!==this.small.frameRate||r.bitrate!==this.small.bitrate,a=!this.small;this.small=r,n&&await(null==(t=this.manager)?void 0:t.update()),a&&await(null==(i=this.room)?void 0:i.enableSmall(!0)),this.log.info("update small stream config success")}fallbackProfile(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e.width>e.height,r=DA({},e);return e.width*e.height<=19200&&Jk&&KC&&(this.log.warn("".concat(t?"small ":"","resolution is ").concat(e.width,"*").concat(e.height,", fallback to 240*180 for android chrome")),r.width=i?240:180,r.height=i?180:240,r.bitrate=Math.max(e.bitrate,150)),e.width*e.height>921600&&cD&&(r.width=i?1280:720,r.height=i?720:1280,this.log.warn("reset to 1280 * 720 on iOS 13~14")),function(e,t){let i=e.split(".").map(e=>Number(e)),r=t.split(".").map(e=>Number(e));for(let n=0;n<Math.max(i.length,r.length);n++){let e=i[n]||0,t=r[n]||0;if(e<t)return!0;if(e>t)return!1}return!1}(nD,"14.3")&&aD(nD,"14.0",!0)&&this.on("7",()=>{let e=this.profile.width>this.profile.height;this.profile.width*this.profile.height>307200?(this.profile.width=e?640:480,this.profile.height=e?480:640,this.log.warn("reduce the resolution to 480p on iOS 14.0 ~ 14.2")):this.profile.width*this.profile.height>230400&&(this.profile.width=e?640:360,this.profile.height=e?360:640,this.log.warn("reduce the resolution to 360p on iOS 14.0 ~ 14.2"))}),!t&&this.avoidCropping&&(KC||$k)&&!fD()&&e.width*e.height<=230400&&e.width/e.height===16/9&&(this._scaleResolutionDownBy=1280/e.width,r.width=1280,r.height=720,this.log.warn("capture 720p, scale: ".concat(this._scaleResolutionDownBy))),r}stopSmall(){var e,t;this.small&&(delete this.small,null==(e=this.manager)||e.update(),null==(t=this.room)||t.enableSmall(!1),this._smallTrack&&(this._smallTrack.stop(),delete this._smallTrack))}listenDeviceChange(){Lx&&!Lx.listeners("videoInputRemoved").includes(this.handleCameraRemoved)&&Lx.on("videoInputRemoved",this.handleCameraRemoved,this)}async handleCameraRemoved(e){if(e.deviceId===this.deviceId){let t=1===this.recaptureMode;if(this.log.warn("RecaptureMode: ".concat(aM[this.recaptureMode],". Current camera is lost: ").concat(JSON.stringify(e))),0===this.recaptureMode){xM(this.userId,{eventId:2003,param1:7,streamType:2});let e=await Mx(),i=this.filterVirtualDevice?Cx(e)[0]:e[0];i?this.recapture(i.deviceId):t=!0}t&&Lx.on("videoInputAdded",this.handleCameraAdded,this)}}async handleCameraAdded(e){1===this.recaptureMode&&e.deviceId!==this.deviceId||(Lx.off("videoInputAdded",this.handleCameraAdded,this),this.log.warn("camera added: ".concat(JSON.stringify(e))),this.recapture(e.deviceId))}encodeFrame(e,t){if(!this.manager)return e;let i=t?8:this.mediaType,r=e;for(let n=this.manager.encodePipeline.length-1;n>=0;n--){let e=this.manager.encodePipeline[n];if(!e)continue;let t=e({frame:r,mediaType:i});t&&"object"==typeof t&&"frame"in t?r=t.frame:t&&(r=t)}return r}get enableEncodeFrame(){return!!this.manager&&this.manager.encodePipeline.some(e=>e)}play(e,t){return KD(this.mirror)&&!this.isScreen&&this.setMirror("view"),super.play(e,t)}close(){var e;this.muteImage&&(null==(e=this.manager)||e.deleteWatermark("mute"),this.muteImage=void 0),this._smallTrack&&(this._smallTrack.stop(),delete this._smallTrack),Lx.off("videoInputAdded",this.handleCameraAdded,this),Lx.off("videoInputRemoved",this.handleCameraRemoved,this),super.close()}async recapture(e){try{await super.recapture(e)}catch(XA){let i=await Mx(),r=(this.filterVirtualDevice?Cx(i):i).find(t=>t.deviceId!==e);if(!r)throw XA;await super.recapture(r.deviceId)}}setContentHint(e){this.mediaTrack&&"contentHint"in this.mediaTrack&&this.mediaTrack.contentHint!==e&&(this.log.info("setContentHint ".concat(e)),this.mediaTrack.contentHint=e),this.outMediaTrack&&this.outMediaTrack.contentHint!==e&&(this.outMediaTrack.contentHint=e)}setRotation(e){this.manager&&(this.isScreen||KD(e)||e!==this.rotation&&(this.rotation=e,this.manager.rotation=e))}setOutputMediaStreamTrack(t){var i;let r=this._outputTrack;if(!(this instanceof e&&jO(r,this.room||(null==(i=this.manager)?void 0:i.room))))return super.setOutputMediaStreamTrack(t)}};MA([GA(function(e){this.setContentHint(e.contentHint||"motion")})],dM.prototype,"capture",1);var uM=dM,hM=[-1,-1,1,-1,-1,1,1,1],pM=[0,0,1,0,0,1,1,1],fM=class e extends FN{constructor(e,t){if(super(),this.context=e,UA(this,"name"),UA(this,"sourceId",""),UA(this,"input"),UA(this,"output"),UA(this,"texture"),UA(this,"ctx2d",null),UA(this,"fbo"),UA(this,"width",0),UA(this,"height",0),UA(this,"x",0),UA(this,"y",0),UA(this,"program"),UA(this,"vertexShader"),UA(this,"fragmentShader"),UA(this,"totalFrames",0),UA(this,"dropFrames",0),UA(this,"matchInputSize",!0),UA(this,"texCoordBuffer"),UA(this,"positionBuffer"),UA(this,"lastInfo",{name:"",timestamp:0,totalFrames:0,x:0,y:0,width:0,height:0,fps:0}),UA(this,"cost",0),UA(this,"_canvas",null),UA(this,"_image"),UA(this,"log"),this.context.on("disconnect",this.close,this),this.name=t.name,this.log=t.logger,this.matchInputSize=!1!==t.matchInputSize,this.width=t.width||e.width,this.height=t.height||e.height,this._image=t.image,e instanceof RM)t.create2d&&("function"==typeof OffscreenCanvas&&16!==oD?this._canvas=new OffscreenCanvas(this.width,this.height):(this._canvas=document.createElement("canvas"),this._canvas.width=this.width,this._canvas.height=this.height),this.ctx2d=this._canvas.getContext("2d"),this._image=this._canvas);else try{let i=e.ctx;this.texCoordBuffer=this.createBuffer(pM),this.positionBuffer=this.createBuffer(hM),!1!==t.createTexture&&(this.texture=i.createTexture(),this.useTexture(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.pixelStorei(i.UNPACK_ALIGNMENT,1)),t.useFbo&&(this.fbo=i.createFramebuffer(),this.useBufferFrame(),this.useTexture(),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.width,this.height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,this.texture,0)),t.useDefaultProgram?this.program=e.defaultProgam:(t.vertexShaderSource||t.fragmentShaderSource)&&(this.vertexShader=t.vertexShaderSource?e.createShader(i.VERTEX_SHADER,t.vertexShaderSource):e.defaultVShader,this.fragmentShader=t.fragmentShaderSource?e.createShader(i.FRAGMENT_SHADER,t.fragmentShaderSource):e.defaultFShader,this.program=e.createProgram(this.vertexShader,this.fragmentShader))}catch(i){this.context.destroy(new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:3,message:"create video node ".concat(this.name," error ").concat(i.message||i)}))}}get image(){return this._image}set image(e){this._image=e}createFramebuffer(e){let t=this.context.ctx,i=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),i}connect(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return e.addInput(this,...i),this.output=e,e}addInput(e){this.input=e,this.matchInputSize&&e.width&&e.height&&this.resize(e.width,e.height)}requestFrame(e){let t=Date.now();return!!(this.context instanceof AM&&this.render(e)||this.context instanceof RM&&this.render2d(e))&&(this.totalFrames++,this.cost=Date.now()-t,!0)}render2d(e){var t;return!(null==(t=this.input)||!t.requestFrame(e))&&this.draw2d(this.input.image,0,0,this.width,this.height)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t;null==(t=this.output)||t.update(e)}disconnect(){for(var e,t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];null==(e=this.output)||e.removeInput(this,...i),delete this.output}removeInput(e){delete this.input}close(){var e,t;if(this.context.off("disconnect",this.close,this),null==(e=this.output)||e.removeInput(this),delete this.output,null==(t=this.input)||t.disconnect(),this.context instanceof AM){let e=this.context.ctx;e.deleteBuffer(this.texCoordBuffer),e.deleteBuffer(this.positionBuffer),this.fbo&&e.deleteFramebuffer(this.fbo),this.texture&&e.deleteTexture(this.texture),this.vertexShader&&this.vertexShader!==this.context.defaultVShader&&e.deleteShader(this.vertexShader),this.fragmentShader&&this.fragmentShader!==this.context.defaultFShader&&e.deleteShader(this.fragmentShader),this.program&&this.program!==this.context.defaultProgam&&e.deleteProgram(this.program)}this._canvas&&(this._canvas.width=0,this._canvas.height=0,this.ctx2d=null),this.removeAllListeners()}useTexture(){this.useTextures(this.texture)}useInputTexture(){var e;this.useTextures(null==(e=this.input)?void 0:e.texture)}useTextures(){let e=this.context.ctx;for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];i.forEach((t,i)=>{t&&(e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,t))})}useProgram(){this.context.ctx.useProgram(this.program)}useBufferFrame(){let e=this.context.ctx;e.bindFramebuffer(e.FRAMEBUFFER,this.fbo||null)}createBuffer(e){let t=this.context.ctx,i=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,i),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),i}setTexBuffer(e){let t=this.context.ctx;t.bindBuffer(t.ARRAY_BUFFER,this.texCoordBuffer),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW)}setPosBuffer(e){let t=this.context.ctx;t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW)}changeBufferData(e,t){let i=this.context.ctx;i.bindBuffer(i.ARRAY_BUFFER,e),i.bufferData(i.ARRAY_BUFFER,new Float32Array(t),i.STATIC_DRAW)}setAttributes(){let e=this.context.ctx;for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];i.forEach((t,i)=>{e.enableVertexAttribArray(i),e.bindBuffer(e.ARRAY_BUFFER,t),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0)})}getVertexPoint(e,t){return[e/this.width*2-1,t/this.height*2-1]}layout2texCoords(e){return[...this.getVertexPoint(e.x,e.y),...this.getVertexPoint(e.x+e.width,e.y),...this.getVertexPoint(e.x,e.y+e.height),...this.getVertexPoint(e.x+e.width,e.y+e.height)]}resize(e,t){if(this.width!==e||this.height!==t){if(this.width=e,this.height=t,this._canvas&&(this._canvas.width=e,this._canvas.height=t),this.texture&&this.fbo){this.useTexture();let i=this.context.ctx;i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,null)}this.output&&this.output.matchInputSize&&this.output.resize(e,t)}}draw(e,t){this.setAttributes(e||this.positionBuffer,t||this.texCoordBuffer);let i=this.context.ctx;i.drawArrays(i.TRIANGLE_STRIP,0,4)}draw2d(t,i,r,n,a,o,s,c,l){let d=!(KD(o)||KD(s)||KD(c)||KD(l));return!(!this.ctx2d||!t)&&(t instanceof ImageData?(d?this.ctx2d.putImageData(t,i,r,o,s,c,l):this.ctx2d.putImageData(t,i,r),this.emit(e.RENDER,this.ctx2d.canvas)):(d?this.ctx2d.drawImage(t,o,s,c,l,i,r,n,a):this.ctx2d.drawImage(t,i,r,n,a),this.emit(e.RENDER,t)),"undefined"!=typeof VideoFrame&&t instanceof VideoFrame&&t.close(),!0)}drawBackGround2d(e){this.ctx2d&&(this.ctx2d.save(),this.ctx2d.fillStyle=e,this.ctx2d.fillRect(0,0,this.width,this.height),this.ctx2d.restore())}getInfo(){var e;let{totalFrames:t,x:i,y:r,width:n,height:a,name:o,cost:s,dropFrames:c}=this,l=Date.now(),d=(t-this.lastInfo.totalFrames)/((l-this.lastInfo.timestamp)/1e3)|0;return this.lastInfo={totalFrames:t,x:i,y:r,width:n,height:a,timestamp:l,fps:d,name:o,cost:s,dropFrames:c},DA({parent:null==(e=this.input)?void 0:e.getInfo()},this.lastInfo)}createTexture(e){let t=this.context.ctx,i=t.createTexture();return this.useTextures(i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),i}};UA(fM,"RENDER","render"),MA([xN(FN.INIT,"connected",{sync:!0})],fM.prototype,"connect",1),MA([xN("connected",FN.INIT,{ignoreError:!0,sync:!0})],fM.prototype,"disconnect",1),MA([xN([],"closed",{sync:!0})],fM.prototype,"close",1);var mM=fM,gM=qP(function(e){return KP(t=>{let i=0,r=setInterval(()=>t.next(i++),e);return t.defer(()=>{clearInterval(r)}),"interval"},"interval",arguments)}(250),cx(()=>performance.now()),$P()),_M=[0,1,1,1,0,0,1,0],vM=class extends mM{constructor(e,t){super(e,Object.assign({useDefaultProgram:!0,createTexture:!1,name:"destination"},t)),UA(this,"_intervalId",0),UA(this,"_sequence",0),UA(this,"checkGLError",!1),UA(this,"_useTimerOnShowSubject",tx()),UA(this,"_closedOb",rx(this,"closed")),UA(this,"checkVisibilityChange"),UA(this,"_paused",!1),UA(this,"_pendingFps",null),UA(this,"_lastFps",0),e instanceof RM?this.ctx2d=e.ctx||null:e.available&&null!=t&&t.mirrorUpAndDown&&this.setTexBuffer(_M),qP(this._useTimerOnShowSubject,fx(rx(document,"visibilitychange")),ox(this._closedOb),mx(()=>{document.hidden&&(this.start(this.context.frameRate),this.log.info("".concat(this.name," use timer")))}))}get isPaused(){return this._paused}pause(){this.isPaused||(this._paused=!0,this.log.info("".concat(this.name," pause (frameRate=").concat(this._lastFps||this.context.frameRate,")")),this._intervalId&&(WN.clearTask(this._intervalId),this._intervalId=0))}resume(){var e,t;if(!this.isPaused)return;this._paused=!1;let i=null!=(t=null!=(e=this._pendingFps)?e:this._lastFps)?t:this.context.frameRate;this._pendingFps=null,this.log.info("".concat(this.name," resume (frameRate=").concat(i,")")),this._startMainThreadDriven(i)}start(e){this._startMainThreadDriven(e)}_startMainThreadDriven(e){this.isPaused?this._pendingFps=e:0!==this._intervalId&&this._lastFps===e||(this._lastFps=e,this.log.info("".concat(this.name," start render ").concat(e," fps")),WN.clearTask(this._intervalId),this._intervalId=WN.run("intervalInWorker",()=>{if(e!==this.context.frameRate&&(WN.clearTask(this._intervalId),this.start(this.context.frameRate)),this.requestFrame(this._sequence++),this.checkGLError&&this.context instanceof AM){let e=this.context.ctx.getError();e&&this.context.destroy(new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:5,message:"".concat(this.name," req ").concat(this._sequence," render ").concat(this.totalFrames," faild ").concat(e)}))}},{fps:this.context.frameRate}))}render(e){var t;return!(null==(t=this.input)||!t.requestFrame(e))&&(this.useProgram(),this.useBufferFrame(),this.useInputTexture(),this.draw(),this.emit(mM.RENDER,this.context._canvas),!0)}addInput(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];super.addInput(e,...i),this.start(this.context.frameRate)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;"closed"!==this.state&&(this.isPaused||(this._intervalId&&(WN.clearTask(this._intervalId),this._intervalId=0,1===e&&(this.log.info("".concat(this.name," use requestVideoFrameCallback")),this._useTimerOnShowSubject.next())),this.requestFrame(this._sequence++)))}removeInput(e){super.removeInput(e),WN.clearTask(this._intervalId),this._intervalId=0,this._lastFps=0}resize(e,t){super.resize(e,t),this.context.setSize(e,t)}close(){super.close(),WN.clearTask(this._intervalId),document.removeEventListener("visibilitychange",this.checkVisibilityChange)}},yM=class extends vM{constructor(e,t){super(e,t),UA(this,"_videoTrack"),UA(this,"_muteOb"),UA(this,"_subscription"),UA(this,"_canvasContainer"),Number(iD)<17&&(this._canvasContainer=document.createElement("div"),this._canvasContainer.style.display="none"),[this._videoTrack]=e.canvas.captureStream().getVideoTracks(),this.log.info("VideoTrackDestination using captureStream track, id=".concat(this._videoTrack.id,", readyState=").concat(this._videoTrack.readyState)),this._muteOb=rx(this._videoTrack,"mute"),qP(rx(this._videoTrack,"ended"),ox(this._closedOb),mx(()=>{this.context.destroy(new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:8,message:"video track ended"}))}))}enableCheckMute(){this._subscription=qP(this._muteOb,ox(this._closedOb),fx((e=>t=>{let i=performance.now();qP(gM,sx(t=>t-i<e),ax(1))(t)})(5e3)),nx(()=>{var e;return!(null==(e=this._videoTrack)||!e.muted||document.hidden)}),mx(()=>{this.context.destroy(new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:7,message:"video track muted"}))}))}disableCheckMute(){var e;null==(e=this._subscription)||e.dispose()}get videoTrack(){return this._videoTrack}putCanvasIntoDom(){!this.context._canvas||!this._canvasContainer||document.getElementById(this.context._canvas.id)||(this.log.info("".concat(this.name," put canvas to body")),document.body.appendChild(this._canvasContainer),this._canvasContainer.appendChild(this.context._canvas))}render(e){return this.putCanvasIntoDom(),super.render(e)}render2d(e){return this.putCanvasIntoDom(),super.render2d(e)}close(){var e,t;super.close(),null==(e=this._videoTrack)||e.stop(),delete this._videoTrack,null==(t=this._canvasContainer)||t.remove()}},EM=class extends mM{constructor(e,t){super(e,DA({name:"imageSource"},t)),UA(this,"_lastImage"),UA(this,"_totalFrames",0),UA(this,"_autoResize",!1),UA(this,"_canvasRendered"),UA(this,"videoCallbackId",0),UA(this,"waitingFirstFrame",!0),UA(this,"shouldUpdate",!0),this._autoResize=!1!==(null==t?void 0:t.autoResize),16===oD&&(this._canvasRendered=tx(),qP(this._canvasRendered,function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return e=>KP(function(i){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;for(;r<n&&!i.disposed;)i.next(t[r++]);i.disposed||i.subscribe(e)},"startWith",arguments)}(this._image),px(e=>e instanceof HTMLCanvasElement?rx(e,"rendered"):function(){return KP(e=>e.complete(),"empty",arguments)}()),ox(rx(this,"closed")),mx(()=>{this.update()})))}onFirstFrame(){this.waitingFirstFrame=!1}tryVideoFrameCallback(){if(!this.shouldUpdate)return;let e=this.image;this.videoCallbackId&&e.cancelVideoFrameCallback(this.videoCallbackId),bN()&&!document.hidden&&(this.videoCallbackId=e.requestVideoFrameCallback((e,t)=>{this.waitingFirstFrame&&this.onFirstFrame(),document.hidden||(this._totalFrames=t.presentedFrames,this.update(1))}))}_render(e,t){var i;let{width:r,height:n}=this,{image:a}=this;if(a instanceof HTMLVideoElement){if(this.tryVideoFrameCallback(),({videoWidth:r,videoHeight:n}=a),!r||!n)return!1;a.width=r,a.height=n}else if(a instanceof HTMLImageElement||a instanceof ImageData||a instanceof ImageBitmap){if(({width:r,height:n}=a),a!==this._lastImage)this._lastImage=a;else if(r===this.width&&n===this.height)return!0}else a instanceof HTMLCanvasElement||a instanceof OffscreenCanvas?(({width:r,height:n}=a),this._lastImage=a):"undefined"!=typeof VideoFrame&&a instanceof VideoFrame&&(({displayWidth:r,displayHeight:n}=a),null==(i=this._lastImage)||i.close(),this._lastImage=a);if(!this._autoResize)return!0;if(this.width===r&&this.height===n&&this.totalFrames){if(t){this.useTexture();let e=this.context.ctx;e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,a)}}else{if(t){this.useTexture();let e=this.context.ctx;e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a)}this.resize(r,n)}return!0}get image(){return this._image}set image(e){var t;null==(t=this._canvasRendered)||t.next(e),this._image=e}render(e){return this._render(e,!0)}render2d(e){return this._render(e,!1)}},bM=class extends EM{constructor(e,t,i){super(e,i),this._player=t,this.name="videoPlayerSource",qP(rx(this._player,GN.PLAYER_STATE_CHANGED),ox(rx(this,"closed")),nx(e=>{let{state:t}=e;return"PLAYING"===t}),mx(()=>{this.tryVideoFrameCallback()}))}get image(){return this._player.element}},wM=class extends bM{get available(){return this._player.isPlaying&&!this.waitingFirstFrame}get currentTrack(){return this._player.track}constructor(e,t,i){super(e,new IP({id:i.name,track:t,muted:!0,container:null,objectFit:"contain",log:i.logger}),i),this.name="videoTrackSource",this._player.play()}replaceTrack(e){this.waitingFirstFrame=!0,this._player.setTrack(e),this._player.play()}close(){super.close(),this._player.stop()}},IM=class extends mM{constructor(e,t,i){super(e,OA(DA({name:"textSource"},i),{create2d:!0})),UA(this,"hasChange",!0),UA(this,"content",""),this.ctx2d.textBaseline="top",this.content=t.content||"",t.font&&(this.font=t.font),t.color&&(this.color=t.color)}set font(e){this.ctx2d&&(this.ctx2d.font=e,this.hasChange=!0)}get font(){var e;return(null==(e=this.ctx2d)?void 0:e.font)||""}set color(e){this.ctx2d&&(this.ctx2d.fillStyle=e,this.hasChange=!0)}get color(){var e;return(null==(e=this.ctx2d)?void 0:e.fillStyle)||""}render2d(e){return!(!this.ctx2d||!this.hasChange)&&(this.ctx2d.clearRect(0,0,this.width,this.height),this.drawMultilineText(0,0),this.hasChange=!1,!0)}render(e){return!1}resize(e,t){if(!this.ctx2d)return;let{color:i,font:r}=this;super.resize(e,t),this.color=i,this.font=r}drawMultilineText(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1.2;if(!this.ctx2d)return;let r=this.ctx2d.measureText(this.content);t+=r.fontBoundingBoxAscent||r.actualBoundingBoxAscent||0;let n=this.font.match(/(\d+)px/),a=(n?parseInt(n[1],10):16)*i,o=this.content.split("\n");for(let s=0;s<o.length;s++)this.ctx2d.fillText(o[s],e,t+s*a)}},TM=class extends FN{constructor(e){super(),UA(this,"frameRate"),UA(this,"_canvas"),UA(this,"log"),UA(this,"hasAlpha",!1),UA(this,"name"),UA(this,"error"),this.name=e.name,this.log=e.logger.createChild({id:"vc-".concat(this.name)}),this.frameRate=e.frameRate}get canvas(){return this._canvas}set width(e){this._canvas&&(this._canvas.width=e)}get width(){var e;return(null==(e=this._canvas)?void 0:e.width)||0}set height(e){this._canvas&&(this._canvas.height=e)}get height(){var e;return(null==(e=this._canvas)?void 0:e.height)||0}setSize(e,t){this._canvas&&(this._canvas.width=e,this._canvas.height=t)}createVideoTrackSource(e,t){return new wM(this,e,{logger:this.log,name:t})}createVideoTrackDestination(e){return new yM(this,e)}createVideoImageSource(e,t){return new EM(this,t?Object.assign(t,{logger:this.log,image:e}):{logger:this.log,image:e})}createVideoPlayerSource(e,t){return new bM(this,e,t?Object.assign(t,{logger:this.log}):{logger:this.log})}createTextSource(e,t){return new IM(this,e,t?Object.assign(t,{logger:this.log}):{logger:this.log})}get available(){return"created"===this.state}disconnect(){this.emit("disconnect")}};UA(TM,"_ids",0);var SM=class extends TM{constructor(){super(...arguments),UA(this,"defaultProgam"),UA(this,"defaultVShader"),UA(this,"defaultFShader"),UA(this,"ctx"),UA(this,"_canvas2d")}get canvas(){return this._canvas2d||this._canvas}create(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._canvas||(this._canvas=document.createElement("canvas"),this._canvas.id="trtc_".concat(this.name,"_").concat(TM._ids++)),e&&(this._canvas2d=document.createElement("canvas")),this.ctx=this._canvas.getContext("webgl2",FR),!this.ctx)throw new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:2,message:"webgl2 not supported"});this.defaultVShader=this.createShader(this.ctx.VERTEX_SHADER,"\n// 顶点着色器\nattribute vec4 a_position;\nattribute vec2 a_texCoord;\nvarying vec2 v_texCoord;\n\nvoid main() {\n gl_Position = a_position;\n v_texCoord = a_texCoord;\n}\n"),this.defaultFShader=this.createShader(this.ctx.FRAGMENT_SHADER,"\n// 片元着色器\nprecision mediump float;\nvarying vec2 v_texCoord;\nuniform sampler2D u_texture;\n\nvoid main() {\n gl_FragColor = texture2D(u_texture, v_texCoord);\n} "),this.defaultProgam=this.createProgram(this.defaultVShader,this.defaultFShader),this._canvas.addEventListener("webglcontextlost",()=>{this.destroy(new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:4,message:"webgl context lost"}))})}destroy(e){let t="";return e&&(t=e.message,this.error=e,yL.addFailedEvent({key:512702,error:e})),this.disconnect(),this.log.info("video context destroy".concat(t)?": ".concat(t):""),this.ctx&&(this.ctx.deleteShader(this.defaultVShader),this.ctx.deleteShader(this.defaultFShader),this.ctx.deleteProgram(this.defaultProgam),delete this.ctx),e}set width(e){var t;null==(t=this.ctx)||t.viewport(0,0,e,this.height),super.width=e,this._canvas2d&&(this._canvas2d.width=e)}set height(e){var t;null==(t=this.ctx)||t.viewport(0,0,this.width,e),super.height=e,this._canvas2d&&(this._canvas2d.height=e)}setSize(e,t){var i;null==(i=this.ctx)||i.viewport(0,0,e,t),super.setSize(e,t),this._canvas2d&&(this._canvas2d.width=e,this._canvas2d.height=t)}createShader(e,t){let i=this.ctx,r=i.createShader(e);return i.shaderSource(r,t),i.compileShader(r),r}createProgram(e,t){let i=this.ctx,r=i.createProgram();return i.attachShader(r,e),i.attachShader(r,t),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS)||this.log.error(i.getProgramInfoLog(r)),r}};UA(SM,"UNAVAILABLE","unavailable"),MA([xN(FN.INIT,"created",{sync:!0,fail(e){this.log.error("video gl context create failed",e.cause),yL.addFailedEvent({key:512700,error:e.cause||e})},success(){this.log.info("video context created use webgl"),yL.addSuccessEvent({key:512700})}})],SM.prototype,"create",1),MA([xN("created",FN.INIT,{ignoreError:!0,sync:!0,success(e){e&&this.emit(SM.UNAVAILABLE,e),this.removeAllListeners()}})],SM.prototype,"destroy",1);var AM=SM,RM=class extends TM{constructor(){super(...arguments),UA(this,"ctx"),UA(this,"_contextLostHandler",null),UA(this,"_contextRestoredHandler",null)}create(e){this.hasAlpha=e.alpha,this._canvas=document.createElement("canvas"),this._canvas.id="trtc_".concat(this.name,"_").concat(TM._ids++),this._initMainThreadMode(e)}_initMainThreadMode(e){if(this.ctx=this._canvas.getContext("2d",{alpha:e.alpha,willReadFrequently:e.willReadFrequently}),!this.ctx)throw new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:2,message:"2d context not supported"});this._contextLostHandler=()=>{this.log.error("2d context lost, pausing rendering")},this._contextRestoredHandler=()=>{var e;this.log.warn("2d context restored, attempting recovery");let t=null==(e=this._canvas)?void 0:e.getContext("2d",{alpha:this.hasAlpha,willReadFrequently:!1});t?(this.ctx=t,this.log.info("2d context successfully recovered")):(this.log.error("2d context recovery failed, destroying"),this.destroy(new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:9,message:"2d context lost and recovery failed"})))},this._canvas.addEventListener("contextlost",this._contextLostHandler),this._canvas.addEventListener("contextrestored",this._contextRestoredHandler)}destroy(e){let t="";e&&(t=e.message,this.error=e,yL.addFailedEvent({key:512703,error:e})),this.disconnect(),this.log.info("video context destroy ".concat(t?": ".concat(t):"")),this._canvas&&this._contextLostHandler&&this._canvas.removeEventListener("contextlost",this._contextLostHandler),this._canvas&&this._contextRestoredHandler&&this._canvas.removeEventListener("contextrestored",this._contextRestoredHandler),this._contextLostHandler=null,this._contextRestoredHandler=null,delete this.ctx,this._canvas&&(this._canvas.remove(),this._canvas.width=0,this._canvas.height=0,delete this._canvas),this.removeAllListeners(),yL.addSuccessEvent({key:512703})}};MA([xN(FN.INIT,"created",{sync:!0,fail(e){this.log.error("video 2d context create failed",e.cause),yL.addFailedEvent({key:512701,error:e.cause||e})},success(){this.log.info("video context created use 2d"),yL.addSuccessEvent({key:512701})}})],RM.prototype,"create",1),MA([xN("created",FN.INIT,{ignoreError:!0,sync:!0})],RM.prototype,"destroy",1);var kM=sL();if("undefined"!=typeof navigator&&navigator.mediaDevices&&"setCaptureHandleConfig"in navigator.mediaDevices)try{navigator.mediaDevices.setCaptureHandleConfig({handle:kM,exposeOrigin:!0,permittedOrigins:["*"]})}catch(_A){}var CM=async function(e){let t=null,i=function(e){let t={preferCurrentTab:"current-tab"===e.preferDisplaySurface||!!e.captureElement,systemAudio:"include",selfBrowserSurface:e.selfBrowserSurface||"include",surfaceSwitching:"include"},i={frameRate:e.frameRate,displaySurface:e.preferDisplaySurface||"monitor"};if(e.captureElement||(e.applyResolutionConstraints?(i.width=eD?{max:e.width}:{ideal:e.width,max:e.width},i.height=eD?{max:e.height}:{ideal:e.height,max:e.height}):KL()&&(i.width=eD?{max:lR}:{ideal:lR,max:lR},i.height=eD?{max:dR}:{ideal:dR,max:dR})),t.video=i,e.systemAudio){let{echoCancellation:i=!0,noiseSuppression:r=!1,autoGainControl:n=!1}=e;t.audio={echoCancellation:i,noiseSuppression:r,autoGainControl:n,sampleRate:48e3}}return t}(e);oL.info("getDisplayMedia with constraints: ".concat(JSON.stringify(i)));let r=await navigator.mediaDevices.getDisplayMedia(i);e.systemAudio&&0===r.getAudioTracks().length&&(YC&&ZC<74||eD||$k)&&oL.warn("Your browser not support capture system audio");let n=r.getVideoTracks()[0];if(n){if(e.frameRate)try{let t={frameRate:{min:e.frameRate,ideal:e.frameRate}};e.captureElement||(e.applyResolutionConstraints?(t.width=e.width,t.height=e.height):KL()&&(t.width=lR,t.height=dR),await n.applyConstraints(t))}catch(a){oL.warn("screen applyConstraints failed: ".concat(a))}e.captureElement&&(await async function(e,t){var i;if("CropTarget"in window&&"fromElement"in CropTarget&&qD(e.cropTo))try{if((null==(i=e.getCaptureHandle())?void 0:i.handle)!==kM)return;let r=await CropTarget.fromElement(t);await e.cropTo(r)}catch(r){oL.warn("cropTo target failed ".concat(r))}}(n,e.captureElement),await n.applyConstraints({frameRate:{min:e.frameRate,ideal:e.frameRate},width:e.width,height:e.height}))}if(e.audio){let i=function(e){let t={echoCancellation:e.echoCancellation,autoGainControl:e.autoGainControl,noiseSuppression:e.noiseSuppression,sampleRate:e.sampleRate,channelCount:e.channelCount};return KD(e.microphoneId)||(t.deviceId=e.microphoneId),{audio:t,video:!1}}(e);oL.info("getUserMedia with constraints: ".concat(JSON.stringify(i))),t=await navigator.mediaDevices.getUserMedia(i),r.addTrack(t.getAudioTracks()[0])}return r};MA([GA(function(e){this.setContentHint(e.contentHint||"detail")})],class extends uM{constructor(e){super(e,2),UA(this,"profile",{width:1920,height:1080,frameRate:5,bitrate:1600}),UA(this,"objectFit","contain"),UA(this,"isScreen",!0),this._log.id="s-".concat(this._log.id)}get isShareCurrentTab(){var e,t;try{return kM===(null==(t=null==(e=this.mediaTrack)?void 0:e.getCaptureHandle())?void 0:t.handle)}catch(i){return}}async capture(e){let{systemAudio:t=!1,autoGainControl:i,echoCancellation:r,noiseSuppression:n,audioTrack:a,videoTrack:o,captureElement:s,preferDisplaySurface:c,selfBrowserSurface:l,applyResolutionConstraints:d=!0}=e;var u;try{let e,h=sO();return o||a?(e=new MediaStream,o&&e.addTrack(o),a&&e.addTrack(a)):(e=await CM({audio:!1,systemAudio:t,width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate,autoGainControl:i,echoCancellation:r,noiseSuppression:n,captureElement:s,preferDisplaySurface:c,selfBrowserSurface:l,applyResolutionConstraints:d}),this.sourceTrack=e.getVideoTracks()[0]),await this.setInputMediaStreamTrack(e.getVideoTracks()[0]),iL.emit(rL.LOCAL_TRACK_CAPTURE_SUCCESS,{track:this,cost:sO()-h,profile:this.profile,room:null==(u=this.manager)?void 0:u.room}),e}catch(h){throw this.log.error("getDisplayMedia error observed ".concat(h)),h instanceof _k?h:new _k({code:mk.INITIALIZE_FAILED,name:h.name,message:h.message})}}async switchDevice(e){throw new Error("Method not implemented.")}async applyProfile(){var e;if(!this.mediaTrack)return;this.log.info("applyProfile",this.profile);let t=this.settings;return(t.height!==this.profile.height||t.width!==this.profile.width||t.frameRate!==this.profile.frameRate)&&await(null==(e=this.sourceTrack||this.mediaTrack)?void 0:e.applyConstraints({width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate})),this.isNeedToSetBandwidth&&this.room&&this.room.setBandWidth?(this.isNeedToSetBandwidth=!1,this.room.setBandWidth({bandwidth:this.profile.bitrate,type:pR,videoType:gR})):void 0}}.prototype,"capture",1);var DM=class e extends Gx{constructor(t,i,r){super({userId:i.userId,sdkAppId:t.sdkAppId,mediaType:r,room:t}),this.room=t,this.user=i,UA(this,"tinyId"),UA(this,"isRemote",!0),UA(this,"jitterBufferDelay",0),UA(this,"availableState"),UA(this,"remotePublishState"),UA(this,"_triggerCheckDecodeSubject",tx(rx(this,e.STATE_SUBSCRIBE))),UA(this,"ignoreUpdatePlayingState"),UA(this,"_isFirstUnmute",!0),this.tinyId=i.tinyId,this.availableState=new FN("".concat(i.userId,"-").concat(this.mediaType,"-available"),"remote-track-available"),this.remotePublishState=new FN("".concat(i.userId,"-").concat(this.mediaType,"-remote-publish"),"remote-track-publish"),qP(ex(rx(this,FN.STATECHANGED),rx(this.remotePublishState,FN.STATECHANGED)),cx(()=>this.isRemotePublished&&(this.isSubscribed||this.isSubscribing)),mx(e=>{this.availableState.state!==(e?FN.ON:FN.OFF)&&(this.availableState.state=e?FN.ON:FN.OFF),(!this.isRemotePublished||!this.ignoreUpdatePlayingState)&&this.updatePlayingState(e)}));let n=qP(rx(this.player,GN.ERROR),nx(e=>e.code===MediaError.MEDIA_ERR_DECODE)),a=qP(function(e,t){return KP(i=>{let r=0,n=setTimeout(()=>{if(i.removeDefer(a),i.next(r++),t){let e=setInterval(()=>i.next(r++),t);i.defer(()=>{clearInterval(e)})}else i.complete()},e),a=()=>clearTimeout(n);i.defer(a)},"timer",arguments)}(5e3),nx(()=>!!(!this.ignoreDecodeError&&this.isSubscribed&&this.isPlayCalled&&this.stat.bytesReceived&&this.isRemotePublished)&&(!this.player.isPlaying&&!(this.kind===hR?this.getAudioLevel()>0:this.stat.framesDecoded>0)||(this.reportDecodeResult(!0),!1)))),o=qP(function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return KP(e=>{let i=new Map;t.forEach(t=>{let r=new WP(e);i.set(t,r),r.complete=()=>{i.delete(t),0===i.size?e.complete():r.dispose()},r.next=e=>{i.delete(t),i.forEach(e=>e.dispose()),r.resetNext(),r.resetComplete(),r.next(e)}}),t.forEach(e=>i.get(e).subscribe(e))},"race",arguments)}(n,a),ox(rx(this,FN.INIT)));qP(this._triggerCheckDecodeSubject,nx(()=>!this.ignoreDecodeError),fx(o),mx(e=>{this.reportDecodeResult(!1,e)}))}setMute(e){this.isRemotePublished&&super.setMute(e)}setInputMediaStreamTrack(e){super.setInputMediaStreamTrack(e),this.isRemotePublished&&this.isSubscribed&&this.player.setTrack(this.outMediaTrack)}checkDecodeResult(){this._triggerCheckDecodeSubject.next(!0)}waitHasMediaTrack(){return new Promise(e=>{this.mediaTrack?e():this.once("input-media-track-changed",e)})}get ignoreDecodeError(){var e,t,i,r;return null!=(r=null==(i=null==(t=null==(e=this.room)?void 0:e.networkQuality)?void 0:t.hadRecentBadDownlink)?void 0:i.call(t,2))&&r||this.player.isInAutoPlayFailedState}get isSubscribing(){return"subscribeing"===this.state.toString()}get isSubscribed(){return this.state===e.STATE_SUBSCRIBE}get isAvailable(){return this.availableState.state===FN.ON}get isNeedPlay(){return this.isAvailable&&this.isPlayCalled}subscribe(e){return e}unsubscribe(){"main"===this.streamType&&"video"===this.kind&&this.room.changeType(!1,this.user)}reportDecodeResult(e,t){var i,r;let n=this.kind===hR;if(yL[e?"addSuccessEvent":"addFailedEvent"]({key:n?504700:514702}),!n){let t=(null==(i=this.room)?void 0:i.downlinkVideoCodec.toUpperCase())||"H264";yL[e?"addSuccessEvent":"addFailedEvent"]({key:_L["DECODE_".concat(t,"_RESULT")]}),e||this.log.warn("".concat(null==(r=this.room)?void 0:r.downlinkVideoCodec," decode failed"))}e||(yL.addEnum({key:n?504701:514703,value:ED()}),ZN.uploadEvent({log:"stat-decode-failed-".concat(this.kind,"-").concat(_D()||bD(),"-").concat(gD()),userId:this.room.userId}),this._log.warn("decode failed: isPlaying: ".concat(this.player.isPlaying," ").concat(this.kind===hR?"audioLevel: ".concat(this.getAudioLevel()):"framesDecoded: ".concat(this.stat.framesDecoded>0))),this.emit("decode-failed",{error:t}))}updatePlayingState(e){if(this.player.isPlayCalled&&this.player.setTrack(this.playerMediaTrack),this.isPlayCalled){if(!e)return void super.updatePlayingState(!1);if(this.player.isStopped){if(!this.isSubscribed||!this.isRemotePublished||!this.outMediaTrack)return void this.log.info("abort play, isSubscribed: ".concat(this.isSubscribed," isAvailable: ").concat(this.isRemotePublished," hasTrack: ").concat(!!this.outMediaTrack," "));super.updatePlayingState(!0)}}}close(){super.close(),this.outMediaTrack&&this.uninstallTrackEvent(this.outMediaTrack)}onFlagChanged(){this.remotePublishState.state=this.isRemotePublished?FN.ON:FN.OFF,this.emit("remote-publish-changed",this.isRemotePublished)}onTrackMuted(){this.isNeedPlay&&super.onTrackMuted()}onTrackUnmuted(){this.isNeedPlay&&super.onTrackUnmuted(),this.kind===pR&&this._isFirstUnmute&&(this._isFirstUnmute=!1,iL.emit(rL.REMOTE_VIDEO_FIRST_UNMUTE,{track:this,performanceTime:performance.now(),dateTime:Date.now(),isPlayReady:this.isNeedPlay}))}onTrackEnded(){this.isNeedPlay&&super.onTrackEnded()}};UA(DM,"STATE_SUBSCRIBE","subscribe"),MA([function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return qA((i,r)=>function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return new Promise((n,o)=>{let s=setTimeout(()=>{let i=new _k({code:mk.API_CALL_TIMEOUT,message:"checkPendingPromise ".concat(r,"() timeout ").concat(e,"s")});(this.log||this._log||oL).warn(i),2===t?o(i):1===t&&n()},1e3*e);this._checkPendingPromiseSet||(this._checkPendingPromiseSet=new Set),this._checkPendingPromiseSet.add(s),i.apply(this,a).then(n,o).finally(()=>{clearTimeout(s),this._checkPendingPromiseSet&&s&&this._checkPendingPromiseSet.delete(s)})})})}(5,1)],DM.prototype,"waitHasMediaTrack",1),MA([xN(FN.INIT,DM.STATE_SUBSCRIBE,{success(){this.log.info("subscribed"),iL.emit(rL.REMOTE_TRACK_SUBSCRIBED,{track:this})},ignoreError:!0}),rM(521716,!1)],DM.prototype,"subscribe",1),MA([xN(DM.STATE_SUBSCRIBE,FN.INIT,{sync:!0,success(){this.log.info("unsubscribed"),iL.emit(rL.REMOTE_TRACK_UNSUBSCRIBED,{track:this})}})],DM.prototype,"unsubscribe",1);var OM=DM,LM=class extends mM{constructor(e,t,i,r,n){super(e,{useDefaultProgram:!0,useFbo:!0,name:"alpha",create2d:!0,logger:t}),this.setContainer=r,UA(this,"initStat",{alphaStitchingType:1}),UA(this,"end",tx()),UA(this,"minSize",320),UA(this,"maxSize",1280),UA(this,"draggable",!1),UA(this,"startDragX",0),UA(this,"startDragY",0),UA(this,"left",0),UA(this,"top",0),UA(this,"baseWidth",320),UA(this,"baseRatio"),UA(this,"container"),this.initStat=n,this.draggable=i,this.bindDragEvents(),yL.addEnum({key:515700,value:1}),this.draggable&&yL.addEnum({key:515700,value:11})}bindDragEvents(){let e=this.context._canvas;if(e)if(this.draggable){let t=ox(this.end);qP(rx(e,"mousedown"),gx(this.startDrag.bind(this)),px(()=>qP(rx(window,"mousemove"),ox(rx(window,"mouseup")))),t,mx(this.doDrag.bind(this))),qP(rx(e,"dblclick"),t,mx(this.resetPosition.bind(this))),qP(rx(e,"wheel"),t,mx(this.handleZoom.bind(this))),this.renderCanvas()}else{if(!this.container)return;this.container.style.removeProperty("left"),this.container.style.removeProperty("top"),this.end.next()}}render(e){var t;return!(null==(t=this.input)||!t.requestFrame(e))&&(this.useProgram(),this.useBufferFrame(),this.useInputTexture(),this.draw(),!0)}startDrag(e){e.preventDefault(),0===e.button&&(this.startDragX=e.clientX-this.left,this.startDragY=e.clientY-this.top)}renderCanvas(){let{container:e}=this;e||this.setContainer(),e&&this.baseRatio&&this.draggable&&(e.style.setProperty("width","".concat(this.baseWidth,"px")),e.style.setProperty("height","".concat(this.baseWidth/this.baseRatio,"px")),e.style.setProperty("position","fixed"),e.style.setProperty("left","".concat(this.left,"px")),e.style.setProperty("top","".concat(this.top,"px")))}doDrag(e){e.preventDefault(),this.left=e.clientX-this.startDragX,this.top=e.clientY-this.startDragY,this.renderCanvas()}handleZoom(e){e.preventDefault();let t=e.deltaY,i=this.context._canvas;i&&(this.baseWidth||(this.baseWidth=i.offsetWidth),this.baseWidth=t<0?Math.min(1.1*this.baseWidth,this.maxSize):Math.max(.9*this.baseWidth,this.minSize),this.renderCanvas())}resetPosition(){this.left=0,this.top=0,this.renderCanvas()}onRatioReset(){this.renderCanvas()}draw2d(e,t,i,r,n){var a;let{ctx2d:o}=this,s=this.context._canvas;if(!o||!s)return!1;let c=super.draw2d(e,t,i,r,n),l=o.getImageData(0,0,r,n),{data:d}=l,u=!1;if(1===this.initStat.alphaStitchingType){let e=Math.floor(r/2);for(let t=0;t<n;t++)for(let i=0;i<e;i++){let n=4*(t*r+i),a=4*(t*r+(i+e)),o=d[a];d[a+3]=0;let s=o>=100;d[n+3]=s?255:0}u=super.draw2d(l,0,0,0,0,e,n),s.width=e}else if(2===this.initStat.alphaStitchingType){let e=Math.floor(n/2);for(let t=0;t<e;t++)for(let i=0;i<r;i++){let n=4*(t*r+i),a=4*((t+e)*r+i),o=d[a];d[a+3]=0;let s=o>=100;d[n+3]=s?255:0}u=super.draw2d(l,0,0,0,0,r,e),s.height=e}return null==(a=this.context.ctx)||a.clearRect(0,0,r,n),c&&u}close(){this.baseRatio=void 0,this.end.next(),this.end.complete()}};var NM=class extends OM{constructor(e,t){super(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:4),UA(this,"mediaType",4),UA(this,"source"),UA(this,"shouldRenderAlpha",!1),UA(this,"alphaNode"),UA(this,"shouldBeDraggable",!0),UA(this,"stat",{bytesReceived:0,packetsReceived:0,packetsLost:0,framesReceived:0,framesDecoded:0,frameWidth:0,frameHeight:0,end2EndDelay:0,jitterBufferDelay:0,keyFramesDecoded:0}),UA(this,"_keyFrameCountLogged",!1),UA(this,"_keyFrameStartTimestamp",0),UA(this,"_keyFrameStartCount",0),UA(this,"_keyFrameIntervals",[]),UA(this,"_prevKeyFrameTimestamp",0),UA(this,"decodeFrameFromWorker"),UA(this,"decodeFallbackToMainThread"),UA(this,"decodeFallbackMediaStreamTrack"),UA(this,"decodeFallbackOriginalTrack"),this.manager=e.videoManager,this.on("first-video-frame",e=>{this.room.emit("first-video-frame",e)})}isAlphaSei(e){if(this.userId!==e.userId||50!==e.seiPayloadType)return!1;let t=new Uint8Array(e.data);return t.length%3==0&&0===t[0]&&1===t[1]&&t}play(e,t){return null!=t&&t.canvasRender&&!this.source&&this.useCanvasPlayer(),super.play(e,t).then(()=>{this.player.calculateStat(),iL.emit("156",{track:this,player:this.player})})}updateAlphaRenderInfo(e){let t=this.isAlphaSei(e);if(t)if(this.alphaNode){let e=t[2];if(this.alphaNode.baseRatio&&this.alphaNode.initStat.alphaStitchingType===e)return;this.alphaNode.initStat={alphaStitchingType:e};let i=this.player.getElement();if(i){let t=i.videoWidth/i.videoHeight;t&&(this.alphaNode.baseRatio=t*(1===e?.5:2),this.alphaNode.onRatioReset())}this.player.canvas&&(this.player.canvas.id=this.generateAlphaCanvasName(e))}else this.shouldRenderAlpha=!0,this.player.shouldRenderAlpha=!0,this.useCanvasPlayer(t[2])}generateAlphaCanvasName(e){let t=JA[e];return"".concat("alpha","_").concat(t,"_").concat(this.userId)}useCanvasPlayer(e){if(this.log.info("useCanvasPlayer(), has element:".concat(!!this.player.element)),!this.player.element)return;let t=new RM({frameRate:15,logger:this.log,name:this.shouldRenderAlpha&&e?this.generateAlphaCanvasName(e):this.userId});t.create({alpha:this.shouldRenderAlpha,willReadFrequently:this.shouldRenderAlpha});let i=new vM(t,{name:"remotePlayer",logger:this.log});if(this.source=t.createVideoPlayerSource(this.player),this.player.setCanvas(t._canvas),this.shouldRenderAlpha&&e){let r=()=>{!this.player.container||!this.alphaNode||(this.alphaNode.container=this.player.container,this.alphaNode.renderCanvas())},n=new LM(t,this.log,this.shouldBeDraggable,r,{alphaStitchingType:e});this.source.connect(n),n.connect(i),this.alphaNode=n}else this.source.connect(i);bN()||(this.updateCanvasPlayerFPS=this.updateCanvasPlayerFPS.bind(this,t),this.room.on("heartbeat-report",this.updateCanvasPlayerFPS,this))}updateCanvasPlayerFPS(e){let t=this.decodeFPS,i=function(e){return[15,30,45,60].reduce((t,i)=>Math.abs(i-e)<Math.abs(t-e)?i:t)}(t);!XD(t)||t<=0?this.log.debug("updateCanvasPlayerFPS() ignore decoder: ".concat(t," ")):i!==e.frameRate?(this.log.info("updateCanvasPlayerFPS() decoder: ".concat(t,", closest: ").concat(i,", current: ").concat(e.frameRate)),e.frameRate=i):this.log.debug("updateCanvasPlayerFPS() ignore ClosestFPS ".concat(i," == ").concat(e.frameRate))}get decodeFPS(){var e;let{msg_video_status:t}=(null==(e=this.room.heartbeatReport)?void 0:e.msg_down_stream_info.find(e=>e.msg_user_info.str_identifier===this.userId))||{},i=2===this.mediaType?7:this.isSmall?3:2;if(!t||0===t.length)return 0;let r=t.find(e=>e.uint32_video_stream_type===i);return(null==r?void 0:r.uint32_video_dec_fps)||0}stop(){return this.room.off("heartbeat-report",this.updateCanvasPlayerFPS,this),iL.emit("157",{track:this,player:this.player}),this.alphaNode&&this.alphaNode.close(),super.stop()}decodeFrame(e){if(!this.manager)return e;for(let t of this.manager.decodePipeline){if(!t)continue;let i=t({frame:e,track:this});if(!i)return;e="frame"in i?i.frame:i}return e}get isBig(){return 4===this.mediaType}get isSmall(){return 8===this.mediaType}changeType(e){this.room.changeType(e,this.user)}get isRemotePublished(){return this.user.muteState.videoAvailable}setMirror(e){"publish"===e||"both"===e||super.setMirror(e)}setDraggable(e){this.shouldBeDraggable=e,this.alphaNode&&(this.alphaNode.draggable=e,this.alphaNode.bindDragEvents())}onDecodeDowngradeStateChanged(e){this.emit("decode-downgrade-state-changed",e)}updateKeyFramesDecoded(e){let t=this.stat.keyFramesDecoded||0;if(this.stat.keyFramesDecoded=e,this._keyFrameCountLogged)return;let i=Date.now();if(!this._keyFrameStartTimestamp)return this._keyFrameStartTimestamp=i,this._keyFrameStartCount=e,void(this._prevKeyFrameTimestamp=i);if(this._prevKeyFrameTimestamp&&e>t){let r=e-t,n=(i-this._prevKeyFrameTimestamp)/1e3/r;this._keyFrameIntervals.push(n)}this._prevKeyFrameTimestamp=i;let r=i-this._keyFrameStartTimestamp;if(r>=16e3){let t=e-this._keyFrameStartCount,i=t>0?r/1e3/t:0,n="".concat(t," keyframes in 16s ").concat(i," [").concat(this._keyFrameIntervals.map(e=>e.toFixed(1)).join(","),"] keyFramesDecoded ").concat(e),a=i<=2.5?"debug":"info";this.log[a](n),this._keyFrameCountLogged=!0}}},PM=new Map;function xM(e,t){let i=OA(DA({},t),{timestamp:vk()});PM.has(e)?PM.get(e).push(i):PM.set(e,[i])}iL.on(rL.JOIN_SUCCESS,e=>{let{room:t}=e;xM(t.userId,{eventId:32788})}),iL.on(rL.LEAVE_START,e=>{let{room:t}=e;xM(t.userId,{eventId:32789})}),iL.on(rL.LOCAL_TRACK_PUBLISHED,e=>{let{track:t}=e;if(t.room){let e=32769;4===t.mediaType?e=32768:2===t.mediaType&&(e=32805),xM(t.room.userId,{eventId:e})}}),iL.on(rL.LOCAL_TRACK_UNPUBLISHED,e=>{let{track:t}=e;if(t.room){let e=32771;4===t.mediaType?e=32770:2===t.mediaType&&(e=32806),xM(t.room.userId,{eventId:e})}}),iL.on(rL.TRACK_MUTED,e=>{let{track:t}=e;t.room&&(t.kind===hR?xM(t.room.userId,{eventId:t.isRemote?32785:32772,remoteUserId:t.isRemote?t.userId:void 0}):xM(t.room.userId,{eventId:t.isRemote?32784:32773,remoteUserId:t.isRemote?t.userId:void 0}))}),iL.on(rL.TRACK_UNMUTED,e=>{let{track:t}=e;t.room&&(t.kind===hR?xM(t.room.userId,{eventId:t.isRemote?32787:32774,remoteUserId:t.isRemote?t.userId:void 0}):xM(t.room.userId,{eventId:t.isRemote?32786:32775,remoteUserId:t.isRemote?t.userId:void 0}))}),iL.on(rL.REMOTE_TRACK_SUBSCRIBED,e=>{let{track:t}=e;t.room&&(1===t.mediaType&&xM(t.room.userId,{eventId:32777,remoteUserId:t.userId}),4===t.mediaType&&xM(t.room.userId,{eventId:32776,remoteUserId:t.userId}),8===t.mediaType&&xM(t.room.userId,{eventId:32803,remoteUserId:t.userId}))}),iL.on(rL.REMOTE_TRACK_UNSUBSCRIBED,e=>{let{track:t}=e;t.room&&(1===t.mediaType&&xM(t.room.userId,{eventId:32779,remoteUserId:t.userId}),4===t.mediaType&&xM(t.room.userId,{eventId:32778,remoteUserId:t.userId}),8===t.mediaType&&xM(t.room.userId,{eventId:32804,remoteUserId:t.userId}))}),iL.on(rL.SWITCH_DEVICE_SUCCESS,e=>{let{track:t}=e;t.room&&xM(t.room.userId,{eventId:t.kind===pR?32780:32781})}),iL.on(rL.LOCAL_TRACK_REPLACED,e=>{let{track:t}=e;t.room&&xM(t.room.userId,{eventId:t.kind===pR?32782:32783})}),iL.on(rL.SIGNAL_CONNECTION_STATE_CHANGED,e=>{let t,{room:i,prevState:r,state:n}=e;switch(n){case"CONNECTED":t="RECONNECTING"===r?32795:32791;break;case"DISCONNECTED":t="RECONNECTING"===r?32796:32790;break;case"RECONNECTING":t=32794}t&&xM(i.userId,{eventId:t})}),iL.on(rL.PEER_CONNECTION_STATE_CHANGED,e=>{let t,{room:i,prevState:r,state:n,remoteUserId:a}=e,o=!!a;switch(n){case"CONNECTED":t="RECONNECTING"===r?o?32801:32798:o?32793:32792;break;case"DISCONNECTED":"RECONNECTING"===r&&(t=o?32802:32799);break;case"RECONNECTING":t=o?32800:32797}t&&xM(i.userId,{eventId:t,remoteUserId:a})}),iL.on(rL.VIDEO_CODEC_IMPLEMENTATION_CHANGED,e=>{let{implementation:t,userId:i,remoteUserId:r,codec:n,isHWCodec:a,prevImplementation:o,streamType:s}=e,c=a?1:0;o||(c=a?3:2);let l={H264:0,H265:1,VP8:2}[n.toUpperCase()],d={eventId:4004,param1:c,param2:l,streamType:s||2};r&&(d.remoteUserId=r,d.eventId=4005),xM(i,d),yL.addEnum({key:r?514701:513701,value:c}),yL.addEnum({key:r?514700:513700,value:l})}),iL.on(rL.LOCAL_TRACK_RECAPTURE,e=>{let{track:t,error:i}=e;if(t.userId){let e={eventId:2003,param1:0};t.kind===hR?(e.streamType=1,i&&(e.param1=2)):(e.streamType="auxiliary"===t.streamType?7:2,i&&(e.param1=8)),xM(t.userId,e)}}),xA(BA(),1),xA(BA(),1);var MM="trtc_debug_dialog",UM="".concat(MM,"_activated"),FM="".concat(MM,"_switch"),BM="".concat(MM,"_mask"),VM="".concat(MM,"_panel"),HM="".concat(MM,"_tabber"),jM="".concat(MM,"_tab"),zM="".concat(MM,"_topbar"),WM="".concat(MM,"_toptab"),GM="".concat(MM,"_content"),qM="".concat(MM,"_has_topbar"),KM="".concat(GM,"_log"),YM="".concat(GM,"_network"),XM="".concat(MM,"_dump"),ZM="".concat(YM,"_title"),JM="".concat(YM,"_basic"),QM="".concat(YM,"_local"),$M="".concat(YM,"_remote"),eU="".concat(XM,"_title"),tU="".concat(XM,"_local"),iU="".concat(XM,"_remote"),rU="".concat(iU,"_hook"),nU="".concat(MM,"_banner"),aU="".concat(nU,"_item"),oU="".concat(MM,"_toolbar"),sU="".concat(MM,"_tool"),cU="".concat(MM,"_item"),lU="".concat(cU,"_debug"),dU="".concat(cU,"_info"),uU="".concat(cU,"_warn"),hU="".concat(cU,"_error"),pU="".concat(MM,"_back_top"),fU="".concat(MM,"_go_bottom"),mU="".concat(XM,"_local_audio"),gU="".concat(XM,"_local_video_main"),_U="".concat(XM,"_local_video_aux"),vU="".concat(MM,"_tooltip"),yU="".concat(JM,"_network_info"),EU="".concat(JM,"_room_info"),bU="".concat(KM,"_controller"),wU="success",IU="warning",TU="failed",SU=0,AU=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.addStyle(),this.addDialog()}addDialog(){var e;let t=document.createElement("template");t.innerHTML='<div id="'.concat(MM,'" class="').concat(MM,'"><div class="').concat(FM,'">Debug#').concat(++SU,'</div><div class="').concat(BM,'"></div><div class="').concat(VM,'"><div class="').concat(HM,'"><a class="').concat(jM," ").concat(UM,'" data-tab="log">').concat(zR,'</a><a class="').concat(jM,'" data-tab="network">').concat(WR,'</a><a class="').concat(jM,'" data-tab="dump">').concat(GR,'</a></div><div class="').concat(bU,'"><div data-type="back_top">').concat(ek,'</div><div data-type="go_bottom">').concat($R,'</div><div data-type="clear_log">').concat(tk,'</div></div><div class="').concat(zM,'"><a class="').concat(WM," ").concat(UM,'" data-type="all">All</a><a class="').concat(WM,'" data-type="debug">Debug</a><a class="').concat(WM,'" data-type="info">Info</a><a class="').concat(WM,'" data-type="warn">Warn</a><a class="').concat(WM,'" data-type="error">Error</a></div><div class="').concat(GM," ").concat(qM,'"><div class="').concat(KM,'"></div><div class="').concat(YM,'"><div class="').concat(ZM,'">').concat(ak,'</div><div class="').concat(JM,'"><div class="').concat(EU,'"></div><div class="').concat(yU,'">').concat(nk,'</div></div><div class="').concat(ZM,'">').concat(ik,'</div><div class="').concat(QM,'">').concat(nk,'</div><div class="').concat(ZM,'">').concat(rk,'</div><div class="').concat($M,'">').concat(nk,'</div></div><div class="').concat(XM,'"><div class="').concat(eU,'">').concat(ik,'</div><div class="').concat(tU,'"><div id="').concat(mU,'"><span>').concat(ck," - ").concat(ok,'(s):</span><input type="number" min=0 value=0></input><button class="dump">').concat(qR,'</button><button class="dump-opus">').concat(KR,'</button><button class="end-dump" disabled>').concat(XR,'</button></div><div id="').concat(gU,'"><span>').concat(sk," - ").concat(ok,'(s):</span><input type="number" min=0 value=0></input><button class="dump">').concat(GR,'</button><button class="end-dump" disabled>').concat(XR,'</button></div><div id="').concat(_U,'"><span>').concat(lk," - ").concat(ok,'(s):</span><input type="number" min=0 value=0></input><button class="dump">').concat(GR,'</button><button class="end-dump" disabled>').concat(XR,'</button></div></div><div class="').concat(eU,'">').concat(rk,'</div><div class="').concat(iU,'"><div class="').concat(rU,"\">userId:<input id=\"dump-remote-video-hook-userid\" value='*' />duration:<input id=\"dump-remote-video-hook-duration\" min='1' value='0' type='number' />mediaType:<select id=\"dump-remote-video-hook-mediaType\" value='main' ><option value='main' checked>Video</option><option value='sub'>Screen</option></select><button id=\"dump-remote-video-hook-button\">dump if video is available</button></div></div></div></div><div class=\"").concat(nU,'"></div><div class="').concat(oU,'"><a id="trtc_upload" class="').concat(sU,'">').concat(ZR,'</a><a id="trtc_export" class="').concat(sU,'">').concat(JR,'</a><a id="trtc_hide" class="').concat(sU,'">').concat(QR,"</a></div></div></div>"),null==(e=this.shadowRoot)||e.appendChild(t.content.firstChild)}addStyle(){var e;let t=document.createElement("style");t.textContent="#".concat(MM,"{font-size:14px;--DD-BG-0:#ededed;--DD-BG-1:#f7f7f7;--DD-BG-2:#fff;--DD-BORDER:rgba(0,0,0,0.1);--DD-ERROR:red;--DD-WARN:#fa9d3b;--DD-INFO:#000;--DD-DEBUG:#10aeff;--DD-WARN-BG:#fff3cc;--DD-ERROR-BG:#ffe6e6;}#").concat(MM," a,.").concat(FM,"{cursor:pointer;}.").concat(MM,"{color:black;}.").concat(FM,"{display:block;position:fixed;right:50px;bottom:").concat(150+50*SU,"px;border-radius:5px;background-color:#07c160;color:#fff;padding:5px 10px;z-index:10000;}.").concat(BM,"{display:none;position:fixed;left:0;top:0;right:0;bottom:0;z-index:10001;background-color:rgb(0,0,0,0.6);}.").concat(VM,"{background-color:#ededed;display:none;position:fixed;min-height:85%;left:60%;right:0;bottom:0;z-index:10002;border:1px solid var(--DD-BG-0);}@media (max-width:768px) {.").concat(VM,"{left:0;}}.").concat(HM,"{display:flex;height:2em;border-bottom:1px solid var(--DD-BORDER);}.").concat(jM,"{padding:0 20px;border-right:1px solid rgba(0,0,0,0.1);line-height:2em;color:black;}.").concat(jM,".").concat(UM,"{background-color:var(--DD-BG-2);}.").concat(jM,".disabled{cursor:not-allowed;background-color:#ededed;color:#999;}.").concat(zM,"{height:2em;display:flex;flex-direction:row;}.").concat(WM,"{width:20%;text-align:center;line-height:2em;border-right:1px solid var(--DD-BORDER);border-bottom:1px solid var(--DD-BORDER);color:black;}.").concat(WM,".").concat(UM,"{border-bottom:1px solid #1485ee;background-color:var(--DD-BG-2);}.").concat(GM,"{background-color:#fff;position:absolute;left:0;right:0;top:2em;bottom:8em;overflow-y:scroll;overflow-x:hidden;}.").concat(GM,".").concat(qM,"{top:4em;bottom:10em}.").concat(YM,"{display:none;}.").concat(XM,"{display:none;}.").concat(ZM,",.").concat(eU,"{line-height:2em;text-align:center;background-color:var(--DD-BG-0);border-bottom:1px solid var(--DD-BORDER);}.").concat(JM,",.").concat(QM,",.").concat($M,"{text-align:center;border-bottom:1px solid var(--DD-BORDER);}.").concat(tU,",.").concat(iU,"{display:flex;flex-direction:column;padding:0.5em 0;justify-content:center;align-items:center;}.").concat(tU," div input{margin:0 10px;height:1.5em;width:4em;}.").concat(tU," div {padding:10px 0;border-radius:5px;}.").concat(tU," div button,.").concat(iU," div button {cursor:pointer;height:1.8em;border-radius:5px;margin-right:5px;}.").concat(tU," div button[disabled],.").concat(iU," div button[disabled]{cursor:not-allowed;}.").concat(iU," select {height:1.8em;margin:0 10px;}.").concat(iU," div input{margin:0 10px;height:1.5em;width:4em;}.").concat(rU," {line-height:3em;padding:0.5em;}.").concat(ZM,"{text-align:center;background-color:var(--DD-BG-0);border-bottom:1px solid var(--DD-BORDER);}.").concat(JM,",.").concat(QM,",.").concat($M,"{text-align:center;border-bottom:1px solid var(--DD-BORDER);}.").concat(cU,"{border-bottom:1px solid var(--DD-BG-0);padding:5px 10px;overflow-wrap: break-word;}.").concat(hU,"{color:var(--DD-ERROR);background-color:var(--DD-ERROR-BG);}.").concat(uU,"{color:var(--DD-WARN);background-color:var(--DD-WARN-BG);}div .").concat(dU,"{color:var(--DD-INFO);}.").concat(lU,"{color:var(--DD-DEBUG);}.").concat(nU,"{position:absolute;left:0;right:0;bottom:2em;height:6em;border-bottom:1px solid var(--DD-BORDER);display:flex;flex-direction:column;overflow-y:scroll;background-color:var(--DD-BG-1);}.").concat(aU,"{border-bottom:1px solid var(--DD-BORDER);padding:5px 10px;overflow-wrap: break-word;}.").concat(oU,"{position:absolute;line-height:2em;display:flex;flex-direction:row;left:0;right:0;bottom:0;}.").concat(sU,"{flex:1;color:black;text-align:center;background-color:#ededed;border-right:1px solid var(--DD-BORDER);}#").concat(MM," .").concat(pU,",#").concat(MM," .").concat(fU,"{position:absolute;height:2em;width:6em;right:2em;border-radius:5px;background-color:rgba(30,136,229,0.8);z-index:10003;cursor:pointer;padding:0 5px;line-height:2em;color:white;text-align:center;}.").concat(fU,"{bottom:9em;}.").concat(pU,"{bottom:11.5em;}#").concat(MM," .").concat(sU,".disable{cursor:not-allowed;background-color:#ededed;color:#999;}.").concat(vU," {position:relative;display:inline-block;}.").concat(vU," .tooltiptext{visibility:hidden;width:180px;background-color:black;color:#fff;text-align:center;padding:5px 0;border-radius:6px;position:absolute;}.").concat(vU," .tooltip-top {bottom:125%;left:50%;margin-left:-90px;}.").concat(vU,":hover .tooltiptext{visibility:visible;}.").concat(bU,"{position:absolute;left:0;right:0;bottom:8em;height:2em;display:flex;align-items:center;}.").concat(bU," div{flex:1;cursor:pointer;border-right:1px solid var(--DD-BORDER);text-align: center;}"),null==(e=this.shadowRoot)||e.appendChild(t)}};customElements.define("trtc-basic-debug-dialog",AU);var RU=class{constructor(e,t){UA(this,"_dialogNode",null),UA(this,"_switchNode",null),UA(this,"_maskNode",null),UA(this,"_panelNode",null),UA(this,"_logContentNode",null),UA(this,"_networkContentNode",null),UA(this,"_dumpContentNode",null),UA(this,"_tabNodes",[]),UA(this,"_toptabNodes",[]),UA(this,"_hasMove",!1),UA(this,"_showDialog",!1),UA(this,"_isMobile",!1),UA(this,"_showLogType","all"),UA(this,"prevBytesSent",0),UA(this,"prevBytesReceived",0),UA(this,"_core"),UA(this,"_log"),UA(this,"_logList",[]),UA(this,"isUploading",!1),UA(this,"publishMap",new Map),UA(this,"dumpLocalVideoMap",{}),UA(this,"dumpRemoteVideoMap",{}),UA(this,"dumpLocalAudioMap",{}),UA(this,"dumpRemoteAudioMap",{}),UA(this,"eventMap",new Map),UA(this,"switchPos",{x:0,y:0,startX:0,startY:0,endX:0,endY:0,isTouchEnd:!1}),UA(this,"handleLeaveSuccess",e=>{let{room:t}=e;var i,r;if(!this.hitTest(t))return;let n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(iU));for(let a of this.publishMap.values())null==n||n.removeChild(a);this.publishMap.clear()}),UA(this,"handleJoinSuccess",e=>{let{room:t}=e;var i,r;if(!this.hitTest(t))return;(null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(EU))).innerHTML="sdkAppId: ".concat(t.sdkAppId,"<br/>roomId: ").concat(t.roomId,"<br/>userId: ").concat(t.userId,"<br/>")}),UA(this,"handleRemoteVideoAvailable",e=>{let t="sub"===e.streamType?"auxiliary":"main";this.renderDumpTab(e.userId,"remote",t,"publish")}),UA(this,"handleRemoteVideoUnavailable",e=>{let t="sub"===e.streamType?"auxiliary":"main";this.renderDumpTab(e.userId,"remote",t,"unpublish")}),UA(this,"handleRemoteAudioAvailable",e=>{this.renderDumpTab(e.userId,"remote","audio","publish")}),UA(this,"handleRemoteAudioUnavailable",e=>{this.renderDumpTab(e.userId,"remote","audio","unpublish")}),UA(this,"renderDumpTab",(e,t,i,r)=>{var n,a,o;let s={main:"video",auxiliary:"screen",audio:"audio"},c=(e,t)=>{var i,r,n;let a=document.createElement("div");a.innerText="".concat(e," - ").concat(s[t]," - ").concat(ok,"(s):");let o=document.createElement("input");o.type="number",o.min="0",o.value="10",o.id="dump_remote_".concat(t,"_").concat(e);let c,l=document.createElement("button");l.innerText=XR,l.disabled=!0,"audio"===t&&(c=document.createElement("button"),c.innerText=KR,c.style.marginLeft="5px");let d,u,h=document.createElement("button");if(h.innerText="audio"===t?qR:GR,h.onclick=()=>{let i,r,n=Number(o.value);if("audio"===t)({download:i,onDumpEnd:r}=this.dumpAudio("remote",n,e));else{if(!this.isSupportDumpVideo())return;({download:i,onDumpEnd:r}=this.dumpVideo(t,"remote",n,e))}i&&(this.inactiveButton(h,YR),c&&this.inactiveButton(c),n>0?setTimeout(()=>{null==i||i(),this.activeButton(h,GR),c&&this.activeButton(c,KR)},1e3*n):(this.activeButton(l),l.onclick=()=>{l.onclick=null,null==i||i(),null==r||r(),this.activeButton(h,GR),c&&this.activeButton(c,KR),this.inactiveButton(l)}))},c&&(c.onclick=()=>{let t=Number(o.value),{download:i,onDumpEnd:r}=this.dumpAudioFromPipeline("remote",t,e);i&&(this.inactiveButton(c,YR),this.inactiveButton(h),t>0?setTimeout(()=>{null==i||i(),this.activeButton(c,KR),this.activeButton(h,GR)},1e3*t):(this.activeButton(l),l.onclick=()=>{l.onclick=null,null==i||i(),null==r||r(),this.activeButton(c,KR),this.activeButton(h,GR),this.inactiveButton(l)}))}),"audio"!==t&&(d=document.createElement("button"),d.innerText="Dump w/ Audio",d.style.marginLeft="5px",d.onclick=()=>{if(!this.isSupportDumpVideo())return;let i=Number(o.value),r=this.dumpVideo(t,"remote",i,e),n=this.dumpAudioFromPipeline("remote",i,e);if(!r.download&&!n.download)return;let a=async()=>{var i,a,o,s;let c=new pk.default,l=this.dumpRemoteVideoMap["".concat(e,"-").concat(t)];if(l&&l.data.length>0){let i,r="h264",n=this.getVideoCodec(e);if("vp8"===n){let n=this._core.room.remotePublishedUserMap.get(e),a="main"===t?null==n?void 0:n.remoteVideoTrack:null==n?void 0:n.remoteAuxiliaryTrack;this.addInfoToBanner(IU,"package vp8 into ivf format"),i=this.convertVP8ToIVF(l.data,a),r="ivf"}else i=new Blob(l.data),r=n||"h264";let a="remote-".concat(e,"_").concat(t,"_").concat(this.formatStartDumpTime(l.startTimestamp),".").concat(r);c.file(a,i)}let d=this.dumpRemoteAudioMap["".concat(e)];if(d&&d.data.length>0){let t,r=(null==(a=null==(i=this._core.room.userManager)?void 0:i.getPublishedUser(e))?void 0:a.audioCodec)||"opus",n=r;"opus"===r?(this.addInfoToBanner(IU,"package opus to ogg"),t=this.convertOpusToOgg(d.data),n="ogg"):t=new Blob(d.data);let o="remote-".concat(e,"_audio_").concat(this.formatStartDumpTime(d.startTimestamp),".").concat(n);c.file(o,t)}let u=await c.generateAsync({type:"blob"}),h=URL.createObjectURL(u),p=document.createElement("a");p.href=h,p.download="dump_".concat(e,"_").concat(this.formatStartDumpTime(Date.now()),".zip"),p.style.display="none",document.body.appendChild(p),p.click(),URL.revokeObjectURL(h),document.body.removeChild(p),null==(o=r.onDumpEnd)||o.call(r),null==(s=n.onDumpEnd)||s.call(n),this.addInfoToBanner(wU,"Dump success, file name is: ".concat(p.download))};this.inactiveButton(d,YR),this.inactiveButton(h),i>0?setTimeout(()=>{a(),this.activeButton(d,"Dump w/ Audio"),this.activeButton(h,GR)},1e3*i):(this.activeButton(l),l.onclick=()=>{l.onclick=null,a(),this.activeButton(d,"Dump w/ Audio"),this.activeButton(h,GR),this.inactiveButton(l)})}),"audio"!==t){u=document.createElement("button"),u.innerText="Preview",u.style.whiteSpace="Pre";let i=document.createElement("video");document.body.appendChild(i),i.id="".concat(MM,"_preview_remote_").concat(t,"_").concat(e),i.style.cssText="\n width: 320px;\n height: 240px;\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n border: 3px solid #cccccc;\n transform: translate(-50%, -50%);\n z-index: 10004;\n ",u.onclick=async()=>{var r;if(i.style.display="none"===i.style.display?"":"none",u&&(u.innerText="none"===i.style.display?"Preview":" Hide "),!i.srcObject){let n=this._core.room.remotePublishedUserMap.get(e);if(n){let e=null==(r=n["main"===t?"remoteVideoTrack":"remoteAuxiliaryTrack"])?void 0:r.mediaTrack;e?(i.srcObject=new MediaStream([e]),await i.play()):this.addInfoToBanner(TU,"failed to preview, remote video track is not available")}}}}a.appendChild(o),a.appendChild(h),c&&a.appendChild(c),d&&a.appendChild(d),a.appendChild(l),u&&a.appendChild(u),a.style.cssText="padding:10px;";let p=document.createElement("div");return p.style.cssText="width:100%;display:flex;justify-content:center;border-top: 1px solid var(--DD-BORDER);",p.appendChild(a),null==(n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(iU)))||n.appendChild(p),p};if("remote"===t)if("publish"===r){let r=c(e,i);this.publishMap.set("".concat(e,"-").concat(t,"-").concat(i),r)}else{let r=this.publishMap.get("".concat(e,"-").concat(t,"-").concat(i));if(!r)return;null==(o=null==(a=null==(n=this._dialogNode)?void 0:n.shadowRoot)?void 0:a.querySelector(".".concat(iU)))||o.removeChild(r);let s=document.querySelector("#".concat(MM,"_preview_remote_").concat(i,"_").concat(e));s&&document.body.removeChild(s),this.publishMap.delete("".concat(e,"-").concat(t,"-").concat(i))}}),UA(this,"handleStatistics",e=>{var t,i,r,n,a,o;let s=(e.bytesSent-this.prevBytesSent)/2,c=(e.bytesReceived-this.prevBytesReceived)/2;this.prevBytesSent=e.bytesSent,this.prevBytesReceived=e.bytesReceived,(null==(i=null==(t=this._dialogNode)?void 0:t.shadowRoot)?void 0:i.querySelector(".".concat(yU))).innerHTML="rtt: ".concat(e.rtt," ms upLoss: ").concat(e.upLoss,"% downLoss: ").concat(e.downLoss,"% <br>\n ↑ ").concat(s/1e3," KB/s (").concat(8*s/1e3," Kb/s) <br>\n ↓ ").concat(c/1e3," KB/s (").concat(8*c/1e3," Kb/s) <br>\n ");let l=null==(n=null==(r=this._dialogNode)?void 0:r.shadowRoot)?void 0:n.querySelector(".".concat(QM)),d="";e.localStatistics.audio.bitrate&&(d="<li>local audio: ".concat(e.localStatistics.audio.bitrate," Kb/s audioLevel: ").concat(e.localStatistics.audio.audioLevel.toFixed(5),"</li>")),e.localStatistics.video.length>0&&(d+="".concat(e.localStatistics.video.map(e=>"<li>local ".concat(e.videoType," video: ").concat(e.bitrate," Kb/s ").concat(e.width,"*").concat(e.height," ").concat(e.frameRate,"fps</li>")).join(""))),l.innerHTML=""===d?"".concat(nk):d;let u=null==(o=null==(a=this._dialogNode)?void 0:a.shadowRoot)?void 0:o.querySelector(".".concat($M)),h="";e.remoteStatistics.length>0&&e.remoteStatistics.forEach(e=>{let t="remote ".concat(e.userId,":");e.audio.bitrate>0&&(t+="<li>audio: ".concat(e.audio.bitrate," Kb/s audioLevel: ").concat(e.audio.audioLevel.toFixed(5),"</li>")),e.video.length>0&&e.video.forEach(e=>{t+="<li>".concat(e.videoType," video: ").concat(e.bitrate," Kb/s ").concat(e.width,"*").concat(e.height," ").concat(e.frameRate,"fps</li>")}),h+=t}),u.innerHTML=""===h?"".concat(nk):h}),UA(this,"pad",e=>e<10?"0".concat(e):"".concat(e)),this._core=e,this._log=t,this.initCustomElements(),this.synchronizeLog(),this.installEvents(),this.addVideoProcessor(),this.addAudioProcessor(),window["__trtc_instance_".concat(SU,"__")]=this._core.trtc}initCustomElements(){this._isMobile=(()=>{let e=window.navigator&&window.navigator.userAgent||"",t=/iPad/i.test(e)||/iPhone/i.test(e),i=/Android/i.test(e);return t||i})();let e=document.createElement("trtc-basic-debug-dialog");document.body.appendChild(e);let t=e.shadowRoot;if(this._dialogNode=e,!t)return;this._switchNode=t.querySelector(".".concat(FM)),this._addEventListener(this._switchNode,"click",this.onSwitchClick.bind(this));let i=getComputedStyle(this._switchNode);this.switchPos.x=parseInt(i.right,10)||50,this.switchPos.y=parseInt(i.bottom,10)||100+50*SU,this._isMobile?(this._switchNode.ontouchstart=this.onTouchStart.bind(this),this._switchNode.ontouchend=this.onTouchEnd.bind(this),this._switchNode.ontouchmove=this.onTouchMove.bind(this)):this._switchNode.onmousedown=this.onMouseDown.bind(this),this._maskNode=t.querySelector(".".concat(BM)),this._addEventListener(this._maskNode,"click",this.onMaskClick.bind(this)),this._panelNode=t.querySelector(".".concat(VM)),t.querySelector(".".concat(bU)).childNodes.forEach(e=>{switch(e.getAttribute("data-type")){case"go_bottom":this._addEventListener(e,"click",this.onGoBottomClick.bind(this));break;case"back_top":this._addEventListener(e,"click",this.onBackTopClick.bind(this));break;case"clear_log":this._addEventListener(e,"click",this.onClearLogClick.bind(this))}}),this._logContentNode=t.querySelector(".".concat(KM)),this._networkContentNode=t.querySelector(".".concat(YM)),this._dumpContentNode=t.querySelector(".".concat(XM)),this._tabNodes=Array.from(t.querySelector(".".concat(HM)).children),this._tabNodes.forEach(e=>{this._addEventListener(e,"click",this.onTabClick.bind(this))}),this._toptabNodes=Array.from(t.querySelector(".".concat(zM)).children),this._toptabNodes.forEach(e=>{this._addEventListener(e,"click",this.onToptabClick.bind(this))});let r=t.querySelector("#trtc_upload");this._addEventListener(r,"click",this.onUploadClick.bind(this));let n=t.querySelector("#trtc_export");this._addEventListener(n,"click",this.onExportClick.bind(this));let a=t.querySelector("#trtc_hide");this._addEventListener(a,"click",this.onHideClick.bind(this));let o=t.querySelector("#".concat(gU," .dump")),s=t.querySelector("#".concat(gU," .end-dump")),c=t.querySelector("#".concat(gU," input"));this._addEventListener(o,"click",()=>{let e=Number(c.value);this.getDumpButtonClickHandler(o,s,e,"main","local")});let l=t.querySelector("#".concat(_U," .dump")),d=t.querySelector("#".concat(_U," .end-dump")),u=t.querySelector("#".concat(_U," input"));this._addEventListener(l,"click",()=>{let e=Number(u.value);this.getDumpButtonClickHandler(l,d,e,"auxiliary","local")});let h=t.querySelector("#".concat(mU," .dump")),p=t.querySelector("#".concat(mU," .dump-opus")),f=t.querySelector("#".concat(mU," .end-dump"));this._addEventListener(h,"click",()=>{let e=Number(t.querySelector("#".concat(mU," input")).value),{download:i,onDumpEnd:r}=this.dumpAudio("local",e);i?(this.inactiveButton(h,YR),this.inactiveButton(p),e>0?setTimeout(()=>{i(),this.activeButton(h,qR),this.activeButton(p,KR)},1e3*e):(this.activeButton(f),f.onclick=()=>{f.onclick=null,i(),null==r||r(),this.activeButton(h,qR),this.activeButton(p,KR),this.inactiveButton(f)})):this.addInfoToBanner(TU,"Failed to dump, please check if the current user has started the audio")}),this._addEventListener(p,"click",()=>{let e=Number(t.querySelector("#".concat(mU," input")).value),{download:i,onDumpEnd:r}=this.dumpAudioFromPipeline("local",e);i?(this.inactiveButton(p,YR),this.inactiveButton(h),e>0?setTimeout(()=>{i(),this.activeButton(p,KR),this.activeButton(h,qR)},1e3*e):(this.activeButton(f),f.onclick=()=>{f.onclick=null,i(),null==r||r(),this.activeButton(p,KR),this.activeButton(h,qR),this.inactiveButton(f)})):this.addInfoToBanner(TU,"Failed to dump opus, please check if the current user has started the audio")});let m=t.querySelector("#dump-remote-video-hook-userid"),g=t.querySelector("#dump-remote-video-hook-duration"),_=t.querySelector("#dump-remote-video-hook-mediaType"),v=t.querySelector("#dump-remote-video-hook-button");v.onclick=()=>{let e=Number(g.value);if(e<1)return void this.addInfoToBanner(TU,"duration at least 1s");let t=m.value;if(!t)return void this.addInfoToBanner(TU,"please input user id");"*"===t&&this.inactiveButton(v);let i,r,n=_.value,a="remote_".concat(t,"_").concat("sub"===n?"auxiliary":n),o=a=>{if((a.userId===t||"*"===t)&&a.streamType===n){if(this.addInfoToBanner(wU,"[".concat(a.userId,"_").concat(n,"] starting to dump video, duration: ").concat(e,"s")),({download:i,onDumpEnd:r}=this.dumpVideo("sub"===a.streamType?"auxiliary":a.streamType,"remote",e,a.userId)),!i)return;setTimeout(()=>{null==i||i(),null==r||r(),"*"!==t&&this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,o)},1e3*e)}};this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,o),this.addInfoToBanner(wU,"[".concat(a,"] waiting to dump video from ").concat("*"===t?"all remote users":"user ".concat(t),", duration: ").concat(e,"s"))}}synchronizeLog(){this._core.loggerManager.getQueue().forEach(e=>{this.updateLog(e)})}isSupportDumpVideo(){return!(!this._core.rtcDectection.IS_INSERTABLE_STREAM_SUPPORTED&&!this._core.rtcDectection.IS_SCRIPT_TRANSFORM_SUPPORTED)||(this.addInfoToBanner(TU,"Current browser does not support dumping video"),!1)}_addEventListener(e,t,i,r){e&&(e.addEventListener(t,i,r),this.eventMap.set(e,{type:t,listener:i}))}_removeEventListener(){this.eventMap.forEach((e,t)=>{let{type:i,listener:r}=e;t&&t.removeEventListener(i,r)}),this.eventMap.clear(),this._switchNode&&(this._switchNode.onmousedown=null,this._switchNode.ontouchmove=null,this._switchNode.ontouchstart=null,this._switchNode.ontouchend=null)}closeDialog(){this.uninstallEvents(),this._removeEventListener(),this.removeVideoProcessor(),this.removeAudioProcessor(),this._dialogNode&&(document.body.removeChild(this._dialogNode),this._dialogNode=null)}updateLog(e){var t;this._logList.push(e);let i=document.createElement("div");switch(i.classList.add(cU),e.level){case 4:i.classList.add(hU);break;case 2:i.classList.add(dU);break;case 3:i.classList.add(uU);break;case 1:i.classList.add(lU)}i.textContent=e.log,"all"!==this._showLogType&&!i.classList.contains("".concat(cU,"_").concat(this._showLogType))&&(i.style.display="none"),null==(t=this._logContentNode)||t.appendChild(i),this.addHelper(i)}getDumpButtonClickHandler(e,t,i,r,n){if(!this.isSupportDumpVideo())return;let{download:a,onDumpEnd:o}=this.dumpVideo(r,n,i);if(a)return this.addInfoToBanner(wU,"[".concat(n,"_").concat(r,"] starting to dump...")),this.inactiveButton(e,YR),void(i>0?setTimeout(()=>{a(),this.activeButton(e,GR)},1e3*i):(this.activeButton(t),t.onclick=()=>{t.onclick=null,null==o||o(),a(),this.activeButton(e,GR),this.inactiveButton(t)}));this.addInfoToBanner(wU,"[".concat(n,"_").concat(r,"] waiting to dump..."));let s=a=>{let{track:o}=a;if(o.room===this._core.room&&o.streamType===r){this.addInfoToBanner(wU,"[".concat(n,"_").concat(r,"] starting to dump")),"local"===n&&this._core.innerEmitter.off("104",s);let{download:a,onDumpEnd:o}=this.dumpVideo(r,n,i);if(!a)return;i>0?setTimeout(()=>{a(),this.activeButton(e,GR)},1e3*i):(this.activeButton(t),t.onclick=()=>{t.onclick=null,null==o||o(),a(),this.activeButton(e,GR),this.inactiveButton(t)})}};s.bind(this),"local"===n&&this._core.innerEmitter.on("104",s),this.inactiveButton(e,YR)}onSwitchClick(){this._hasMove?this._hasMove=!1:this._showDialog?this.hideDialog():(this._isMobile&&(this._maskNode.style.display="block"),this._panelNode.style.display="block",this._switchNode.style.display="none",this._showDialog=!0,this.logContentGoBottom())}onTabClick(e){var t,i,r,n,a,o,s;let c=e.target;null==(t=this._tabNodes)||t.forEach(e=>{e.classList.remove(UM)}),c.classList.add(UM);let l=c.getAttribute("data-tab");"log"===l?(null==(n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(GM)))||n.classList.add(qM),this._logContentNode.style.display="block",this._networkContentNode.style.display="none",this._dumpContentNode.style.display="none",this.logContentGoBottom()):(null==(s=null==(o=null==(a=this._dialogNode)?void 0:a.shadowRoot)?void 0:o.querySelector(".".concat(GM)))||s.classList.remove(qM),"network"===l?(this._networkContentNode.style.display="block",this._logContentNode.style.display="none",this._dumpContentNode.style.display="none"):"dump"===l&&(this._dumpContentNode.style.display="block",this._networkContentNode.style.display="none",this._logContentNode.style.display="none"))}onToptabClick(e){var t,i;let r=e.target;null==(t=this._toptabNodes)||t.forEach(e=>{e.classList.remove(UM)}),r.classList.add(UM),this._showLogType=r.getAttribute("data-type");let n=null==(i=this._logContentNode)?void 0:i.querySelectorAll(".".concat(cU)),a="".concat(cU,"_").concat(this._showLogType);n.forEach(e=>{e.classList.contains(a)||"all"===this._showLogType?e.style.display="block":e.style.display="none"}),this.logContentGoBottom()}onExportClick(){let e=this._logList.reduce((e,t)=>"".concat(e+t.log,"\n"),""),t=new Blob([e],{type:"text/plain"}),i=document.createElement("a"),r=URL.createObjectURL(t);i.href=r;let n="trtc_".concat(void 0===this._core.room.sdkAppId?"EmptySdkAppId":this._core.room.sdkAppId,"_").concat(void 0===this._core.room.userId?"EmptyUserId":this._core.room.userId,"_").concat(this.formatStartDumpTime(+new Date),".log");i.download=n,i.style.display="none",document.body.appendChild(i),i.click(),URL.revokeObjectURL(r),document.body.removeChild(i),this.addInfoToBanner(wU,"Export success: The log file name is ".concat(n)),this._core.kvStatManager.addSuccessEvent({key:592703})}addInfoToBanner(e,t){var i,r;let n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(nU)),a=document.createElement("div");a.classList.add(aU);let o=e===wU?"🟩":e===IU?"🟧":"🟥";a.innerText="".concat(o," [").concat(this.getCurrentTime(),"] ").concat(t),n.appendChild(a),n.scrollTop=n.scrollHeight}async onUploadClick(){var e,t;if(this.isUploading)return;this.isUploading=!0;let i=null==(t=null==(e=this._dialogNode)?void 0:e.shadowRoot)?void 0:t.querySelector("#trtc_upload");i.innerText="Uploading...",null==i||i.classList.add(".disable");let r=this._logList.reduce((e,t)=>"".concat(e+t.log,"\n"),""),n=new Blob([r],{type:"text/plain"}),a=new FormData;a.append("file",n,"trtc.log"),a.append("sdkAppId","".concat(this._core.room.sdkAppId||"EmptySdkAppId")),a.append("userId","".concat(this._core.room.userId||"EmptyUserId")),fetch("https://service.trtc.qcloud.com/api/uploadLogFile",{method:"POST",body:a}).then(e=>e.json()).then(e=>{this.addInfoToBanner(e.type,e.message_en||"Upload Failed: Please use local export"),this.isUploading=!1,this._log.info(e.message_en),this._core.kvStatManager.addSuccessEvent({key:592704})}).catch(()=>{this.addInfoToBanner(TU,"Upload Failed: Please use local export"),this._log.info("Upload Failed: Please use local export"),this._core.kvStatManager.addFailedEvent({key:592704})}).finally(()=>{i.innerText=ZR,null==i||i.classList.remove(".disable"),this.isUploading=!1})}onHideClick(){this.hideDialog()}onMaskClick(){this.hideDialog()}hideDialog(){this._isMobile&&(this._maskNode.style.display="none"),this._panelNode.style.display="none",this._switchNode.style.display="block",this._showDialog=!1}onBackTopClick(){var e,t,i;null==(i=null==(t=null==(e=this._dialogNode)?void 0:e.shadowRoot)?void 0:t.querySelector(".".concat(GM)))||i.scrollTo(0,0)}onGoBottomClick(){this.logContentGoBottom()}onClearLogClick(){this._logList=[],this._logContentNode&&(this._logContentNode.innerHTML="")}logContentGoBottom(){var e,t;let i=null==(t=null==(e=this._dialogNode)?void 0:e.shadowRoot)?void 0:t.querySelector(".".concat(GM));null==i||i.scrollTo(0,null==i?void 0:i.scrollHeight)}onMouseDown(e){e.preventDefault(),this.switchPos.startX=e.pageX,this.switchPos.startY=e.pageY,document.onmousemove=this.onMouseMove.bind(this),document.onmouseup=this.onMouseUp.bind(this)}onMouseMove(e){e.cancelable&&e.preventDefault(),this._hasMove=!0;let t=this.switchPos.x-(e.pageX-this.switchPos.startX),i=this.switchPos.y-(e.pageY-this.switchPos.startY);[t,i]=this.getSafeAreaXY(t,i),this._switchNode.style.right="".concat(t,"px"),this._switchNode.style.bottom="".concat(i,"px"),this.switchPos.endX=t,this.switchPos.endY=i}onMouseUp(){this.switchPos.startX=0,this.switchPos.startY=0,this.switchPos.x=this.switchPos.endX,this.switchPos.y=this.switchPos.endY,document.onmousemove=null,document.onmouseup=null}onTouchStart(e){this.switchPos.startX=e.touches[0].pageX,this.switchPos.startY=e.touches[0].pageY,this.switchPos.isTouchEnd=!1}onTouchEnd(){this.switchPos.isTouchEnd&&(this.switchPos.startX=0,this.switchPos.startY=0,this.switchPos.isTouchEnd=!1,this.switchPos.x=this.switchPos.endX,this.switchPos.y=this.switchPos.endY)}onTouchMove(e){if(e.touches.length<=0)return;let t=e.touches[0].pageX-this.switchPos.startX,i=e.touches[0].pageY-this.switchPos.startY,r=Math.floor(this.switchPos.x-t),n=Math.floor(this.switchPos.y-i);[r,n]=this.getSafeAreaXY(r,n),this._switchNode.style.right="".concat(r,"px"),this._switchNode.style.bottom="".concat(n,"px"),this.switchPos.endX=r,this.switchPos.endY=n,this.switchPos.isTouchEnd=!0,e.cancelable&&e.preventDefault()}getSafeAreaXY(e,t){let i=Math.max(document.documentElement.offsetWidth,window.innerWidth),r=Math.max(document.documentElement.offsetHeight,window.innerHeight);return e+this._switchNode.offsetWidth>i&&(e=i-this._switchNode.offsetWidth),t+this._switchNode.offsetHeight>r&&(t=r-this._switchNode.offsetHeight),e<0&&(e=0),t<20&&(t=20),[e,t]}hitTest(e){return e===this._core.room}installEvents(){this._core.innerEmitter.on("264",this.handleLog,this),this._core.innerEmitter.on("53",this.handleLeaveSuccess,this),this._core.innerEmitter.on("27",this.handleJoinSuccess,this),this._core.trtc.on(this._core.TRTC.EVENT.STATISTICS,this.handleStatistics,this),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_AUDIO_AVAILABLE,this.handleRemoteAudioAvailable),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_AUDIO_UNAVAILABLE,this.handleRemoteAudioUnavailable),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,this.handleRemoteVideoAvailable),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_VIDEO_UNAVAILABLE,this.handleRemoteVideoUnavailable),this._core.room.on("dump",this.handleDumpFromScriptTransform,this)}uninstallEvents(){this._core.innerEmitter.off("264",this.handleLog,this),this._core.innerEmitter.off("53",this.handleLeaveSuccess,this),this._core.innerEmitter.off("27",this.handleJoinSuccess,this),this._core.trtc.off(this._core.TRTC.EVENT.STATISTICS,this.handleStatistics,this),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_AUDIO_AVAILABLE,this.handleRemoteAudioAvailable),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_AUDIO_UNAVAILABLE,this.handleRemoteAudioUnavailable),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,this.handleRemoteVideoAvailable),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_VIDEO_UNAVAILABLE,this.handleRemoteVideoUnavailable),this._core.room.off("dump",this.handleDumpFromScriptTransform,this)}handleDumpFromScriptTransform(e){if(e.isAudio){let t=e.userId?this.dumpRemoteAudioMap[e.userId]:this.dumpLocalAudioMap.main;return void(t&&(t.data.push(e.data),t.duration>0&&Date.now()-t.startTimestamp>1e3*t.duration&&t.onDumpEnd()))}if(e.userId){let t=this.dumpRemoteVideoMap["".concat(e.userId,"-").concat(e.streamType)];t&&(t.data.push(e.data),t.duration>0&&Date.now()-t.startTimestamp>1e3*t.duration&&t.onDumpEnd())}else{let t="main"===e.streamType?"main":"sub",i=this.dumpLocalVideoMap[t];i&&(i.data.push(e.data),i.duration>0&&Date.now()-i.startTimestamp>1e3*i.duration&&i.onDumpEnd())}}inactiveButton(e,t){e.disabled=!0,t&&(e.innerText=t)}activeButton(e,t){e.disabled=!1,t&&(e.innerText=t)}handleLog(e){this.updateLog(e.log)}addHelper(e){let t=/((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/g,i=hk,r=e.innerText;r=r.split("\n").map(e=>{if((e=e.replace(/</g,"&lt;").replace(/>/g,"&gt;")).includes("failed"))return e.includes("on autoplay-failed")?e:"<span class='red' style=\"background:red; color:#fff;\">".concat(e,"</span>");if(e.includes("clientIp:")){let i=e.match(t);return null==i||i.forEach(t=>{e=e.replace(t,'<a href="javascript:void(0);" target=""><span class=\'ip\' style="background:#e1dfdf">'.concat(t,"</span></a>"))}),e}return e.includes("URL of current page")&&(e=e.replace(/URL of current page: (.+)/,'URL of current page: <a href="$1">$1</a>')),e}).join("\n"),i.forEach(t=>{if(e.innerText.includes(t)){let i="";i="function"==typeof dk[t].tips?dk[t].tips(e.innerText):dk[t].tips,r=r.replace(new RegExp("".concat((e=>e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d").replace(">","&gt;").replace(">","&lt;"))(t)),"gi"),'<span class="'.concat(vU,'" style="background:').concat(dk[t].color||"#e1dfdf","; color: ").concat(dk[t].textColor||"#000",'">').concat(t,'\n <span class="tooltiptext tooltip-top">').concat(i,"</span>\n </span>"))}}),e.innerHTML=r}getCurrentTime(){let e=new Date,t=this.pad(e.getHours()),i=this.pad(e.getMinutes()),r=this.pad(e.getSeconds());return"".concat(t,":").concat(i,":").concat(r)}dumpAudioFromPipeline(e,t,i){this.addInfoToBanner(IU,"dump audio from pipeline");let r=Date.now(),n=this.formatStartDumpTime(r),a=[],o="".concat(e,"_").concat(i);if("local"===e)this._core.trtc._localAudioTrack;else if(i){let e=this._core.room.remotePublishedUserMap.get(i);e&&e.remoteAudioTrack}let s;if("local"===e){if(!this.hasLocalTrack("main","audio"))return{};s=()=>{delete this.dumpLocalAudioMap.main},this.dumpLocalAudioMap.main={startTimestamp:r,data:a,duration:t,onDumpEnd:s}}if("remote"===e&&i){if(s=()=>{delete this.dumpRemoteAudioMap["".concat(i)]},this.dumpRemoteAudioMap["".concat(i)])return this.addInfoToBanner(IU,"[".concat(o,"] dump already exists.")),{};this.dumpRemoteAudioMap["".concat(i)]={startTimestamp:r,data:a,duration:t,onDumpEnd:s}}return{download:()=>{var t,r;if(0===a.length)return void this.addInfoToBanner(TU,"[".concat(o,"] dump failed. Reason: data is empty"));let s,c=("local"===e?null==(t=this._core.room.singlePC)?void 0:t.audioCodec:null==(r=this._core.room.userManager)?void 0:r.getPublishedUser(i).audioCodec)||"opus",l=c;"opus"===c?(this.addInfoToBanner(IU,"[".concat(o,"] package opus to ogg")),s=this.convertOpusToOgg(a),l="ogg"):s=new Blob(a);let d=URL.createObjectURL(s),u=document.createElement("a"),h="local"===e?"local_".concat(n,".").concat(l):"remote-".concat(i,"_").concat(n,".").concat(l);u.href=d,u.download=h,u.style.display="none",document.body.appendChild(u),u.click(),URL.revokeObjectURL(d),u.remove(),this.addInfoToBanner(wU,"[".concat(o,"] dump success. File name is: ").concat(h))},onDumpEnd:s}}dumpVideo(e,t,i,r){let n,a=Date.now(),o=this.formatStartDumpTime(a),s=[],c="".concat(t,"_").concat(r,"_").concat(e);if("local"===t)n="main"===e?this._core.trtc._localVideoTrack:this._core.trtc._localScreenTrack;else if(r){let t=this._core.room.remotePublishedUserMap.get(r);t&&(n="main"===e?t.remoteVideoTrack:t.remoteAuxiliaryTrack)}let l;if("local"===t){if(!this.hasLocalTrack(e,"video"))return{};l=()=>{delete this.dumpLocalVideoMap["auxiliary"===e?"sub":"main"]},this.dumpLocalVideoMap["auxiliary"===e?"sub":"main"]={startTimestamp:a,data:s,duration:i,onDumpEnd:l}}if("remote"===t&&r){if(l=()=>{delete this.dumpRemoteVideoMap["".concat(r,"-").concat(e)]},this.dumpRemoteVideoMap["".concat(r,"-").concat(e)])return this.addInfoToBanner(IU,"[".concat(c,"] dump already exists.")),{};this.dumpRemoteVideoMap["".concat(r,"-").concat(e)]={startTimestamp:a,data:s,duration:i,onDumpEnd:l}}return{download:()=>{var i,a;if(0===s.length)return void this.addInfoToBanner(TU,"[".concat(c,"] dump failed. Reason: data is empty"));let l,d;"main"===e?l="video":"auxiliary"===e&&(l="screen"),"vp8"===this.getVideoCodec(r||"")?(this.addInfoToBanner(IU,"[".concat(c,"] package vp8 into ivf format")),d=this.convertVP8ToIVF(s,n)):d=new Blob(s);let u=URL.createObjectURL(d),h=document.createElement("a"),p="local"===t?"local_".concat(l,"_").concat(o,".").concat((null==(i=this._core.room.singlePC)?void 0:i.videoCodec)||"h264"):"remote-".concat(r,"_").concat(l,"_").concat(o,".").concat((null==(a=this._core.room.userManager)?void 0:a.getPublishedUser(r).videoCodec)||"h264");h.href=u,h.download=p,h.style.display="none",document.body.appendChild(h),h.click(),URL.revokeObjectURL(u),h.remove(),this.addInfoToBanner(wU,"[".concat(c,"] dump success. File name is: ").concat(p))},onDumpEnd:l}}convertVP8ToIVF(e,t){var i,r,n;function a(e,t,i){for(let r=0;r<i.length;r++)e.setUint8(t+r,i.charCodeAt(r))}let o=e.reduce((e,t)=>e+12+t.byteLength,32),s=new ArrayBuffer(o),c=new DataView(s),l=new Uint8Array(s),d=0;a(c,d,"DKIF"),d+=4,c.setUint16(d,0,!0),d+=2,c.setUint16(d,32,!0),d+=2,a(c,d,"VP80"),d+=4,c.setUint16(d,(null==(i=null==t?void 0:t._inputTrack)?void 0:i.getSettings().width)||0,!0),d+=2,c.setUint16(d,(null==(r=null==t?void 0:t._inputTrack)?void 0:r.getSettings().height)||0,!0),d+=2;let u=(t instanceof NM?null==t?void 0:t.decodeFPS:null==(n=null==t?void 0:t.mediaTrack)?void 0:n.getSettings().frameRate)||15;return c.setUint32(d,u,!0),d+=4,c.setUint32(d,1,!0),d+=4,c.setUint32(d,e.length,!0),d+=4,c.setUint32(d,0,!0),d+=4,e.forEach((e,t)=>{let i=e.byteLength,r=Math.floor(1e6*t/u);c.setUint32(d,i,!0),d+=4,c.setFloat64(d,r,!0),d+=8,l.set(new Uint8Array(e),d),d+=i}),new Blob([s],{type:"application/octet-stream"})}getVideoCodec(e){var t,i;return""===e?null==(t=this._core.room.singlePC)?void 0:t.videoCodec:null==(i=this._core.room.remotePublishedUserMap.get(e))?void 0:i.videoCodec}hasLocalTrack(e,t){for(let i of this._core.room.localTracks)if(i.streamType===e&&i.kind===t)return!0;return!1}dumpAudio(e,t,i){var r,n,a;let o,s,c=null,l=[],d=[],u=[],h=[],p=[],f=[],m=[],g=new AbortController,_=Date.now(),v=this.formatStartDumpTime(_),y=this._core.room.audioManager._localAudioPipline,E=this._core.room.audioManager._localScreenAudioPipeline,b=e=>{let{room:t,data:i,type:r}=e;if(this.hitTest(t)){if("dump"===r){if(h[0]=h[0]?h[0].concat(i.captureInput):i.captureInput,h[1]=h[1]?h[1].concat(i.playInput):i.playInput,o){let e=i.startTime-o,t=i.endTime-i.startTime;if(e>30||t>30){let r=function(e){if("number"!=typeof e||e<0)return"0毫秒";let t=[],i=Math.floor(e/6e4),r=e%6e4;i>0&&t.push("".concat(i,"分"));let n=Math.floor(r/1e3);return r%=1e3,(n>0||t.length)&&t.push("".concat(n,"秒")),(r>0||!t.length)&&t.push("".concat(r,"毫秒")),t.join("")},n=i.startTime-s,a=o-s;m.push("".concat(i.startTime,"\t").concat(r(n),"~").concat(r(a),"\t").concat(e,"\t").concat(t))}o=i.startTime}else o=i.startTime,s=i.startTime;f.push(i.startTime)}"dump-screen-audio"===r&&(p[0]=p[0]?p[0].concat(i.captureInput):i.captureInput,p[1]=p[1]?p[1].concat(i.playInput):i.playInput)}};if("local"===e){let{sampleRate:e}=this._core.room.audioManager.audioContext;if(!this._core.room.audioManager.hasAudioTrack&&!this._core.room.audioManager.hasScreenAudioTrack)return{};if(null!=y&&y.source.node&&(l.push(y.source.node),d.push("local_audio_raw_capture-".concat(e,"-").concat(y.source.node.channelCount))),(null!=(r=null==y?void 0:y.aec)&&r.node||null!=E&&E.aec.node)&&(this._core.trtc.updatePlugin("AudioProcessor",{enableDump:!0}),this._core.innerEmitter.on("265",b),null!=(n=null==y?void 0:y.aec)&&n.node&&(l.push(y.aec.node),d.push("local_audio_audioProcessor_processed-".concat(e,"-").concat(y.aec.node.channelCount))),null!=E&&E.aec.node&&(l.push(E.aec.node),d.push("screen_audio_audioProcessor_processed-".concat(e,"-").concat(E.aec.node.channelCount)))),null!=y&&y.denoiser.node&&(l.push(y.denoiser.node),d.push("local_audio_denoiser_processed-".concat(e,"-").concat(y.denoiser.node.channelCount))),this._core.room.audioManager.mixWeight>1&&null!=y&&y.stream){let t=this._core.room.audioManager.audioContext.createMediaStreamSource(y.stream);t.channelCount=1,l.push(t),d.push("local_audio_destination-".concat(e,"-").concat(t.channelCount))}}else if("remote"===e&&void 0!==i){let e=null==(a=this._core.room.remotePublishedUserMap.get(i))?void 0:a.remoteAudioTrack;if(null==e||!e.mediaTrack)return{};let t=this._core.createAudioNode(e.mediaTrack);l.push(t),d.push("remote_".concat(i))}let w=async()=>{var t,i,r,n,a;let o=new pk.default;for(let e=0;e<d.length;e++)o.file("".concat(d[e],".pcm"),new Blob(u[e]));if(null!=(t=null==h?void 0:h[0])&&t.length&&o.file("audioProcessor_input_capture.pcm",new Blob(h[0])),null!=(i=null==h?void 0:h[1])&&i.length&&o.file("audioProcessor_input_playback.pcm",new Blob(h[1])),null!=(r=null==p?void 0:p[0])&&r.length&&o.file("audioProcessor_screen_audio_input_capture.pcm",new Blob(p[0])),null!=(n=null==p?void 0:p[1])&&n.length&&o.file("audioProcessor_screen_audio_input_playback.pcm",new Blob(p[1])),null!=f&&f.length){let e=f.reduce((e,t)=>"".concat(e,"\n").concat(t));o.file("audioProcessor_handle_timestamp.txt",new Blob([e]))}if(null!=m&&m.length){let e=m.reduce((e,t)=>"".concat(e,"\n").concat(t));o.file("audioProcessor_big_gap_data.txt",new Blob([e]))}let s=await o.generateAsync({type:"blob"}),l=URL.createObjectURL(s),_=document.createElement("a");_.href=l,_.download="".concat(e,"-audio-").concat(v,".zip"),_.style.display="none",document.body.appendChild(_),_.click(),URL.revokeObjectURL(l),_.remove(),this.addInfoToBanner(wU,"Dump success, file name is: ".concat(e,"-").concat(v,".zip")),this._core.innerEmitter.off("265",b),(null!=(a=null==y?void 0:y.aec)&&a.node||null!=E&&E.aec.node)&&this._core.trtc.updatePlugin("AudioProcessor",{enableDump:!1}),c&&clearTimeout(c),g.abort("download")};return t>0&&(c=Number(setTimeout(()=>{g.abort("timeout")},1e3*t))),l.length>0&&this._core.startGetPCM(l).then(e=>e.pipeTo(new WritableStream({write(e){e.forEach((e,t)=>{u[t]=u[t]?u[t].concat(e[0]):[e[0]]})}}),g).catch(()=>w)),{download:w,onDumpEnd:()=>{g.abort("timeout")}}}formatStartDumpTime(e){let t=new Date(e),i=t.getFullYear(),r=this.pad(t.getMonth()+1),n=this.pad(t.getDate()),a=this.pad(t.getHours()),o=this.pad(t.getMinutes()),s=this.pad(t.getSeconds()),c=-t.getTimezoneOffset(),l=Math.floor(Math.abs(c)/60),d=Math.abs(c)%60,u=c>=0?"+":"-";return"".concat(i,"-").concat(r,"-").concat(n,"T").concat(a,"-").concat(o,"-").concat(s).concat(u).concat(this.pad(l),"-").concat(this.pad(d))}convertOpusToOgg(e){let t=Math.floor(4294967295*Math.random()),i=0,r=0,n=[],a=this.createOpusHead(48e3,2);n.push(this.createOggPage(2,0,t,i++,[a]));let o=this.createOpusTags();n.push(this.createOggPage(0,0,t,i++,[o]));let s=[],c=0;return e.forEach((a,o)=>{let l=this.getOpusPacketDuration(a);s.push(a),c+=a.byteLength,r+=l;let d=o===e.length-1;if(c>6e4||s.length>=50||d){let e=d?4:0;n.push(this.createOggPage(e,r,t,i++,s)),s=[],c=0}}),new Blob(n,{type:"audio/ogg"})}createOpusHead(e,t){let i=new ArrayBuffer(19),r=new DataView(i);return this.writeString(r,0,"OpusHead"),r.setUint8(8,1),r.setUint8(9,t),r.setUint16(10,0,!0),r.setUint32(12,e,!0),r.setUint16(16,0,!0),r.setUint8(18,0),i}createOpusTags(){let e="TRTC Debugger",t=new ArrayBuffer(29),i=new DataView(t);return this.writeString(i,0,"OpusTags"),i.setUint32(8,13,!0),this.writeString(i,12,e),i.setUint32(25,0,!0),t}createOggPage(e,t,i,r,n){let a=0;n.forEach(e=>{let t=e.byteLength;for(;t>=255;)a++,t-=255;a++});let o=27+a,s=n.reduce((e,t)=>e+t.byteLength,0),c=new ArrayBuffer(o+s),l=new DataView(c),d=new Uint8Array(c);this.writeString(l,0,"OggS"),l.setUint8(4,0),l.setUint8(5,e),l.setUint32(6,4294967295&t,!0),l.setUint32(10,Math.floor(t/4294967295),!0),l.setUint32(14,i,!0),l.setUint32(18,r,!0),l.setUint32(22,0,!0),l.setUint8(26,a);let u=27;n.forEach(e=>{let t=e.byteLength;for(;t>=255;)d[u++]=255,t-=255;d[u++]=t});let h=o;n.forEach(e=>{d.set(new Uint8Array(e),h),h+=e.byteLength});let p=this.crc32(d);return l.setUint32(22,p,!0),d}writeString(e,t,i){for(let r=0;r<i.length;r++)e.setUint8(t+r,i.charCodeAt(r))}getOpusPacketDuration(e){if(0===e.byteLength)return 0;let t=new Uint8Array(e),i=t[0],r=i>>3&31,n=3&i,a=1;if(1===n||2===n)a=2;else if(3===n){if(e.byteLength<2)return 0;a=63&t[1]}return([480,480,480,480,960,960,960,960,1920,1920,1920,1920,2880,2880,480,480,120,120,120,120,240,240,240,240,480,480,480,480,960,960,960,960][r]||960)*a}crc32(e){let t=new Uint32Array(256);for(let r=0;r<256;r++){let e=r<<24;for(let t=0;t<8;t++)2147483648&e?e=e<<1^79764919:e<<=1;t[r]=e>>>0}let i=0;for(let r=0;r<e.length;r++){i=(i<<8^t[255&(i>>>24^e[r])])>>>0}return i}addVideoProcessor(){let e=this._core.rtcDectection.IS_INSERTABLE_STREAM_SUPPORTED&&!this._core.rtcDectection.IS_SCRIPT_TRANSFORM_SUPPORTED;this._core.room.videoManager.addEncodeProcessor({processor:e?this.encodeVideo.bind(this):BR,type:1}),this._core.room.videoManager.addDecodeProcessor({processor:e?this.decodeVideo.bind(this):VR,type:1})}removeVideoProcessor(){this._core.room.videoManager.removeEncodeProcessor({type:1}),this._core.room.videoManager.removeDecodeProcessor({type:1})}addAudioProcessor(){let e=this._core.rtcDectection.IS_INSERTABLE_STREAM_SUPPORTED&&!this._core.rtcDectection.IS_SCRIPT_TRANSFORM_SUPPORTED;this._core.room.audioManager.addEncodeProcessor({processor:e?this.encodeAudio.bind(this):HR,type:2}),this._core.room.audioManager.addDecodeProcessor({processor:e?this.decodeAudio.bind(this):jR,type:2})}removeAudioProcessor(){this._core.room.audioManager.removeEncodeProcessor({type:2}),this._core.room.audioManager.removeDecodeProcessor({type:2})}encodeVideo(e){let{frame:t,mediaType:i}=e;if(i){let e=2===i?"sub":"main",r=this.dumpLocalVideoMap[e];r&&(r.data.push(t.data.slice(0)),r.duration>0&&Date.now()-r.startTimestamp>1e3*r.duration&&r.onDumpEnd())}return t}decodeVideo(e){let{frame:t,track:i}=e;if(i){let e=this.dumpRemoteVideoMap["".concat(i.userId,"-").concat(i.streamType)];e&&(e.data.push(t.data.slice(0)),e.duration>0&&Date.now()-e.startTimestamp>1e3*e.duration&&e.onDumpEnd())}return t}encodeAudio(e){let{frame:t}=e,i=this.dumpLocalAudioMap.main;return i&&(i.data.push(t.data.slice(0)),i.duration>0&&Date.now()-i.startTimestamp>1e3*i.duration&&i.onDumpEnd()),t}decodeAudio(e){let{frame:t,track:i}=e;if(i){let e=this.dumpRemoteAudioMap[i.userId];e&&(e.data.push(t.data.slice(0)),e.duration>0&&Date.now()-e.startTimestamp>1e3*e.duration&&e.onDumpEnd())}return t}};
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).TRTCDebugDialog=t()}(this,function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=function(e){return e&&e.Math===Math&&e},i=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof e&&e)||t("object"==typeof e&&e)||function(){return this}()||Function("return this")(),r={},n=function(e){try{return!!e()}catch(t){return!0}},a=!n(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}),o=!n(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}),s=o,c=Function.prototype.call,l=s?c.bind(c):function(){return c.apply(c,arguments)},d={},u={}.propertyIsEnumerable,h=Object.getOwnPropertyDescriptor,p=h&&!u.call({1:2},1);d.f=p?function(e){var t=h(this,e);return!!t&&t.enumerable}:u;var f,m,g=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},_=o,v=Function.prototype,y=v.call,E=_&&v.bind.bind(y,y),b=_?E:function(e){return function(){return y.apply(e,arguments)}},w=b,I=w({}.toString),T=w("".slice),S=function(e){return T(I(e),8,-1)},A=n,R=S,k=Object,C=b("".split),D=A(function(){return!k("z").propertyIsEnumerable(0)})?function(e){return"String"===R(e)?C(e,""):k(e)}:k,O=function(e){return null==e},L=O,N=TypeError,P=function(e){if(L(e))throw new N("Can't call method on "+e);return e},x=D,M=P,U=function(e){return x(M(e))},F="object"==typeof document&&document.all,B=void 0===F&&void 0!==F?function(e){return"function"==typeof e||e===F}:function(e){return"function"==typeof e},V=B,H=function(e){return"object"==typeof e?null!==e:V(e)},j=i,z=B,W=function(e,t){return arguments.length<2?(i=j[e],z(i)?i:void 0):j[e]&&j[e][t];var i},G=b({}.isPrototypeOf),q=i.navigator,K=q&&q.userAgent,Y=K?String(K):"",X=i,Z=Y,J=X.process,Q=X.Deno,$=J&&J.versions||Q&&Q.version,ee=$&&$.v8;ee&&(m=(f=ee.split("."))[0]>0&&f[0]<4?1:+(f[0]+f[1])),!m&&Z&&(!(f=Z.match(/Edge\/(\d+)/))||f[1]>=74)&&(f=Z.match(/Chrome\/(\d+)/))&&(m=+f[1]);var te=m,ie=te,re=n,ne=i.String,ae=!!Object.getOwnPropertySymbols&&!re(function(){var e=Symbol("symbol detection");return!ne(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ie&&ie<41}),oe=ae&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,se=W,ce=B,le=G,de=Object,ue=oe?function(e){return"symbol"==typeof e}:function(e){var t=se("Symbol");return ce(t)&&le(t.prototype,de(e))},he=String,pe=function(e){try{return he(e)}catch(t){return"Object"}},fe=B,me=pe,ge=TypeError,_e=function(e){if(fe(e))return e;throw new ge(me(e)+" is not a function")},ve=_e,ye=O,Ee=function(e,t){var i=e[t];return ye(i)?void 0:ve(i)},be=l,we=B,Ie=H,Te=TypeError,Se={exports:{}},Ae=i,Re=Object.defineProperty,ke=function(e,t){try{Re(Ae,e,{value:t,configurable:!0,writable:!0})}catch(i){Ae[e]=t}return t},Ce=i,De=ke,Oe="__core-js_shared__",Le=Se.exports=Ce[Oe]||De(Oe,{});(Le.versions||(Le.versions=[])).push({version:"3.49.0",mode:"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Ne=Se.exports,Pe=Ne,xe=function(e,t){return Pe[e]||(Pe[e]=t||{})},Me=P,Ue=Object,Fe=function(e){return Ue(Me(e))},Be=Fe,Ve=b({}.hasOwnProperty),He=Object.hasOwn||function(e,t){return Ve(Be(e),t)},je=b,ze=0,We=Math.random(),Ge=je(1.1.toString),qe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ge(++ze+We,36)},Ke=xe,Ye=He,Xe=qe,Ze=ae,Je=oe,Qe=i.Symbol,$e=Ke("wks"),et=Je?Qe.for||Qe:Qe&&Qe.withoutSetter||Xe,tt=function(e){return Ye($e,e)||($e[e]=Ze&&Ye(Qe,e)?Qe[e]:et("Symbol."+e)),$e[e]},it=l,rt=H,nt=ue,at=Ee,ot=function(e,t){var i,r;if("string"===t&&we(i=e.toString)&&!Ie(r=be(i,e)))return r;if(we(i=e.valueOf)&&!Ie(r=be(i,e)))return r;if("string"!==t&&we(i=e.toString)&&!Ie(r=be(i,e)))return r;throw new Te("Can't convert object to primitive value")},st=TypeError,ct=tt("toPrimitive"),lt=function(e,t){if(!rt(e)||nt(e))return e;var i,r=at(e,ct);if(r){if(void 0===t&&(t="default"),i=it(r,e,t),!rt(i)||nt(i))return i;throw new st("Can't convert object to primitive value")}return void 0===t&&(t="number"),ot(e,t)},dt=lt,ut=ue,ht=function(e){var t=dt(e,"string");return ut(t)?t:t+""},pt=H,ft=i.document,mt=pt(ft)&&pt(ft.createElement),gt=function(e){return mt?ft.createElement(e):{}},_t=gt,vt=!a&&!n(function(){return 7!==Object.defineProperty(_t("div"),"a",{get:function(){return 7}}).a}),yt=a,Et=l,bt=d,wt=g,It=U,Tt=ht,St=He,At=vt,Rt=Object.getOwnPropertyDescriptor;r.f=yt?Rt:function(e,t){if(e=It(e),t=Tt(t),At)try{return Rt(e,t)}catch(i){}if(St(e,t))return wt(!Et(bt.f,e,t),e[t])};var kt={},Ct=a&&n(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype}),Dt=H,Ot=String,Lt=TypeError,Nt=function(e){if(Dt(e))return e;throw new Lt(Ot(e)+" is not an object")},Pt=a,xt=vt,Mt=Ct,Ut=Nt,Ft=ht,Bt=TypeError,Vt=Object.defineProperty,Ht=Object.getOwnPropertyDescriptor,jt="enumerable",zt="configurable",Wt="writable";kt.f=Pt?Mt?function(e,t,i){if(Ut(e),t=Ft(t),Ut(i),"function"==typeof e&&"prototype"===t&&"value"in i&&Wt in i&&!i[Wt]){var r=Ht(e,t);r&&r[Wt]&&(e[t]=i.value,i={configurable:zt in i?i[zt]:r[zt],enumerable:jt in i?i[jt]:r[jt],writable:!1})}return Vt(e,t,i)}:Vt:function(e,t,i){if(Ut(e),t=Ft(t),Ut(i),xt)try{return Vt(e,t,i)}catch(r){}if("get"in i||"set"in i)throw new Bt("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var Gt=kt,qt=g,Kt=a?function(e,t,i){return Gt.f(e,t,qt(1,i))}:function(e,t,i){return e[t]=i,e},Yt={exports:{}},Xt=a,Zt=He,Jt=Function.prototype,Qt=Xt&&Object.getOwnPropertyDescriptor,$t=Zt(Jt,"name"),ei={EXISTS:$t,PROPER:$t&&"something"===function(){}.name,CONFIGURABLE:$t&&(!Xt||Xt&&Qt(Jt,"name").configurable)},ti=B,ii=Ne,ri=b(Function.toString);ti(ii.inspectSource)||(ii.inspectSource=function(e){return ri(e)});var ni,ai,oi,si=ii.inspectSource,ci=B,li=i.WeakMap,di=ci(li)&&/native code/.test(String(li)),ui=qe,hi=xe("keys"),pi=function(e){return hi[e]||(hi[e]=ui(e))},fi={},mi=di,gi=i,_i=H,vi=Kt,yi=He,Ei=Ne,bi=pi,wi=fi,Ii="Object already initialized",Ti=gi.TypeError,Si=gi.WeakMap;if(mi||Ei.state){var Ai=Ei.state||(Ei.state=new Si);Ai.get=Ai.get,Ai.has=Ai.has,Ai.set=Ai.set,ni=function(e,t){if(Ai.has(e))throw new Ti(Ii);return t.facade=e,Ai.set(e,t),t},ai=function(e){return Ai.get(e)||{}},oi=function(e){return Ai.has(e)}}else{var Ri=bi("state");wi[Ri]=!0,ni=function(e,t){if(yi(e,Ri))throw new Ti(Ii);return t.facade=e,vi(e,Ri,t),t},ai=function(e){return yi(e,Ri)?e[Ri]:{}},oi=function(e){return yi(e,Ri)}}var ki={set:ni,get:ai,has:oi,enforce:function(e){return oi(e)?ai(e):ni(e,{})},getterFor:function(e){return function(t){var i;if(!_i(t)||(i=ai(t)).type!==e)throw new Ti("Incompatible receiver, "+e+" required");return i}}},Ci=b,Di=n,Oi=B,Li=He,Ni=a,Pi=ei.CONFIGURABLE,xi=si,Mi=ki.enforce,Ui=ki.get,Fi=String,Bi=Object.defineProperty,Vi=Ci("".slice),Hi=Ci("".replace),ji=Ci([].join),zi=Ni&&!Di(function(){return 8!==Bi(function(){},"length",{value:8}).length}),Wi=String(String).split("String"),Gi=Yt.exports=function(e,t,i){"Symbol("===Vi(Fi(t),0,7)&&(t="["+Hi(Fi(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(t="get "+t),i&&i.setter&&(t="set "+t),(!Li(e,"name")||Pi&&e.name!==t)&&(Ni?Bi(e,"name",{value:t,configurable:!0}):e.name=t),zi&&i&&Li(i,"arity")&&e.length!==i.arity&&Bi(e,"length",{value:i.arity});try{i&&Li(i,"constructor")&&i.constructor?Ni&&Bi(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(n){}var r=Mi(e);return Li(r,"source")||(r.source=ji(Wi,"string"==typeof t?t:"")),e};Function.prototype.toString=Gi(function(){return Oi(this)&&Ui(this).source||xi(this)},"toString");var qi=Yt.exports,Ki=B,Yi=kt,Xi=qi,Zi=ke,Ji=function(e,t,i,r){r||(r={});var n=r.enumerable,a=void 0!==r.name?r.name:t;if(Ki(i)&&Xi(i,a,r),r.global)n?e[t]=i:Zi(t,i);else{try{r.unsafe?e[t]&&(n=!0):delete e[t]}catch(o){}n?e[t]=i:Yi.f(e,t,{value:i,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return e},Qi={},$i=Math.ceil,er=Math.floor,tr=Math.trunc||function(e){var t=+e;return(t>0?er:$i)(t)},ir=function(e){var t=+e;return t!=t||0===t?0:tr(t)},rr=ir,nr=Math.max,ar=Math.min,or=function(e,t){var i=rr(e);return i<0?nr(i+t,0):ar(i,t)},sr=ir,cr=Math.min,lr=function(e){var t=sr(e);return t>0?cr(t,9007199254740991):0},dr=lr,ur=function(e){return dr(e.length)},hr=U,pr=or,fr=ur,mr=function(e){return function(t,i,r){var n=hr(t),a=fr(n);if(0===a)return!e&&-1;var o,s=pr(r,a);if(e&&i!=i){for(;a>s;)if((o=n[s++])!=o)return!0}else for(;a>s;s++)if((e||s in n)&&n[s]===i)return e||s||0;return!e&&-1}},gr={includes:mr(!0),indexOf:mr(!1)},_r=He,vr=U,yr=gr.indexOf,Er=fi,br=b([].push),wr=function(e,t){var i,r=vr(e),n=0,a=[];for(i in r)!_r(Er,i)&&_r(r,i)&&br(a,i);for(;t.length>n;)_r(r,i=t[n++])&&(~yr(a,i)||br(a,i));return a},Ir=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Tr=wr,Sr=Ir.concat("length","prototype");Qi.f=Object.getOwnPropertyNames||function(e){return Tr(e,Sr)};var Ar={};Ar.f=Object.getOwnPropertySymbols;var Rr=W,kr=Qi,Cr=Ar,Dr=Nt,Or=b([].concat),Lr=Rr("Reflect","ownKeys")||function(e){var t=kr.f(Dr(e)),i=Cr.f;return i?Or(t,i(e)):t},Nr=He,Pr=Lr,xr=r,Mr=kt,Ur=function(e,t,i){for(var r=Pr(t),n=Mr.f,a=xr.f,o=0;o<r.length;o++){var s=r[o];Nr(e,s)||i&&Nr(i,s)||n(e,s,a(t,s))}},Fr=n,Br=B,Vr=/#|\.prototype\./,Hr=function(e,t){var i=zr[jr(e)];return i===Gr||i!==Wr&&(Br(t)?Fr(t):!!t)},jr=Hr.normalize=function(e){return String(e).replace(Vr,".").toLowerCase()},zr=Hr.data={},Wr=Hr.NATIVE="N",Gr=Hr.POLYFILL="P",qr=Hr,Kr=i,Yr=r.f,Xr=Kt,Zr=Ji,Jr=ke,Qr=Ur,$r=qr,en=function(e,t){var i,r,n,a,o,s=e.target,c=e.global,l=e.stat;if(i=c?Kr:l?Kr[s]||Jr(s,{}):Kr[s]&&Kr[s].prototype)for(r in t){if(a=t[r],n=e.dontCallGetSet?(o=Yr(i,r))&&o.value:i[r],!$r(c?r:s+(l?".":"#")+r,e.forced)&&void 0!==n){if(typeof a==typeof n)continue;Qr(a,n)}(e.sham||n&&n.sham)&&Xr(a,"sham",!0),Zr(i,r,a,e)}},tn={};tn[tt("toStringTag")]="z";var rn="[object z]"===String(tn),nn=B,an=S,on=tt("toStringTag"),sn=Object,cn="Arguments"===an(function(){return arguments}()),ln=rn?an: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(i){}}(t=sn(e),on))?i:cn?an(t):"Object"===(r=an(t))&&nn(t.callee)?"Arguments":r},dn=ln,un=String,hn=function(e){if("Symbol"===dn(e))throw new TypeError("Cannot convert a Symbol value to a string");return un(e)},pn=qi,fn=kt,mn=function(e,t,i){return i.get&&pn(i.get,t,{getter:!0}),i.set&&pn(i.set,t,{setter:!0}),fn.f(e,t,i)},gn=en,_n=a,vn=l,yn=b,En=He,bn=B,wn=G,In=hn,Tn=mn,Sn=Ur,An=i.Symbol,Rn=An&&An.prototype;if(_n&&bn(An)&&(!("description"in Rn)||void 0!==An().description)){var kn={},Cn=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:In(arguments[0]),t=wn(Rn,this)?new An(e):void 0===e?An():An(e);return""===e&&(kn[t]=!0),t};Sn(Cn,An);var Dn=Cn.for;Cn.for={for:function(e){var t=In(e),i=vn(Dn,this,t);return""===t&&(kn[i]=!0),i}}.for,Cn.prototype=Rn,Rn.constructor=Cn;var On="Symbol(description detection)"===String(An("description detection")),Ln=yn(Rn.valueOf),Nn=yn(Rn.toString),Pn=/^Symbol\((.*)\)[^)]+$/,xn=yn("".replace),Mn=yn("".slice);Tn(Rn,"description",{configurable:!0,get:function(){var e=Ln(this);if(En(kn,e))return"";var t=Nn(e),i=On?Mn(t,7,-1):xn(t,Pn,"$1");return""===i?void 0:i}}),gn({global:!0,constructor:!0,forced:!0},{Symbol:Cn})}var Un={},Fn=wr,Bn=Ir,Vn=Object.keys||function(e){return Fn(e,Bn)},Hn=a,jn=Ct,zn=kt,Wn=Nt,Gn=U,qn=Vn;Un.f=Hn&&!jn?Object.defineProperties:function(e,t){Wn(e);for(var i,r=Gn(t),n=qn(t),a=n.length,o=0;a>o;)zn.f(e,i=n[o++],r[i]);return e};var Kn,Yn=W("document","documentElement"),Xn=Nt,Zn=Un,Jn=Ir,Qn=fi,$n=Yn,ea=gt,ta="prototype",ia="script",ra=pi("IE_PROTO"),na=function(){},aa=function(e){return"<"+ia+">"+e+"</"+ia+">"},oa=function(e){e.write(aa("")),e.close();var t=e.parentWindow.Object;return e=null,t},sa=function(){try{Kn=new ActiveXObject("htmlfile")}catch(n){}var e,t,i;sa="undefined"!=typeof document?document.domain&&Kn?oa(Kn):(t=ea("iframe"),i="java"+ia+":",t.style.display="none",$n.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(aa("document.F=Object")),e.close(),e.F):oa(Kn);for(var r=Jn.length;r--;)delete sa[ta][Jn[r]];return sa()};Qn[ra]=!0;var ca=Object.create||function(e,t){var i;return null!==e?(na[ta]=Xn(e),i=new na,na[ta]=null,i[ra]=e):i=sa(),void 0===t?i:Zn.f(i,t)},la=tt,da=ca,ua=kt.f,ha=la("unscopables"),pa=Array.prototype;void 0===pa[ha]&&ua(pa,ha,{configurable:!0,value:da(null)});var fa=function(e){pa[ha][e]=!0},ma=en,ga=gr.includes,_a=n,va=fa,ya=_a(function(){return!Array(1).includes()}),Ea=_a(function(){return[,1].includes(void 0,1)});ma({target:"Array",proto:!0,forced:ya||Ea},{includes:function(e){return ga(this,e,arguments.length>1?arguments[1]:void 0)}}),va("includes");var ba,wa,Ia,Ta={},Sa=!n(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Aa=He,Ra=B,ka=Fe,Ca=Sa,Da=pi("IE_PROTO"),Oa=Object,La=Oa.prototype,Na=Ca?Oa.getPrototypeOf:function(e){var t=ka(e);if(Aa(t,Da))return t[Da];var i=t.constructor;return Ra(i)&&t instanceof i?i.prototype:t instanceof Oa?La:null},Pa=n,xa=B,Ma=H,Ua=Na,Fa=Ji,Ba=tt("iterator"),Va=!1;[].keys&&("next"in(Ia=[].keys())?(wa=Ua(Ua(Ia)))!==Object.prototype&&(ba=wa):Va=!0);var Ha=!Ma(ba)||Pa(function(){var e={};return ba[Ba].call(e)!==e});Ha&&(ba={}),xa(ba[Ba])||Fa(ba,Ba,function(){return this});var ja={IteratorPrototype:ba,BUGGY_SAFARI_ITERATORS:Va},za=kt.f,Wa=He,Ga=tt("toStringTag"),qa=function(e,t,i){e&&!i&&(e=e.prototype),e&&!Wa(e,Ga)&&za(e,Ga,{configurable:!0,value:t})},Ka=ja.IteratorPrototype,Ya=ca,Xa=g,Za=qa,Ja=Ta,Qa=function(){return this},$a=function(e,t,i,r){var n=t+" Iterator";return e.prototype=Ya(Ka,{next:Xa(+!r,i)}),Za(e,n,!1),Ja[n]=Qa,e},eo=b,to=_e,io=H,ro=function(e){return io(e)||null===e},no=String,ao=TypeError,oo=function(e,t,i){try{return eo(to(Object.getOwnPropertyDescriptor(e,t)[i]))}catch(r){}},so=H,co=P,lo=function(e){if(ro(e))return e;throw new ao("Can't set "+no(e)+" as a prototype")},uo=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=oo(Object.prototype,"__proto__","set"))(i,[]),t=i instanceof Array}catch(r){}return function(i,r){return co(i),lo(r),so(i)?(t?e(i,r):i.__proto__=r,i):i}}():void 0),ho=en,po=l,fo=B,mo=$a,go=Na,_o=uo,vo=qa,yo=Kt,Eo=Ji,bo=Ta,wo=ei.PROPER,Io=ei.CONFIGURABLE,To=ja.IteratorPrototype,So=ja.BUGGY_SAFARI_ITERATORS,Ao=tt("iterator"),Ro="keys",ko="values",Co="entries",Do=function(){return this},Oo=function(e,t,i,r,n,a,o){mo(i,t,r);var s,c,l,d=function(e){if(e===n&&m)return m;if(!So&&e&&e in p)return p[e];switch(e){case Ro:case ko:case Co:return function(){return new i(this,e)}}return function(){return new i(this)}},u=t+" Iterator",h=!1,p=e.prototype,f=p[Ao]||p["@@iterator"]||n&&p[n],m=!So&&f||d(n),g="Array"===t&&p.entries||f;if(g&&(s=go(g.call(new e)))!==Object.prototype&&s.next&&(go(s)!==To&&(_o?_o(s,To):fo(s[Ao])||Eo(s,Ao,Do)),vo(s,u,!0)),wo&&n===ko&&f&&f.name!==ko&&(Io?yo(p,"name",ko):(h=!0,m=function(){return po(f,this)})),n)if(c={values:d(ko),keys:a?m:d(Ro),entries:d(Co)},o)for(l in c)(So||h||!(l in p))&&Eo(p,l,c[l]);else ho({target:t,proto:!0,forced:So||h},c);return p[Ao]!==m&&Eo(p,Ao,m,{name:n}),bo[t]=m,c},Lo=function(e,t){return{value:e,done:t}},No=U,Po=fa,xo=Ta,Mo=ki,Uo=kt.f,Fo=Oo,Bo=Lo,Vo=a,Ho="Array Iterator",jo=Mo.set,zo=Mo.getterFor(Ho),Wo=Fo(Array,"Array",function(e,t){jo(this,{type:Ho,target:No(e),index:0,kind:t})},function(){var e=zo(this),t=e.target,i=e.index++;if(!t||i>=t.length)return e.target=null,Bo(void 0,!0);switch(e.kind){case"keys":return Bo(i,!1);case"values":return Bo(t[i],!1)}return Bo([i,t[i]],!1)},"values"),Go=xo.Arguments=xo.Array;if(Po("keys"),Po("values"),Po("entries"),Vo&&"values"!==Go.name)try{Uo(Go,"name",{value:"values"})}catch(OU){}var qo=_e,Ko=Fe,Yo=D,Xo=ur,Zo=TypeError,Jo="Reduce of empty array with no initial value",Qo=function(e){return function(t,i,r,n){var a=Ko(t),o=Yo(a),s=Xo(a);if(qo(i),0===s&&r<2)throw new Zo(Jo);var c=e?s-1:0,l=e?-1:1;if(r<2)for(;;){if(c in o){n=o[c],c+=l;break}if(c+=l,e?c<0:s<=c)throw new Zo(Jo)}for(;e?c>=0:s>c;c+=l)c in o&&(n=i(n,o[c],c,a));return n}},$o={left:Qo(!1),right:Qo(!0)},es=n,ts=function(e,t){var i=[][e];return!!i&&es(function(){i.call(null,t||function(){return 1},1)})},is=i,rs=Y,ns=S,as=function(e){return rs.slice(0,e.length)===e},os=as("Bun/")?"BUN":as("Cloudflare-Workers")?"CLOUDFLARE":as("Deno/")?"DENO":as("Node.js/")?"NODE":is.Bun&&"string"==typeof Bun.version?"BUN":is.Deno&&"object"==typeof Deno.version?"DENO":"process"===ns(is.process)?"NODE":is.window&&is.document?"BROWSER":"REST",ss="NODE"===os,cs=$o.left;en({target:"Array",proto:!0,forced:!ss&&te>79&&te<83||!ts("reduce")},{reduce:function(e){var t=arguments.length;return cs(this,e,t,t>1?arguments[1]:void 0)}});var ls=S,ds=Array.isArray||function(e){return"Array"===ls(e)},us=en,hs=ds,ps=b([].reverse),fs=[1,2];us({target:"Array",proto:!0,forced:String(fs)===String(fs.reverse())},{reverse:function(){return hs(this)&&(this.length=this.length),ps(this)}});var ms="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,gs=Ji,_s=function(e,t,i){for(var r in t)gs(e,r,t[r],i);return e},vs=G,ys=TypeError,Es=function(e,t){if(vs(t,e))return e;throw new ys("Incorrect invocation")},bs=ir,ws=lr,Is=RangeError,Ts=function(e){if(void 0===e)return 0;var t=bs(e),i=ws(t);if(t!==i)throw new Is("Wrong length or index");return i},Ss=Math.sign||function(e){var t=+e;return 0===t||t!=t?t:t<0?-1:1},As=4503599627370496,Rs=Ss,ks=function(e){return e+As-As},Cs=Math.abs,Ds=function(e,t,i,r){var n=+e,a=Cs(n),o=Rs(n);if(a<r)return o*ks(a/r/t)*r*t;var s=(1+t/2220446049250313e-31)*a,c=s-(s-a);return c>i||c!=c?Infinity*o:o*c},Os=Math.fround||function(e){return Ds(e,1.1920928955078125e-7,34028234663852886e22,11754943508222875e-54)},Ls=Array,Ns=Math.abs,Ps=Math.pow,xs=Math.floor,Ms=Math.log,Us=Math.LN2,Fs={pack:function(e,t,i){var r,n,a,o=Ls(i),s=8*i-t-1,c=(1<<s)-1,l=c>>1,d=23===t?Ps(2,-24)-Ps(2,-77):0,u=e<0||0===e&&1/e<0?1:0,h=0;for((e=Ns(e))!=e||Infinity===e?(n=e!=e?1:0,r=c):(r=xs(Ms(e)/Us),e*(a=Ps(2,-r))<1&&(r--,a*=2),(e+=r+l>=1?d/a:d*Ps(2,1-l))*a>=2&&(r++,a/=2),r+l>=c?(n=0,r=c):r+l>=1?(n=(e*a-1)*Ps(2,t),r+=l):(n=e*Ps(2,l-1)*Ps(2,t),r=0));t>=8;)o[h++]=255&n,n/=256,t-=8;for(r=r<<t|n,s+=t;s>0;)o[h++]=255&r,r/=256,s-=8;return o[h-1]|=128*u,o},unpack:function(e,t){var i,r=e.length,n=8*r-t-1,a=(1<<n)-1,o=a>>1,s=n-7,c=r-1,l=e[c--],d=127&l;for(l>>=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-o;else{if(d===a)return i?NaN:l?-Infinity:Infinity;i+=Ps(2,t),d-=o}return(l?-1:1)*i*Ps(2,d-t)}},Bs=Fe,Vs=or,Hs=ur,js=function(e){for(var t=Bs(this),i=Hs(t),r=arguments.length,n=Vs(r>1?arguments[1]:void 0,i),a=r>2?arguments[2]:void 0,o=void 0===a?i:Vs(a,i);o>n;)t[n++]=e;return t},zs=b([].slice),Ws=B,Gs=H,qs=uo,Ks=function(e,t,i){var r,n;return qs&&Ws(r=t.constructor)&&r!==i&&Gs(n=r.prototype)&&n!==i.prototype&&qs(e,n),e},Ys=i,Xs=b,Zs=a,Js=ms,Qs=Kt,$s=mn,ec=_s,tc=n,ic=Es,rc=ir,nc=Ts,ac=Os,oc=Fs,sc=Na,cc=uo,lc=js,dc=zs,uc=Ks,hc=Ur,pc=qa,fc=ki,mc=ei.PROPER,gc=ei.CONFIGURABLE,_c="ArrayBuffer",vc="DataView",yc="prototype",Ec="Wrong index",bc=fc.getterFor(_c),wc=fc.getterFor(vc),Ic=fc.set,Tc=Ys[_c],Sc=Tc,Ac=Sc&&Sc[yc],Rc=Ys[vc],kc=Rc&&Rc[yc],Cc=Object.prototype,Dc=Ys.Array,Oc=Ys.RangeError,Lc=Xs(lc),Nc=Xs([].reverse),Pc=oc.pack,xc=oc.unpack,Mc=function(e){return[255&e]},Uc=function(e){return[255&e,e>>8&255]},Fc=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},Bc=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Vc=function(e){return Pc(ac(e),23,4)},Hc=function(e){return Pc(e,52,8)},jc=function(e,t,i){$s(e[yc],t,{configurable:!0,get:function(){return i(this)[t]}})},zc=function(e,t,i,r){var n=wc(e),a=nc(i),o=!!r;if(a+t>n.byteLength)throw new Oc(Ec);var s=n.bytes,c=a+n.byteOffset,l=dc(s,c,c+t);return o?l:Nc(l)},Wc=function(e,t,i,r,n,a){var o=wc(e),s=nc(i),c=r(+n),l=!!a;if(s+t>o.byteLength)throw new Oc(Ec);for(var d=o.bytes,u=s+o.byteOffset,h=0;h<t;h++)d[u+h]=c[l?h:t-h-1]};if(Js){var Gc=mc&&Tc.name!==_c;tc(function(){Tc(1)})&&tc(function(){new Tc(-1)})&&!tc(function(){return new Tc,new Tc(1.5),new Tc(NaN),1!==Tc.length||Gc&&!gc})?Gc&&gc&&Qs(Tc,"name",_c):((Sc=function(e){return ic(this,Ac),uc(new Tc(nc(e)),this,Sc)})[yc]=Ac,Ac.constructor=Sc,hc(Sc,Tc)),cc&&sc(kc)!==Cc&&cc(kc,Cc);var qc=new Rc(new Sc(2)),Kc=Xs(kc.setInt8);qc.setInt8(0,2147483648),qc.setInt8(1,2147483649),!qc.getInt8(0)&&qc.getInt8(1)||ec(kc,{setInt8:function(e,t){Kc(this,e,t<<24>>24)},setUint8:function(e,t){Kc(this,e,t<<24>>24)}},{unsafe:!0})}else Ac=(Sc=function(e){ic(this,Ac);var t=nc(e);Ic(this,{type:_c,bytes:Lc(Dc(t),0),byteLength:t}),Zs||(this.byteLength=t,this.detached=!1)})[yc],kc=(Rc=function(e,t,i){ic(this,kc),ic(e,Ac);var r=bc(e),n=r.byteLength,a=rc(t);if(a<0||a>n)throw new Oc("Wrong offset");if(a+(i=void 0===i?n-a:nc(i))>n)throw new Oc("Wrong length");Ic(this,{type:vc,buffer:e,byteLength:i,byteOffset:a,bytes:r.bytes}),Zs||(this.buffer=e,this.byteLength=i,this.byteOffset=a)})[yc],Zs&&(jc(Sc,"byteLength",bc),jc(Rc,"buffer",wc),jc(Rc,"byteLength",wc),jc(Rc,"byteOffset",wc)),ec(kc,{getInt8:function(e){return zc(this,1,e)[0]<<24>>24},getUint8:function(e){return zc(this,1,e)[0]},getInt16:function(e){var t=zc(this,2,e,arguments.length>1&&arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=zc(this,2,e,arguments.length>1&&arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return Bc(zc(this,4,e,arguments.length>1&&arguments[1]))},getUint32:function(e){return Bc(zc(this,4,e,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(e){return xc(zc(this,4,e,arguments.length>1&&arguments[1]),23)},getFloat64:function(e){return xc(zc(this,8,e,arguments.length>1&&arguments[1]),52)},setInt8:function(e,t){Wc(this,1,e,Mc,t)},setUint8:function(e,t){Wc(this,1,e,Mc,t)},setInt16:function(e,t){Wc(this,2,e,Uc,t,arguments.length>2&&arguments[2])},setUint16:function(e,t){Wc(this,2,e,Uc,t,arguments.length>2&&arguments[2])},setInt32:function(e,t){Wc(this,4,e,Fc,t,arguments.length>2&&arguments[2])},setUint32:function(e,t){Wc(this,4,e,Fc,t,arguments.length>2&&arguments[2])},setFloat32:function(e,t){Wc(this,4,e,Vc,t,arguments.length>2&&arguments[2])},setFloat64:function(e,t){Wc(this,8,e,Hc,t,arguments.length>2&&arguments[2])}});pc(Sc,_c),pc(Rc,vc);var Yc={ArrayBuffer:Sc,DataView:Rc},Xc=W,Zc=mn,Jc=a,Qc=tt("species"),$c=function(e){var t=Xc(e);Jc&&t&&!t[Qc]&&Zc(t,Qc,{configurable:!0,get:function(){return this}})},el=$c,tl="ArrayBuffer",il=Yc[tl];en({global:!0,constructor:!0,forced:i[tl]!==il},{ArrayBuffer:il}),el(tl);var rl=S,nl=b,al=function(e){if("Function"===rl(e))return nl(e)},ol=en,sl=al,cl=n,ll=Nt,dl=or,ul=lr,hl=Yc.ArrayBuffer,pl=Yc.DataView,fl=pl.prototype,ml=sl(hl.prototype.slice),gl=sl(fl.getUint8),_l=sl(fl.setUint8);ol({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:cl(function(){return!new hl(2).slice(1,void 0).byteLength})},{slice:function(e,t){if(ml&&void 0===t)return ml(ll(this),e);for(var i=ll(this).byteLength,r=dl(e,i),n=dl(void 0===t?i:t,i),a=new hl(ul(n-r)),o=new pl(this),s=new pl(a),c=0;r<n;)_l(s,c++,gl(o,r++));return a}});var vl=i,yl=b,El=n,bl=B,wl=ln,Il=si,Tl=function(){},Sl=W("Reflect","construct"),Al=/^\s*(?:class|function)\b/,Rl=yl(Al.exec),kl=!Al.test(Tl),Cl=function(e){if(!bl(e))return!1;try{return Sl(Tl,[],e),!0}catch(OU){return!1}},Dl=function(e){if(!bl(e))return!1;switch(wl(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return kl||!!Rl(Al,Il(e))}catch(OU){return!0}};Dl.sham=!0;var Ol,Ll,Nl,Pl,xl=!Sl||El(function(){var e;return Cl(Cl.call)||!Cl(Object)||!Cl(function(){e=!0})||e})?Dl:Cl,Ml=xl,Ul=pe,Fl=TypeError,Bl=function(e){if(Ml(e))return e;throw new Fl(Ul(e)+" is not a constructor")},Vl=Nt,Hl=Bl,jl=O,zl=tt("species"),Wl=function(e,t){var i,r=Vl(e).constructor;return void 0===r||jl(i=Vl(r)[zl])?t:Hl(i)},Gl=o,ql=Function.prototype,Kl=ql.apply,Yl=ql.call,Xl="object"==typeof Reflect&&Reflect.apply||(Gl?Yl.bind(Kl):function(){return Yl.apply(Kl,arguments)}),Zl=_e,Jl=o,Ql=al(al.bind),$l=function(e,t){return Zl(e),void 0===t?e:Jl?Ql(e,t):function(){return e.apply(t,arguments)}},ed=TypeError,td=function(e,t){if(e<t)throw new ed("Not enough arguments");return e},id=Y,rd=/ipad|iphone|ipod/i.test(id)&&/applewebkit/i.test(id),nd=i,ad=Xl,od=$l,sd=B,cd=He,ld=n,dd=Yn,ud=zs,hd=gt,pd=td,fd=rd,md=ss,gd=nd.setImmediate,_d=nd.clearImmediate,vd=nd.process,yd=nd.Dispatch,Ed=nd.Function,bd=nd.MessageChannel,wd=nd.String,Id=0,Td={},Sd="onreadystatechange";ld(function(){Ol=nd.location});var Ad=function(e){if(cd(Td,e)){var t=Td[e];delete Td[e],t()}},Rd=function(e){return function(){Ad(e)}},kd=function(e){Ad(e.data)},Cd=function(e){nd.postMessage(wd(e),Ol.protocol+"//"+Ol.host)};gd&&_d||(gd=function(e){pd(arguments.length,1);var t=sd(e)?e:Ed(e),i=ud(arguments,1);return Td[++Id]=function(){ad(t,void 0,i)},Ll(Id),Id},_d=function(e){delete Td[e]},md?Ll=function(e){vd.nextTick(Rd(e))}:yd&&yd.now?Ll=function(e){yd.now(Rd(e))}:bd&&!fd?(Pl=(Nl=new bd).port2,Nl.port1.onmessage=kd,Ll=od(Pl.postMessage,Pl)):nd.addEventListener&&sd(nd.postMessage)&&!nd.importScripts&&Ol&&"file:"!==Ol.protocol&&!ld(Cd)?(Ll=Cd,nd.addEventListener("message",kd,!1)):Ll=Sd in hd("script")?function(e){dd.appendChild(hd("script"))[Sd]=function(){dd.removeChild(this),Ad(e)}}:function(e){setTimeout(Rd(e),0)});var Dd={set:gd,clear:_d},Od=i,Ld=a,Nd=Object.getOwnPropertyDescriptor,Pd=function(e){if(!Ld)return Od[e];var t=Nd(Od,e);return t&&t.value},xd=function(){this.head=null,this.tail=null};xd.prototype={add:function(e){var t={item:e,next:null},i=this.tail;i?i.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var Md,Ud,Fd,Bd,Vd,Hd=xd,jd=/ipad|iphone|ipod/i.test(Y)&&"undefined"!=typeof Pebble,zd=/web0s(?!.*chrome)/i.test(Y),Wd=i,Gd=Pd,qd=$l,Kd=Dd.set,Yd=Hd,Xd=rd,Zd=jd,Jd=zd,Qd=ss,$d=Wd.MutationObserver||Wd.WebKitMutationObserver,eu=Wd.document,tu=Wd.process,iu=Wd.Promise,ru=Gd("queueMicrotask");if(!ru){var nu=new Yd,au=function(){var e,t;for(Qd&&(e=tu.domain)&&e.exit();t=nu.get();)try{t()}catch(OU){throw nu.head&&Md(),OU}e&&e.enter()};Xd||Qd||Jd||!$d||!eu?!Zd&&iu&&iu.resolve?((Bd=iu.resolve(void 0)).constructor=iu,Vd=qd(Bd.then,Bd),Md=function(){Vd(au)}):Qd?Md=function(){tu.nextTick(au)}:(Kd=qd(Kd,Wd),Md=function(){Kd(au)}):(Ud=!0,Fd=eu.createTextNode(""),new $d(au).observe(Fd,{characterData:!0}),Md=function(){Fd.data=Ud=!Ud}),ru=function(e){nu.head||Md(),nu.add(e)}}var ou=ru,su=function(e){try{return{error:!1,value:e()}}catch(OU){return{error:!0,value:OU}}},cu=i.Promise,lu=i,du=cu,uu=B,hu=qr,pu=si,fu=tt,mu=os,gu=te;du&&du.prototype;var _u=fu("species"),vu=!1,yu=uu(lu.PromiseRejectionEvent),Eu=hu("Promise",function(){var e=pu(du),t=e!==String(du);if(!t&&66===gu)return!0;if(!gu||gu<51||!/native code/.test(e)){var i=new du(function(e){e(1)}),r=function(e){e(function(){},function(){})};if((i.constructor={})[_u]=r,!(vu=i.then(function(){})instanceof r))return!0}return!(t||"BROWSER"!==mu&&"DENO"!==mu||yu)}),bu={CONSTRUCTOR:Eu,REJECTION_EVENT:yu,SUBCLASSING:vu},wu={},Iu=_e,Tu=TypeError,Su=function(e){var t,i;this.promise=new e(function(e,r){if(void 0!==t||void 0!==i)throw new Tu("Bad Promise constructor");t=e,i=r}),this.resolve=Iu(t),this.reject=Iu(i)};wu.f=function(e){return new Su(e)};var Au,Ru,ku,Cu,Du=en,Ou=ss,Lu=i,Nu=vl,Pu=l,xu=Ji,Mu=uo,Uu=qa,Fu=$c,Bu=_e,Vu=B,Hu=H,ju=Es,zu=Wl,Wu=Dd.set,Gu=ou,qu=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(OU){}},Ku=su,Yu=Hd,Xu=ki,Zu=cu,Ju=wu,Qu="Promise",$u=bu.CONSTRUCTOR,eh=bu.REJECTION_EVENT,th=bu.SUBCLASSING,ih=Xu.getterFor(Qu),rh=Xu.set,nh=Zu&&Zu.prototype,ah=Zu,oh=nh,sh=Lu.TypeError,ch=Lu.document,lh=Lu.process,dh=Ju.f,uh=dh,hh=!!(ch&&ch.createEvent&&Lu.dispatchEvent),ph="unhandledrejection",fh=function(e){var t;return!(!Hu(e)||!Vu(t=e.then))&&t},mh=function(e,t){var i,r,n,a=t.value,o=1===t.state,s=o?e.ok:e.fail,c=e.resolve,l=e.reject,d=e.domain;try{s?(o||(2===t.rejection&&Eh(t),t.rejection=1),!0===s?i=a:(d&&d.enter(),i=s(a),d&&(d.exit(),n=!0)),i===e.promise?l(new sh("Promise-chain cycle")):(r=fh(i))?Pu(r,i,c,l):c(i)):l(a)}catch(OU){d&&!n&&d.exit(),l(OU)}},gh=function(e,t){e.notified||(e.notified=!0,Gu(function(){for(var i,r=e.reactions;i=r.get();)mh(i,e);e.notified=!1,t&&!e.rejection&&vh(e)}))},_h=function(e,t,i){var r,n;hh?((r=ch.createEvent("Event")).promise=t,r.reason=i,r.initEvent(e,!1,!0),Lu.dispatchEvent(r)):r={promise:t,reason:i},!eh&&(n=Lu["on"+e])?n(r):e===ph&&qu("Unhandled promise rejection",i)},vh=function(e){Pu(Wu,Lu,function(){var t,i=e.facade,r=e.value;if(yh(e)&&(t=Ku(function(){Ou?lh.emit("unhandledRejection",r,i):_h(ph,i,r)}),e.rejection=Ou||yh(e)?2:1,t.error))throw t.value})},yh=function(e){return 1!==e.rejection&&!e.parent},Eh=function(e){Pu(Wu,Lu,function(){var t=e.facade;Ou?lh.emit("rejectionHandled",t):_h("rejectionhandled",t,e.value)})},bh=function(e,t,i){return function(r){e(t,r,i)}},wh=function(e,t,i){e.done||(e.done=!0,i&&(e=i),e.value=t,e.state=2,gh(e,!0))},Ih=function(e,t,i){if(!e.done){e.done=!0,i&&(e=i);try{if(e.facade===t)throw new sh("Promise can't be resolved itself");var r=fh(t);r?Gu(function(){var i={done:!1};try{Pu(r,t,bh(Ih,i,e),bh(wh,i,e))}catch(OU){wh(i,OU,e)}}):(e.value=t,e.state=1,gh(e,!1))}catch(OU){wh({done:!1},OU,e)}}};if($u&&(oh=(ah=function(e){ju(this,oh),Bu(e),Pu(Au,this);var t=ih(this);try{e(bh(Ih,t),bh(wh,t))}catch(OU){wh(t,OU)}}).prototype,(Au=function(e){rh(this,{type:Qu,done:!1,notified:!1,parent:!1,reactions:new Yu,rejection:!1,state:0,value:null})}).prototype=xu(oh,"then",function(e,t){var i=ih(this),r=dh(zu(this,ah));return i.parent=!0,r.ok=!Vu(e)||e,r.fail=Vu(t)&&t,r.domain=Ou?lh.domain:void 0,0===i.state?i.reactions.add(r):Gu(function(){mh(r,i)}),r.promise}),Ru=function(){var e=new Au,t=ih(e);this.promise=e,this.resolve=bh(Ih,t),this.reject=bh(wh,t)},Ju.f=dh=function(e){return e===ah||e===ku?new Ru(e):uh(e)},Vu(Zu)&&nh!==Object.prototype)){Cu=nh.then,th||xu(nh,"then",function(e,t){var i=this;return new ah(function(e,t){Pu(Cu,i,e,t)}).then(e,t)},{unsafe:!0});try{delete nh.constructor}catch(OU){}Mu&&Mu(nh,oh)}Du({global:!0,constructor:!0,wrap:!0,forced:$u},{Promise:ah}),ku=Nu.Promise,Uu(ah,Qu,!1),Fu(Qu);var Th=Ta,Sh=tt("iterator"),Ah=Array.prototype,Rh=function(e){return void 0!==e&&(Th.Array===e||Ah[Sh]===e)},kh=ln,Ch=Ee,Dh=O,Oh=Ta,Lh=tt("iterator"),Nh=function(e){if(!Dh(e))return Ch(e,Lh)||Ch(e,"@@iterator")||Oh[kh(e)]},Ph=l,xh=_e,Mh=Nt,Uh=pe,Fh=Nh,Bh=TypeError,Vh=function(e,t){var i=arguments.length<2?Fh(e):t;if(xh(i))return Mh(Ph(i,e));throw new Bh(Uh(e)+" is not iterable")},Hh=l,jh=Nt,zh=Ee,Wh=function(e,t,i){var r,n;jh(e);try{if(!(r=zh(e,"return"))){if("throw"===t)throw i;return i}r=Hh(r,e)}catch(OU){n=!0,r=OU}if("throw"===t)throw i;if(n)throw r;return jh(r),i},Gh=$l,qh=l,Kh=Nt,Yh=pe,Xh=Rh,Zh=ur,Jh=G,Qh=Vh,$h=Nh,ep=Wh,tp=TypeError,ip=function(e,t){this.stopped=e,this.result=t},rp=ip.prototype,np=function(e,t,i){var r,n,a,o,s,c,l,d=i&&i.that,u=!(!i||!i.AS_ENTRIES),h=!(!i||!i.IS_RECORD),p=!(!i||!i.IS_ITERATOR),f=!(!i||!i.INTERRUPTED),m=Gh(t,d),g=function(e){var t=r;return r=void 0,t&&ep(t,"normal"),new ip(!0,e)},_=function(e){return u?(Kh(e),f?m(e[0],e[1],g):m(e[0],e[1])):f?m(e,g):m(e)};if(h)r=e.iterator;else if(p)r=e;else{if(!(n=$h(e)))throw new tp(Yh(e)+" is not iterable");if(Xh(n)){for(a=0,o=Zh(e);o>a;a++)if((s=_(e[a]))&&Jh(rp,s))return s;return new ip(!1)}r=Qh(e,n)}for(c=h?e.next:r.next;!(l=qh(c,r)).done;){var v=l.value;try{s=_(v)}catch(OU){if(!r)throw OU;ep(r,"throw",OU)}if("object"==typeof s&&s&&Jh(rp,s))return s}return new ip(!1)},ap=tt("iterator"),op=!1;try{var sp=0,cp={next:function(){return{done:!!sp++}},return:function(){op=!0}};cp[ap]=function(){return this},Array.from(cp,function(){throw 2})}catch(OU){}var lp=function(e,t){try{if(!t&&!op)return!1}catch(OU){return!1}var i=!1;try{var r={};r[ap]=function(){return{next:function(){return{done:i=!0}}}},e(r)}catch(OU){}return i},dp=cu,up=bu.CONSTRUCTOR||!lp(function(e){dp.all(e).then(void 0,function(){})}),hp=l,pp=_e,fp=wu,mp=su,gp=np;en({target:"Promise",stat:!0,forced:up},{all:function(e){var t=this,i=fp.f(t),r=i.resolve,n=i.reject,a=mp(function(){var i=pp(t.resolve),a=[],o=0,s=1;gp(e,function(e){var c=o++,l=!1;s++,hp(i,t,e).then(function(e){l||(l=!0,a[c]=e,--s||r(a))},n)}),--s||r(a)});return a.error&&n(a.value),i.promise}});var _p=en,vp=bu.CONSTRUCTOR,yp=cu,Ep=W,bp=B,wp=Ji,Ip=yp&&yp.prototype;if(_p({target:"Promise",proto:!0,forced:vp,real:!0},{catch:function(e){return this.then(void 0,e)}}),bp(yp)){var Tp=Ep("Promise").prototype.catch;Ip.catch!==Tp&&wp(Ip,"catch",Tp,{unsafe:!0})}var Sp=l,Ap=_e,Rp=wu,kp=su,Cp=np;en({target:"Promise",stat:!0,forced:up},{race:function(e){var t=this,i=Rp.f(t),r=i.reject,n=kp(function(){var n=Ap(t.resolve);Cp(e,function(e){Sp(n,t,e).then(i.resolve,r)})});return n.error&&r(n.value),i.promise}});var Dp=wu;en({target:"Promise",stat:!0,forced:bu.CONSTRUCTOR},{reject:function(e){var t=Dp.f(this);return(0,t.reject)(e),t.promise}});var Op=Nt,Lp=H,Np=wu,Pp=function(e,t){if(Op(e),Lp(t)&&t.constructor===e)return t;var i=Np.f(e);return(0,i.resolve)(t),i.promise},xp=en,Mp=bu.CONSTRUCTOR,Up=Pp;W("Promise"),xp({target:"Promise",stat:!0,forced:Mp},{resolve:function(e){return Up(this,e)}});var Fp=en,Bp=cu,Vp=n,Hp=W,jp=B,zp=Wl,Wp=Pp,Gp=Ji,qp=Bp&&Bp.prototype;if(Fp({target:"Promise",proto:!0,real:!0,forced:!!Bp&&Vp(function(){qp.finally.call({then:function(){}},function(){})})},{finally:function(e){var t=zp(this,Hp("Promise")),i=jp(e);return this.then(i?function(i){return Wp(t,e()).then(function(){return i})}:e,i?function(i){return Wp(t,e()).then(function(){throw i})}:e)}}),jp(Bp)){var Kp=Hp("Promise").prototype.finally;qp.finally!==Kp&&Gp(qp,"finally",Kp,{unsafe:!0})}var Yp=H,Xp=S,Zp=tt("match"),Jp=function(e){var t;return Yp(e)&&(void 0!==(t=e[Zp])?!!t:"RegExp"===Xp(e))},Qp=n,$p=i.RegExp,ef=!Qp(function(){var e=!0;try{$p(".","d")}catch(OU){e=!1}var t={},i="",r=e?"dgimsy":"gimsy",n=function(e,r){Object.defineProperty(t,e,{get:function(){return i+=r,!0}})},a={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in e&&(a.hasIndices="d"),a)n(o,a[o]);return Object.getOwnPropertyDescriptor($p.prototype,"flags").get.call(t)!==r||i!==r}),tf={correct:ef},rf=Nt,nf=function(){var e=rf(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},af=l,of=He,sf=G,cf=tf,lf=nf,df=RegExp.prototype,uf=cf.correct?function(e){return e.flags}:function(e){return cf.correct||!sf(df,e)||of(e,"flags")?e.flags:af(lf,e)},hf=n,pf=i.RegExp,ff=hf(function(){var e=pf("a","y");return e.lastIndex=2,null!==e.exec("abcd")}),mf=ff||hf(function(){return!pf("a","y").sticky}),gf=ff||hf(function(){var e=pf("^r","gy");return e.lastIndex=2,null!==e.exec("str")}),_f={BROKEN_CARET:gf,MISSED_STICKY:mf,UNSUPPORTED_Y:ff},vf=kt.f,yf=n,Ef=i.RegExp,bf=yf(function(){var e=Ef(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)}),wf=n,If=i.RegExp,Tf=wf(function(){var e=If("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")}),Sf=a,Af=i,Rf=b,kf=qr,Cf=Ks,Df=Kt,Of=ca,Lf=Qi.f,Nf=G,Pf=Jp,xf=hn,Mf=uf,Uf=_f,Ff=function(e,t,i){i in e||vf(e,i,{configurable:!0,get:function(){return t[i]},set:function(e){t[i]=e}})},Bf=Ji,Vf=n,Hf=He,jf=ki.enforce,zf=$c,Wf=bf,Gf=Tf,qf=tt("match"),Kf=Af.RegExp,Yf=Kf.prototype,Xf=Af.SyntaxError,Zf=Rf(Yf.exec),Jf=Rf("".charAt),Qf=Rf("".replace),$f=Rf("".indexOf),em=Rf("".slice),tm=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,im=/a/g,rm=/a/g,nm=new Kf(im)!==im,am=Uf.MISSED_STICKY,om=Uf.UNSUPPORTED_Y,sm=Sf&&(!nm||am||Wf||Gf||Vf(function(){return rm[qf]=!1,Kf(im)!==im||Kf(rm)===rm||"/a/i"!==String(Kf(im,"i"))}));if(kf("RegExp",sm)){for(var cm=function(e,t){var i,r,n,a,o,s,c=Nf(Yf,this),l=Pf(e),d=void 0===t,u=[],h=e;if(!c&&l&&d&&e.constructor===cm)return e;if((l||Nf(Yf,e))&&(e=e.source,d&&(t=Mf(h))),e=void 0===e?"":xf(e),t=void 0===t?"":xf(t),h=e,Wf&&"dotAll"in im&&(r=!!t&&$f(t,"s")>-1)&&(t=Qf(t,/s/g,"")),i=t,am&&"sticky"in im&&(n=!!t&&$f(t,"y")>-1)&&om&&(t=Qf(t,/y/g,"")),Gf&&(a=function(e){for(var t,i=e.length,r=0,n="",a=[],o=Of(null),s=!1,c=!1,l=0,d="";r<i;r++){if("\\"===(t=Jf(e,r))){if(t+=Jf(e,++r),!c&&"\\"===Jf(t,1)){n+="\\x5c";continue}}else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:n+=t,Zf(tm,em(e,r+1))?(r+=2,c=!0,l++):"?"!==Jf(e,r+1)&&l++;continue;case">"===t&&c:if(""===d||Hf(o,d))throw new Xf("Invalid capture group name");o[d]=!0,a[a.length]=[d,l],c=!1,d="";continue}c?d+=t:n+=t}for(var u=0;u<a.length;u++)for(var h="\\k<"+a[u][0]+">",p="\\"+a[u][1];$f(n,h)>-1;)n=Qf(n,h,p);return[n,a]}(e),e=a[0],u=a[1]),o=Cf(Kf(e,t),c?this:Yf,cm),(r||n||u.length)&&(s=jf(o),r&&(s.dotAll=!0,s.raw=cm(function(e){for(var t,i=e.length,r=0,n="",a=!1;r<i;r++)"\\"!==(t=Jf(e,r))?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),n+=t):n+="[\\s\\S]":n+=t+Jf(e,++r);return n}(e),i)),n&&(s.sticky=!0),u.length&&(s.groups=u)),e!==h)try{Df(o,"source",""===h?"(?:)":h)}catch(OU){}return o},lm=Lf(Kf),dm=0;lm.length>dm;)Ff(cm,Kf,lm[dm++]);Yf.constructor=cm,cm.prototype=Yf,Bf(Af,"RegExp",cm,{constructor:!0})}zf("RegExp");var um=l,hm=b,pm=hn,fm=nf,mm=_f,gm=ca,_m=ki.get,vm=bf,ym=Tf,Em=xe("native-string-replace",String.prototype.replace),bm=RegExp.prototype.exec,wm=bm,Im=hm("".charAt),Tm=hm("".indexOf),Sm=hm("".replace),Am=hm("".slice),Rm=function(){var e=/a/,t=/b*/g;return um(bm,e,"a"),um(bm,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),km=mm.BROKEN_CARET,Cm=void 0!==/()??/.exec("")[1],Dm=function(e,t){for(var i=e.groups=gm(null),r=0;r<t.length;r++){var n=t[r];i[n[0]]=e[n[1]]}};(Rm||Cm||km||vm||ym)&&(wm=function(e){var t,i,r,n=this,a=_m(n),o=pm(e),s=a.raw;if(s)return s.lastIndex=n.lastIndex,t=um(wm,s,o),n.lastIndex=s.lastIndex,t&&a.groups&&Dm(t,a.groups),t;var c=a.groups,l=km&&n.sticky,d=um(fm,n),u=n.source,h=0,p=o;if(l){d=Sm(d,"y",""),-1===Tm(d,"g")&&(d+="g"),p=Am(o,n.lastIndex);var f=n.lastIndex>0&&Im(o,n.lastIndex-1);n.lastIndex>0&&(!n.multiline||n.multiline&&"\n"!==f&&"\r"!==f&&"\u2028"!==f&&"\u2029"!==f)&&(u="(?: (?:"+u+"))",p=" "+p,h++),i=new RegExp("^(?:"+u+")",d)}Cm&&(i=new RegExp("^"+u+"$(?!\\s)",d)),Rm&&(r=n.lastIndex);var m=um(bm,l?i:n,p);return l?m?(m.input=o,m[0]=Am(m[0],h),m.index=n.lastIndex,n.lastIndex+=m[0].length):n.lastIndex=0:Rm&&m&&(n.lastIndex=n.global?m.index+m[0].length:r),Cm&&m&&m.length>1&&um(Em,m[0],i,function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(m[e]=void 0)}),m&&c&&Dm(m,c),m});var Om=wm;en({target:"RegExp",proto:!0,forced:/./.exec!==Om},{exec:Om});var Lm=mn,Nm=tf,Pm=nf;a&&!Nm.correct&&(Lm(RegExp.prototype,"flags",{configurable:!0,get:Pm}),Nm.correct=!0);var xm=ir,Mm=hn,Um=P,Fm=RangeError,Bm=Math.floor,Vm=b,Hm=lr,jm=hn,zm=P,Wm=Vm(function(e){var t=Mm(Um(this)),i="",r=xm(e);if(r<0||Infinity===r)throw new Fm("Wrong number of repetitions");for(;r>0;(r=Bm(r/2))&&(t+=t))r%2&&(i+=t);return i}),Gm=Vm("".slice),qm=Math.ceil,Km=function(e){return function(t,i,r){var n=jm(zm(t)),a=Hm(i),o=n.length;if(a<=o)return n;var s,c,l=void 0===r?" ":jm(r);return""===l?n:((c=Wm(l,qm((s=a-o)/l.length))).length>s&&(c=Gm(c,0,s)),e?n+c:c+n)}},Ym={start:Km(!1),end:Km(!0)},Xm=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Y),Zm=Ym.start;en({target:"String",proto:!0,forced:Xm},{padStart:function(e){return Zm(this,e,arguments.length>1?arguments[1]:void 0)}});var Jm=l,Qm=Ji,$m=Om,eg=n,tg=tt,ig=Kt,rg=tg("species"),ng=RegExp.prototype,ag=b,og=ir,sg=hn,cg=P,lg=ag("".charAt),dg=ag("".charCodeAt),ug=ag("".slice),hg=function(e){return function(t,i){var r,n,a=sg(cg(t)),o=og(i),s=a.length;return o<0||o>=s?e?"":void 0:(r=dg(a,o))<55296||r>56319||o+1===s||(n=dg(a,o+1))<56320||n>57343?e?lg(a,o):r:e?ug(a,o,o+2):n-56320+(r-55296<<10)+65536}},pg={codeAt:hg(!1),charAt:hg(!0)},fg=pg.charAt,mg=b,gg=Fe,_g=Math.floor,vg=mg("".charAt),yg=mg("".replace),Eg=mg("".slice),bg=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,wg=/\$([$&'`]|\d{1,2})/g,Ig=function(e,t,i,r,n,a){var o=i+e.length,s=r.length,c=wg;return void 0!==n&&(n=gg(n),c=bg),yg(a,c,function(a,c){var l;switch(vg(c,0)){case"$":return"$";case"&":return e;case"`":return Eg(t,0,i);case"'":return Eg(t,o);case"<":l=n[Eg(c,1,-1)];break;default:var d=+c;if(0===d)return a;if(d>s){var u=_g(d/10);return 0===u?a:u<=s?void 0===r[u-1]?vg(c,1):r[u-1]+vg(c,1):a}l=r[d-1]}return void 0===l?"":l})},Tg=l,Sg=Nt,Ag=B,Rg=S,kg=Om,Cg=TypeError,Dg=Xl,Og=l,Lg=b,Ng=function(e,t,i,r){var n=tg(e),a=!eg(function(){var t={};return t[n]=function(){return 7},7!==""[e](t)}),o=a&&!eg(function(){var t=!1,i=/a/;if("split"===e){var r={};r[rg]=function(){return i},(i={constructor:r,flags:""})[n]=/./[n]}return i.exec=function(){return t=!0,null},i[n](""),!t});if(!a||!o||i){var s=/./[n],c=t(n,""[e],function(e,t,i,r,n){var o=t.exec;return o===$m||o===ng.exec?a&&!n?{done:!0,value:Jm(s,t,i,r)}:{done:!0,value:Jm(e,i,t,r)}:{done:!1}});Qm(String.prototype,e,c[0]),Qm(ng,n,c[1])}r&&ig(ng[n],"sham",!0)},Pg=n,xg=Nt,Mg=B,Ug=H,Fg=ir,Bg=lr,Vg=hn,Hg=P,jg=function(e,t,i){return t+(i&&fg(e,t).length||1)},zg=Ee,Wg=Ig,Gg=uf,qg=function(e,t){var i=e.exec;if(Ag(i)){var r=Tg(i,e,t);return null!==r&&Sg(r),r}if("RegExp"===Rg(e))return Tg(kg,e,t);throw new Cg("RegExp#exec called on incompatible receiver")},Kg=tt("replace"),Yg=Math.max,Xg=Math.min,Zg=Lg([].concat),Jg=Lg([].push),Qg=Lg("".indexOf),$g=Lg("".slice),e_=function(e){return void 0===e?e:String(e)},t_="$0"==="a".replace(/./,"$0"),i_=!!/./[Kg]&&""===/./[Kg]("a","$0"),r_=!Pg(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")});Ng("replace",function(e,t,i){var r=i_?"$":"$0";return[function(e,i){var r=Hg(this),n=Ug(e)?zg(e,Kg):void 0;return n?Og(n,e,r,i):Og(t,Vg(r),e,i)},function(e,n){var a=xg(this),o=Vg(e),s=Mg(n);s||(n=Vg(n));var c=Vg(Gg(a));if("string"==typeof n&&!~Qg(n,r)&&!~Qg(n,"$<")&&!~Qg(c,"y")){var l=i(t,a,o,n);if(l.done)return l.value}var d,u=!!~Qg(c,"g");u&&(d=!!~Qg(c,"u")||!!~Qg(c,"v"),a.lastIndex=0);for(var h,p=[];null!==(h=qg(a,o))&&(Jg(p,h),u);){""===Vg(h[0])&&(a.lastIndex=jg(o,Bg(a.lastIndex),d))}for(var f="",m=0,g=0;g<p.length;g++){for(var _,v=Vg((h=p[g])[0]),y=Yg(Xg(Fg(h.index),o.length),0),E=[],b=1;b<h.length;b++)Jg(E,e_(h[b]));var w=h.groups;if(s){var I=Zg([v],E,y,o);void 0!==w&&Jg(I,w),_=Vg(Dg(n,void 0,I))}else _=Wg(v,o,y,E,w,n);y>=m&&(f+=$g(o,m,y)+_,m=y+v.length)}return f+$g(o,m)}]},!r_||!t_||i_);var n_="\t\n\v\f\r                 \u2028\u2029\ufeff",a_=P,o_=hn,s_=n_,c_=b("".replace),l_=RegExp("^["+s_+"]+"),d_=RegExp("(^|[^"+s_+"])["+s_+"]+$"),u_=function(e){return function(t){var i=o_(a_(t));return 1&e&&(i=c_(i,l_,"")),2&e&&(i=c_(i,d_,"$1")),i}},h_={start:u_(1),end:u_(2),trim:u_(3)},p_=ei.PROPER,f_=n,m_=n_,g_=h_.trim;en({target:"String",proto:!0,forced:function(e){return f_(function(){return!!m_[e]()||"​…᠎"!=="​…᠎"[e]()||p_&&m_[e].name!==e})}("trim")},{trim:function(){return g_(this)}});var __,v_,y_,E_={exports:{}},b_=ms,w_=a,I_=i,T_=B,S_=H,A_=He,R_=ln,k_=pe,C_=Kt,D_=Ji,O_=mn,L_=G,N_=Na,P_=uo,x_=tt,M_=qe,U_=ki.enforce,F_=ki.get,B_=I_.Int8Array,V_=B_&&B_.prototype,H_=I_.Uint8ClampedArray,j_=H_&&H_.prototype,z_=B_&&N_(B_),W_=V_&&N_(V_),G_=Object.prototype,q_=I_.TypeError,K_=x_("toStringTag"),Y_=M_("TYPED_ARRAY_TAG"),X_="TypedArrayConstructor",Z_=b_&&!!P_&&"Opera"!==R_(I_.opera),J_=!1,Q_={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},$_={BigInt64Array:8,BigUint64Array:8},ev=function(e){var t=N_(e);if(S_(t)){var i=F_(t);return i&&A_(i,X_)?i[X_]:ev(t)}},tv=function(e){if(!S_(e))return!1;var t=R_(e);return A_(Q_,t)||A_($_,t)};for(__ in Q_)(y_=(v_=I_[__])&&v_.prototype)?U_(y_)[X_]=v_:Z_=!1;for(__ in $_)(y_=(v_=I_[__])&&v_.prototype)&&(U_(y_)[X_]=v_);if((!Z_||!T_(z_)||z_===Function.prototype)&&(z_=function(){throw new q_("Incorrect invocation")},Z_))for(__ in Q_)I_[__]&&P_(I_[__],z_);if((!Z_||!W_||W_===G_)&&(W_=z_.prototype,Z_))for(__ in Q_)I_[__]&&P_(I_[__].prototype,W_);if(Z_&&N_(j_)!==W_&&P_(j_,W_),w_&&!A_(W_,K_))for(__ in J_=!0,O_(W_,K_,{configurable:!0,get:function(){return S_(this)?this[Y_]:void 0}}),Q_)I_[__]&&C_(I_[__].prototype,Y_,__);var iv={NATIVE_ARRAY_BUFFER_VIEWS:Z_,TYPED_ARRAY_TAG:J_&&Y_,aTypedArray:function(e){if(tv(e))return e;throw new q_("Target is not a typed array")},aTypedArrayConstructor:function(e){if(T_(e)&&(!P_||L_(z_,e)))return e;throw new q_(k_(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,r){if(w_){if(i)for(var n in Q_){var a=I_[n];if(a&&A_(a.prototype,e))try{delete a.prototype[e]}catch(OU){try{a.prototype[e]=t}catch(o){}}}W_[e]&&!i||D_(W_,e,i?t:Z_&&V_[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,i){var r,n;if(w_){if(P_){if(i)for(r in Q_)if((n=I_[r])&&A_(n,e))try{delete n[e]}catch(OU){}if(z_[e]&&!i)return;try{return D_(z_,e,i?t:Z_&&z_[e]||t)}catch(OU){}}for(r in Q_)!(n=I_[r])||n[e]&&!i||D_(n,e,t)}},getTypedArrayConstructor:ev,isView:function(e){if(!S_(e))return!1;var t=R_(e);return"DataView"===t||A_(Q_,t)||A_($_,t)},isTypedArray:tv,TypedArray:z_,TypedArrayPrototype:W_},rv=i,nv=n,av=lp,ov=iv.NATIVE_ARRAY_BUFFER_VIEWS,sv=rv.ArrayBuffer,cv=rv.Int8Array,lv=!ov||!nv(function(){cv(1)})||!nv(function(){new cv(-1)})||!av(function(e){new cv,new cv(null),new cv(1.5),new cv(e)},!0)||nv(function(){return 1!==new cv(new sv(2),1,void 0).length}),dv=H,uv=Math.floor,hv=Number.isInteger||function(e){return!dv(e)&&isFinite(e)&&uv(e)===e},pv=ir,fv=RangeError,mv=function(e){var t=pv(e);if(t<0)throw new fv("The argument can't be less than 0");return t},gv=RangeError,_v=function(e,t){var i=mv(e);if(i%t)throw new gv("Wrong offset");return i},vv=Math.floor,yv=ln,Ev=lt,bv=TypeError,wv=function(e){var t=Ev(e,"number");if("number"==typeof t)throw new bv("Can't convert number to bigint");return BigInt(t)},Iv=$l,Tv=l,Sv=_e,Av=Bl,Rv=Fe,kv=ur,Cv=Vh,Dv=Nh,Ov=Rh,Lv=function(e){var t=yv(e);return"BigInt64Array"===t||"BigUint64Array"===t},Nv=iv.aTypedArrayConstructor,Pv=wv,xv=function(e){var t=Av(this),i=arguments.length,r=i>1?arguments[1]:void 0,n=void 0!==r;n&&Sv(r);var a,o,s,c,l,d,u,h,p=Rv(e),f=Dv(p);if(f&&!Ov(f))for(h=(u=Cv(p,f)).next,p=[];!(d=Tv(h,u)).done;)p.push(d.value);for(n&&i>2&&(r=Iv(r,arguments[2])),o=kv(p),s=new(Nv(t))(o),c=Lv(s),a=0;o>a;a++)l=n?r(p[a],a):p[a],s[a]=c?Pv(l):+l;return s},Mv=ds,Uv=xl,Fv=H,Bv=tt("species"),Vv=Array,Hv=function(e){var t;return Mv(e)&&(t=e.constructor,(Uv(t)&&(t===Vv||Mv(t.prototype))||Fv(t)&&null===(t=t[Bv]))&&(t=void 0)),void 0===t?Vv:t},jv=a,zv=kt,Wv=g,Gv=function(e,t,i){jv?zv.f(e,t,Wv(0,i)):e[t]=i},qv=$l,Kv=D,Yv=Fe,Xv=ur,Zv=function(e,t){return new(Hv(e))(0===t?0:t)},Jv=Gv,Qv=function(e){var t=1===e,i=2===e,r=3===e,n=4===e,a=6===e,o=7===e,s=5===e||a;return function(c,l,d){for(var u,h,p=Yv(c),f=Kv(p),m=Xv(f),g=qv(l,d),_=0,v=0,y=t?Zv(c,m):i||o?Zv(c,0):void 0;m>_;_++)if((s||_ in f)&&(h=g(u=f[_],_,p),e))if(t)Jv(y,_,h);else if(h)switch(e){case 3:return!0;case 5:return u;case 6:return _;case 2:Jv(y,v++,u)}else switch(e){case 4:return!1;case 7:Jv(y,v++,u)}return a?-1:r||n?n:y}},$v={forEach:Qv(0),map:Qv(1),filter:Qv(2),some:Qv(3),every:Qv(4),find:Qv(5),findIndex:Qv(6),filterReject:Qv(7)},ey=ur,ty=en,iy=i,ry=l,ny=a,ay=lv,oy=iv,sy=Yc,cy=Es,ly=g,dy=Kt,uy=hv,hy=Ts,py=_v,fy=function(e){var t=+e;if(t!=t||t<=0)return 0;if(t>=255)return 255;var i=vv(t);return i+.5<t?i+1:t<i+.5||i%2==0?i:i+1},my=ht,gy=He,_y=ln,vy=H,yy=ue,Ey=ca,by=G,wy=uo,Iy=Qi.f,Ty=xv,Sy=$v.forEach,Ay=$c,Ry=mn,ky=kt,Cy=r,Dy=function(e,t,i){for(var r=0,n=arguments.length>2?i:ey(t),a=new e(n);n>r;)a[r]=t[r++];return a},Oy=Ks,Ly=ki.get,Ny=ki.set,Py=ki.enforce,xy=ky.f,My=Cy.f,Uy=iy.RangeError,Fy=sy.ArrayBuffer,By=Fy.prototype,Vy=sy.DataView,Hy=oy.NATIVE_ARRAY_BUFFER_VIEWS,jy=oy.TYPED_ARRAY_TAG,zy=oy.TypedArray,Wy=oy.TypedArrayPrototype,Gy=oy.isTypedArray,qy="BYTES_PER_ELEMENT",Ky="Wrong length",Yy=function(e,t){Ry(e,t,{configurable:!0,get:function(){return Ly(this)[t]}})},Xy=function(e){var t;return by(By,e)||"ArrayBuffer"===(t=_y(e))||"SharedArrayBuffer"===t},Zy=function(e,t){return Gy(e)&&!yy(t)&&t in e&&uy(+t)&&t>=0},Jy=function(e,t){return t=my(t),Zy(e,t)?ly(2,e[t]):My(e,t)},Qy=function(e,t,i){return t=my(t),!(Zy(e,t)&&vy(i)&&gy(i,"value"))||gy(i,"get")||gy(i,"set")||i.configurable||gy(i,"writable")&&!i.writable||gy(i,"enumerable")&&!i.enumerable?xy(e,t,i):(e[t]=i.value,e)};ny?(Hy||(Cy.f=Jy,ky.f=Qy,Yy(Wy,"buffer"),Yy(Wy,"byteOffset"),Yy(Wy,"byteLength"),Yy(Wy,"length")),ty({target:"Object",stat:!0,forced:!Hy},{getOwnPropertyDescriptor:Jy,defineProperty:Qy}),E_.exports=function(e,t,i){var r=e.match(/\d+/)[0]/8,n=e+(i?"Clamped":"")+"Array",a="get"+e,o="set"+e,s=iy[n],c=s,l=c&&c.prototype,d={},u=function(e,t){xy(e,t,{get:function(){return function(e,t){var i=Ly(e);return i.view[a](t*r+i.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var a=Ly(e);a.view[o](t*r+a.byteOffset,i?fy(n):n,!0)}(this,t,e)},enumerable:!0})};Hy?ay&&(c=t(function(e,t,i,n){return cy(e,l),Oy(vy(t)?Xy(t)?void 0!==n?new s(t,py(i,r),n):void 0!==i?new s(t,py(i,r)):new s(t):Gy(t)?Dy(c,t):ry(Ty,c,t):new s(hy(t)),e,c)}),wy&&wy(c,zy),Sy(Iy(s),function(e){e in c||dy(c,e,s[e])}),c.prototype=l):(c=t(function(e,t,i,n){cy(e,l);var a,o,s,d=0,h=0;if(vy(t)){if(!Xy(t))return Gy(t)?Dy(c,t):ry(Ty,c,t);a=t,h=py(i,r);var p=t.byteLength;if(void 0===n){if(p%r)throw new Uy(Ky);if((o=p-h)<0)throw new Uy(Ky)}else if((o=hy(n)*r)+h>p)throw new Uy(Ky);s=o/r}else s=hy(t),a=new Fy(o=s*r);for(Ny(e,{buffer:a,byteOffset:h,byteLength:o,length:s,view:new Vy(a)});d<s;)u(e,d++)}),wy&&wy(c,zy),l=c.prototype=Ey(Wy)),l.constructor!==c&&dy(l,"constructor",c),Py(l).TypedArrayConstructor=c,jy&&dy(l,jy,n);var h=c!==s;d[n]=c,ty({global:!0,constructor:!0,forced:h,sham:!Hy},d),qy in c||dy(c,qy,r),qy in l||dy(l,qy,r),Ay(n)}):E_.exports=function(){};var $y=E_.exports;$y("Float32",function(e){return function(t,i,r){return e(this,t,i,r)}}),$y("Int32",function(e){return function(t,i,r){return e(this,t,i,r)}}),$y("Uint8",function(e){return function(t,i,r){return e(this,t,i,r)}}),$y("Uint16",function(e){return function(t,i,r){return e(this,t,i,r)}}),$y("Uint32",function(e){return function(t,i,r){return e(this,t,i,r)}});var eE=js,tE=wv,iE=ln,rE=l,nE=n,aE=iv.aTypedArray,oE=iv.exportTypedArrayMethod,sE=b("".slice);oE("fill",function(e){var t=arguments.length;aE(this);var i="Big"===sE(iE(this),0,3)?tE(e):+e;return rE(eE,this,i,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)},nE(function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e})),(0,iv.exportTypedArrayStaticMethod)("from",xv,lv);var cE=i,lE=l,dE=iv,uE=ur,hE=_v,pE=Fe,fE=n,mE=cE.RangeError,gE=cE.Int8Array,_E=gE&&gE.prototype,vE=_E&&_E.set,yE=dE.aTypedArray,EE=dE.exportTypedArrayMethod,bE=!fE(function(){var e=new Uint8ClampedArray(2);return lE(vE,e,{length:1,0:3},1),3!==e[1]}),wE=bE&&dE.NATIVE_ARRAY_BUFFER_VIEWS&&fE(function(){var e=new gE(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]});EE("set",function(e){yE(this);var t=hE(arguments.length>1?arguments[1]:void 0,1),i=pE(e);if(bE)return lE(vE,this,i,t);var r=this.length,n=uE(i),a=0;if(n+t>r)throw new mE("Wrong length");for(;a<n;)this[t+a]=i[a++]},!bE||wE);var IE=zs,TE=Math.floor,SE=function(e,t){var i=e.length;if(i<8)for(var r,n,a=1;a<i;){for(n=a,r=e[a];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==a++&&(e[n]=r)}else for(var o=TE(i/2),s=SE(IE(e,0,o),t),c=SE(IE(e,o),t),l=s.length,d=c.length,u=0,h=0;u<l||h<d;)e[u+h]=u<l&&h<d?t(s[u],c[h])<=0?s[u++]:c[h++]:u<l?s[u++]:c[h++];return e},AE=SE,RE=Y.match(/firefox\/(\d+)/i),kE=!!RE&&+RE[1],CE=/MSIE|Trident/.test(Y),DE=Y.match(/AppleWebKit\/(\d+)\./),OE=!!DE&&+DE[1],LE=al,NE=n,PE=_e,xE=AE,ME=kE,UE=CE,FE=te,BE=OE,VE=iv.aTypedArray,HE=iv.exportTypedArrayMethod,jE=i.Uint16Array,zE=jE&&LE(jE.prototype.sort),WE=!(!zE||NE(function(){zE(new jE(2),null)})&&NE(function(){zE(new jE(2),{})})),GE=!!zE&&!NE(function(){if(FE)return FE<74;if(ME)return ME<67;if(UE)return!0;if(BE)return BE<602;var e,t,i=new jE(516),r=Array(516);for(e=0;e<516;e++)t=e%4,i[e]=515-e,r[e]=e-2*t+3;for(zE(i,function(e,t){return(e/4|0)-(t/4|0)}),e=0;e<516;e++)if(i[e]!==r[e])return!0});HE("sort",function(e){return void 0!==e&&PE(e),GE?zE(this,e):xE(VE(this),function(e){return function(t,i){return void 0!==e?+e(t,i)||0:i!=i?t!=t?0:-1:t!=t?1:0===t&&0===i?1/t>0?1/i>0?0:1:1/i>0?-1:0:t>i?1:t<i?-1:0}}(e))},!GE||WE);var qE=en,KE=l,YE=b,XE=P,ZE=B,JE=H,QE=Jp,$E=hn,eb=Ee,tb=uf,ib=Ig,rb=tt("replace"),nb=TypeError,ab=YE("".indexOf);YE("".replace);var ob=YE("".slice),sb=Math.max;qE({target:"String",proto:!0},{replaceAll:function(e,t){var i,r,n,a,o,s,c,l,d,u=XE(this),h=0,p="";if(JE(e)){if(QE(e)&&(i=$E(XE(tb(e))),!~ab(i,"g")))throw new nb("`.replaceAll` does not allow non-global regexes");if(r=eb(e,rb))return KE(r,e,u,t)}for(n=$E(u),a=$E(e),(o=ZE(t))||(t=$E(t)),s=a.length,c=sb(1,s),l=ab(n,a);-1!==l;)d=o?$E(t(a,l,n)):ib(a,n,l,[],void 0,t),p+=ob(n,h,l)+d,h=l+s,l=l+c>n.length?-1:ab(n,a,l+c);return h<n.length&&(p+=ob(n,h)),p}});var cb={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},lb=gt("span").classList,db=lb&&lb.constructor&&lb.constructor.prototype,ub=db===Object.prototype?void 0:db,hb=$v.forEach,pb=ts("forEach")?[].forEach:function(e){return hb(this,e,arguments.length>1?arguments[1]:void 0)},fb=i,mb=cb,gb=ub,_b=pb,vb=Kt,yb=function(e){if(e&&e.forEach!==_b)try{vb(e,"forEach",_b)}catch(OU){e.forEach=_b}};for(var Eb in mb)mb[Eb]&&yb(fb[Eb]&&fb[Eb].prototype);yb(gb);var bb=i,wb=cb,Ib=ub,Tb=Wo,Sb=Kt,Ab=qa,Rb=tt("iterator"),kb=Tb.values,Cb=function(e,t){if(e){if(e[Rb]!==kb)try{Sb(e,Rb,kb)}catch(OU){e[Rb]=kb}if(Ab(e,t,!0),wb[t])for(var i in Tb)if(e[i]!==Tb[i])try{Sb(e,i,Tb[i])}catch(OU){e[i]=Tb[i]}}};for(var Db in wb)Cb(bb[Db]&&bb[Db].prototype,Db);Cb(Ib,"DOMTokenList");var Ob=Dd.clear;en({global:!0,bind:!0,enumerable:!0,forced:i.clearImmediate!==Ob},{clearImmediate:Ob});var Lb=i,Nb=Xl,Pb=B,xb=os,Mb=Y,Ub=zs,Fb=td,Bb=Lb.Function,Vb=/MSIE .\./.test(Mb)||"BUN"===xb&&function(){var e=Lb.Bun.version.split(".");return e.length<3||"0"===e[0]&&(e[1]<3||"3"===e[1]&&"0"===e[2])}(),Hb=en,jb=i,zb=Dd.set,Wb=function(e,t){var i=t?2:1;return Vb?function(r,n){var a=Fb(arguments.length,1)>i,o=Pb(r)?r:Bb(r),s=a?Ub(arguments,i):[],c=a?function(){Nb(o,this,s)}:o;return t?e(c,n):e(c)}:e},Gb=jb.setImmediate?Wb(zb,!1):zb;Hb({global:!0,bind:!0,enumerable:!0,forced:jb.setImmediate!==Gb},{setImmediate:Gb});var qb=pg.charAt,Kb=hn,Yb=ki,Xb=Oo,Zb=Lo,Jb="String Iterator",Qb=Yb.set,$b=Yb.getterFor(Jb);Xb(String,"String",function(e){Qb(this,{type:Jb,string:Kb(e),index:0})},function(){var e,t=$b(this),i=t.string,r=t.index;return r>=i.length?Zb(void 0,!0):(e=qb(i,r),t.index+=e.length,Zb(e,!1))});var ew=n,tw=a,iw=tt("iterator"),rw=!ew(function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,i=new URLSearchParams("a=1&a=2&b=3"),r="";return e.pathname="c%20d",t.forEach(function(e,i){t.delete("b"),r+=i+e}),i.delete("a",2),i.delete("b",void 0),!t.size&&!tw||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[iw]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==r||"x"!==new URL("https://x",void 0).host}),nw=a,aw=b,ow=l,sw=n,cw=Vn,lw=Ar,dw=d,uw=Fe,hw=D,pw=Object.assign,fw=Object.defineProperty,mw=aw([].concat),gw=!pw||sw(function(){if(nw&&1!==pw({b:1},pw(fw({},"a",{enumerable:!0,get:function(){fw(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},i=Symbol("assign detection"),r="abcdefghijklmnopqrst";return e[i]=7,r.split("").forEach(function(e){t[e]=e}),7!==pw({},e)[i]||cw(pw({},t)).join("")!==r})?function(e,t){for(var i=uw(e),r=arguments.length,n=1,a=lw.f,o=dw.f;r>n;)for(var s,c=hw(arguments[n++]),l=a?mw(cw(c),a(c)):cw(c),d=l.length,u=0;d>u;)s=l[u++],nw&&!ow(o,c,s)||(i[s]=c[s]);return i}:pw,_w=Nt,vw=Wh,yw=a,Ew=ds,bw=TypeError,ww=Object.getOwnPropertyDescriptor,Iw=yw&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(OU){return OU instanceof TypeError}}(),Tw=$l,Sw=l,Aw=Fe,Rw=function(e,t,i,r){try{return r?t(_w(i)[0],i[1]):t(i)}catch(OU){vw(e,"throw",OU)}},kw=Rh,Cw=xl,Dw=ur,Ow=Gv,Lw=Iw?function(e,t){if(Ew(e)&&!ww(e,"length").writable)throw new bw("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},Nw=Vh,Pw=Nh,xw=Wh,Mw=Array,Uw=b,Fw=2147483647,Bw=/[^\0-\u007E]/,Vw=/[.\u3002\uFF0E\uFF61]/g,Hw="Overflow: input needs wider integers to process",jw=RangeError,zw=Uw(Vw.exec),Ww=Math.floor,Gw=String.fromCharCode,qw=Uw("".charCodeAt),Kw=Uw([].join),Yw=Uw([].push),Xw=Uw("".replace),Zw=Uw("".split),Jw=Uw("".toLowerCase),Qw=function(e){return e+22+75*(e<26)},$w=function(e,t,i){var r=0;for(e=i?Ww(e/700):e>>1,e+=Ww(e/t);e>455;)e=Ww(e/35),r+=36;return Ww(r+36*e/(e+38))},eI=function(e){var t=[];e=function(e){for(var t=[],i=0,r=e.length;i<r;){var n=qw(e,i++);if(n>=55296&&n<=56319&&i<r){var a=qw(e,i++);56320==(64512&a)?Yw(t,((1023&n)<<10)+(1023&a)+65536):(Yw(t,n),i--)}else Yw(t,n)}return t}(e);var i,r,n=e.length,a=128,o=0,s=72;for(i=0;i<e.length;i++)(r=e[i])<128&&Yw(t,Gw(r));var c=t.length,l=c;for(c&&Yw(t,"-");l<n;){var d=Fw;for(i=0;i<e.length;i++)(r=e[i])>=a&&r<d&&(d=r);var u=l+1;if(d-a>Ww((Fw-o)/u))throw new jw(Hw);for(o+=(d-a)*u,a=d,i=0;i<e.length;i++){if((r=e[i])<a&&++o>Fw)throw new jw(Hw);if(r===a){for(var h=o,p=36;;){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var m=h-f,g=36-f;Yw(t,Gw(Qw(f+m%g))),h=Ww(m/g),p+=36}Yw(t,Gw(Qw(h))),s=$w(o,u,l===c),o=0,l++}}o++,a++}return Kw(t,"")},tI=en,iI=b,rI=or,nI=RangeError,aI=String.fromCharCode,oI=String.fromCodePoint,sI=iI([].join);tI({target:"String",stat:!0,arity:1,forced:!!oI&&1!==oI.length},{fromCodePoint:function(e){for(var t,i=[],r=arguments.length,n=0;r>n;){if(rI(t=+arguments[n],1114111)!==t)throw new nI(t+" is not a valid code point");i[n++]=t<65536?aI(t):aI(55296+((t-=65536)>>10),t%1024+56320)}return sI(i,"")}});var cI=en,lI=i,dI=Pd,uI=W,hI=l,pI=b,fI=a,mI=rw,gI=Ji,_I=mn,vI=_s,yI=qa,EI=$a,bI=ki,wI=Es,II=B,TI=He,SI=$l,AI=ln,RI=Nt,kI=H,CI=hn,DI=ca,OI=g,LI=Vh,NI=Nh,PI=Lo,xI=td,MI=AE,UI=tt("iterator"),FI="URLSearchParams",BI=FI+"Iterator",VI=bI.set,HI=bI.getterFor(FI),jI=bI.getterFor(BI),zI=dI("fetch"),WI=dI("Request"),GI=dI("Headers"),qI=WI&&WI.prototype,KI=GI&&GI.prototype,YI=lI.TypeError,XI=lI.encodeURIComponent,ZI=String.fromCharCode,JI=uI("String","fromCodePoint"),QI=parseInt,$I=pI("".charAt),eT=pI([].join),tT=pI([].push),iT=pI("".replace),rT=pI([].shift),nT=pI([].splice),aT=pI("".split),oT=pI("".slice),sT=pI(/./.exec),cT=/\+/g,lT=/^[0-9a-f]+$/i,dT=function(e,t){var i=oT(e,t,t+2);return sT(lT,i)?QI(i,16):NaN},uT=function(e){for(var t=0,i=128;i>0&&0!==(e&i);i>>=1)t++;return t},hT=function(e){var t=null,i=e.length;switch(i){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return null===t||t>1114111||t>=55296&&t<=57343||t<(i>3?65536:i>2?2048:i>1?128:0)?null:t},pT=function(e){for(var t=(e=iT(e,cT," ")).length,i="",r=0;r<t;){var n=$I(e,r);if("%"===n){if("%"===$I(e,r+1)||r+3>t){i+="%",r++;continue}var a=dT(e,r+1);if(a!=a){i+=n,r++;continue}r+=2;var o=uT(a);if(0===o)n=ZI(a);else{if(1===o||o>4){i+="�",r++;continue}for(var s=[a],c=1;c<o&&!(++r+3>t||"%"!==$I(e,r));){var l=dT(e,r+1);if(l!=l||l>191||l<128)break;if(1===c){if(224===a&&l<160)break;if(237===a&&l>159)break;if(240===a&&l<144)break;if(244===a&&l>143)break}tT(s,l),r+=2,c++}if(s.length!==o){i+="�";continue}var d=hT(s);if(null===d){for(var u=0;u<o;u++)i+="�";r++;continue}n=JI(d)}}i+=n,r++}return i},fT=/[!'()~]|%20/g,mT={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},gT=function(e){return mT[e]},_T=function(e){return iT(XI(e),fT,gT)},vT=EI(function(e,t){VI(this,{type:BI,target:HI(e).entries,index:0,kind:t})},FI,function(){var e=jI(this),t=e.target,i=e.index++;if(!t||i>=t.length)return e.target=null,PI(void 0,!0);var r=t[i];switch(e.kind){case"keys":return PI(r.key,!1);case"values":return PI(r.value,!1)}return PI([r.key,r.value],!1)},!0),yT=function(e){this.entries=[],this.url=null,void 0!==e&&(kI(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===$I(e,0)?oT(e,1):e:CI(e)))};yT.prototype={type:FI,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,i,r,n,a,o,s,c=this.entries,l=NI(e);if(l)for(i=(t=LI(e,l)).next;!(r=hI(i,t)).done;){if(a=(n=LI(RI(r.value))).next,(o=hI(a,n)).done||(s=hI(a,n)).done||!hI(a,n).done)throw new YI("Expected sequence with length 2");tT(c,{key:CI(o.value),value:CI(s.value)})}else for(var d in e)TI(e,d)&&tT(c,{key:d,value:CI(e[d])})},parseQuery:function(e){if(e)for(var t,i,r=this.entries,n=aT(e,"&"),a=0;a<n.length;)(t=n[a++]).length&&(i=aT(t,"="),tT(r,{key:pT(rT(i)),value:pT(eT(i,"="))}))},serialize:function(){for(var e,t=this.entries,i=[],r=0;r<t.length;)e=t[r++],tT(i,_T(e.key)+"="+_T(e.value));return eT(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var ET=function(){wI(this,bT);var e=VI(this,new yT(arguments.length>0?arguments[0]:void 0));fI||(this.size=e.entries.length)},bT=ET.prototype;if(vI(bT,{append:function(e,t){var i=HI(this);xI(arguments.length,2),tT(i.entries,{key:CI(e),value:CI(t)}),fI||this.size++,i.updateURL()},delete:function(e){for(var t=HI(this),i=xI(arguments.length,1),r=t.entries,n=CI(e),a=i<2?void 0:arguments[1],o=void 0===a?a:CI(a),s=0;s<r.length;){var c=r[s];c.key!==n||void 0!==o&&c.value!==o?s++:nT(r,s,1)}fI||(this.size=r.length),t.updateURL()},get:function(e){var t=HI(this).entries;xI(arguments.length,1);for(var i=CI(e),r=0;r<t.length;r++)if(t[r].key===i)return t[r].value;return null},getAll:function(e){var t=HI(this).entries;xI(arguments.length,1);for(var i=CI(e),r=[],n=0;n<t.length;n++)t[n].key===i&&tT(r,t[n].value);return r},has:function(e){for(var t=HI(this).entries,i=xI(arguments.length,1),r=CI(e),n=i<2?void 0:arguments[1],a=void 0===n?n:CI(n),o=0;o<t.length;){var s=t[o++];if(s.key===r&&(void 0===a||s.value===a))return!0}return!1},set:function(e,t){var i=HI(this);xI(arguments.length,2);for(var r,n=i.entries,a=!1,o=CI(e),s=CI(t),c=0;c<n.length;c++)(r=n[c]).key===o&&(a?nT(n,c--,1):(a=!0,r.value=s));a||tT(n,{key:o,value:s}),fI||(this.size=n.length),i.updateURL()},sort:function(){var e=HI(this);MI(e.entries,function(e,t){return e.key>t.key?1:-1}),e.updateURL()},forEach:function(e){for(var t,i=HI(this).entries,r=SI(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 vT(this,"keys")},values:function(){return new vT(this,"values")},entries:function(){return new vT(this,"entries")}},{enumerable:!0}),gI(bT,UI,bT.entries,{name:"entries"}),gI(bT,"toString",function(){return HI(this).serialize()},{enumerable:!0}),fI&&_I(bT,"size",{get:function(){return HI(this).entries.length},configurable:!0,enumerable:!0}),yI(ET,FI),cI({global:!0,constructor:!0,forced:!mI},{URLSearchParams:ET}),!mI&&II(GI)){var wT=pI(KI.has),IT=pI(KI.set),TT=function(e){if(kI(e)){var t,i=e.body;if(AI(i)===FI)return t=e.headers?new GI(e.headers):new GI,wT(t,"content-type")||IT(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),DI(e,{body:OI(0,CI(i)),headers:OI(0,t)})}return e};if(II(zI)&&cI({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return zI(e,arguments.length>1?TT(arguments[1]):{})}}),II(WI)){var ST=function(e){return wI(this,qI),new WI(e,arguments.length>1?TT(arguments[1]):{})};qI.constructor=ST,ST.prototype=qI,cI({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:ST})}}var AT,RT=en,kT=a,CT=rw,DT=i,OT=$l,LT=b,NT=Ji,PT=mn,xT=Es,MT=He,UT=gw,FT=function(e){var t=Cw(this),i=arguments.length,r=i>1?arguments[1]:void 0,n=void 0!==r;n&&(r=Tw(r,i>2?arguments[2]:void 0));var a,o,s,c,l,d,u=Aw(e),h=Pw(u),p=0;if(!h||this===Mw&&kw(h))for(a=Dw(u),o=t?new this(a):Mw(a);a>p;p++)d=n?r(u[p],p):u[p],Ow(o,p,d);else for(o=t?new this:[],l=(c=Nw(u,h)).next;!(s=Sw(l,c)).done;p++){d=n?Rw(c,r,[s.value,p],!0):s.value;try{Ow(o,p,d)}catch(OU){xw(c,"throw",OU)}}return Lw(o,p),o},BT=zs,VT=pg.codeAt,HT=function(e){var t,i,r=[],n=Zw(Xw(Jw(e),Vw,"."),".");for(t=0;t<n.length;t++)i=n[t],Yw(r,zw(Bw,i)?"xn--"+eI(i):i);return Kw(r,".")},jT=hn,zT=qa,WT=td,GT={URLSearchParams:ET,getState:HI},qT=ki,KT=qT.set,YT=qT.getterFor("URL"),XT=GT.URLSearchParams,ZT=GT.getState,JT=DT.URL,QT=DT.TypeError,$T=DT.encodeURIComponent,eS=DT.parseInt,tS=Math.floor,iS=Math.pow,rS=LT("".charAt),nS=LT(/./.exec),aS=LT([].join),oS=LT(1.1.toString),sS=LT([].pop),cS=LT([].push),lS=LT("".replace),dS=LT([].shift),uS=LT("".split),hS=LT("".slice),pS=LT("".toLowerCase),fS=LT([].unshift),mS="Invalid scheme",gS="Invalid host",_S="Invalid port",vS=/[a-z]/i,yS=/[\d+\-.a-z]/i,ES=/\d/,bS=/^0x/i,wS=/^[0-7]+$/,IS=/^\d+$/,TS=/^[\da-f]+$/i,SS=/[\0\t\n\r #%/:<>?@[\\\]^|]/,AS=/[\0\t\n\r #/:<>?@[\\\]^|]/,RS=/^[\u0000-\u0020]+/,kS=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,CS=/[\t\n\r]/g,DS=function(e){var t,i,r,n;if("number"==typeof e){for(t=[],i=0;i<4;i++)fS(t,e%256),e=tS(e/256);return aS(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,i=1,r=null,n=0,a=0;a<8;a++)0!==e[a]?(n>i&&(t=r,i=n),r=null,n=0):(null===r&&(r=a),++n);return n>i?r:t}(e),i=0;i<8;i++)n&&0===e[i]||(n&&(n=!1),r===i?(t+=i?":":"::",n=!0):(t+=oS(e[i],16),i<7&&(t+=":")));return"["+t+"]"}return e},OS={},LS=UT({},OS,{" ":1,'"':1,"#":1,"<":1,">":1}),NS=UT({},LS,{"'":1}),PS=UT({},OS,{" ":1,'"':1,"<":1,">":1,"`":1}),xS=UT({},PS,{"#":1,"?":1,"{":1,"}":1,"^":1}),MS=UT({},xS,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),US=function(e,t){var i=VT(e,0);return i>=32&&i<127&&!MT(t,e)?e:"'"===e&&MT(t,e)?"%27":$T(e)},FS={ftp:21,file:null,http:80,https:443,ws:80,wss:443},BS=function(e,t){var i;return 2===e.length&&nS(vS,rS(e,0))&&(":"===(i=rS(e,1))||!t&&"|"===i)},VS=function(e){var t;return e.length>1&&BS(hS(e,0,2))&&(2===e.length||"/"===(t=rS(e,2))||"\\"===t||"?"===t||"#"===t)},HS=function(e){return"."===e||"%2e"===pS(e)},jS=function(e){return".."===(e=pS(e))||"%2e."===e||".%2e"===e||"%2e%2e"===e},zS={},WS={},GS={},qS={},KS={},YS={},XS={},ZS={},JS={},QS={},$S={},eA={},tA={},iA={},rA={},nA={},aA={},oA={},sA={},cA={},lA={},dA=function(e,t,i){var r,n,a,o=jT(e);if(t){if(n=this.parse(o))throw new QT(n);this.searchParams=null}else{if(void 0!==i&&(r=new dA(i,!0)),n=this.parse(o,null,r))throw new QT(n);(a=ZT(new XT)).bindURL(this),this.searchParams=a}};dA.prototype={type:"URL",parse:function(e,t,i){var r,n,a,o,s=this,c=t||zS,l=0,d="",u=!1,h=!1,p=!1;for(e=jT(e),t||(s.scheme="",s.username="",s.password="",s.host=null,s.port=null,s.path=[],s.query=null,s.fragment=null,s.cannotBeABaseURL=!1,e=lS(e,RS,""),e=lS(e,kS,"$1")),e=lS(e,CS,""),r=FT(e);l<=r.length;){switch(n=r[l],c){case zS:if(!n||!nS(vS,n)){if(t)return mS;c=GS;continue}d+=pS(n),c=WS;break;case WS:if(n&&nS(yS,n))d+=pS(n);else{if(":"!==n){if(t)return mS;d="",c=GS,l=0;continue}if(t&&(s.isSpecial()!==MT(FS,d)||"file"===d&&(s.includesCredentials()||null!==s.port)||"file"===s.scheme&&""===s.host))return;if(s.scheme=d,t)return void(s.isSpecial()&&FS[s.scheme]===s.port&&(s.port=null));d="","file"===s.scheme?c=iA:s.isSpecial()&&i&&i.scheme===s.scheme?c=qS:s.isSpecial()?c=ZS:"/"===r[l+1]?(c=KS,l++):(s.cannotBeABaseURL=!0,cS(s.path,""),c=sA)}break;case GS:if(!i||i.cannotBeABaseURL&&"#"!==n)return mS;if(i.cannotBeABaseURL&&"#"===n){s.scheme=i.scheme,s.path=BT(i.path),s.query=i.query,s.fragment="",s.cannotBeABaseURL=!0,c=lA;break}c="file"===i.scheme?iA:YS;continue;case qS:if("/"!==n||"/"!==r[l+1]){c=YS;continue}c=JS,l++;break;case KS:if("/"===n){c=QS;break}c=oA;continue;case YS:if(s.scheme=i.scheme,n===AT)s.username=i.username,s.password=i.password,s.host=i.host,s.port=i.port,s.path=BT(i.path),s.query=i.query;else if("/"===n||"\\"===n&&s.isSpecial())c=XS;else if("?"===n)s.username=i.username,s.password=i.password,s.host=i.host,s.port=i.port,s.path=BT(i.path),s.query="",c=cA;else{if("#"!==n){s.username=i.username,s.password=i.password,s.host=i.host,s.port=i.port,s.path=BT(i.path),s.path.length&&s.path.length--,c=oA;continue}s.username=i.username,s.password=i.password,s.host=i.host,s.port=i.port,s.path=BT(i.path),s.query=i.query,s.fragment="",c=lA}break;case XS:if(!s.isSpecial()||"/"!==n&&"\\"!==n){if("/"!==n){s.username=i.username,s.password=i.password,s.host=i.host,s.port=i.port,c=oA;continue}c=QS}else c=JS;break;case ZS:if(c=JS,"/"!==n||"/"!==r[l+1])continue;l++;break;case JS:if("/"!==n&&"\\"!==n){c=QS;continue}break;case QS:if("@"===n){u&&(d="%40"+d),u=!0,a=FT(d);for(var f=0;f<a.length;f++){var m=a[f];if(":"!==m||p){var g=US(m,MS);p?s.password+=g:s.username+=g}else p=!0}d=""}else if(n===AT||"/"===n||"?"===n||"#"===n||"\\"===n&&s.isSpecial()){if(u&&""===d)return"Invalid authority";l-=FT(d).length+1,d="",c=$S}else d+=n;break;case $S:case eA:if(t&&"file"===s.scheme){c=nA;continue}if(":"!==n||h){if(n===AT||"/"===n||"?"===n||"#"===n||"\\"===n&&s.isSpecial()){if(s.isSpecial()&&""===d)return gS;if(t&&""===d&&(s.includesCredentials()||null!==s.port))return;if(o=s.parseHost(d))return o;if(d="",c=aA,t)return;continue}"["===n?h=!0:"]"===n&&(h=!1),d+=n}else{if(""===d)return gS;if(t===eA)return;if(o=s.parseHost(d))return o;d="",c=tA}break;case tA:if(!nS(ES,n)){if(n===AT||"/"===n||"?"===n||"#"===n||"\\"===n&&s.isSpecial()||t){if(""!==d){var _=eS(d,10);if(_>65535)return _S;s.port=s.isSpecial()&&_===FS[s.scheme]?null:_,d=""}if(t)return;c=aA;continue}return _S}d+=n;break;case iA:if(s.scheme="file",s.host="","/"===n||"\\"===n)c=rA;else{if(!i||"file"!==i.scheme){c=oA;continue}switch(n){case AT:s.host=i.host,s.path=BT(i.path),s.query=i.query;break;case"?":s.host=i.host,s.path=BT(i.path),s.query="",c=cA;break;case"#":s.host=i.host,s.path=BT(i.path),s.query=i.query,s.fragment="",c=lA;break;default:s.host=i.host,VS(aS(BT(r,l),""))||(s.path=BT(i.path),s.shortenPath()),c=oA;continue}}break;case rA:if("/"===n||"\\"===n){c=nA;break}i&&"file"===i.scheme&&(s.host=i.host,!VS(aS(BT(r,l),""))&&BS(i.path[0],!0)&&cS(s.path,i.path[0])),c=oA;continue;case nA:if(n===AT||"/"===n||"\\"===n||"?"===n||"#"===n){if(!t&&BS(d))c=oA;else if(""===d){if(s.host="",t)return;c=aA}else{if(o=s.parseHost(d))return o;if("localhost"===s.host&&(s.host=""),t)return;d="",c=aA}continue}d+=n;break;case aA:if(s.isSpecial()){if(c=oA,"/"!==n&&"\\"!==n)continue}else if(t||"?"!==n)if(t||"#"!==n){if(n!==AT&&(c=oA,"/"!==n))continue}else s.fragment="",c=lA;else s.query="",c=cA;break;case oA:if(n===AT||"/"===n||"\\"===n&&s.isSpecial()||!t&&("?"===n||"#"===n)){if(jS(d)?(s.shortenPath(),"/"===n||"\\"===n&&s.isSpecial()||cS(s.path,"")):HS(d)?"/"===n||"\\"===n&&s.isSpecial()||cS(s.path,""):("file"===s.scheme&&!s.path.length&&BS(d)&&(null!==s.host&&""!==s.host&&(s.host=""),d=rS(d,0)+":"),cS(s.path,d)),d="","file"===s.scheme&&(n===AT||"?"===n||"#"===n))for(;s.path.length>1&&""===s.path[0];)dS(s.path);"?"===n?(s.query="",c=cA):"#"===n&&(s.fragment="",c=lA)}else d+=US(n,xS);break;case sA:"?"===n?(s.query="",c=cA):"#"===n?(s.fragment="",c=lA):n!==AT&&(s.path[0]+=US(n,OS));break;case cA:t||"#"!==n?n!==AT&&(s.query+=US(n,s.isSpecial()?NS:LS)):(s.fragment="",c=lA);break;case lA:n!==AT&&(s.fragment+=US(n,PS))}l++}},parseHost:function(e){var t,i,r;if("["===rS(e,0)){if("]"!==rS(e,e.length-1))return gS;if(t=function(e){var t,i,r,n,a,o,s,c=[0,0,0,0,0,0,0,0],l=0,d=null,u=0,h=function(){return rS(e,u)};if(":"===h()){if(":"!==rS(e,1))return;u+=2,d=++l}for(;h();){if(8===l)return;if(":"!==h()){for(t=i=0;i<4&&nS(TS,h());)t=16*t+eS(h(),16),u++,i++;if("."===h()){if(0===i)return;if(u-=i,l>6)return;for(r=0;h();){if(n=null,r>0){if(!("."===h()&&r<4))return;u++}if(!nS(ES,h()))return;for(;nS(ES,h());){if(a=eS(h(),10),null===n)n=a;else{if(0===n)return;n=10*n+a}if(n>255)return;u++}c[l]=256*c[l]+n,2!==++r&&4!==r||l++}if(4!==r)return;break}if(":"===h()){if(u++,!h())return}else if(h())return;c[l++]=t}else{if(null!==d)return;u++,d=++l}}if(null!==d)for(o=l-d,l=7;0!==l&&o>0;)s=c[l],c[l--]=c[d+o-1],c[d+--o]=s;else if(8!==l)return;return c}(hS(e,1,-1)),!t)return gS;this.host=t}else if(this.isSpecial()){if(e=HT(e),nS(SS,e))return gS;if(function(e){var t,i,r=uS(e,".");if(""===r[r.length-1]){if(1===r.length)return!1;r.length--}return t=r[r.length-1],!!nS(IS,t)||!!nS(bS,t)&&(""===(i=hS(t,2))||!!nS(TS,i))}(e)){if(t=function(e){var t,i,r,n,a,o,s,c=uS(e,".");if(c.length&&""===c[c.length-1]&&c.length--,(t=c.length)>4)return null;for(i=[],r=0;r<t;r++){if(""===(n=c[r]))return null;if(a=10,n.length>1&&"0"===rS(n,0)&&(a=nS(bS,n)?16:8,n=hS(n,8===a?1:2)),""===n)o=0;else{if(!nS(10===a?IS:8===a?wS:TS,n))return null;o=eS(n,a)}cS(i,o)}for(r=0;r<t;r++)if(o=i[r],r===t-1){if(o>=iS(256,5-t))return null}else if(o>255)return null;for(s=sS(i),r=0;r<i.length;r++)s+=i[r]*iS(256,3-r);return s}(e),null===t)return gS;this.host=t}else this.host=e}else{if(nS(AS,e))return gS;for(t="",i=FT(e),r=0;r<i.length;r++)t+=US(i[r],OS);this.host=t}},cannotHaveUsernamePasswordPort:function(){return null===this.host||""===this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return MT(FS,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&BS(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,i=e.username,r=e.password,n=e.host,a=e.port,o=e.path,s=e.query,c=e.fragment,l=t+":";return null!==n?(l+="//",e.includesCredentials()&&(l+=i+(r?":"+r:"")+"@"),l+=DS(n),null!==a&&(l+=":"+a)):"file"===t&&(l+="//"),null===n&&!e.cannotBeABaseURL&&o.length>1&&""===o[0]&&(l+="/."),l+=e.cannotBeABaseURL?o[0]:o.length?"/"+aS(o,"/"):"",null!==s&&(l+="?"+s),null!==c&&(l+="#"+c),l},setHref:function(e){var t=this.parse(e);if(t)throw new QT(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new uA(this.path[0]).origin}catch(OU){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+DS(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(jT(e)+":",zS)},getUsername:function(){return this.username},setUsername:function(e){var t=FT(jT(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<t.length;i++)this.username+=US(t[i],MS)}},getPassword:function(){return this.password},setPassword:function(e){var t=FT(jT(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<t.length;i++)this.password+=US(t[i],MS)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?DS(e):DS(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,$S)},getHostname:function(){var e=this.host;return null===e?"":DS(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,eA)},getPort:function(){var e=this.port;return null===e?"":jT(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=jT(e))?this.port=null:this.parse(e,tA))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+aS(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,aA))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=jT(e))?this.query=null:("?"===rS(e,0)&&(e=hS(e,1)),this.query="",this.parse(e,cA)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=jT(e))?("#"===rS(e,0)&&(e=hS(e,1)),this.fragment="",this.parse(e,lA)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var uA=function(e){var t=xT(this,hA),i=WT(arguments.length,1)>1?arguments[1]:void 0,r=KT(t,new dA(e,!1,i));kT||(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())},hA=uA.prototype,pA=function(e,t){return{get:function(){return YT(this)[e]()},set:t&&function(e){return YT(this)[t](e)},configurable:!0,enumerable:!0}};if(kT&&(PT(hA,"href",pA("serialize","setHref")),PT(hA,"origin",pA("getOrigin")),PT(hA,"protocol",pA("getProtocol","setProtocol")),PT(hA,"username",pA("getUsername","setUsername")),PT(hA,"password",pA("getPassword","setPassword")),PT(hA,"host",pA("getHost","setHost")),PT(hA,"hostname",pA("getHostname","setHostname")),PT(hA,"port",pA("getPort","setPort")),PT(hA,"pathname",pA("getPathname","setPathname")),PT(hA,"search",pA("getSearch","setSearch")),PT(hA,"searchParams",pA("getSearchParams")),PT(hA,"hash",pA("getHash","setHash"))),NT(hA,"toJSON",function(){return YT(this).serialize()},{enumerable:!0}),NT(hA,"toString",function(){return YT(this).serialize()},{enumerable:!0}),JT){var fA=JT.createObjectURL,mA=JT.revokeObjectURL;fA&&NT(uA,"createObjectURL",OT(fA,JT)),mA&&NT(uA,"revokeObjectURL",OT(mA,JT))}zT(uA,"URL"),RT({global:!0,constructor:!0,forced:!CT,sham:!kT},{URL:uA});var gA=l;en({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return gA(URL.prototype.toString,this)}});var _A,vA,yA=Object.create,EA=Object.defineProperty,bA=Object.defineProperties,wA=Object.getOwnPropertyDescriptor,IA=Object.getOwnPropertyDescriptors,TA=Object.getOwnPropertyNames,SA=Object.getOwnPropertySymbols,AA=Object.getPrototypeOf,RA=Object.prototype.hasOwnProperty,kA=Object.prototype.propertyIsEnumerable,CA=(e,t,i)=>t in e?EA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,DA=(e,t)=>{for(var i in t||(t={}))RA.call(t,i)&&CA(e,i,t[i]);if(SA)for(var i of SA(t))kA.call(t,i)&&CA(e,i,t[i]);return e},OA=(e,t)=>bA(e,IA(t)),LA=(_A=function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')},"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(_A,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):_A),NA=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),PA=(e,t)=>{for(var i in t)EA(e,i,{get:t[i],enumerable:!0})},xA=(e,t,i)=>(i=null!=e?yA(AA(e)):{},((e,t,i,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of TA(t))!RA.call(e,n)&&n!==i&&EA(e,n,{get:()=>t[n],enumerable:!(r=wA(t,n))||r.enumerable});return e})(!t&&e&&e.__esModule?i:EA(i,"default",{value:e,enumerable:!0}),e)),MA=(e,t,i,r)=>{for(var n,a=r>1?void 0:r?wA(t,i):t,o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r?n(t,i,a):n(a))||a);return r&&a&&EA(t,i,a),a},UA=(e,t,i)=>CA(e,"symbol"!=typeof t?t+"":t,i),FA=NA((e,t)=>{!function(i){"object"==typeof e&&void 0!==t?t.exports=i():"function"==typeof define&&define.amd?define([],i):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JSZip=i()}(function(){return function e(t,i,r){function n(o,s){if(!i[o]){if(!t[o]){var c="function"==typeof LA&&LA;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var d=i[o]={exports:{}};t[o][0].call(d.exports,function(e){return n(t[o][1][e]||e)},d,d.exports,e,t,i,r)}return i[o].exports}for(var a="function"==typeof LA&&LA,o=0;o<r.length;o++)n(r[o]);return n}({1:[function(e,t,i){var r=e("./utils"),n=e("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(e){for(var t,i,n,o,s,c,l,d=[],u=0,h=e.length,p=h,f="string"!==r.getTypeOf(e);u<e.length;)p=h-u,n=f?(t=e[u++],i=u<h?e[u++]:0,u<h?e[u++]:0):(t=e.charCodeAt(u++),i=u<h?e.charCodeAt(u++):0,u<h?e.charCodeAt(u++):0),o=t>>2,s=(3&t)<<4|i>>4,c=1<p?(15&i)<<2|n>>6:64,l=2<p?63&n:64,d.push(a.charAt(o)+a.charAt(s)+a.charAt(c)+a.charAt(l));return d.join("")},i.decode=function(e){var t,i,r,o,s,c,l=0,d=0,u="data:";if(e.substr(0,5)===u)throw new Error("Invalid base64 input, it looks like a data url.");var h,p=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===a.charAt(64)&&p--,e.charAt(e.length-2)===a.charAt(64)&&p--,p%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=n.uint8array?new Uint8Array(0|p):new Array(0|p);l<e.length;)t=a.indexOf(e.charAt(l++))<<2|(o=a.indexOf(e.charAt(l++)))>>4,i=(15&o)<<4|(s=a.indexOf(e.charAt(l++)))>>2,r=(3&s)<<6|(c=a.indexOf(e.charAt(l++))),h[d++]=t,64!==s&&(h[d++]=i),64!==c&&(h[d++]=r);return h}},{"./support":30,"./utils":32}],2:[function(e,t,i){var r=e("./external"),n=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function s(e,t,i,r,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=r,this.compressedContent=n}s.prototype={getContentWorker:function(){var e=new n(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new n(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(e,t,i){return e.pipe(new a).pipe(new o("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){var r=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){var r=e("./utils"),n=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}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,i){var r=n,a=0+i;e^=-1;for(var o=0;o<a;o++)e=e>>>8^r[255&(e^t[o])];return-1^e}(0|t,e,e.length):function(e,t,i){var r=n,a=0+i;e^=-1;for(var o=0;o<a;o++)e=e>>>8^r[255&(e^t.charCodeAt(o))];return-1^e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){var r;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),a=e("./utils"),o=e("./stream/GenericWorker"),s=r?"uint8array":"array";function c(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}i.magic="\b\0",a.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},i.compressWorker=function(e){return new c("Deflate",e)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){function r(e,t){var i,r="";for(i=0;i<t;i++)r+=String.fromCharCode(255&e),e>>>=8;return r}function n(e,t,i,n,o,d){var u,h,p=e.file,f=e.compression,m=d!==s.utf8encode,g=a.transformTo("string",d(p.name)),_=a.transformTo("string",s.utf8encode(p.name)),v=p.comment,y=a.transformTo("string",d(v)),E=a.transformTo("string",s.utf8encode(v)),b=_.length!==p.name.length,w=E.length!==v.length,I="",T="",S="",A=p.dir,R=p.date,k={crc32:0,compressedSize:0,uncompressedSize:0};t&&!i||(k.crc32=e.crc32,k.compressedSize=e.compressedSize,k.uncompressedSize=e.uncompressedSize);var C=0;t&&(C|=8),m||!b&&!w||(C|=2048);var D,O,L,N=0,P=0;A&&(N|=16),"UNIX"===o?(P=798,N|=(D=p.unixPermissions,O=A,L=D,D||(L=O?16893:33204),(65535&L)<<16)):(P=20,N|=function(e){return 63&(e||0)}(p.dosPermissions)),u=R.getUTCHours(),u<<=6,u|=R.getUTCMinutes(),u<<=5,u|=R.getUTCSeconds()/2,h=R.getUTCFullYear()-1980,h<<=4,h|=R.getUTCMonth()+1,h<<=5,h|=R.getUTCDate(),b&&(T=r(1,1)+r(c(g),4)+_,I+="up"+r(T.length,2)+T),w&&(S=r(1,1)+r(c(y),4)+E,I+="uc"+r(S.length,2)+S);var x="";return x+="\n\0",x+=r(C,2),x+=f.magic,x+=r(u,2),x+=r(h,2),x+=r(k.crc32,4),x+=r(k.compressedSize,4),x+=r(k.uncompressedSize,4),x+=r(g.length,2),x+=r(I.length,2),{fileRecord:l.LOCAL_FILE_HEADER+x+g+I,dirRecord:l.CENTRAL_FILE_HEADER+r(P,2)+x+r(y.length,2)+"\0\0\0\0"+r(N,4)+r(n,4)+g+I+y}}var a=e("../utils"),o=e("../stream/GenericWorker"),s=e("../utf8"),c=e("../crc32"),l=e("../signature");function d(e,t,i,r){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(d,o),d.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-r-1))/i:100}}))},d.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(e){this.accumulate=!1;var t,i=this.streamFiles&&!e.file.dir,a=n(e,i,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(a.dirRecord),i)this.push({data:(t=e,l.DATA_DESCRIPTOR+r(t.crc32,4)+r(t.compressedSize,4)+r(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:a.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i,n,o,s,c,d,u=this.bytesWritten-e,h=(i=this.dirRecords.length,n=u,o=e,s=this.zipComment,c=this.encodeFileName,d=a.transformTo("string",c(s)),l.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(i,2)+r(i,2)+r(n,4)+r(o,4)+r(d.length,2)+d);this.push({data:h,meta:{percent:100}})},d.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},d.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},d.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},d.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch(r){}return!0},d.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=d},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,i){var r=e("../compressions"),n=e("./ZipFileWorker");i.generateWorker=function(e,t,i){var a=new n(t.streamFiles,i,t.platform,t.encodeFileName),o=0;try{e.forEach(function(e,i){o++;var n=function(e,t){var i=e||t,n=r[i];if(!n)throw new Error(i+" is not a valid compression method !");return n}(i.options.compression,t.compression),s=i.options.compressionOptions||t.compressionOptions||{},c=i.dir,l=i.date;i._compressWorker(n,s).withStreamInfo("file",{name:e,dir:c,date:l,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(a)}),a.entriesCount=o}catch(s){a.error(s)}return a}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new r;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.1",r.loadAsync=function(e,t){return(new r).loadAsync(e,t)},r.external=e("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){var r=e("./utils"),n=e("./external"),a=e("./utf8"),o=e("./zipEntries"),s=e("./stream/Crc32Probe"),c=e("./nodejsUtils");function l(e){return new n.Promise(function(t,i){var r=e.decompressed.getContentWorker().pipe(new s);r.on("error",function(e){i(e)}).on("end",function(){r.streamInfo.crc32!==e.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}t.exports=function(e,t){var i=this;return t=r.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),c.isNode&&c.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var i=new o(t);return i.load(e),i}).then(function(e){var i=[n.Promise.resolve(e)],r=e.files;if(t.checkCRC32)for(var a=0;a<r.length;a++)i.push(l(r[a]));return n.Promise.all(i)}).then(function(e){for(var n=e.shift(),a=n.files,o=0;o<a.length;o++){var s=a[o],c=s.fileNameStr,l=r.resolve(s.fileNameStr);i.file(l,s.decompressed,{binary:!0,optimizedBinaryString:!0,date:s.date,dir:s.dir,comment:s.fileCommentStr.length?s.fileCommentStr:null,unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions,createFolders:t.createFolders}),s.dir||(i.file(l).unsafeOriginalName=c)}return n.zipComment.length&&(i.comment=n.zipComment),i})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var r=e("../utils"),n=e("../stream/GenericWorker");function a(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}r.inherits(a,n),a.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},a.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var r=e("readable-stream").Readable;function n(e,t,i){r.call(this,t),this._helper=e;var n=this;e.on("data",function(e,t){n.push(e)||n._helper.pause(),i&&i(t)}).on("error",function(e){n.emit("error",e)}).on("end",function(){n.push(null)})}e("../utils").inherits(n,r),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,i){t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,i){function r(e,t,i){var r,n=a.getTypeOf(t),s=a.extend(i||{},c);s.date=s.date||new Date,null!==s.compression&&(s.compression=s.compression.toUpperCase()),"string"==typeof s.unixPermissions&&(s.unixPermissions=parseInt(s.unixPermissions,8)),s.unixPermissions&&16384&s.unixPermissions&&(s.dir=!0),s.dosPermissions&&16&s.dosPermissions&&(s.dir=!0),s.dir&&(e=m(e)),s.createFolders&&(r=f(e))&&g.call(this,r,!0);var u="string"===n&&!1===s.binary&&!1===s.base64;i&&void 0!==i.binary||(s.binary=!u),(t instanceof l&&0===t.uncompressedSize||s.dir||!t||0===t.length)&&(s.base64=!1,s.binary=!0,t="",s.compression="STORE",n="string");var _;_=t instanceof l||t instanceof o?t:h.isNode&&h.isStream(t)?new p(e,t):a.prepareContent(e,t,s.binary,s.optimizedBinaryString,s.base64);var v=new d(e,_,s);this.files[e]=v}var n=e("./utf8"),a=e("./utils"),o=e("./stream/GenericWorker"),s=e("./stream/StreamHelper"),c=e("./defaults"),l=e("./compressedObject"),d=e("./zipObject"),u=e("./generate"),h=e("./nodejsUtils"),p=e("./nodejs/NodejsStreamInputAdapter"),f=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},g=function(e,t){return t=void 0!==t?t:c.createFolders,e=m(e),this.files[e]||r.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function _(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var v={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,r;for(t in this.files)r=this.files[t],(i=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(i,r)},filter:function(e){var t=[];return this.forEach(function(i,r){e(i,r)&&t.push(r)}),t},file:function(e,t,i){if(1!==arguments.length)return e=this.root+e,r.call(this,e,t,i),this;if(_(e)){var n=e;return this.filter(function(e,t){return!t.dir&&n.test(e)})}var a=this.files[this.root+e];return a&&!a.dir?a:null},folder:function(e){if(!e)return this;if(_(e))return this.filter(function(t,i){return i.dir&&e.test(t)});var t=this.root+e,i=g.call(this,t),r=this.clone();return r.root=i.name,r},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var i=this.filter(function(t,i){return i.name.slice(0,e.length)===e}),r=0;r<i.length;r++)delete this.files[i[r].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,i={};try{if((i=a.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),"binarystring"===i.type&&(i.type="string"),!i.type)throw new Error("No output type specified.");a.checkSupport(i.type),"darwin"!==i.platform&&"freebsd"!==i.platform&&"linux"!==i.platform&&"sunos"!==i.platform||(i.platform="UNIX"),"win32"===i.platform&&(i.platform="DOS");var r=i.comment||this.comment||"";t=u.generateWorker(this,i,r)}catch(c){(t=new o("error")).error(c)}return new s(t,i.type||"string",i.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=v},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),n=e.charCodeAt(3),a=this.length-4;0<=a;--a)if(this.data[a]===t&&this.data[a+1]===i&&this.data[a+2]===r&&this.data[a+3]===n)return a-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),n=e.charCodeAt(3),a=this.readData(4);return t===a[0]&&i===a[1]&&r===a[2]&&n===a[3]},n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var r=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,i=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)i=(i<<8)+this.byteAt(t);return this.index+=e,i},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var r=e("./Uint8ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var r=e("./ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var r=e("../utils"),n=e("../support"),a=e("./ArrayReader"),o=e("./StringReader"),s=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new s(e):n.uint8array?new c(r.transformTo("uint8array",e)):new a(r.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,i){var r=e("./GenericWorker"),n=e("../utils");function a(e){r.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var r=e("./GenericWorker"),n=e("../crc32");function a(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,n),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(a,n),a.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=r},{}],29:[function(e,t,i){var r=e("../utils"),n=e("./ConvertWorker"),a=e("./GenericWorker"),o=e("../base64"),s=e("../support"),c=e("../external"),l=null;if(s.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(u){}function d(e,t,i){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=i,r.checkSupport(o),this._worker=e.pipe(new n(o)),e.lock()}catch(s){this._worker=new a("error"),this._worker.error(s)}}d.prototype={accumulate:function(e){return function(e,t){return new c.Promise(function(i,n){var a=[],s=e._internalType,c=e._outputType,l=e._mimeType;e.on("data",function(e,i){a.push(e),t&&t(i)}).on("error",function(e){a=[],n(e)}).on("end",function(){try{var e=function(e,t,i){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),i);case"base64":return o.encode(t);default:return r.transformTo(e,t)}}(c,function(e,t){var i,r=0,n=null,a=0;for(i=0;i<t.length;i++)a+=t[i].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(n=new Uint8Array(a),i=0;i<t.length;i++)n.set(t[i],r),r+=t[i].length;return n;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(s,a),l);i(e)}catch(t){n(t)}a=[]}).resume()})}(this,e)},on:function(e,t){var i=this;return"data"===e?this._worker.on(e,function(e){t.call(i,e.data,e.meta)}):this._worker.on(e,function(){r.delay(t,arguments,i)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(r.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,i.nodebuffer="undefined"!=typeof Buffer,i.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)i.blob=!1;else{var r=new ArrayBuffer(0);try{i.blob=0===new Blob([r],{type:"application/zip"}).size}catch(a){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(r),i.blob=0===n.getBlob("application/zip").size}catch(ZA){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(a){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var r=e("./utils"),n=e("./support"),a=e("./nodejsUtils"),o=e("./stream/GenericWorker"),s=new Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function l(){o.call(this,"utf-8 decode"),this.leftOver=null}function d(){o.call(this,"utf-8 encode")}s[254]=s[254]=1,i.utf8encode=function(e){return n.nodebuffer?a.newBufferFrom(e,"utf-8"):function(e){var t,i,r,a,o,s=e.length,c=0;for(a=0;a<s;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(r=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(r-56320),a++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=n.uint8array?new Uint8Array(c):new Array(c),a=o=0;o<c;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(r=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(r-56320),a++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t}(e)},i.utf8decode=function(e){return n.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,i,n,a,o=e.length,c=new Array(2*o);for(t=i=0;t<o;)if((n=e[t++])<128)c[i++]=n;else if(4<(a=s[n]))c[i++]=65533,t+=a-1;else{for(n&=2===a?31:3===a?15:7;1<a&&t<o;)n=n<<6|63&e[t++],a--;1<a?c[i++]=65533:n<65536?c[i++]=n:(n-=65536,c[i++]=55296|n>>10&1023,c[i++]=56320|1023&n)}return c.length!==i&&(c.subarray?c=c.subarray(0,i):c.length=i),r.applyFromCharCode(c)}(e=r.transformTo(n.uint8array?"uint8array":"array",e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+s[e[i]]>t?i:t}(t),c=t;o!==t.length&&(n.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:i.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=l,r.inherits(d,o),d.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=d},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){var r=e("./support"),n=e("./base64"),a=e("./nodejsUtils"),o=e("./external");function s(e){return e}function c(e,t){for(var i=0;i<e.length;++i)t[i]=255&e.charCodeAt(i);return t}e("setimmediate"),i.newBlob=function(e,t){i.checkSupport("blob");try{return new Blob([e],{type:t})}catch(n){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(e),r.getBlob(t)}catch(a){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(e,t,i){var r=[],n=0,a=e.length;if(a<=i)return String.fromCharCode.apply(null,e);for(;n<a;)"array"===t||"nodebuffer"===t?r.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+i,a)))):r.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+i,a)))),n+=i;return r.join("")},stringifyByChar:function(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&1===String.fromCharCode.apply(null,a.allocBuffer(1)).length}catch(e){return!1}}()}};function d(e){var t=65536,r=i.getTypeOf(e),n=!0;if("uint8array"===r?n=l.applyCanBeUsed.uint8array:"nodebuffer"===r&&(n=l.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return l.stringifyByChunk(e,r,t)}catch(a){t=Math.floor(t/2)}return l.stringifyByChar(e)}function u(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}i.applyFromCharCode=d;var h={};h.string={string:s,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return h.string.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:function(e){return c(e,a.allocBuffer(e.length))}},h.array={string:d,array:s,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return a.newBufferFrom(e)}},h.arraybuffer={string:function(e){return d(new Uint8Array(e))},array:function(e){return u(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:s,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return a.newBufferFrom(new Uint8Array(e))}},h.uint8array={string:d,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:s,nodebuffer:function(e){return a.newBufferFrom(e)}},h.nodebuffer={string:d,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return h.nodebuffer.uint8array(e).buffer},uint8array:function(e){return u(e,new Uint8Array(e.length))},nodebuffer:s},i.transformTo=function(e,t){if(t=t||"",!e)return t;i.checkSupport(e);var r=i.getTypeOf(t);return h[r][e](t)},i.resolve=function(e){for(var t=e.split("/"),i=[],r=0;r<t.length;r++){var n=t[r];"."===n||""===n&&0!==r&&r!==t.length-1||(".."===n?i.pop():i.push(n))}return i.join("/")},i.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":r.nodebuffer&&a.isBuffer(e)?"nodebuffer":r.uint8array&&e instanceof Uint8Array?"uint8array":r.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(e){if(!r[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(e){var t,i,r="";for(i=0;i<(e||"").length;i++)r+="\\x"+((t=e.charCodeAt(i))<16?"0":"")+t.toString(16).toUpperCase();return r},i.delay=function(e,t,i){setImmediate(function(){e.apply(i||null,t||[])})},i.inherits=function(e,t){function i(){}i.prototype=t.prototype,e.prototype=new i},i.extend=function(){var e,t,i={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===i[t]&&(i[t]=arguments[e][t]);return i},i.prepareContent=function(e,t,a,s,l){return o.Promise.resolve(t).then(function(e){return r.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise(function(t,i){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=function(e){i(e.target.error)},r.readAsArrayBuffer(e)}):e}).then(function(t){var d,u=i.getTypeOf(t);return u?("arraybuffer"===u?t=i.transformTo("uint8array",t):"string"===u&&(l?t=n.decode(t):a&&!0!==s&&(t=c(d=t,r.uint8array?new Uint8Array(d.length):new Array(d.length)))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),a=e("./signature"),o=e("./zipEntry"),s=e("./support");function c(e){this.files=[],this.loadOptions=e}c.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var i=this.reader.index;this.reader.setIndex(e);var r=this.reader.readString(4)===t;return this.reader.setIndex(i),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=s.uint8array?"uint8array":"array",i=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(i)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,i,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),i=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var r=t-i;if(0<r)this.isSignature(t,a.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=r(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),a=e("./compressedObject"),o=e("./crc32"),s=e("./utf8"),c=e("./compressions"),l=e("./support");function d(e,t){this.options=e,this.loadOptions=t}d.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in c)if(Object.prototype.hasOwnProperty.call(c,t)&&c[t].magic===e)return c[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,i,r,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),i=e.readInt(2),r=e.readData(i),this.extraFields[t]={id:t,length:i,value:r};e.setIndex(n)},handleUTF8:function(){var e=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=s.utf8decode(this.fileName),this.fileCommentStr=s.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var i=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var a=n.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(a)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=r(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:s.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=r(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:s.utf8decode(t.readData(e.length-5))}return null}},t.exports=d},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,i){function r(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}var n=e("./stream/StreamHelper"),a=e("./stream/DataWorker"),o=e("./utf8"),s=e("./compressedObject"),c=e("./stream/GenericWorker");r.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");var r="string"===(i=e.toLowerCase())||"text"===i;"binarystring"!==i&&"text"!==i||(i="string"),t=this._decompressWorker();var a=!this._dataBinary;a&&!r&&(t=t.pipe(new o.Utf8EncodeWorker)),!a&&r&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(s){(t=new c("error")).error(s)}return new n(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof s&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new o.Utf8EncodeWorker)),s.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof s?this._data.getContentWorker():this._data instanceof c?this._data:new a(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],d=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u<l.length;u++)r.prototype[l[u]]=d;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){var i,r,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var a=0,o=new n(d),s=e.document.createTextNode("");o.observe(s,{characterData:!0}),i=function(){s.data=a=++a%2}}else if(e.setImmediate||void 0===e.MessageChannel)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){d(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(d,0)};else{var c=new e.MessageChannel;c.port1.onmessage=d,i=function(){c.port2.postMessage(0)}}var l=[];function d(){var e,t;r=!0;for(var i=l.length;i;){for(t=l,l=[],e=-1;++e<i;)t[e]();i=l.length}r=!1}t.exports=function(e){1!==l.push(e)||r||i()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,i){var r=e("immediate");function n(){}var a={},o=["REJECTED"],s=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==n&&p(this,e)}function d(e,t,i){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function u(e,t,i){r(function(){var r;try{r=t(i)}catch(fL){return a.reject(e,fL)}r===e?a.reject(e,new TypeError("Cannot resolve promise with itself")):a.resolve(e,r)})}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var i=!1;function r(t){i||(i=!0,a.reject(e,t))}function n(t){i||(i=!0,a.resolve(e,t))}var o=f(function(){t(n,r)});"error"===o.status&&r(o.value)}function f(e,t){var i={};try{i.value=e(t),i.status="success"}catch(r){i.status="error",i.value=r}return i}(t.exports=l).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(i){return t.resolve(e()).then(function(){return i})},function(i){return t.resolve(e()).then(function(){throw i})})},l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===o)return this;var i=new this.constructor(n);return this.state!==c?u(i,this.state===s?e:t,this.outcome):this.queue.push(new d(i,e,t)),i},d.prototype.callFulfilled=function(e){a.resolve(this.promise,e)},d.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},d.prototype.callRejected=function(e){a.reject(this.promise,e)},d.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},a.resolve=function(e,t){var i=f(h,t);if("error"===i.status)return a.reject(e,i.value);var r=i.value;if(r)p(e,r);else{e.state=s,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},a.reject=function(e,t){e.state=o,e.outcome=t;for(var i=-1,r=e.queue.length;++i<r;)e.queue[i].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:a.resolve(new this(n),e)},l.reject=function(e){var t=new this(n);return a.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,r=!1;if(!i)return this.resolve([]);for(var o=new Array(i),s=0,c=-1,l=new this(n);++c<i;)d(e[c],c);return l;function d(e,n){t.resolve(e).then(function(e){o[n]=e,++s!==i||r||(r=!0,a.resolve(l,o))},function(e){r||(r=!0,a.reject(l,e))})}},l.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t,i=e.length,r=!1;if(!i)return this.resolve([]);for(var o=-1,s=new this(n);++o<i;)t=e[o],this.resolve(t).then(function(e){r||(r=!0,a.resolve(s,e))},function(e){r||(r=!0,a.reject(s,e))});return s}},{immediate:36}],38:[function(e,t,i){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){var r=e("./zlib/deflate"),n=e("./utils/common"),a=e("./utils/strings"),o=e("./zlib/messages"),s=e("./zlib/zstream"),c=Object.prototype.toString;function l(e){if(!(this instanceof l))return new l(e);this.options=n.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var i=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(o[i]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var d;if(d="string"==typeof t.dictionary?a.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=r.deflateSetDictionary(this.strm,d)))throw new Error(o[i]);this._dict_set=!0}}function d(e,t){var i=new l(t);if(i.push(e,!0),i.err)throw i.msg||o[i.err];return i.result}l.prototype.push=function(e,t){var i,o,s=this.strm,l=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?s.input=a.string2buf(e):"[object ArrayBuffer]"===c.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 n.Buf8(l),s.next_out=0,s.avail_out=l),1!==(i=r.deflate(s,o))&&0!==i)return this.onEnd(i),!(this.ended=!0);0!==s.avail_out&&(0!==s.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(a.buf2binstring(n.shrinkBuf(s.output,s.next_out))):this.onData(n.shrinkBuf(s.output,s.next_out)))}while((0<s.avail_in||0===s.avail_out)&&1!==i);return 4===o?(i=r.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==o||(this.onEnd(0),!(s.avail_out=0))},l.prototype.onData=function(e){this.chunks.push(e)},l.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Deflate=l,i.deflate=d,i.deflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},i.gzip=function(e,t){return(t=t||{}).gzip=!0,d(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){var r=e("./zlib/inflate"),n=e("./utils/common"),a=e("./utils/strings"),o=e("./zlib/constants"),s=e("./zlib/messages"),c=e("./zlib/zstream"),l=e("./zlib/gzheader"),d=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var i=r.inflateInit2(this.strm,t.windowBits);if(i!==o.Z_OK)throw new Error(s[i]);this.header=new l,r.inflateGetHeader(this.strm,this.header)}function h(e,t){var i=new u(t);if(i.push(e,!0),i.err)throw i.msg||s[i.err];return i.result}u.prototype.push=function(e,t){var i,s,c,l,u,h,p=this.strm,f=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;s=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?p.input=a.binstring2buf(e):"[object ArrayBuffer]"===d.call(e)?p.input=new Uint8Array(e):p.input=e,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new n.Buf8(f),p.next_out=0,p.avail_out=f),(i=r.inflate(p,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&m&&(h="string"==typeof m?a.string2buf(m):"[object ArrayBuffer]"===d.call(m)?new Uint8Array(m):m,i=r.inflateSetDictionary(this.strm,h)),i===o.Z_BUF_ERROR&&!0===g&&(i=o.Z_OK,g=!1),i!==o.Z_STREAM_END&&i!==o.Z_OK)return this.onEnd(i),!(this.ended=!0);p.next_out&&(0!==p.avail_out&&i!==o.Z_STREAM_END&&(0!==p.avail_in||s!==o.Z_FINISH&&s!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(c=a.utf8border(p.output,p.next_out),l=p.next_out-c,u=a.buf2string(p.output,c),p.next_out=l,p.avail_out=f-l,l&&n.arraySet(p.output,p.output,c,l,0),this.onData(u)):this.onData(n.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(g=!0)}while((0<p.avail_in||0===p.avail_out)&&i!==o.Z_STREAM_END);return i===o.Z_STREAM_END&&(s=o.Z_FINISH),s===o.Z_FINISH?(i=r.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===o.Z_OK):s!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(p.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=u,i.inflate=h,i.inflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},i.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+r),n);else for(var a=0;a<r;a++)e[n+a]=t[i+a]},flattenChunks:function(e){var t,i,r,n,a,o;for(t=r=0,i=e.length;t<i;t++)r+=e[t].length;for(o=new Uint8Array(r),t=n=0,i=e.length;t<i;t++)a=e[t],o.set(a,n),n+=a.length;return o}},a={arraySet:function(e,t,i,r,n){for(var a=0;a<r;a++)e[n+a]=t[i+a]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,a))},i.setTyped(r)},{}],42:[function(e,t,i){var r=e("./common"),n=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(l){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(l){a=!1}for(var o=new r.Buf8(256),s=0;s<256;s++)o[s]=252<=s?6:248<=s?5:240<=s?4:224<=s?3:192<=s?2:1;function c(e,t){if(t<65537&&(e.subarray&&a||!e.subarray&&n))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var i="",o=0;o<t;o++)i+=String.fromCharCode(e[o]);return i}o[254]=o[254]=1,i.string2buf=function(e){var t,i,n,a,o,s=e.length,c=0;for(a=0;a<s;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(n=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(n-56320),a++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=new r.Buf8(c),a=o=0;o<c;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(n=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(n-56320),a++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t},i.buf2binstring=function(e){return c(e,e.length)},i.binstring2buf=function(e){for(var t=new r.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){var i,r,n,a,s=t||e.length,l=new Array(2*s);for(i=r=0;i<s;)if((n=e[i++])<128)l[r++]=n;else if(4<(a=o[n]))l[r++]=65533,i+=a-1;else{for(n&=2===a?31:3===a?15:7;1<a&&i<s;)n=n<<6|63&e[i++],a--;1<a?l[r++]=65533:n<65536?l[r++]=n:(n-=65536,l[r++]=55296|n>>10&1023,l[r++]=56320|1023&n)}return c(l,r)},i.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+o[e[i]]>t?i:t}},{"./common":41}],43:[function(e,t,i){t.exports=function(e,t,i,r){for(var n=65535&e,a=e>>>16&65535,o=0;0!==i;){for(i-=o=2e3<i?2e3:i;a=a+(n=n+t[r++]|0)|0,--o;);n%=65521,a%=65521}return n|a<<16}},{}],44:[function(e,t,i){t.exports={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}},{}],45:[function(e,t,i){var r=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}();t.exports=function(e,t,i,n){var a=r,o=n+i;e^=-1;for(var s=n;s<o;s++)e=e>>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,i){var r,n=e("../utils/common"),a=e("./trees"),o=e("./adler32"),s=e("./crc32"),c=e("./messages"),l=-2,d=258,u=262,h=113;function p(e,t){return e.msg=c[t],t}function f(e){return(e<<1)-(4<e?9:0)}function m(e){for(var t=e.length;0<=--t;)e[t]=0}function g(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(n.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 _(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,g(e.strm)}function v(e,t){e.pending_buf[e.pending++]=t}function y(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function E(e,t){var i,r,n=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-u?e.strstart-(e.w_size-u):0,l=e.window,h=e.w_mask,p=e.prev,f=e.strstart+d,m=l[a+o-1],g=l[a+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(l[(i=t)+o]===g&&l[i+o-1]===m&&l[i]===l[a]&&l[++i]===l[a+1]){a+=2,i++;do{}while(l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&a<f);if(r=d-(f-a),a=f-d,o<r){if(e.match_start=t,s<=(o=r))break;m=l[a+o-1],g=l[a+o]}}}while((t=p[t&h])>c&&0!=--n);return o<=e.lookahead?o:e.lookahead}function b(e){var t,i,r,a,c,l,d,h,p,f,m=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-u)){for(n.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=i=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--i;);for(t=i=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--i;);a+=m}if(0===e.strm.avail_in)break;if(l=e.strm,d=e.window,h=e.strstart+e.lookahead,f=void 0,(p=a)<(f=l.avail_in)&&(f=p),i=0===f?0:(l.avail_in-=f,n.arraySet(d,l.input,l.next_in,f,h),1===l.state.wrap?l.adler=o(l.adler,d,f,h):2===l.state.wrap&&(l.adler=s(l.adler,d,f,h)),l.next_in+=f,l.total_in+=f,f),e.lookahead+=i,e.lookahead+e.insert>=3)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+3-1])&e.hash_mask,e.prev[c&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=c,c++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<u&&0!==e.strm.avail_in)}function w(e,t){for(var i,r;;){if(e.lookahead<u){if(b(e),e.lookahead<u&&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-u&&(e.match_length=E(e,i)),e.match_length>=3)if(r=a._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){for(e.match_length--;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,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=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(_(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(_(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_(e,!1),0===e.strm.avail_out)?1:2}function I(e,t){for(var i,r,n;;){if(e.lookahead<u){if(b(e),e.lookahead<u&&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-u&&(e.match_length=E(e,i),e.match_length<=5&&(1===e.strategy||3===e.match_length&&4096<e.strstart-e.match_start)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-3,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++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),0!=--e.prev_length;);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(_(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=a._tr_tally(e,0,e.window[e.strstart-1]))&&_(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=a._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(_(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_(e,!1),0===e.strm.avail_out)?1:2}function T(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 S(){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 n.Buf16(1146),this.dyn_dtree=new n.Buf16(122),this.bl_tree=new n.Buf16(78),m(this.dyn_ltree),m(this.dyn_dtree),m(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(16),this.heap=new n.Buf16(573),m(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(573),m(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function A(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:h,e.adler=2===t.wrap?0:1,t.last_flush=0,a._tr_init(t),0):p(e,l)}function R(e){var t,i=A(e);return 0===i&&((t=e.state).window_size=2*t.w_size,m(t.head),t.max_lazy_match=r[t.level].max_lazy,t.good_match=r[t.level].good_length,t.nice_match=r[t.level].nice_length,t.max_chain_length=r[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 k(e,t,i,r,a,o){if(!e)return l;var s=1;if(-1===t&&(t=6),r<0?(s=0,r=-r):15<r&&(s=2,r-=16),a<1||9<a||8!==i||r<8||15<r||t<0||9<t||o<0||4<o)return p(e,l);8===r&&(r=9);var c=new S;return(e.state=c).strm=e,c.wrap=s,c.gzhead=null,c.w_bits=r,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=a+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+3-1)/3),c.window=new n.Buf8(2*c.w_size),c.head=new n.Buf16(c.hash_size),c.prev=new n.Buf16(c.w_size),c.lit_bufsize=1<<a+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new n.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=t,c.strategy=o,c.method=i,R(e)}r=[new T(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(b(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,_(e,!1),0===e.strm.avail_out)||e.strstart-e.block_start>=e.w_size-u&&(_(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(_(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(_(e,!1),e.strm.avail_out),1)}),new T(4,4,8,4,w),new T(4,5,16,8,w),new T(4,6,32,32,w),new T(4,4,16,16,I),new T(8,16,32,32,I),new T(8,16,128,128,I),new T(8,32,128,256,I),new T(32,128,258,1024,I),new T(32,258,258,4096,I)],i.deflateInit=function(e,t){return k(e,t,8,15,8,0)},i.deflateInit2=k,i.deflateReset=R,i.deflateResetKeep=A,i.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?l:(e.state.gzhead=t,0):l},i.deflate=function(e,t){var i,n,o,c;if(!e||!e.state||5<t||t<0)return e?p(e,l):l;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&4!==t)return p(e,0===e.avail_out?-5:l);if(n.strm=e,i=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,v(n,31),v(n,139),v(n,8),n.gzhead?(v(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),v(n,255&n.gzhead.time),v(n,n.gzhead.time>>8&255),v(n,n.gzhead.time>>16&255),v(n,n.gzhead.time>>24&255),v(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),v(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(v(n,255&n.gzhead.extra.length),v(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=s(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(v(n,0),v(n,0),v(n,0),v(n,0),v(n,0),v(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),v(n,3),n.status=h);else{var u=8+(n.w_bits-8<<4)<<8;u|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(u|=32),u+=31-u%31,n.status=h,y(n,u),0!==n.strstart&&(y(n,e.adler>>>16),y(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending!==n.pending_buf_size));)v(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,v(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,v(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&g(e),n.pending+2<=n.pending_buf_size&&(v(n,255&e.adler),v(n,e.adler>>8&255),e.adler=0,n.status=h)):n.status=h),0!==n.pending){if(g(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&f(t)<=f(i)&&4!==t)return p(e,-5);if(666===n.status&&0!==e.avail_in)return p(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var E=2===n.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(b(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(_(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(_(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var i,r,n,o,s=e.window;;){if(e.lookahead<=d){if(b(e),e.lookahead<=d&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0<e.strstart&&(r=s[n=e.strstart-1])===s[++n]&&r===s[++n]&&r===s[++n]){o=e.strstart+d;do{}while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&n<o);e.match_length=d-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=a._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(_(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(_(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_(e,!1),0===e.strm.avail_out)?1:2}(n,t):r[n.level].func(n,t);if(3!==E&&4!==E||(n.status=666),1===E||3===E)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===E&&(1===t?a._tr_align(n):5!==t&&(a._tr_stored_block(n,0,0,!1),3===t&&(m(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),g(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(v(n,255&e.adler),v(n,e.adler>>8&255),v(n,e.adler>>16&255),v(n,e.adler>>24&255),v(n,255&e.total_in),v(n,e.total_in>>8&255),v(n,e.total_in>>16&255),v(n,e.total_in>>24&255)):(y(n,e.adler>>>16),y(n,65535&e.adler)),g(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?0:1)},i.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&t!==h&&666!==t?p(e,l):(e.state=null,t===h?p(e,-3):0):l},i.deflateSetDictionary=function(e,t){var i,r,a,s,c,d,u,h,p=t.length;if(!e||!e.state||2===(s=(i=e.state).wrap)||1===s&&42!==i.status||i.lookahead)return l;for(1===s&&(e.adler=o(e.adler,t,p,0)),i.wrap=0,p>=i.w_size&&(0===s&&(m(i.head),i.strstart=0,i.block_start=0,i.insert=0),h=new n.Buf8(i.w_size),n.arraySet(h,t,p-i.w_size,i.w_size,0),t=h,p=i.w_size),c=e.avail_in,d=e.next_in,u=e.input,e.avail_in=p,e.next_in=0,e.input=t,b(i);i.lookahead>=3;){for(r=i.strstart,a=i.lookahead-2;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++,--a;);i.strstart=r,i.lookahead=2,b(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=d,e.input=u,e.avail_in=c,i.wrap=s,0},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){t.exports=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}},{}],48:[function(e,t,i){t.exports=function(e,t){var i,r,n,a,o,s,c,l,d,u,h,p,f,m,g,_,v,y,E,b,w,I,T,S,A;i=e.state,r=e.next_in,S=e.input,n=r+(e.avail_in-5),a=e.next_out,A=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=i.dmax,l=i.wsize,d=i.whave,u=i.wnext,h=i.window,p=i.hold,f=i.bits,m=i.lencode,g=i.distcode,_=(1<<i.lenbits)-1,v=(1<<i.distbits)-1;e:do{f<15&&(p+=S[r++]<<f,f+=8,p+=S[r++]<<f,f+=8),y=m[p&_];t:for(;;){if(p>>>=E=y>>>24,f-=E,0==(E=y>>>16&255))A[a++]=65535&y;else{if(!(16&E)){if(!(64&E)){y=m[(65535&y)+(p&(1<<E)-1)];continue t}if(32&E){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}b=65535&y,(E&=15)&&(f<E&&(p+=S[r++]<<f,f+=8),b+=p&(1<<E)-1,p>>>=E,f-=E),f<15&&(p+=S[r++]<<f,f+=8,p+=S[r++]<<f,f+=8),y=g[p&v];i:for(;;){if(p>>>=E=y>>>24,f-=E,!(16&(E=y>>>16&255))){if(!(64&E)){y=g[(65535&y)+(p&(1<<E)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(w=65535&y,f<(E&=15)&&(p+=S[r++]<<f,(f+=8)<E&&(p+=S[r++]<<f,f+=8)),c<(w+=p&(1<<E)-1)){e.msg="invalid distance too far back",i.mode=30;break e}if(p>>>=E,f-=E,(E=a-o)<w){if(d<(E=w-E)&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(T=h,(I=0)===u){if(I+=l-E,E<b){for(b-=E;A[a++]=h[I++],--E;);I=a-w,T=A}}else if(u<E){if(I+=l+u-E,(E-=u)<b){for(b-=E;A[a++]=h[I++],--E;);if(I=0,u<b){for(b-=E=u;A[a++]=h[I++],--E;);I=a-w,T=A}}}else if(I+=u-E,E<b){for(b-=E;A[a++]=h[I++],--E;);I=a-w,T=A}for(;2<b;)A[a++]=T[I++],A[a++]=T[I++],A[a++]=T[I++],b-=3;b&&(A[a++]=T[I++],1<b&&(A[a++]=T[I++]))}else{for(I=a-w;A[a++]=A[I++],A[a++]=A[I++],A[a++]=A[I++],2<(b-=3););b&&(A[a++]=A[I++],1<b&&(A[a++]=A[I++]))}break}}break}}while(r<n&&a<s);r-=b=f>>3,p&=(1<<(f-=b<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=a<s?s-a+257:257-(a-s),i.hold=p,i.bits=f}},{}],49:[function(e,t,i){var r=e("../utils/common"),n=e("./adler32"),a=e("./crc32"),o=e("./inffast"),s=e("./inftrees"),c=-2;function l(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function d(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function u(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 r.Buf32(852),t.distcode=t.distdyn=new r.Buf32(592),t.sane=1,t.back=-1,0):c}function h(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,u(e)):c}function p(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||15<t)?c:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,h(e))):c}function f(e,t){var i,r;return e?(r=new d,(e.state=r).window=null,0!==(i=p(e,t))&&(e.state=null),i):c}var m,g,_=!0;function v(e){if(_){var t;for(m=new r.Buf32(512),g=new r.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(s(1,e.lens,0,288,m,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(2,e.lens,0,32,g,0,e.work,{bits:5}),_=!1}e.lencode=m,e.lenbits=9,e.distcode=g,e.distbits=5}function y(e,t,i,n){var a,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new r.Buf8(o.wsize)),n>=o.wsize?(r.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(a=o.wsize-o.wnext)&&(a=n),r.arraySet(o.window,t,i-n,a,o.wnext),(n-=a)?(r.arraySet(o.window,t,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=a))),0}i.inflateReset=h,i.inflateReset2=p,i.inflateResetKeep=u,i.inflateInit=function(e){return f(e,15)},i.inflateInit2=f,i.inflate=function(e,t){var i,d,u,h,p,f,m,g,_,E,b,w,I,T,S,A,R,k,C,D,O,L,N,P,x=0,M=new r.Buf8(4),U=[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 c;12===(i=e.state).mode&&(i.mode=13),p=e.next_out,u=e.output,m=e.avail_out,h=e.next_in,d=e.input,f=e.avail_in,g=i.hold,_=i.bits,E=f,b=m,L=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;_<16;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(2&i.wrap&&35615===g){M[i.check=0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0),_=g=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&g)<<8)+(g>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&g)){e.msg="unknown compression method",i.mode=30;break}if(_-=4,O=8+(15&(g>>>=4)),0===i.wbits)i.wbits=O;else if(O>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<O,e.adler=i.check=1,i.mode=512&g?10:12,_=g=0;break;case 2:for(;_<16;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(i.flags=g,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=g>>8&1),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0)),_=g=0,i.mode=3;case 3:for(;_<32;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}i.head&&(i.head.time=g),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,M[2]=g>>>16&255,M[3]=g>>>24&255,i.check=a(i.check,M,4,0)),_=g=0,i.mode=4;case 4:for(;_<16;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}i.head&&(i.head.xflags=255&g,i.head.os=g>>8),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0)),_=g=0,i.mode=5;case 5:if(1024&i.flags){for(;_<16;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}i.length=g,i.head&&(i.head.extra_len=g),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0)),_=g=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(f<(w=i.length)&&(w=f),w&&(i.head&&(O=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),r.arraySet(i.head.extra,d,h,w,O)),512&i.flags&&(i.check=a(i.check,d,w,h)),f-=w,h+=w,i.length-=w),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===f)break e;for(w=0;O=d[h+w++],i.head&&O&&i.length<65536&&(i.head.name+=String.fromCharCode(O)),O&&w<f;);if(512&i.flags&&(i.check=a(i.check,d,w,h)),f-=w,h+=w,O)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===f)break e;for(w=0;O=d[h+w++],i.head&&O&&i.length<65536&&(i.head.comment+=String.fromCharCode(O)),O&&w<f;);if(512&i.flags&&(i.check=a(i.check,d,w,h)),f-=w,h+=w,O)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;_<16;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(g!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}_=g=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(;_<32;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}e.adler=i.check=l(g),_=g=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,i.hold=g,i.bits=_,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){g>>>=7&_,_-=7&_,i.mode=27;break}for(;_<3;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}switch(i.last=1&g,_-=1,3&(g>>>=1)){case 0:i.mode=14;break;case 1:if(v(i),i.mode=20,6!==t)break;g>>>=2,_-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}g>>>=2,_-=2;break;case 14:for(g>>>=7&_,_-=7&_;_<32;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if((65535&g)!=(g>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&g,_=g=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(w=i.length){if(f<w&&(w=f),m<w&&(w=m),0===w)break e;r.arraySet(u,d,h,w,p),f-=w,h+=w,m-=w,p+=w,i.length-=w;break}i.mode=12;break;case 17:for(;_<14;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(i.nlen=257+(31&g),g>>>=5,_-=5,i.ndist=1+(31&g),g>>>=5,_-=5,i.ncode=4+(15&g),g>>>=4,_-=4,286<i.nlen||30<i.ndist){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(;_<3;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}i.lens[U[i.have++]]=7&g,g>>>=3,_-=3}for(;i.have<19;)i.lens[U[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,N={bits:i.lenbits},L=s(0,i.lens,0,19,i.lencode,0,i.work,N),i.lenbits=N.bits,L){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(;A=(x=i.lencode[g&(1<<i.lenbits)-1])>>>16&255,R=65535&x,!((S=x>>>24)<=_);){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(R<16)g>>>=S,_-=S,i.lens[i.have++]=R;else{if(16===R){for(P=S+2;_<P;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(g>>>=S,_-=S,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}O=i.lens[i.have-1],w=3+(3&g),g>>>=2,_-=2}else if(17===R){for(P=S+3;_<P;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}_-=S,O=0,w=3+(7&(g>>>=S)),g>>>=3,_-=3}else{for(P=S+7;_<P;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}_-=S,O=0,w=11+(127&(g>>>=S)),g>>>=7,_-=7}if(i.have+w>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;w--;)i.lens[i.have++]=O}}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,N={bits:i.lenbits},L=s(1,i.lens,0,i.nlen,i.lencode,0,i.work,N),i.lenbits=N.bits,L){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,N={bits:i.distbits},L=s(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,N),i.distbits=N.bits,L){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(6<=f&&258<=m){e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,i.hold=g,i.bits=_,o(e,b),p=e.next_out,u=e.output,m=e.avail_out,h=e.next_in,d=e.input,f=e.avail_in,g=i.hold,_=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;A=(x=i.lencode[g&(1<<i.lenbits)-1])>>>16&255,R=65535&x,!((S=x>>>24)<=_);){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(A&&!(240&A)){for(k=S,C=A,D=R;A=(x=i.lencode[D+((g&(1<<k+C)-1)>>k)])>>>16&255,R=65535&x,!(k+(S=x>>>24)<=_);){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}g>>>=k,_-=k,i.back+=k}if(g>>>=S,_-=S,i.back+=S,i.length=R,0===A){i.mode=26;break}if(32&A){i.back=-1,i.mode=12;break}if(64&A){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&A,i.mode=22;case 22:if(i.extra){for(P=i.extra;_<P;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}i.length+=g&(1<<i.extra)-1,g>>>=i.extra,_-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;A=(x=i.distcode[g&(1<<i.distbits)-1])>>>16&255,R=65535&x,!((S=x>>>24)<=_);){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(!(240&A)){for(k=S,C=A,D=R;A=(x=i.distcode[D+((g&(1<<k+C)-1)>>k)])>>>16&255,R=65535&x,!(k+(S=x>>>24)<=_);){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}g>>>=k,_-=k,i.back+=k}if(g>>>=S,_-=S,i.back+=S,64&A){e.msg="invalid distance code",i.mode=30;break}i.offset=R,i.extra=15&A,i.mode=24;case 24:if(i.extra){for(P=i.extra;_<P;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}i.offset+=g&(1<<i.extra)-1,g>>>=i.extra,_-=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===m)break e;if(w=b-m,i.offset>w){if((w=i.offset-w)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}I=w>i.wnext?(w-=i.wnext,i.wsize-w):i.wnext-w,w>i.length&&(w=i.length),T=i.window}else T=u,I=p-i.offset,w=i.length;for(m<w&&(w=m),m-=w,i.length-=w;u[p++]=T[I++],--w;);0===i.length&&(i.mode=21);break;case 26:if(0===m)break e;u[p++]=i.length,m--,i.mode=21;break;case 27:if(i.wrap){for(;_<32;){if(0===f)break e;f--,g|=d[h++]<<_,_+=8}if(b-=m,e.total_out+=b,i.total+=b,b&&(e.adler=i.check=i.flags?a(i.check,u,b,p-b):n(i.check,u,b,p-b)),b=m,(i.flags?g:l(g))!==i.check){e.msg="incorrect data check",i.mode=30;break}_=g=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;_<32;){if(0===f)break e;f--,g+=d[h++]<<_,_+=8}if(g!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}_=g=0}i.mode=29;case 29:L=1;break e;case 30:L=-3;break e;case 31:return-4;default:return c}return e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,i.hold=g,i.bits=_,(i.wsize||b!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&y(e,e.output,e.next_out,b-e.avail_out)?(i.mode=31,-4):(E-=e.avail_in,b-=e.avail_out,e.total_in+=E,e.total_out+=b,i.total+=b,i.wrap&&b&&(e.adler=i.check=i.flags?a(i.check,u,b,e.next_out-b):n(i.check,u,b,e.next_out-b)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0==E&&0===b||4===t)&&0===L&&(L=-5),L)},i.inflateEnd=function(e){if(!e||!e.state)return c;var t=e.state;return t.window&&(t.window=null),e.state=null,0},i.inflateGetHeader=function(e,t){var i;return e&&e.state&&2&(i=e.state).wrap?((i.head=t).done=!1,0):c},i.inflateSetDictionary=function(e,t){var i,r=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?c:11===i.mode&&n(1,t,r,0)!==i.check?-3:y(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,0):c},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){var r=e("../utils/common"),n=[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],a=[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],o=[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],s=[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];t.exports=function(e,t,i,c,l,d,u,h){var p,f,m,g,_,v,y,E,b,w=h.bits,I=0,T=0,S=0,A=0,R=0,k=0,C=0,D=0,O=0,L=0,N=null,P=0,x=new r.Buf16(16),M=new r.Buf16(16),U=null,F=0;for(I=0;I<=15;I++)x[I]=0;for(T=0;T<c;T++)x[t[i+T]]++;for(R=w,A=15;1<=A&&0===x[A];A--);if(A<R&&(R=A),0===A)return l[d++]=20971520,l[d++]=20971520,h.bits=1,0;for(S=1;S<A&&0===x[S];S++);for(R<S&&(R=S),I=D=1;I<=15;I++)if(D<<=1,(D-=x[I])<0)return-1;if(0<D&&(0===e||1!==A))return-1;for(M[1]=0,I=1;I<15;I++)M[I+1]=M[I]+x[I];for(T=0;T<c;T++)0!==t[i+T]&&(u[M[t[i+T]]++]=T);if(v=0===e?(N=U=u,19):1===e?(N=n,P-=257,U=a,F-=257,256):(N=o,U=s,-1),I=S,_=d,C=T=L=0,m=-1,g=(O=1<<(k=R))-1,1===e&&852<O||2===e&&592<O)return 1;for(;;){for(y=I-C,b=u[T]<v?(E=0,u[T]):u[T]>v?(E=U[F+u[T]],N[P+u[T]]):(E=96,0),p=1<<I-C,S=f=1<<k;l[_+(L>>C)+(f-=p)]=y<<24|E<<16|b,0!==f;);for(p=1<<I-1;L&p;)p>>=1;if(0!==p?(L&=p-1,L+=p):L=0,T++,0==--x[I]){if(I===A)break;I=t[i+u[T]]}if(R<I&&(L&g)!==m){for(0===C&&(C=R),_+=S,D=1<<(k=I-C);k+C<A&&!((D-=x[k+C])<=0);)k++,D<<=1;if(O+=1<<k,1===e&&852<O||2===e&&592<O)return 1;l[m=L&g]=R<<24|k<<16|_-d}}return 0!==L&&(l[_+L]=I-C<<24|64<<16),h.bits=R,0}},{"../utils/common":41}],51:[function(e,t,i){t.exports={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"}},{}],52:[function(e,t,i){var r=e("../utils/common");function n(e){for(var t=e.length;0<=--t;)e[t]=0}var a=256,o=286,s=30,c=15,l=[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],d=[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],u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],h=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],p=new Array(576);n(p);var f=new Array(60);n(f);var m=new Array(512);n(m);var g=new Array(256);n(g);var _=new Array(29);n(_);var v,y,E,b=new Array(s);function w(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 I(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function T(e){return e<256?m[e]:m[256+(e>>>7)]}function S(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function A(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,S(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 R(e,t,i){A(e,i[2*t],i[2*t+1])}function k(e,t){for(var i=0;i|=1&e,e>>>=1,i<<=1,0<--t;);return i>>>1}function C(e,t,i){var r,n,a=new Array(16),o=0;for(r=1;r<=c;r++)a[r]=o=o+i[r-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=k(a[s]++,s))}}function D(e){var t;for(t=0;t<o;t++)e.dyn_ltree[2*t]=0;for(t=0;t<s;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 O(e){8<e.bi_valid?S(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function L(e,t,i,r){var n=2*t,a=2*i;return e[n]<e[a]||e[n]===e[a]&&r[t]<=r[i]}function N(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&L(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!L(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function P(e,t,i){var r,n,o,s,c=0;if(0!==e.last_lit)for(;r=e.pending_buf[e.d_buf+2*c]<<8|e.pending_buf[e.d_buf+2*c+1],n=e.pending_buf[e.l_buf+c],c++,0===r?R(e,n,t):(R(e,(o=g[n])+a+1,t),0!==(s=l[o])&&A(e,n-=_[o],s),R(e,o=T(--r),i),0!==(s=d[o])&&A(e,r-=b[o],s)),c<e.last_lit;);R(e,256,t)}function x(e,t){var i,r,n,a=t.dyn_tree,o=t.stat_desc.static_tree,s=t.stat_desc.has_stree,l=t.stat_desc.elems,d=-1;for(e.heap_len=0,e.heap_max=573,i=0;i<l;i++)0!==a[2*i]?(e.heap[++e.heap_len]=d=i,e.depth[i]=0):a[2*i+1]=0;for(;e.heap_len<2;)a[2*(n=e.heap[++e.heap_len]=d<2?++d:0)]=1,e.depth[n]=0,e.opt_len--,s&&(e.static_len-=o[2*n+1]);for(t.max_code=d,i=e.heap_len>>1;1<=i;i--)N(e,a,i);for(n=l;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],N(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,a[2*n]=a[2*i]+a[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,a[2*i+1]=a[2*r+1]=n,e.heap[1]=n++,N(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,n,a,o,s,l=t.dyn_tree,d=t.max_code,u=t.stat_desc.static_tree,h=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(a=0;a<=c;a++)e.bl_count[a]=0;for(l[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)m<(a=l[2*l[2*(r=e.heap[i])+1]+1]+1)&&(a=m,g++),l[2*r+1]=a,d<r||(e.bl_count[a]++,o=0,f<=r&&(o=p[r-f]),s=l[2*r],e.opt_len+=s*(a+o),h&&(e.static_len+=s*(u[2*r+1]+o)));if(0!==g){do{for(a=m-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[m]--,g-=2}while(0<g);for(a=m;0!==a;a--)for(r=e.bl_count[a];0!==r;)d<(n=e.heap[--i])||(l[2*n+1]!==a&&(e.opt_len+=(a-l[2*n+1])*l[2*n],l[2*n+1]=a),r--)}}(e,t),C(a,d,e.bl_count)}function M(e,t,i){var r,n,a=-1,o=t[1],s=0,c=7,l=4;for(0===o&&(c=138,l=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=o,o=t[2*(r+1)+1],++s<c&&n===o||(s<l?e.bl_tree[2*n]+=s:0!==n?(n!==a&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=n,l=(s=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4))}function U(e,t,i){var r,n,a=-1,o=t[1],s=0,c=7,l=4;for(0===o&&(c=138,l=3),r=0;r<=i;r++)if(n=o,o=t[2*(r+1)+1],!(++s<c&&n===o)){if(s<l)for(;R(e,n,e.bl_tree),0!=--s;);else 0!==n?(n!==a&&(R(e,n,e.bl_tree),s--),R(e,16,e.bl_tree),A(e,s-3,2)):s<=10?(R(e,17,e.bl_tree),A(e,s-3,3)):(R(e,18,e.bl_tree),A(e,s-11,7));a=n,l=(s=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4)}}n(b);var F=!1;function B(e,t,i,n){var a,o,s;A(e,0+(n?1:0),3),o=t,s=i,O(a=e),S(a,s),S(a,~s),r.arraySet(a.pending_buf,a.window,o,s,a.pending),a.pending+=s}i._tr_init=function(e){F||(function(){var e,t,i,r,n,a=new Array(16);for(r=i=0;r<28;r++)for(_[r]=i,e=0;e<1<<l[r];e++)g[i++]=r;for(g[i-1]=r,r=n=0;r<16;r++)for(b[r]=n,e=0;e<1<<d[r];e++)m[n++]=r;for(n>>=7;r<s;r++)for(b[r]=n<<7,e=0;e<1<<d[r]-7;e++)m[256+n++]=r;for(t=0;t<=c;t++)a[t]=0;for(e=0;e<=143;)p[2*e+1]=8,e++,a[8]++;for(;e<=255;)p[2*e+1]=9,e++,a[9]++;for(;e<=279;)p[2*e+1]=7,e++,a[7]++;for(;e<=287;)p[2*e+1]=8,e++,a[8]++;for(C(p,287,a),e=0;e<s;e++)f[2*e+1]=5,f[2*e]=k(e,5);v=new w(p,l,257,o,c),y=new w(f,d,0,s,c),E=new w(new Array(0),u,0,19,7)}(),F=!0),e.l_desc=new I(e.dyn_ltree,v),e.d_desc=new I(e.dyn_dtree,y),e.bl_desc=new I(e.bl_tree,E),e.bi_buf=0,e.bi_valid=0,D(e)},i._tr_stored_block=B,i._tr_flush_block=function(e,t,i,r){var n,o,s=0;0<e.level?(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<a;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),x(e,e.l_desc),x(e,e.d_desc),s=function(e){var t;for(M(e,e.dyn_ltree,e.l_desc.max_code),M(e,e.dyn_dtree,e.d_desc.max_code),x(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*h[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?B(e,t,i,r):4===e.strategy||o===n?(A(e,2+(r?1:0),3),P(e,p,f)):(A(e,4+(r?1:0),3),function(e,t,i,r){var n;for(A(e,t-257,5),A(e,i-1,5),A(e,r-4,4),n=0;n<r;n++)A(e,e.bl_tree[2*h[n]+1],3);U(e,e.dyn_ltree,t-1),U(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),P(e,e.dyn_ltree,e.dyn_dtree)),D(e),r&&O(e)},i._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*(g[i]+a+1)]++,e.dyn_dtree[2*T(t)]++),e.last_lit===e.lit_bufsize-1},i._tr_align=function(e){var t;A(e,2,3),R(e,256,p),16===(t=e).bi_valid?(S(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,i){t.exports=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}},{}],54:[function(e,t,i){(function(e){!function(e){if(!e.setImmediate){var t,i,r,n,a=1,o={},s=!1,c=e.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(e);l=l&&l.setTimeout?l:e,t="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick(function(){u(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?(n="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",h,!1):e.attachEvent("onmessage",h),function(t){e.postMessage(n+t,"*")}):e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){u(e.data)},function(e){r.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(i=c.documentElement,function(e){var t=c.createElement("script");t.onreadystatechange=function(){u(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):function(e){setTimeout(u,0,e)},l.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var i=new Array(arguments.length-1),r=0;r<i.length;r++)i[r]=arguments[r+1];var n={callback:e,args:i};return o[a]=n,t(a),a++},l.clearImmediate=d}function d(e){delete o[e]}function u(e){if(s)setTimeout(u,0,e);else{var t=o[e];if(t){s=!0;try{!function(e){var t=e.callback,i=e.args;switch(i.length){case 0:t();break;case 1:t(i[0]);break;case 2:t(i[0],i[1]);break;case 3:t(i[0],i[1],i[2]);break;default:t.apply(void 0,i)}}(t)}finally{d(e),s=!1}}}}function h(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(n)&&u(+t.data.slice(n.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)})}),BA=NA((e,t)=>{var i=Object.prototype.hasOwnProperty,r="~";function n(){}function a(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,i,n,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new a(i,n||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){0===--e._eventsCount?e._events=new n:delete e._events[t]}function c(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)i.call(e,t)&&n.push(r?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.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,a=i.length,o=new Array(a);n<a;n++)o[n]=i[n].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},c.prototype.emit=function(e,t,i,n,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c,l,d=this._events[s],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){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,a),!0;case 6:return d.fn.call(d.context,t,i,n,a,o),!0}for(l=1,c=new Array(u-1);l<u;l++)c[l-1]=arguments[l];d.fn.apply(d.context,c)}else{var h,p=d.length;for(l=0;l<p;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),u){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,i);break;case 4:d[l].fn.call(d[l].context,t,i,n);break;default:if(!c)for(h=1,c=new Array(u-1);h<u;h++)c[h-1]=arguments[h];d[l].fn.apply(d[l].context,c)}}return!0},c.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},c.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},c.prototype.removeListener=function(e,t,i,n){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!n||o.once)&&(!i||o.context===i)&&s(this,a);else{for(var c=0,l=[],d=o.length;c<d;c++)(o[c].fn!==t||n&&!o[c].once||i&&o[c].context!==i)&&l.push(o[c]);l.length?this._events[a]=1===l.length?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,void 0!==t&&(t.exports=c)}),VA=NA((e,t)=>{var i=t.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(i).forEach(function(e){i[e].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})}),HA=NA(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 a=e.push?{}:n?i[e.name]:i;(function(e,i,r,n){if(n&&!r)i[n]=t(e[1]);else for(var a=0;a<r.length;a+=1)null!=e[a+1]&&(i[r[a]]=t(e[a+1]))})(r.match(e.reg),a,e.names,e.name),e.push&&i[e.push].push(a)},r=VA(),n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},a=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(n).forEach(function(e){var t=e[0],n=e.slice(2);"m"===t&&(a.push({rtp:[],fmtp:[]}),o=a[a.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,o,n)}}),t.media=a,t};var a=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(a,{})},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(a,{})})},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}})})}}),jA=NA((e,t)=>{var i=VA(),r=/%[sdv%]/g,n=function(e){var t=1,i=arguments,n=i.length;return e.replace(r,function(e){if(t>=n)return e;var r=i[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(r);case"%d":return Number(r);case"%v":return""}})},a=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 a=0;a<t.names.length;a+=1){var o=t.names[a];t.name?r.push(i[t.name][o]):r.push(i[t.names[a]])}else r.push(i[t.name]);return n.apply(null,r)},o=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];t.exports=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||o,n=t.innerOrder||s,c=[];return r.forEach(function(t){i[t].forEach(function(i){i.name in e&&null!=e[i.name]?c.push(a(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach(function(e){c.push(a(t,i,e))})})}),e.media.forEach(function(e){c.push(a("m",i.m[0],e)),n.forEach(function(t){i[t].forEach(function(i){i.name in e&&null!=e[i.name]?c.push(a(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach(function(e){c.push(a(t,i,e))})})})}),c.join("\r\n")+"\r\n"}}),zA=NA(e=>{var t=HA(),i=jA(),r=VA();e.grammar=r,e.write=i,e.parse=t.parse,e.parseParams=t.parseParams,e.parseFmtpConfig=t.parseFmtpConfig,e.parsePayloads=t.parsePayloads,e.parseRemoteCandidates=t.parseRemoteCandidates,e.parseImageAttributes=t.parseImageAttributes,e.parseSimulcastStreamList=t.parseSimulcastStreamList}),WA=((vA=WA||{}).ROOM_DESTROY="1",vA.JOIN_START="21",vA.JOIN_SCHEDULE_SUCCESS="22",vA.JOIN_SIGNAL_CONNECTION_START="23",vA.JOIN_SIGNAL_CONNECTION_END="24",vA.JOIN_SEND_CMD="25",vA.JOIN_RECEIVED_CMD_RES="26",vA.JOIN_SUCCESS="27",vA.JOIN_FAILED="28",vA.WHIP_REQUEST_COST="29",vA.WHIP_PULL_RESULT="30",vA.LEAVE_START="51",vA.LEAVE_SEND_CMD="52",vA.LEAVE_SUCCESS="53",vA.PUBLISH_START="61",vA.SEND_FIRST_VIDEO_FRAME="62",vA.PUBLISH_FAILED="63",vA.SUBSCRIBE_START="81",vA.SUBSCRIBE_SUCCESS="82",vA.SUBSCRIBE_FAILED="84",vA.UNSUBSCRIBE_SUCCESS="83",vA.LOCAL_TRACK_CAPTURE_START="101",vA.LOCAL_TRACK_CAPTURE_SUCCESS="102",vA.LOCAL_TRACK_CAPTURE_FAILED="103",vA.LOCAL_TRACK_PUBLISHED="104",vA.LOCAL_TRACK_UNPUBLISHED="105",vA.LOCAL_TRACK_REPLACED="106",vA.SWITCH_DEVICE_SUCCESS="107",vA.TRACK_MUTED="108",vA.TRACK_UNMUTED="109",vA.REMOTE_TRACK_SUBSCRIBED="110",vA.REMOTE_TRACK_UNSUBSCRIBED="111",vA.LOCAL_TRACK_RECAPTURE="112",vA.LOCAL_AUDIO_STARTED="113",vA.LOCAL_AUDIO_STOPPED="114",vA.REMOTE_AUDIO_STARTED="115",vA.REMOTE_AUDIO_STOPPED="116",vA.LOCAL_TRACK_STOPPED="117",vA.LOCAL_VIDEO_TRACK_PREPROCESSED="118",vA.VIDEO_MANAGER_UPDATE_TIMEOUT="119",vA.PLAY_TRACK_START="151",vA.PLAYER_STATE_CHANGED="152",vA.VIDEO_LOADED_DATA="153",vA.AUTOPLAY_DIALOG_CLICK_CONFIRM="154",vA.AUDIO_CONTEXT_LONG_SUSPENDED="155",vA.REMOTE_VIDEO_PLAY_START="156",vA.REMOTE_VIDEO_PLAY_FINISH="157",vA.SIGNAL_CONNECTION_STATE_CHANGED="201",vA.PEER_CONNECTION_STATE_CHANGED="202",vA.SINGLE_CONNECTION_STAT="203",vA.SPC_RECONNECTED="204",vA.HEARTBEAT_REPORT="251",vA.RECEIVED_PUBLISHED_USER_LIST="252",vA.REMOTE_PUBLISH_STATE_CHANGED="253",vA.AUDIO_LEVEL_INTERVAL="260",vA.NETWORK_QUALITY="261",vA.VIDEO_CODEC_IMPLEMENTATION_CHANGED="262",vA.QUALITY_LIMITATION_CHANGED="263",vA.LOG="264",vA.AUDIO_PROCESSOR_DEBUG="265",vA.SSO_SWITCH="266",vA.SEI_MESSAGE="267",vA.USER_PAUSE_IN_PIP="268",vA.USER_RESUME_IN_PIP="269",vA.ENTER_PICTURE_IN_PICTURE="270",vA.LEAVE_PICTURE_IN_PICTURE="271",vA.REMOTE_VIDEO_FIRST_UNMUTE="272",vA.REMOTE_VIDEO_FIRST_FRAME_METRICS="273",vA.SWITCH_ROOM_START="401",vA.SWITCH_ROOM_SUCCESS="407",vA.SWITCH_ROOM_FAILED="408",vA);function GA(e){return qA((t,i)=>async function(){for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];let a=await t.apply(this,r);return await e.call(this,...r),a})}function qA(e){return function(t,i,r){return r.value=e(r.value,i),r}}var KA=new WeakMap;function YA(e,t){return qA((i,r)=>function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];let o=KA.get(this);o||(o=new Map,KA.set(this,o));let s=t(...n),c=o.get(s);if(!c||c<=0){i.apply(this,n);let t=setTimeout(()=>{var e;null==(e=KA.get(this))||e.delete(s)},e);o.set(s,t)}else{clearTimeout(c);let t=window.setTimeout(()=>{var e;i.apply(this,n),null==(e=KA.get(this))||e.delete(s)},e);o.set(s,t)}})}var XA,ZA,JA=((XA=JA||{})[XA.none=0]="none",XA[XA.horizontal=1]="horizontal",XA[XA.vertical=2]="vertical",XA),QA="5.0.0",$A="undefined"!=typeof importScripts,eR="undefined"!=typeof registerProcessor,tR="https://".concat("web.sdk.qcloud.com","/trtc/webrtc/doc"),iR="https://cloud.tencent.com/document/product/647/85386",rR="https://trtc.io/document/56025",nR="jssdk_log",aR="qcloud",oR=((ZA=oR||{})[ZA.TRACE=0]="TRACE",ZA[ZA.DEBUG=1]="DEBUG",ZA[ZA.INFO=2]="INFO",ZA[ZA.WARN=3]="WARN",ZA[ZA.ERROR=4]="ERROR",ZA[ZA.NONE=5]="NONE",ZA),sR={unknown:0,wifi:1,"4g":2,"3g":3,"2g":4,wired:5,"5g":6},cR={width:640,height:480,frameRate:15,bitrate:500},lR=3840,dR=2160,uR="canvas",hR="audio",pR="video",fR="screen",mR="big",gR="auxiliary",_R="mute",vR="unmute",yR="ended",ER="playing",bR="pause",wR="error",IR="loadstart",TR="loadeddata",SR="loadedmetadata",AR="audioinput",RR="videoinput",kR="enterpictureinpicture",CR="leavepictureinpicture",DR="fullscreenchange",OR="resize",LR="player-error",NR="load-worklet",PR="getUserMedia-retry",xR="default",MR=2e3,UR=["width","height","frameRate","facingMode","sampleRate","sampleSize","channelCount","deviceId","min","max"],FR={alpha:!0,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0,powerPreference:"low-power"};function BR(e){let{frame:t,streamType:i}=e;return{frame:t,messages:[{type:"dump",isAudio:!1,data:t.data,userId:"",streamType:i}]}}function VR(e){let{frame:t,userId:i,streamType:r}=e;return{frame:t,messages:[{type:"dump",isAudio:!1,data:t.data,userId:i,streamType:r}]}}function HR(e){let{frame:t,streamType:i}=e;return{frame:t,messages:[{type:"dump",isAudio:!0,data:t.data,userId:"",streamType:i}]}}function jR(e){let{frame:t,userId:i,streamType:r}=e;return{frame:t,messages:[{type:"dump",isAudio:!0,data:t.data,userId:i,streamType:r}]}}var zR="Log",WR="Network",GR="Dump",qR="Dump (PCM)",KR="Dump (Opus)",YR="Dumping",XR="End",ZR="Upload Log",JR="Export Log",QR="Hide",$R="goBottom",ek="backTop",tk="Clear Log",ik="Uplink",rk="Downlink",nk="No Data",ak="Basic",ok="Duration",sk="Video",ck="Audio",lk="Screen",dk={"play() error: NotAllowedError:":{tips:e=>e.includes("main <video>")||e.includes("main <audio>")?"Remote stream auto play is restricted and playback fails":"Local stream playback failure, generally only occurs in Android WeChat devices, no need to handle",color:"red",class:"red"},"updateStream() try to recover local stream":{tips:"Device acquisition exception, automatic recovery is in progress"},"updateStream() recover local stream successfully":{tips:"Device acquisition exception, automatic recovery is successful"},"updateStream() failed to recover local stream":{tips:"Device acquisition exception, automatic recovery failed"},"main stream - video track is muted":{tips:"Indicates that the received video data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - audio track is muted":{tips:"Indicates that the received audio data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"auxiliary stream - video track is muted":{tips:"Indicates that the received screen sharing data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - video track is unable to provide media output":{tips:"Indicates that the received video data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - audio track is unable to provide media output":{tips:"Indicates that the received audio data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"auxiliary stream - video track is unable to provide media output":{tips:"Indicates that the received screen sharing data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - video track is unmuted":{tips:"Received enough playback video data"},"main stream - audio track is unmuted":{tips:"Received enough playback audio data"},"auxiliary stream - video track is unmuted":{tips:"Received enough playback screen sharing data"},"main stream - audio player track is ended":{tips:"Remote audio track stopped"},"main stream - video player track is ended":{tips:"Remote video track stopped"},"auxiliary stream - video player track is ended":{tips:"Received enough playback screen sharing data"},"stream - video track is muted":{tips:"Camera capture is paused, usually due to the device being occupied by other applications or the browser media permission being revoked. The client needs to re-capture.",color:"orange"},"stream - video track is unable to provide media output":{tips:"The camera acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked, and the customer needs to re-acquire. SDK v4.11.4+ will automatically resume acquisition without customer intervention",color:"orange"},"video track is unable to provide media output":{tips:e=>e.includes("↓")?"The remote track is temporarily unable to decode data, which may be caused by network fluctuations":"The camera acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked. The SDK will automatically resume the acquisition.",color:"orange"},"stream - video player track is ended":{tips:"The camera acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"video player track is ended":{tips:"The camera acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"stream - audio track is muted":{tips:"Microphone capture is paused, usually due to the device being occupied by other applications or the browser media permission being revoked. The client needs to re-capture.",color:"orange"},"audio track is unable to provide media output":{tips:e=>e.includes("↓")?"The remote track is temporarily unable to decode data, which may be caused by network fluctuations":"Microphone acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked. The SDK will automatically resume the acquisition.",color:"orange"},"stream - audio track is unable to provide media output":{tips:"The microphone acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked. The SDK will automatically resume the acquisition.",color:"orange"},"stream - audio player track is ended":{tips:"The microphone acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"audio player track is ended":{tips:"The microphone acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"is adding audio track to current published local stream":{tips:"add audio track",color:"orange"},"is removing audio track from current published local stream":{tips:"remove audio track",color:"orange"},"is removing video track from current published local stream":{tips:"remove video track",color:"orange"},"is adding video track to current published local stream":{tips:"add video track",color:"orange"},"is replacing audio track to current published local main stream":{tips:"replace audio track",color:"orange"},"is replacing video track to current published local main stream":{tips:"replace video track",color:"orange"},"downlink network quality change":{tips:"Downstream network quality change: 1: excellent, 2: good, 3: average, 4: poor, 5: extremely poor"},"uplink network quality change":{tips:"Upstream network quality change: 1: excellent, 2: good, 3: average, 4: poor, 5: extremely poor"},"localStream mute video":{tips:"mute upstream video stream",color:"orange"},"localStream unmute video":{tips:"unmute upstream video stream",color:"orange"},"localStream mute audio":{tips:"mute upstream audio stream",color:"orange"},"localStream unmute audio":{tips:"unmute upstream audio stream",color:"orange"},"black detected":{tips:"Detect black screen, which means fps = 0. It is usually caused by network, and the network will be recovered after a while. If the network is normal but has not been restored, it is an abnormal situation."},'main stream start to play with options: {"muted":true}':{tips:"Play the remote stream in silent mode. Generally, the remote stream does not need to be played in silent mode. You need to confirm whether the parameters passed in the client stream.play API call are correct.",color:"orange"},"main stream - audio player is starting playing":{tips:"Remote stream audio playback success",color:"#0dd90d",class:"success"},"main stream - video player is starting playing":{tips:"Remote stream video playback success",color:"#0dd90d",class:"success"},"video player is playing":{tips:"Local video playback success",color:"#0dd90d",class:"success"},"audio player is playing":{tips:"Local audio playback success",color:"#0dd90d",class:"success"},"stream - video player is starting playing":{tips:"Local video playback success",color:"#0dd90d",class:"success"},"stream - audio player is starting playing":{tips:"Local audio playback success",color:"#0dd90d",class:"success"},"switch camera success":{tips:"Switch camera success",color:"#0dd90d",class:"success"},"switch microphone success":{tips:"Switch microphone success",color:"#0dd90d",class:"success"},gotStream:{tips:"Local stream capture success"},"local stream is published successfully":{tips:"Publish success",color:"#0dd90d",class:"success"},"encoderImplementation change to OpenH264":{tips:"Use software encoding"},"encoderImplementation change to ExternalEncoder":{tips:"Use hardware encoding"},"getUserMedia with constraints":{tips:"Start media (camera/microphone) capture"},"getDisplayMedia with constraints":{tips:"Start screen sharing capture"},"client-banned":{tips:"Kicked out of the room",color:"red",class:"red",textColor:"#fff"},user_timeout:{tips:"The backend is too long without receiving SDK heartbeat, which is usually caused by the JS thread being blocked for a long time. If the reproduction probability is high, the application browser Performance tool analyzes where the JS thread is blocked.",color:"red",class:"red",textColor:"#fff"},"schedule failed":{tips:"Signaling request failed, does not affect the normal room entry process, SDK will connect to the default signaling domain."},"updateStream() video flag is true, but no camera detected, set video to false":{tips:"When trying to resume camera acquisition, the camera acquisition is not resumed because it is detected that there is no camera.",color:"orange",class:"orange",textColor:"#fff"},"qualityLimitationReason change to bandwidth":{tips:"bandwidth estimation is not enough to limit the quality of the encoding, which may cause the code rate, frame rate, and resolution to be lowered.",color:"orange",class:"orange",textColor:"#fff"},"qualityLimitationReason change to cpu":{tips:"cpu load is too high to limit the quality of the encoding, which may cause the code rate, frame rate, and resolution to be lowered.",color:"orange",class:"orange",textColor:"#fff"},"visibility change: hidden":{tips:"User page switched to backend, in mobile devices, this will cause the device to pause the capture, and it will be restored when the user switches backend to the frontend.",color:"orange",class:"orange",textColor:"#fff"},"visibility change: visible":{tips:"User page switched to frontend",color:"orange",class:"orange",textColor:"#fff"},"main stream - audio player is paused":{tips:"The remote stream audio playback is paused, which usually has two possibilities:\n 1. The business side passes in the div tag container for playing audio and video to be removed by the business side from the DOM.\n 2. If the user is in Chrome 70 and below, when the div container is moved, the playback will be paused.",color:"orange",class:"orange",textColor:"#fff"},"main stream - video player is paused":{tips:"The remote stream video playback is paused, which usually has two possibilities:\n 1. The business side passes in the div tag container for playing audio and video to be removed by the business side from the DOM.\n 2. If the user is in Chrome 70 and below, when the div container is moved, the playback will be paused.",color:"orange",class:"orange",textColor:"#fff"},'"displaySurface":"window"':{tips:"Screen sharing captures the application window",color:"blue",class:"blue",textColor:"#fff"},'"displaySurface":"monitor"':{tips:"Screen sharing captures the entire screen",color:"blue",class:"blue",textColor:"#fff"},'"displaySurface":"browser"':{tips:"Screen sharing captures a certain tab page",color:"blue",class:"blue",textColor:"#fff"},updateMediaSettings:{tips:"The resolution and frame rate below are the actual resolution and frame rate captured",color:"blue",class:"blue",textColor:"#fff"},"main stream start to play with":{tips:"Call remoteStream.play interface",color:"blue",class:"blue",textColor:"#fff"},"stream start to play with":{tips:"Call localStream.play interface",color:"blue",class:"blue",textColor:"#fff"},"main setAudioVolume to 0":{tips:"Business side calls remoteStream.setAudioVolume(0) interface to set the playback volume to 0, which will cause the playback to be silent",color:"orange",class:"orange",textColor:"#fff"},"screen sharing was stopped because the video track is ended":{tips:"Screen sharing capture stopped, possible reasons: user clicks the stop button, the window/page shared by the user is closed, etc.",color:"orange",class:"orange",textColor:"#fff"},"Join() => joining room":{tips:"Call client.join interface",color:"blue",class:"blue",textColor:"#fff"},"publish() => publishing local stream":{tips:"Call client.publish interface",color:"blue",class:"blue",textColor:"#fff"},"subscribe() => subscribe to":{tips:"Call client.subscribe interface",color:"blue",class:"blue",textColor:"#fff"},"switchRole() => switch role":{tips:"Call client.switchRole interface",color:"blue",class:"blue",textColor:"#fff"}};["enterRoom","exitRoom","switchRole","destroy","startLocalAudio","updateLocalAudio","stopLocalAudio","startLocalVideo","updateLocalVideo","stopLocalVideo","startScreenShare","updateScreenShare","stopScreenShare","startRemoteVideo","updateRemoteVideo","stopRemoteVideo","muteRemoteAudio","setRemoteAudioVolume"].forEach(e=>{dk["".concat(e,"()")]={tips:"Call trtc.".concat(e),color:"blue",class:"blue",textColor:"#fff"}});var uk,hk=Object.keys(dk),pk=xA(FA()),fk=((uk=fk||{})[uk.INVALID_PARAMETER=4096]="INVALID_PARAMETER",uk[uk.INVALID_OPERATION=4097]="INVALID_OPERATION",uk[uk.NOT_SUPPORTED=4098]="NOT_SUPPORTED",uk[uk.DEVICE_NOT_FOUND=4099]="DEVICE_NOT_FOUND",uk[uk.INITIALIZE_FAILED=4100]="INITIALIZE_FAILED",uk[uk.SIGNAL_CHANNEL_SETUP_FAILED=16385]="SIGNAL_CHANNEL_SETUP_FAILED",uk[uk.SIGNAL_CHANNEL_ERROR=16386]="SIGNAL_CHANNEL_ERROR",uk[uk.ICE_TRANSPORT_ERROR=16387]="ICE_TRANSPORT_ERROR",uk[uk.JOIN_ROOM_FAILED=16388]="JOIN_ROOM_FAILED",uk[uk.CREATE_OFFER_FAILED=16389]="CREATE_OFFER_FAILED",uk[uk.SIGNAL_CHANNEL_RECONNECTION_FAILED=16390]="SIGNAL_CHANNEL_RECONNECTION_FAILED",uk[uk.UPLINK_RECONNECTION_FAILED=16391]="UPLINK_RECONNECTION_FAILED",uk[uk.DOWNLINK_RECONNECTION_FAILED=16392]="DOWNLINK_RECONNECTION_FAILED",uk[uk.REMOTE_STREAM_NOT_EXIST=16400]="REMOTE_STREAM_NOT_EXIST",uk[uk.CLIENT_BANNED=16448]="CLIENT_BANNED",uk[uk.SERVER_TIMEOUT=16449]="SERVER_TIMEOUT",uk[uk.SUBSCRIPTION_TIMEOUT=16450]="SUBSCRIPTION_TIMEOUT",uk[uk.PLAY_NOT_ALLOWED=16451]="PLAY_NOT_ALLOWED",uk[uk.DEVICE_AUTO_RECOVER_FAILED=16452]="DEVICE_AUTO_RECOVER_FAILED",uk[uk.START_PUBLISH_CDN_FAILED=16453]="START_PUBLISH_CDN_FAILED",uk[uk.STOP_PUBLISH_CDN_FAILED=16454]="STOP_PUBLISH_CDN_FAILED",uk[uk.START_MIX_TRANSCODE_FAILED=16455]="START_MIX_TRANSCODE_FAILED",uk[uk.STOP_MIX_TRANSCODE_FAILED=16456]="STOP_MIX_TRANSCODE_FAILED",uk[uk.NOT_SUPPORTED_H264=16457]="NOT_SUPPORTED_H264",uk[uk.SWITCH_ROLE_FAILED=16458]="SWITCH_ROLE_FAILED",uk[uk.API_CALL_TIMEOUT=16459]="API_CALL_TIMEOUT",uk[uk.SCHEDULE_FAILED=16460]="SCHEDULE_FAILED",uk[uk.API_CALL_ABORTED=16461]="API_CALL_ABORTED",uk[uk.SPC_INITIALIZED_FAILED=16462]="SPC_INITIALIZED_FAILED",uk[uk.VIDEO_MANAGER_ERROR=16463]="VIDEO_MANAGER_ERROR",uk[uk.SWITCH_ROOM_FAILED=16464]="SWITCH_ROOM_FAILED",uk[uk.VIDEO_ENCODE_FAILED=16465]="VIDEO_ENCODE_FAILED",uk[uk.AUDIO_ENCODE_FAILED=16466]="AUDIO_ENCODE_FAILED",uk[uk.WHIP_REQUEST_FAILED=16467]="WHIP_REQUEST_FAILED",uk[uk.UNKNOWN=65535]="UNKNOWN",uk),mk=fk,gk=class extends Error{constructor(e){let{name:t="RtcError",message:i,code:r=mk.UNKNOWN,extraCode:n=0,constraint:a}=e,o="<".concat(function(e){for(let t in mk)if(mk[t]===e)return t;return"UNKNOWN"}(r)," 0x").concat(r.toString(16),">"),s="".concat(i).concat(a?" constraint: ".concat(a):"").concat(null!=i&&i.includes(o)?"":" ".concat(o));super(s),UA(this,"code"),UA(this,"extraCode"),UA(this,"message"),UA(this,"originMessage"),UA(this,"name"),UA(this,"constraint"),this.code=r,this.extraCode=n,this.name=t,this.message=s,this.constraint=a,this.originMessage=i}getCode(){return this.code}getExtraCode(){return this.extraCode}toString(){return this.originMessage}},_k=gk,vk=function(){return Date.now()+0},yk=function(){let e=new Date;return e.setTime(vk()),e.toLocaleString()};PA({},{REPORT_TYPE:()=>UO,buildSSOPackage:()=>FO,bytes2ms:()=>MD,calculateScaleResolutionDownNumber:()=>LO,calculateWatermarkSize:()=>PO,concatArrayBuffers:()=>BO,convertObjectNumberToInt:()=>RO,copyProperties:()=>xD,deepClone:()=>_O,deepCloneBasic:()=>MO,deepMerge:()=>gO,delay:()=>kO,detectImageType:()=>zO,fibonacci:()=>zD,formatedTime:()=>EO,getConstructorName:()=>rO,getContainerFromElement:()=>yO,getEnv:()=>TD,getFirst16Bits:()=>HO,getInternalVersion:()=>lO,getLast16Bits:()=>VO,getLoggerUrl:()=>RD,getMediaStreamTrackInfo:()=>OO,getMuteStateFromFlag:()=>pO,getNetworkType:()=>CD,getNumNetworkType:()=>PD,getReconnectionTimeout:()=>WD,getStringByteLength:()=>IO,getTestSignalDomain:()=>SD,getTurnServer:()=>fO,getUint32Version:()=>AO,getValueType:()=>GD,getVersionFromInternalVersion:()=>dO,getViewListFromView:()=>vO,glog:()=>VD,ipv4ToUint32:()=>mO,isArray:()=>QD,isAudioWorkletSupported:()=>nO,isBoolean:()=>ZD,isConstructor:()=>iO,isEmpty:()=>hO,isFunction:()=>qD,isLangChinese:()=>HD,isMediaStreamTrack:()=>$D,isNumber:()=>XD,isObject:()=>JD,isOverseaSdkAppId:()=>AD,isPlainObject:()=>jD,isPortrait:()=>TO,isPromise:()=>tO,isRemoteTrack:()=>eO,isRotate90Or270:()=>NO,isSameSubnet:()=>ID,isSetSinkIdSupported:()=>aO,isString:()=>YD,isUndefined:()=>KD,isValidIP:()=>wD,isVideoMixerOutputTrack:()=>jO,loadImage:()=>SO,loadVideo:()=>xO,ms2bytes:()=>FD,ms2samples:()=>BD,normalizeUrl:()=>DO,performanceNow:()=>sO,promiseAny:()=>oO,samples2ms:()=>UD,setNetworkTypeFromWebRTC:()=>ND,stringify:()=>bO,stringifyIncludeValue:()=>wO,throttlePromise:()=>CO});var Ek=function(e,t,i,r){return new(i||(i=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(t){a(t)}}function s(e){try{c(r.throw(e))}catch(t){a(t)}}function c(e){e.done?n(e.value):function(e){return e instanceof i?e:new i(function(t){t(e)})}(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},bk=Symbol(32),wk=Symbol(16),Ik=Symbol(8),Tk=class{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return Ek(this,void 0,void 0,function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise((t,i)=>{var r;this.reject=i,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)},this.demand(e,!0)||null===(r=this.pull)||void 0===r||r.call(this,e)})})}readU32(){return this.read(bk)}readU16(){return this.read(wk)}readU8(){return this.read(Ik)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null,t=this.buffer.subarray(this.consumed),i=0,r=e=>t.length<(i=e);if("number"==typeof this.need){if(r(this.need))return;e=t.subarray(0,i)}else if(this.need===bk){if(r(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===wk){if(r(2))return;e=t[0]<<8|t[1]}else if(this.need===Ik){if(r(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(r(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,i)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(r(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,i)),e=this.need}return this.consumed+=i,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise(e=>this.pull=e);this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){let t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{let e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}};Tk.U32=bk,Tk.U16=wk,Tk.U8=Ik;var Sk=128;function Ak(e){let t=new Tk;for(;e>=128;)t.malloc(1)[0]=255&e|Sk,e>>>=7;return t.malloc(1)[0]=255&e,t.buffer||new Uint8Array(0)}function Rk(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=new Tk,r=t<<3;switch(typeof e){case"boolean":let n=i.malloc(2);n[0]=r,n[1]=e?1:0;break;case"number":i.malloc(1)[0]=r,i.write(Ak(e));break;case"string":i.malloc(1)[0]=2|r;let a=(new TextEncoder).encode(e);i.write(Ak(a.length));let o=i.malloc(a.length);for(let e=0;e<a.length;e++)o[e]=a[e];break;case"object":let s=new Tk;if(Array.isArray(e))for(let t=0;t<e.length;t++){let i=Rk(e[t],t+1);i&&s.write(i)}else{let t=1;for(let i in e){let r=Rk(e[i],t++);r&&s.write(r)}}0===t?s.buffer&&i.write(s.buffer):(i.malloc(1)[0]=2|r,s.buffer&&(i.write(Ak(s.buffer.length)),i.write(s.buffer)))}return i.buffer||new Uint8Array(0)}var kk=class{constructor(){UA(this,"buffer"),this.buffer=[]}get data(){return this.buffer}get length(){return this.buffer.length}writeInt32(e){this.buffer.push(e>>>24&255),this.buffer.push(e>>>16&255),this.buffer.push(e>>>8&255),this.buffer.push(255&e)}writeInt16(e){this.buffer.push(e>>>8&255),this.buffer.push(255&e)}writeByte(e){this.buffer.push(255&e)}writeBytes(e){for(let t=0;t<e.length;t++)this.buffer.push(e[t])}};function Ck(e,t,i){e[i]=t>>>24&255,e[i+1]=t>>>16&255,e[i+2]=t>>>8&255,e[i+3]=255&t}function Dk(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function Ok(e,t){return e[t]}function Lk(e,t,i){return(new TextDecoder).decode(function(e,t,i){return e.slice(t,t+i)}(e,t,i))}var Nk=0,Pk=2654435769,xk=16,Mk=2,Uk=7;function Fk(e,t){let i=new kk,r=function(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"AVQualityReportSvc.C2S";return{version:arguments.length>4&&void 0!==arguments[4]?arguments[4]:2e3,encryption:arguments.length>5&&void 0!==arguments[5]?arguments[5]:2,d2:"",d2Len:0,uinType:arguments.length>6&&void 0!==arguments[6]?arguments[6]:30,uin:"",uinLen:0,reqHead:{seqNumber:i,appId:e,appidAtThird:new Uint8Array(0),a2:"",a2Len:0,serviceCmd:r,serviceCmdLen:0,cookie:"",cookieLen:0,imei:"",imeiLen:0,ksid:"",ksidLen:0,clientVersionInfo:"",clientVersionInfoLen:0},busiBuff:t}}(t,e,Nk);Nk=Nk+1&2147483647,i.writeInt32(0),i.writeInt32(r.version),i.writeByte(r.encryption);let n=(new TextEncoder).encode(r.d2);i.writeInt32(n.length+4),n&&i.writeBytes(n),i.writeByte(r.uinType);let a=(new TextEncoder).encode(r.uin);i.writeInt32(a.length+4),a.length&&i.writeBytes(a);let o=new kk;o.writeInt32(0),o.writeInt32(r.reqHead.seqNumber),o.writeInt32(r.reqHead.appId),o.writeByte(r.reqHead.appId>>>24&255),o.writeByte(r.reqHead.appId>>>16&255),o.writeByte(r.reqHead.appId>>>8&255),o.writeByte(255&r.reqHead.appId);for(let v=4;v<16;v++)o.writeByte(0);let s=(new TextEncoder).encode(r.reqHead.a2);o.writeInt32(s.length+4),s.length&&o.writeBytes(s);let c=(new TextEncoder).encode(r.reqHead.serviceCmd);o.writeInt32(c.length+4),c.length&&o.writeBytes(c);let l=(new TextEncoder).encode(r.reqHead.cookie);o.writeInt32(l.length+4),l.length&&o.writeBytes(l);let d=(new TextEncoder).encode(r.reqHead.imei);o.writeInt32(d.length+4),d.length&&o.writeBytes(d);let u=(new TextEncoder).encode(r.reqHead.ksid);o.writeInt32(u.length+4),u.length&&o.writeBytes(u);let h=(new TextEncoder).encode(r.reqHead.clientVersionInfo);o.writeInt16(h.length+2),h.length&&o.writeBytes(h);let p=o.length;o.data[0]=p>>>24&255,o.data[1]=p>>>16&255,o.data[2]=p>>>8&255,o.data[3]=255&p,YD(e)&&(e=(new TextEncoder).encode(e)),o.writeInt32(e.length+4),e.length&&o.writeBytes(e);let f=new Uint8Array(o.data),m=null;1===r.encryption?m=(new TextEncoder).encode(r.uin):2===r.encryption&&(m=new Uint8Array(16)),m&&(f=function(e,t){let i=e.length,r=(i+1+Mk+Uk)%8;r&&(r=8-r);let n=i+1+Mk+Uk+r,a=new Uint8Array(n),o=0,s=new Uint8Array(8),c=new Uint8Array(8),l=new Uint8Array(8),d=0;s[0]=248&Math.floor(256*Math.random())|r,d=1;for(let h=0;h<r;h++)s[d]=255&Math.floor(256*Math.random()),d+=1;for(let h=0;h<Mk;)if(d<8&&(s[d]=255&Math.floor(256*Math.random()),d+=1,h+=1),8===d){Bk(s,t,c,l,a,o),o+=8,d=0;for(let e=0;e<8;e++)l[e]=a[o-8+e]}let u=0;for(;u<i;)if(d<8&&(s[d]=e[u],d+=1,u+=1),8===d){Bk(s,t,c,l,a,o),o+=8,d=0;for(let e=0;e<8;e++)l[e]=a[o-8+e]}for(let h=0;h<Uk;)if(d<8&&(s[d]=0,d+=1,h+=1),8===d){Bk(s,t,c,l,a,o),o+=8,d=0;for(let e=0;e<8;e++)l[e]=a[o-8+e]}return a}(f,m)),i.writeBytes(f);let g=new Uint8Array(i.data),_=g.length;return g[0]=_>>>24&255,g[1]=_>>>16&255,g[2]=_>>>8&255,g[3]=255&_,g}function Bk(e,t,i,r,n,a){for(let o=0;o<8;o++)e[o]^=r[o];!function(e,t,i,r){let n=Dk(e,0),a=Dk(e,4),o=[];for(let c=0;c<4;c++)o[c]=Dk(t,4*c);let s=0;for(let c=0;c<xk;c++)s+=Pk,s>>>=0,n+=(a<<4)+o[0]^a+s^(a>>>5)+o[1],n>>>=0,a+=(n<<4)+o[2]^n+s^(n>>>5)+o[3],a>>>=0;Ck(i,n,r),Ck(i,a,r+4)}(e,t,n,a);for(let o=0;o<8;o++)n[a+o]^=i[o];for(let o=0;o<8;o++)i[o]=e[o]}var Vk="undefined"==typeof navigator?"":navigator.userAgent,Hk=e=>new RegExp(e,"i").test(Vk),jk=e=>{if(Hk(e)){let t=new RegExp("".concat(e,"\\/([\\d.]+)")),i=Vk.match(t);if(i&&i[1])return i[1]}return""},zk=e=>{if(Hk(e)){let t=new RegExp("".concat(e,"\\/(\\d+)")),i=Vk.match(t);if(i&&i[1])return parseFloat(i[1])}return NaN},Wk=/AppleWebKit\/([\d.]+)/i.exec(Vk);Wk&&parseFloat(Wk[1]);var Gk=Hk("iPad"),qk="undefined"!=typeof navigator&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&Hk("Macintosh"),Kk=Hk("iPhone")&&!Gk,Yk=Hk("iPod"),Xk=Kk||Gk||Yk||qk,Zk=()=>{try{return Xk&&navigator.maxTouchPoints>1&&navigator.vendor.includes("Apple")}catch(_A){return Xk}},Jk=Hk("Android"),Qk=function(){if(Jk){let e=Vk.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(e){let t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);if(t&&i)return parseFloat("".concat(e[1],".").concat(e[2]));if(t)return t}}return NaN}();Jk&&Hk("webkit");var $k=Hk("Firefox"),eC=jk("Firefox"),tC=zk("Firefox"),iC=Hk("Edge"),rC=jk("Edge"),nC=Hk("Edg"),aC=jk("Edg"),oC=zk("Edg"),sC=Hk("SogouMobileBrowser"),cC=jk("SogouMobileBrowser"),lC=Hk("MetaSr\\s"),dC=jk("MetaSr\\s"),uC=Hk("TBS"),hC=jk("TBS"),pC=Hk("XWEB"),fC=jk("XWEB");Hk("MSIE\\s8\\.0");var mC=Hk("MSIE\\/\\d+");!function(){if(mC){let e=/MSIE\s(\d+)\.\d/.exec(Vk),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(Vk)&&/rv:11.0/.test(Vk)&&(t=11),t}}();var gC=Hk("(micromessenger|webbrowser)"),_C=jk("MicroMessenger"),vC=!uC&&Hk("MQQBrowser")&&Hk("COVC"),yC=!uC&&Hk("MQQBrowser")&&!Hk("COVC"),EC=yC||vC?jk("MQQBrowser"):"",bC=!uC&&Hk(" QQBrowser"),wC=jk(" QQBrowser"),IC=!uC&&Hk("QQBrowserLite"),TC=jk("QQBrowserLite"),SC=!uC&&Hk("MQBHD"),AC=jk("MQBHD"),RC=Hk("Windows"),kC=!Xk&&Hk("MAC OS X"),CC=!Jk&&Hk("Linux"),DC=Hk("CrOS");Hk("MicroMessenger"),Hk("UCBrowser");var OC=Hk("Electron"),LC=Hk("MiuiBrowser"),NC=jk("MiuiBrowser"),PC=Hk("HuaweiBrowser"),xC=Hk("Huawei")||Hk("HUAWEI"),MC=Hk("Honor")||Hk("HONOR"),UC=jk("HuaweiBrowser"),FC=Hk("SamsungBrowser"),BC=jk("SamsungBrowser"),VC=Hk("HeyTapBrowser"),HC=jk("HeyTapBrowser"),jC=Hk("VivoBrowser"),zC=jk("VivoBrowser"),WC=Hk("OpenHarmony");jk("OpenHarmony");var GC=()=>zk("Chrome"),qC=Hk("CriOS"),KC=Hk("Chrome"),YC=!iC&&!lC&&!sC&&!uC&&!pC&&!nC&&!bC&&!LC&&!PC&&!FC&&!VC&&!jC&&KC,XC=Hk("HeadlessChrome"),ZC=GC(),JC=KC&&ZC>=128&&ZC<=143,QC=jk("Chrome"),$C=zk("Electron"),eD=!KC&&!yC&&!vC&&!IC&&!SC&&Hk("Safari"),tD=eD||Xk,iD=jk("Version"),rD=/Android.*(wv|.0.0.0)/.test(Vk),nD=(()=>{if(qk)return iD;if(Xk){let e=Vk.match(/OS (\d+)_(\d+)/i);if(e&&e[1]){let t=e[1];return e[2]&&(t+=".".concat(e[2])),t}}return""})();function aD(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.split(".").map(e=>Number(e)),n=t.split(".").map(e=>Number(e));for(let a=0;a<Math.max(r.length,n.length);a++){let e=r[a]||0,t=n[a]||0;if(e>t)return!0;if(e<t)return!1}return i}var oD=Number(nD.split(".")[0]),sD="15.1"===nD,cD=(()=>{let e=Number(nD.split(".")[0]);return 14===e||13===e})(),lD=qC&&"11.1.1"===iD,dD="undefined"!=typeof location&&("file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname),uD=(()=>{let e;return()=>{if(void 0===e)try{e=!!window.localStorage}catch(t){e=!1}return e}})(),hD=function(){let e=new Map([[$k,["Firefox",eC]],[nC,["Edg",aC]],[YC,["Chrome",QC]],[qC,["ChiOS",jk("CriOS")]],[eD&&!qC,["Safari",iD]],[uC,["TBS",hC]],[pC,["XWEB",fC]],[gC&&Kk,["WeChat",_C]],[bC,["QQ(Win)",wC]],[yC,["QQ(Mobile)",EC]],[vC,["QQ(Mobile X5)",EC]],[IC,["QQ(Mac)",TC]],[SC,["QQ(iPad)",AC]],[LC,["MI",NC]],[PC,["HW",UC]],[FC,["Samsung",BC]],[VC,["OPPO",HC]],[jC,["VIVO",zC]],[iC,["EDGE",rC]],[sC,["SogouMobile",cC]],[lC,["Sogou",dC]]]),t="unknown",i="unknown";return e.has(!0)&&([t,i]=e.get(!0)),{name:t,version:i}}();var pD=null;function fD(){return pD&&"boolean"==typeof pD.mobile?pD.mobile:Jk||Xk||Kk||Gk||WC}var mD="";function gD(){try{if(mD)return mD;let e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return"";let i=t.getExtension("WEBGL_debug_renderer_info");if(i){let e=t.getParameter(i.UNMASKED_VENDOR_WEBGL),r=t.getParameter(i.UNMASKED_RENDERER_WEBGL);return mD="".concat(e," ").concat(r)}return""}catch(_A){return""}}function _D(){return function(){let e=/;\s*([^;)]+)\s+Build\//,t=Vk.match(e);return null!=t&&t[1]?t[1].trim():null}()||""}var vD=new Map([[Jk,"Android"],[Xk,"iOS"],[RC,"Windows"],[kC,"MacOS"],[CC,"Linux"],[DC,"ChromeOS"]]),yD=function(){return vD.get(!0)?vD.get(!0):"unknown"};function ED(){return RC?1:Jk?2:kC?3:Xk?4:CC?5:DC?6:WC?7:0}var bD=()=>{let e=yD();return Xk?e+="/".concat(nD):Jk&&(e+="/".concat(Qk)),e+="/".concat(hD.name,"/").concat(eD&&!qC?hD.version:hD.version.split(".")[0]),e};function wD(e){return!!e&&!!(/^\d{1,3}(\.\d{1,3}){3}$/.test(e)||e.includes(":")&&/^[0-9a-fA-F:]+$/.test(e))}function ID(e,t){if(!wD(e)||!wD(t))return e===t;let i=e=>e.includes(":");if(i(e)!==i(t))return e===t;if(i(e)){return e.split(":").slice(0,3).join(":")===t.split(":").slice(0,3).join(":")}return e.split(".").slice(0,3).join(".")===t.split(".").slice(0,3).join(".")}var TD=function(){return new URLSearchParams(location.search).get("trtc_env")||""},SD=function(e){return e.includes(".")?e:"".concat(e).concat(".rtc.qq.com")},AD=e=>Number(e)<14e8,RD=function(e,t){let i;i=AD(e)?"https://apisgp.my-imcloud.com":"https://yun.tim.qq.com";let r=Math.floor(Math.random()*2**31);return"".concat(i,"/v5/AVQualityReportSvc/C2S?random=").concat(r,"&sdkappid=").concat(e,"&cmdtype=").concat(t)},kD="unknown";function CD(){!function(){var e;if(!OD){OD=!0;try{null==(e=navigator.connection)||e.addEventListener("typechange",DD)}catch(t){}}}();let{userAgent:e,connection:t}=navigator,i=(e.match(/NetType\/\S+/)||[])[0]||"";i=i.toLowerCase().replace("nettype/",""),"3gnet"===i&&(i="3g");let r=t&&t.type&&t.type.toLowerCase(),n=t&&t.effectiveType&&t.effectiveType.toLowerCase();return"slow-2"===n&&(n="2g"),r?LD(r,n):kD}function DD(){oL.warn("netType changed",CD())}var OD=!1;function LD(e,t){if(sR[e])return e;switch(e){case"cellular":case"wimax":return t||"unknown";case"ethernet":return"wired";default:return"unknown"}}function ND(e){kD=LD(e)}function PD(){return sR[CD()]}function xD(e,t){for(let i of Reflect.ownKeys(t))if("constructor"!==i&&"prototype"!==i&&"name"!==i){let r=Object.getOwnPropertyDescriptor(t,i)||"";Object.defineProperty(e,i,r)}return e}function MD(e){return UD(e/4,arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)}function UD(e){return 1e3*e/(arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)}function FD(e){return 4*BD(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)}function BD(e){return e*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)/1e3}var VD="undefined"!=typeof window&&"function"==typeof window.glog?window.glog:()=>{},HD=()=>{let e=navigator.language;return e=e.substring(0,2),"zh"===e},jD=function(e){if(!e||"object"!=typeof e||"[object Object]"!=Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);if(null===t)return!0;let i=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)};function zD(e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return e<=1?t:zD(e-1,t,(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)+t)}function WD(e){return e>8?3e4:1e3*zD(e)}function GD(e){return Reflect.apply(Object.prototype.toString,e,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}var qD=e=>"function"==typeof e,KD=e=>void 0===e,YD=e=>"string"==typeof e,XD=e=>"number"==typeof e,ZD=e=>"boolean"==typeof e,JD=e=>"object"===GD(e),QD=e=>"array"===GD(e),$D=e=>GD(e)==="MediaStreamTrack".toLowerCase(),eO=e=>e.isRemote,tO=e=>"promise"===GD(e),iO=e=>qD(e)&&e.prototype.constructor===e,rO=e=>iO(e)?e.prototype.constructor.name:"",nO="undefined"!=typeof AudioWorkletNode,aO="undefined"!=typeof HTMLMediaElement&&"setSinkId"in HTMLMediaElement.prototype;function oO(e){return new Promise((t,i)=>{let r=[];e.forEach(n=>{n.then(t).catch(t=>{r.push(t),r.length===e.length&&i(r)})})})}function sO(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}var cO=e=>+e<10?"0".concat(e):e,lO=e=>{let t=e.match(/^\d+\.\d+\.\d+/)[0];if(!t)return e;let i=t.split("."),r=cO(i[1])+cO(i[2]);return i[1]-15>0&&(i[1]="15"),i[2]-15>0&&(i[2]="15"),"".concat(i.join("."),".").concat(r)},dO=e=>{let t=e.split(".");if(4!==t.length)return e;let i=t[0],r=t[3];if(r.length<4)return e;let n=parseInt(r.substring(0,r.length-2),10),a=parseInt(r.substring(r.length-2),10);return"".concat(i,".").concat(n,".").concat(a)},uO=Object.prototype.hasOwnProperty;function hO(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e||"function"==typeof e||Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(jD(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(let t in e)if(uO.call(e,t))return!1;return!0}return!1}function pO(e,t){return{userId:t,hasAudio:!!(8&e),hasVideo:!!(1&e),hasAuxiliary:!!(4&e),hasSmall:!!(2&e),audioMuted:!!(64&e),videoMuted:!!(16&e),audioAvailable:!(!(8&e)||64&e),videoAvailable:!(!(1&e)||16&e),hasDatachannel:!!(256&e)}}function fO(e){let t={urls:e.url.startsWith("turn:")||e.url.startsWith("turns:")?e.url:"turn:".concat(e.url)};return!KD(e.username)&&!KD(e.credential)&&(t.username=e.username,t.credential=e.credential,t.credentialType="password",KD(e.credentialType)||(t.credentialType=e.credentialType)),t}function mO(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!YD(e))return 0;let i=e.split(".");return t?(Number(i[0])<<24|Number(i[1])<<16|Number(i[2])<<8|Number(i[3]))>>>0:(Number(i[3])<<24|Number(i[2])<<16|Number(i[1])<<8|Number(i[0]))>>>0}var gO=function(e,t,i,r){if(!JD(e)||!JD(t))return 0;let n,a=0,o=Object.keys(t);for(let s=0,c=o.length;s<c;s++)if(n=o[s],!(KD(t[n])||i&&i.includes(n)))if(JD(e[n])&&JD(t[n]))a+=gO(e[n],t[n],i,r);else{if(r&&r.includes(t[n]))continue;e[n]!==t[n]&&(e[n]=_O(t[n]),a+=1)}return a};function _O(e){if(QD(e)){let t=[];return e.forEach((e,i)=>{t[i]=_O(e)}),t}if(JD(e)){let t={};return Object.keys(e).forEach(i=>{t[i]=_O(e[i])}),t}return e}var vO=e=>{let t=[];if(QD(e))t=[...e];else if(YD(e)){let i=document.getElementById(e);i&&t.push(i)}else e&&t.push(e);return t},yO=e=>YD(e)?document.getElementById(e):e,EO=()=>(e=>{let t=e=>e<10?"0".concat(e):"".concat(e),i=e.getFullYear(),r=e.getMonth()+1,n=e.getDate(),a=t(e.getHours()),o=t(e.getMinutes()),s=t(e.getSeconds());return"".concat(i,"/").concat(r,"/").concat(n," ").concat(a,":").concat(o,":").concat(s)})(new Date);function bO(e,t){let{keysToInclude:i,keysToExclude:r}=t;try{if(QD(e))return"[".concat(e.map(e=>bO(e,{keysToInclude:i,keysToExclude:r})).join(","),"]");if(!jD(e)||!QD(i)&&!QD(r))return JSON.stringify(e);let t={},n=new Set(i),a=new Set(r);return Object.keys(e).forEach(o=>{(0===a.size&&n.has(o)||0===n.size&&!a.has(o))&&(t[o]=jD(e[o])||QD(e[o])?JSON.parse(bO(e[o],{keysToExclude:r,keysToInclude:i})):e[o])}),JSON.stringify(t)}catch(XA){return"{}"}}function wO(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return Object.keys(e).forEach(r=>{t===e[r]&&i.push(r)}),bO(e,{keysToInclude:i})}function IO(e){return e.replace(/[\u4e00-\u9fa5]/g,"aa").length}var TO=()=>{var e,t,i,r;return null!=(e=window.screen)&&e.orientation?!(null==(r=null==(i=null==(t=window.screen)?void 0:t.orientation)?void 0:i.type)||!r.includes("portrait")):0===window.orientation||180===window.orientation},SO=async e=>new Promise((t,i)=>{let r;if(YD(e))r=new Image,r.crossOrigin="anonymous",r.src=e;else if(r=e,r.complete)return void t(r);r.onload=()=>t(r),r.onerror=()=>{i(new _k({code:mk.INVALID_PARAMETER,message:"load image failed, url: ".concat(e)}))}}),AO=e=>{let t=e.split(".");return+t[0]<<24|+t[1]<<16|+t[2]<<8|+t[3]},RO=e=>(Object.keys(e).forEach(t=>{XD(e[t])&&(t.startsWith("uint")||t.startsWith("int"))?e[t]=Math.floor(e[t]):(jD(e[t])||QD(e[t]))&&RO(e[t])}),e);function kO(e,t){return new Promise(i=>{let r=setTimeout(i,e);t&&t(r)})}function CO(e,t){let i=null;return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return i||(i=e.apply(t||this,n),i.finally(()=>i=null),i)}}function DO(e){return e.replace(/(^|[^:])\/{2,}/g,"$1/")}function OO(e){var t;try{let{width:i,height:r,frameRate:n,sampleRate:a,sampleSize:o,channelCount:s}=null==(t=e.getSettings)?void 0:t.call(e),c=e.kind===hR?"".concat(a,"x").concat(o,"@").concat(s):"".concat(i,"x").concat(r,"@").concat(n),l=e.stats?" stats: ".concat(JSON.stringify(e.stats).replaceAll('"',"")):"";return"".concat(e.id," ").concat(e.readyState," muted:").concat(e.muted," ").concat(e.kind," ").concat(e.label," ").concat(c).concat(l)}catch(sM){return""}}function LO(e,t){return e.width*e.height===t.width*t.height?1:fD()&&TO()&&t.width>t.height&&e.height>t.width?Math.max(e.width/t.height,e.height/t.width,1):Math.max(e.width/t.width,e.height/t.height,1)}function NO(e){return 90===e||270===e}function PO(e,t,i,r,n){let a=e,o=t;if(JD(n))a=(null==n?void 0:n.width)||a,o=(null==n?void 0:n.height)||o;else if(XD(n))a=e*n,o=t*n;else if("contain"===n||"cover"===n){let s=e/t,c=s>i/r;"contain"===n?c?(a=i,o=i/s):(a=r*s,o=r):c?(o=r,a=r*s):(a=i,o=i/s)}return{width:a,height:o}}async function xO(e){return new Promise((t,i)=>{let r=document.createElement("video");r.crossOrigin="anonymous",r.src=e,r.muted=!0,r.loop=!0,r.playsInline=!0,r.play().then(()=>t(r)),r.onerror=()=>{i(r.error)}})}function MO(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){let i=[];return t.set(e,i),e.forEach((e,r)=>{i[r]=MO(e,t)}),i}if("[object Object]"===Object.prototype.toString.call(e)){let i={};return t.set(e,i),Reflect.ownKeys(e).forEach(r=>{i[r]=MO(e[r],t)}),i}return e}var UO=(e=>(e[e.END_REPORT=2001]="END_REPORT",e[e.LOG=2002]="LOG",e[e.KEY_METRIC_REPORT=2003]="KEY_METRIC_REPORT",e))(UO||{});function FO(e,t,i,r){try{let n=function(e,t,i,r){let n={data:e,random:Math.floor(2147483648*Math.random()),sdkAppId:i};return KD(r)||(n=OA(DA({},n),{gzip:+r})),{uint32_sdkappid:0,uint64_from_uin:0,uint32_timestamp:0,uint32_seq:0,msg_common_info:{msg_device_info:{enum_device_type:0,str_device_brand:"",str_device_model:"",str_device_board:"",str_device_cpu_abi:""},msg_system_info:{enum_os_type:0,str_os_version:"",msg_network_info:0},msg_network_info:{enum_network_type:0}},msg_report_content:{uint32_type:t,bytes_report_data:JSON.stringify(n)}}}(e,t,i,r);return Fk(Rk(n),i)}catch(n){return JSON.stringify(e)}}function BO(e,t){let i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer}function VO(e){return(65535&e)>>>0}function HO(e){return(4294901760&e)>>>0}function jO(e,t){return oL.debug("isVideoMixerOutputTrack",e,t,e===(null==t?void 0:t.videoMixerOutputTrack)),!(!e||null==t||!t.isUsingVideoMixerInternalTrack)&&!(!t.videoMixerOutputTrack||e!==t.videoMixerOutputTrack)}function zO(e){var t;if(!e)return{animated:!1};if(e.startsWith("data:")){let t=e.match(/^data:(image\/[^;,]+)/);if(t){let e=t[1].toLowerCase();return{animated:"image/gif"===e||"image/apng"===e,mimeType:e}}return{animated:!1}}if(e.startsWith("blob:"))return{animated:!1};try{let i=null==(t=new URL(e,"https://placeholder.invalid").pathname.split(".").pop())?void 0:t.toLowerCase();if("gif"===i)return{animated:!0,mimeType:"image/gif"};if("apng"===i)return{animated:!0,mimeType:"image/apng"}}catch(sM){}return{animated:!1}}function WO(e){let t=function(e){try{let t={},i=0;t.totalLength=Dk(e,i),i+=4,t.version=Dk(e,i),i+=4,t.encryption=Ok(e,i),i+=1,t.uinType=Ok(e,i),i+=1,t.uinLength=Dk(e,i),i+=4,t.uin=t.uinLength>4?Lk(e,i,t.uinLength-4):"",i+=t.uinLength-4;let r=e.slice(i);if(2===t.encryption){e=function(e,t){let i=0,r=new Uint8Array(8).fill(0),n=new Uint8Array(e.slice(0,8)),a=GO(n,t),o=7&a[0],s=e.length-1-o-Mk-Uk,c=new Uint8Array(s),l=0,d=r,u=e.slice(0,8);i=8;let h=1;h+=o;for(let f=1;f<=Mk;)if(h<8)h++,f++;else if(8===h){let r=qO(e,i,d,u,a,t);d=r.ivPreCrypt,u=r.ivCurCrypt,a=r.debiBuf,i=r.bufPos,h=0}let p=s;for(;p>0;)if(h<8)c[l++]=a[h]^d[h],h++,p--;else if(8===h){let r=qO(e,i,d,u,a,t);d=r.ivPreCrypt,u=r.ivCurCrypt,a=r.debiBuf,i=r.bufPos,h=0}for(let f=1;f<=Uk;)if(h<8)a[h],d[h],h++,f++;else if(8===h){if(i>=e.length)break;let r=qO(e,i,d,u,a,t);if(!r.success)break;d=r.ivPreCrypt,u=r.ivCurCrypt,a=r.debiBuf,i=r.bufPos,h=0}return c}(r,new Uint8Array(16).fill(0)),t.decrypted=!0,i=0}else e=r,i=0;return t.rspHeadLength=Dk(e,i),i+=4,t.seqNo=Dk(e,i),i+=4,t.retCode=Dk(e,i),i+=4,t.retStrLength=Dk(e,i),i+=4,t.retStr=t.retStrLength?Lk(e,i,t.retStrLength-4):"",i+=t.retStrLength-4,t.serviceCmdLength=Dk(e,i),i+=4,t.serviceCmd=t.serviceCmdLength?Lk(e,i,t.serviceCmdLength-4):"",i+=t.serviceCmdLength-4,t.cookieLength=Dk(e,i),i+=4,t.cookie=t.cookieLength?Lk(e,i,t.cookieLength-4):"",i+=t.cookieLength-4,t.flag=Dk(e,i),i+=4,t.busiBuffLength=Dk(e,i),i+=4,t.busiBuff=t.busiBuffLength?Lk(e,i,t.busiBuffLength-4):"",i+=t.busiBuffLength-4,t}catch(t){}}(e);return null==t?void 0:t.busiBuff}function GO(e,t){let i=e[0]<<24|e[1]<<16|e[2]<<8|e[3],r=e[4]<<24|e[5]<<16|e[6]<<8|e[7];i>>>=0,r>>>=0;let n=Pk*xk>>>0;for(let a=0;a<xk;a++)r-=(i<<4)+t[2]^i+n^(i>>>5)+t[3],r>>>=0,i-=(r<<4)+t[0]^r+n^(r>>>5)+t[1],i>>>=0,n-=Pk,n>>>=0;return new Uint8Array([i>>>24&255,i>>>16&255,i>>>8&255,255&i,r>>>24&255,r>>>16&255,r>>>8&255,255&r])}function qO(e,t,i,r,n,a){if(t+8>e.length)return{success:!1};let o=new Uint8Array(r),s=e.slice(t,t+8),c=new Uint8Array(8);for(let l=0;l<8;l++)c[l]=n[l]^s[l];return{success:!0,ivPreCrypt:o,ivCurCrypt:s,debiBuf:GO(c,a),bufPos:t+8}}var KO="undefined"!=typeof TextDecoder?new TextDecoder:void 0;function YO(e){let{url:t,body:i,method:r="POST",timeout:n,priority:a}=e;return new Promise((e,o)=>{if("fetch"in window)return fetch(t,{method:r,body:i,priority:a}).then(e=>e.clone().json().then(e=>({data:e}),()=>e.arrayBuffer().then(e=>({data:WO(new Uint8Array(e))||(KO?KO.decode(e):e)})))).then(e,o);let s=new XMLHttpRequest;s.onreadystatechange=()=>{if(4===s.readyState)if(s.status>=200&&s.status<300)try{let t=JSON.parse(s.response);e({data:t})}catch(t){e({data:s.response})}else o({status:s.status,statusText:s.statusText||"request failed!"})},s.timeout=n||5e3,s.open(r,t,!0),s.send(i)})}var XO=Object.prototype.hasOwnProperty,ZO=e=>"function"==typeof e,JO=e=>void 0===e,QO=e=>e.isRemote;function $O(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e||"function"==typeof e||Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(function(e){if(!e||"object"!=typeof e||"[object Object]"!=Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);if(null===t)return!0;let i=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(let t in e)if(XO.call(e,t))return!1;return!0}return!1}var eL=function(e){let{retryFunction:t,settings:i,onError:r,onRetrying:n,onRetryFailed:a,onRetrySuccess:o,context:s}=e;return function(){for(var e=arguments.length,c=new Array(e),l=0;l<e;l++)c[l]=arguments[l];let{retries:d=5,timeout:u=1e3}=i,h=0,p=-1,f=0,m=async(e,i)=>{let l=s||this;try{let i=await t.apply(l,c);h>0&&o&&o.call(this,h),h=0,e(i)}catch(g){let t=()=>{clearTimeout(p),h=0,f=2,i(g)},o=()=>{2!==f&&h<(ZO(d)?d():d)?(h++,f=1,ZO(n)&&n.call(this,h,t),p=window.setTimeout(()=>{p=-1,m(e,i)},ZO(u)?u(h):u)):(t(),ZO(a)&&a.call(this,g))};ZO(r)?r.call(this,{error:g,retry:o,reject:i,retryFuncArgs:c,retriedCount:h}):o()}};return new Promise(m)}},tL=class e{constructor(e){UA(this,"_parentPath"),UA(this,"userId"),UA(this,"remoteUserId"),UA(this,"id"),UA(this,"sdkAppId"),UA(this,"type"),UA(this,"isLocal"),this.id=e.id,this.userId=e.userId,this.sdkAppId=e.sdkAppId,this.remoteUserId=e.remoteUserId,this.isLocal=!(e=>"boolean"==typeof e)(e.isLocal)||e.isLocal,this.type=this.isLocal?"":e.type}getFullId(){return this._parentPath&&this.id?"".concat(this._parentPath,"-").concat(this.id):this._parentPath?this._parentPath:this.id}createChild(t){let i=new e({id:t.id,userId:JO(t.userId)?this.userId:t.userId,sdkAppId:JO(t.sdkAppId)?this.sdkAppId:t.sdkAppId,type:JO(t.type)?this.type:t.type,isLocal:JO(t.isLocal)?this.isLocal:t.isLocal,remoteUserId:JO(t.remoteUserId)?this.remoteUserId:t.remoteUserId});return i.bindParent(this),i}bindParent(e){let t=e.getFullId();this._parentPath!==t&&(this._parentPath=t,this.userId=e.userId||this.userId,this.sdkAppId=e.sdkAppId||this.sdkAppId,this.debug("bindParent: ".concat(e.id)))}setUserId(e){this.userId=e}setSdkAppId(e){this.sdkAppId=e}log(e,t){let i=this.isLocal?this.userId:this.remoteUserId,r=this.getFullId();t.unshift("[".concat(this.isLocal?"↑":"↓").concat(this.type&&"main"!==this.type?"*":"").concat(r).concat(i?"|".concat(i):"","]")),oL.log(e,t,JO(this.userId)||$O(this.userId),this.userId,this.sdkAppId)}info(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(2,t)}debug(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(1,t)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(3,t)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(4,t)}},iL=new(xA(BA(),1).default),rL=WA,nL=new class{constructor(){UA(this,"enable",!1),UA(this,"ssoFailCount",0),iL.on("22",e=>{let{schedule:t}=e;var i;null!=(i=null==t?void 0:t.config)&&i.sso&&iL.emit("266",{enable:!0})}),iL.on("266",e=>{let{enable:t}=e;this.enable=t})}handleUploadFailed(){this.ssoFailCount++,this.ssoFailCount>3&&iL.emit("266",{enable:!1})}},aL=class e{constructor(){UA(this,"_isEnableUploadLog",!0),UA(this,"_localJoinedUser",new Map),UA(this,"_queue",[]),UA(this,"_timeoutId",-1),UA(this,"_logLevel",1),UA(this,"_logLevelToUpload",2),!$A&&!eR&&(this.checkURLParam(),this.installEvents())}get isAbleToUpload(){return this._isEnableUploadLog&&-1!==this._timeoutId}installEvents(){iL.on(rL.JOIN_SCHEDULE_SUCCESS,e=>{let{schedule:t}=e;var i;null!=(i=null==t?void 0:t.config)&&i.logLevelToUpload&&oR[t.config.logLevelToUpload]&&(this._logLevelToUpload=t.config.logLevelToUpload)}),iL.on(rL.JOIN_START,e=>{let{params:t}=e;this.addJoinedUser({userId:t.userId,sdkAppId:t.sdkAppId}),this.startUpload()}),iL.on(rL.LEAVE_SUCCESS,e=>{let{room:t}=e;this.deleteJoinedUser(t.userId)})}startUpload(){-1===this._timeoutId&&this.uploadInterval()}addJoinedUser(e){this._localJoinedUser.set(e.userId,e),this.startUpload()}deleteJoinedUser(e){this._localJoinedUser.delete(e)}uploadInterval(){this.upload().catch(()=>{}),this._timeoutId=window.setTimeout(()=>this.uploadInterval(),5e3)}getLogsToUpload(){let e={map:new Map,splicedQueue:[]};if(this._queue[0].forAllJoinedClients&&0===this._localJoinedUser.size)return e;let t=0;for(;t<this._queue.length&&50!==t;t++){let i=this._queue[t];if(i.forAllJoinedClients)this._localJoinedUser.forEach(t=>{let{userId:r,sdkAppId:n}=t;e.map.has(r)?e.map.get(r).logs.push(i):e.map.set(r,{userId:r,sdkAppId:n,logs:[i]})});else if(YD(i.userId)&&XD(i.sdkAppId)){let{userId:t,sdkAppId:r}=i;e.map.has(t)?e.map.get(t).logs.push(i):e.map.set(t,{userId:t,sdkAppId:r,logs:[i]})}}return e.map.size>0&&(e.splicedQueue=this._queue.splice(0,t)),e}async upload(){if(0===this._queue.length||!this._isEnableUploadLog)return;let{map:e,splicedQueue:t}=this.getLogsToUpload();if(0===e.size)return;try{let t=[...e.values()];for(let e=0;e<t.length;e++){let{userId:i,sdkAppId:r,logs:n}=t[e],a={timestamp:yk(),sdkAppId:String(r),userId:i,version:QA,log:n.map(e=>e.log).join("\n")},o=JSON.stringify(a),s=nL.enable?FO(a,2002,r):o;await this.uploadLogWithRetry(s,r,s instanceof Uint8Array,o),n.forEach(e=>e.uploaded=!0)}}catch(r){}let i=t.filter(e=>!e.uploaded);i.length>0&&(this._queue=i.concat(this._queue))}uploadLogWithRetry(e,t,i,r){return eL({retryFunction:()=>YO({url:RD(t,nR),body:e,timeout:5e3,priority:"low"}).then(e=>{i&&"ok"!==e.data&&(nL.handleUploadFailed(),this.uploadLogWithRetry(r,t,!1,r))}),settings:{retries:3,timeout:2e3},onError:e=>{let{retry:t}=e;t()}})()}getPrefix(e){let t=new Date;return t.setTime(vk()),"[".concat(function(e){let t=String(e.getMilliseconds());return"padStart"in String.prototype&&(t=t.toString().padStart(3,"0")),"".concat(e.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1"),":").concat(t)}(t),"] <").concat(oR[e],">")}getLogLevel(){return this._logLevel}setLogLevel(e){KD(oR[e])||(this._logLevel!==e&&this.info("setLogLevel",e),this._logLevel=e)}enableUploadLog(){this._isEnableUploadLog=!0}disableUploadLog(){this.warn("disableUploadLog"),this._isEnableUploadLog=!1}logChunkToString(e){if(YD(e))return e;try{return e instanceof Error?e.toString():JSON.stringify(e)}catch(sM){return""}}addLogToQueue(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0,a={log:t.reduce((e,t)=>"".concat(e," ").concat(this.logChunkToString(t)).trim(),""),level:e,userId:r,sdkAppId:n,forAllJoinedClients:i};iL.emit(rL.LOG,{log:a}),this._isEnableUploadLog&&e>=this._logLevelToUpload&&this._queue.push(a)}log(t,i){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;var o;if(i.unshift(this.getPrefix(t)),this.addLogToQueue(t,i,r,n,a),t<this._logLevel)return;let s=(null==(o=oR[t])?void 0:o.toLowerCase())||"info";e.PRINT_LOG_TAG?console[s]("%cTRTC%c%s","padding: 1px 4px;border-radius: 3px;color: #fff;background: #1E88E5;","display: inline",...i):console[s](...i)}debug(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(1,t)}info(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(2,t)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(3,t)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(4,t)}createLogger(e){if(e.parent instanceof tL){let t=e,{parent:i}=t,r=((e,t)=>{var i={};for(var r in e)RA.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&SA)for(var r of SA(e))t.indexOf(r)<0&&kA.call(e,r)&&(i[r]=e[r]);return i})(t,["parent"]),n=new tL(r);return n.bindParent(i),n}return new tL(e)}checkURLParam(){let e=new URLSearchParams(location.search).get("logLevelToUpload"),t=e?Number(e):-1;oR[t]&&(this._logLevelToUpload=t)}getQueue(){return this._queue}};UA(aL,"PRINT_LOG_TAG",!(Xk||Jk||XC));var oL=new aL,sL=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},cL=new class{constructor(){UA(this,"_prefix","TRTC"),UA(this,"_queue",new Map)}getRealKey(e){return"".concat(this._prefix,"_").concat(e)}checkStorage(){uD()&&(setInterval(this.doFlush.bind(this),2e4),Object.keys(localStorage).filter(e=>{if(e.startsWith(this._prefix))try{let t=localStorage.getItem(e);if(!t)return!1;let i=JSON.parse(t);if(i&&i.expiresIn<Date.now())return!0}catch(t){return!1}return!1}).forEach(e=>localStorage.removeItem(e)))}doFlush(){if(uD())try{for(let[e,t]of this._queue)localStorage.setItem(e,JSON.stringify(t))}catch(e){oL.warn(e)}}getItem(e){if(!uD())return null;try{let t=localStorage.getItem(this.getRealKey(e));if(!t)return null;let i=JSON.parse(t);return i&&i.expiresIn>=Date.now()?i.value:null}catch(sM){oL.warn(sM)}}setItem(e,t){if(uD())try{let i={expiresIn:Date.now()+6048e5,value:t};this._queue.set(this.getRealKey(e),i)}catch(XA){oL.warn(XA)}}deleteItem(e){if(!uD())return!1;try{return e=this.getRealKey(e),this._queue.delete(e),localStorage.removeItem(e),!0}catch(sM){return oL.warn(sM),!1}}clear(){if(uD())try{localStorage.clear()}catch(e){oL.warn(e)}}};PA({},{HTTPS_API:()=>BL,IS_GET_CAPABILITIES_FROM_INPUTDEVICE_SUPPORTED:()=>cN,IS_GET_CAPABILITIES_SUPPORTED:()=>sN,IS_GET_SETTINGS_SUPPORTED:()=>oN,IS_GET_SYNCHRONIZATION_SOURCES_SUPPORTED:()=>aN,IS_INSERTABLE_STREAM_SUPPORTED:()=>lN,IS_JITTER_BUFFER_TARGET_SUPPORTED:()=>wN,IS_RTC_RTP_SENDER_SUPPORTED:()=>iN,IS_SCRIPT_TRANSFORM_SUPPORTED:()=>dN,IS_SEI_SUPPORTED:()=>uN,IS_SPC_SUPPORTED:()=>eN,basis:()=>_N,capabilityCheck:()=>EN,checkSystemRequirementsInternal:()=>LL,decodeSupportStatus:()=>OL,detectH264SupportedByFakeStreaming:()=>UL,detectVideoCodecCapabilities:()=>SN,detectVideoDecoderCapabilities:()=>RN,detectVideoEncoderCapabilities:()=>AN,encodeSupportStatus:()=>DL,getBrowserInfo:()=>wL,getDisplayResolution:()=>HL,getH264ProfileLevelIds:()=>kN,isAddTransceiverSupported:()=>$L,isBrowserSupported:()=>IL,isCanvasCaptureStreamAPISupported:()=>WL,isCanvasSmallStreamSupported:()=>GL,isGetReceiversSupported:()=>ZL,isGetSendersSupported:()=>JL,isGetTransceiversSupported:()=>QL,isGetUserMediaSupported:()=>jL,isMediaDevicesSupported:()=>SL,isMediaSessionSupported:()=>fN,isMediaStreamTrackGeneratorSupported:()=>CL,isMediaStreamTrackProcessorSupported:()=>kL,isReplaceTrackSupported:()=>rN,isRequestVideoFrameCallbackSupported:()=>bN,isSIMDSupported:()=>gN,isScaleResolutionDownBySupported:()=>qL,isScaleResolutionDownToSupported:()=>KL,isScreenCaptureApiAvailable:()=>PL,isSelectedCandidatePair:()=>VL,isSetParametersSupported:()=>nN,isSetSinkIdSupported:()=>xL,isSmallStreamSupported:()=>YL,isStopTransceiverSupported:()=>tN,isTRTCSupported:()=>NL,isUnifiedPlanDefault:()=>XL,isUsedInHttpProtocol:()=>RL,isWebAudioSupported:()=>zL,isWebCodecSupported:()=>pN,isWebCodecsSupported:()=>TL,isWebRTCSupported:()=>hN,isWebTransportSupported:()=>mN});var lL={AVOID_REPEATED_CALL:"AVOID_REPEATED_CALL",INVALID_PARAMETER_REQUIRED:"INVALID_PARAMETER_REQUIRED",INVALID_PARAMETER_TYPE:"INVALID_PARAMETER_TYPE",INVALID_PARAMETER_EMPTY:"INVALID_PARAMETER_EMPTY",INVALID_PARAMETER_INSTANCE:"INVALID_PARAMETER_INSTANCE",INVALID_PARAMETER_RANGE:"INVALID_PARAMETER_RANGE",INVALID_PARAMETER_MIN:"INVALID_PARAMETER_MIN",INVALID_PARAMETER_MAX:"INVALID_PARAMETER_MAX",INVALID_PARAMETER_STREAMTYPE:"INVALID_PARAMETER_STREAMTYPE",API_CALL_TIMEOUT:"API_CALL_TIMEOUT",SIGNAL_CHANNEL_RECONNECTION_FAILED:"SIGNAL_CHANNEL_RECONNECTION_FAILED",SIGNAL_CHANNEL_SETUP_FAILED:"SIGNAL_CHANNEL_SETUP_FAILED",ERROR_MESSAGE:"ERROR_MESSAGE",EXCHANGE_SDP_TIMEOUT:"EXCHANGE_SDP_TIMEOUT",DOWNLINK_RECONNECTION_FAILED:"DOWNLINK_RECONNECTION_FAILED",EXCHANGE_SDP_FAILED:"EXCHANGE_SDP_FAILED",UPDATE_OFFER_TIMEOUT:"UPDATE_OFFER_TIMEOUT",UPLINK_RECONNECTION_FAILED:"UPLINK_RECONNECTION_FAILED",INVALID_RECORDID:"INVALID_RECORDID",INVALID_PURE_AUDIO:"INVALID_PURE_AUDIO",INVALID_STREAMID:"INVALID_STREAMID",INVALID_USER_DEFINE_RECORDID:"INVALID_USER_DEFINE_RECORDID",INVALID_USER_DEFINE_PUSH_ARGS:"INVALID_USER_DEFINE_PUSH_ARGS",INVALID_PROXY:"INVALID_PROXY",INVALID_JOIN:"INVALID_JOIN",INVALID_ROOMID_STRING:"INVALID_ROOMID_STRING",INVALID_ROOMID_INTEGER:"INVALID_ROOMID_INTEGER",INVALID_SIGNAL_CHANNEL:"INVALID_SIGNAL_CHANNEL",JOIN_ROOM_TIMEOUT:"JOIN_ROOM_TIMEOUT",JOIN_ROOM_FAILED:"JOIN_ROOM_FAILED",REJOIN_ROOM_FAILED:"REJOIN_ROOM_FAILED",INVALID_DESTROY:"INVALID_DESTROY",INVALID_PUBLISH:"INVALID_PUBLISH",INVALID_UNPUBLISH:"INVALID_UNPUBLISH",INVALID_AUDIENCE:"INVALID_AUDIENCE",INVALID_INITIALIZE:"INVALID_INITIALIZE",INVALID_DUPLICATE_PUBLISHING:"INVALID_DUPLICATE_PUBLISHING",INVALID_SUBSCRIBE_UNDEFINED:"INVALID_SUBSCRIBE_UNDEFINED",INVALID_SUBSCRIBE_LOCAL:"INVALID_SUBSCRIBE_LOCAL",INVALID_REMOTE_STREAM:"INVALID_REMOTE_STREAM",SUBSCRIBE_FAILED:"SUBSCRIBE_FAILED",INVALID_ROLE:"INVALID_ROLE",INVALID_PARAMETER_SWITCH_ROLE:"INVALID_PARAMETER_SWITCH_ROLE",INVALID_OPERATION_SWITCH_ROLE:"INVALID_OPERATION_SWITCH_ROLE",SWITCH_ROLE_TIMEOUT:"SWITCH_ROLE_TIMEOUT",SWITCH_ROLE_FAILED:"SWITCH_ROLE_FAILED",CLIENT_BANNED:"CLIENT_BANNED",INVALID_OPERATION_START_PUBLISH_CDN:"INVALID_OPERATION_START_PUBLISH_CDN",INVALID_OPERATION_STOP_PUBLISH_CDN:"INVALID_OPERATION_STOP_PUBLISH_CDN",INVALID_STREAM_ID:"INVALID_STREAM_ID",START_PUBLISH_CDN_FAILED:"START_PUBLISH_CDN_FAILED",STOP_PUBLISH_CDN_FAILED:"STOP_PUBLISH_CDN_FAILED",START_MIX_TRANSCODE:"START_MIX_TRANSCODE",STOP_MIX_TRANSCODE:"STOP_MIX_TRANSCODE",INVALID_AUDIO_VOLUME:"INVALID_AUDIO_VOLUME",ENABLE_SMALL_STREAM_PUBLISHED:"ENABLE_SMALL_STREAM_PUBLISHED",DISABLE_SMALL_STREAM_PUBLISHED:"DISABLE_SMALL_STREAM_PUBLISHED",NOT_SUPPORTED_SMALL_STREAM:"NOT_SUPPORTED_SMALL_STREAM",INVALID_SMALL_STREAM_PROFILE:"INVALID_SMALL_STREAM_PROFILE",INVALID_PARAMETER_REMOTE_STREAM:"INVALID_PARAMETER_REMOTE_STREAM",INVALID_OPERATION_CHANGE_SMALL:"INVALID_OPERATION_CHANGE_SMALL",REMOTE_NOT_PUBLISH_SMALL_STREAM:"REMOTE_NOT_PUBLISH_SMALL_STREAM",INVALID_SWITCH_DEVICE:"INVALID_SWITCH_DEVICE",INVALID_SWITCH_DEVICE_PUBLISHING:"INVALID_SWITCH_DEVICE_PUBLISHING",INVALID_REPLACE_TRACK:"INVALID_REPLACE_TRACK",INVALID_INITIALIZE_LOCAL_STREAM:"INVALID_INITIALIZE_LOCAL_STREAM",INVALID_ADD_TRACK_REPETITIVE:"INVALID_ADD_TRACK_REPETITIVE",INVALID_ADD_TRACK_REMOVING:"INVALID_ADD_TRACK_REMOVING",INVALID_ADD_TRACK_PUBLISHING:"INVALID_ADD_TRACK_PUBLISHING",INVALID_STREAM_INITIALIZED:"INVALID_STREAM_INITIALIZED",INVALID_ADD_TRACK_NUMBER:"INVALID_ADD_TRACK_NUMBER",INVALID_REMOVE_AUDIO_TRACK:"INVALID_REMOVE_AUDIO_TRACK",INVALID_REMOVE_AUDIO_ADDING:"INVALID_REMOVE_AUDIO_ADDING",INVALID_REMOVE_AUDIO_ON:"INVALID_REMOVE_AUDIO_ON",INVALID_REMOVE_TRACK_PUBLISHING:"INVALID_REMOVE_TRACK_PUBLISHING",INVALID_REMOVE_TRACK_NOT_TRACK:"INVALID_REMOVE_TRACK_NOT_TRACK",INVALID_REMOVE_TRACK_NUMBER:"INVALID_REMOVE_TRACK_NUMBER",INVALID_REPLACE_TRACK_NO_TRACK:"INVALID_REPLACE_TRACK_NO_TRACK",REPEAT_JOIN:"REPEAT_JOIN",CLIENT_DESTROYED:"CLIENT_DESTROYED",NOT_BUG_PACKAGE:"NOT_BUG_PACKAGE",START_MIX_TRANSCODE_FAILED:"START_MIX_TRANSCODE_FAILED",STOP_MIX_TRANSCODE_FAILED:"STOP_MIX_TRANSCODE_FAILED",MIX_TRANSCODE_NOT_STARTED:"MIX_TRANSCODE_NOT_STARTED",CANNOT_LESS_THAN_ZERO:"CANNOT_LESS_THAN_ZERO",MIX_PARAMS_VIDEO_FRAMERATE:"MIX_PARAMS_VIDEO_FRAMERATE",MIX_PARAMS_VIDEO_GOP:"MIX_PARAMS_VIDEO_GOP",MIX_PARAMS_AUDIO_BITRATE:"MIX_PARAMS_AUDIO_BITRATE",MIX_PARAMS_USER_Z_ORDER:"MIX_PARAMS_USER_Z_ORDER",MIX_PARAMS_NOT_SELF:"MIX_PARAMS_NOT_SELF",MIX_PARAMS_USER_STREAM:"MIX_PARAMS_USER_STREAM",INVALID_PLAY:"INVALID_PLAY",INVALID_ELEMENT_ID:"INVALID_ELEMENT_ID",INVALID_ELEMENT_ID_TYPE:"INVALID_ELEMENT_ID_TYPE",PLAY_FAILED:"PLAY_FAILED",INVALID_USERID:"INVALID_USERID",INVALID_CREATE_STREAM_SOURCE:"INVALID_CREATE_STREAM_SOURCE",INVALID_CREATE_STREAM_SCREEN:"INVALID_CREATE_STREAM_SCREEN",INVALID_CREATE_STREAM_AUDIO:"INVALID_CREATE_STREAM_AUDIO",INVALID_CREATE_STREAM_SCREEN_AUDIO:"INVALID_CREATE_STREAM_SCREEN_AUDIO",NOT_SUPPORTED_HTTP:"NOT_SUPPORTED_HTTP",NOT_SUPPORTED_WEBRTC:"NOT_SUPPORTED_WEBRTC",NOT_SUPPORTED_PROFILE:"NOT_SUPPORTED_PROFILE",NOT_SUPPORTED_MEDIA:"NOT_SUPPORTED_MEDIA",NOT_SUPPORTED_H264ENCODE:"NOT_SUPPORTED_H264ENCODE",NOT_SUPPORTED_H264DECODE:"NOT_SUPPORTED_H264DECODE",NOT_SUPPORTED_TRACK:"NOT_SUPPORTED_TRACK",NOT_SUPPORTED_SWITCH_DEVICE:"NOT_SUPPORTED_SWITCH_DEVICE",NOT_SUPPORTED_CAPTURE:"NOT_SUPPORTED_CAPTURE",NOT_SUPPORTED_AUX:"NOT_SUPPORTED_AUX",MICROPHONE_NOT_FOUND:"MICROPHONE_NOT_FOUND",CAMERA_NOT_FOUND:"CAMERA_NOT_FOUND",SIGNAL_RESPONSE_FAILED:"SIGNAL_RESPONSE_FAILED",CATCH_HANDLER_ERROR:"CATCH_HANDLER_ERROR",API_NOT_EXIST:"API_NOT_EXIST",CONNECTION_CLOSED:"CONNECTION_CLOSED",SUBSCRIBE_ALL_FALSE:"SUBSCRIBE_ALL_FALSE",SEI_NOT_SUPPORT:"SEI_NOT_SUPPORT",SEI_DISABLED:"SEI_DISABLED",SEI_BEFORE_PUBLISH:"SEI_BEFORE_PUBLISH",SEI_NOT_VIDEO:"SEI_NOT_VIDEO",CALL_FREQUENCY_LIMIT:"CALL_FREQUENCY_LIMIT",CONNECTION_ABORTED:"CONNECTION_ABORTED",API_CALL_ABORTED:"API_CALL_ABORTED",DUPLICATE_AUX:"DUPLICATE_AUX",SWITCH_PLAYBACK_QUALITY_TIMEOUT:"SWITCH_PLAYBACK_QUALITY_TIMEOUT"},dL={AVOID_REPEATED_CALL:e=>"previous ".concat(e.name,"() is ongoing, please avoid repeated calls."),INVALID_PARAMETER_REQUIRED(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' is a required param when calling ").concat(r,"(), received: ").concat(n,".")},INVALID_PARAMETER_TYPE(e){let{key:t,rule:i,fnName:r,value:n}=e,a="".concat(t||i.name),o="";return o=Array.isArray(i.type)?i.type.join("|"):i.type,"'".concat(a,"' must be type of ").concat(o," when calling ").concat(r,"(), received type: ").concat(GD(n),".")},INVALID_PARAMETER_EMPTY(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' cannot be '").concat(n,"' when calling ").concat(r,"().")},INVALID_PARAMETER_INSTANCE(e){let{key:t,rule:i,fnName:r,value:n}=e,a="".concat(t||i.name),o="".concat(i.instanceOf.name||i.instanceOf);return"'".concat(a,"' must be instanceof ").concat(o," when calling ").concat(r,"(), received type: ").concat(GD(n),".")},INVALID_PARAMETER_RANGE(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' must be one of ").concat(i.values.join("|")," when calling ").concat(r,"(), received: ").concat(n,".")},INVALID_PARAMETER_MIN(e){let{key:t,rule:i,fnName:r,value:n}=e;return"the min value of ".concat(t||i.name," is ").concat(i.min,", received: ").concat(n,".")},INVALID_PARAMETER_MAX(e){let{key:t,rule:i,fnName:r,value:n}=e;return"the max value of ".concat(t||i.name," is ").concat(i.max,", received: ").concat(n,".")},API_CALL_TIMEOUT:e=>"".concat(e.commandDesc||e.command," timeout observed."),SIGNAL_CHANNEL_RECONNECTION_FAILED:"signal channel reconnection failed, please check your network.",SIGNAL_CHANNEL_SETUP_FAILED:e=>"SignalChannel setup failure: (errorCode: ".concat(e.errorCode,", errorMsg: ").concat(e.errorMsg," })."),ERROR_MESSAGE(e){let t="".concat(e.type," failed");return e.message&&(t="".concat(t,": ").concat(e.message,".")),t},EXCHANGE_SDP_TIMEOUT:"exchange sdp timeout.",DOWNLINK_RECONNECTION_FAILED:"downlink reconnection failed, please check your network and re-join room.",EXCHANGE_SDP_FAILED:e=>"exchange sdp failed ".concat(e.errMsg,"."),UPDATE_OFFER_TIMEOUT:"update offer timeout observed.",UPLINK_RECONNECTION_FAILED:"uplink reconnection failed, please check your network and publish again.",INVALID_RECORDID:"recordId must be an integer number.",INVALID_PURE_AUDIO:"pureAudioPushMode must be 1 or 2.",INVALID_STREAMID:"streamId must be a sting literal within 64 bytes, and not be empty.",INVALID_USER_DEFINE_RECORDID:"userDefineRecordId must be a sting literal contains (a-zA-Z),(0-9), underline and hyphen, within 64 bytes, and not be empty.",INVALID_USER_DEFINE_PUSH_ARGS:"userDefinePushArgs must be a sting literal within 256 bytes, and not be empty.",INVALID_PROXY:'proxy server url must start with "wss://".',INVALID_JOIN:"duplicate join() called.",INVALID_ROOMID_STRING:e=>"'".concat(e,"' must be validate string when useStringRoomId is true."),INVALID_ROOMID_INTEGER:e=>"'".concat(e,"' must be an integer between [1, 4294967294] when useStringRoomId is false."),INVALID_SIGNAL_CHANNEL:"SignalChannel is not ready yet.",JOIN_ROOM_TIMEOUT:"join room timeout.",JOIN_ROOM_FAILED(e){let{error:t,code:i}=e;return"Failed to join room - ".concat(t," code: ").concat(i)},REJOIN_ROOM_FAILED:e=>"reJoin room: ".concat(e.roomId," failed, please check your network."),INVALID_DESTROY:"please call leave() before destroy().",INVALID_PUBLISH:"please call join() before publish().",INVALID_UNPUBLISH:"stream has not been published yet.",INVALID_AUDIENCE:'no permission to publish() under live/audience, please call switchRole("anchor") firstly before publish().',INVALID_INITIALIZE:"cannot publish stream because stream is not initialized, is switching device, or has been closed.",INVALID_DUPLICATE_PUBLISHING:e=>"duplicate ".concat(e," stream publishing, please unpublish your prev ").concat(e," stream and then re-publish."),INVALID_SUBSCRIBE_UNDEFINED:"stream is undefined or null.",INVALID_SUBSCRIBE_LOCAL:"stream cannot be LocalStream.",INVALID_REMOTE_STREAM:"remoteStream does not exist because it has been unpublished by remote peer.",SUBSCRIBE_FAILED(e){let{message:t,userId:i,streamType:r}=e;return"failed to subscribe ".concat(i," ").concat(r," stream, reason: ").concat(t,".")},INVALID_ROLE:"switchRole can only be called in live mode.",INVALID_PARAMETER_SWITCH_ROLE:"role could only be set to a value as anchor or audience.",INVALID_OPERATION_SWITCH_ROLE:"please call join() before switchRole().",SWITCH_ROLE_TIMEOUT:"switchRole timeout.",SWITCH_ROLE_FAILED:e=>"switchRole failed, errCode: ".concat(e.code," errMsg: ").concat(e.message,"."),CLIENT_BANNED:e=>"client was banned because of ".concat(e.message,"."),INVALID_OPERATION_START_PUBLISH_CDN:"please call startPublishCDNStream() after join room and publish the local stream.",INVALID_OPERATION_STOP_PUBLISH_CDN:"please call startPublishCDNStream() before stopPublishCDNStream().",START_PUBLISH_CDN_FAILED:e=>"startPublishCDNStream failed, errMsg: ".concat(e.message,"."),STOP_PUBLISH_CDN_FAILED:e=>"stopPublishCDNStream failed, errMsg: ".concat(e.message,"."),INVALID_STREAM_ID:e=>"'".concat(e,"' can only consist of uppercase and lowercase english letters (a-zA-Z), numbers (0-9), hyphens and underscores."),START_MIX_TRANSCODE:"please call startMixTranscode() after join().",STOP_MIX_TRANSCODE:"please call stopMixTranscode() after startMixTranscode().",INVALID_AUDIO_VOLUME:"interval must be a number.",ENABLE_SMALL_STREAM_PUBLISHED:"Cannot enable small stream after localStream published.",DISABLE_SMALL_STREAM_PUBLISHED:"Cannot disable small stream after localStream published.",NOT_SUPPORTED_SMALL_STREAM:"your browser does not support opening small stream.",INVALID_SMALL_STREAM_PROFILE:"small stream profile is invalid.",INVALID_PARAMETER_REMOTE_STREAM:"remoteStream is invalid.",INVALID_OPERATION_CHANGE_SMALL:"cannot switch to the small stream without subscribing to the video of remoteStream.",REMOTE_NOT_PUBLISH_SMALL_STREAM:"remote peer does not publish small stream.",INVALID_SWITCH_DEVICE:"cannot switch device on current stream.",INVALID_SWITCH_DEVICE_PUBLISHING:"cannot switch device when publishing localStream.",INVALID_REPLACE_TRACK:"cannot replace track when publishing localStream.",INVALID_INITIALIZE_LOCAL_STREAM:"local stream has not initialized yet.",INVALID_ADD_TRACK_REPETITIVE:"previous addTrack is ongoing, please avoid repetitive execution.",INVALID_ADD_TRACK_REMOVING:"cannot add track when a track is removing.",INVALID_ADD_TRACK_PUBLISHING:"cannot add track when publishing localStream.",INVALID_STREAM_INITIALIZED:"your local stream haven't been initialized yet.",INVALID_ADD_TRACK_NUMBER:"a Stream has at most one audio track and one video track.",INVALID_REMOVE_AUDIO_TRACK:"remove audio track is not supported on your browser.",INVALID_REMOVE_AUDIO_ADDING:"cannot remove track when a track is adding.",INVALID_REMOVE_AUDIO_ON:"previous removeTrack is ongoing, please avoid repetitive execution.",INVALID_REMOVE_TRACK_PUBLISHING:"cannot remove track when publishing localStream.",INVALID_REMOVE_TRACK_NOT_TRACK:"localStream has not this track.",INVALID_REMOVE_TRACK_NUMBER:"remove the only video track is not supported, please use replaceTrack or muteVideo.",INVALID_REPLACE_TRACK_NO_TRACK:e=>"cannot replace ".concat(e.kind," track because stream has not ").concat(e.kind," track"),NOT_BUG_PACKAGE:"You need to buy packages, refer to tencent console.",START_MIX_TRANSCODE_FAILED:e=>"startMixTranscode failed, errMsg: ".concat(e.message,"."),STOP_MIX_TRANSCODE_FAILED:e=>"stopMixTranscode failed, errMsg: ".concat(e.message,"."),MIX_TRANSCODE_NOT_STARTED:"mixTranscode has not been started.",CANNOT_LESS_THAN_ZERO(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' cannot be less than 0 when calling ").concat(r,"().")},MIX_PARAMS_VIDEO_FRAMERATE:"'config.videoFramerate' should be an integer between 0 and 30, excluding 0.",MIX_PARAMS_VIDEO_GOP:"'config.videoGOP' should be an integer between 1 and 8.",MIX_PARAMS_AUDIO_BITRATE:"'config.audioBitrate' should be an integer between 32 and 192.",MIX_PARAMS_USER_Z_ORDER:e=>"'".concat(e,"' is required and must be between 1 and 15."),MIX_PARAMS_NOT_SELF:"'config.mixUsers' must contain self.",MIX_PARAMS_USER_STREAM:"'config.videoWidth' and 'config.videoHeight' of output stream should be contain all mix stream.",INVALID_PLAY:"duplicate play() call observed, please stop() firstly.",INVALID_ELEMENT_ID:e=>{let{key:t,fnName:i}=e;return"'".concat(t,"' is not found in the document object when calling ").concat(i,"().")},INVALID_ELEMENT_ID_TYPE:e=>{let{key:t,fnName:i,type:r}=e;return"the element corresponding to '".concat(t,"' must be instanceof HTMLElement when calling ").concat(i,"(), received: ").concat(r,".")},PLAY_FAILED:e=>"".concat(e.media," play failed, browser exception: ").concat(e.error.toString()),INVALID_USERID:"userId cannot be all spaces.",INVALID_CREATE_STREAM_SOURCE:"LocalStream must be created by createStream() with either audio/video or audioSource/videoSource, but can not be mixed with audio/video and audioSource/videoSource.",INVALID_CREATE_STREAM_SCREEN:"screen/video cannot be both true.",INVALID_CREATE_STREAM_AUDIO:"audio/screenAudio cannot be both true.",INVALID_CREATE_STREAM_SCREEN_AUDIO:"when screen is true, screenAudio can be configured.",NOT_SUPPORTED_HTTP:"http protocol does not support the ability to capture microphone, camera and screen. please use https to deploy your page.",NOT_SUPPORTED_WEBRTC:"your browser or environment does not support full WebRTC capabilities.",NOT_SUPPORTED_PROFILE:"your browser does not support setVideoProfile.",NOT_SUPPORTED_MEDIA:"your browser or environment does not support navigator.mediaDevices.",NOT_SUPPORTED_H264ENCODE:"your device does not support H.264 encoding.",NOT_SUPPORTED_H264DECODE:"your device does not support H.264 decoding.",NOT_SUPPORTED_TRACK:e=>"".concat(e,"Track is not supported on your browser."),NOT_SUPPORTED_SWITCH_DEVICE:"switchDevice is not supported on your browser.",NOT_SUPPORTED_CAPTURE:"Your browser or environment does not support screen sharing, please check whether the browser version.",MICROPHONE_NOT_FOUND:"no microphone detected, please check your microphone.",CAMERA_NOT_FOUND:"no camera detected, please check your camera.",SIGNAL_RESPONSE_FAILED:e=>"".concat(e.signalResponse," failed, response code is ").concat(e.code," , errMsg: ").concat(e.message,"."),CATCH_HANDLER_ERROR(e){let{name:t,event:i}=e;return"an error was caught in ".concat(t,".on('").concat(i,"', handler), please check your code in 'handler'.")},API_NOT_EXIST(e){let{name:t}=e;return"experimental api ".concat(t," does not exist.")},REPEAT_JOIN:e=>"please avoid repeated join.",CONNECTION_CLOSED:"remoteStream has been unsubscribed or unpublished by remote user.",SUBSCRIBE_ALL_FALSE:"cannot subscribe when both audio & video are false, use client.unsubscribe() instead",CLIENT_DESTROYED(e){let{funName:t}=e;return"failed to call ".concat(t,"() because client was destroyed.")},SEI_NOT_SUPPORT:e=>"not support to sendSEIMessage".concat(!1===e?" without using h264 codec":""),SEI_DISABLED:"SEI is disabled",SEI_BEFORE_PUBLISH:"please call sendSEIMessage() after publish() success",SEI_NOT_VIDEO:"cannot send sei when localStream has not video.",CALL_FREQUENCY_LIMIT:e=>{let{isSize:t,name:i,timesInSecond:r,maxSizeInSecond:n}=e;return"api ".concat(i," call ").concat(t?"size":"times"," is over ").concat(t?"".concat(n," bytes"):r," in a second.")},CONNECTION_ABORTED:e=>"connection aborted due to: ".concat(e),API_CALL_ABORTED(e){let t;return t=e.message.includes("REMOTE_STREAM_NOT_EXIST")?"Subscribe ".concat(e.userId," ").concat(e.streamType," stream aborted, reason: remote user ").concat(e.userId," unpublished stream."):"API aborted, reason: ".concat(e.message),t},DUPLICATE_AUX:"only one auxiliary stream can be published in a room.",NOT_SUPPORTED_AUX:"publish auxiliary stream is not supported on your browser.",INVALID_PARAMETER_STREAMTYPE:e=>"'streamType' is required when 'userId' is not '*', calling ".concat(e,"()"),SWITCH_PLAYBACK_QUALITY_TIMEOUT:e=>"switchPlaybackQuality timeout: waiting for first frame of user ".concat(e.userId,".")},uL=(e,t)=>t?"".concat(tR,"/").concat(e,"/").concat(t):"".concat(tR,"/").concat(e,"/index.html"),hL=()=>{if(window.TRTC_ERROR_INFO&&window.TRTC_ERROR_LINK)return{TRTC_ERROR_INFO:window.TRTC_ERROR_INFO,TRTC_ERROR_LINK:window.TRTC_ERROR_LINK};let e=null==localStorage?void 0:localStorage.getItem("trtc_error_assistance");if(e){e=JSON.parse(e);let t=document.createElement("script");t.type="text/javascript",t.text=e.message,document.body.appendChild(t);let i=window.TRTC_ERROR_INFO,r=window.TRTC_ERROR_LINK;return document.body.removeChild(t),{TRTC_ERROR_INFO:i,TRTC_ERROR_LINK:r}}return{}};function pL(e){let{key:t,data:i,link:r,addDocLink:n=!0}=e,a="",o="",s="";qD(dL[t])?a=dL[t](i):YD(dL[t])&&(a=dL[t]);let{TRTC_ERROR_INFO:c,TRTC_ERROR_LINK:l}=hL();r?s="".concat(r.className,".html#").concat(r.fnName):l&&l[t]&&(qD(l[t])?s=l[t](i):YD(l[t])&&(s=l[t]));let d=a;return HD()&&(c&&c[t]&&(qD(c[t])?o=c[t](i):YD(c[t])&&(o=c[t])),o&&(d=n?"".concat(o,"\n请查看文档: ").concat(uL("zh-cn",s),"\n\n"):"".concat(o,"\n\n"),d+=a)),n&&(d+=" \nRefer to: ".concat(uL("en",s),"\n")),d}var fL,mL=xA(zA(),1),gL=class{constructor(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];UA(this,"countMap",new Map),UA(this,"distributionMap",new Map),UA(this,"version"),UA(this,"log",oL.createLogger({id:"kv"})),e&&(iL.on("102",e=>{let{track:t,cost:i}=e;this.addSuccessEvent({key:t.kind===hR?501700:511700,cost:i})}),iL.on("103",e=>{let{track:t,error:i}=e;this.addFailedEvent({key:t.kind===hR?501700:511700,error:i})}),iL.on("266",e=>{let{enable:t}=e;this.log.info("".concat(t?"enable":"disable"," sso")),t?this.addSuccessEvent({key:525701}):this.addFailedEvent({key:525701})}))}getReportData(e,t){let i={msg_sdk_basic_info:{uint32_sdk_version:AO(this.version||QA),uint32_terminal_type:15,bytes_device_name:"",bytes_os_version:"",uint32_framework:30,uint32_network_type:0},stats_count:[...this.countMap.entries()].map(e=>{let[t,i]=e;return{uint32_key:t,uint32_count:i}}),stats_distribution:[...this.distributionMap.entries()].map(e=>{let[t,i]=e;return{uint32_key:t,distribution_items:[...i.entries()].map(e=>{let[t,i]=e;return{uint32_item_key:t,uint32_item_value:i}})}}),str_user_sig:e,bytes_report_token:t};return this.countMap.clear(),this.distributionMap.clear(),i}clear(){this.countMap.clear(),this.distributionMap.clear()}isEnumKey(e){let t=+String(e).slice(-3);return t>=700&&t<799}isErrorCodeKey(e){let t=+String(e).slice(-3);return t>=600&&t<699}isCountKey(e){let t=+String(e).slice(-3);return t>=0&&t<599}isNumberKey(e){let t=+String(e).slice(-3);return t>=800&&t<899}addCount(e){let{key:t,useUV:i=!1}=e;this.isCountKey(t)?i&&this.countMap.has(t)||this.countMap.set(t,(this.countMap.get(t)||0)+1):this.log.debug("".concat(t," is not count key, last 3 number should be 0~599"))}addEnum(e){let{key:t,value:i,useUV:r=!0}=e;var n;if(!this.isEnumKey(t))return this.log.debug("".concat(t," is not enum key, last 3 number should be 700~799"));if(r&&this.countMap.has(t))return;this.countMap.set(t,(this.countMap.get(t)||0)+1);let a=(null==(n=this.distributionMap)?void 0:n.get(t))||new Map;a.set(i,(a.get(i)||0)+1),this.distributionMap.set(t,a)}addNumber(e){let{key:t,value:i,split:r=100,useUV:n=!1,max:a=5e3}=e;var o;if(!this.isNumberKey(t))return this.log.debug("".concat(t," is not number key, last 3 number should be 800~899"));if(n&&this.countMap.has(t))return;i>a&&(i=a),this.countMap.set(t,(this.countMap.get(t)||0)+1);let s=(null==(o=this.distributionMap)?void 0:o.get(t))||new Map,c=0;if(XD(r))c=Math.floor(i/r);else for(let l=r.length-1;l>0;l--)if(i>r[l]){c=l;break}s.set(c,(s.get(c)||0)+1),this.distributionMap.set(t,s)}addSuccessEvent(e){let{key:t,cost:i,timeKey:r,split:n}=e;if(t&&(this.addEnum({key:t,value:1,useUV:!1}),i)){let e=+String(t).slice(-3);e<800&&e>=700?this.addNumber({key:r||t+100,value:i,split:n}):r||this.log.debug("time stat ignored, ".concat(t))}}addFailedEvent(e){let{key:t,error:i}=e;if(!t)return;let r=mk.UNKNOWN;i&&(XD(i)?r=i:(!KD(i.extraCode)||!KD(i.code))&&(r=i.extraCode||i.code)),this.addEnum({key:t,value:0,useUV:!1}),this.addEnum({key:t,value:Math.abs(r),useUV:!1})}},_L=((fL=_L||{})[fL.DECODER_TYPE=514700]="DECODER_TYPE",fL[fL.DECODER_HW_SW=514701]="DECODER_HW_SW",fL[fL.DECODE_RESULT=514702]="DECODE_RESULT",fL[fL.DECODE_FAILED_OS=514703]="DECODE_FAILED_OS",fL[fL.DOWNGRADE_RESULT=514704]="DOWNGRADE_RESULT",fL[fL.DOWNGRADE_WEBCODECS_VIDEO=514705]="DOWNGRADE_WEBCODECS_VIDEO",fL[fL.DOWNGRADE_WEBCODECS_2D=514706]="DOWNGRADE_WEBCODECS_2D",fL[fL.DOWNGRADE_WASM_WEGBL=514707]="DOWNGRADE_WASM_WEGBL",fL[fL.DOWNGRADE_WASM_VIDEO=514708]="DOWNGRADE_WASM_VIDEO",fL[fL.DOWNGRADE_WASM_2D=514709]="DOWNGRADE_WASM_2D",fL[fL.DECODE_H264_RESULT=514710]="DECODE_H264_RESULT",fL[fL.DECODE_H265_RESULT=514711]="DECODE_H265_RESULT",fL[fL.DECODE_VP8_RESULT=514712]="DECODE_VP8_RESULT",fL[fL.DECODE_CAPABILITIES=514713]="DECODE_CAPABILITIES",fL[fL.H264_PROFILE_LEVEL_ID_HIGH=514714]="H264_PROFILE_LEVEL_ID_HIGH",fL[fL.H264_PROFILE_LEVEL_ID_MAIN=514715]="H264_PROFILE_LEVEL_ID_MAIN",fL[fL.RENDER_FREEZE_RATE=514850]="RENDER_FREEZE_RATE",fL[fL.DATA_FREEZE_RATE=514851]="DATA_FREEZE_RATE",fL[fL.VIDEO_CONSUME_RENDER_RATE=514852]="VIDEO_CONSUME_RENDER_RATE",fL),vL=new gL(!0);new gL(!1);var yL=vL,EL={result:!1,detail:{isBrowserSupported:!1,isWebRTCSupported:!1,isWebCodecsSupported:!1,isMediaDevicesSupported:!1,isScreenShareSupported:!1,isSmallStreamSupported:!1,isH264EncodeSupported:!1,isVp8EncodeSupported:!1,isH265EncodeSupported:!1,isH264DecodeSupported:!1,isVp8DecodeSupported:!1,isH265DecodeSupported:!1}},bL=new Map([[$k,["Firefox",eC]],[nC,["Edg",aC]],[YC,["Chrome",QC]],[eD,["Safari",iD]],[uC,["TBS",hC]],[pC,["XWEB",fC]],[gC&&Kk,["WeChat",_C]],[bC,["QQ(Win)",wC]],[yC,["QQ(Mobile)",EC]],[vC,["QQ(Mobile X5)",EC]],[IC,["QQ(Mac)",TC]],[SC,["QQ(iPad)",AC]],[LC,["MI",NC]],[PC,["HW",UC]],[FC,["Samsung",BC]],[VC,["OPPO",HC]],[jC,["VIVO",zC]],[iC,["EDGE",rC]],[sC,["SogouMobile",cC]],[lC,["Sogou",dC]]]);function wL(){let e=bL.get(!0);return{browserName:e?e[0]:"unknown",browserVersion:e?e[1]:"unknown"}}var IL=function(){return!(iC||nC&&oC<80||$k&&tC<56)},TL=function(){return["VideoDecoder","VideoEncoder","AudioEncoder","AudioDecoder"].every(e=>e in window)},SL=function(){if(!navigator.mediaDevices)return RL()||oL.error(dL.NOT_SUPPORTED_MEDIA),!1;let e=["getUserMedia","enumerateDevices"];return e.filter(e=>e in navigator.mediaDevices).length===e.length},AL=!1;function RL(){return"http:"===location.protocol&&!dD&&(AL||oL.error(pL({key:lL.NOT_SUPPORTED_HTTP})),AL=!0,!0)}var kL=function(){return(null==window?void 0:window.OffscreenCanvas)&&(null==window?void 0:window.MediaStreamTrackProcessor)&&(null==window?void 0:window.MediaStreamTrackGenerator)},CL=function(){return!(null==window||!window.MediaStreamTrackGenerator)},DL=async function(){var e,t,i;if(EL.detail.isH264EncodeSupported&&EL.detail.isVp8EncodeSupported)return{isH264EncodeSupported:EL.detail.isH264EncodeSupported,isVp8EncodeSupported:EL.detail.isVp8EncodeSupported,isH265EncodeSupported:EL.detail.isH265EncodeSupported};let r,n=!1,a=!1,o=!1;try{let s=new RTCPeerConnection,c=document.createElement(uR);c.getContext("2d");let l=c.captureStream(0);return s.addTrack(l.getVideoTracks()[0],l),r=await s.createOffer(),n=-1!==(null==(e=r.sdp)?void 0:e.toLowerCase().indexOf("h264")),a=-1!==(null==(t=r.sdp)?void 0:t.toLowerCase().indexOf("vp8")),o=-1!==(null==(i=r.sdp)?void 0:i.toLowerCase().indexOf("h265")),s.close(),{isH264EncodeSupported:n,isVp8EncodeSupported:a,isH265EncodeSupported:o}}catch(s){return{isH264EncodeSupported:!1,isVp8EncodeSupported:!1,isH265EncodeSupported:!1}}},OL=async function(){var e;if(EL.detail.isH264DecodeSupported&&EL.detail.isVp8DecodeSupported)return{isH264DecodeSupported:EL.detail.isH264DecodeSupported,isVp8DecodeSupported:EL.detail.isVp8DecodeSupported,isH265DecodeSupported:EL.detail.isH265DecodeSupported};let t,i=!1,r=!1;try{let n=new RTCPeerConnection;$L()?(n.addTransceiver(pR,{direction:"recvonly"}),t=await n.createOffer()):t=await n.createOffer({offerToReceiveVideo:!0}),-1!==t.sdp.toLowerCase().indexOf("h264")&&!(rD&&ZC<79)&&(i=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0);let a=-1!==(null==(e=t.sdp)?void 0:e.toLowerCase().indexOf("h265"));return n.close(),{isH264DecodeSupported:i,isVp8DecodeSupported:r,isH265DecodeSupported:a}}catch(n){return{isH264DecodeSupported:!1,isVp8DecodeSupported:!1,isH265DecodeSupported:!1}}};var LL=CO(async e=>{let t=Date.now(),i=hN(),r=SL(),n=TL();if(EL.detail.isWebRTCSupported=i,EL.detail.isMediaDevicesSupported=r,EL.detail.isWebCodecsSupported=n,EL.detail.isScreenShareSupported=PL(),EL.detail.isSmallStreamSupported=YL(),37===e)return Object.assign(EL.detail,await async function(){return FL||(FL=new Promise(async e=>{let t={isH264EncodeSupported:!1,isH264DecodeSupported:!1,isVp8EncodeSupported:!1,isVp8DecodeSupported:!1};if(!TL())return void e(t);let i=null,r=null,n=null,a=()=>{n&&clearTimeout(n),i=null,r=null};try{i=document.createElement("canvas"),r=i.getContext("2d"),i.width=320,i.height=240;let o=0,s=()=>{!r||!i||(r.fillStyle="hsl(".concat(o%360,", 50%, 50%)"),r.fillRect(0,0,i.width,i.height),r.fillStyle="white",r.font="20px Arial",r.fillText("Frame ".concat(o),10,30),o++)};n=setTimeout(()=>{a(),e(t)},5e3);let c=[{type:"h264",encodeConfig:{codec:"avc1.42E01E",avc:{format:"annexb"},width:320,height:240,bitrate:1e6},decodeConfig:{codec:"avc1.42E01E",avc:{format:"annexb"}}},{type:"vp8",encodeConfig:{codec:"vp8",width:320,height:240,bitrate:1e6},decodeConfig:{codec:"vp8"}}];(await Promise.all(c.map(async e=>{let t,r={type:e.type,encodeSupported:!1,decodeSupported:!1};try{t=await new Promise(async(t,n)=>{try{let a=new VideoEncoder({output:e=>{t(e),r.encodeSupported=!0},error:n});a.configure(e.encodeConfig),s();let o=new VideoFrame(i,{timestamp:0});a.encode(o,{keyFrame:!0}),o.close(),await a.flush(),a.close()}catch(a){n(a)}})}catch(p){return oL.warn("".concat(e.type," encoder error:"),p),r}try{await new Promise(async(i,n)=>{try{let a=new VideoDecoder({output:e=>{r.decodeSupported=!0,i(0),e.close()},error:n});a.configure(e.decodeConfig),a.decode(t),await a.flush(),a.close()}catch(a){n(a)}})}catch(p){oL.warn("".concat(e.type," decoder error:"),p)}return r}))).forEach(e=>{"h264"===e.type?(t.isH264EncodeSupported=e.encodeSupported,t.isH264DecodeSupported=e.decodeSupported):"vp8"===e.type&&(t.isVp8EncodeSupported=e.encodeSupported,t.isVp8DecodeSupported=e.decodeSupported)}),a(),e(t)}catch(o){a(),oL.warn("detectWebCodecsSupported failed:",o),e(t)}}),FL)}()),EL.detail.isBrowserSupported=n,EL.result=r&&n,EL.result||oL.error("".concat(navigator.userAgent," ").concat(wO(EL.detail,!1))),yN(e),yL.addNumber({key:523800,value:Date.now()-t}),EL;if(EL.result&&EL.detail.isH264EncodeSupported&&EL.detail.isVp8EncodeSupported&&EL.detail.isH265EncodeSupported&&EL.detail.isH264DecodeSupported&&EL.detail.isVp8DecodeSupported&&EL.detail.isH265DecodeSupported)return EL;let a=IL(),{encode:o,decode:s}=await async function(){let[e,t]=await Promise.all([DL(),OL()]);return{encode:{h264:e.isH264EncodeSupported,vp8:e.isVp8EncodeSupported,h265:e.isH265EncodeSupported},decode:{h264:t.isH264DecodeSupported,vp8:t.isVp8DecodeSupported,h265:t.isH265DecodeSupported}}}(),{h264:c,vp8:l}=o,{h264:d}=s,{h265:u}=o,{vp8:h,h265:p}=s;if(!c||!l){let e=await DL();oL.warn("detect encode again h264:".concat(c," vp8:").concat(l," result: ").concat(JSON.stringify(e))),c=e.isH264EncodeSupported,l=e.isVp8EncodeSupported}if(c&&d&&Jk&&KC&&!pC&&!uC&&(!VC||115!==ZC)){let{encode:e,decode:t}=await UL();c=e,d=t}return EL.result=a&&i&&r&&(c||l)&&(d||h),EL.detail.isBrowserSupported=a,EL.detail.isWebRTCSupported=i,EL.detail.isH264EncodeSupported=c,EL.detail.isVp8EncodeSupported=l,EL.detail.isH265EncodeSupported=u,EL.detail.isH264DecodeSupported=d,EL.detail.isVp8DecodeSupported=h,EL.detail.isH265DecodeSupported=p,EL.result||oL.error("".concat(navigator.userAgent," ").concat(wO(EL.detail,!1))),yN(),yL.addNumber({key:523800,value:Date.now()-t}),EL}),NL=function(){return EL.result},PL=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)},xL="undefined"!=typeof HTMLMediaElement&&"setSinkId"in HTMLMediaElement.prototype,ML=null;async function UL(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3;return ML||(ML=new Promise(async t=>{let i={encode:!1,decode:!1},r=()=>{};try{let n=document.createElement("canvas"),a=n.getContext("2d");n.width=640,n.height=480;let o=setInterval(()=>{a.fillText("test",Math.floor(640*Math.random()),Math.floor(480*Math.random()))},66),s=-1,c=-1;r=()=>{clearInterval(s),clearInterval(o),clearTimeout(c),d.close(),u.close(),l.getTracks().forEach(e=>e.stop())},c=setTimeout(()=>{r(),t(i)},e);let l=n.captureStream(),d=new RTCPeerConnection({}),u=new RTCPeerConnection({offerToReceiveAudio:!0,offerToReceiveVideo:!0});d.addEventListener("icecandidate",e=>u.addIceCandidate(e.candidate)),u.addEventListener("icecandidate",e=>d.addIceCandidate(e.candidate)),d.addTrack(l.getVideoTracks()[0],l);let h=await d.createOffer();await d.setLocalDescription(h),await u.setRemoteDescription(h);let p=await u.createAnswer(),f=mL.default.parse(p.sdp),m=f.media[0].rtp.findIndex(e=>"H264"===e.codec);f.media[0].rtp=[f.media[0].rtp[m]],f.media[0].fmtp=f.media[0].fmtp.filter(e=>e.payload===f.media[0].rtp[0].payload),f.media[0].rtcpFb&&(f.media[0].rtcpFb=f.media[0].rtcpFb.filter(e=>e.payload===f.media[0].rtp[0].payload)),p.sdp=mL.default.write(f),await u.setLocalDescription(p),await d.setRemoteDescription(p),s=setInterval(async()=>{i.encode&&i.decode&&(r(),t(i));let e=d.getSenders()[0],n=u.getReceivers()[0];if(!e||!n)return;let[a,o]=await Promise.all([e.getStats(),n.getStats()]);i.encode||a.forEach(e=>{"outbound-rtp"===e.type&&(e.mediaType===pR||e.kind===pR)&&e.bytesSent>0&&(i.encode=!0)}),i.decode||o.forEach(e=>{"inbound-rtp"===e.type&&(e.mediaType===pR||e.kind===pR)&&e.bytesReceived>0&&(i.decode=!0)})},100)}catch(n){r(),oL.warn("detectH264Supported failed",n),t({encode:!0,decode:!0})}}).then(e=>(e.encode||(e.decode=!0),(!e.encode||!e.decode)&&oL.warn("detectH264Supported encode: ".concat(e.encode," decode: ").concat(e.decode," ").concat("")),e)),ML)}var FL=null;var BL=(e,t,i)=>{"http:"===location.protocol&&!dD&&(e[t]=()=>{throw new _k({code:mk.INVALID_OPERATION,message:dL.NOT_SUPPORTED_HTTP})})},VL=function(e){return!("candidate-pair"!==e.type||!e.nominated||"in-progress"!==e.state&&"succeeded"!==e.state)&&!(ZD(e.selected)&&!e.selected)};function HL(){let e="";if(screen.width){let t=screen.width?screen.width*window.devicePixelRatio:"",i=screen.height?screen.height*window.devicePixelRatio:"";e+="".concat(t," * ").concat(i)}return e}function jL(){return navigator.getUserMedia||navigator.mediaDevices&&navigator.mediaDevices.getUserMedia}function zL(){let e={isSupported:!1},t=["AudioContext","webkitAudioContext","mozAudioContext","msAudioContext"];for(let i=0;i<t.length;i++)if(t[i]in window){e.isSupported=!0;break}return e.isSupported}function WL(){return"captureStream"in HTMLCanvasElement.prototype}function GL(){return!(gC||Xk||ZC&&ZC<63)&&!(!IL()||!WL())}function qL(){return!(ZC<74||iC||oD<11||tC<46)}function KL(){return KC&&ZC>=131}function YL(){return GL()||qL()}var XL=function(){if(KD(window.RTCRtpTransceiver)||!$L()||!("currentDirection"in RTCRtpTransceiver.prototype))return!1;let e=null,t=!1;try{e=new RTCPeerConnection({sdpSemantics:"unified-plan"}),e.addTransceiver(hR),t=!0}catch(sM){}return null==e||e.close(),t};function ZL(){return"RTCPeerConnection"in window&&"getReceivers"in window.RTCPeerConnection.prototype}function JL(){return"RTCPeerConnection"in window&&"getSenders"in window.RTCPeerConnection.prototype}function QL(){return"RTCPeerConnection"in window&&"getTransceivers"in window.RTCPeerConnection.prototype}function $L(){return!(11===oD&&!lD)&&("RTCPeerConnection"in window&&"addTransceiver"in window.RTCPeerConnection.prototype)}var eN=!(!$L()||KC&&ZC<86);function tN(){return"RTCRtpTransceiver"in window&&"stop"in window.RTCRtpTransceiver.prototype}var iN="RTCRtpSender"in window;function rN(){return iN&&"replaceTrack"in window.RTCRtpSender.prototype}function nN(){return iN&&"setParameters"in window.RTCRtpSender.prototype&&JL()}var aN="RTCRtpReceiver"in window&&"getSynchronizationSources"in window.RTCRtpReceiver.prototype,oN=window.MediaStreamTrack&&"getSettings"in MediaStreamTrack.prototype,sN=window.MediaStreamTrack&&"getCapabilities"in MediaStreamTrack.prototype,cN="undefined"!=typeof InputDeviceInfo&&"getCapabilities"in InputDeviceInfo.prototype,lN=iN&&"createEncodedStreams"in window.RTCRtpSender.prototype&&GC()>=86,dN="RTCRtpScriptTransform"in window,uN=iN&&(lN||dN),hN=function(){return["RTCPeerConnection","webkitRTCPeerConnection","RTCIceGatherer"].filter(e=>e in window).length>0};function pN(){let e={AudioDecoder:!1,AudioEncoder:!1,VideoDecoder:!1,VideoEncoder:!1,ImageDecoder:!1};return KD(window.AudioDecoder)||(e.AudioDecoder=!0),KD(window.AudioEncoder)||(e.AudioEncoder=!0),KD(window.VideoDecoder)||(e.VideoDecoder=!0),KD(window.VideoEncoder)||(e.VideoEncoder=!0),KD(window.ImageDecoder)||(e.ImageDecoder=!0),e}function fN(){return"mediaSession"in navigator&&!KD(navigator.mediaSession.setActionHandler)}function mN(){return!KD(window.WebTransport)}function gN(){return"undefined"!=typeof WebAssembly&&WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))}function _N(){let e={browser:"".concat(hD.name,"/").concat(hD.version),os:yD(),displayResolution:HL(),isScreenShareSupported:PL(),isWebRTCSupported:hN(),isGetUserMediaSupported:jL(),isWebAudioSupported:zL(),isWebSocketsSupported:"WebSocket"in window&&2===window.WebSocket.CLOSING,isWebCodecSupported:pN(),isMediaSessionSupported:fN(),isWebTransportSupported:mN()};return navigator.userAgent.includes("miniProgram")&&(e.browser="mini/".concat(e.browser)),e}var vN="checkResult";function yN(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30;cL.setItem(vN+e,{ua:navigator.userAgent,checkResult:EL})}function EN(e){RL();let t=cL.getItem(vN+e);t&&t.ua===navigator.userAgent&&t.checkResult&&function(e,t){return!!JD(e)&&Object.keys(t).every(t=>t in e)}(t.checkResult.detail,EL.detail)&&(EL=t.checkResult),LL(e)}function bN(){return"requestVideoFrameCallback"in HTMLVideoElement.prototype}var wN="RTCRtpReceiver"in window&&"jitterBufferTarget"in window.RTCRtpReceiver.prototype;function IN(e){return{h264:1,h265:2,vp8:3,vp9:4,av1:5}[e]}var TN=!1;async function SN(){var e;try{if(TN||null==(e=null==navigator?void 0:navigator.mediaCapabilities)||!e.encodingInfo)return;let t=ED(),i=gC||pC?4:KC?1:eD?2:$k?3:0;if(0===t||0===i)return;TN=!0;let r=["H264","VP8","VP9","AV1","H265"],[n,a]=await Promise.all([AN(r),RN(r)]);n&&Object.keys(n).forEach(e=>{let r=IN(e.toLowerCase());yL.addEnum({key:513707,value:+"".concat(r).concat(+n[e].supported).concat(+n[e].powerEfficient).concat(t).concat(i),useUV:!1})}),a&&Object.keys(a).forEach(e=>{let r=IN(e.toLowerCase());yL.addEnum({key:514713,value:+"".concat(r).concat(+a[e].supported).concat(+a[e].powerEfficient).concat(t).concat(i),useUV:!1})});let{sender:o,receiver:s}=kN();yL.addEnum({key:513708,value:+"".concat(t).concat(i).concat(+o.high),useUV:!1}),yL.addEnum({key:513709,value:+"".concat(t).concat(i).concat(+o.main),useUV:!1}),yL.addEnum({key:514714,value:+"".concat(t).concat(i).concat(+s.high),useUV:!1}),yL.addEnum({key:514715,value:+"".concat(t).concat(i).concat(+s.main),useUV:!1})}catch(t){oL.info("detectVideoCodecCapabilities failed",t)}}async function AN(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1920,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1080,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:3e3,a={};try{for(let o of e){let e=await navigator.mediaCapabilities.encodingInfo({type:"webrtc",video:{contentType:"video/".concat(o),width:t,height:i,bitrate:n,framerate:r}});a[o]=e}}catch(ZA){}return a}async function RN(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1920,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1080,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:3e3,a={};try{for(let o of e){let e=await navigator.mediaCapabilities.decodingInfo({type:"webrtc",video:{contentType:"video/".concat(o),width:t,height:i,bitrate:n,framerate:r}});a[o]=e}}catch(ZA){}return a}function kN(){let e={sender:{base:!1,main:!1,high:!1},receiver:{base:!1,main:!1,high:!1}};try{if(RTCRtpSender&&"function"==typeof RTCRtpSender.getCapabilities){let t=RTCRtpSender.getCapabilities("video");t&&t.codecs&&t.codecs.filter(e=>"video/h264"===e.mimeType.toLowerCase()).forEach(t=>{if(t.sdpFmtpLine){let i=t.sdpFmtpLine.match(/profile-level-id=([0-9a-fA-F]+)/);if(i&&i[1])switch(i[1].slice(0,2)){case"42":e.sender.base=!0;break;case"4d":e.sender.main=!0;break;case"64":e.sender.high=!0}}})}if(RTCRtpReceiver&&"function"==typeof RTCRtpReceiver.getCapabilities){let t=RTCRtpReceiver.getCapabilities("video");t&&t.codecs&&t.codecs.filter(e=>"video/h264"===e.mimeType.toLowerCase()).forEach(t=>{if(t.sdpFmtpLine){let i=t.sdpFmtpLine.match(/profile-level-id=([0-9a-fA-F]+)/);if(i&&i[1])switch(i[1].slice(0,2)){case"42":e.receiver.base=!0;break;case"4d":e.receiver.main=!0;break;case"64":e.receiver.high=!0}}})}}catch(t){oL.warn("get H264 profile levelId failed",t)}return e}var CN=xA(BA(),1),DN=Symbol("instance"),ON=Symbol("cacheResult"),LN=class{constructor(e,t,i){this.oldState=e,this.newState=t,this.action=i,this.aborted=!1}abort(e){this.aborted=!0,UN.call(e,this.oldState,new Error("action '".concat(this.action,"' aborted")))}toString(){return"".concat(this.action,"ing")}},NN=class extends Error{constructor(e,t,i){super(t),this.state=e,this.message=t,this.cause=i}};var PN=new Map;function xN(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(r,n,a)=>{let o=i.action||n;if(!i.context){let i=PN.get(r)||[];PN.has(r)||PN.set(r,i),i.push({from:e,to:t,action:o})}let s=a.value;a.value=function(){let r=this;for(var n=arguments.length,a=new Array(n),c=0;c<n;c++)a[c]=arguments[c];if(i.context&&(r=FN.get("function"==typeof i.context?i.context.call(this,...a):i.context)),r.state===t)return i.sync?r[ON]:Promise.resolve(r[ON]);r.state instanceof LN&&r.state.action==i.abortAction&&r.state.abort(r);let l=null;Array.isArray(e)?0==e.length?r.state instanceof LN&&r.state.abort(r):("string"!=typeof r.state||!e.includes(r.state))&&(l=new NN(r._state,"".concat(r.name," ").concat(o," to ").concat(t," failed: current state ").concat(r._state," not from ").concat(e.join("|")))):e!==r.state&&(l=new NN(r._state,"".concat(r.name," ").concat(o," to ").concat(t," failed: current state ").concat(r._state," not from ").concat(e)));let d=e=>{if(i.fail&&i.fail.call(this,e),i.sync){if(i.ignoreError)return e;throw e}return i.ignoreError?Promise.resolve(e):Promise.reject(e)};if(l)return d(l);let u=r.state,h=new LN(u,t,o);UN.call(r,h);let p=e=>{var n;return r[ON]=e,h.aborted||(UN.call(r,t),null===(n=i.success)||void 0===n||n.call(this,r[ON])),e},f=e=>(UN.call(r,u,e),d(e));try{let e=s.apply(this,a);return function(e){return"object"==typeof e&&e&&"then"in e}(e)?e.then(p).catch(f):i.sync?p(e):Promise.resolve(p(e))}catch(m){return f(new NN(r._state,"".concat(r.name," ").concat(o," from ").concat(e," to ").concat(t," failed: ").concat(m),m instanceof Error?m:new Error(String(m))))}}}}var MN="undefined"!=typeof window&&window.__AFSM__?(e,t)=>{window.dispatchEvent(new CustomEvent(e,{detail:t}))}:"undefined"!=typeof importScripts?(e,t)=>{postMessage({type:e,payload:t})}:()=>{};function UN(e,t){let i=this._state;this._state=e;let r=e.toString();e&&this.emit(r,i),this.emit(FN.STATECHANGED,e,i,t),this.updateDevTools({value:e,old:i,err:t instanceof Error?t.message:String(t)})}var FN=class e extends CN.default{constructor(t,i,r){super(),this.name=t,this.groupName=i,this._state=e.INIT,t||(t=Date.now().toString(36)),r?Object.setPrototypeOf(this,r):r=Object.getPrototypeOf(this),i||(this.groupName=this.constructor.name);let n=r[DN];n?this.name=n.name+"-"+n.count++:r[DN]={name:this.name,count:0},this.updateDevTools({diagram:this.stateDiagram})}get stateDiagram(){let e=Object.getPrototypeOf(this),t=PN.get(e)||[],i=new Set,r=[],n=[],a=new Set,o=Object.getPrototypeOf(e);PN.has(o)&&(o.stateDiagram.forEach(e=>i.add(e)),o.allStates.forEach(e=>a.add(e))),t.forEach(e=>{let{from:t,to:i,action:a}=e;"string"==typeof t?r.push({from:t,to:i,action:a}):t.length?t.forEach(e=>{r.push({from:e,to:i,action:a})}):n.push({to:i,action:a})}),r.forEach(e=>{let{from:t,to:r,action:n}=e;a.add(t),a.add(r),a.add(n+"ing"),i.add("".concat(t," --\x3e ").concat(n,"ing : ").concat(n)),i.add("".concat(n,"ing --\x3e ").concat(r," : ").concat(n," 🟢")),i.add("".concat(n,"ing --\x3e ").concat(t," : ").concat(n," 🔴"))}),n.forEach(e=>{let{to:t,action:r}=e;i.add("".concat(r,"ing --\x3e ").concat(t," : ").concat(r," 🟢")),a.forEach(e=>{e!==t&&i.add("".concat(e," --\x3e ").concat(r,"ing : ").concat(r))})});let s=[...i];return Object.defineProperties(e,{stateDiagram:{value:s},allStates:{value:a}}),s}static get(t){let i;return"string"==typeof t?(i=e.instances.get(t),i||e.instances.set(t,i=new e(t,void 0,Object.create(e.prototype)))):(i=e.instances2.get(t),i||e.instances2.set(t,i=new e(t.constructor.name,void 0,Object.create(e.prototype)))),i}static getState(t){var i;return null===(i=e.get(t))||void 0===i?void 0:i.state}updateDevTools(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};MN(e.UPDATEAFSM,Object.assign({name:this.name,group:this.groupName},t))}get state(){return this._state}set state(e){UN.call(this,e)}};FN.STATECHANGED="stateChanged",FN.UPDATEAFSM="updateAFSM",FN.INIT="[*]",FN.ON="on",FN.OFF="off",FN.instances=new Map,FN.instances2=new WeakMap;var BN="undefined"!=typeof window,VN=BN&&window.requestIdleCallback||function(e){let t=Date.now();return setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1e3)},HN=BN&&window.cancelIdleCallback||function(e){clearTimeout(e)},jN=BN&&(window.cancelAnimationFrame||window.mozCancelAnimationFrame),zN=class e{static generateTaskID(){return this.currentTaskID++}static run(e,t,i){null!=i&&i.fps&&(i.delay=i.delay||Number((1e3/i.fps).toFixed(2))),i=DA("interval"===e?{delay:2e3,count:0,backgroundTask:!0}:"ric"===e?{delay:1e4,count:0}:"raf"===e?{fps:60,delay:16.6,count:0,backgroundTask:!0}:{delay:2e3,count:0,backgroundTask:!0},i);let r=OA(DA({taskID:this.generateTaskID(),loopCount:0,intervalID:null,timeoutID:null,rafID:null,ricID:null,taskName:e,callback:t},i),{delay:i.delay});return this.taskMap.set(r.taskID,r),this[e](r),r.taskID}static interval(t){return t.intervalID=setInterval(()=>{t.callback(),t.loopCount+=1,e.isBreakLoop(t)},t.delay)}static intervalInWorker(t){e.sharedWorker||(e.sharedWorker=new Worker(URL.createObjectURL(new Blob(["\n const timers = new Map();\n self.onmessage = function(e) {\n const { taskId, delay, type } = e.data;\n if (type === 'start') {\n timers.set(taskId, setInterval(() => {\n self.postMessage({ type: 'tick', taskId });\n }, delay));\n } else if (type === 'stop') {\n clearInterval(timers.get(taskId));\n timers.delete(taskId);\n }\n };\n "],{type:"application/javascript"}))),e.sharedWorker.onmessage=t=>{var i;if("tick"===t.data.type){let r=e.workerTasks.get(t.data.taskId);r&&(e.isBreakLoop(r)?(null==(i=e.sharedWorker)||i.postMessage({type:"stop",taskId:r.taskID}),e.workerTasks.delete(r.taskID)):(r.callback(),r.loopCount+=1))}}),e.workerTasks.set(t.taskID,t),e.sharedWorker.postMessage({taskId:t.taskID,delay:t.delay,type:"start"})}static timeout(t){let i=()=>{if(t.callback(),t.loopCount+=1,!e.isBreakLoop(t))return t.timeoutID=setTimeout(i,t.delay)};return t.timeoutID=setTimeout(i,t.delay)}static ric(t){let i,r=sO(),n=()=>{if(i=sO()-r,i>=t.delay&&(r=sO()-Math.floor(i%t.delay),t.callback(),t.loopCount+=1),!e.isBreakLoop(t))return t.ricID=VN(n,{timeout:t.delay})};return t.ricID=VN(n,{timeout:t.delay})}static raf(t){let i,r=sO(),n=()=>document.hidden&&t.backgroundTask?(i=sO()-r,r=sO(),t.callback(),t.loopCount+=1,e.isBreakLoop(t)?void 0:t.timeoutID=setTimeout(n,t.delay-Math.floor(i%t.delay))):(i=sO()-r,i>=t.delay&&(r=sO()-Math.floor(i%t.delay),t.callback(),t.loopCount+=1),e.isBreakLoop(t)?void 0:t.rafID=requestAnimationFrame(n));if(t.rafID=requestAnimationFrame(n),t.backgroundTask){let e=()=>{if(document.hidden){let e=sO()-r;e>=t.delay?n():t.timeoutID=setTimeout(n,t.delay-e)}};document.addEventListener("visibilitychange",e),t.onVisibilitychange=e,document.hidden&&e()}return t.taskID}static hasTask(e){return this.taskMap.has(e)}static clearTask(e){if(!this.taskMap.has(e))return!0;let{intervalID:t,timeoutID:i,rafID:r,ricID:n,onVisibilitychange:a}=this.taskMap.get(e);return t&&clearInterval(t),i&&clearTimeout(i),r&&jN&&jN(r),n&&HN(n),a&&document.removeEventListener("visibilitychange",a),this.taskMap.delete(e),!0}static isBreakLoop(e){return!this.hasTask(e.taskID)||0!==e.count&&e.loopCount>=e.count&&(this.clearTask(e.taskID),!0)}};UA(zN,"taskMap",new Map),UA(zN,"currentTaskID",1),UA(zN,"sharedWorker",null),UA(zN,"workerTasks",new Map);var WN=zN,GN={LOAD_START:IR,LOADED_DATA:TR,LOADED_META_DATA:SR,MEDIA_TRACK_CHANGED:"media-track-changed",PLAYER_STATE_CHANGED:"player-state-changed",ERROR:"error",AUTOPLAY_FAILED:"autoplay-failed",RESIZE:OR,TIME_UPDATE:"time-update",LEAVE_PICTURE_IN_PICTURE:CR,ENTER_PICTURE_IN_PICTURE:kR,USER_RESUME_IN_PIP_OR_FULL_SCREEN:"user-resume-in-pip-or-full-screen",USER_PAUSE_IN_PIP_OR_FULL_SCREEN:"user-pause-in-pip-or-full-screen",ENTER_FULL_SCREEN:"enter-full-screen",LEAVE_FULL_SCREEN:"leave-full-screen",VOLUME_CHANGE:"volume-change"},qN={};PA(qN,{create:()=>YN,remove:()=>XN});var KN=new WeakMap;function YN(e,t){KN.has(e)||KN.set(e,[]);let i=KN.get(e),r={add:(e,n)=>("addEventListener"in t?(i.push(t.removeEventListener.bind(t,e,n)),t.addEventListener(e,n)):(i.push(t.off.bind(t,e,n)),t.on(e,n)),r)};return r}function XN(e){let t=KN.get(e);t&&(t.forEach(e=>e()),KN.delete(e))}var ZN=new class{constructor(){UA(this,"_roomIdMap",new Map),UA(this,"_configs"),"undefined"==typeof registerProcessor&&(this._configs={sdkAppId:"",userId:"",version:QA,env:aR,browserVersion:hD.name+hD.version,ua:navigator.userAgent})}setConfig(e){let{sdkAppId:t,env:i,userId:r,roomId:n}=e;t!==this._configs.sdkAppId&&(this._configs.sdkAppId=String(t)),this._configs.env=i,this._configs.userId=r,this._roomIdMap.set(r,String(n))}logSuccessEvent(e){dD||!oL.isAbleToUpload||this._configs.env===aR&&this.uploadEventToKibana(OA(DA({},e),{result:"success"}))}logFailedEvent(e){if(dD||!oL.isAbleToUpload)return;let{eventType:t,code:i,error:r,userId:n}=e,a={roomId:this._roomIdMap.get(n||this._configs.userId),userId:n,eventType:t,result:"failed",code:i||(null==r?void 0:r.extraCode)||(null==r?void 0:r.code)||mk.UNKNOWN};this._configs.env===aR&&this.uploadEventToKibana(OA(DA({},a),{error:r}))}uploadEventToKibana(e){let t="stat-".concat(e.eventType,"-").concat(e.result);("delta-join"===e.eventType||"delta-leave"===e.eventType||"delta-publish"===e.eventType)&&(t="".concat(e.eventType,":").concat(e.delta)),this.uploadEvent({log:t,userId:e.userId}),"failed"===e.result&&(t="stat-".concat(e.eventType,"-").concat(e.result,"-").concat(e.code),this.uploadEvent({log:t,userId:e.userId,error:e.error}))}uploadEvent(e){let{log:t,userId:i,error:r}=e,n={timestamp:yk(),sdkAppId:this._configs.sdkAppId,userId:i||this._configs.userId,version:QA,log:t};r&&(n.errorInfo=r.message,r.stack&&(n.errorInfo+="\n".concat(r.stack)));let a=nL.enable?FO(n,2002,Number(this._configs.sdkAppId)):JSON.stringify(n);this.sendRequest(RD(this._configs.sdkAppId,nR),a)}sendRequest(e,t){setTimeout(()=>YO({url:e,body:t,priority:"low"}).catch(()=>{}),2e3)}},JN=new WeakMap;var QN=class extends FN{constructor(e,t){super(e.id,"".concat(t,"-player")),this.options=e,this.kind=t,UA(this,"id"),UA(this,"element",null),UA(this,"track"),UA(this,"url"),UA(this,"attr"),UA(this,"mode"),UA(this,"muted"),UA(this,"_log"),UA(this,"isPausedByUserCall",!1),UA(this,"_pausedRetryCount"),UA(this,"_isElementPlayingFired",!1),UA(this,"_interval"),UA(this,"_delayDestroyTimeoutId",0),UA(this,"_playSuccessResolve"),UA(this,"_isReplayByRecreateMediaStreamCalled",!1),UA(this,"isPlayCalled",!1),UA(this,"isInAutoPlayFailedState",!1),UA(this,"isBindAutoPlayEvent",!1),this.id=e.id,this._log=e.log,this.track=e.track,this.muted=e.muted,this._pausedRetryCount=5,this._state="STOPPED",this.bindTrackEvents(),this._log.info("create ".concat(t,"-player ").concat(this.id))}get isPlaying(){var e;return"PLAYING"===this._state&&!1===(null==(e=this.element)?void 0:e.paused)}get isPaused(){var e;return"PAUSED"===this._state||!0===(null==(e=this.element)?void 0:e.paused)}get isStopped(){return"STOPPED"===this._state}setAttr(e){this.attr=e}setUrl(e){this.track&&(this.unbindTrackEvents(),this.element&&(this.element.srcObject=null),this.track=null),e!==this.url&&(this.url=e,null!==e&&this.element&&(this.element.crossOrigin="anonymous",this.element.src=e))}async play(){if(!this.isPlaying)try{this.isPlayCalled=!0,this._delayDestroyTimeoutId&&(clearTimeout(this._delayDestroyTimeoutId),this._delayDestroyTimeoutId=0,this.element&&(this.element.muted=this.muted),this.bindTrackEvents(),this.bindElementEvents()),this.bindAutoPlayEvent(),await new Promise((e,t)=>{this._playSuccessResolve=e,this.element.play().then(e,t)})}catch(sM){let t=pL({key:lL.PLAY_FAILED,data:{media:this.kind,error:sM}});if(this._log.warn(sM),t.includes("NotAllowedError"))throw this.isInAutoPlayFailedState=!0,new _k({code:mk.PLAY_NOT_ALLOWED,message:t})}}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t;this.isPlayCalled=!1,this.isPausedByUserCall=!1,this._isElementPlayingFired=!1,this.unbindEvents(),e>0&&!tD?this._delayDestroyTimeoutId||(this.element&&(this.element.muted=!0),null==(t=this.element)||t.remove(),this._log.info("destroy element after 3 * ".concat(e)),this._delayDestroyTimeoutId=setTimeout(()=>this.destroyElement(),3*e)):this.destroyElement(),this.handleStopped(yR),this._interval>0&&WN.clearTask(this._interval)}destroyElement(){this.element&&(this._log.debug("destroy element"),this.element.remove(),this.element.src="",this.element.srcObject=null,this.element=null),clearTimeout(this._delayDestroyTimeoutId),this._delayDestroyTimeoutId=0}pause(){this._log.info("pause"),this.isPausedByUserCall=!0,this.doPause()}doPause(){var e;null==(e=this.element)||e.pause()}resume(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isPausedByUserCall=!1,this.doResume(e)}doResume(){return this._log.info("resume"),this.isPausedByUserCall||this.isPlaying?Promise.resolve():sD?this.replay():this.play().catch(()=>{})}setMuted(e){this.element&&(this.element.muted=e),this.muted=e}replay(){return this.stop(),this.play().catch(()=>{})}bindElementEvents(){if(this.element){let e=this.handleElementEvent.bind(this);return YN(this.element,this.element).add(ER,e).add(yR,e).add(bR,e).add(wR,e).add(IR,e).add(TR,e).add(SR,e)}}bindTrackEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.track;if(e){let t=this.handleTrackEvent.bind(this);null==qN||qN.create(e,e).add(yR,t).add(_R,t).add(vR,t),e.readyState===yR&&this.handleTrackEvent({type:yR}),e.muted&&this.handleTrackEvent({type:_R})}}bindAutoPlayEvent(){this.isBindAutoPlayEvent||(iL.on(rL.AUTOPLAY_DIALOG_CLICK_CONFIRM,this.resume,this),this.isBindAutoPlayEvent=!0)}unbindTrackEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.track;e&&XN(e)}unbindEvents(){this.element&&XN(this.element),this.unbindTrackEvents(),iL.off(rL.AUTOPLAY_DIALOG_CLICK_CONFIRM,this.resume,this),this.isBindAutoPlayEvent=!1}handleElementEvent(e){switch(e.type){case ER:gP()||(this.isInAutoPlayFailedState=!1),this._isElementPlayingFired=!0,this._log.info("".concat(this.kind," player is playing")),this.handlePlaying(ER),this._interval&&(WN.clearTask(this._interval),this._interval=-1);break;case yR:this._log.info("".concat(this.kind," player is ended")),this.handleStopped(yR);break;case bR:this._log.info("".concat(this.kind," player is paused")),this.handlePaused(bR);break;case wR:if(this.element&&this.element.error){this.handlePaused(wR);let{code:e,message:t}=this.element.error;this._log.error("".concat(this.kind," ").concat(this._log.isLocal?"local":"remote"," MediaError code: ").concat(e," message: ").concat(t," userAgent: ").concat(navigator.userAgent)),ZN.uploadEvent({log:"stat-".concat(this.kind,"-").concat(LR,"-").concat(e,"-").concat(navigator.userAgent),error:this.element.error}),MC||xC?this.emit(GN.ERROR,this.element.error):this.replayByRecreateMediaStream(this.element.error)}break;case TR:this.kind===pR&&this.emit(GN.LOADED_DATA);break;case SR:this.kind===pR&&this.emit(GN.LOADED_META_DATA);break;case IR:this.emit(GN.LOAD_START)}}replayByRecreateMediaStream(e){if(!this._isReplayByRecreateMediaStreamCalled)return this._isReplayByRecreateMediaStreamCalled=!0,this.doReplayByRecreateMediaStream(1e3).then(()=>{this._log.warn("replayByRecreateMediaStream success"),ZN.uploadEvent({log:"stat-replayByRecreateMediaStream-success"}),yL.addSuccessEvent({key:this.kind===hR?506700:516700})}).catch(()=>{var t;this._log.error("replayByRecreateMediaStream failed"),ZN.uploadEvent({log:"stat-replayByRecreateMediaStream-failed"}),yL.addFailedEvent({key:this.kind===hR?506700:516700,error:null==(t=this.element)?void 0:t.error}),this.emit(GN.ERROR,e)})}doReplayByRecreateMediaStream(e){return this._log.warn("delay ".concat(e,"ms to recreate mediaStream")),new Promise((t,i)=>{kO(e).then(()=>{this.element&&(this.element.srcObject=null,this.element.srcObject=new MediaStream([this.track]),this._log.warn("recreated mediaStream"),this.element.onerror=()=>{var e,t,r;this._log.warn("element onerror ".concat(null==(t=null==(e=this.element)?void 0:e.error)?void 0:t.code," fired after recreated mediaStream")),i(null==(r=this.element)?void 0:r.error)}),kO(5e3).then(()=>{var e,r;(!this.isPlaying||null!=(e=this.element)&&e.error)&&i(null==(r=this.element)?void 0:r.error),t()})})}).finally(()=>{this.element&&(this.element.onerror=null)})}async handleTrackEvent(e){let t=e.type;switch(this.options.enableLogTrackState&&this._log[t===vR?"info":"warn"]("track ".concat(t)),t){case yR:this.handleStopped(yR);break;case _R:this.handlePaused(_R);break;case vR:this.mode>0?this.handlePlaying(this.mode.toString()):this.element&&(this.element.paused&&!this.isPausedByUserCall&&(this._log.warn("track unmuted and element is paused, resume"),await this.doResume()),this.element&&!this.element.paused&&this._isElementPlayingFired&&this.handlePlaying(vR))}}handlePlaying(e){var t;return this._log.debug("handlePlaying",e),null==(t=this._playSuccessResolve)||t.call(this,e),e}handlePaused(e){return this._log.debug("handlePaused",e),e}handleStopped(e){return this._log.debug("handleStopped",e),e}getElement(){return this.element}};UA(QN,"PlayerEvent",GN),MA([function(e){let{settings:t={retries:5,timeout:2e3},onError:i,onRetrying:r,onRetryFailed:n}=e;return function(e,a,o){let s=eL({retryFunction:o.value,settings:t,onError(t){let{error:r,retry:n,reject:o,retryFuncArgs:s}=t;var c;i?i.call(this,r,()=>{var t;null!=(t=JN.get(e))&&t.has(a)?n():o(r)},o,s):null!=(c=JN.get(e))&&c.has(a)?n():o(r)},onRetrying(t,i){var n;ZO(r)&&r.call(this,t,i),null!=(n=JN.get(e))&&n.has(a)&&(JN.get(e).get(a).stopRetry=i)},onRetryFailed:n});return o.value=function(){let t=JN.get(e);for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];return t?t.set(a,{args:r}):JN.set(e,new Map([[a,{args:r}]])),s.apply(this,r).finally(()=>{var t;return null==(t=JN.get(e))?void 0:t.delete(a)})},o}}({settings:{retries:2,timeout:0},onError(e,t,i,r){r[0]=(r[0]||1e3)+1e3,t()}})],QN.prototype,"doReplayByRecreateMediaStream",1),MA([xN([],"PLAYING",{sync:!0,success(e){this.emit(GN.PLAYER_STATE_CHANGED,{type:this.kind,state:"PLAYING",reason:e})}})],QN.prototype,"handlePlaying",1),MA([xN("PLAYING","PAUSED",{ignoreError:!0,sync:!0,success(e){this.emit(GN.PLAYER_STATE_CHANGED,{type:this.kind,state:"PAUSED",reason:e})}})],QN.prototype,"handlePaused",1),MA([xN([],"STOPPED",{sync:!0,success(e){this.emit(GN.PLAYER_STATE_CHANGED,{type:this.kind,state:"STOPPED",reason:e})}})],QN.prototype,"handleStopped",1);var $N="trtc_autoplay",eP="".concat($N,"_mask"),tP="".concat($N,"_wrapper"),iP="".concat($N,"_header"),rP="".concat($N,"_content"),nP="".concat($N,"_action_wrapper"),aP="".concat($N,"_question"),oP="".concat($N,"_collapse"),sP="".concat($N,"_action_confirm"),cP="".concat($N,"_detail"),lP="#2473E8",dP="dialog",uP="".concat(dP,"-show"),hP="".concat(dP,"-1"),pP="".concat(dP,"-2"),fP=!1,mP=!1,gP=()=>mP,_P="".concat(tR,"/").concat(HD()?"zh-cn":"en","/tutorial-21-advanced-auto-play-policy.html"),vP="<br><a href='".concat(_P,"' target='_blank'>").concat(HD()?"其他方案?":"Any other solution?","</a>"),yP="".concat(HD()?"浏览器自动播放策略:在用户与页面产生交互(点击、触摸)之前,浏览器禁止播放有声媒体。该弹窗用于帮助用户恢复音视频播放。".concat(vP):"Autoplay Policy: Before user interacts with the web page (clicking, touching), page will not be allowed to play media with sound. This Dialog is used to help users resume playback. ".concat(vP)),EP=class{constructor(){if(UA(this,"content","音视频播放被浏览器拦截,请点击“恢复播放”。"),UA(this,"_dialogNode",null),UA(this,"_bodyPosition",""),UA(this,"_showDetail",!1),UA(this,"_isCollapseClicked",!1),UA(this,"_isQuestionClicked",!1),HD()||(this.content='Media playback failed. Click the "Resume" to resume playback.'),!fP){let e=document.createElement("style");e.innerHTML=".".concat(eP,"{position:fixed;top:0;left:0;right:0;bottom:0;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center;background:rgba(0,0,0,0.5);z-index:1500;}.").concat(eP," div:not(.").concat(nP,"){display:block !important;}.").concat(tP,"{padding:14px;background:#fff;border-radius:3px;box-shadow:0px 3px 15px #434343;border:1px solid #d1cfcf;max-width:500px;}.").concat(tP," a{color:").concat(lP,";}.").concat(iP,"{overflow:hidden;text-overflow:ellipsis;font-size:16px;font-weight:600;}.").concat(rP,"{margin:8px 0;}.").concat(nP,"{width:100%;display:flex !important;align-items:center;justify-content:right;float:right;}.").concat(oP,"{margin-right:auto;cursor:pointer}.").concat(aP,"{height:100%;line-height:16px;cursor:pointer;}.").concat(sP,"{margin-left:8px;color:#fff;background:").concat(lP,";padding:4px 12px;outline:none;border:1px solid;border-radius:3px;font-weight:bold;}.").concat(sP,":hover{opacity:0.9;}.").concat(oP,",.").concat(sP,",.").concat(rP,",.").concat(aP,"{font-size:14px;}@media screen and (max-width:750px){.").concat(tP,"{width:80vw;}}"),document.head.appendChild(e),fP=!0}this.addDiaLog()}createDiaLog(){let e=document.createElement("template");e.innerHTML='<div class="'.concat(eP,"\"><div class='").concat(tP,"'><div class='").concat(iP,"'>").concat(location.host,"</div><div class='").concat(rP,"'>").concat(this.content,"</div><div class='").concat(cP,'\' style="visibility:hidden;width:100%;height:0;font-size:12px;color:gray;">').concat(yP,"</div><div class='").concat(nP,"'></div></div></div>").trim();let t=document.createElement("button");t.className=sP,t.innerText=HD()?"恢复播放":"Resume",t.onclick=this.onConfirm.bind(this);let i=document.createElement("div");i.className=aP,i.innerHTML='<?xml version="1.0" encoding="UTF-8"?>\n <svg class="icon" width="18" height="18" p-id="2030" t="1639646523624" version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\n <path d="m464 784.35c0 26.51 21.49 48 48 48s48-21.49 48-48-21.49-48-48-48-48 21.49-48 48z" p-id="2031"/>\n <path d="m512 960c-247.04 0-448-200.96-448-448s200.96-448 448-448 448 200.96 448 448-200.96 448-448 448zm0-831.71c-211.58 0-383.71 172.13-383.71 383.71 0 211.55 172.13 383.71 383.71 383.71 211.55 0 383.71-172.16 383.71-383.71 0-211.58-172.16-383.71-383.71-383.71z" p-id="2032"/>\n <path d="m512 673.7c-17.665 0-32.001-14.336-32.001-31.999v-54.112c0-52.353 40-92.352 75.328-127.65 25.887-25.92 52.672-52.672 52.672-74.017 0-53.343-43.072-96.735-95.999-96.735-53.823 0-95.999 41.536-95.999 94.559 0 17.665-14.336 31.999-32.001 31.999s-32.001-14.336-32.001-31.999c0-87.424 71.775-158.56 160-158.56s160 72.095 160 160.74c0 47.904-36.32 84.192-71.424 119.3-27.84 27.776-56.576 56.512-56.576 82.336v54.112c0 17.665-14.336 32.032-32.001 32.032z" p-id="2033"/>\n </svg>\n ',i.onclick=this.onQuestionClick.bind(this);let r=document.createElement("div");r.className=oP,r.innerText="".concat(HD()?"详情 >":"Detail >"),r.onclick=this.onCollapseClick.bind(this);let n=e.content.firstChild,a=n.querySelector(".".concat(nP));return a.appendChild(r),a.appendChild(i),a.appendChild(t),n}addDiaLog(){gP()||(mP=!0,this._dialogNode=this.createDiaLog(),document.body.appendChild(this._dialogNode),this._dialogNode.onclick=this.onConfirm.bind(this),this._dialogNode.querySelector(".".concat(tP)).onclick=e=>e.stopPropagation(),this._bodyPosition=document.body.style.position,document.body.style.position="fixed",oL.info("show autoplay dialog"),ZN.uploadEvent({log:uP}))}deleteDialog(){this._dialogNode&&(document.body.removeChild(this._dialogNode),document.body.style.position=this._bodyPosition,this._dialogNode=null,mP=!1),bP=null}onConfirm(){oL.warn("confirm clicked, try resume stream"),iL.emit(rL.AUTOPLAY_DIALOG_CLICK_CONFIRM),this.deleteDialog()}onCollapseClick(){let e=this._dialogNode.querySelector(".".concat(cP));e.style.visibility="".concat(this._showDetail?"hidden":"visible"),e.style.height="".concat(this._showDetail?0:"fit-content"),this._showDetail=!this._showDetail,this._isCollapseClicked||ZN.uploadEvent({log:hP}),this._isCollapseClicked=!0}onQuestionClick(){window.open(_P,"_blank"),this._isQuestionClicked||ZN.uploadEvent({log:pP}),this._isQuestionClicked=!0}},bP=null;var wP=new Map;function IP(e){if(!e)return"null";let t=!0===e.fullRange?"full":!1===e.fullRange?"limited":"range=?",i="unspecified"===e.primaries?"?":e.primaries||"?",r="unspecified"===e.transfer?"?":e.transfer||"?",n="unspecified"===e.matrix?"?":e.matrix||"?";return i===r&&r===n?"".concat(i," ").concat(t):"p=".concat(i," t=").concat(r," m=").concat(n," ").concat(t)}function TP(e,t){let i=function(e){if(!e||"undefined"==typeof window||"function"!=typeof window.VideoFrame||e.readyState<2)return null;try{return new window.VideoFrame(e)}catch(t){return null}}(e);if(i)try{let r=function(e,t){let i=[IP(t)];e.format&&i.push(e.format);let r=e.codedWidth,n=e.codedHeight;if(!r||!n)return i.join(" ");let a=e.visibleRect,o=a&&(a.width!==r||a.height!==n),s=e.displayWidth&&e.displayHeight&&(e.displayWidth!==r||e.displayHeight!==n);if(!o&&!s)return i.push("".concat(r,"x").concat(n)),i.join(" ");i.push("".concat(e.displayWidth||r,"x").concat(e.displayHeight||n));let c=["from ".concat(r,"x").concat(n)];return o&&c.push("crop=".concat(a.width,"x").concat(a.height,"@").concat(a.x,",").concat(a.y)),i.push("(".concat(c.join(" "),")")),i.join(" ")}(i,i.colorSpace);(function(e,t){return wP.get(e)!==t&&(wP.set(e,t),!0)})((null==e?void 0:e.id)||"video",r)&&t.info("[colors] ".concat(r))}catch(XA){t.debug("[colors] sample failed:",XA)}finally{i.close()}}var SP,AP=class extends QN{constructor(e){super(e,pR),UA(this,"stat",{}),UA(this,"_calculateTimeout",-1),UA(this,"hasRvfcFired",!1),UA(this,"viewMirror",!1),UA(this,"objectFit","cover"),UA(this,"container"),UA(this,"canvas"),UA(this,"shouldRenderAlpha",!1),UA(this,"_preSize",{width:0,height:0}),UA(this,"posterImg"),UA(this,"pipWindow"),UA(this,"enterPIPPromise"),UA(this,"_originContainerPosition"),UA(this,"_isResettingSrcObject",!1),UA(this,"_wrapper",null),UA(this,"_useWrapper",!1),this.mode=e.canvas?1:0,this.container=e.container,this.canvas=e.canvas,KD(e.viewMirror)||(this.viewMirror=e.viewMirror),KD(e.objectFit)||(this.objectFit=e.objectFit),this.initializeElement()}get isPlaying(){var e;return!("PLAYING"!==this._state||this.element&&this.element.paused)&&("live"===(null==(e=this.track)?void 0:e.readyState)&&!this.track.muted)}initializeElement(){let e=document.createElement(pR);this.track&&2!==this.mode&&(e.srcObject=new MediaStream([this.track])),e.muted=!0,e.setAttribute("id","video_".concat(this.id)),e.setAttribute("style",this.styleAttribute),this.canvas&&this.canvas.setAttribute("style",this.styleAttribute),e.setAttribute("autoplay","autoplay"),e.setAttribute("playsinline","playsinline"),this.element=e,Jk&&(e.poster="data:,"),this._appendToWrapper(),this.bindElementEvents(),this.calculateStat()}get styleAttribute(){let e=this._useWrapper?"grid-area:1/1;width:100%;height:100%;object-fit:".concat(this.objectFit,";").concat(this.shouldRenderAlpha?"":"background-color:black",";"):"width:100%;height:100%;object-fit:".concat(this.objectFit,";").concat(this.shouldRenderAlpha?"":"background-color:black",";");return this.viewMirror&&(e+="transform:scaleX(-1);"),e}setLiveMode(e){if(this._useWrapper!==e&&(this._useWrapper=e,this.elementToRender&&this.elementToRender.setAttribute("style",this.styleAttribute),this.container&&this.elementToRender))if(e){let e=this._getOrCreateWrapper();e.insertBefore(this.elementToRender,e.firstChild)}else this.container.appendChild(this.elementToRender),this._cleanupWrapper()}setContainer(e){if(this.container===e)return;let t=this._wrapper,i=this.container;this.container=e,this._pausedRetryCount=5,this.track&&this.elementToRender&&this._appendToWrapper(),t&&i&&i!==this.container&&t.isConnected&&0===t.children.length&&t.remove()}_getOrCreateWrapper(){if(!this.container)throw new Error("[VideoPlayer] container is required");let e=this.container.querySelector("[data-trtc-video-wrapper]");return e||(e=document.createElement("div"),e.setAttribute("data-trtc-video-wrapper","true"),e.style.cssText="display:grid;width:100%;height:100%;",this.container.appendChild(e)),this._wrapper=e,e}_appendToWrapper(e){let t=null!=e?e:this.elementToRender;if(this.container&&t)if(this._useWrapper){let e=this._getOrCreateWrapper();e.insertBefore(t,e.firstChild)}else this.container.appendChild(t)}bindElementEvents(){let e=super.bindElementEvents();this.handleElementEvent=this.handleElementEvent.bind(this),this.handleFullscreenChange=this.handleFullscreenChange.bind(this),this.handleVolumeChange=this.handleVolumeChange.bind(this),e&&e.add(kR,this.handleElementEvent).add(CR,this.handleElementEvent).add(OR,this.handleElementEvent),this.element&&(this.element.addEventListener(DR,this.handleFullscreenChange),this.element.addEventListener("webkitbeginfullscreen",this.handleFullscreenChange),this.element.addEventListener("webkitendfullscreen",this.handleFullscreenChange),this.element.addEventListener("volumechange",this.handleVolumeChange))}handleTrackEvent(e){var t;return e.type===_R&&(null!=(t=this.stat)&&t.fps&&(this.stat.fps=0),this.isFullscreen()&&this.resetSrcObjectToReplay()),super.handleTrackEvent(e)}handleFullscreenChange(){this.isFullscreen()?(this._log.info("enter fullscreen"),this.emit(GN.ENTER_FULL_SCREEN)):(this._log.info("leave fullscreen"),this.emit(GN.LEAVE_FULL_SCREEN))}handleVolumeChange(){var e;(this.isPictureInPicture()||this.isFullscreen())&&this.emit(GN.VOLUME_CHANGE,{muted:null==(e=this.element)?void 0:e.muted})}handleElementEvent(e){var t,i,r,n,a,o;if(2===this.mode)return;super.handleElementEvent(e);let s=e.type;s===ER&&TP(this.element,this._log);let c=this.isPictureInPicture(),l=this.isFullscreen(),d=e.isTrusted&&(c&&eD||l);if(s===ER&&d&&!this._isResettingSrcObject&&(this._log.warn("user resume in ".concat(l?"fullscreen":"pip")),this.emit(GN.USER_RESUME_IN_PIP_OR_FULL_SCREEN)),s===bR&&(d&&(this._log.warn("user pause in ".concat(l?"fullscreen":"pip")),this.emit(GN.USER_PAUSE_IN_PIP_OR_FULL_SCREEN)),this.container&&!this.container.isConnected&&(this._log.warn("".concat(this.kind," player has been remove, element ID: ").concat(this.container.id)),kO(500).then(()=>{var e;null!=(e=this.container)&&e.isConnected&&(this._pausedRetryCount=5,this._log.info("view container ".concat(this.container.id," is in dom, reset pausedRetryCount")))})),this._pausedRetryCount>0&&!gP()&&!this.isPausedByUserCall&&!d&&(this._log.info("[".concat(5-this._pausedRetryCount+1,"/").concat(5,"] ").concat(this.kind," player auto resume when paused")),this.doResume(),this._pausedRetryCount--),Xk&&!d&&(this._interval=WN.run("timeout",()=>{this.element&&"PAUSED"===this._state&&!this.isPausedByUserCall&&this.doResume()},{delay:3e3})),this.stat.fps&&(this.stat.fps=0)),this.viewMirror&&this.element){let e=this.element.style.transform;s===kR?this.element.style.transform=e.replace("scaleX(-1)",""):s===CR&&!e.includes("scaleX")&&(this.element.style.transform="".concat(e," scaleX(-1)"))}s===OR&&(this._preSize.height!==(null==(t=this.element)?void 0:t.videoHeight)||this._preSize.width!==(null==(i=this.element)?void 0:i.videoWidth))&&(this._log.info("video size changed to ".concat(null==(r=this.element)?void 0:r.videoWidth,"x").concat(null==(n=this.element)?void 0:n.videoHeight)),this._preSize.height=(null==(a=this.element)?void 0:a.videoHeight)||0,this._preSize.width=(null==(o=this.element)?void 0:o.videoWidth)||0,this.emit(GN.RESIZE,{newWidth:this._preSize.width,newHeight:this._preSize.height})),s===CR&&(this._log.warn("exit pip"),this.isPaused&&!this.isPausedByUserCall&&(this._log.warn("resume after exit pip"),this.doResume()),this.resetSrcObjectToReplay(),this.emit(GN.LEAVE_PICTURE_IN_PICTURE)),s===kR&&this.emit(GN.ENTER_PICTURE_IN_PICTURE)}resetSrcObjectToReplay(){Jk&&JC&&this.isPlayCalled&&this.element&&this.track&&!this.isPausedByUserCall&&(this._log.warn("reset srcObject to replay for android chromium"),this._isResettingSrcObject=!0,this.element.srcObject=new MediaStream([this.track]),this.element.play().catch(e=>{this._log.warn("play failed after reset srcObject",e)}).finally(()=>{this._isResettingSrcObject=!1}))}setCanvas(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i,r;this.canvas!==e&&(null==(i=this.canvas)||i.remove(),null==e||e.setAttribute("style",this.styleAttribute),this.canvas=e,this.mode=e?t:0,2===this.mode&&this.setTrack(e.captureStream().getVideoTracks()[0]),e?(null==(r=this.element)||r.remove(),this._appendToWrapper(e)):this.element&&this._appendToWrapper(this.element))}setAttr(e){let t=Object.assign({autoplay:"autoplay",playsinline:"playsinline",muted:!0},e);t.style=Object.assign({width:"100%",height:"100%"},t.style),super.setAttr(t)}get mirror(){return this.viewMirror}setRect(e,t){this.elementToRender&&(this.elementToRender.style.width="".concat(e,"px"),this.elementToRender.style.height="".concat(t,"px"))}setViewMirror(e){this.elementToRender&&(this.elementToRender.style.transform=e?"scaleX(-1)":""),this.viewMirror=e}setObjectFit(e){this.elementToRender&&(this.elementToRender.style.objectFit="".concat(e)),this.objectFit=e}setPoster(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(i=>{if(!this.element||(this._log.info("setPoster",e.slice(0,10)),""===e?this.element.removeAttribute("poster"):this.element.poster=e,!t||!eD&&!$k))return i();if(""===e)return this.removePosterImg(),i();if(this.posterImg)return i();let r=document.createElement("img");r.src=e;let n=window.getComputedStyle(this.element),a=n.objectFit||this.objectFit,o=1;if(this._useWrapper){let e=parseInt(n.zIndex,10);isNaN(e)||(o=e+1)}r.style.cssText=this._useWrapper?"grid-area:1/1;z-index:".concat(o,";width:100%;height:100%;object-fit:").concat(a,";"):"position:absolute;top:0;left:0;width:100%;height:100%;object-fit:".concat(a,";"),r.onload=async()=>{try{r.decode&&await r.decode(),this.container&&!this._useWrapper&&"static"===window.getComputedStyle(this.container).position&&(this._originContainerPosition=this.container.style.position,this.container.style.position="relative"),this.posterImg=r;let e=this._useWrapper?this._wrapper:this.container;null==e||e.appendChild(r),Zk()&&oD<=17&&this.elementToRender&&(this.elementToRender.style.visibility="hidden")}catch(e){this._log.warn("decode poster image error",e)}return i()},r.onerror=()=>(this._log.warn("load poster image error"),i())})}removePosterImg(){this.posterImg&&(Zk()&&oD<=17&&this.elementToRender&&(this.elementToRender.style.visibility=""),this.posterImg.remove(),URL.revokeObjectURL(this.posterImg.src),!this._useWrapper&&this.container&&!KD(this._originContainerPosition)&&"relative"===this.container.style.position&&(this.container.style.position=this._originContainerPosition),delete this.posterImg)}get hasPoster(){var e;return!!this.posterImg||!(null==(e=this.element)||!e.getAttribute("poster"))}async pause(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];super.pause(),!this.isPictureInPicture()&&!this.hasPoster&&(JC||e&&($k||eD))&&await this.setPoster(this.getVideoFrame(),!0)}resume(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return super.resume(e).then(()=>{var e;(this.posterImg||null!=(e=this.element)&&e.poster)&&this.setPoster("",!0)})}doResume(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isPaused&&e&&this.element&&this.track&&JC&&"video"===this.track.kind&&(this.element.srcObject=new MediaStream([this.track])),super.doResume()}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t;this.isPictureInPicture()&&this.exitPictureInPicture().catch(e=>{}),this.isFullscreen()&&this.exitFullscreen().catch(e=>{}),this.element&&(this.element.removeEventListener(DR,this.handleFullscreenChange),this.element.removeEventListener("webkitbeginfullscreen",this.handleFullscreenChange),this.element.removeEventListener("webkitendfullscreen",this.handleFullscreenChange),this.element.removeEventListener("volumechange",this.handleVolumeChange)),super.stop(e),null==(t=this.canvas)||t.remove(),this.removePosterImg(),this._useWrapper&&this._cleanupWrapper()}_cleanupWrapper(){this._wrapper&&0===this._wrapper.children.length&&this._wrapper.remove(),this._wrapper=null}play(e){if(KD(null==e?void 0:e.isLiveStream)||this.setLiveMode(e.isLiveStream),this.element){if(this.elementToRender&&this.container)if(this._useWrapper){let e=this._getOrCreateWrapper();this.elementToRender.parentElement!==e&&e.insertBefore(this.elementToRender,e.firstChild)}else this.elementToRender.parentElement!==this.container&&this.container.append(this.elementToRender)}else this.initializeElement();return 2===this.mode?Promise.resolve():super.play()}get elementToRender(){return this.canvas||this.element}setTrack(e){e!==this.track&&(this.unbindTrackEvents(),this.track=e,this.emit(GN.MEDIA_TRACK_CHANGED,e),null!==e&&(this.bindTrackEvents(),this.element&&2!==this.mode&&(this.element.srcObject=new MediaStream([e]),this.element.remove()),this._appendToWrapper()))}getVideoFrame(){if(this.canvas)return this.canvas.toDataURL("image/png");if(!this.element)return"";let e=document.createElement("canvas");return e.width=this.element.videoWidth,e.height=this.element.videoHeight,e.getContext("2d").drawImage(this.element,0,0),e.toDataURL("image/png")}getElement(){return this.element}calculateStat(){try{if(bN()&&this.element&&this._calculateTimeout<0){let e=0,t=null,i=(r,n)=>{this.stat.width=n.width,this.stat.height=n.height,t&&(this.stat.fps=Math.round((n.presentedFrames-t.presentedFrames)/(r-e)*1e3)),e=r,t=n,this.hasRvfcFired=!0,this._calculateTimeout=-1,this.element&&(this._calculateTimeout=setTimeout(()=>{var e;return null==(e=this.element)?void 0:e.requestVideoFrameCallback(i)},2e3))};this.element.requestVideoFrameCallback(i)}}catch(sM){this._log.warn("init stat failed",sM)}}async enterFullscreen(){let e=this.elementToRender;if(!e)throw this._log.warn("no element to render, cannot enter fullscreen"),new Error("No element available for fullscreen");if(Xk&&this.isPictureInPicture()){this._log.info("exit pip before entering fullscreen");try{await this.exitPictureInPicture()}catch(XA){this._log.warn("exit pip failed before fullscreen:",XA)}}try{if(e.requestFullscreen)await e.requestFullscreen();else if(e.webkitRequestFullscreen)await e.webkitRequestFullscreen();else if(e.webkitEnterFullscreen)await e.webkitEnterFullscreen();else if(e.mozRequestFullScreen)await e.mozRequestFullScreen();else{if(!e.msRequestFullscreen)throw new Error("Fullscreen API not supported");await e.msRequestFullscreen()}this._log.info("entered fullscreen mode")}catch(XA){throw this._log.error("failed to enter fullscreen:",XA),XA}}async exitFullscreen(){try{if(!this.isFullscreen())return;if(document.exitFullscreen)await document.exitFullscreen();else if(document.webkitExitFullscreen)await document.webkitExitFullscreen();else if(document.mozCancelFullScreen)await document.mozCancelFullScreen();else{if(!document.msExitFullscreen)throw new Error("Exit fullscreen API not supported");await document.msExitFullscreen()}this._log.info("exited fullscreen mode")}catch(sM){throw this._log.error("failed to exit fullscreen:",sM),sM}}isFullscreen(){let e=this.elementToRender;return!!e&&(this.element&&this.element.webkitDisplayingFullscreen?!this.isPictureInPicture():(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)===e)}async toggleFullscreen(){this.isFullscreen()?await this.exitFullscreen():await this.enterFullscreen()}async enterPictureInPicture(){this.enterPIPPromise=this._enterPictureInPicture();try{return await this.enterPIPPromise}finally{delete this.enterPIPPromise}}async _enterPictureInPicture(){try{if(!this.element)throw new Error("No video element available for pip");if(this.canvas&&1!==this.mode)throw new Error("pip is not supported for canvas-only mode");let{element:e}=this;if(e.requestPictureInPicture){this._log.info("requestPictureInPicture");let t=await e.requestPictureInPicture();return this.pipWindow=t,this._log.info("entered pip mode"),this.elementToRender===this.canvas&&(this.canvas.remove(),this._appendToWrapper(this.element)),t}if(e.webkitSetPresentationMode)return this._log.info("webkitSetPresentationMode"),await e.webkitSetPresentationMode("picture-in-picture"),this._log.info("entered pip mode (webkit)"),{};throw new Error("pip API not supported")}catch(sM){throw this._log.error("failed to enter pip:",sM.name,sM.message),sM}}async exitPictureInPicture(){var e;try{if(!this.isPictureInPicture())return;if(delete this.pipWindow,document.pictureInPictureElement&&document.exitPictureInPicture)await document.exitPictureInPicture(),this.elementToRender===this.canvas&&(null==(e=this.element)||e.remove(),this._pausedRetryCount=5,this._appendToWrapper(this.canvas)),this._log.info("exited pip mode");else{if(!this.element||!this.element.webkitSetPresentationMode)throw new Error("Exit pip API not supported or not in PiP mode");await this.element.webkitSetPresentationMode("inline"),this._log.info("exited pip mode (webkit)")}}catch(XA){throw this._log.error("failed to exit pip:",XA),XA}}isPictureInPicture(){if(!this.element)return!1;let{element:e}=this;return document.pictureInPictureElement?document.pictureInPictureElement===e:!!e.webkitPresentationMode&&"picture-in-picture"===e.webkitPresentationMode}async togglePictureInPicture(){this.isPictureInPicture()?await this.exitPictureInPicture():await this.enterPictureInPicture()}};"undefined"!=typeof AudioContext?SP=AudioContext:"undefined"!=typeof webkitAudioContext?SP=webkitAudioContext:"undefined"!=typeof mozAudioContext&&(SP=mozAudioContext);var RP,kP=-1,CP=0,DP=-1,OP=!1,LP=0,NP=-1,PP=-1;!function e(){try{if(RP)return;(RP=new SP({sampleRate:48e3})).onstatechange=()=>{oL.info("context state: ".concat(RP.state).concat("running"!==RP.state?" visibilityState: ".concat(document.visibilityState):"")),xP()},clearTimeout(kP)}catch(_A){oL.error("initAudioContext failed: ".concat(_A," typeof AudioContextClass: ").concat(typeof SP)),kP=setTimeout(e,1e3)}}();var xP=()=>{"suspended"===RP.state?(CP=sO(),-1===DP&&(DP=setTimeout(()=>{"suspended"===RP.state&&(OP=!0,iL.emit("155",{isSuspended:!0}))},1500)),FP(),document.addEventListener("click",xP)):"interrupted"===RP.state?FP():(CP&&(yL.addNumber({key:507800,value:sO()-CP,split:[0,500,1e3,1500,2e3,3e3,4e3,5e3,1e4,3e4],max:6e4}),CP=0),-1!==DP&&(clearTimeout(DP),DP=-1,OP&&(OP=!1,iL.emit("155",{isSuspended:!1}))),document.removeEventListener("visibilitychange",xP),document.removeEventListener("click",xP))},MP=0,UP=-1;function FP(){return new Promise((e,t)=>{if("running"===RP.state)return e();Date.now()-MP<1e3?(clearTimeout(UP),UP=setTimeout(()=>{MP=Date.now(),RP.resume().then(e,t).finally(()=>{BP()})},1e3)):(clearTimeout(UP),MP=Date.now(),RP.resume().then(e,t).finally(()=>{BP()}))}).catch(e=>{oL.warn("context resume failed: ".concat(e)),document.addEventListener("visibilitychange",xP)})}function BP(){if(!Xk||-1!==PP)return;let e=()=>{sO()-LP<500||(RP&&"running"===RP.state&&RP.currentTime===NP&&(oL.warn("context is fake running, auto resume"),RP.suspend().catch(e=>{oL.warn("context suspend failed: ".concat(e))})),NP=RP.currentTime,LP=sO())};PP=setInterval(()=>{e()},2e3),document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&e()})}document.addEventListener("click",xP);var VP=e=>RP;function HP(){}var jP=e=>e();function zP(){this.dispose()}var WP=1,GP=class extends Function{toString(){return"".concat(this.name,"(").concat(this.args.length?[...this.args].join(", "):"",")")}subscribe(e){let t=new $P(e,this,this.streamId++);return ex.subscribe({id:this.id,end:!1},{nodeId:t.sourceId,streamId:t.id}),this(t),t}},qP=class{constructor(){this.defers=new Set,this.disposed=!1}next(e){}complete(){this.dispose()}error(e){this.dispose()}get bindDispose(){return()=>this.dispose()}dispose(){this.disposed=!0,this.complete=HP,this.error=HP,this.next=HP,this.dispose=HP,this.subscribe=HP,this.doDefer()}subscribe(e){return e instanceof GP?e.subscribe(this):e(this),this}get bindSubscribe(){return e=>this.subscribe(e)}doDefer(){this.defers.forEach(jP),this.defers.clear()}defer(e){this.defers.add(e)}removeDefer(e){this.defers.delete(e)}reset(){this.disposed=!1,delete this.complete,delete this.next,delete this.dispose,delete this.next,delete this.subscribe}resetNext(){delete this.next}resetComplete(){delete this.complete}resetError(){delete this.error}},KP=class extends qP{constructor(e){super(),this.sink=e,e.defer(this.bindDispose)}next(e){this.sink.next(e)}complete(){this.sink.complete()}error(e){this.sink.error(e)}},YP=class extends qP{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:HP,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:HP,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:HP;if(super(),this._next=t,this._error=i,this._complete=r,this.then=HP,e instanceof GP){let n={toString:()=>"subscribe",id:0,source:e};this.defer(()=>{ex.defer(n,0)}),ex.create(n),ex.pipe(n),this.sourceId=n.id,this.subscribe(e),ex.subscribe({id:n.id,end:!0}),t==HP?this._next=e=>ex.next(n,0,e):this.next=e=>{ex.next(n,0,e),t(e)},r==HP?this._complete=()=>ex.complete(n,0):this.complete=()=>{this.dispose(),ex.complete(n,0),r()},i==HP?this._error=e=>ex.complete(n,0,e):this.error=e=>{this.dispose(),ex.complete(n,0,e),i(e)}}else this.subscribe(e)}next(e){this._next(e)}complete(){this.dispose(),this._complete()}error(e){this.dispose(),this._error(e)}};function XP(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return i.reduce((e,t)=>t(e),e)}function ZP(e,t,i){if("undefined"!=typeof __FASTRX_DEVTOOLS__){let r=Object.defineProperties(Object.setPrototypeOf(e,GP.prototype),{streamId:{value:0,writable:!0,configurable:!0},name:{value:t,writable:!0,configurable:!0},args:{value:i,writable:!0,configurable:!0},id:{value:0,writable:!0,configurable:!0}});ex.create(r);for(let e=0;e<i.length;e++){let t=i[e];"function"==typeof t&&t instanceof GP&&ex.addSource(r,t)}return r}return e}function JP(e,t){return function(){for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];return i=>{if(i instanceof GP){let n=ZP(t=>{let a=new e(t,...r);a.sourceId=n.id,a.subscribe(i)},t,arguments);return n.source=i,ex.pipe(n),n}return t=>i(new e(t,...r))}}}function QP(e,t){window.postMessage({source:"fastrx-devtools-backend",payload:{event:e,payload:t}})}var $P=class extends KP{constructor(e,t,i){super(e),this.source=t,this.id=i,this.sourceId=e.sourceId,this.defer(()=>{ex.defer(this.source,this.id)})}next(e){ex.next(this.source,this.id,e),this.sink.next(e)}complete(){ex.complete(this.source,this.id),this.sink.complete()}error(e){ex.complete(this.source,this.id,e),this.sink.error(e)}},ex={addSource(e,t){QP("addSource",{id:e.id,name:e.toString(),source:{id:t.id,name:t.toString()}})},next(e,t,i){QP("next",{id:e.id,streamId:t,data:i&&i.toString()})},subscribe(e,t){let{id:i,end:r}=e;QP("subscribe",{id:i,end:r,sink:{nodeId:t&&t.nodeId,streamId:t&&t.streamId}})},complete(e,t,i){QP("complete",{id:e.id,streamId:t,err:i?i.toString():null})},defer(e,t){QP("defer",{id:e.id,streamId:t})},pipe(e){QP("pipe",{name:e.toString(),id:e.id,source:{id:e.source.id,name:e.source.toString()}})},update(e){QP("update",{id:e.id,name:e.toString()})},create(e){e.id||(e.id=WP++),QP("create",{name:e.toString(),id:e.id})}},tx=class extends qP{constructor(e){super(),this.source=e,this.sinks=new Set}add(e){e.defer(()=>this.remove(e)),1===this.sinks.add(e).size&&(this.reset(),this.subscribe(this.source))}remove(e){this.sinks.delete(e),0===this.sinks.size&&this.dispose()}next(e){this.sinks.forEach(t=>t.next(e))}complete(){this.sinks.forEach(e=>e.complete()),this.sinks.clear()}error(e){this.sinks.forEach(t=>t.error(e)),this.sinks.clear()}};function ix(){return e=>{let t=new tx(e);if(e instanceof GP){let i=ZP(e=>{t.add(e)},"share",arguments);return t.sourceId=i.id,i.source=e,ex.pipe(i),i}return ZP(t.add.bind(t),"share",arguments)}}function rx(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return ZP(e=>{let i=new KP(e),r=t.length;i.complete=()=>{0===--r&&e.complete()},t.forEach(i.bindSubscribe)},"merge",arguments)}function nx(e){let t=arguments,i=ix()(ZP(t=>{i.next=e=>t.next(e),i.complete=()=>t.complete(),i.error=e=>t.error(e),e&&t.subscribe(e)},"subject",t));return i.next=HP,i.complete=HP,i.error=HP,i}function ax(e,t){return i=>{let r=e=>i.next(e);i.defer(()=>t(r)),e(r)}}function ox(e,t){if("on"in e&&"off"in e)return ZP(ax(i=>e.on(t,i),i=>e.off(t,i)),"fromEvent",arguments);if("addListener"in e&&"removeListener"in e)return ZP(ax(i=>e.addListener(t,i),i=>e.removeListener(t,i)),"fromEvent",arguments);if("addEventListener"in e)return ZP(ax(i=>e.addEventListener(t,i),i=>e.removeEventListener(t,i)),"fromEvent",arguments);throw"target is not a EventDispachter"}var sx=JP(class extends KP{constructor(e,t,i){super(e),this.filter=t,this.thisArg=i}next(e){this.filter.call(this.thisArg,e)&&this.sink.next(e)}},"filter"),cx=JP(class extends KP{constructor(e,t){super(e),this.count=t}next(e){this.sink.next(e),0===--this.count&&(this.doDefer(),this.complete())}},"take"),lx=JP(class extends KP{constructor(e,t){super(e);let i=new KP(e);i.next=()=>{i.doDefer(),e.complete()},i.complete=zP,i.subscribe(t)}},"takeUntil"),dx=JP(class extends KP{constructor(e,t){super(e),this.f=t}next(e){this.f(e)||(this.next=super.next,this.next(e))}},"skipWhile"),ux=JP(class extends KP{constructor(e,t,i){super(e),this.mapper=t,this.thisArg=i}next(e){super.next(this.mapper.call(this.thisArg,e))}},"map"),hx=class extends KP{constructor(e,t,i){super(e),this.data=t,this.context=i}next(e){let t=this.context.combineResults;t?this.sink.next(t(this.data,e)):this.sink.next(e)}tryComplete(){this.context.resetComplete(),this.dispose()}},px=class e extends KP{constructor(e,t,i){super(e),this.makeSource=t,this.combineResults=i,this.index=0}subInner(t,i){let r=this.currentSink=new i(this.sink,t,this);this.complete===e.prototype.complete&&(this.complete=this.tryComplete),r.complete=r.tryComplete,r.subscribe(this.makeSource(t,this.index++))}complete(){this.sink.complete()}tryComplete(){this.currentSink.resetComplete(),this.dispose()}},fx=class extends hx{},mx=class extends px{next(e){this.subInner(e,fx),this.next=e=>{this.currentSink.dispose(),this.subInner(e,fx)}}},gx=JP(mx,"switchMap");var _x=function(e){return(t,i)=>e(()=>t,i)}(JP(mx,"switchMapTo")),vx=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:HP,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:HP,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:HP;return r=>new YP(r,e,t,i)},yx=JP(class extends KP{constructor(e,t){super(e),t instanceof Function?this.next=i=>{t(i),e.next(i)}:(t.next&&(this.next=i=>{t.next(i),e.next(i)}),t.complete&&(this.complete=()=>{t.complete(),e.complete()}),t.error&&(this.error=i=>{t.error(i),e.error(i)}))}},"tap"),Ex=class{constructor(e){this.name=e,UA(this,"node"),UA(this,"node2"),UA(this,"pre",new Set),UA(this,"next",new Set),UA(this,"context"),UA(this,"connectedNodes",new Set),UA(this,"nextInputChannelMap",new Map),UA(this,"_channelCount",1)}get channelCount(){return this._channelCount}set channelCount(e){this._channelCount=e,this.setChannelCount(this.node,e),this.setChannelCount(this.node2,e),this.next.forEach(t=>t.channelCount=e)}setChannelCount(e,t){!e||e instanceof ScriptProcessorNode||(e.channelCountMode="explicit",e.channelCount=t||this.channelCount||1)}setContext(e){this.context=e,this.node&&e.addMixWeight()}removeContext(){var e;this.node&&(null==(e=this.context)||e.reduceMixWeight()),delete this.context}replaceNode(e){var t;if(e!==this.node)try{this.node?this._disconnect():null==(t=this.context)||t.addMixWeight(),this.node=e,this.setChannelCount(this.node),this.preNodeReconnect(),this.reconnect()}catch(XA){oL.error(XA)}}setNode(e,t){var i;if(!this.node)try{null==(i=this.context)||i.addMixWeight(),this.node=e,this.setChannelCount(this.node),t&&(this.node2=t,this.setChannelCount(this.node2)),this.preNodeReconnect(),this.reconnect(),yL.addSuccessEvent({key:502701})}catch(r){oL.error(r),yL.addFailedEvent({key:502701,error:r})}}deleteNode(){var e;if(this.node)try{this._disconnect(),delete this.node,delete this.node2,null==(e=this.context)||e.reduceMixWeight(),this.preNodeReconnect(),yL.addSuccessEvent({key:502702})}catch(sM){oL.error(sM),yL.addFailedEvent({key:502702,error:sM})}}preNodeReconnect(){this.pre.forEach(e=>{e.node?e.reconnect():e.preNodeReconnect()})}connectNext(e){this.next.forEach(t=>{let i=this.nextInputChannelMap.get(t);e._connect(t.node,i)||t.connectNext(e)})}_connect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(!this.node||!e)&&((this.node2||this.node).connect(e,0,t),this.connectedNodes.add(e),!0)}_disconnect(){this.connectedNodes.forEach(e=>{var t;return null==(t=this.node2||this.node)?void 0:t.disconnect(e)}),this.connectedNodes.clear()}reconnect(){this._disconnect(),this.connectNext(this)}pipeTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.next.add(e),e.pre.add(this),this.nextInputChannelMap.set(e,t),e}},bx=class extends Ex{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:256;super(),this.fftSize=e,UA(this,"dataArray",new Uint8Array(0))}setNode(e){e.fftSize=this.fftSize,this.dataArray=new Uint8Array(e.frequencyBinCount),super.setNode(e)}getByteTimeDomainData(){var e;return null==(e=this.node)||e.getByteTimeDomainData(this.dataArray),this.dataArray}get level(){var e;return null==(e=this.node)||e.getByteTimeDomainData(this.dataArray),Math.max(...this.dataArray)/128-1}get timeDomainPathData(){let e=this.getByteTimeDomainData(),t=0,i=0,r="M".concat(t,",").concat(i);for(let n=0;n<e.length;n++)i=e[n]/128*100/2,r+="L".concat(t,",").concat(i),t+=1;return r}},wx=class{constructor(){UA(this,"source",new Ex),UA(this,"gain",new Ex),UA(this,"destination",new Ex)}get volume(){var e;return(null==(e=this.gain.node)?void 0:e.gain.value)||1}setVolume(e){1!==e?(this.gain.node||this.gain.setNode(VP().createGain()),this.gain.node.gain.value=e):this.gain.node&&this.gain.deleteNode()}replaceSource(e){try{let t=function(t){try{let e=Ix.get(t);if(e)return e;let i=VP();if(t instanceof HTMLAudioElement)e=i.createMediaElementSource(t);else{if(!(t instanceof MediaStreamTrack))return t;e=i.createMediaStreamSource(new MediaStream([t]))}return Ix.set(t,e),e}catch(e){if(!($k&&e instanceof Error&&"NotSupportedError"===e.name))throw e;oL.warn(e)}}(e);t&&this.source.replaceNode(t)}catch(sM){oL.error(sM)}}get track(){var e;return null==(e=this.stream)?void 0:e.getAudioTracks()[0]}get stream(){var e;return null==(e=this.destination.node)?void 0:e.stream}},Ix=new WeakMap;var Tx=class e{constructor(e){UA(this,"_volume",0),UA(this,"_volumeDb",0),UA(this,"_log"),UA(this,"_scriptProcessorNode",null),UA(this,"_audioWorkletNode",null),UA(this,"_interval",200);let{log:t}=e;this._log=t,iL.on(rL.AUDIO_LEVEL_INTERVAL,this.handleAudioLevelInterval,this)}static get isRunning(){return Date.now()-e.lastMessageTime<2e3}get node(){return this._audioWorkletNode||this._scriptProcessorNode}preload(){if(OC&&$C<=22)return this._log.warn("use script processor to avoid memory leak in electron22-"),this.initScriptProcessor();if(!e.workletReady){let t='class VolumeMeterWorklet extends AudioWorkletProcessor{constructor(){super(),this.volume=0,this.intervalTime=200,this.tick=200,this.isStop=!1,this.cache=[],this.sentFirstInfo1=!1,this.unmute=!1,this.port.onmessage=t=>{var e=t.data;switch(e.name){case"chunk":this.cache.push(...e.data),this.sentFirstInfo1||(this.port.postMessage({cl:e.data.length}),this.sentFirstInfo1=!0);break;case"setIntervalTime":this.intervalTime=e.intervalTime;break;case"unmute":this.unmute=!0;break;case"stop":this.isStop=!0}}}process(t,s){t=t[0],s=s[0];if(t||s){if(this.isStop)return!1;var i=s&&s[0]?s[0].length:0,h=this.cache.length,a=(i<h?(s[0].set(this.cache.slice(0,i)),this.cache=this.cache.slice(i)):this.unmute&&s[0].set(t[0]),(i<h?s:t)[0]);if(a){let e=0;for(let t=0;t<a.length;++t)e=Math.max(Math.abs(a[t]),e);s=a.reduce((t,e)=>t+e*e,0)/a.length;this.volume=e,this.tick-=a.length,this.tick<0&&(this.tick+=this.intervalTime/1e3*sampleRate,this.port.postMessage({volume:this.volume,volumeDb:Math.max(10*Math.log10(s)+100,0)/100,cacheLen:h,outputLen:i}))}}return!0}}registerProcessor("volume-meter",VolumeMeterWorklet);',i=URL.createObjectURL(new Blob([t],{type:"application/javascript"}));e.workletReady=async function(e,t){if(!e.audioWorklet)return Promise.reject("audioWorklet is not supported");try{await e.audioWorklet.addModule(t),oL.info("worklet addModule success")}catch(i){throw oL.info("worklet addModule catch error. ".concat(i.message)),i}}(e.audioContext,i).finally(()=>{URL.revokeObjectURL(i)})}return e.workletReady.then(()=>this.initAudioWorklet()).catch(e=>(this._log.error("volumeMeter preload error: ".concat(e)),this.initScriptProcessor()))}initAudioWorklet(){if(!this._audioWorkletNode)try{this._audioWorkletNode=new AudioWorkletNode(e.audioContext,"volume-meter");let t=!1;this._audioWorkletNode.port.onmessage=i=>{e.lastMessageTime=Date.now(),this._volume=i.data.volume||0,this._volumeDb=i.data.volumeDb||0,!t&&i.data.cacheLen&&i.data.outputLen&&(this._log.warn("worklet play success"),t=!0)},this.handleAudioLevelInterval({interval:this._interval})}catch(t){this._log.error("volumeMeter init audio worklet error: ".concat(t)),ZN.logFailedEvent({userId:this._log.userId,eventType:NR,error:t}),this.initScriptProcessor()}}initScriptProcessor(){if(!this._scriptProcessorNode)try{let t=VP();this._scriptProcessorNode=t.createScriptProcessor(2048,1,1),this._scriptProcessorNode.onaudioprocess=t=>{e.lastMessageTime=Date.now();let i=t.inputBuffer.getChannelData(0),r=0,n=0;for(let e=0;e<i.length;++e)r=Math.max(Math.abs(i[e]),r),n+=i[e]*i[e];this._volume=r;let a=n/i.length;this._volumeDb=Math.max(10*Math.log10(a)+100,0)/100},this._scriptProcessorNode.connect(t.destination)}catch(t){this._log.error("volumeMeter init script processor error: ".concat(t))}}destroy(){this._scriptProcessorNode&&(this._scriptProcessorNode.onaudioprocess=null,this._scriptProcessorNode.disconnect()),this._audioWorkletNode&&(this._audioWorkletNode.port.postMessage({name:"stop"}),this._audioWorkletNode.port.onmessage=null,this._audioWorkletNode.port.close(),this._audioWorkletNode.disconnect()),this._audioWorkletNode=null,this._scriptProcessorNode=null,iL.off(rL.AUDIO_LEVEL_INTERVAL,this.handleAudioLevelInterval,this)}getInternalAudioLevel(){return this._volume}getCalculatedVolume(){return parseFloat(this._volume.toFixed(2))}getVolumeDb(){return Math.floor(100*this._volumeDb)}handleAudioLevelInterval(e){var t;let{interval:i}=e;this._interval=i,null==(t=this._audioWorkletNode)||t.port.postMessage({name:"setIntervalTime",intervalTime:i})}};UA(Tx,"lastMessageTime",0),UA(Tx,"audioContext",VP()),UA(Tx,"workletReady");var Sx=Tx,Ax=class extends Ex{constructor(e){super(),UA(this,"_volumeMeter"),this._volumeMeter=new Sx(e)}deleteNode(){super.deleteNode(),this._volumeMeter.destroy()}async init(){await this._volumeMeter.preload(),this.setNode(this._volumeMeter.node)}getCalculatedVolume(){return this._volumeMeter.getCalculatedVolume()}getInternalAudioLevel(){return this._volumeMeter.getInternalAudioLevel()}getVolumeDb(){return this._volumeMeter.getVolumeDb()}write(e){if(this.node){let t=e.allocationSize({planeIndex:0}),i=new Float32Array(t>>2);e.copyTo(i,{planeIndex:0}),this.node.port.postMessage({name:"chunk",data:i},[i.buffer]),e.close()}}},Rx=xA(BA(),1),kx=e=>t=>t.deviceId===e,Cx=["virtual"],Dx=["obs","webcastmate"];function Ox(e,t){let i=e.label.toLowerCase();return!(!Cx.some(e=>i.includes(e))||(t||e.kind)===RR&&Dx.some(e=>i.includes(e.toLowerCase())))}function Lx(e,t){let i=e.filter(e=>!Ox(e,t));return i.length>0?i:e}var Nx=class{constructor(e,t){UA(this,"kind"),UA(this,"type"),UA(this,"devices",[]),this.kind=e,this.type=t}update(e,t){let i=e.filter(e=>e.kind==="".concat(this.kind).concat(this.type.toLocaleLowerCase()));1===this.devices.length&&Mx(this.devices[0])||t&&(i.forEach(e=>{if(e.deviceId&&!this.devices.find(kx(e.deviceId))){let i="".concat(this.kind).concat(this.type,"Added");oL.warn("".concat(i,": ").concat(JSON.stringify(e))),t.emit(i,e)}}),this.devices.forEach(e=>{if(e.deviceId&&!i.find(kx(e.deviceId))){let i="".concat(this.kind).concat(this.type,"Removed");oL.warn("".concat(i,": ").concat(JSON.stringify(e))),t.emit(i,e)}})),this.devices=i}hasDevice(e){return!!this.devices.find(t=>t.deviceId===e)}},Px=class extends Rx.EventEmitter{constructor(){super(),UA(this,"audioInputs",new Nx(hR,"Input")),UA(this,"videoInputs",new Nx(pR,"Input")),UA(this,"audioOutputs",new Nx(hR,"Output")),this.init(),navigator.mediaDevices&&(navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",()=>this.update()),"ondevicechange"in navigator.mediaDevices||WN.run("interval",()=>{this.update()},{delay:1e4}))}init(){Ux().then(e=>{this.audioInputs.update(e),this.videoInputs.update(e),this.audioOutputs.update(e)})}async update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=await Ux(e);return this.audioInputs.update(t,this),this.videoInputs.update(t,this),this.audioOutputs.update(t,this),this}hasBlueTooth(){var e;if(1e3*(null==(e=VP())?void 0:e.outputLatency)>150)return!0;let t=["bluetooth","air","wireless","bt","tws","buds","headset","headphone"];return this.audioOutputs.devices.some(e=>t.some(t=>e.label.toLowerCase().includes(t)))||this.audioInputs.devices.some(e=>t.some(t=>e.label.toLowerCase().includes(t)))}},xx=eR||$A?null:new Px;function Mx(e){return e.deviceId===e.groupId&&""===e.groupId}async function Ux(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(RL()||!SL())return[];let t=await navigator.mediaDevices.enumerateDevices();if(0!==e){let r={audio:!1,video:!1};if(t.forEach(e=>{Mx(e)&&(e.kind===AR?r.audio=!0:e.kind===RR&&(r.video=!0))}),2===e&&(r.audio=!1),1===e&&(r.video=!1),r.audio||r.video){let e;try{e=await navigator.mediaDevices.getUserMedia(r),r.audio&&FP()}catch(i){oL.debug("capture before getDevices failed: ",i)}t=await navigator.mediaDevices.enumerateDevices(),null==e||e.getTracks().forEach(e=>e.stop())}}return t.map((e,t)=>{let i={kind:e.kind,deviceId:e.deviceId,groupId:e.groupId,label:e.label||"".concat(e.kind,"_").concat(t)};return e.deviceId.length>0&&jx.add("".concat(e.deviceId,"_").concat(e.kind)),e.getCapabilities&&(i.getCapabilities=()=>e.getCapabilities()),i})}function Fx(e){var t,i;let r="boolean"==typeof e?e:null!=(t=null==e?void 0:e.requestPermission)&&t,n="boolean"!=typeof e&&(null!=(i=null==e?void 0:e.filterVirtualDevice)&&i);return xx.update(r?1:0).then(e=>{let{devices:t}=e.audioInputs;return n?Lx(t,AR):t})}function Bx(e){var t,i;let r="boolean"==typeof e?e:null!=(t=null==e?void 0:e.requestPermission)&&t,n="boolean"!=typeof e&&(null!=(i=null==e?void 0:e.filterVirtualDevice)&&i);return xx.update(r?2:0).then(e=>{let{devices:t}=e.videoInputs;return n?Lx(t,RR):t})}var Vx=!1;async function Hx(){try{Vx||(Vx=!0,oL.info("speakers:".concat((await async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(Xk||eD)&&(e=!1),xx.update(e?1:0).then(e=>e.audioOutputs.devices)}()).map(e=>" ".concat(e.deviceId.slice(0,8),": ").concat(e.label)))))}catch(_A){}}var jx=new Set;async function zx(e){let{newDeviceId:t,oldDeviceId:i,oldGroupId:r,oldLabel:n,kind:a}=e;return t===i&&(a!==hR||t!==xR||await async function(e,t){let i=(await Fx()).find(e=>e.deviceId===xR);return!t&&(null==i?void 0:i.groupId)===e||(null==i?void 0:i.groupId)===e&&i.label===t}(r,n))}var Wx,Gx=class extends wx{constructor(e){super(),this.log=e,UA(this,"volumeMeter"),UA(this,"volumeMeterAfter3A"),UA(this,"volumeDestination"),UA(this,"analyser",new bx),this.volumeMeter=new Ax({log:this.log}),this.volumeMeterAfter3A=new Ax({log:this.log}),this.volumeDestination=new Ex,this.volumeMeter.pipeTo(this.volumeDestination)}destroy(){this.gain.deleteNode(),this.volumeMeter.deleteNode(),this.analyser.deleteNode(),this.source.deleteNode(),this.destination.deleteNode(),this.volumeDestination.deleteNode()}},qx=class extends QN{constructor(e){super(e,hR),UA(this,"_outputDeviceId"),UA(this,"_floatVolume",1),UA(this,"_destination"),UA(this,"pipeline"),UA(this,"volumeMeterMode","worklet"),UA(this,"enableVolumeControlInIOS"),this.enableVolumeControlInIOS=e.enableVolumeControlInIOS,this.mode=0,e.url&&(this.url=e.url),this.pipeline=new Gx(this._log)}setTrack(e){}get duration(){var e;return Math.floor(1e3*((null==(e=this.element)?void 0:e.duration)||0))}get currentTime(){var e;return Math.floor(1e3*((null==(e=this.element)?void 0:e.currentTime)||0))}set currentTime(e){this.element&&(this.element.currentTime=e/1e3)}getMediaStream(){return this.pipeline.stream||(this.track?new MediaStream([this.track]):null)}initializeElement(e){if(("15.2"===nD||"15.3"===nD||"15.4"===nD)&&this.muted)return void this._log.info("audioElement is muted.");let t=Wx||new Audio;t.setAttribute("autoplay","autoplay"),t.srcObject=this.getMediaStream(),t.muted=this.muted,this.url&&(t.crossOrigin="anonymous",t.src=this.url),this.element=t,this.setVolume(XD(e)?e/100:this._floatVolume),t===Wx&&(Wx=void 0),this.options.enableTimeupdateEvent&&(this.element.ontimeupdate=()=>this.emit(GN.TIME_UPDATE,this.currentTime)),this.bindElementEvents()}async play(e){if(this.track||this.url){try{!this.pipeline.source.node&&this.track&&this.pipeline.replaceSource(this.track),this.element||this.initializeElement(null==e?void 0:e.volume),this._outputDeviceId&&await this.setSinkId(this._outputDeviceId),"worklet"===this.volumeMeterMode?(this.pipeline.volumeMeter.init(),this.pipeline.volumeMeterAfter3A.init()):"analyser"===this.volumeMeterMode&&this.pipeline.analyser.setNode(VP().createAnalyser()),this._log.info("volumeMeterMode: ".concat(this.volumeMeterMode)),Hx()}catch(XA){this._log.warn("autoplay error occurred before native play(): ".concat(XA)),aD(nD,"18.7",!0)&&this.bindAutoPlayEvent();let t=pL({key:lL.PLAY_FAILED,data:{media:this.kind,error:XA}});if(t.includes("NotAllowedError"))throw this.isInAutoPlayFailedState=!0,new gk({code:mk.PLAY_NOT_ALLOWED,message:t})}return super.play()}}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.pipeline.destroy(),super.stop(e)}setVolume(e){this._floatVolume=e,this.element&&(this.element.volume=e)}async setSinkId(e){var t,i;this._outputDeviceId!==e&&(this._outputDeviceId=e),this.element&&this.element.sinkId!==e&&await(null==(i=(t=this.element).setSinkId)?void 0:i.call(t,e)),this._log.info("setSinkId: ".concat(this._outputDeviceId))}get useDestination(){return!!this.pipeline.stream}setLoop(e){this.element&&(this.element.loop=e)}getAudioLevel(){return this.pipeline.volumeMeter.getCalculatedVolume()}getInternalAudioLevel(){return this.pipeline.volumeMeter.getInternalAudioLevel()}getInternalAudioLevelAfter3A(){return this.pipeline.volumeMeterAfter3A.getInternalAudioLevel()}},Kx=class extends qx{constructor(e){super(e),UA(this,"_sourceElement"),UA(this,"_output",new Ex),this.pipeline.source.pipeTo(this.pipeline.gain),this.pipeline.gain.pipeTo(this.pipeline.volumeMeter).pipeTo(this._output),this.pipeline.gain.pipeTo(this.pipeline.destination)}setOutput(){this.mode=1,this._output.setNode(VP().destination)}write(e){this.pipeline.volumeMeter.write(e)}setTrack(e){var t,i,r;(null==(i=null==(t=this.element)?void 0:t.error)?void 0:i.code)!==MediaError.MEDIA_ERR_DECODE&&this.track!==e&&(this.unbindTrackEvents(),this.track=e,this.emit(GN.MEDIA_TRACK_CHANGED,e),e?(this.bindTrackEvents(),this._sourceElement?this._sourceElement.srcObject=new MediaStream([e]):!this.useDestination&&this.element&&(this.element.srcObject=new MediaStream([e])),this.pipeline.source.channelCount=(null==(r=e.getSettings())?void 0:r.channelCount)||1,this.pipeline.replaceSource(e)):this.pipeline.source.deleteNode())}setVolume(e){var t;let i=e<=1&&!Zk();if(this._floatVolume!==e||!(i&&(null==(t=this.element)?void 0:t.volume)===e||!i&&this.pipeline.volume===e))if(this._floatVolume=e,this.useDestination)this.pipeline.setVolume(e),this._log.info("set pipeline volume: ".concat(e));else if(i)this.element?(this._log.info("set element volume: ".concat(e)),this.element.volume=e):this._log.info("set element volume: no element");else{if(Zk()){if(!this.enableVolumeControlInIOS)return;BP()}if($k&&!this.pipeline.source.node)return void this._log.warn("set pipeline volume failed: no source node");this._log.info("start set pipeline volume: ".concat(e)),this.pipeline.setVolume(e),this.element&&!this._sourceElement&&(this._destination||(this._destination=VP().createMediaStreamDestination()),this.pipeline.destination.setNode(this._destination),XN(this.element),this._sourceElement=this.element,this._sourceElement.muted=!0,this.element=null,this.play().catch(e=>{this.emit(GN.AUTOPLAY_FAILED,e)}))}}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.pipeline.destroy();let t=this._sourceElement||this.element;t&&tD&&(Wx=t),this._sourceElement&&(this._sourceElement.srcObject=null,delete this._sourceElement),super.stop(e)}},Yx=class extends FN{constructor(e){let{userId:t,sdkAppId:i,mediaType:r,room:n,PlayerClass:a=(1===r?Kx:AP)}=e;var o;super(),UA(this,"id",sL()),UA(this,"userId",""),UA(this,"isRemote"),UA(this,"mediaType"),UA(this,"room"),UA(this,"user"),UA(this,"_log"),UA(this,"_inputTrack"),UA(this,"_outputTrack"),UA(this,"isPlayCalled",!1),UA(this,"container",null),UA(this,"player"),UA(this,"subVideoPlayerMap"),UA(this,"muted",!1),UA(this,"abortCtrl"),UA(this,"objectFit","cover"),UA(this,"mirror"),UA(this,"rotation"),UA(this,"isScreen",!1),UA(this,"manager"),UA(this,"trackSettings"),UA(this,"isFirstVideoFrameEmitted",!1),this.userId=t||"",this.mediaType=r,this._log=oL.createLogger({parent:null==n?void 0:n.getLogger(),id:"".concat(this.kind[0],"t"),userId:null==(o=n||this.room)?void 0:o.userId,remoteUserId:this instanceof lM?void 0:this.userId,sdkAppId:i,type:2===this.mediaType?"auxiliary":"main",isLocal:this instanceof lM}),this.player=new a({id:this.userId||this.id,track:null,muted:!1,container:null,log:this._log,enableVolumeControlInIOS:null==n?void 0:n.enableVolumeControlInIOS}),this.player.on(GN.PLAYER_STATE_CHANGED,e=>{if(iL.emit(rL.PLAYER_STATE_CHANGED,DA({track:this},e)),this.emit("player-state-changed",e),"PLAYING"===e.state&&this.room){let e=!0;for(let{remoteAudioTrack:t,remoteVideoTrack:i,remoteAuxiliaryTrack:r}of[...this.room.remotePublishedUserMap.values()])if(t.isAvailable&&!t.player.isPlaying||i.isAvailable&&!i.player.isPlaying||r.isAvailable&&!r.player.isPlaying){e=!1;break}e&&gP()&&bP&&bP.deleteDialog()}}),this.kind===pR&&(this.player.on(GN.LOADED_DATA,()=>{this.emitFirstVideoFrameEvent(GN.LOADED_DATA),iL.emit(rL.VIDEO_LOADED_DATA,{track:this})}),this.player.on(GN.LOADED_META_DATA,()=>{this.emitFirstVideoFrameEvent(GN.LOADED_META_DATA)}),this.player.on(GN.MEDIA_TRACK_CHANGED,e=>{var t;null==(t=this.subVideoPlayerMap)||t.forEach(t=>t.setTrack(e))}),this.player.on(GN.RESIZE,e=>{this.emitFirstVideoFrameEvent(GN.RESIZE),this.emit("video-size-changed",DA({userId:this.userId,streamType:2===this.mediaType?"auxiliary":"main"},e))})),this.onTrackMuted=this.onTrackMuted.bind(this),this.onTrackUnmuted=this.onTrackUnmuted.bind(this),this.onTrackEnded=this.onTrackEnded.bind(this),this.onPlayerError&&this.player.on(GN.ERROR,this.onPlayerError.bind(this)),this.player.on(GN.AUTOPLAY_FAILED,this.handleAutoPlayFailed,this)}get log(){return this._log||oL}get kind(){return 1===this.mediaType?hR:pR}get isAudio(){return this.kind===hR}get strMediaType(){return 4===this.mediaType?pR:2===this.mediaType?fR:hR}get streamType(){return 2&this.mediaType?"auxiliary":"main"}get isMediaTrackActive(){return!!this.mediaTrack&&(!this.mediaTrack.muted&&"live"===this.mediaTrack.readyState&&this.mediaTrack.enabled)}async play(e,t){let i=QD(e)?e[0]:e;if(this.isPlayCalled)return this.log.info("play update options: ".concat(JSON.stringify(t))),t&&!KD(t.muted)&&this.setPlayerMute(t.muted),t&&!KD(t.objectFit)&&(this.objectFit=t.objectFit),void(this.player instanceof AP&&(this.player.setObjectFit(this.objectFit),this.container!==i&&i&&(QD(e)&&e.length>=1&&this.container&&e.includes(this.container)&&this.container.contains(this.player.elementToRender)?(e.splice(e.indexOf(this.container),1),e.unshift(this.container)):(this.container=i,this.player.setContainer(i))),QD(e)&&e.length>=1&&await this.playSubContainer(e.slice(1),t)));if(t&&!KD(t.muted)?this.setPlayerMute(t.muted):(!this.isRemote||this.kind===pR)&&this.setPlayerMute(!0),t&&!KD(t.objectFit)&&(this.objectFit=t.objectFit),this.player instanceof AP&&(KD(null==t?void 0:t.isLiveStream)||this.player.setLiveMode(t.isLiveStream),this.player.setObjectFit(this.objectFit),t&&!KD(t.poster)&&this.player.setPoster(t.poster)),this.isPlayCalled=!0,i&&(this.container=i,this.player instanceof AP&&this.player.setContainer(i)),iL.emit(rL.PLAY_TRACK_START,{track:this}),this._outputTrack){this._log.info("play with options: ".concat(JSON.stringify(t)));try{this.player.setTrack(this.playerMediaTrack),await this.player.play(t),QD(e)&&e.length>1&&await this.playSubContainer(e.slice(1),t)}catch(r){throw this.handleAutoPlayFailed(r),r}}else this.log.info("play has not mediaTrack, abort")}setMirror(e,t){if(this.isScreen||this.kind!==pR||KD(e)||e===this.mirror)return;this.mirror=e;let i=this.player;t&&(i=t);let r=this.manager;if(ZD(this.mirror))return i.setViewMirror(this.mirror),void(!this.isRemote&&r&&(r.mirror=!1));switch(this.mirror){case"view":r&&(r.mirror=!1),i.setViewMirror(!0);break;case"publish":r&&(r.mirror=!0),i.setViewMirror(!0);break;case"both":r&&(r.mirror=!0),i.setViewMirror(!1)}}async playSubContainer(e,t){if(!this._outputTrack||this.kind===hR)return;this.subVideoPlayerMap||(this.subVideoPlayerMap=new Map),this.subVideoPlayerMap.forEach((t,i)=>{var r;e.find(e=>i===e)||(t.stop(),null==(r=this.subVideoPlayerMap)||r.delete(i))});for(let[r,n]of e.entries()){let e=this.subVideoPlayerMap.get(n);e?t&&(KD(t.objectFit)||e.setObjectFit(t.objectFit)):this.subVideoPlayerMap.set(n,new AP({id:this.userId||this.id,track:this.playerMediaTrack,container:n,muted:this.player.muted,objectFit:this.objectFit,log:this.log.createChild({id:"vp-sub".concat(r+1)})}))}let i=[...this.subVideoPlayerMap.values()];for(let r of i)r.setViewMirror(this.player.mirror),await r.play()}setAudioOutput(e){return this.player.setSinkId(e)}setAudioVolume(e){this.player.setVolume(e)}getAudioLevel(){return this.player.getAudioLevel()||0}getInternalAudioLevel(){var e;return(null==(e=this.player)?void 0:e.getInternalAudioLevel())||0}stop(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isPlayCalled&&(this.isPlayCalled=!1,this.isFirstVideoFrameEmitted=!1,this._replayTimer&&(clearTimeout(this._replayTimer),this._replayTimer=0),this.player&&(this.log.info("stop ".concat(this.kind," player")),this.player.stop(QO(this)&&!e?this.jitterBufferDelay:0)),this.subVideoPlayerMap&&this.subVideoPlayerMap.size>0&&this.subVideoPlayerMap.forEach(e=>{e.stop()}),this.container=null)}async resume(){var e;this.isPlayCalled&&await(null==(e=this.player)?void 0:e.resume())}close(){this._toInitState(),this.log.info("close"),this.isPlayCalled&&this.stop(!0)}_toInitState(){}setMute(e){this.muted=e,this._inputTrack&&(this._inputTrack.enabled=!e),this._outputTrack&&(this._outputTrack.enabled=!e),this.emit(e?"mute":"unmute",this),iL.emit(e?rL.TRACK_MUTED:rL.TRACK_UNMUTED,{track:this})}setPlayerMute(e){this.player.setMuted(e)}get mediaTrack(){return this._inputTrack||null}get outMediaTrack(){return this._outputTrack||null}get playerMediaTrack(){return this.outMediaTrack}installTrackEvent(e){YN(e,e).add(_R,this.onTrackMuted).add(vR,this.onTrackUnmuted).add(yR,this.onTrackEnded),e.muted&&this.onTrackMuted(),e.readyState===yR&&this.onTrackEnded()}uninstallTrackEvent(e){XN(e)}setInputMediaStreamTrack(e){var t;let i=this._inputTrack;if(e!==i)return this._inputTrack=e,this.trackSettings=null==(t=e.getSettings)?void 0:t.call(e),e.enabled=!this.muted,i&&this.uninstallTrackEvent(i),this.installTrackEvent(e),this.emit("input-media-track-changed",e||null,i||null),this.manager?this.manager.changeInput(this):this.setOutputMediaStreamTrack(e)}setOutputMediaStreamTrack(e){var t;e!==this._outputTrack&&(this.isRemote?this.log.debug("setOutputMediaStreamTrack",e.label):this.log.info("setOutputMediaStreamTrack",null==(t=e.getSettings)?void 0:t.call(e).deviceId,e.label),this._outputTrack=e,this._inputTrack&&(this._outputTrack.contentHint=this._inputTrack.contentHint,this._outputTrack.enabled=this._inputTrack.enabled),this.updatePlayingState(!!e),this.emit("output-media-track-changed",e))}setMediaType(e){this.mediaType=e}updatePlayingState(e){var t,i;if(this.isPlayCalled){if(!e){if(this.player.isStopped)return this.stop(),void this.log.info("playing state updated, stop ".concat(this.kind));if(QO(this)&&this.isAudio&&null!=(t=this.user)&&t.muteState.hasAudio&&null!=(i=this.user)&&i.muteState.audioMuted)return;return this.player.stop(QO(this)?this.jitterBufferDelay:0),void this.log.info("playing state updated, stop ".concat(this.kind))}if(this.player.setTrack(this.playerMediaTrack),this.player.isStopped)return this.player.play().catch(e=>this.handleAutoPlayFailed(e)),void this.log.info("playing state updated, play ".concat(this.kind))}this.log.debug("updatePlayingState abort ".concat(this.isPlayCalled," ").concat(e," ").concat(this.player.isStopped))}async handleAutoPlayFailed(e){var t;this.log.warn("handleAutoPlayFailed",e);let i=()=>{this.resume().then(()=>{document.removeEventListener("click",i,!0)})};(pC||gC)&&(await kO(100),null!=(t=this.player)&&t.isPlaying)||(this.room&&this.room.enableAutoPlayDialog?bP||(bP=new EP):document.addEventListener("click",i,!0),iL.once(rL.LOCAL_TRACK_CAPTURE_SUCCESS,e=>{let{track:t}=e;"audio"===t.kind&&gP()&&!this.player.isPlaying&&this.isRemote&&this.isAvailable&&i()}),this.emit("error",e))}getVideoFrame(){return this.player instanceof AP?this.player.getVideoFrame():""}emitFirstVideoFrameEvent(e){var t,i,r;if(this.isFirstVideoFrameEmitted)return;let n=null==(t=this.mediaTrack)?void 0:t.getSettings(),a=(null==n?void 0:n.width)||(null==(i=this.player.element)?void 0:i.videoWidth)||0,o=(null==n?void 0:n.height)||(null==(r=this.player.element)?void 0:r.videoHeight)||0;e===GN.RESIZE&&!a&&!o||e===GN.LOADED_META_DATA&&!a&&!o||(e===GN.LOADED_DATA&&!a&&!o&&this._log.warn("the dimension of video is 0x0 in first-video-frame event"),this.isFirstVideoFrameEmitted=!0,NO(this.rotation)&&([a,o]=[o,a]),this.emit("first-video-frame",{width:a,height:o,streamType:this.streamType,userId:this.isRemote?this.userId:""}))}onTrackMuted(){this._log.warn("".concat(this.kind," track is unable to provide media output"))}onTrackUnmuted(){this._log.info("".concat(this.kind," track is able to provide media output"))}onTrackEnded(){this._log.warn("".concat(this.kind," track ended, isPlayCalled=").concat(this.isPlayCalled,", isStopped=").concat(this.player.isStopped,", playerState=").concat(this.player._state))}};MA([xN([],FN.INIT,{sync:!0})],Yx.prototype,"_toInitState",1);var Xx=Object.prototype.hasOwnProperty;var Zx=function(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e||"function"==typeof e||Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(jD(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(let t in e)if(Xx.call(e,t))return!1;return!0}return!1};function Jx(e,t,i){if(0!==t.length&&Ox(t[0],i)){let r=Lx(t,i);r[0]!==t[0]&&(e.deviceId={exact:r[0].deviceId},oL.info("avoid virtual ".concat(i,' "').concat(t[0].label,'", use "').concat(r[0].label,'" instead')))}}var Qx=eL({retryFunction:async function(e){let t=function(e){return{audio:eM(e),video:tM(e)}}(e);oL.info("getUserMedia with constraints: ".concat(JSON.stringify(t)));let i=[],r=[],n=["label","deviceId","groupId"];if(t.audio&&(i=await Fx(),oL.info("microphones: ".concat(bO(i.map(e=>OA(DA({},e),{groupId:e.groupId.substring(0,8)})),{keysToInclude:n}))),!ZD(t.audio)&&!t.audio.deviceId&&Jx(t.audio,i,AR)),t.video&&(r=await Bx(),oL.info("cameras: ".concat(bO(r,{keysToInclude:n}))),!ZD(t.video)&&!t.video.deviceId&&!t.video.facingMode&&Jx(t.video,r,RR),!ZD(t.video)&&"user"===t.video.facingMode&&!t.video.deviceId)){let e=r.filter(e=>!e.label.includes("infrared")).find(e=>e.label.includes("facing front"));e&&(t.video.deviceId=e.deviceId,oL.info("exclude infrared camera: ".concat(JSON.stringify(t))))}try{let i=await navigator.mediaDevices.getUserMedia(t);return sN&&i.getTracks().forEach(t=>{var i;let r=t.getCapabilities();oL.info("".concat(t.kind," capabilities: ").concat(bO(r,{keysToInclude:UR}))),!KD(e.echoCancellation)&&-1===(null==(i=r.echoCancellation)?void 0:i.indexOf(e.echoCancellation))&&oL.warn("Invalid argument for 'echoCancellation'. Expected one of [".concat(JSON.stringify(r.echoCancellation),"], but received '").concat(e.echoCancellation,"'"))}),t.audio&&FP(),i}catch(a){let{message:t}=a;throw"NotFoundError"===a.name&&(e.video&&r&&0===r.length&&(t=pL({key:lL.CAMERA_NOT_FOUND})),e.audio&&i&&0===i.length&&(t=pL({key:lL.MICROPHONE_NOT_FOUND}))),new _k({code:mk.INITIALIZE_FAILED,name:a.name,message:t,constraint:a.constraint})}},settings:{retries:3,timeout:500},onError:e=>{let{error:t,retry:i,reject:r,retryFuncArgs:n,retriedCount:a}=e,o=a+1;"NotReadableError"===t.name||"OverconstrainedError"===t.name||"AbortError"===t.name?(1===o?(n[0].video&&(n[0].maxResolution=!1,(!eD||n[0].width*n[0].height<=2073600)&&n[0].frameRate&&(n[0].frameRate=n[0].frameRate>10?10:5)),n[0].retryWhenExactFailed&&n[0].useExactDeviceId&&(n[0].useExactDeviceId=!1)):2===o?n[0].useDeviceIdOnly=!0:3===o&&!n[0].useExactDeviceId&&(n[0].useTrueAsConstraint=!0),i()):r(t),n[0].microphoneId&&$x(n[0].microphoneId,!1),n[0].cameraId&&$x(n[0].cameraId,!0)},onRetrying:e=>{oL.warn("getUserMedia NotReadableError observed, retrying [".concat(e,"/3]"))},onRetryFailed:e=>{ZN.logFailedEvent({eventType:PR,error:e})},onRetrySuccess:e=>{ZN.logSuccessEvent({eventType:PR}),ZN.uploadEvent({log:"stat-".concat(PR,"-success-").concat(e)})}});async function $x(e,t){let i=(t?await Bx():await Fx()).find(t=>t.deviceId===e);i&&qD(i.getCapabilities)&&oL.warn(bO(i.getCapabilities(),{keysToInclude:UR}))}function eM(e){if(!e.audio)return!1;if(e.useTrueAsConstraint)return!0;let t={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:e.sampleRate};return!Zx(e.microphoneId)&&(t.deviceId=e.useExactDeviceId?{exact:e.microphoneId}:e.microphoneId,e.useDeviceIdOnly)?t:(XD(e.channelCount)&&(t.channelCount=e.channelCount),(ZD(e.echoCancellation)||"remote-only"===e.echoCancellation||"all"===e.echoCancellation)&&(t.echoCancellation=e.echoCancellation),ZD(e.noiseSuppression)&&!e.noiseSuppression&&(t.noiseSuppression=!1),ZD(e.autoGainControl)&&!e.autoGainControl&&(t.autoGainControl=!1),!!Zx(t)||t)}function tM(e){if(!e.video)return!1;if(e.useTrueAsConstraint)return!0;let{maxResolution:t=!0}=e,i={};return e.cameraId?i.deviceId=e.useExactDeviceId?{exact:e.cameraId}:e.cameraId:e.facingMode&&(i.facingMode=e.facingMode),e.useDeviceIdOnly&&!Zx(i)?i:(e.width&&(i.width={ideal:e.width},t&&!$k&&(i.width.max=e.width)),e.height&&(i.height={ideal:e.height},t&&!$k&&(i.height.max=e.height)),$k&&kC&&e.width&&e.height&&e.width*e.height<101376&&(i.width=e.width,i.height=e.height),e.frameRate&&(i.frameRate=e.frameRate),!!Zx(i)||i)}var iM=Qx,rM=0,nM=class{constructor(e){UA(this,"log"),UA(this,"isRunning",!1),UA(this,"queue",[]);let t="fq".concat(++rM);e&&(t+="|".concat(e)),this.log=oL.createLogger({id:t})}get length(){return this.queue.length}get lastQueueItem(){return 0===this.length?null:this.queue[this.length-1]}push(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,r;let n=DA({},e),a=new Promise((e,t)=>{n.resolve=e,n.reject=t});return n.promise=a,t?this.length<=1?this.queue.push(n):null==(r=null==(i=this.lastQueueItem)?void 0:i.promise)||r.then(n.resolve,n.reject):this.queue.push(n),this.log.debug("push ".concat(this.length),e.funcName,e.args),this.isRunning||this.callNext(),a}shift(){let e=this.queue.shift();return this.log.debug("shift ".concat(this.length),null==e?void 0:e.funcName,null==e?void 0:e.args),e}callNext(){if(this.isRunning||0===this.length)return;let{fn:e,args:t,context:i,resolve:r,reject:n,funcName:a}=this.queue[0];this.log.debug("callNext",this.length,a,t),this.isRunning=!0,e.apply(i,t).then(r,n).finally(()=>{this.isRunning=!1,this.shift(),this.callNext()})}},aM=new WeakMap;function oM(e,t){return qA((i,r)=>function(){let r=e;try{for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];let e=i.apply(this,a),s=sO();return tO(e)?e.then(e=>(t?yL.addSuccessEvent({key:r,cost:sO()-s}):yL.addSuccessEvent({key:r}),e)).catch(e=>{throw yL.addFailedEvent({key:r,error:e}),e}):(yL.addSuccessEvent({key:r}),e)}catch(ZA){throw yL.addFailedEvent({key:r,error:ZA}),ZA}})}var sM,cM=((sM=cM||{})[sM.AUTO_SWITCH_NEW_DEVICE=0]="AUTO_SWITCH_NEW_DEVICE",sM[sM.WAIT_CURRENT_DEVICE=1]="WAIT_CURRENT_DEVICE",sM),lM=class extends Yx{constructor(e,t,i){super({mediaType:e,PlayerClass:t,room:i}),UA(this,"isRemote",!1),UA(this,"deviceId"),UA(this,"groupId",""),UA(this,"label",""),UA(this,"sourceTrack"),UA(this,"enableAutoSwitchWhenRecapturing",!0),UA(this,"filterVirtualDevice",!1),UA(this,"_isRecapturing",!1),UA(this,"_lastRecaptureTime",0),UA(this,"_onMuteTimeoutId",-1),UA(this,"_onVisibilityChangeForRecapture",null),UA(this,"_encodeCheckTimeoutId",-1),UA(this,"_silentCaptureStartTime",0),UA(this,"_hasCapturedDataBefore",!1),UA(this,"_lastSilentRecaptureTime",0),UA(this,"_silentCaptureReported",!1),UA(this,"_lastSilentCheckTotalFrames"),UA(this,"recaptureMode",0),UA(this,"profile"),UA(this,"retryEncodeFailed"),this._checkSilentCapture=this._checkSilentCapture.bind(this),this.on("4",e=>{let{state:t}=e;"started"===t?this.startSilentCaptureDetection():"stopped"===t&&this.stopSilentCaptureDetection()})}get enableEncodeFrame(){return!1}get isPublishing(){return"publishing"===this.state.toString()}get isPublished(){return"publish"===this.state}get isUseCustomSource(){return!(!this.mediaTrack||this.sourceTrack===this.mediaTrack)}encodeFrame(e,t){throw new Error("Method not implemented.")}installTrackEvent(e){e.addEventListener(_R,this.onTrackMuted),e.addEventListener(vR,this.onTrackUnmuted),e.addEventListener(yR,this.onTrackEnded),e.muted&&this.onTrackMuted(),e.readyState===yR&&this.onTrackEnded()}uninstallTrackEvent(e){e.removeEventListener(_R,this.onTrackMuted),e.removeEventListener(vR,this.onTrackUnmuted),e.removeEventListener(yR,this.onTrackEnded)}setStateToReady(){}async capture(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,r;let n=this.sourceTrack;try{let n,a=sO();iL.emit(rL.LOCAL_TRACK_CAPTURE_START,{track:this}),e.customSource?(n=new MediaStream,n.addTrack(e.customSource)):(t||null==(i=this.sourceTrack)||i.stop(),n=await iM(e));let o=n.getTracks()[0];return await this.setInputMediaStreamTrack(o),e.customSource||(this.sourceTrack=o,this.updateDeviceIdInUse(),this.listenDeviceChange()),iL.emit(rL.LOCAL_TRACK_CAPTURE_SUCCESS,{track:this,cost:sO()-a,profile:this.profile,room:null==(r=this.manager)?void 0:r.room}),n}catch(a){throw iL.emit(rL.LOCAL_TRACK_CAPTURE_FAILED,{track:this,error:a}),this.log.error("getUserMedia error observed ".concat(a)),a}finally{t&&(null==n||n.stop())}}setOutputMediaStreamTrack(e){var t;if(super.setOutputMediaStreamTrack(e),this.setStateToReady(),this.isPublishing||this.isPublished)return null==(t=this.room)?void 0:t.replaceTrack(this)}get hasFlag(){var e,t;let i=pO((null==(e=this.room)?void 0:e.localPublishFlag)||0,(null==(t=this.room)?void 0:t.userId)||"");return 4===this.mediaType&&i.hasVideo||1===this.mediaType&&i.hasAudio||2===this.mediaType&&i.hasAuxiliary}async publish(e,t){return this.room=e,this.room.localTracks.add(this),this.emit("4",{mediaType:this.strMediaType,state:"starting",prevState:"stopped"}),this.userId=e.userId,this._log.bindParent(e.getLogger()),await t,this._checkPublishFlag(e)}_checkPublishFlag(e){return new Promise(async(t,i)=>{var r,n,a,o,s;let c=()=>i(new _k({code:mk.API_CALL_ABORTED,message:"publish aborted"}));if(this.hasFlag||this.muted?t():((this.state===FN.INIT||"ready"===this.state)&&c(),XP(ox(e,"local-publish-flag-changed"),sx(()=>this.hasFlag),lx(rx(ox(this,FN.INIT),ox(this,"ready"))),vx(t,i,c))),null!=(a=null==(n=null==(r=this.room)?void 0:r.networkQuality)?void 0:n.hadRecentBadUplink)&&a.call(n,2))return t();let l=e.heartbeatCount,d=(null==(s=null==(o=this.mediaTrack)?void 0:o.stats)?void 0:s.totalFrames)||0;this._encodeCheckTimeoutId=setTimeout(async()=>{var r,n,a,o,s,c,u,h;if(null!=(a=null==(n=null==(r=this.room)?void 0:r.networkQuality)?void 0:n.hadRecentBadUplink)&&a.call(n,2)||e.heartbeatCount-l<3)return t();if(this.isPublished||this.isPublishing){let e=this.kind===hR;if(null!=(o=this.mediaTrack)&&o.stats){let e=this.mediaTrack.stats.totalFrames||0;e-d===0&&this.log.warn("capture totalFrames is 0 during encode check, totalFrames",e)}if(!this.isMediaTrackActive)return this.emit("6",this),i(new _k({message:"".concat(this.strMediaType," encode failed, track is not active"),code:e?mk.AUDIO_ENCODE_FAILED:mk.VIDEO_ENCODE_FAILED}));let r=this.stat.bytesSent>0;if(yL[r?"addSuccessEvent":"addFailedEvent"]({key:e?503700:513702}),!e){let e={H264:513704,H265:513705,VP8:513706}[(null==(c=null==(s=this.room)?void 0:s.videoCodec)?void 0:c.toUpperCase())||"H264"];e&&yL[r?"addSuccessEvent":"addFailedEvent"]({key:e})}if(!r){if(yL.addEnum({key:e?503701:513703,value:ED()}),ZN.uploadEvent({log:"stat-encode-failed-".concat(this.kind,"-").concat(_D()||bD()),userId:this.userId}),this.log.warn(e?"encode failed":"".concat(null==(h=null==(u=this.room)?void 0:u.videoCodec)?void 0:h.toUpperCase()," encode failed")),this.retryEncodeFailed&&(this.log.warn("retry encode"),await this.retryEncodeFailed(this),this.stat.bytesSent>0||this.hasFlag||(await kO(5e3),this.stat.bytesSent>0||this.hasFlag)))return t();this.emit("6",this),i(new _k({message:"".concat(this.strMediaType," encode failed"),code:e?mk.AUDIO_ENCODE_FAILED:mk.VIDEO_ENCODE_FAILED}))}}},1e4)})}unpublish(){this.room&&this.room.localTracks.delete(this),this.log.info("unpublish"),iL.emit(rL.LOCAL_TRACK_UNPUBLISHED,{track:this})}async updateDeviceIdInUse(){if(this.sourceTrack&&oN){let{deviceId:e,groupId:t}=this.sourceTrack.getSettings(),{label:i}=this.sourceTrack;await zx({newDeviceId:e,oldDeviceId:this.deviceId,oldGroupId:this.groupId,oldLabel:this.label,kind:this.kind})||(this.deviceId=e,this.label=i,t&&(this.groupId=t),Ux().then(i=>{let r=i.find(i=>{let r=i.deviceId===e;return t&&(r=r&&i.groupId===t),r});r&&this.emit("2",r)}))}}setProfile(e){this.log.info("setProfile",e),Object.assign(this.profile,e)}isNeedToRecapture(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return!(!this.deviceId||!this.sourceTrack||this.kind===hR&&!function(e){if(e instanceof CanvasCaptureMediaStreamTrack||!(e instanceof MediaStreamTrack))return!1;let t=e.label.toLocaleLowerCase();if(t.includes("mic")||t.includes("麦克风"))return!0;let i="".concat(((null==e?void 0:e.getSettings())||{}).deviceId,"_").concat(AR);return!!jx.has(i)}(this.sourceTrack)||this.kind===pR&&!function(e){if(e instanceof CanvasCaptureMediaStreamTrack||!(e instanceof MediaStreamTrack))return!1;let t=e.label.toLocaleLowerCase();if(t.includes("camera")||t.includes("webcam"))return!0;let i="".concat(((null==e?void 0:e.getSettings())||{}).deviceId,"_").concat(RR);return!!jx.has(i)}(this.sourceTrack)||this._isRecapturing||e&&kC&&eD)}onTrackMuted(){if(super.onTrackMuted(),this.isNeedToRecapture(!0)){if(Date.now()-this._lastRecaptureTime<MR)return void setTimeout(()=>this.onTrackMuted(),MR);this._onMuteTimeoutId=setTimeout(async()=>{var e;if(null!=(e=this.sourceTrack)&&e.muted){if((Xk||Jk)&&"visible"!==document.visibilityState)return this._onVisibilityChangeForRecapture=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",this._onVisibilityChangeForRecapture),this._onVisibilityChangeForRecapture=null,kO(1e3).then(async()=>{var e;null!=(e=this.sourceTrack)&&e.muted&&!this._isRecapturing&&(this.log.warn("recapture after visible"),this.recapture(await this.getRecoverCaptureDeviceId()))}))},void document.addEventListener("visibilitychange",this._onVisibilityChangeForRecapture);this.recapture(await this.getRecoverCaptureDeviceId())}},5e3)}}onTrackUnmuted(){super.onTrackUnmuted(),this._onMuteTimeoutId>0&&clearTimeout(this._onMuteTimeoutId),this._onVisibilityChangeForRecapture&&(document.removeEventListener("visibilitychange",this._onVisibilityChangeForRecapture),this._onVisibilityChangeForRecapture=null)}async onTrackEnded(){if(super.onTrackEnded(),this.isNeedToRecapture()&&0===this.recaptureMode){if(Date.now()-this._lastRecaptureTime<MR)return void setTimeout(()=>this.onTrackEnded(),MR);this.emit("7"),this.recapture(await this.getRecoverCaptureDeviceId())}}async recapture(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(this._isRecapturing||!this.sourceTrack)return;this.log.warn("recapture trying");let r=this.sourceTrack;t||null==(i=this.sourceTrack)||i.stop(),this._isRecapturing=!0,this._lastRecaptureTime=Date.now();let n={useExactDeviceId:!0};if("user"===e||"environment"===e)n.facingMode=e;else{let t,i="audio"===this.kind?await Fx():await Bx(),r=i.find(t=>t.deviceId===e);if(r)if(this.filterVirtualDevice&&Ox(r)){let n=Lx(i)[0];n.deviceId!==r.deviceId?(this.log.warn("avoid virtual device ".concat(r.label,", use ").concat(n.label," instead")),t=n.deviceId):t=e}else t=e;n.deviceId=t}return this.capture(n,t).then(()=>{var e;this._isRecapturing=!1,this.log.warn("recapture success"),this.emit("1",{deviceId:this.deviceId}),iL.emit(rL.LOCAL_TRACK_RECAPTURE,{track:this}),null!=(e=this.sourceTrack)&&e.muted&&(this.log.warn("track still muted after recapture"),this.onTrackMuted())}).catch(e=>{this._isRecapturing=!1,this.log.warn("recapture failed ".concat(e.message)),this.emit("5",e),iL.emit(rL.LOCAL_TRACK_RECAPTURE,{track:this,error:e})}).finally(()=>{t&&(null==r||r.stop())})}async getRecoverCaptureDeviceId(){let e=this instanceof fM;if(e&&this.facingMode)return this.facingMode;let{deviceId:t}=this;if(t){let i=(dM.get(t)||0)+1;if(dM.set(t,i),i>=3&&this.enableAutoSwitchWhenRecapturing){let r=e?await Bx():await Fx(),n=(this.filterVirtualDevice?Lx(r):r).find(e=>!dM.has(e.deviceId));n&&(this.log.warn("".concat(t," capture fail ").concat(i," times, change new ").concat(n.deviceId)),t=n.deviceId)}}return t}get isCaptureSilent(){var e,t;if(this.muted||!this.sourceTrack||this.sourceTrack.muted||!this.sourceTrack.enabled||"live"!==this.sourceTrack.readyState)return!1;let i=null==(t=null==(e=this.mediaTrack)?void 0:e.stats)?void 0:t.totalFrames;if(XD(i)){let e=this._lastSilentCheckTotalFrames;return this._lastSilentCheckTotalFrames=i,!!XD(e)&&(!(i>e)&&(!(i<e)||this._checkCaptureSilent()))}return this._checkCaptureSilent()}_checkCaptureSilent(){return!1}resetSilentCaptureState(){}get _isRecaptureSilentEnabled(){var e,t,i,r;let n=null==(r=null==(i=null==(t=null==(e=this.room)?void 0:e.scheduleResult)?void 0:t.config)?void 0:i.extraFields)?void 0:r.recaptureSilent;return!!n&&(this.isAudio?"1"===n||"3"===n:"2"===n||"3"===n)}startSilentCaptureDetection(){var e;null==(e=this.room)||e.on("heartbeat-report",this._checkSilentCapture)}stopSilentCaptureDetection(){var e;null==(e=this.room)||e.off("heartbeat-report",this._checkSilentCapture),this._silentCaptureStartTime=0,this._hasCapturedDataBefore=!1,this._lastSilentRecaptureTime=0,this._silentCaptureReported=!1,this._lastSilentCheckTotalFrames=void 0,this.resetSilentCaptureState()}_checkSilentCapture(){if(fD()&&"visible"!==document.visibilityState)this._silentCaptureStartTime=0;else if(this.isPublished&&!this.muted&&this.sourceTrack&&!this.sourceTrack.muted&&"live"===this.sourceTrack.readyState&&!this._isRecapturing&&!this.isUseCustomSource&&!(this._lastSilentRecaptureTime&&Date.now()-this._lastSilentRecaptureTime<3e4)){if(!this.isCaptureSilent)return this._hasCapturedDataBefore=!0,this._silentCaptureStartTime=0,void(this._silentCaptureReported=!1);if(this._hasCapturedDataBefore)if(this._silentCaptureStartTime){if(sO()-this._silentCaptureStartTime>1e4){if(!this._silentCaptureReported){this._silentCaptureReported=!0;let e=_D()||bD();ZN.uploadEvent({log:"stat-silent-capture-".concat(this.strMediaType,"-").concat(e),userId:this.userId}),this.log.warn("capture silent for ".concat(10,"s"))}if(this._isRecaptureSilentEnabled&&this.deviceId&&!this._lastSilentRecaptureTime){this._lastSilentRecaptureTime=Date.now();let e=e=>{this.off("1",t),this.off("5",i);let r=_D()||bD();ZN.uploadEvent({log:"stat-silent-capture-".concat(this.strMediaType,"-").concat(e?"1":"0","-").concat(r),userId:this.userId})},t=()=>e(!0),i=()=>e(!1);this.on("1",t),this.on("5",i),this.recapture(this.deviceId)}}}else this._silentCaptureStartTime=sO()}}stopCapture(){var e;this.sourceTrack&&(this.sourceTrack.stop(),iL.emit(rL.LOCAL_TRACK_STOPPED,{track:this}),this.uninstallTrackEvent(this.sourceTrack)),this._inputTrack&&this.uninstallTrackEvent(this._inputTrack),null==(e=this.manager)||e.removeInput(this),this._onMuteTimeoutId&&clearTimeout(this._onMuteTimeoutId),this._onVisibilityChangeForRecapture&&(document.removeEventListener("visibilitychange",this._onVisibilityChangeForRecapture),this._onVisibilityChangeForRecapture=null),this.stopSilentCaptureDetection()}close(){super.close(),this.stopCapture()}};MA([xN(FN.INIT,"ready",{ignoreError:!0,sync:!0})],lM.prototype,"setStateToReady",1),MA([function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t,i,r){let n=r.value;return r.value=function(){let t=aM.get(this)||new nM;for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return aM.set(this,t),t.push({fn:n,args:a,context:this,funcName:i},e)},r}}()],lM.prototype,"capture",1),MA([xN("ready","publish",{ignoreError:!0,success(){iL.emit(rL.LOCAL_TRACK_PUBLISHED,{track:this,room:this.room}),this.emit("4",{mediaType:this.strMediaType,state:"started",prevState:"starting"}),this.log.info("published")},fail(e){var t;null==(t=this.room)||t.localTracks.delete(this);let i="error",r=e instanceof _k?e:e.cause instanceof _k?e.cause:e,n=!1;r instanceof _k&&(r.message.includes("timeout")?i="timeout":r.code===mk.API_CALL_ABORTED&&(n=!0,i="api-call")),this.emit("4",{mediaType:this.strMediaType,state:"stopped",prevState:"starting",reason:i,error:r}),this.log[n?"info":"error"]("publish failed",r)}}),oM(521714,!1)],lM.prototype,"publish",1),MA([qA(e=>async function(){let t="publish"===this.state?"started":"starting";e.call(this),this.emit("4",{mediaType:this.strMediaType,state:"stopped",prevState:t,reason:"api-call"}),clearTimeout(this._encodeCheckTimeoutId)}),xN([],"ready",{sync:!0})],lM.prototype,"unpublish",1);var dM=new Map;iL.on(rL.SWITCH_DEVICE_SUCCESS,e=>{e.track.deviceId&&dM.delete(e.track.deviceId)});var uM=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.dataView=e,this.isSEI&&(t?this.addPreventionByte():this.removePreventionByte())}addPreventionByte(){let{seiPayloadStartIndex:e}=this,t=this.dataView.byteLength-2,i=[],r=0;for(let a=e;a<=t;a++){let e=this.dataView.getInt8(a);switch(e){case 0:case 1:case 2:case 3:2===r&&(i.push(3),r=0),0===e?r+=1:r=0,i.push(e);break;default:r=0,i.push(e)}}i.push(this.dataView.getInt8(this.dataView.byteLength-1));let n=new DataView(new Uint8Array([...new Uint8Array(this.dataView.buffer).slice(0,e),...i]).buffer);this.dataView=n}removePreventionByte(){let{seiPayloadStartIndex:e}=this,t=this.dataView.byteLength-1,i=[],r=0;for(let a=e;a<=t;a++)switch(this.dataView.getInt8(a)){case 0:r++,i.push(this.dataView.getInt8(a));break;case 3:2!==r&&i.push(this.dataView.getInt8(a)),r=0;break;default:i.push(this.dataView.getInt8(a)),r=0}let n=new DataView(new Uint8Array([...new Uint8Array(this.dataView.buffer).slice(0,e),...i]).buffer);this.dataView=n}get seiPayloadStartIndex(){let e=6;for(let t=6;t<this.dataView.buffer.byteLength&&(e+=1,255===this.dataView.getUint8(t));t+=1);return e}get seiPayloadType(){return this.isSEI?this.dataView.getUint8(5):null}get seiPayload(){if(!this.isSEI)return null;let e=0,t=6;for(let a=6;a<this.dataView.buffer.byteLength;a+=1){let i=this.dataView.getUint8(a);if(t+=1,255!==i){e+=i;break}e+=255}let i=new ArrayBuffer(e),r=new DataView(i),n=t;for(let a=0;a<i.byteLength;a+=1)r.setInt8(a,this.dataView.getInt8(n+a));return r}get naluType(){let e=this.getStartCodeLength();return e>=this.dataView.byteLength?0:31&this.dataView.getUint8(e)}getStartCodeLength(){return this.dataView.byteLength>=4&&0===this.dataView.getUint8(0)&&0===this.dataView.getUint8(1)&&0===this.dataView.getUint8(2)&&1===this.dataView.getUint8(3)?4:this.dataView.byteLength>=3&&0===this.dataView.getUint8(0)&&0===this.dataView.getUint8(1)&&1===this.dataView.getUint8(2)?3:0}get isIDR(){return 5===this.naluType}get isSPS(){return 7===this.naluType}get isPPS(){return 8===this.naluType}get isSEI(){return 6===this.naluType}},hM=class{constructor(){UA(this,"_seiMessageList",[]),UA(this,"_smallSeiMessageList",[]),UA(this,"_seiPayloadType",243)}encodeSEINalu(e){let t=e.byteLength,i=parseInt(String(t/255),10),r=t%255,n=[];n.push(0,0,0,1,6,this._seiPayloadType);for(let o=0;o<i;o++)n.push(255);n.push(r);let a=new DataView(e);return n.push(...new Uint8Array(a.buffer)),n.push(128),new uM(new DataView(new Uint8Array(n).buffer),!0)}sendSEI(e,t){null!=t&&t.seiPayloadType&&(this._seiPayloadType=t.seiPayloadType),this._seiMessageList.push(e),null!=t&&t.small&&this._smallSeiMessageList.push(e)}isEmpty(){return!this._seiMessageList.length}getNaluCount(e){let t=0,i=0,r=new DataView(e);for(let n=0;n<e.byteLength;n++)switch(r.getUint8(n)){case 0:t++;break;case 1:(2===t||3===t)&&i++,t=0;break;default:t=0}return i}encode(e,t){let i=t?this._smallSeiMessageList:this._seiMessageList;if(i.length>0&&e.data.byteLength>0){let t=9-this.getNaluCount(e.data);if(t<=0)return 0;let r=i.splice(0,t).reverse().map(this.encodeSEINalu.bind(this)),n=r.reduce((e,t)=>e+t.dataView.byteLength,0),a=new ArrayBuffer(n+e.data.byteLength),o=new DataView(a),s=new DataView(e.data),c=0;for(let e=0;e<r.length;e++)for(let t=0;t<r[e].dataView.byteLength;t++)o.setInt8(c++,r[e].dataView.getInt8(t));for(let i=0;i<e.data.byteLength;i++)o.setInt8(c++,s.getInt8(i));return e.data=a,r.length}return 0}},pM=class e extends lM{constructor(e){super(arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,AP,null==e?void 0:e.room),UA(this,"profile",DA({},cR)),UA(this,"avoidCropping",!1),UA(this,"_scaleResolutionDownBy"),UA(this,"_smallTrack"),UA(this,"stat",{bytesSent:0,packetsSent:0,framesEncoded:0,framesSent:0,frameWidth:0,frameHeight:0,fpsCapture:0,framesCaptured:0}),UA(this,"small"),UA(this,"isNeedToSetBandwidth"),UA(this,"muteImage"),UA(this,"manager"),UA(this,"_seiCodec",new hM),this.manager=e;let t=()=>{var e;if(this.isAllowed2k4k(this.profile))this.room&&this.settings.height>=1440&&"publish"===this.state&&this.room.sendAbilityStatus({"2k4k":1});else{let t=AD((null==(e=this.room)?void 0:e.sdkAppId)||0)?rR:iR;this.log.warn("Resolution is reset to 1080p, need to upgrade ability here ".concat(t)),this.setProfile(OA(DA({},this.profile),{width:1920,height:1080})),this.applyProfile()}};this.on("input-media-track-changed",t),this.on("publish",t),this.on("input-media-track-changed",()=>{this.invalidateSmallTrack()}),this.handleCameraAdded=this.handleCameraAdded.bind(this),this.handleCameraRemoved=this.handleCameraRemoved.bind(this)}_checkCaptureSilent(){return 0===(this.stat.fpsCapture||0)}get facingMode(){if(oN&&this.mediaTrack)return this.mediaTrack.getSettings().facingMode}get contentHint(){var e,t;return(null==(e=this._inputTrack)?void 0:e.contentHint)||(null==(t=this.outMediaTrack)?void 0:t.contentHint)||""}get isQosClearFirst(){var e;return"detail"===(null==(e=this._inputTrack)?void 0:e.contentHint)}get hasSmall(){var e;return!(null==(e=this.manager)||!e.hasSmall)||!!this._smallTrack}get smallTrack(){if(!this._smallTrack){let e=this.outMediaTrack;e&&(this._smallTrack=e.clone())}return this._smallTrack}invalidateSmallTrack(){this._smallTrack&&(this._smallTrack.stop(),delete this._smallTrack)}async setMute(e){var t,i,r;if(YD(e)){if(this.muteImage===e)return;await(null==(t=this.manager)?void 0:t.deleteWatermark("mute")),await(null==(i=this.manager)?void 0:i.setWatermark({x:0,y:0,width:this.settings.width,height:this.settings.height,type:"mute",zIndex:999,imageUrl:e,fillVideo:!0})),this.muteImage=e,super.setMute(!1)}else this.muteImage&&(await(null==(r=this.manager)?void 0:r.deleteWatermark("mute")),this.muteImage=void 0),super.setMute(e),this.invalidateSmallTrack()}async capture(e){let{deviceId:t,facingMode:i,useExactDeviceId:r=!0,customSource:n,retryWhenExactFailed:a=!0}=e,o={audio:!1,video:!0,facingMode:i||this.facingMode,cameraId:t,width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate,useExactDeviceId:r,retryWhenExactFailed:a,customSource:n};if("environment"===o.facingMode){let e=await this.getDeviceIdWhenUsingBackCamera();e&&(o.cameraId=e)}return super.capture(o)}setProfile(e){var t;let i=this.fallbackProfile(e);if(this.profile.width!==i.width||this.profile.height!==i.height||this.profile.frameRate!==i.frameRate||this.profile.bitrate!==i.bitrate)if(i.bitrate&&(this.isNeedToSetBandwidth=i.bitrate!==this.profile.bitrate),this.isAllowed2k4k(this.profile))super.setProfile(i);else{let e=AD((null==(t=this.room)?void 0:t.sdkAppId)||0)?rR:iR;this.log.warn("Resolution is reset to 1080p, need to upgrade ability here ".concat(e)),super.setProfile(OA(DA({},this.profile),{width:1920,height:1080}))}}async applyProfile(){var e;if(!this.mediaTrack)return;this.log.info("applyProfile",this.profile);let t=this.settings;return(t.height!==this.profile.height||t.width!==this.profile.width||t.frameRate!==this.profile.frameRate)&&(16===oD&&this.deviceId?await this.recapture(this.deviceId):(await(null==(e=this.sourceTrack||this.mediaTrack)?void 0:e.applyConstraints({width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate})),this.manager&&this.manager.changeInput(this)),this.room&&this.settings.height>=1440&&"publish"===this.state&&this.room.sendAbilityStatus({"2k4k":1})),this.isNeedToSetBandwidth&&this.room&&this.room.setBandWidth?(this.isNeedToSetBandwidth=!1,this.room.setBandWidth({bandwidth:this.profile.bitrate,type:pR,videoType:mR})):void 0}get settings(){let e={width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate},t=this.sourceTrack||this.mediaTrack;return oN&&t&&Object.assign(e,t.getSettings()),e}get scaleResolutionDownBy(){return this._scaleResolutionDownBy?this._scaleResolutionDownBy:LO(this.settings,this.profile)}isAllowed2k4k(e){var t;return!(this.room&&this.room.scheduleResult&&!this.isScreen&&!(e.height*e.width<3686400))||1===(null==(t=this.room.scheduleResult.trtcAutoConf)?void 0:t["2k4k"])}isNeedToSwitchDevice(e){return!(!this.mediaTrack||this.deviceId===e||this.facingMode===e)}async switchDevice(e){try{if(!this.isNeedToSwitchDevice(e)&&!this.isUseCustomSource)return;let t={useExactDeviceId:!0,retryWhenExactFailed:!1};"user"===e||"environment"===e?t.facingMode=e:t.deviceId=e,this.sourceTrack&&this.sourceTrack.stop(),await this.capture(t),iL.emit(rL.SWITCH_DEVICE_SUCCESS,{track:this}),this.log.info("switch camera success")}catch(XA){throw this.log.error("switch camera failed ".concat(XA)),this.deviceId&&this.recapture(this.deviceId),XA}}async getDeviceIdWhenUsingBackCamera(){let e;try{if(xC&&!WC&&cN){let t=(await Bx(!0)).map(e=>{var t;return OA(DA({},e),{capabilities:null==(t=e.getCapabilities)?void 0:t.call(e)})}).filter(e=>{var t,i;return null==(i=null==(t=e.capabilities)?void 0:t.facingMode)?void 0:i.includes("environment")}),i=t[0];t.forEach(e=>{var t,r,n,a;let{capabilities:o}=e;(null!=(t=o.width)&&t.max&&null!=(r=o.height)&&r.max?o.width.max*o.height.max:0)>(null!=(n=i.capabilities.width)&&n.max&&null!=(a=i.capabilities.height)&&a.max?i.capabilities.width.max*i.capabilities.height.max:0)&&(i=e)}),null!=i&&i.capabilities&&(this._log.info("use max resolution back camera",i),e=i.deviceId)}}catch(XA){this._log.warn("get max res camera failed",XA)}return e}async updateSmallConfig(e){var t,i;this._log.info("update small stream config: ".concat(JSON.stringify(e)));let r=this.fallbackProfile(e,!0),n=!this.small||r.width!==this.small.width||r.height!==this.small.height||r.frameRate!==this.small.frameRate||r.bitrate!==this.small.bitrate,a=!this.small;this.small=r,n&&await(null==(t=this.manager)?void 0:t.update()),a&&await(null==(i=this.room)?void 0:i.enableSmall(!0)),this.log.info("update small stream config success")}fallbackProfile(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e.width>e.height,r=DA({},e);return e.width*e.height<=19200&&Jk&&KC&&(this.log.warn("".concat(t?"small ":"","resolution is ").concat(e.width,"*").concat(e.height,", fallback to 240*180 for android chrome")),r.width=i?240:180,r.height=i?180:240,r.bitrate=Math.max(e.bitrate,150)),e.width*e.height>921600&&cD&&(r.width=i?1280:720,r.height=i?720:1280,this.log.warn("reset to 1280 * 720 on iOS 13~14")),function(e,t){let i=e.split(".").map(e=>Number(e)),r=t.split(".").map(e=>Number(e));for(let n=0;n<Math.max(i.length,r.length);n++){let e=i[n]||0,t=r[n]||0;if(e<t)return!0;if(e>t)return!1}return!1}(nD,"14.3")&&aD(nD,"14.0",!0)&&this.on("7",()=>{let e=this.profile.width>this.profile.height;this.profile.width*this.profile.height>307200?(this.profile.width=e?640:480,this.profile.height=e?480:640,this.log.warn("reduce the resolution to 480p on iOS 14.0 ~ 14.2")):this.profile.width*this.profile.height>230400&&(this.profile.width=e?640:360,this.profile.height=e?360:640,this.log.warn("reduce the resolution to 360p on iOS 14.0 ~ 14.2"))}),!t&&this.avoidCropping&&(KC||$k)&&!fD()&&e.width*e.height<=230400&&e.width/e.height===16/9&&(this._scaleResolutionDownBy=1280/e.width,r.width=1280,r.height=720,this.log.warn("capture 720p, scale: ".concat(this._scaleResolutionDownBy))),r}stopSmall(){var e,t;this.small&&(delete this.small,null==(e=this.manager)||e.update(),null==(t=this.room)||t.enableSmall(!1),this._smallTrack&&(this._smallTrack.stop(),delete this._smallTrack))}listenDeviceChange(){xx&&!xx.listeners("videoInputRemoved").includes(this.handleCameraRemoved)&&xx.on("videoInputRemoved",this.handleCameraRemoved,this)}async handleCameraRemoved(e){if(e.deviceId===this.deviceId){let t=1===this.recaptureMode;if(this.log.warn("RecaptureMode: ".concat(cM[this.recaptureMode],". Current camera is lost: ").concat(JSON.stringify(e))),0===this.recaptureMode){FM(this.userId,{eventId:2003,param1:7,streamType:2});let e=await Bx(),i=this.filterVirtualDevice?Lx(e)[0]:e[0];i?this.recapture(i.deviceId):t=!0}t&&xx.on("videoInputAdded",this.handleCameraAdded,this)}}async handleCameraAdded(e){1===this.recaptureMode&&e.deviceId!==this.deviceId||(xx.off("videoInputAdded",this.handleCameraAdded,this),this.log.warn("camera added: ".concat(JSON.stringify(e))),this.recapture(e.deviceId))}encodeFrame(e,t){if(!this.manager)return e;let i=t?8:this.mediaType,r=e;for(let n=this.manager.encodePipeline.length-1;n>=0;n--){let e=this.manager.encodePipeline[n];if(!e)continue;let t=e({frame:r,mediaType:i});t&&"object"==typeof t&&"frame"in t?r=t.frame:t&&(r=t)}return r}get enableEncodeFrame(){return!!this.manager&&this.manager.encodePipeline.some(e=>e)}play(e,t){return KD(this.mirror)&&!this.isScreen&&this.setMirror("view"),super.play(e,t)}close(){var e;this.muteImage&&(null==(e=this.manager)||e.deleteWatermark("mute"),this.muteImage=void 0),this._smallTrack&&(this._smallTrack.stop(),delete this._smallTrack),xx.off("videoInputAdded",this.handleCameraAdded,this),xx.off("videoInputRemoved",this.handleCameraRemoved,this),super.close()}async recapture(e){try{await super.recapture(e)}catch(XA){let i=await Bx(),r=(this.filterVirtualDevice?Lx(i):i).find(t=>t.deviceId!==e);if(!r)throw XA;await super.recapture(r.deviceId)}}setContentHint(e){this.mediaTrack&&"contentHint"in this.mediaTrack&&this.mediaTrack.contentHint!==e&&(this.log.info("setContentHint ".concat(e)),this.mediaTrack.contentHint=e),this.outMediaTrack&&this.outMediaTrack.contentHint!==e&&(this.outMediaTrack.contentHint=e)}setRotation(e){this.manager&&(this.isScreen||KD(e)||e!==this.rotation&&(this.rotation=e,this.manager.rotation=e))}setOutputMediaStreamTrack(t){var i;let r=this._outputTrack;if(!(this instanceof e&&jO(r,this.room||(null==(i=this.manager)?void 0:i.room))))return super.setOutputMediaStreamTrack(t)}};MA([GA(function(e){this.setContentHint(e.contentHint||"motion")})],pM.prototype,"capture",1);var fM=pM,mM=[-1,-1,1,-1,-1,1,1,1],gM=[0,0,1,0,0,1,1,1],_M=class e extends FN{constructor(e,t){if(super(),this.context=e,UA(this,"name"),UA(this,"sourceId",""),UA(this,"input"),UA(this,"output"),UA(this,"texture"),UA(this,"ctx2d",null),UA(this,"fbo"),UA(this,"width",0),UA(this,"height",0),UA(this,"x",0),UA(this,"y",0),UA(this,"program"),UA(this,"vertexShader"),UA(this,"fragmentShader"),UA(this,"totalFrames",0),UA(this,"dropFrames",0),UA(this,"matchInputSize",!0),UA(this,"texCoordBuffer"),UA(this,"positionBuffer"),UA(this,"lastInfo",{name:"",timestamp:0,totalFrames:0,x:0,y:0,width:0,height:0,fps:0}),UA(this,"cost",0),UA(this,"_canvas",null),UA(this,"_image"),UA(this,"log"),this.context.on("disconnect",this.close,this),this.name=t.name,this.log=t.logger,this.matchInputSize=!1!==t.matchInputSize,this.width=t.width||e.width,this.height=t.height||e.height,this._image=t.image,e instanceof DM)t.create2d&&("function"==typeof OffscreenCanvas&&16!==oD?this._canvas=new OffscreenCanvas(this.width,this.height):(this._canvas=document.createElement("canvas"),this._canvas.width=this.width,this._canvas.height=this.height),this.ctx2d=this._canvas.getContext("2d"),this._image=this._canvas);else try{let i=e.ctx;this.texCoordBuffer=this.createBuffer(gM),this.positionBuffer=this.createBuffer(mM),!1!==t.createTexture&&(this.texture=i.createTexture(),this.useTexture(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.pixelStorei(i.UNPACK_ALIGNMENT,1)),t.useFbo&&(this.fbo=i.createFramebuffer(),this.useBufferFrame(),this.useTexture(),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.width,this.height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,this.texture,0)),t.useDefaultProgram?this.program=e.defaultProgam:(t.vertexShaderSource||t.fragmentShaderSource)&&(this.vertexShader=t.vertexShaderSource?e.createShader(i.VERTEX_SHADER,t.vertexShaderSource):e.defaultVShader,this.fragmentShader=t.fragmentShaderSource?e.createShader(i.FRAGMENT_SHADER,t.fragmentShaderSource):e.defaultFShader,this.program=e.createProgram(this.vertexShader,this.fragmentShader))}catch(i){this.context.destroy(new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:3,message:"create video node ".concat(this.name," error ").concat(i.message||i)}))}}get image(){return this._image}set image(e){this._image=e}createFramebuffer(e){let t=this.context.ctx,i=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),i}connect(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return e.addInput(this,...i),this.output=e,e}addInput(e){this.input=e,this.matchInputSize&&e.width&&e.height&&this.resize(e.width,e.height)}requestFrame(e){let t=Date.now();return!!(this.context instanceof CM&&this.render(e)||this.context instanceof DM&&this.render2d(e))&&(this.totalFrames++,this.cost=Date.now()-t,!0)}render2d(e){var t;return!(null==(t=this.input)||!t.requestFrame(e))&&this.draw2d(this.input.image,0,0,this.width,this.height)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t;null==(t=this.output)||t.update(e)}disconnect(){for(var e,t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];null==(e=this.output)||e.removeInput(this,...i),delete this.output}removeInput(e){delete this.input}close(){var e,t;if(this.context.off("disconnect",this.close,this),null==(e=this.output)||e.removeInput(this),delete this.output,null==(t=this.input)||t.disconnect(),this.context instanceof CM){let e=this.context.ctx;e.deleteBuffer(this.texCoordBuffer),e.deleteBuffer(this.positionBuffer),this.fbo&&e.deleteFramebuffer(this.fbo),this.texture&&e.deleteTexture(this.texture),this.vertexShader&&this.vertexShader!==this.context.defaultVShader&&e.deleteShader(this.vertexShader),this.fragmentShader&&this.fragmentShader!==this.context.defaultFShader&&e.deleteShader(this.fragmentShader),this.program&&this.program!==this.context.defaultProgam&&e.deleteProgram(this.program)}this._canvas&&(this._canvas.width=0,this._canvas.height=0,this.ctx2d=null),this.removeAllListeners()}useTexture(){this.useTextures(this.texture)}useInputTexture(){var e;this.useTextures(null==(e=this.input)?void 0:e.texture)}useTextures(){let e=this.context.ctx;for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];i.forEach((t,i)=>{t&&(e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,t))})}useProgram(){this.context.ctx.useProgram(this.program)}useBufferFrame(){let e=this.context.ctx;e.bindFramebuffer(e.FRAMEBUFFER,this.fbo||null)}createBuffer(e){let t=this.context.ctx,i=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,i),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),i}setTexBuffer(e){let t=this.context.ctx;t.bindBuffer(t.ARRAY_BUFFER,this.texCoordBuffer),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW)}setPosBuffer(e){let t=this.context.ctx;t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW)}changeBufferData(e,t){let i=this.context.ctx;i.bindBuffer(i.ARRAY_BUFFER,e),i.bufferData(i.ARRAY_BUFFER,new Float32Array(t),i.STATIC_DRAW)}setAttributes(){let e=this.context.ctx;for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];i.forEach((t,i)=>{e.enableVertexAttribArray(i),e.bindBuffer(e.ARRAY_BUFFER,t),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0)})}getVertexPoint(e,t){return[e/this.width*2-1,t/this.height*2-1]}layout2texCoords(e){return[...this.getVertexPoint(e.x,e.y),...this.getVertexPoint(e.x+e.width,e.y),...this.getVertexPoint(e.x,e.y+e.height),...this.getVertexPoint(e.x+e.width,e.y+e.height)]}resize(e,t){if(this.width!==e||this.height!==t){if(this.width=e,this.height=t,this._canvas&&(this._canvas.width=e,this._canvas.height=t),this.texture&&this.fbo){this.useTexture();let i=this.context.ctx;i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,null)}this.output&&this.output.matchInputSize&&this.output.resize(e,t)}}draw(e,t){this.setAttributes(e||this.positionBuffer,t||this.texCoordBuffer);let i=this.context.ctx;i.drawArrays(i.TRIANGLE_STRIP,0,4)}draw2d(t,i,r,n,a,o,s,c,l){let d=!(KD(o)||KD(s)||KD(c)||KD(l));return!(!this.ctx2d||!t)&&(t instanceof ImageData?(d?this.ctx2d.putImageData(t,i,r,o,s,c,l):this.ctx2d.putImageData(t,i,r),this.emit(e.RENDER,this.ctx2d.canvas)):(d?this.ctx2d.drawImage(t,o,s,c,l,i,r,n,a):this.ctx2d.drawImage(t,i,r,n,a),this.emit(e.RENDER,t)),"undefined"!=typeof VideoFrame&&t instanceof VideoFrame&&t.close(),!0)}drawBackGround2d(e){this.ctx2d&&(this.ctx2d.save(),this.ctx2d.fillStyle=e,this.ctx2d.fillRect(0,0,this.width,this.height),this.ctx2d.restore())}getInfo(){var e;let{totalFrames:t,x:i,y:r,width:n,height:a,name:o,cost:s,dropFrames:c}=this,l=Date.now(),d=(t-this.lastInfo.totalFrames)/((l-this.lastInfo.timestamp)/1e3)|0;return this.lastInfo={totalFrames:t,x:i,y:r,width:n,height:a,timestamp:l,fps:d,name:o,cost:s,dropFrames:c},DA({parent:null==(e=this.input)?void 0:e.getInfo()},this.lastInfo)}createTexture(e){let t=this.context.ctx,i=t.createTexture();return this.useTextures(i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),i}};UA(_M,"RENDER","render"),MA([xN(FN.INIT,"connected",{sync:!0})],_M.prototype,"connect",1),MA([xN("connected",FN.INIT,{ignoreError:!0,sync:!0})],_M.prototype,"disconnect",1),MA([xN([],"closed",{sync:!0})],_M.prototype,"close",1);var vM=_M,yM=XP(function(e){return ZP(t=>{let i=0,r=setInterval(()=>t.next(i++),e);return t.defer(()=>{clearInterval(r)}),"interval"},"interval",arguments)}(250),ux(()=>performance.now()),ix()),EM=[0,1,1,1,0,0,1,0],bM=class extends vM{constructor(e,t){super(e,Object.assign({useDefaultProgram:!0,createTexture:!1,name:"destination"},t)),UA(this,"_intervalId",0),UA(this,"_sequence",0),UA(this,"checkGLError",!1),UA(this,"_useTimerOnShowSubject",nx()),UA(this,"_closedOb",ox(this,"closed")),UA(this,"checkVisibilityChange"),UA(this,"_paused",!1),UA(this,"_pendingFps",null),UA(this,"_lastFps",0),e instanceof DM?this.ctx2d=e.ctx||null:e.available&&null!=t&&t.mirrorUpAndDown&&this.setTexBuffer(EM),XP(this._useTimerOnShowSubject,_x(ox(document,"visibilitychange")),lx(this._closedOb),vx(()=>{document.hidden&&(this.start(this.context.frameRate),this.log.info("".concat(this.name," use timer")))}))}get isPaused(){return this._paused}pause(){this.isPaused||(this._paused=!0,this.log.info("".concat(this.name," pause (frameRate=").concat(this._lastFps||this.context.frameRate,")")),this._intervalId&&(WN.clearTask(this._intervalId),this._intervalId=0))}resume(){var e,t;if(!this.isPaused)return;this._paused=!1;let i=null!=(t=null!=(e=this._pendingFps)?e:this._lastFps)?t:this.context.frameRate;this._pendingFps=null,this.log.info("".concat(this.name," resume (frameRate=").concat(i,")")),this._startMainThreadDriven(i)}start(e){this._startMainThreadDriven(e)}_startMainThreadDriven(e){this.isPaused?this._pendingFps=e:0!==this._intervalId&&this._lastFps===e||(this._lastFps=e,this.log.info("".concat(this.name," start render ").concat(e," fps")),WN.clearTask(this._intervalId),this._intervalId=WN.run("intervalInWorker",()=>{if(e!==this.context.frameRate&&(WN.clearTask(this._intervalId),this.start(this.context.frameRate)),this.requestFrame(this._sequence++),this.checkGLError&&this.context instanceof CM){let e=this.context.ctx.getError();e&&this.context.destroy(new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:5,message:"".concat(this.name," req ").concat(this._sequence," render ").concat(this.totalFrames," faild ").concat(e)}))}},{fps:this.context.frameRate}))}render(e){var t;return!(null==(t=this.input)||!t.requestFrame(e))&&(this.useProgram(),this.useBufferFrame(),this.useInputTexture(),this.draw(),this.emit(vM.RENDER,this.context._canvas),!0)}addInput(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];super.addInput(e,...i),this.start(this.context.frameRate)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;"closed"!==this.state&&(this.isPaused||(this._intervalId&&(WN.clearTask(this._intervalId),this._intervalId=0,1===e&&(this.log.info("".concat(this.name," use requestVideoFrameCallback")),this._useTimerOnShowSubject.next())),this.requestFrame(this._sequence++)))}removeInput(e){super.removeInput(e),WN.clearTask(this._intervalId),this._intervalId=0,this._lastFps=0}resize(e,t){super.resize(e,t),this.context.setSize(e,t)}close(){super.close(),WN.clearTask(this._intervalId),document.removeEventListener("visibilitychange",this.checkVisibilityChange)}},wM=class extends bM{constructor(e,t){super(e,t),UA(this,"_videoTrack"),UA(this,"_muteOb"),UA(this,"_subscription"),UA(this,"_canvasContainer"),Number(iD)<17&&(this._canvasContainer=document.createElement("div"),this._canvasContainer.style.display="none"),[this._videoTrack]=e.canvas.captureStream().getVideoTracks(),this.log.info("VideoTrackDestination using captureStream track, id=".concat(this._videoTrack.id,", readyState=").concat(this._videoTrack.readyState)),this._muteOb=ox(this._videoTrack,"mute"),XP(ox(this._videoTrack,"ended"),lx(this._closedOb),vx(()=>{this.context.destroy(new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:8,message:"video track ended"}))}))}enableCheckMute(){this._subscription=XP(this._muteOb,lx(this._closedOb),_x((e=>t=>{let i=performance.now();XP(yM,dx(t=>t-i<e),cx(1))(t)})(5e3)),sx(()=>{var e;return!(null==(e=this._videoTrack)||!e.muted||document.hidden)}),vx(()=>{this.context.destroy(new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:7,message:"video track muted"}))}))}disableCheckMute(){var e;null==(e=this._subscription)||e.dispose()}get videoTrack(){return this._videoTrack}putCanvasIntoDom(){!this.context._canvas||!this._canvasContainer||document.getElementById(this.context._canvas.id)||(this.log.info("".concat(this.name," put canvas to body")),document.body.appendChild(this._canvasContainer),this._canvasContainer.appendChild(this.context._canvas))}render(e){return this.putCanvasIntoDom(),super.render(e)}render2d(e){return this.putCanvasIntoDom(),super.render2d(e)}close(){var e,t;super.close(),null==(e=this._videoTrack)||e.stop(),delete this._videoTrack,null==(t=this._canvasContainer)||t.remove()}},IM=class extends vM{constructor(e,t){super(e,DA({name:"imageSource"},t)),UA(this,"_lastImage"),UA(this,"_totalFrames",0),UA(this,"_autoResize",!1),UA(this,"_canvasRendered"),UA(this,"videoCallbackId",0),UA(this,"waitingFirstFrame",!0),UA(this,"shouldUpdate",!0),this._autoResize=!1!==(null==t?void 0:t.autoResize),16===oD&&(this._canvasRendered=nx(),XP(this._canvasRendered,function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return e=>ZP(function(i){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;for(;r<n&&!i.disposed;)i.next(t[r++]);i.disposed||i.subscribe(e)},"startWith",arguments)}(this._image),gx(e=>e instanceof HTMLCanvasElement?ox(e,"rendered"):function(){return ZP(e=>e.complete(),"empty",arguments)}()),lx(ox(this,"closed")),vx(()=>{this.update()})))}onFirstFrame(){this.waitingFirstFrame=!1}tryVideoFrameCallback(){if(!this.shouldUpdate)return;let e=this.image;this.videoCallbackId&&e.cancelVideoFrameCallback(this.videoCallbackId),bN()&&!document.hidden&&(this.videoCallbackId=e.requestVideoFrameCallback((e,t)=>{this.waitingFirstFrame&&this.onFirstFrame(),document.hidden||(this._totalFrames=t.presentedFrames,this.update(1))}))}_render(e,t){var i;let{width:r,height:n}=this,{image:a}=this;if(a instanceof HTMLVideoElement){if(this.tryVideoFrameCallback(),({videoWidth:r,videoHeight:n}=a),!r||!n)return!1;a.width=r,a.height=n}else if(a instanceof HTMLImageElement||a instanceof ImageData||a instanceof ImageBitmap){if(({width:r,height:n}=a),a!==this._lastImage)this._lastImage=a;else if(r===this.width&&n===this.height)return!0}else a instanceof HTMLCanvasElement||a instanceof OffscreenCanvas?(({width:r,height:n}=a),this._lastImage=a):"undefined"!=typeof VideoFrame&&a instanceof VideoFrame&&(({displayWidth:r,displayHeight:n}=a),null==(i=this._lastImage)||i.close(),this._lastImage=a);if(!this._autoResize)return!0;if(this.width===r&&this.height===n&&this.totalFrames){if(t){this.useTexture();let e=this.context.ctx;e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,a)}}else{if(t){this.useTexture();let e=this.context.ctx;e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a)}this.resize(r,n)}return!0}get image(){return this._image}set image(e){var t;null==(t=this._canvasRendered)||t.next(e),this._image=e}render(e){return this._render(e,!0)}render2d(e){return this._render(e,!1)}},TM=class extends IM{constructor(e,t,i){super(e,i),this._player=t,this.name="videoPlayerSource",XP(ox(this._player,GN.PLAYER_STATE_CHANGED),lx(ox(this,"closed")),sx(e=>{let{state:t}=e;return"PLAYING"===t}),vx(()=>{this.tryVideoFrameCallback()}))}get image(){return this._player.element}},SM=class extends TM{get available(){return this._player.isPlaying&&!this.waitingFirstFrame}get currentTrack(){return this._player.track}constructor(e,t,i){super(e,new AP({id:i.name,track:t,muted:!0,container:null,objectFit:"contain",log:i.logger}),i),this.name="videoTrackSource",this._player.play()}replaceTrack(e){this.waitingFirstFrame=!0,this._player.setTrack(e),this._player.play()}close(){super.close(),this._player.stop()}},AM=class extends vM{constructor(e,t,i){super(e,OA(DA({name:"textSource"},i),{create2d:!0})),UA(this,"hasChange",!0),UA(this,"content",""),this.ctx2d.textBaseline="top",this.content=t.content||"",t.font&&(this.font=t.font),t.color&&(this.color=t.color)}set font(e){this.ctx2d&&(this.ctx2d.font=e,this.hasChange=!0)}get font(){var e;return(null==(e=this.ctx2d)?void 0:e.font)||""}set color(e){this.ctx2d&&(this.ctx2d.fillStyle=e,this.hasChange=!0)}get color(){var e;return(null==(e=this.ctx2d)?void 0:e.fillStyle)||""}render2d(e){return!(!this.ctx2d||!this.hasChange)&&(this.ctx2d.clearRect(0,0,this.width,this.height),this.drawMultilineText(0,0),this.hasChange=!1,!0)}render(e){return!1}resize(e,t){if(!this.ctx2d)return;let{color:i,font:r}=this;super.resize(e,t),this.color=i,this.font=r}drawMultilineText(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1.2;if(!this.ctx2d)return;let r=this.ctx2d.measureText(this.content);t+=r.fontBoundingBoxAscent||r.actualBoundingBoxAscent||0;let n=this.font.match(/(\d+)px/),a=(n?parseInt(n[1],10):16)*i,o=this.content.split("\n");for(let s=0;s<o.length;s++)this.ctx2d.fillText(o[s],e,t+s*a)}},RM=class extends FN{constructor(e){super(),UA(this,"frameRate"),UA(this,"_canvas"),UA(this,"log"),UA(this,"hasAlpha",!1),UA(this,"name"),UA(this,"error"),this.name=e.name,this.log=e.logger.createChild({id:"vc-".concat(this.name)}),this.frameRate=e.frameRate}get canvas(){return this._canvas}set width(e){this._canvas&&(this._canvas.width=e)}get width(){var e;return(null==(e=this._canvas)?void 0:e.width)||0}set height(e){this._canvas&&(this._canvas.height=e)}get height(){var e;return(null==(e=this._canvas)?void 0:e.height)||0}setSize(e,t){this._canvas&&(this._canvas.width=e,this._canvas.height=t)}createVideoTrackSource(e,t){return new SM(this,e,{logger:this.log,name:t})}createVideoTrackDestination(e){return new wM(this,e)}createVideoImageSource(e,t){return new IM(this,t?Object.assign(t,{logger:this.log,image:e}):{logger:this.log,image:e})}createVideoPlayerSource(e,t){return new TM(this,e,t?Object.assign(t,{logger:this.log}):{logger:this.log})}createTextSource(e,t){return new AM(this,e,t?Object.assign(t,{logger:this.log}):{logger:this.log})}get available(){return"created"===this.state}disconnect(){this.emit("disconnect")}};UA(RM,"_ids",0);var kM=class extends RM{constructor(){super(...arguments),UA(this,"defaultProgam"),UA(this,"defaultVShader"),UA(this,"defaultFShader"),UA(this,"ctx"),UA(this,"_canvas2d")}get canvas(){return this._canvas2d||this._canvas}create(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._canvas||(this._canvas=document.createElement("canvas"),this._canvas.id="trtc_".concat(this.name,"_").concat(RM._ids++)),e&&(this._canvas2d=document.createElement("canvas")),this.ctx=this._canvas.getContext("webgl2",FR),!this.ctx)throw new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:2,message:"webgl2 not supported"});this.defaultVShader=this.createShader(this.ctx.VERTEX_SHADER,"\n// 顶点着色器\nattribute vec4 a_position;\nattribute vec2 a_texCoord;\nvarying vec2 v_texCoord;\n\nvoid main() {\n gl_Position = a_position;\n v_texCoord = a_texCoord;\n}\n"),this.defaultFShader=this.createShader(this.ctx.FRAGMENT_SHADER,"\n// 片元着色器\nprecision mediump float;\nvarying vec2 v_texCoord;\nuniform sampler2D u_texture;\n\nvoid main() {\n gl_FragColor = texture2D(u_texture, v_texCoord);\n} "),this.defaultProgam=this.createProgram(this.defaultVShader,this.defaultFShader),this._canvas.addEventListener("webglcontextlost",()=>{this.destroy(new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:4,message:"webgl context lost"}))})}destroy(e){let t="";return e&&(t=e.message,this.error=e,yL.addFailedEvent({key:512702,error:e})),this.disconnect(),this.log.info("video context destroy".concat(t)?": ".concat(t):""),this.ctx&&(this.ctx.deleteShader(this.defaultVShader),this.ctx.deleteShader(this.defaultFShader),this.ctx.deleteProgram(this.defaultProgam),delete this.ctx),e}set width(e){var t;null==(t=this.ctx)||t.viewport(0,0,e,this.height),super.width=e,this._canvas2d&&(this._canvas2d.width=e)}set height(e){var t;null==(t=this.ctx)||t.viewport(0,0,this.width,e),super.height=e,this._canvas2d&&(this._canvas2d.height=e)}setSize(e,t){var i;null==(i=this.ctx)||i.viewport(0,0,e,t),super.setSize(e,t),this._canvas2d&&(this._canvas2d.width=e,this._canvas2d.height=t)}createShader(e,t){let i=this.ctx,r=i.createShader(e);return i.shaderSource(r,t),i.compileShader(r),r}createProgram(e,t){let i=this.ctx,r=i.createProgram();return i.attachShader(r,e),i.attachShader(r,t),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS)||this.log.error(i.getProgramInfoLog(r)),r}};UA(kM,"UNAVAILABLE","unavailable"),MA([xN(FN.INIT,"created",{sync:!0,fail(e){this.log.error("video gl context create failed",e.cause),yL.addFailedEvent({key:512700,error:e.cause||e})},success(){this.log.info("video context created use webgl"),yL.addSuccessEvent({key:512700})}})],kM.prototype,"create",1),MA([xN("created",FN.INIT,{ignoreError:!0,sync:!0,success(e){e&&this.emit(kM.UNAVAILABLE,e),this.removeAllListeners()}})],kM.prototype,"destroy",1);var CM=kM,DM=class extends RM{constructor(){super(...arguments),UA(this,"ctx"),UA(this,"_contextLostHandler",null),UA(this,"_contextRestoredHandler",null)}create(e){this.hasAlpha=e.alpha,this._canvas=document.createElement("canvas"),this._canvas.id="trtc_".concat(this.name,"_").concat(RM._ids++),this._initMainThreadMode(e)}_initMainThreadMode(e){if(this.ctx=this._canvas.getContext("2d",{alpha:e.alpha,willReadFrequently:e.willReadFrequently}),!this.ctx)throw new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:2,message:"2d context not supported"});this._contextLostHandler=()=>{this.log.error("2d context lost, pausing rendering")},this._contextRestoredHandler=()=>{var e;this.log.warn("2d context restored, attempting recovery");let t=null==(e=this._canvas)?void 0:e.getContext("2d",{alpha:this.hasAlpha,willReadFrequently:!1});t?(this.ctx=t,this.log.info("2d context successfully recovered")):(this.log.error("2d context recovery failed, destroying"),this.destroy(new _k({code:mk.VIDEO_MANAGER_ERROR,extraCode:9,message:"2d context lost and recovery failed"})))},this._canvas.addEventListener("contextlost",this._contextLostHandler),this._canvas.addEventListener("contextrestored",this._contextRestoredHandler)}destroy(e){let t="";e&&(t=e.message,this.error=e,yL.addFailedEvent({key:512703,error:e})),this.disconnect(),this.log.info("video context destroy ".concat(t?": ".concat(t):"")),this._canvas&&this._contextLostHandler&&this._canvas.removeEventListener("contextlost",this._contextLostHandler),this._canvas&&this._contextRestoredHandler&&this._canvas.removeEventListener("contextrestored",this._contextRestoredHandler),this._contextLostHandler=null,this._contextRestoredHandler=null,delete this.ctx,this._canvas&&(this._canvas.remove(),this._canvas.width=0,this._canvas.height=0,delete this._canvas),this.removeAllListeners(),yL.addSuccessEvent({key:512703})}};MA([xN(FN.INIT,"created",{sync:!0,fail(e){this.log.error("video 2d context create failed",e.cause),yL.addFailedEvent({key:512701,error:e.cause||e})},success(){this.log.info("video context created use 2d"),yL.addSuccessEvent({key:512701})}})],DM.prototype,"create",1),MA([xN("created",FN.INIT,{ignoreError:!0,sync:!0})],DM.prototype,"destroy",1);var OM=sL();if("undefined"!=typeof navigator&&navigator.mediaDevices&&"setCaptureHandleConfig"in navigator.mediaDevices)try{navigator.mediaDevices.setCaptureHandleConfig({handle:OM,exposeOrigin:!0,permittedOrigins:["*"]})}catch(_A){}var LM=async function(e){let t=null,i=function(e){let t={preferCurrentTab:"current-tab"===e.preferDisplaySurface||!!e.captureElement,systemAudio:"include",selfBrowserSurface:e.selfBrowserSurface||"include",surfaceSwitching:"include"},i={frameRate:e.frameRate,displaySurface:e.preferDisplaySurface||"monitor"};if(e.captureElement||(e.applyResolutionConstraints?(i.width=eD?{max:e.width}:{ideal:e.width,max:e.width},i.height=eD?{max:e.height}:{ideal:e.height,max:e.height}):KL()&&(i.width=eD?{max:lR}:{ideal:lR,max:lR},i.height=eD?{max:dR}:{ideal:dR,max:dR})),t.video=i,e.systemAudio){let{echoCancellation:i=!0,noiseSuppression:r=!1,autoGainControl:n=!1}=e;t.audio={echoCancellation:i,noiseSuppression:r,autoGainControl:n,sampleRate:48e3}}return t}(e);oL.info("getDisplayMedia with constraints: ".concat(JSON.stringify(i)));let r=await navigator.mediaDevices.getDisplayMedia(i);e.systemAudio&&0===r.getAudioTracks().length&&(YC&&ZC<74||eD||$k)&&oL.warn("Your browser not support capture system audio");let n=r.getVideoTracks()[0];if(n){if(e.frameRate)try{let t={frameRate:{min:e.frameRate,ideal:e.frameRate}};e.captureElement||(e.applyResolutionConstraints?(t.width=e.width,t.height=e.height):KL()&&(t.width=lR,t.height=dR),await n.applyConstraints(t))}catch(a){oL.warn("screen applyConstraints failed: ".concat(a))}e.captureElement&&(await async function(e,t){var i;if("CropTarget"in window&&"fromElement"in CropTarget&&qD(e.cropTo))try{if((null==(i=e.getCaptureHandle())?void 0:i.handle)!==OM)return;let r=await CropTarget.fromElement(t);await e.cropTo(r)}catch(r){oL.warn("cropTo target failed ".concat(r))}}(n,e.captureElement),await n.applyConstraints({frameRate:{min:e.frameRate,ideal:e.frameRate},width:e.width,height:e.height}))}if(e.audio){let i=function(e){let t={echoCancellation:e.echoCancellation,autoGainControl:e.autoGainControl,noiseSuppression:e.noiseSuppression,sampleRate:e.sampleRate,channelCount:e.channelCount};return KD(e.microphoneId)||(t.deviceId=e.microphoneId),{audio:t,video:!1}}(e);oL.info("getUserMedia with constraints: ".concat(JSON.stringify(i))),t=await navigator.mediaDevices.getUserMedia(i),r.addTrack(t.getAudioTracks()[0])}return r};MA([GA(function(e){this.setContentHint(e.contentHint||"detail")})],class extends fM{constructor(e){super(e,2),UA(this,"profile",{width:1920,height:1080,frameRate:5,bitrate:1600}),UA(this,"objectFit","contain"),UA(this,"isScreen",!0),this._log.id="s-".concat(this._log.id)}get isShareCurrentTab(){var e,t;try{return OM===(null==(t=null==(e=this.mediaTrack)?void 0:e.getCaptureHandle())?void 0:t.handle)}catch(i){return}}async capture(e){let{systemAudio:t=!1,autoGainControl:i,echoCancellation:r,noiseSuppression:n,audioTrack:a,videoTrack:o,captureElement:s,preferDisplaySurface:c,selfBrowserSurface:l,applyResolutionConstraints:d=!0}=e;var u;try{let e,h=sO();return o||a?(e=new MediaStream,o&&e.addTrack(o),a&&e.addTrack(a)):(e=await LM({audio:!1,systemAudio:t,width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate,autoGainControl:i,echoCancellation:r,noiseSuppression:n,captureElement:s,preferDisplaySurface:c,selfBrowserSurface:l,applyResolutionConstraints:d}),this.sourceTrack=e.getVideoTracks()[0]),await this.setInputMediaStreamTrack(e.getVideoTracks()[0]),iL.emit(rL.LOCAL_TRACK_CAPTURE_SUCCESS,{track:this,cost:sO()-h,profile:this.profile,room:null==(u=this.manager)?void 0:u.room}),e}catch(h){throw this.log.error("getDisplayMedia error observed ".concat(h)),h instanceof _k?h:new _k({code:mk.INITIALIZE_FAILED,name:h.name,message:h.message})}}async switchDevice(e){throw new Error("Method not implemented.")}async applyProfile(){var e;if(!this.mediaTrack)return;this.log.info("applyProfile",this.profile);let t=this.settings;return(t.height!==this.profile.height||t.width!==this.profile.width||t.frameRate!==this.profile.frameRate)&&await(null==(e=this.sourceTrack||this.mediaTrack)?void 0:e.applyConstraints({width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate})),this.isNeedToSetBandwidth&&this.room&&this.room.setBandWidth?(this.isNeedToSetBandwidth=!1,this.room.setBandWidth({bandwidth:this.profile.bitrate,type:pR,videoType:gR})):void 0}}.prototype,"capture",1);var NM=class e extends Yx{constructor(t,i,r){super({userId:i.userId,sdkAppId:t.sdkAppId,mediaType:r,room:t}),this.room=t,this.user=i,UA(this,"tinyId"),UA(this,"isRemote",!0),UA(this,"jitterBufferDelay",0),UA(this,"availableState"),UA(this,"remotePublishState"),UA(this,"_triggerCheckDecodeSubject",nx(ox(this,e.STATE_SUBSCRIBE))),UA(this,"ignoreUpdatePlayingState"),UA(this,"_isFirstUnmute",!0),this.tinyId=i.tinyId,this.availableState=new FN("".concat(i.userId,"-").concat(this.mediaType,"-available"),"remote-track-available"),this.remotePublishState=new FN("".concat(i.userId,"-").concat(this.mediaType,"-remote-publish"),"remote-track-publish"),XP(rx(ox(this,FN.STATECHANGED),ox(this.remotePublishState,FN.STATECHANGED)),ux(()=>this.isRemotePublished&&(this.isSubscribed||this.isSubscribing)),vx(e=>{this.availableState.state!==(e?FN.ON:FN.OFF)&&(this.availableState.state=e?FN.ON:FN.OFF),(!this.isRemotePublished||!this.ignoreUpdatePlayingState)&&this.updatePlayingState(e)}));let n=XP(ox(this.player,GN.ERROR),sx(e=>e.code===MediaError.MEDIA_ERR_DECODE)),a=XP(function(e,t){return ZP(i=>{let r=0,n=setTimeout(()=>{if(i.removeDefer(a),i.next(r++),t){let e=setInterval(()=>i.next(r++),t);i.defer(()=>{clearInterval(e)})}else i.complete()},e),a=()=>clearTimeout(n);i.defer(a)},"timer",arguments)}(5e3),sx(()=>!!(!this.ignoreDecodeError&&this.isSubscribed&&this.isPlayCalled&&this.stat.bytesReceived&&this.isRemotePublished)&&(!this.player.isPlaying&&!(this.kind===hR?this.getAudioLevel()>0:this.stat.framesDecoded>0)||(this.reportDecodeResult(!0),!1)))),o=XP(function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return ZP(e=>{let i=new Map;t.forEach(t=>{let r=new KP(e);i.set(t,r),r.complete=()=>{i.delete(t),0===i.size?e.complete():r.dispose()},r.next=e=>{i.delete(t),i.forEach(e=>e.dispose()),r.resetNext(),r.resetComplete(),r.next(e)}}),t.forEach(e=>i.get(e).subscribe(e))},"race",arguments)}(n,a),lx(ox(this,FN.INIT)));XP(this._triggerCheckDecodeSubject,sx(()=>!this.ignoreDecodeError),_x(o),vx(e=>{this.reportDecodeResult(!1,e)}))}setMute(e){this.isRemotePublished&&super.setMute(e)}setInputMediaStreamTrack(e){super.setInputMediaStreamTrack(e),this.isRemotePublished&&this.isSubscribed&&this.player.setTrack(this.outMediaTrack)}checkDecodeResult(){this._triggerCheckDecodeSubject.next(!0)}waitHasMediaTrack(){return new Promise(e=>{this.mediaTrack?e():this.once("input-media-track-changed",e)})}get ignoreDecodeError(){var e,t,i,r;return null!=(r=null==(i=null==(t=null==(e=this.room)?void 0:e.networkQuality)?void 0:t.hadRecentBadDownlink)?void 0:i.call(t,2))&&r||this.player.isInAutoPlayFailedState}get isSubscribing(){return"subscribeing"===this.state.toString()}get isSubscribed(){return this.state===e.STATE_SUBSCRIBE}get isAvailable(){return this.availableState.state===FN.ON}get isNeedPlay(){return this.isAvailable&&this.isPlayCalled}subscribe(e){return e}unsubscribe(){"main"===this.streamType&&"video"===this.kind&&this.room.changeType(!1,this.user)}reportDecodeResult(e,t){var i,r;let n=this.kind===hR;if(yL[e?"addSuccessEvent":"addFailedEvent"]({key:n?504700:514702}),!n){let t=(null==(i=this.room)?void 0:i.downlinkVideoCodec.toUpperCase())||"H264";yL[e?"addSuccessEvent":"addFailedEvent"]({key:_L["DECODE_".concat(t,"_RESULT")]}),e||this.log.warn("".concat(null==(r=this.room)?void 0:r.downlinkVideoCodec," decode failed"))}e||(yL.addEnum({key:n?504701:514703,value:ED()}),ZN.uploadEvent({log:"stat-decode-failed-".concat(this.kind,"-").concat(_D()||bD(),"-").concat(gD()),userId:this.room.userId}),this._log.warn("decode failed: isPlaying: ".concat(this.player.isPlaying," ").concat(this.kind===hR?"audioLevel: ".concat(this.getAudioLevel()):"framesDecoded: ".concat(this.stat.framesDecoded>0))),this.emit("decode-failed",{error:t}))}updatePlayingState(e){if(this.player.isPlayCalled&&this.player.setTrack(this.playerMediaTrack),this.isPlayCalled){if(!e)return void super.updatePlayingState(!1);if(this.player.isStopped){if(!this.isSubscribed||!this.isRemotePublished||!this.outMediaTrack)return void this.log.info("abort play, isSubscribed: ".concat(this.isSubscribed," isAvailable: ").concat(this.isRemotePublished," hasTrack: ").concat(!!this.outMediaTrack," "));super.updatePlayingState(!0)}}}close(){super.close(),this.outMediaTrack&&this.uninstallTrackEvent(this.outMediaTrack)}onFlagChanged(){this.remotePublishState.state=this.isRemotePublished?FN.ON:FN.OFF,this.emit("remote-publish-changed",this.isRemotePublished)}onTrackMuted(){this.isNeedPlay&&super.onTrackMuted()}onTrackUnmuted(){this.isNeedPlay&&super.onTrackUnmuted(),this.kind===pR&&this._isFirstUnmute&&(this._isFirstUnmute=!1,iL.emit(rL.REMOTE_VIDEO_FIRST_UNMUTE,{track:this,performanceTime:performance.now(),dateTime:Date.now(),isPlayReady:this.isNeedPlay}))}onTrackEnded(){this.isNeedPlay&&super.onTrackEnded()}};UA(NM,"STATE_SUBSCRIBE","subscribe"),MA([function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return qA((i,r)=>function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return new Promise((n,o)=>{let s=setTimeout(()=>{let i=new _k({code:mk.API_CALL_TIMEOUT,message:"checkPendingPromise ".concat(r,"() timeout ").concat(e,"s")});(this.log||this._log||oL).warn(i),2===t?o(i):1===t&&n()},1e3*e);this._checkPendingPromiseSet||(this._checkPendingPromiseSet=new Set),this._checkPendingPromiseSet.add(s),i.apply(this,a).then(n,o).finally(()=>{clearTimeout(s),this._checkPendingPromiseSet&&s&&this._checkPendingPromiseSet.delete(s)})})})}(5,1)],NM.prototype,"waitHasMediaTrack",1),MA([xN(FN.INIT,NM.STATE_SUBSCRIBE,{success(){this.log.info("subscribed"),iL.emit(rL.REMOTE_TRACK_SUBSCRIBED,{track:this})},ignoreError:!0}),oM(521716,!1)],NM.prototype,"subscribe",1),MA([xN(NM.STATE_SUBSCRIBE,FN.INIT,{sync:!0,success(){this.log.info("unsubscribed"),iL.emit(rL.REMOTE_TRACK_UNSUBSCRIBED,{track:this})}})],NM.prototype,"unsubscribe",1);var PM=NM,xM=class extends vM{constructor(e,t,i,r,n){super(e,{useDefaultProgram:!0,useFbo:!0,name:"alpha",create2d:!0,logger:t}),this.setContainer=r,UA(this,"initStat",{alphaStitchingType:1}),UA(this,"end",nx()),UA(this,"minSize",320),UA(this,"maxSize",1280),UA(this,"draggable",!1),UA(this,"startDragX",0),UA(this,"startDragY",0),UA(this,"left",0),UA(this,"top",0),UA(this,"baseWidth",320),UA(this,"baseRatio"),UA(this,"container"),this.initStat=n,this.draggable=i,this.bindDragEvents(),yL.addEnum({key:515700,value:1}),this.draggable&&yL.addEnum({key:515700,value:11})}bindDragEvents(){let e=this.context._canvas;if(e)if(this.draggable){let t=lx(this.end);XP(ox(e,"mousedown"),yx(this.startDrag.bind(this)),gx(()=>XP(ox(window,"mousemove"),lx(ox(window,"mouseup")))),t,vx(this.doDrag.bind(this))),XP(ox(e,"dblclick"),t,vx(this.resetPosition.bind(this))),XP(ox(e,"wheel"),t,vx(this.handleZoom.bind(this))),this.renderCanvas()}else{if(!this.container)return;this.container.style.removeProperty("left"),this.container.style.removeProperty("top"),this.end.next()}}render(e){var t;return!(null==(t=this.input)||!t.requestFrame(e))&&(this.useProgram(),this.useBufferFrame(),this.useInputTexture(),this.draw(),!0)}startDrag(e){e.preventDefault(),0===e.button&&(this.startDragX=e.clientX-this.left,this.startDragY=e.clientY-this.top)}renderCanvas(){let{container:e}=this;e||this.setContainer(),e&&this.baseRatio&&this.draggable&&(e.style.setProperty("width","".concat(this.baseWidth,"px")),e.style.setProperty("height","".concat(this.baseWidth/this.baseRatio,"px")),e.style.setProperty("position","fixed"),e.style.setProperty("left","".concat(this.left,"px")),e.style.setProperty("top","".concat(this.top,"px")))}doDrag(e){e.preventDefault(),this.left=e.clientX-this.startDragX,this.top=e.clientY-this.startDragY,this.renderCanvas()}handleZoom(e){e.preventDefault();let t=e.deltaY,i=this.context._canvas;i&&(this.baseWidth||(this.baseWidth=i.offsetWidth),this.baseWidth=t<0?Math.min(1.1*this.baseWidth,this.maxSize):Math.max(.9*this.baseWidth,this.minSize),this.renderCanvas())}resetPosition(){this.left=0,this.top=0,this.renderCanvas()}onRatioReset(){this.renderCanvas()}draw2d(e,t,i,r,n){var a;let{ctx2d:o}=this,s=this.context._canvas;if(!o||!s)return!1;let c=super.draw2d(e,t,i,r,n),l=o.getImageData(0,0,r,n),{data:d}=l,u=!1;if(1===this.initStat.alphaStitchingType){let e=Math.floor(r/2);for(let t=0;t<n;t++)for(let i=0;i<e;i++){let n=4*(t*r+i),a=4*(t*r+(i+e)),o=d[a];d[a+3]=0;let s=o>=100;d[n+3]=s?255:0}u=super.draw2d(l,0,0,0,0,e,n),s.width=e}else if(2===this.initStat.alphaStitchingType){let e=Math.floor(n/2);for(let t=0;t<e;t++)for(let i=0;i<r;i++){let n=4*(t*r+i),a=4*((t+e)*r+i),o=d[a];d[a+3]=0;let s=o>=100;d[n+3]=s?255:0}u=super.draw2d(l,0,0,0,0,r,e),s.height=e}return null==(a=this.context.ctx)||a.clearRect(0,0,r,n),c&&u}close(){this.baseRatio=void 0,this.end.next(),this.end.complete()}};var MM=class extends PM{constructor(e,t){super(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:4),UA(this,"mediaType",4),UA(this,"source"),UA(this,"shouldRenderAlpha",!1),UA(this,"alphaNode"),UA(this,"shouldBeDraggable",!0),UA(this,"stat",{bytesReceived:0,packetsReceived:0,packetsLost:0,framesReceived:0,framesDecoded:0,frameWidth:0,frameHeight:0,end2EndDelay:0,jitterBufferDelay:0,keyFramesDecoded:0}),UA(this,"_keyFrameCountLogged",!1),UA(this,"_keyFrameStartTimestamp",0),UA(this,"_keyFrameStartCount",0),UA(this,"_keyFrameIntervals",[]),UA(this,"_prevKeyFrameTimestamp",0),UA(this,"decodeFrameFromWorker"),UA(this,"decodeFallbackToMainThread"),UA(this,"decodeFallbackMediaStreamTrack"),UA(this,"decodeFallbackOriginalTrack"),this.manager=e.videoManager,this.on("first-video-frame",e=>{this.room.emit("first-video-frame",e)})}isAlphaSei(e){if(this.userId!==e.userId||50!==e.seiPayloadType)return!1;let t=new Uint8Array(e.data);return t.length%3==0&&0===t[0]&&1===t[1]&&t}play(e,t){return null!=t&&t.canvasRender&&!this.source&&this.useCanvasPlayer(),super.play(e,t).then(()=>{this.player.calculateStat(),iL.emit("156",{track:this,player:this.player})})}updateAlphaRenderInfo(e){let t=this.isAlphaSei(e);if(t)if(this.alphaNode){let e=t[2];if(this.alphaNode.baseRatio&&this.alphaNode.initStat.alphaStitchingType===e)return;this.alphaNode.initStat={alphaStitchingType:e};let i=this.player.getElement();if(i){let t=i.videoWidth/i.videoHeight;t&&(this.alphaNode.baseRatio=t*(1===e?.5:2),this.alphaNode.onRatioReset())}this.player.canvas&&(this.player.canvas.id=this.generateAlphaCanvasName(e))}else this.shouldRenderAlpha=!0,this.player.shouldRenderAlpha=!0,this.useCanvasPlayer(t[2])}generateAlphaCanvasName(e){let t=JA[e];return"".concat("alpha","_").concat(t,"_").concat(this.userId)}useCanvasPlayer(e){if(this.log.info("useCanvasPlayer(), has element:".concat(!!this.player.element)),!this.player.element)return;let t=new DM({frameRate:15,logger:this.log,name:this.shouldRenderAlpha&&e?this.generateAlphaCanvasName(e):this.userId});t.create({alpha:this.shouldRenderAlpha,willReadFrequently:this.shouldRenderAlpha});let i=new bM(t,{name:"remotePlayer",logger:this.log});if(this.source=t.createVideoPlayerSource(this.player),this.player.setCanvas(t._canvas),this.shouldRenderAlpha&&e){let r=()=>{!this.player.container||!this.alphaNode||(this.alphaNode.container=this.player.container,this.alphaNode.renderCanvas())},n=new xM(t,this.log,this.shouldBeDraggable,r,{alphaStitchingType:e});this.source.connect(n),n.connect(i),this.alphaNode=n}else this.source.connect(i);bN()||(this.updateCanvasPlayerFPS=this.updateCanvasPlayerFPS.bind(this,t),this.room.on("heartbeat-report",this.updateCanvasPlayerFPS,this))}updateCanvasPlayerFPS(e){let t=this.decodeFPS,i=function(e){return[15,30,45,60].reduce((t,i)=>Math.abs(i-e)<Math.abs(t-e)?i:t)}(t);!XD(t)||t<=0?this.log.debug("updateCanvasPlayerFPS() ignore decoder: ".concat(t," ")):i!==e.frameRate?(this.log.info("updateCanvasPlayerFPS() decoder: ".concat(t,", closest: ").concat(i,", current: ").concat(e.frameRate)),e.frameRate=i):this.log.debug("updateCanvasPlayerFPS() ignore ClosestFPS ".concat(i," == ").concat(e.frameRate))}get decodeFPS(){var e;let{msg_video_status:t}=(null==(e=this.room.heartbeatReport)?void 0:e.msg_down_stream_info.find(e=>e.msg_user_info.str_identifier===this.userId))||{},i=2===this.mediaType?7:this.isSmall?3:2;if(!t||0===t.length)return 0;let r=t.find(e=>e.uint32_video_stream_type===i);return(null==r?void 0:r.uint32_video_dec_fps)||0}stop(){return this.room.off("heartbeat-report",this.updateCanvasPlayerFPS,this),iL.emit("157",{track:this,player:this.player}),this.alphaNode&&this.alphaNode.close(),super.stop()}decodeFrame(e){if(!this.manager)return e;for(let t of this.manager.decodePipeline){if(!t)continue;let i=t({frame:e,track:this});if(!i)return;e="frame"in i?i.frame:i}return e}get isBig(){return 4===this.mediaType}get isSmall(){return 8===this.mediaType}changeType(e){this.room.changeType(e,this.user)}get isRemotePublished(){return this.user.muteState.videoAvailable}setMirror(e){"publish"===e||"both"===e||super.setMirror(e)}setDraggable(e){this.shouldBeDraggable=e,this.alphaNode&&(this.alphaNode.draggable=e,this.alphaNode.bindDragEvents())}onDecodeDowngradeStateChanged(e){this.emit("decode-downgrade-state-changed",e)}updateKeyFramesDecoded(e){let t=this.stat.keyFramesDecoded||0;if(this.stat.keyFramesDecoded=e,this._keyFrameCountLogged)return;let i=Date.now();if(!this._keyFrameStartTimestamp)return this._keyFrameStartTimestamp=i,this._keyFrameStartCount=e,void(this._prevKeyFrameTimestamp=i);if(this._prevKeyFrameTimestamp&&e>t){let r=e-t,n=(i-this._prevKeyFrameTimestamp)/1e3/r;this._keyFrameIntervals.push(n)}this._prevKeyFrameTimestamp=i;let r=i-this._keyFrameStartTimestamp;if(r>=16e3){let t=e-this._keyFrameStartCount,i=t>0?r/1e3/t:0,n="".concat(t," keyframes in 16s ").concat(i," [").concat(this._keyFrameIntervals.map(e=>e.toFixed(1)).join(","),"] keyFramesDecoded ").concat(e),a=i<=2.5?"debug":"info";this.log[a](n),this._keyFrameCountLogged=!0}}},UM=new Map;function FM(e,t){let i=OA(DA({},t),{timestamp:vk()});UM.has(e)?UM.get(e).push(i):UM.set(e,[i])}iL.on(rL.JOIN_SUCCESS,e=>{let{room:t}=e;FM(t.userId,{eventId:32788})}),iL.on(rL.LEAVE_START,e=>{let{room:t}=e;FM(t.userId,{eventId:32789})}),iL.on(rL.LOCAL_TRACK_PUBLISHED,e=>{let{track:t}=e;if(t.room){let e=32769;4===t.mediaType?e=32768:2===t.mediaType&&(e=32805),FM(t.room.userId,{eventId:e})}}),iL.on(rL.LOCAL_TRACK_UNPUBLISHED,e=>{let{track:t}=e;if(t.room){let e=32771;4===t.mediaType?e=32770:2===t.mediaType&&(e=32806),FM(t.room.userId,{eventId:e})}}),iL.on(rL.TRACK_MUTED,e=>{let{track:t}=e;t.room&&(t.kind===hR?FM(t.room.userId,{eventId:t.isRemote?32785:32772,remoteUserId:t.isRemote?t.userId:void 0}):FM(t.room.userId,{eventId:t.isRemote?32784:32773,remoteUserId:t.isRemote?t.userId:void 0}))}),iL.on(rL.TRACK_UNMUTED,e=>{let{track:t}=e;t.room&&(t.kind===hR?FM(t.room.userId,{eventId:t.isRemote?32787:32774,remoteUserId:t.isRemote?t.userId:void 0}):FM(t.room.userId,{eventId:t.isRemote?32786:32775,remoteUserId:t.isRemote?t.userId:void 0}))}),iL.on(rL.REMOTE_TRACK_SUBSCRIBED,e=>{let{track:t}=e;t.room&&(1===t.mediaType&&FM(t.room.userId,{eventId:32777,remoteUserId:t.userId}),4===t.mediaType&&FM(t.room.userId,{eventId:32776,remoteUserId:t.userId}),8===t.mediaType&&FM(t.room.userId,{eventId:32803,remoteUserId:t.userId}))}),iL.on(rL.REMOTE_TRACK_UNSUBSCRIBED,e=>{let{track:t}=e;t.room&&(1===t.mediaType&&FM(t.room.userId,{eventId:32779,remoteUserId:t.userId}),4===t.mediaType&&FM(t.room.userId,{eventId:32778,remoteUserId:t.userId}),8===t.mediaType&&FM(t.room.userId,{eventId:32804,remoteUserId:t.userId}))}),iL.on(rL.SWITCH_DEVICE_SUCCESS,e=>{let{track:t}=e;t.room&&FM(t.room.userId,{eventId:t.kind===pR?32780:32781})}),iL.on(rL.LOCAL_TRACK_REPLACED,e=>{let{track:t}=e;t.room&&FM(t.room.userId,{eventId:t.kind===pR?32782:32783})}),iL.on(rL.SIGNAL_CONNECTION_STATE_CHANGED,e=>{let t,{room:i,prevState:r,state:n}=e;switch(n){case"CONNECTED":t="RECONNECTING"===r?32795:32791;break;case"DISCONNECTED":t="RECONNECTING"===r?32796:32790;break;case"RECONNECTING":t=32794}t&&FM(i.userId,{eventId:t})}),iL.on(rL.PEER_CONNECTION_STATE_CHANGED,e=>{let t,{room:i,prevState:r,state:n,remoteUserId:a}=e,o=!!a;switch(n){case"CONNECTED":t="RECONNECTING"===r?o?32801:32798:o?32793:32792;break;case"DISCONNECTED":"RECONNECTING"===r&&(t=o?32802:32799);break;case"RECONNECTING":t=o?32800:32797}t&&FM(i.userId,{eventId:t,remoteUserId:a})}),iL.on(rL.VIDEO_CODEC_IMPLEMENTATION_CHANGED,e=>{let{implementation:t,userId:i,remoteUserId:r,codec:n,isHWCodec:a,prevImplementation:o,streamType:s}=e,c=a?1:0;o||(c=a?3:2);let l={H264:0,H265:1,VP8:2}[n.toUpperCase()],d={eventId:4004,param1:c,param2:l,streamType:s||2};r&&(d.remoteUserId=r,d.eventId=4005),FM(i,d),yL.addEnum({key:r?514701:513701,value:c}),yL.addEnum({key:r?514700:513700,value:l})}),iL.on(rL.LOCAL_TRACK_RECAPTURE,e=>{let{track:t,error:i}=e;if(t.userId){let e={eventId:2003,param1:0};t.kind===hR?(e.streamType=1,i&&(e.param1=2)):(e.streamType="auxiliary"===t.streamType?7:2,i&&(e.param1=8)),FM(t.userId,e)}}),xA(BA(),1),xA(BA(),1);var BM="trtc_debug_dialog",VM="".concat(BM,"_activated"),HM="".concat(BM,"_switch"),jM="".concat(BM,"_mask"),zM="".concat(BM,"_panel"),WM="".concat(BM,"_tabber"),GM="".concat(BM,"_tab"),qM="".concat(BM,"_topbar"),KM="".concat(BM,"_toptab"),YM="".concat(BM,"_content"),XM="".concat(BM,"_has_topbar"),ZM="".concat(YM,"_log"),JM="".concat(YM,"_network"),QM="".concat(BM,"_dump"),$M="".concat(JM,"_title"),eU="".concat(JM,"_basic"),tU="".concat(JM,"_local"),iU="".concat(JM,"_remote"),rU="".concat(QM,"_title"),nU="".concat(QM,"_local"),aU="".concat(QM,"_remote"),oU="".concat(aU,"_hook"),sU="".concat(BM,"_banner"),cU="".concat(sU,"_item"),lU="".concat(BM,"_toolbar"),dU="".concat(BM,"_tool"),uU="".concat(BM,"_item"),hU="".concat(uU,"_debug"),pU="".concat(uU,"_info"),fU="".concat(uU,"_warn"),mU="".concat(uU,"_error"),gU="".concat(BM,"_back_top"),_U="".concat(BM,"_go_bottom"),vU="".concat(QM,"_local_audio"),yU="".concat(QM,"_local_video_main"),EU="".concat(QM,"_local_video_aux"),bU="".concat(BM,"_tooltip"),wU="".concat(eU,"_network_info"),IU="".concat(eU,"_room_info"),TU="".concat(ZM,"_controller"),SU="success",AU="warning",RU="failed",kU=0,CU=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.addStyle(),this.addDialog()}addDialog(){var e;let t=document.createElement("template");t.innerHTML='<div id="'.concat(BM,'" class="').concat(BM,'"><div class="').concat(HM,'">Debug#').concat(++kU,'</div><div class="').concat(jM,'"></div><div class="').concat(zM,'"><div class="').concat(WM,'"><a class="').concat(GM," ").concat(VM,'" data-tab="log">').concat(zR,'</a><a class="').concat(GM,'" data-tab="network">').concat(WR,'</a><a class="').concat(GM,'" data-tab="dump">').concat(GR,'</a></div><div class="').concat(TU,'"><div data-type="back_top">').concat(ek,'</div><div data-type="go_bottom">').concat($R,'</div><div data-type="clear_log">').concat(tk,'</div></div><div class="').concat(qM,'"><a class="').concat(KM," ").concat(VM,'" data-type="all">All</a><a class="').concat(KM,'" data-type="debug">Debug</a><a class="').concat(KM,'" data-type="info">Info</a><a class="').concat(KM,'" data-type="warn">Warn</a><a class="').concat(KM,'" data-type="error">Error</a></div><div class="').concat(YM," ").concat(XM,'"><div class="').concat(ZM,'"></div><div class="').concat(JM,'"><div class="').concat($M,'">').concat(ak,'</div><div class="').concat(eU,'"><div class="').concat(IU,'"></div><div class="').concat(wU,'">').concat(nk,'</div></div><div class="').concat($M,'">').concat(ik,'</div><div class="').concat(tU,'">').concat(nk,'</div><div class="').concat($M,'">').concat(rk,'</div><div class="').concat(iU,'">').concat(nk,'</div></div><div class="').concat(QM,'"><div class="').concat(rU,'">').concat(ik,'</div><div class="').concat(nU,'"><div id="').concat(vU,'"><span>').concat(ck," - ").concat(ok,'(s):</span><input type="number" min=0 value=0></input><button class="dump">').concat(qR,'</button><button class="dump-opus">').concat(KR,'</button><button class="end-dump" disabled>').concat(XR,'</button></div><div id="').concat(yU,'"><span>').concat(sk," - ").concat(ok,'(s):</span><input type="number" min=0 value=0></input><button class="dump">').concat(GR,'</button><button class="end-dump" disabled>').concat(XR,'</button></div><div id="').concat(EU,'"><span>').concat(lk," - ").concat(ok,'(s):</span><input type="number" min=0 value=0></input><button class="dump">').concat(GR,'</button><button class="end-dump" disabled>').concat(XR,'</button></div></div><div class="').concat(rU,'">').concat(rk,'</div><div class="').concat(aU,'"><div class="').concat(oU,"\">userId:<input id=\"dump-remote-video-hook-userid\" value='*' />duration:<input id=\"dump-remote-video-hook-duration\" min='1' value='0' type='number' />mediaType:<select id=\"dump-remote-video-hook-mediaType\" value='main' ><option value='main' checked>Video</option><option value='sub'>Screen</option></select><button id=\"dump-remote-video-hook-button\">dump if video is available</button></div></div></div></div><div class=\"").concat(sU,'"></div><div class="').concat(lU,'"><a id="trtc_upload" class="').concat(dU,'">').concat(ZR,'</a><a id="trtc_export" class="').concat(dU,'">').concat(JR,'</a><a id="trtc_hide" class="').concat(dU,'">').concat(QR,"</a></div></div></div>"),null==(e=this.shadowRoot)||e.appendChild(t.content.firstChild)}addStyle(){var e;let t=document.createElement("style");t.textContent="#".concat(BM,"{font-size:14px;--DD-BG-0:#ededed;--DD-BG-1:#f7f7f7;--DD-BG-2:#fff;--DD-BORDER:rgba(0,0,0,0.1);--DD-ERROR:red;--DD-WARN:#fa9d3b;--DD-INFO:#000;--DD-DEBUG:#10aeff;--DD-WARN-BG:#fff3cc;--DD-ERROR-BG:#ffe6e6;}#").concat(BM," a,.").concat(HM,"{cursor:pointer;}.").concat(BM,"{color:black;}.").concat(HM,"{display:block;position:fixed;right:50px;bottom:").concat(150+50*kU,"px;border-radius:5px;background-color:#07c160;color:#fff;padding:5px 10px;z-index:10000;}.").concat(jM,"{display:none;position:fixed;left:0;top:0;right:0;bottom:0;z-index:10001;background-color:rgb(0,0,0,0.6);}.").concat(zM,"{background-color:#ededed;display:none;position:fixed;min-height:85%;left:60%;right:0;bottom:0;z-index:10002;border:1px solid var(--DD-BG-0);}@media (max-width:768px) {.").concat(zM,"{left:0;}}.").concat(WM,"{display:flex;height:2em;border-bottom:1px solid var(--DD-BORDER);}.").concat(GM,"{padding:0 20px;border-right:1px solid rgba(0,0,0,0.1);line-height:2em;color:black;}.").concat(GM,".").concat(VM,"{background-color:var(--DD-BG-2);}.").concat(GM,".disabled{cursor:not-allowed;background-color:#ededed;color:#999;}.").concat(qM,"{height:2em;display:flex;flex-direction:row;}.").concat(KM,"{width:20%;text-align:center;line-height:2em;border-right:1px solid var(--DD-BORDER);border-bottom:1px solid var(--DD-BORDER);color:black;}.").concat(KM,".").concat(VM,"{border-bottom:1px solid #1485ee;background-color:var(--DD-BG-2);}.").concat(YM,"{background-color:#fff;position:absolute;left:0;right:0;top:2em;bottom:8em;overflow-y:scroll;overflow-x:hidden;}.").concat(YM,".").concat(XM,"{top:4em;bottom:10em}.").concat(JM,"{display:none;}.").concat(QM,"{display:none;}.").concat($M,",.").concat(rU,"{line-height:2em;text-align:center;background-color:var(--DD-BG-0);border-bottom:1px solid var(--DD-BORDER);}.").concat(eU,",.").concat(tU,",.").concat(iU,"{text-align:center;border-bottom:1px solid var(--DD-BORDER);}.").concat(nU,",.").concat(aU,"{display:flex;flex-direction:column;padding:0.5em 0;justify-content:center;align-items:center;}.").concat(nU," div input{margin:0 10px;height:1.5em;width:4em;}.").concat(nU," div {padding:10px 0;border-radius:5px;}.").concat(nU," div button,.").concat(aU," div button {cursor:pointer;height:1.8em;border-radius:5px;margin-right:5px;}.").concat(nU," div button[disabled],.").concat(aU," div button[disabled]{cursor:not-allowed;}.").concat(aU," select {height:1.8em;margin:0 10px;}.").concat(aU," div input{margin:0 10px;height:1.5em;width:4em;}.").concat(oU," {line-height:3em;padding:0.5em;}.").concat($M,"{text-align:center;background-color:var(--DD-BG-0);border-bottom:1px solid var(--DD-BORDER);}.").concat(eU,",.").concat(tU,",.").concat(iU,"{text-align:center;border-bottom:1px solid var(--DD-BORDER);}.").concat(uU,"{border-bottom:1px solid var(--DD-BG-0);padding:5px 10px;overflow-wrap: break-word;}.").concat(mU,"{color:var(--DD-ERROR);background-color:var(--DD-ERROR-BG);}.").concat(fU,"{color:var(--DD-WARN);background-color:var(--DD-WARN-BG);}div .").concat(pU,"{color:var(--DD-INFO);}.").concat(hU,"{color:var(--DD-DEBUG);}.").concat(sU,"{position:absolute;left:0;right:0;bottom:2em;height:6em;border-bottom:1px solid var(--DD-BORDER);display:flex;flex-direction:column;overflow-y:scroll;background-color:var(--DD-BG-1);}.").concat(cU,"{border-bottom:1px solid var(--DD-BORDER);padding:5px 10px;overflow-wrap: break-word;}.").concat(lU,"{position:absolute;line-height:2em;display:flex;flex-direction:row;left:0;right:0;bottom:0;}.").concat(dU,"{flex:1;color:black;text-align:center;background-color:#ededed;border-right:1px solid var(--DD-BORDER);}#").concat(BM," .").concat(gU,",#").concat(BM," .").concat(_U,"{position:absolute;height:2em;width:6em;right:2em;border-radius:5px;background-color:rgba(30,136,229,0.8);z-index:10003;cursor:pointer;padding:0 5px;line-height:2em;color:white;text-align:center;}.").concat(_U,"{bottom:9em;}.").concat(gU,"{bottom:11.5em;}#").concat(BM," .").concat(dU,".disable{cursor:not-allowed;background-color:#ededed;color:#999;}.").concat(bU," {position:relative;display:inline-block;}.").concat(bU," .tooltiptext{visibility:hidden;width:180px;background-color:black;color:#fff;text-align:center;padding:5px 0;border-radius:6px;position:absolute;}.").concat(bU," .tooltip-top {bottom:125%;left:50%;margin-left:-90px;}.").concat(bU,":hover .tooltiptext{visibility:visible;}.").concat(TU,"{position:absolute;left:0;right:0;bottom:8em;height:2em;display:flex;align-items:center;}.").concat(TU," div{flex:1;cursor:pointer;border-right:1px solid var(--DD-BORDER);text-align: center;}"),null==(e=this.shadowRoot)||e.appendChild(t)}};customElements.define("trtc-basic-debug-dialog",CU);var DU=class{constructor(e,t){UA(this,"_dialogNode",null),UA(this,"_switchNode",null),UA(this,"_maskNode",null),UA(this,"_panelNode",null),UA(this,"_logContentNode",null),UA(this,"_networkContentNode",null),UA(this,"_dumpContentNode",null),UA(this,"_tabNodes",[]),UA(this,"_toptabNodes",[]),UA(this,"_hasMove",!1),UA(this,"_showDialog",!1),UA(this,"_isMobile",!1),UA(this,"_showLogType","all"),UA(this,"prevBytesSent",0),UA(this,"prevBytesReceived",0),UA(this,"_core"),UA(this,"_log"),UA(this,"_logList",[]),UA(this,"isUploading",!1),UA(this,"publishMap",new Map),UA(this,"dumpLocalVideoMap",{}),UA(this,"dumpRemoteVideoMap",{}),UA(this,"dumpLocalAudioMap",{}),UA(this,"dumpRemoteAudioMap",{}),UA(this,"eventMap",new Map),UA(this,"switchPos",{x:0,y:0,startX:0,startY:0,endX:0,endY:0,isTouchEnd:!1}),UA(this,"handleLeaveSuccess",e=>{let{room:t}=e;var i,r;if(!this.hitTest(t))return;let n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(aU));for(let a of this.publishMap.values())null==n||n.removeChild(a);this.publishMap.clear()}),UA(this,"handleJoinSuccess",e=>{let{room:t}=e;var i,r;if(!this.hitTest(t))return;(null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(IU))).innerHTML="sdkAppId: ".concat(t.sdkAppId,"<br/>roomId: ").concat(t.roomId,"<br/>userId: ").concat(t.userId,"<br/>")}),UA(this,"handleRemoteVideoAvailable",e=>{let t="sub"===e.streamType?"auxiliary":"main";this.renderDumpTab(e.userId,"remote",t,"publish")}),UA(this,"handleRemoteVideoUnavailable",e=>{let t="sub"===e.streamType?"auxiliary":"main";this.renderDumpTab(e.userId,"remote",t,"unpublish")}),UA(this,"handleRemoteAudioAvailable",e=>{this.renderDumpTab(e.userId,"remote","audio","publish")}),UA(this,"handleRemoteAudioUnavailable",e=>{this.renderDumpTab(e.userId,"remote","audio","unpublish")}),UA(this,"renderDumpTab",(e,t,i,r)=>{var n,a,o;let s={main:"video",auxiliary:"screen",audio:"audio"},c=(e,t)=>{var i,r,n;let a=document.createElement("div");a.innerText="".concat(e," - ").concat(s[t]," - ").concat(ok,"(s):");let o=document.createElement("input");o.type="number",o.min="0",o.value="10",o.id="dump_remote_".concat(t,"_").concat(e);let c,l=document.createElement("button");l.innerText=XR,l.disabled=!0,"audio"===t&&(c=document.createElement("button"),c.innerText=KR,c.style.marginLeft="5px");let d,u,h=document.createElement("button");if(h.innerText="audio"===t?qR:GR,h.onclick=()=>{let i,r,n=Number(o.value);if("audio"===t)({download:i,onDumpEnd:r}=this.dumpAudio("remote",n,e));else{if(!this.isSupportDumpVideo())return;({download:i,onDumpEnd:r}=this.dumpVideo(t,"remote",n,e))}i&&(this.inactiveButton(h,YR),c&&this.inactiveButton(c),n>0?setTimeout(()=>{null==i||i(),this.activeButton(h,GR),c&&this.activeButton(c,KR)},1e3*n):(this.activeButton(l),l.onclick=()=>{l.onclick=null,null==i||i(),null==r||r(),this.activeButton(h,GR),c&&this.activeButton(c,KR),this.inactiveButton(l)}))},c&&(c.onclick=()=>{let t=Number(o.value),{download:i,onDumpEnd:r}=this.dumpAudioFromPipeline("remote",t,e);i&&(this.inactiveButton(c,YR),this.inactiveButton(h),t>0?setTimeout(()=>{null==i||i(),this.activeButton(c,KR),this.activeButton(h,GR)},1e3*t):(this.activeButton(l),l.onclick=()=>{l.onclick=null,null==i||i(),null==r||r(),this.activeButton(c,KR),this.activeButton(h,GR),this.inactiveButton(l)}))}),"audio"!==t&&(d=document.createElement("button"),d.innerText="Dump w/ Audio",d.style.marginLeft="5px",d.onclick=()=>{if(!this.isSupportDumpVideo())return;let i=Number(o.value),r=this.dumpVideo(t,"remote",i,e),n=this.dumpAudioFromPipeline("remote",i,e);if(!r.download&&!n.download)return;let a=async()=>{var i,a,o,s;let c=new pk.default,l=this.dumpRemoteVideoMap["".concat(e,"-").concat(t)];if(l&&l.data.length>0){let i,r="h264",n=this.getVideoCodec(e);if("vp8"===n){let n=this._core.room.remotePublishedUserMap.get(e),a="main"===t?null==n?void 0:n.remoteVideoTrack:null==n?void 0:n.remoteAuxiliaryTrack;this.addInfoToBanner(AU,"package vp8 into ivf format"),i=this.convertVP8ToIVF(l.data,a),r="ivf"}else i=new Blob(l.data),r=n||"h264";let a="remote-".concat(e,"_").concat(t,"_").concat(this.formatStartDumpTime(l.startTimestamp),".").concat(r);c.file(a,i)}let d=this.dumpRemoteAudioMap["".concat(e)];if(d&&d.data.length>0){let t,r=(null==(a=null==(i=this._core.room.userManager)?void 0:i.getPublishedUser(e))?void 0:a.audioCodec)||"opus",n=r;"opus"===r?(this.addInfoToBanner(AU,"package opus to ogg"),t=this.convertOpusToOgg(d.data),n="ogg"):t=new Blob(d.data);let o="remote-".concat(e,"_audio_").concat(this.formatStartDumpTime(d.startTimestamp),".").concat(n);c.file(o,t)}let u=await c.generateAsync({type:"blob"}),h=URL.createObjectURL(u),p=document.createElement("a");p.href=h,p.download="dump_".concat(e,"_").concat(this.formatStartDumpTime(Date.now()),".zip"),p.style.display="none",document.body.appendChild(p),p.click(),URL.revokeObjectURL(h),document.body.removeChild(p),null==(o=r.onDumpEnd)||o.call(r),null==(s=n.onDumpEnd)||s.call(n),this.addInfoToBanner(SU,"Dump success, file name is: ".concat(p.download))};this.inactiveButton(d,YR),this.inactiveButton(h),i>0?setTimeout(()=>{a(),this.activeButton(d,"Dump w/ Audio"),this.activeButton(h,GR)},1e3*i):(this.activeButton(l),l.onclick=()=>{l.onclick=null,a(),this.activeButton(d,"Dump w/ Audio"),this.activeButton(h,GR),this.inactiveButton(l)})}),"audio"!==t){u=document.createElement("button"),u.innerText="Preview",u.style.whiteSpace="Pre";let i=document.createElement("video");document.body.appendChild(i),i.id="".concat(BM,"_preview_remote_").concat(t,"_").concat(e),i.style.cssText="\n width: 320px;\n height: 240px;\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n border: 3px solid #cccccc;\n transform: translate(-50%, -50%);\n z-index: 10004;\n ",u.onclick=async()=>{var r;if(i.style.display="none"===i.style.display?"":"none",u&&(u.innerText="none"===i.style.display?"Preview":" Hide "),!i.srcObject){let n=this._core.room.remotePublishedUserMap.get(e);if(n){let e=null==(r=n["main"===t?"remoteVideoTrack":"remoteAuxiliaryTrack"])?void 0:r.mediaTrack;e?(i.srcObject=new MediaStream([e]),await i.play()):this.addInfoToBanner(RU,"failed to preview, remote video track is not available")}}}}a.appendChild(o),a.appendChild(h),c&&a.appendChild(c),d&&a.appendChild(d),a.appendChild(l),u&&a.appendChild(u),a.style.cssText="padding:10px;";let p=document.createElement("div");return p.style.cssText="width:100%;display:flex;justify-content:center;border-top: 1px solid var(--DD-BORDER);",p.appendChild(a),null==(n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(aU)))||n.appendChild(p),p};if("remote"===t)if("publish"===r){let r=c(e,i);this.publishMap.set("".concat(e,"-").concat(t,"-").concat(i),r)}else{let r=this.publishMap.get("".concat(e,"-").concat(t,"-").concat(i));if(!r)return;null==(o=null==(a=null==(n=this._dialogNode)?void 0:n.shadowRoot)?void 0:a.querySelector(".".concat(aU)))||o.removeChild(r);let s=document.querySelector("#".concat(BM,"_preview_remote_").concat(i,"_").concat(e));s&&document.body.removeChild(s),this.publishMap.delete("".concat(e,"-").concat(t,"-").concat(i))}}),UA(this,"handleStatistics",e=>{var t,i,r,n,a,o;let s=(e.bytesSent-this.prevBytesSent)/2,c=(e.bytesReceived-this.prevBytesReceived)/2;this.prevBytesSent=e.bytesSent,this.prevBytesReceived=e.bytesReceived,(null==(i=null==(t=this._dialogNode)?void 0:t.shadowRoot)?void 0:i.querySelector(".".concat(wU))).innerHTML="rtt: ".concat(e.rtt," ms upLoss: ").concat(e.upLoss,"% downLoss: ").concat(e.downLoss,"% <br>\n ↑ ").concat(s/1e3," KB/s (").concat(8*s/1e3," Kb/s) <br>\n ↓ ").concat(c/1e3," KB/s (").concat(8*c/1e3," Kb/s) <br>\n ");let l=null==(n=null==(r=this._dialogNode)?void 0:r.shadowRoot)?void 0:n.querySelector(".".concat(tU)),d="";e.localStatistics.audio.bitrate&&(d="<li>local audio: ".concat(e.localStatistics.audio.bitrate," Kb/s audioLevel: ").concat(e.localStatistics.audio.audioLevel.toFixed(5),"</li>")),e.localStatistics.video.length>0&&(d+="".concat(e.localStatistics.video.map(e=>"<li>local ".concat(e.videoType," video: ").concat(e.bitrate," Kb/s ").concat(e.width,"*").concat(e.height," ").concat(e.frameRate,"fps</li>")).join(""))),l.innerHTML=""===d?"".concat(nk):d;let u=null==(o=null==(a=this._dialogNode)?void 0:a.shadowRoot)?void 0:o.querySelector(".".concat(iU)),h="";e.remoteStatistics.length>0&&e.remoteStatistics.forEach(e=>{let t="remote ".concat(e.userId,":");e.audio.bitrate>0&&(t+="<li>audio: ".concat(e.audio.bitrate," Kb/s audioLevel: ").concat(e.audio.audioLevel.toFixed(5),"</li>")),e.video.length>0&&e.video.forEach(e=>{t+="<li>".concat(e.videoType," video: ").concat(e.bitrate," Kb/s ").concat(e.width,"*").concat(e.height," ").concat(e.frameRate,"fps</li>")}),h+=t}),u.innerHTML=""===h?"".concat(nk):h}),UA(this,"pad",e=>e<10?"0".concat(e):"".concat(e)),this._core=e,this._log=t,this.initCustomElements(),this.synchronizeLog(),this.installEvents(),this.addVideoProcessor(),this.addAudioProcessor(),window["__trtc_instance_".concat(kU,"__")]=this._core.trtc}initCustomElements(){this._isMobile=(()=>{let e=window.navigator&&window.navigator.userAgent||"",t=/iPad/i.test(e)||/iPhone/i.test(e),i=/Android/i.test(e);return t||i})();let e=document.createElement("trtc-basic-debug-dialog");document.body.appendChild(e);let t=e.shadowRoot;if(this._dialogNode=e,!t)return;this._switchNode=t.querySelector(".".concat(HM)),this._addEventListener(this._switchNode,"click",this.onSwitchClick.bind(this));let i=getComputedStyle(this._switchNode);this.switchPos.x=parseInt(i.right,10)||50,this.switchPos.y=parseInt(i.bottom,10)||100+50*kU,this._isMobile?(this._switchNode.ontouchstart=this.onTouchStart.bind(this),this._switchNode.ontouchend=this.onTouchEnd.bind(this),this._switchNode.ontouchmove=this.onTouchMove.bind(this)):this._switchNode.onmousedown=this.onMouseDown.bind(this),this._maskNode=t.querySelector(".".concat(jM)),this._addEventListener(this._maskNode,"click",this.onMaskClick.bind(this)),this._panelNode=t.querySelector(".".concat(zM)),t.querySelector(".".concat(TU)).childNodes.forEach(e=>{switch(e.getAttribute("data-type")){case"go_bottom":this._addEventListener(e,"click",this.onGoBottomClick.bind(this));break;case"back_top":this._addEventListener(e,"click",this.onBackTopClick.bind(this));break;case"clear_log":this._addEventListener(e,"click",this.onClearLogClick.bind(this))}}),this._logContentNode=t.querySelector(".".concat(ZM)),this._networkContentNode=t.querySelector(".".concat(JM)),this._dumpContentNode=t.querySelector(".".concat(QM)),this._tabNodes=Array.from(t.querySelector(".".concat(WM)).children),this._tabNodes.forEach(e=>{this._addEventListener(e,"click",this.onTabClick.bind(this))}),this._toptabNodes=Array.from(t.querySelector(".".concat(qM)).children),this._toptabNodes.forEach(e=>{this._addEventListener(e,"click",this.onToptabClick.bind(this))});let r=t.querySelector("#trtc_upload");this._addEventListener(r,"click",this.onUploadClick.bind(this));let n=t.querySelector("#trtc_export");this._addEventListener(n,"click",this.onExportClick.bind(this));let a=t.querySelector("#trtc_hide");this._addEventListener(a,"click",this.onHideClick.bind(this));let o=t.querySelector("#".concat(yU," .dump")),s=t.querySelector("#".concat(yU," .end-dump")),c=t.querySelector("#".concat(yU," input"));this._addEventListener(o,"click",()=>{let e=Number(c.value);this.getDumpButtonClickHandler(o,s,e,"main","local")});let l=t.querySelector("#".concat(EU," .dump")),d=t.querySelector("#".concat(EU," .end-dump")),u=t.querySelector("#".concat(EU," input"));this._addEventListener(l,"click",()=>{let e=Number(u.value);this.getDumpButtonClickHandler(l,d,e,"auxiliary","local")});let h=t.querySelector("#".concat(vU," .dump")),p=t.querySelector("#".concat(vU," .dump-opus")),f=t.querySelector("#".concat(vU," .end-dump"));this._addEventListener(h,"click",()=>{let e=Number(t.querySelector("#".concat(vU," input")).value),{download:i,onDumpEnd:r}=this.dumpAudio("local",e);i?(this.inactiveButton(h,YR),this.inactiveButton(p),e>0?setTimeout(()=>{i(),this.activeButton(h,qR),this.activeButton(p,KR)},1e3*e):(this.activeButton(f),f.onclick=()=>{f.onclick=null,i(),null==r||r(),this.activeButton(h,qR),this.activeButton(p,KR),this.inactiveButton(f)})):this.addInfoToBanner(RU,"Failed to dump, please check if the current user has started the audio")}),this._addEventListener(p,"click",()=>{let e=Number(t.querySelector("#".concat(vU," input")).value),{download:i,onDumpEnd:r}=this.dumpAudioFromPipeline("local",e);i?(this.inactiveButton(p,YR),this.inactiveButton(h),e>0?setTimeout(()=>{i(),this.activeButton(p,KR),this.activeButton(h,qR)},1e3*e):(this.activeButton(f),f.onclick=()=>{f.onclick=null,i(),null==r||r(),this.activeButton(p,KR),this.activeButton(h,qR),this.inactiveButton(f)})):this.addInfoToBanner(RU,"Failed to dump opus, please check if the current user has started the audio")});let m=t.querySelector("#dump-remote-video-hook-userid"),g=t.querySelector("#dump-remote-video-hook-duration"),_=t.querySelector("#dump-remote-video-hook-mediaType"),v=t.querySelector("#dump-remote-video-hook-button");v.onclick=()=>{let e=Number(g.value);if(e<1)return void this.addInfoToBanner(RU,"duration at least 1s");let t=m.value;if(!t)return void this.addInfoToBanner(RU,"please input user id");"*"===t&&this.inactiveButton(v);let i,r,n=_.value,a="remote_".concat(t,"_").concat("sub"===n?"auxiliary":n),o=a=>{if((a.userId===t||"*"===t)&&a.streamType===n){if(this.addInfoToBanner(SU,"[".concat(a.userId,"_").concat(n,"] starting to dump video, duration: ").concat(e,"s")),({download:i,onDumpEnd:r}=this.dumpVideo("sub"===a.streamType?"auxiliary":a.streamType,"remote",e,a.userId)),!i)return;setTimeout(()=>{null==i||i(),null==r||r(),"*"!==t&&this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,o)},1e3*e)}};this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,o),this.addInfoToBanner(SU,"[".concat(a,"] waiting to dump video from ").concat("*"===t?"all remote users":"user ".concat(t),", duration: ").concat(e,"s"))}}synchronizeLog(){this._core.loggerManager.getQueue().forEach(e=>{this.updateLog(e)})}isSupportDumpVideo(){return!(!this._core.rtcDectection.IS_INSERTABLE_STREAM_SUPPORTED&&!this._core.rtcDectection.IS_SCRIPT_TRANSFORM_SUPPORTED)||(this.addInfoToBanner(RU,"Current browser does not support dumping video"),!1)}_addEventListener(e,t,i,r){e&&(e.addEventListener(t,i,r),this.eventMap.set(e,{type:t,listener:i}))}_removeEventListener(){this.eventMap.forEach((e,t)=>{let{type:i,listener:r}=e;t&&t.removeEventListener(i,r)}),this.eventMap.clear(),this._switchNode&&(this._switchNode.onmousedown=null,this._switchNode.ontouchmove=null,this._switchNode.ontouchstart=null,this._switchNode.ontouchend=null)}closeDialog(){this.uninstallEvents(),this._removeEventListener(),this.removeVideoProcessor(),this.removeAudioProcessor(),this._dialogNode&&(document.body.removeChild(this._dialogNode),this._dialogNode=null)}updateLog(e){var t;this._logList.push(e);let i=document.createElement("div");switch(i.classList.add(uU),e.level){case 4:i.classList.add(mU);break;case 2:i.classList.add(pU);break;case 3:i.classList.add(fU);break;case 1:i.classList.add(hU)}i.textContent=e.log,"all"!==this._showLogType&&!i.classList.contains("".concat(uU,"_").concat(this._showLogType))&&(i.style.display="none"),null==(t=this._logContentNode)||t.appendChild(i),this.addHelper(i)}getDumpButtonClickHandler(e,t,i,r,n){if(!this.isSupportDumpVideo())return;let{download:a,onDumpEnd:o}=this.dumpVideo(r,n,i);if(a)return this.addInfoToBanner(SU,"[".concat(n,"_").concat(r,"] starting to dump...")),this.inactiveButton(e,YR),void(i>0?setTimeout(()=>{a(),this.activeButton(e,GR)},1e3*i):(this.activeButton(t),t.onclick=()=>{t.onclick=null,null==o||o(),a(),this.activeButton(e,GR),this.inactiveButton(t)}));this.addInfoToBanner(SU,"[".concat(n,"_").concat(r,"] waiting to dump..."));let s=a=>{let{track:o}=a;if(o.room===this._core.room&&o.streamType===r){this.addInfoToBanner(SU,"[".concat(n,"_").concat(r,"] starting to dump")),"local"===n&&this._core.innerEmitter.off("104",s);let{download:a,onDumpEnd:o}=this.dumpVideo(r,n,i);if(!a)return;i>0?setTimeout(()=>{a(),this.activeButton(e,GR)},1e3*i):(this.activeButton(t),t.onclick=()=>{t.onclick=null,null==o||o(),a(),this.activeButton(e,GR),this.inactiveButton(t)})}};s.bind(this),"local"===n&&this._core.innerEmitter.on("104",s),this.inactiveButton(e,YR)}onSwitchClick(){this._hasMove?this._hasMove=!1:this._showDialog?this.hideDialog():(this._isMobile&&(this._maskNode.style.display="block"),this._panelNode.style.display="block",this._switchNode.style.display="none",this._showDialog=!0,this.logContentGoBottom())}onTabClick(e){var t,i,r,n,a,o,s;let c=e.target;null==(t=this._tabNodes)||t.forEach(e=>{e.classList.remove(VM)}),c.classList.add(VM);let l=c.getAttribute("data-tab");"log"===l?(null==(n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(YM)))||n.classList.add(XM),this._logContentNode.style.display="block",this._networkContentNode.style.display="none",this._dumpContentNode.style.display="none",this.logContentGoBottom()):(null==(s=null==(o=null==(a=this._dialogNode)?void 0:a.shadowRoot)?void 0:o.querySelector(".".concat(YM)))||s.classList.remove(XM),"network"===l?(this._networkContentNode.style.display="block",this._logContentNode.style.display="none",this._dumpContentNode.style.display="none"):"dump"===l&&(this._dumpContentNode.style.display="block",this._networkContentNode.style.display="none",this._logContentNode.style.display="none"))}onToptabClick(e){var t,i;let r=e.target;null==(t=this._toptabNodes)||t.forEach(e=>{e.classList.remove(VM)}),r.classList.add(VM),this._showLogType=r.getAttribute("data-type");let n=null==(i=this._logContentNode)?void 0:i.querySelectorAll(".".concat(uU)),a="".concat(uU,"_").concat(this._showLogType);n.forEach(e=>{e.classList.contains(a)||"all"===this._showLogType?e.style.display="block":e.style.display="none"}),this.logContentGoBottom()}onExportClick(){let e=this._logList.reduce((e,t)=>"".concat(e+t.log,"\n"),""),t=new Blob([e],{type:"text/plain"}),i=document.createElement("a"),r=URL.createObjectURL(t);i.href=r;let n="trtc_".concat(void 0===this._core.room.sdkAppId?"EmptySdkAppId":this._core.room.sdkAppId,"_").concat(void 0===this._core.room.userId?"EmptyUserId":this._core.room.userId,"_").concat(this.formatStartDumpTime(+new Date),".log");i.download=n,i.style.display="none",document.body.appendChild(i),i.click(),URL.revokeObjectURL(r),document.body.removeChild(i),this.addInfoToBanner(SU,"Export success: The log file name is ".concat(n)),this._core.kvStatManager.addSuccessEvent({key:592703})}addInfoToBanner(e,t){var i,r;let n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(sU)),a=document.createElement("div");a.classList.add(cU);let o=e===SU?"🟩":e===AU?"🟧":"🟥";a.innerText="".concat(o," [").concat(this.getCurrentTime(),"] ").concat(t),n.appendChild(a),n.scrollTop=n.scrollHeight}async onUploadClick(){var e,t;if(this.isUploading)return;this.isUploading=!0;let i=null==(t=null==(e=this._dialogNode)?void 0:e.shadowRoot)?void 0:t.querySelector("#trtc_upload");i.innerText="Uploading...",null==i||i.classList.add(".disable");let r=this._logList.reduce((e,t)=>"".concat(e+t.log,"\n"),""),n=new Blob([r],{type:"text/plain"}),a=new FormData;a.append("file",n,"trtc.log"),a.append("sdkAppId","".concat(this._core.room.sdkAppId||"EmptySdkAppId")),a.append("userId","".concat(this._core.room.userId||"EmptyUserId")),fetch("https://service.trtc.qcloud.com/api/uploadLogFile",{method:"POST",body:a}).then(e=>e.json()).then(e=>{this.addInfoToBanner(e.type,e.message_en||"Upload Failed: Please use local export"),this.isUploading=!1,this._log.info(e.message_en),this._core.kvStatManager.addSuccessEvent({key:592704})}).catch(()=>{this.addInfoToBanner(RU,"Upload Failed: Please use local export"),this._log.info("Upload Failed: Please use local export"),this._core.kvStatManager.addFailedEvent({key:592704})}).finally(()=>{i.innerText=ZR,null==i||i.classList.remove(".disable"),this.isUploading=!1})}onHideClick(){this.hideDialog()}onMaskClick(){this.hideDialog()}hideDialog(){this._isMobile&&(this._maskNode.style.display="none"),this._panelNode.style.display="none",this._switchNode.style.display="block",this._showDialog=!1}onBackTopClick(){var e,t,i;null==(i=null==(t=null==(e=this._dialogNode)?void 0:e.shadowRoot)?void 0:t.querySelector(".".concat(YM)))||i.scrollTo(0,0)}onGoBottomClick(){this.logContentGoBottom()}onClearLogClick(){this._logList=[],this._logContentNode&&(this._logContentNode.innerHTML="")}logContentGoBottom(){var e,t;let i=null==(t=null==(e=this._dialogNode)?void 0:e.shadowRoot)?void 0:t.querySelector(".".concat(YM));null==i||i.scrollTo(0,null==i?void 0:i.scrollHeight)}onMouseDown(e){e.preventDefault(),this.switchPos.startX=e.pageX,this.switchPos.startY=e.pageY,document.onmousemove=this.onMouseMove.bind(this),document.onmouseup=this.onMouseUp.bind(this)}onMouseMove(e){e.cancelable&&e.preventDefault(),this._hasMove=!0;let t=this.switchPos.x-(e.pageX-this.switchPos.startX),i=this.switchPos.y-(e.pageY-this.switchPos.startY);[t,i]=this.getSafeAreaXY(t,i),this._switchNode.style.right="".concat(t,"px"),this._switchNode.style.bottom="".concat(i,"px"),this.switchPos.endX=t,this.switchPos.endY=i}onMouseUp(){this.switchPos.startX=0,this.switchPos.startY=0,this.switchPos.x=this.switchPos.endX,this.switchPos.y=this.switchPos.endY,document.onmousemove=null,document.onmouseup=null}onTouchStart(e){this.switchPos.startX=e.touches[0].pageX,this.switchPos.startY=e.touches[0].pageY,this.switchPos.isTouchEnd=!1}onTouchEnd(){this.switchPos.isTouchEnd&&(this.switchPos.startX=0,this.switchPos.startY=0,this.switchPos.isTouchEnd=!1,this.switchPos.x=this.switchPos.endX,this.switchPos.y=this.switchPos.endY)}onTouchMove(e){if(e.touches.length<=0)return;let t=e.touches[0].pageX-this.switchPos.startX,i=e.touches[0].pageY-this.switchPos.startY,r=Math.floor(this.switchPos.x-t),n=Math.floor(this.switchPos.y-i);[r,n]=this.getSafeAreaXY(r,n),this._switchNode.style.right="".concat(r,"px"),this._switchNode.style.bottom="".concat(n,"px"),this.switchPos.endX=r,this.switchPos.endY=n,this.switchPos.isTouchEnd=!0,e.cancelable&&e.preventDefault()}getSafeAreaXY(e,t){let i=Math.max(document.documentElement.offsetWidth,window.innerWidth),r=Math.max(document.documentElement.offsetHeight,window.innerHeight);return e+this._switchNode.offsetWidth>i&&(e=i-this._switchNode.offsetWidth),t+this._switchNode.offsetHeight>r&&(t=r-this._switchNode.offsetHeight),e<0&&(e=0),t<20&&(t=20),[e,t]}hitTest(e){return e===this._core.room}installEvents(){this._core.innerEmitter.on("264",this.handleLog,this),this._core.innerEmitter.on("53",this.handleLeaveSuccess,this),this._core.innerEmitter.on("27",this.handleJoinSuccess,this),this._core.trtc.on(this._core.TRTC.EVENT.STATISTICS,this.handleStatistics,this),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_AUDIO_AVAILABLE,this.handleRemoteAudioAvailable),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_AUDIO_UNAVAILABLE,this.handleRemoteAudioUnavailable),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,this.handleRemoteVideoAvailable),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_VIDEO_UNAVAILABLE,this.handleRemoteVideoUnavailable),this._core.room.on("dump",this.handleDumpFromScriptTransform,this)}uninstallEvents(){this._core.innerEmitter.off("264",this.handleLog,this),this._core.innerEmitter.off("53",this.handleLeaveSuccess,this),this._core.innerEmitter.off("27",this.handleJoinSuccess,this),this._core.trtc.off(this._core.TRTC.EVENT.STATISTICS,this.handleStatistics,this),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_AUDIO_AVAILABLE,this.handleRemoteAudioAvailable),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_AUDIO_UNAVAILABLE,this.handleRemoteAudioUnavailable),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,this.handleRemoteVideoAvailable),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_VIDEO_UNAVAILABLE,this.handleRemoteVideoUnavailable),this._core.room.off("dump",this.handleDumpFromScriptTransform,this)}handleDumpFromScriptTransform(e){if(e.isAudio){let t=e.userId?this.dumpRemoteAudioMap[e.userId]:this.dumpLocalAudioMap.main;return void(t&&(t.data.push(e.data),t.duration>0&&Date.now()-t.startTimestamp>1e3*t.duration&&t.onDumpEnd()))}if(e.userId){let t=this.dumpRemoteVideoMap["".concat(e.userId,"-").concat(e.streamType)];t&&(t.data.push(e.data),t.duration>0&&Date.now()-t.startTimestamp>1e3*t.duration&&t.onDumpEnd())}else{let t="main"===e.streamType?"main":"sub",i=this.dumpLocalVideoMap[t];i&&(i.data.push(e.data),i.duration>0&&Date.now()-i.startTimestamp>1e3*i.duration&&i.onDumpEnd())}}inactiveButton(e,t){e.disabled=!0,t&&(e.innerText=t)}activeButton(e,t){e.disabled=!1,t&&(e.innerText=t)}handleLog(e){this.updateLog(e.log)}addHelper(e){let t=/((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/g,i=hk,r=e.innerText;r=r.split("\n").map(e=>{if((e=e.replace(/</g,"&lt;").replace(/>/g,"&gt;")).includes("failed"))return e.includes("on autoplay-failed")?e:"<span class='red' style=\"background:red; color:#fff;\">".concat(e,"</span>");if(e.includes("clientIp:")){let i=e.match(t);return null==i||i.forEach(t=>{e=e.replace(t,'<a href="javascript:void(0);" target=""><span class=\'ip\' style="background:#e1dfdf">'.concat(t,"</span></a>"))}),e}return e.includes("URL of current page")&&(e=e.replace(/URL of current page: (.+)/,'URL of current page: <a href="$1">$1</a>')),e}).join("\n"),i.forEach(t=>{if(e.innerText.includes(t)){let i="";i="function"==typeof dk[t].tips?dk[t].tips(e.innerText):dk[t].tips,r=r.replace(new RegExp("".concat((e=>e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d").replace(">","&gt;").replace(">","&lt;"))(t)),"gi"),'<span class="'.concat(bU,'" style="background:').concat(dk[t].color||"#e1dfdf","; color: ").concat(dk[t].textColor||"#000",'">').concat(t,'\n <span class="tooltiptext tooltip-top">').concat(i,"</span>\n </span>"))}}),e.innerHTML=r}getCurrentTime(){let e=new Date,t=this.pad(e.getHours()),i=this.pad(e.getMinutes()),r=this.pad(e.getSeconds());return"".concat(t,":").concat(i,":").concat(r)}dumpAudioFromPipeline(e,t,i){this.addInfoToBanner(AU,"dump audio from pipeline");let r=Date.now(),n=this.formatStartDumpTime(r),a=[],o="".concat(e,"_").concat(i);if("local"===e)this._core.trtc._localAudioTrack;else if(i){let e=this._core.room.remotePublishedUserMap.get(i);e&&e.remoteAudioTrack}let s;if("local"===e){if(!this.hasLocalTrack("main","audio"))return{};s=()=>{delete this.dumpLocalAudioMap.main},this.dumpLocalAudioMap.main={startTimestamp:r,data:a,duration:t,onDumpEnd:s}}if("remote"===e&&i){if(s=()=>{delete this.dumpRemoteAudioMap["".concat(i)]},this.dumpRemoteAudioMap["".concat(i)])return this.addInfoToBanner(AU,"[".concat(o,"] dump already exists.")),{};this.dumpRemoteAudioMap["".concat(i)]={startTimestamp:r,data:a,duration:t,onDumpEnd:s}}return{download:()=>{var t,r;if(0===a.length)return void this.addInfoToBanner(RU,"[".concat(o,"] dump failed. Reason: data is empty"));let s,c=("local"===e?null==(t=this._core.room.singlePC)?void 0:t.audioCodec:null==(r=this._core.room.userManager)?void 0:r.getPublishedUser(i).audioCodec)||"opus",l=c;"opus"===c?(this.addInfoToBanner(AU,"[".concat(o,"] package opus to ogg")),s=this.convertOpusToOgg(a),l="ogg"):s=new Blob(a);let d=URL.createObjectURL(s),u=document.createElement("a"),h="local"===e?"local_".concat(n,".").concat(l):"remote-".concat(i,"_").concat(n,".").concat(l);u.href=d,u.download=h,u.style.display="none",document.body.appendChild(u),u.click(),URL.revokeObjectURL(d),u.remove(),this.addInfoToBanner(SU,"[".concat(o,"] dump success. File name is: ").concat(h))},onDumpEnd:s}}dumpVideo(e,t,i,r){let n,a=Date.now(),o=this.formatStartDumpTime(a),s=[],c="".concat(t,"_").concat(r,"_").concat(e);if("local"===t)n="main"===e?this._core.trtc._localVideoTrack:this._core.trtc._localScreenTrack;else if(r){let t=this._core.room.remotePublishedUserMap.get(r);t&&(n="main"===e?t.remoteVideoTrack:t.remoteAuxiliaryTrack)}let l;if("local"===t){if(!this.hasLocalTrack(e,"video"))return{};l=()=>{delete this.dumpLocalVideoMap["auxiliary"===e?"sub":"main"]},this.dumpLocalVideoMap["auxiliary"===e?"sub":"main"]={startTimestamp:a,data:s,duration:i,onDumpEnd:l}}if("remote"===t&&r){if(l=()=>{delete this.dumpRemoteVideoMap["".concat(r,"-").concat(e)]},this.dumpRemoteVideoMap["".concat(r,"-").concat(e)])return this.addInfoToBanner(AU,"[".concat(c,"] dump already exists.")),{};this.dumpRemoteVideoMap["".concat(r,"-").concat(e)]={startTimestamp:a,data:s,duration:i,onDumpEnd:l}}return{download:()=>{var i,a;if(0===s.length)return void this.addInfoToBanner(RU,"[".concat(c,"] dump failed. Reason: data is empty"));let l,d;"main"===e?l="video":"auxiliary"===e&&(l="screen"),"vp8"===this.getVideoCodec(r||"")?(this.addInfoToBanner(AU,"[".concat(c,"] package vp8 into ivf format")),d=this.convertVP8ToIVF(s,n)):d=new Blob(s);let u=URL.createObjectURL(d),h=document.createElement("a"),p="local"===t?"local_".concat(l,"_").concat(o,".").concat((null==(i=this._core.room.singlePC)?void 0:i.videoCodec)||"h264"):"remote-".concat(r,"_").concat(l,"_").concat(o,".").concat((null==(a=this._core.room.userManager)?void 0:a.getPublishedUser(r).videoCodec)||"h264");h.href=u,h.download=p,h.style.display="none",document.body.appendChild(h),h.click(),URL.revokeObjectURL(u),h.remove(),this.addInfoToBanner(SU,"[".concat(c,"] dump success. File name is: ").concat(p))},onDumpEnd:l}}convertVP8ToIVF(e,t){var i,r,n;function a(e,t,i){for(let r=0;r<i.length;r++)e.setUint8(t+r,i.charCodeAt(r))}let o=e.reduce((e,t)=>e+12+t.byteLength,32),s=new ArrayBuffer(o),c=new DataView(s),l=new Uint8Array(s),d=0;a(c,d,"DKIF"),d+=4,c.setUint16(d,0,!0),d+=2,c.setUint16(d,32,!0),d+=2,a(c,d,"VP80"),d+=4,c.setUint16(d,(null==(i=null==t?void 0:t._inputTrack)?void 0:i.getSettings().width)||0,!0),d+=2,c.setUint16(d,(null==(r=null==t?void 0:t._inputTrack)?void 0:r.getSettings().height)||0,!0),d+=2;let u=(t instanceof MM?null==t?void 0:t.decodeFPS:null==(n=null==t?void 0:t.mediaTrack)?void 0:n.getSettings().frameRate)||15;return c.setUint32(d,u,!0),d+=4,c.setUint32(d,1,!0),d+=4,c.setUint32(d,e.length,!0),d+=4,c.setUint32(d,0,!0),d+=4,e.forEach((e,t)=>{let i=e.byteLength,r=Math.floor(1e6*t/u);c.setUint32(d,i,!0),d+=4,c.setFloat64(d,r,!0),d+=8,l.set(new Uint8Array(e),d),d+=i}),new Blob([s],{type:"application/octet-stream"})}getVideoCodec(e){var t,i;return""===e?null==(t=this._core.room.singlePC)?void 0:t.videoCodec:null==(i=this._core.room.remotePublishedUserMap.get(e))?void 0:i.videoCodec}hasLocalTrack(e,t){for(let i of this._core.room.localTracks)if(i.streamType===e&&i.kind===t)return!0;return!1}dumpAudio(e,t,i){var r,n,a;let o,s,c=null,l=[],d=[],u=[],h=[],p=[],f=[],m=[],g=new AbortController,_=Date.now(),v=this.formatStartDumpTime(_),y=this._core.room.audioManager._localAudioPipline,E=this._core.room.audioManager._localScreenAudioPipeline,b=e=>{let{room:t,data:i,type:r}=e;if(this.hitTest(t)){if("dump"===r){if(h[0]=h[0]?h[0].concat(i.captureInput):i.captureInput,h[1]=h[1]?h[1].concat(i.playInput):i.playInput,o){let e=i.startTime-o,t=i.endTime-i.startTime;if(e>30||t>30){let r=function(e){if("number"!=typeof e||e<0)return"0毫秒";let t=[],i=Math.floor(e/6e4),r=e%6e4;i>0&&t.push("".concat(i,"分"));let n=Math.floor(r/1e3);return r%=1e3,(n>0||t.length)&&t.push("".concat(n,"秒")),(r>0||!t.length)&&t.push("".concat(r,"毫秒")),t.join("")},n=i.startTime-s,a=o-s;m.push("".concat(i.startTime,"\t").concat(r(n),"~").concat(r(a),"\t").concat(e,"\t").concat(t))}o=i.startTime}else o=i.startTime,s=i.startTime;f.push(i.startTime)}"dump-screen-audio"===r&&(p[0]=p[0]?p[0].concat(i.captureInput):i.captureInput,p[1]=p[1]?p[1].concat(i.playInput):i.playInput)}};if("local"===e){let{sampleRate:e}=this._core.room.audioManager.audioContext;if(!this._core.room.audioManager.hasAudioTrack&&!this._core.room.audioManager.hasScreenAudioTrack)return{};if(null!=y&&y.source.node&&(l.push(y.source.node),d.push("local_audio_raw_capture-".concat(e,"-").concat(y.source.node.channelCount))),(null!=(r=null==y?void 0:y.aec)&&r.node||null!=E&&E.aec.node)&&(this._core.trtc.updatePlugin("AudioProcessor",{enableDump:!0}),this._core.innerEmitter.on("265",b),null!=(n=null==y?void 0:y.aec)&&n.node&&(l.push(y.aec.node),d.push("local_audio_audioProcessor_processed-".concat(e,"-").concat(y.aec.node.channelCount))),null!=E&&E.aec.node&&(l.push(E.aec.node),d.push("screen_audio_audioProcessor_processed-".concat(e,"-").concat(E.aec.node.channelCount)))),null!=y&&y.denoiser.node&&(l.push(y.denoiser.node),d.push("local_audio_denoiser_processed-".concat(e,"-").concat(y.denoiser.node.channelCount))),this._core.room.audioManager.mixWeight>1&&null!=y&&y.stream){let t=this._core.room.audioManager.audioContext.createMediaStreamSource(y.stream);t.channelCount=1,l.push(t),d.push("local_audio_destination-".concat(e,"-").concat(t.channelCount))}}else if("remote"===e&&void 0!==i){let e=null==(a=this._core.room.remotePublishedUserMap.get(i))?void 0:a.remoteAudioTrack;if(null==e||!e.mediaTrack)return{};let t=this._core.createAudioNode(e.mediaTrack);l.push(t),d.push("remote_".concat(i))}let w=async()=>{var t,i,r,n,a;let o=new pk.default;for(let e=0;e<d.length;e++)o.file("".concat(d[e],".pcm"),new Blob(u[e]));if(null!=(t=null==h?void 0:h[0])&&t.length&&o.file("audioProcessor_input_capture.pcm",new Blob(h[0])),null!=(i=null==h?void 0:h[1])&&i.length&&o.file("audioProcessor_input_playback.pcm",new Blob(h[1])),null!=(r=null==p?void 0:p[0])&&r.length&&o.file("audioProcessor_screen_audio_input_capture.pcm",new Blob(p[0])),null!=(n=null==p?void 0:p[1])&&n.length&&o.file("audioProcessor_screen_audio_input_playback.pcm",new Blob(p[1])),null!=f&&f.length){let e=f.reduce((e,t)=>"".concat(e,"\n").concat(t));o.file("audioProcessor_handle_timestamp.txt",new Blob([e]))}if(null!=m&&m.length){let e=m.reduce((e,t)=>"".concat(e,"\n").concat(t));o.file("audioProcessor_big_gap_data.txt",new Blob([e]))}let s=await o.generateAsync({type:"blob"}),l=URL.createObjectURL(s),_=document.createElement("a");_.href=l,_.download="".concat(e,"-audio-").concat(v,".zip"),_.style.display="none",document.body.appendChild(_),_.click(),URL.revokeObjectURL(l),_.remove(),this.addInfoToBanner(SU,"Dump success, file name is: ".concat(e,"-").concat(v,".zip")),this._core.innerEmitter.off("265",b),(null!=(a=null==y?void 0:y.aec)&&a.node||null!=E&&E.aec.node)&&this._core.trtc.updatePlugin("AudioProcessor",{enableDump:!1}),c&&clearTimeout(c),g.abort("download")};return t>0&&(c=Number(setTimeout(()=>{g.abort("timeout")},1e3*t))),l.length>0&&this._core.startGetPCM(l).then(e=>e.pipeTo(new WritableStream({write(e){e.forEach((e,t)=>{u[t]=u[t]?u[t].concat(e[0]):[e[0]]})}}),g).catch(()=>w)),{download:w,onDumpEnd:()=>{g.abort("timeout")}}}formatStartDumpTime(e){let t=new Date(e),i=t.getFullYear(),r=this.pad(t.getMonth()+1),n=this.pad(t.getDate()),a=this.pad(t.getHours()),o=this.pad(t.getMinutes()),s=this.pad(t.getSeconds()),c=-t.getTimezoneOffset(),l=Math.floor(Math.abs(c)/60),d=Math.abs(c)%60,u=c>=0?"+":"-";return"".concat(i,"-").concat(r,"-").concat(n,"T").concat(a,"-").concat(o,"-").concat(s).concat(u).concat(this.pad(l),"-").concat(this.pad(d))}convertOpusToOgg(e){let t=Math.floor(4294967295*Math.random()),i=0,r=0,n=[],a=this.createOpusHead(48e3,2);n.push(this.createOggPage(2,0,t,i++,[a]));let o=this.createOpusTags();n.push(this.createOggPage(0,0,t,i++,[o]));let s=[],c=0;return e.forEach((a,o)=>{let l=this.getOpusPacketDuration(a);s.push(a),c+=a.byteLength,r+=l;let d=o===e.length-1;if(c>6e4||s.length>=50||d){let e=d?4:0;n.push(this.createOggPage(e,r,t,i++,s)),s=[],c=0}}),new Blob(n,{type:"audio/ogg"})}createOpusHead(e,t){let i=new ArrayBuffer(19),r=new DataView(i);return this.writeString(r,0,"OpusHead"),r.setUint8(8,1),r.setUint8(9,t),r.setUint16(10,0,!0),r.setUint32(12,e,!0),r.setUint16(16,0,!0),r.setUint8(18,0),i}createOpusTags(){let e="TRTC Debugger",t=new ArrayBuffer(29),i=new DataView(t);return this.writeString(i,0,"OpusTags"),i.setUint32(8,13,!0),this.writeString(i,12,e),i.setUint32(25,0,!0),t}createOggPage(e,t,i,r,n){let a=0;n.forEach(e=>{let t=e.byteLength;for(;t>=255;)a++,t-=255;a++});let o=27+a,s=n.reduce((e,t)=>e+t.byteLength,0),c=new ArrayBuffer(o+s),l=new DataView(c),d=new Uint8Array(c);this.writeString(l,0,"OggS"),l.setUint8(4,0),l.setUint8(5,e),l.setUint32(6,4294967295&t,!0),l.setUint32(10,Math.floor(t/4294967295),!0),l.setUint32(14,i,!0),l.setUint32(18,r,!0),l.setUint32(22,0,!0),l.setUint8(26,a);let u=27;n.forEach(e=>{let t=e.byteLength;for(;t>=255;)d[u++]=255,t-=255;d[u++]=t});let h=o;n.forEach(e=>{d.set(new Uint8Array(e),h),h+=e.byteLength});let p=this.crc32(d);return l.setUint32(22,p,!0),d}writeString(e,t,i){for(let r=0;r<i.length;r++)e.setUint8(t+r,i.charCodeAt(r))}getOpusPacketDuration(e){if(0===e.byteLength)return 0;let t=new Uint8Array(e),i=t[0],r=i>>3&31,n=3&i,a=1;if(1===n||2===n)a=2;else if(3===n){if(e.byteLength<2)return 0;a=63&t[1]}return([480,480,480,480,960,960,960,960,1920,1920,1920,1920,2880,2880,480,480,120,120,120,120,240,240,240,240,480,480,480,480,960,960,960,960][r]||960)*a}crc32(e){let t=new Uint32Array(256);for(let r=0;r<256;r++){let e=r<<24;for(let t=0;t<8;t++)2147483648&e?e=e<<1^79764919:e<<=1;t[r]=e>>>0}let i=0;for(let r=0;r<e.length;r++){i=(i<<8^t[255&(i>>>24^e[r])])>>>0}return i}addVideoProcessor(){let e=this._core.rtcDectection.IS_INSERTABLE_STREAM_SUPPORTED&&!this._core.rtcDectection.IS_SCRIPT_TRANSFORM_SUPPORTED;this._core.room.videoManager.addEncodeProcessor({processor:e?this.encodeVideo.bind(this):BR,type:1}),this._core.room.videoManager.addDecodeProcessor({processor:e?this.decodeVideo.bind(this):VR,type:1})}removeVideoProcessor(){this._core.room.videoManager.removeEncodeProcessor({type:1}),this._core.room.videoManager.removeDecodeProcessor({type:1})}addAudioProcessor(){let e=this._core.rtcDectection.IS_INSERTABLE_STREAM_SUPPORTED&&!this._core.rtcDectection.IS_SCRIPT_TRANSFORM_SUPPORTED;this._core.room.audioManager.addEncodeProcessor({processor:e?this.encodeAudio.bind(this):HR,type:2}),this._core.room.audioManager.addDecodeProcessor({processor:e?this.decodeAudio.bind(this):jR,type:2})}removeAudioProcessor(){this._core.room.audioManager.removeEncodeProcessor({type:2}),this._core.room.audioManager.removeDecodeProcessor({type:2})}encodeVideo(e){let{frame:t,mediaType:i}=e;if(i){let e=2===i?"sub":"main",r=this.dumpLocalVideoMap[e];r&&(r.data.push(t.data.slice(0)),r.duration>0&&Date.now()-r.startTimestamp>1e3*r.duration&&r.onDumpEnd())}return t}decodeVideo(e){let{frame:t,track:i}=e;if(i){let e=this.dumpRemoteVideoMap["".concat(i.userId,"-").concat(i.streamType)];e&&(e.data.push(t.data.slice(0)),e.duration>0&&Date.now()-e.startTimestamp>1e3*e.duration&&e.onDumpEnd())}return t}encodeAudio(e){let{frame:t}=e,i=this.dumpLocalAudioMap.main;return i&&(i.data.push(t.data.slice(0)),i.duration>0&&Date.now()-i.startTimestamp>1e3*i.duration&&i.onDumpEnd()),t}decodeAudio(e){let{frame:t,track:i}=e;if(i){let e=this.dumpRemoteAudioMap[i.userId];e&&(e.data.push(t.data.slice(0)),e.duration>0&&Date.now()-e.startTimestamp>1e3*e.duration&&e.onDumpEnd())}return t}};
2
2
  /*! Bundled license information:
3
3
 
4
4
  jszip/dist/jszip.min.js:
@@ -14,4 +14,4 @@
14
14
  https://github.com/nodeca/pako/blob/main/LICENSE
15
15
  *)
16
16
  */
17
- return MA([YA(300,()=>"export")],RU.prototype,"onExportClick",1),MA([YA(300,()=>"upload")],RU.prototype,"onUploadClick",1),RU});
17
+ return MA([YA(300,()=>"export")],DU.prototype,"onExportClick",1),MA([YA(300,()=>"upload")],DU.prototype,"onUploadClick",1),DU});