@byteplus/rtc 4.38.0 → 4.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.min.js +2 -2
- package/index.min.js +2 -2
- package/package.json +4 -1
package/index.esm.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright (c) 2020 The BytePlusRTC project authors. All Rights Reserved.
|
|
3
3
|
* @brief BytePlusRTC Advance API
|
|
4
|
-
* version: 4.38.
|
|
4
|
+
* version: 4.38.1
|
|
5
5
|
*/
|
|
6
|
-
function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(e){return e&&e.Math==Math&&e},n=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||Function("return this")(),i={},o=function(e){try{return!!e()}catch(e){return!0}},a=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),s=!o((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),c=s,u=Function.prototype.call,d=c?u.bind(u):function(){return u.apply(u,arguments)},l={},h={}.propertyIsEnumerable,f=Object.getOwnPropertyDescriptor,p=f&&!h.call({1:2},1);l.f=p?function(e){var t=f(this,e);return!!t&&t.enumerable}:h;var _,v,m=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},E=s,S=Function.prototype,g=S.bind,y=S.call,b=E&&g.bind(y,y),T=E?function(e){return e&&b(e)}:function(e){return e&&function(){return y.apply(e,arguments)}},I=T,R=I({}.toString),A=I("".slice),C=function(e){return A(R(e),8,-1)},O=T,N=o,w=C,D=n.Object,k=O("".split),P=N((function(){return!D("z").propertyIsEnumerable(0)}))?function(e){return"String"==w(e)?k(e,""):D(e)}:D,M=n.TypeError,U=function(e){if(null==e)throw M("Can't call method on "+e);return e},L=P,x=U,V=function(e){return L(x(e))},B=function(e){return"function"==typeof e},j=B,F=function(e){return"object"==typeof e?null!==e:j(e)},G=n,H=B,z=function(e){return H(e)?e:void 0},Y=function(e,t){return arguments.length<2?z(G[e]):G[e]&&G[e][t]},K=T({}.isPrototypeOf),X=Y("navigator","userAgent")||"",W=n,q=X,J=W.process,Z=W.Deno,$=J&&J.versions||Z&&Z.version,Q=$&&$.v8;Q&&(v=(_=Q.split("."))[0]>0&&_[0]<4?1:+(_[0]+_[1])),!v&&q&&(!(_=q.match(/Edge\/(\d+)/))||_[1]>=74)&&(_=q.match(/Chrome\/(\d+)/))&&(v=+_[1]);var ee=v,te=ee,re=o,ne=!!Object.getOwnPropertySymbols&&!re((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&te&&te<41})),ie=ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,oe=Y,ae=B,se=K,ce=ie,ue=n.Object,de=ce?function(e){return"symbol"==typeof e}:function(e){var t=oe("Symbol");return ae(t)&&se(t.prototype,ue(e))},le=n.String,he=function(e){try{return le(e)}catch(e){return"Object"}},fe=B,pe=he,_e=n.TypeError,ve=function(e){if(fe(e))return e;throw _e(pe(e)+" is not a function")},me=ve,Ee=function(e,t){var r=e[t];return null==r?void 0:me(r)},Se=d,ge=B,ye=F,be=n.TypeError,Te={exports:{}},Ie=n,Re=Object.defineProperty,Ae=function(e,t){try{Re(Ie,e,{value:t,configurable:!0,writable:!0})}catch(r){Ie[e]=t}return t},Ce=Ae,Oe=n["__core-js_shared__"]||Ce("__core-js_shared__",{}),Ne=Oe;(Te.exports=function(e,t){return Ne[e]||(Ne[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"});var we=U,De=n.Object,ke=function(e){return De(we(e))},Pe=ke,Me=T({}.hasOwnProperty),Ue=Object.hasOwn||function(e,t){return Me(Pe(e),t)},Le=T,xe=0,Ve=Math.random(),Be=Le(1..toString),je=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Be(++xe+Ve,36)},Fe=n,Ge=Te.exports,He=Ue,ze=je,Ye=ne,Ke=ie,Xe=Ge("wks"),We=Fe.Symbol,qe=We&&We.for,Je=Ke?We:We&&We.withoutSetter||ze,Ze=function(e){if(!He(Xe,e)||!Ye&&"string"!=typeof Xe[e]){var t="Symbol."+e;Ye&&He(We,e)?Xe[e]=We[e]:Xe[e]=Ke&&qe?qe(t):Je(t)}return Xe[e]},$e=d,Qe=F,et=de,tt=Ee,rt=function(e,t){var r,n;if("string"===t&&ge(r=e.toString)&&!ye(n=Se(r,e)))return n;if(ge(r=e.valueOf)&&!ye(n=Se(r,e)))return n;if("string"!==t&&ge(r=e.toString)&&!ye(n=Se(r,e)))return n;throw be("Can't convert object to primitive value")},nt=Ze,it=n.TypeError,ot=nt("toPrimitive"),at=function(e,t){if(!Qe(e)||et(e))return e;var r,n=tt(e,ot);if(n){if(void 0===t&&(t="default"),r=$e(n,e,t),!Qe(r)||et(r))return r;throw it("Can't convert object to primitive value")}return void 0===t&&(t="number"),rt(e,t)},st=at,ct=de,ut=function(e){var t=st(e,"string");return ct(t)?t:t+""},dt=F,lt=n.document,ht=dt(lt)&&dt(lt.createElement),ft=function(e){return ht?lt.createElement(e):{}},pt=ft,_t=!a&&!o((function(){return 7!=Object.defineProperty(pt("div"),"a",{get:function(){return 7}}).a})),vt=a,mt=d,Et=l,St=m,gt=V,yt=ut,bt=Ue,Tt=_t,It=Object.getOwnPropertyDescriptor;i.f=vt?It:function(e,t){if(e=gt(e),t=yt(t),Tt)try{return It(e,t)}catch(e){}if(bt(e,t))return St(!mt(Et.f,e,t),e[t])};var Rt={},At=a&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ct=n,Ot=F,Nt=Ct.String,wt=Ct.TypeError,Dt=function(e){if(Ot(e))return e;throw wt(Nt(e)+" is not an object")},kt=a,Pt=_t,Mt=At,Ut=Dt,Lt=ut,xt=n.TypeError,Vt=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor;Rt.f=kt?Mt?function(e,t,r){if(Ut(e),t=Lt(t),Ut(r),"function"==typeof e&&"prototype"===t&&"value"in r&&"writable"in r&&!r.writable){var n=Bt(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:"configurable"in r?r.configurable:n.configurable,enumerable:"enumerable"in r?r.enumerable:n.enumerable,writable:!1})}return Vt(e,t,r)}:Vt:function(e,t,r){if(Ut(e),t=Lt(t),Ut(r),Pt)try{return Vt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw xt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var jt=Rt,Ft=m,Gt=a?function(e,t,r){return jt.f(e,t,Ft(1,r))}:function(e,t,r){return e[t]=r,e},Ht={exports:{}},zt=B,Yt=Oe,Kt=T(Function.toString);zt(Yt.inspectSource)||(Yt.inspectSource=function(e){return Kt(e)});var Xt,Wt,qt,Jt=Yt.inspectSource,Zt=B,$t=Jt,Qt=n.WeakMap,er=Zt(Qt)&&/native code/.test($t(Qt)),tr=Te.exports,rr=je,nr=tr("keys"),ir=function(e){return nr[e]||(nr[e]=rr(e))},or={},ar=er,sr=n,cr=T,ur=F,dr=Gt,lr=Ue,hr=Oe,fr=ir,pr=or,_r=sr.TypeError,vr=sr.WeakMap;if(ar||hr.state){var mr=hr.state||(hr.state=new vr),Er=cr(mr.get),Sr=cr(mr.has),gr=cr(mr.set);Xt=function(e,t){if(Sr(mr,e))throw new _r("Object already initialized");return t.facade=e,gr(mr,e,t),t},Wt=function(e){return Er(mr,e)||{}},qt=function(e){return Sr(mr,e)}}else{var yr=fr("state");pr[yr]=!0,Xt=function(e,t){if(lr(e,yr))throw new _r("Object already initialized");return t.facade=e,dr(e,yr,t),t},Wt=function(e){return lr(e,yr)?e[yr]:{}},qt=function(e){return lr(e,yr)}}var br={set:Xt,get:Wt,has:qt,enforce:function(e){return qt(e)?Wt(e):Xt(e,{})},getterFor:function(e){return function(t){var r;if(!ur(t)||(r=Wt(t)).type!==e)throw _r("Incompatible receiver, "+e+" required");return r}}},Tr=a,Ir=Ue,Rr=Function.prototype,Ar=Tr&&Object.getOwnPropertyDescriptor,Cr=Ir(Rr,"name"),Or={EXISTS:Cr,PROPER:Cr&&"something"===function(){}.name,CONFIGURABLE:Cr&&(!Tr||Tr&&Ar(Rr,"name").configurable)},Nr=n,wr=B,Dr=Ue,kr=Gt,Pr=Ae,Mr=Jt,Ur=Or.CONFIGURABLE,Lr=br.get,xr=br.enforce,Vr=String(String).split("String");(Ht.exports=function(e,t,r,n){var i,o=!!n&&!!n.unsafe,a=!!n&&!!n.enumerable,s=!!n&&!!n.noTargetGet,c=n&&void 0!==n.name?n.name:t;wr(r)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Dr(r,"name")||Ur&&r.name!==c)&&kr(r,"name",c),(i=xr(r)).source||(i.source=Vr.join("string"==typeof c?c:""))),e!==Nr?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=r:kr(e,t,r)):a?e[t]=r:Pr(t,r)})(Function.prototype,"toString",(function(){return wr(this)&&Lr(this).source||Mr(this)}));var Br={},jr=Math.ceil,Fr=Math.floor,Gr=function(e){var t=+e;return t!=t||0===t?0:(t>0?Fr:jr)(t)},Hr=Gr,zr=Math.max,Yr=Math.min,Kr=function(e,t){var r=Hr(e);return r<0?zr(r+t,0):Yr(r,t)},Xr=Gr,Wr=Math.min,qr=function(e){return e>0?Wr(Xr(e),9007199254740991):0},Jr=qr,Zr=function(e){return Jr(e.length)},$r=V,Qr=Kr,en=Zr,tn=function(e){return function(t,r,n){var i,o=$r(t),a=en(o),s=Qr(n,a);if(e&&r!=r){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},rn={includes:tn(!0),indexOf:tn(!1)},nn=Ue,on=V,an=rn.indexOf,sn=or,cn=T([].push),un=function(e,t){var r,n=on(e),i=0,o=[];for(r in n)!nn(sn,r)&&nn(n,r)&&cn(o,r);for(;t.length>i;)nn(n,r=t[i++])&&(~an(o,r)||cn(o,r));return o},dn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ln=un,hn=dn.concat("length","prototype");Br.f=Object.getOwnPropertyNames||function(e){return ln(e,hn)};var fn={};fn.f=Object.getOwnPropertySymbols;var pn=Y,_n=Br,vn=fn,mn=Dt,En=T([].concat),Sn=pn("Reflect","ownKeys")||function(e){var t=_n.f(mn(e)),r=vn.f;return r?En(t,r(e)):t},gn=Ue,yn=Sn,bn=i,Tn=Rt,In=function(e,t,r){for(var n=yn(t),i=Tn.f,o=bn.f,a=0;a<n.length;a++){var s=n[a];gn(e,s)||r&&gn(r,s)||i(e,s,o(t,s))}},Rn=o,An=B,Cn=/#|\.prototype\./,On=function(e,t){var r=wn[Nn(e)];return r==kn||r!=Dn&&(An(t)?Rn(t):!!t)},Nn=On.normalize=function(e){return String(e).replace(Cn,".").toLowerCase()},wn=On.data={},Dn=On.NATIVE="N",kn=On.POLYFILL="P",Pn=On,Mn=n,Un=i.f,Ln=Gt,xn=Ht.exports,Vn=Ae,Bn=In,jn=Pn,Fn=function(e,t){var r,n,i,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?Mn:u?Mn[s]||Vn(s,{}):(Mn[s]||{}).prototype)for(n in t){if(o=t[n],i=e.noTargetGet?(a=Un(r,n))&&a.value:r[n],!jn(c?n:s+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;Bn(o,i)}(e.sham||i&&i.sham)&&Ln(o,"sham",!0),xn(r,n,o,e)}},Gn=ve,Hn=s,zn=T(T.bind),Yn=function(e,t){return Gn(e),void 0===t?e:Hn?zn(e,t):function(){return e.apply(t,arguments)}},Kn=C,Xn=Array.isArray||function(e){return"Array"==Kn(e)},Wn={};Wn[Ze("toStringTag")]="z";var qn="[object z]"===String(Wn),Jn=n,Zn=qn,$n=B,Qn=C,ei=Ze("toStringTag"),ti=Jn.Object,ri="Arguments"==Qn(function(){return arguments}()),ni=Zn?Qn:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=ti(e),ei))?r:ri?Qn(t):"Object"==(n=Qn(t))&&$n(t.callee)?"Arguments":n},ii=T,oi=o,ai=B,si=ni,ci=Jt,ui=function(){},di=[],li=Y("Reflect","construct"),hi=/^\s*(?:class|function)\b/,fi=ii(hi.exec),pi=!hi.exec(ui),_i=function(e){if(!ai(e))return!1;try{return li(ui,di,e),!0}catch(e){return!1}},vi=function(e){if(!ai(e))return!1;switch(si(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return pi||!!fi(hi,ci(e))}catch(e){return!0}};vi.sham=!0;var mi=!li||oi((function(){var e;return _i(_i.call)||!_i(Object)||!_i((function(){e=!0}))||e}))?vi:_i,Ei=n,Si=Xn,gi=mi,yi=F,bi=Ze("species"),Ti=Ei.Array,Ii=function(e){var t;return Si(e)&&(t=e.constructor,(gi(t)&&(t===Ti||Si(t.prototype))||yi(t)&&null===(t=t[bi]))&&(t=void 0)),void 0===t?Ti:t},Ri=function(e,t){return new(Ii(e))(0===t?0:t)},Ai=Yn,Ci=P,Oi=ke,Ni=Zr,wi=Ri,Di=T([].push),ki=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,f,p=Oi(c),_=Ci(p),v=Ai(u,d),m=Ni(_),E=0,S=l||wi,g=t?S(c,m):r||a?S(c,0):void 0;m>E;E++)if((s||E in _)&&(f=v(h=_[E],E,p),e))if(t)g[E]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return E;case 2:Di(g,h)}else switch(e){case 4:return!1;case 7:Di(g,h)}return o?-1:n||i?i:g}},Pi={forEach:ki(0),map:ki(1),filter:ki(2),some:ki(3),every:ki(4),find:ki(5),findIndex:ki(6),filterReject:ki(7)},Mi=o,Ui=function(e,t){var r=[][e];return!!r&&Mi((function(){r.call(null,t||function(){throw 1},1)}))},Li=Pi.forEach,xi=Ui("forEach")?[].forEach:function(e){return Li(this,e,arguments.length>1?arguments[1]:void 0)};Fn({target:"Array",proto:!0,forced:[].forEach!=xi},{forEach:xi});var Vi=ni,Bi=qn?{}.toString:function(){return"[object "+Vi(this)+"]"},ji=qn,Fi=Ht.exports,Gi=Bi;ji||Fi(Object.prototype,"toString",Gi,{unsafe:!0});var Hi={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},zi=ft("span").classList,Yi=zi&&zi.constructor&&zi.constructor.prototype,Ki=Yi===Object.prototype?void 0:Yi,Xi=n,Wi=Hi,qi=Ki,Ji=xi,Zi=Gt,$i=function(e){if(e&&e.forEach!==Ji)try{Zi(e,"forEach",Ji)}catch(t){e.forEach=Ji}};for(var Qi in Wi)Wi[Qi]&&$i(Xi[Qi]&&Xi[Qi].prototype);$i(qi);var eo=Fn,to=T,ro=n.Date,no=to(ro.prototype.getTime);eo({target:"Date",stat:!0},{now:function(){return no(new ro)}});var io=T,oo=Ht.exports,ao=Date.prototype,so=io(ao.toString),co=io(ao.getTime);function uo(e){return uo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uo(e)}"Invalid Date"!=String(new Date(NaN))&&oo(ao,"toString",(function(){var e=co(this);return e==e?so(this):"Invalid Date"}));var lo=n,ho=B,fo=lo.String,po=lo.TypeError,_o=T,vo=Dt,mo=function(e){if("object"==typeof e||ho(e))return e;throw po("Can't set "+fo(e)+" as a prototype")},Eo=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=_o(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return vo(r),mo(n),t?e(r,n):r.__proto__=n,r}}():void 0);Fn({target:"Object",stat:!0},{setPrototypeOf:Eo});var So={},go=un,yo=dn,bo=Object.keys||function(e){return go(e,yo)},To=a,Io=At,Ro=Rt,Ao=Dt,Co=V,Oo=bo;So.f=To&&!Io?Object.defineProperties:function(e,t){Ao(e);for(var r,n=Co(t),i=Oo(t),o=i.length,a=0;o>a;)Ro.f(e,r=i[a++],n[r]);return e};var No,wo=Y("document","documentElement"),Do=Dt,ko=So,Po=dn,Mo=or,Uo=wo,Lo=ft,xo=ir("IE_PROTO"),Vo=function(){},Bo=function(e){return"<script>"+e+"<\/script>"},jo=function(e){e.write(Bo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Fo=function(){try{No=new ActiveXObject("htmlfile")}catch(e){}var e,t;Fo="undefined"!=typeof document?document.domain&&No?jo(No):((t=Lo("iframe")).style.display="none",Uo.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Bo("document.F=Object")),e.close(),e.F):jo(No);for(var r=Po.length;r--;)delete Fo.prototype[Po[r]];return Fo()};Mo[xo]=!0;var Go=Object.create||function(e,t){var r;return null!==e?(Vo.prototype=Do(e),r=new Vo,Vo.prototype=null,r[xo]=e):r=Fo(),void 0===t?r:ko.f(r,t)};Fn({target:"Object",stat:!0,sham:!a},{create:Go});var Ho=a,zo=T,Yo=d,Ko=o,Xo=bo,Wo=fn,qo=l,Jo=ke,Zo=P,$o=Object.assign,Qo=Object.defineProperty,ea=zo([].concat),ta=!$o||Ko((function(){if(Ho&&1!==$o({b:1},$o(Qo({},"a",{enumerable:!0,get:function(){Qo(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=$o({},e)[r]||Xo($o({},t)).join("")!=n}))?function(e,t){for(var r=Jo(e),n=arguments.length,i=1,o=Wo.f,a=qo.f;n>i;)for(var s,c=Zo(arguments[i++]),u=o?ea(Xo(c),o(c)):Xo(c),d=u.length,l=0;d>l;)s=u[l++],Ho&&!Yo(a,c,s)||(r[s]=c[s]);return r}:$o,ra=ta;Fn({target:"Object",stat:!0,forced:Object.assign!==ra},{assign:ra});var na=Fn,ia=rn.indexOf,oa=Ui,aa=T([].indexOf),sa=!!aa&&1/aa([1],1,-0)<0,ca=oa("indexOf");na({target:"Array",proto:!0,forced:sa||!ca},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return sa?aa(this,e,t)||0:ia(this,e,t)}});var ua=s,da=Function.prototype,la=da.apply,ha=da.call,fa="object"==typeof Reflect&&Reflect.apply||(ua?ha.bind(la):function(){return ha.apply(la,arguments)}),pa=ni,_a=n.String,va=function(e){if("Symbol"===pa(e))throw TypeError("Cannot convert a Symbol value to a string");return _a(e)},ma={},Ea=ut,Sa=Rt,ga=m,ya=function(e,t,r){var n=Ea(t);n in e?Sa.f(e,n,ga(0,r)):e[n]=r},ba=Kr,Ta=Zr,Ia=ya,Ra=n.Array,Aa=Math.max,Ca=function(e,t,r){for(var n=Ta(e),i=ba(t,n),o=ba(void 0===r?n:r,n),a=Ra(Aa(o-i,0)),s=0;i<o;i++,s++)Ia(a,s,e[i]);return a.length=s,a},Oa=C,Na=V,wa=Br.f,Da=Ca,ka="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];ma.f=function(e){return ka&&"Window"==Oa(e)?function(e){try{return wa(e)}catch(e){return Da(ka)}}(e):wa(Na(e))};var Pa=T([].slice),Ma={},Ua=Ze;Ma.f=Ua;var La=n,xa=Ue,Va=Ma,Ba=Rt.f,ja=function(e){var t=La.Symbol||(La.Symbol={});xa(t,e)||Ba(t,e,{value:Va.f(e)})},Fa=Rt.f,Ga=Ue,Ha=Ze("toStringTag"),za=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Ga(e,Ha)&&Fa(e,Ha,{configurable:!0,value:t})},Ya=Fn,Ka=n,Xa=Y,Wa=fa,qa=d,Ja=T,Za=a,$a=ne,Qa=o,es=Ue,ts=Xn,rs=B,ns=F,is=K,os=de,as=Dt,ss=ke,cs=V,us=ut,ds=va,ls=m,hs=Go,fs=bo,ps=Br,_s=ma,vs=fn,ms=i,Es=Rt,Ss=So,gs=l,ys=Pa,bs=Ht.exports,Ts=Te.exports,Is=or,Rs=je,As=Ze,Cs=Ma,Os=ja,Ns=za,ws=br,Ds=Pi.forEach,ks=ir("hidden"),Ps=As("toPrimitive"),Ms=ws.set,Us=ws.getterFor("Symbol"),Ls=Object.prototype,xs=Ka.Symbol,Vs=xs&&xs.prototype,Bs=Ka.TypeError,js=Ka.QObject,Fs=Xa("JSON","stringify"),Gs=ms.f,Hs=Es.f,zs=_s.f,Ys=gs.f,Ks=Ja([].push),Xs=Ts("symbols"),Ws=Ts("op-symbols"),qs=Ts("string-to-symbol-registry"),Js=Ts("symbol-to-string-registry"),Zs=Ts("wks"),$s=!js||!js.prototype||!js.prototype.findChild,Qs=Za&&Qa((function(){return 7!=hs(Hs({},"a",{get:function(){return Hs(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Gs(Ls,t);n&&delete Ls[t],Hs(e,t,r),n&&e!==Ls&&Hs(Ls,t,n)}:Hs,ec=function(e,t){var r=Xs[e]=hs(Vs);return Ms(r,{type:"Symbol",tag:e,description:t}),Za||(r.description=t),r},tc=function(e,t,r){e===Ls&&tc(Ws,t,r),as(e);var n=us(t);return as(r),es(Xs,n)?(r.enumerable?(es(e,ks)&&e[ks][n]&&(e[ks][n]=!1),r=hs(r,{enumerable:ls(0,!1)})):(es(e,ks)||Hs(e,ks,ls(1,{})),e[ks][n]=!0),Qs(e,n,r)):Hs(e,n,r)},rc=function(e,t){as(e);var r=cs(t),n=fs(r).concat(ac(r));return Ds(n,(function(t){Za&&!qa(nc,r,t)||tc(e,t,r[t])})),e},nc=function(e){var t=us(e),r=qa(Ys,this,t);return!(this===Ls&&es(Xs,t)&&!es(Ws,t))&&(!(r||!es(this,t)||!es(Xs,t)||es(this,ks)&&this[ks][t])||r)},ic=function(e,t){var r=cs(e),n=us(t);if(r!==Ls||!es(Xs,n)||es(Ws,n)){var i=Gs(r,n);return!i||!es(Xs,n)||es(r,ks)&&r[ks][n]||(i.enumerable=!0),i}},oc=function(e){var t=zs(cs(e)),r=[];return Ds(t,(function(e){es(Xs,e)||es(Is,e)||Ks(r,e)})),r},ac=function(e){var t=e===Ls,r=zs(t?Ws:cs(e)),n=[];return Ds(r,(function(e){!es(Xs,e)||t&&!es(Ls,e)||Ks(n,Xs[e])})),n};($a||(bs(Vs=(xs=function(){if(is(Vs,this))throw Bs("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?ds(arguments[0]):void 0,t=Rs(e),r=function(e){this===Ls&&qa(r,Ws,e),es(this,ks)&&es(this[ks],t)&&(this[ks][t]=!1),Qs(this,t,ls(1,e))};return Za&&$s&&Qs(Ls,t,{configurable:!0,set:r}),ec(t,e)}).prototype,"toString",(function(){return Us(this).tag})),bs(xs,"withoutSetter",(function(e){return ec(Rs(e),e)})),gs.f=nc,Es.f=tc,Ss.f=rc,ms.f=ic,ps.f=_s.f=oc,vs.f=ac,Cs.f=function(e){return ec(As(e),e)},Za&&(Hs(Vs,"description",{configurable:!0,get:function(){return Us(this).description}}),bs(Ls,"propertyIsEnumerable",nc,{unsafe:!0}))),Ya({global:!0,wrap:!0,forced:!$a,sham:!$a},{Symbol:xs}),Ds(fs(Zs),(function(e){Os(e)})),Ya({target:"Symbol",stat:!0,forced:!$a},{for:function(e){var t=ds(e);if(es(qs,t))return qs[t];var r=xs(t);return qs[t]=r,Js[r]=t,r},keyFor:function(e){if(!os(e))throw Bs(e+" is not a symbol");if(es(Js,e))return Js[e]},useSetter:function(){$s=!0},useSimple:function(){$s=!1}}),Ya({target:"Object",stat:!0,forced:!$a,sham:!Za},{create:function(e,t){return void 0===t?hs(e):rc(hs(e),t)},defineProperty:tc,defineProperties:rc,getOwnPropertyDescriptor:ic}),Ya({target:"Object",stat:!0,forced:!$a},{getOwnPropertyNames:oc,getOwnPropertySymbols:ac}),Ya({target:"Object",stat:!0,forced:Qa((function(){vs.f(1)}))},{getOwnPropertySymbols:function(e){return vs.f(ss(e))}}),Fs)&&Ya({target:"JSON",stat:!0,forced:!$a||Qa((function(){var e=xs();return"[null]"!=Fs([e])||"{}"!=Fs({a:e})||"{}"!=Fs(Object(e))}))},{stringify:function(e,t,r){var n=ys(arguments),i=t;if((ns(t)||void 0!==e)&&!os(e))return ts(t)||(t=function(e,t){if(rs(i)&&(t=qa(i,this,e,t)),!os(t))return t}),n[1]=t,Wa(Fs,null,n)}});if(!Vs[Ps]){var sc=Vs.valueOf;bs(Vs,Ps,(function(e){return qa(sc,this)}))}Ns(xs,"Symbol"),Is[ks]=!0;var cc=Fn,uc=o,dc=V,lc=i.f,hc=a,fc=uc((function(){lc(1)}));cc({target:"Object",stat:!0,forced:!hc||fc,sham:!hc},{getOwnPropertyDescriptor:function(e,t){return lc(dc(e),t)}});var pc=Fn,_c=a,vc=Rt.f;pc({target:"Object",stat:!0,forced:Object.defineProperty!==vc,sham:!_c},{defineProperty:vc});var mc=n.Promise,Ec=Ht.exports,Sc=function(e,t,r){for(var n in t)Ec(e,n,t[n],r);return e},gc=Y,yc=Rt,bc=a,Tc=Ze("species"),Ic=function(e){var t=gc(e),r=yc.f;bc&&t&&!t[Tc]&&r(t,Tc,{configurable:!0,get:function(){return this}})},Rc=K,Ac=n.TypeError,Cc=function(e,t){if(Rc(t,e))return e;throw Ac("Incorrect invocation")},Oc={},Nc=Oc,wc=Ze("iterator"),Dc=Array.prototype,kc=function(e){return void 0!==e&&(Nc.Array===e||Dc[wc]===e)},Pc=ni,Mc=Ee,Uc=Oc,Lc=Ze("iterator"),xc=function(e){if(null!=e)return Mc(e,Lc)||Mc(e,"@@iterator")||Uc[Pc(e)]},Vc=d,Bc=ve,jc=Dt,Fc=he,Gc=xc,Hc=n.TypeError,zc=function(e,t){var r=arguments.length<2?Gc(e):t;if(Bc(r))return jc(Vc(r,e));throw Hc(Fc(e)+" is not iterable")},Yc=d,Kc=Dt,Xc=Ee,Wc=function(e,t,r){var n,i;Kc(e);try{if(!(n=Xc(e,"return"))){if("throw"===t)throw r;return r}n=Yc(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return Kc(n),r},qc=Yn,Jc=d,Zc=Dt,$c=he,Qc=kc,eu=Zr,tu=K,ru=zc,nu=xc,iu=Wc,ou=n.TypeError,au=function(e,t){this.stopped=e,this.result=t},su=au.prototype,cu=function(e,t,r){var n,i,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),p=qc(t,d),_=function(e){return n&&iu(n,"normal",e),new au(!0,e)},v=function(e){return l?(Zc(e),f?p(e[0],e[1],_):p(e[0],e[1])):f?p(e,_):p(e)};if(h)n=e;else{if(!(i=nu(e)))throw ou($c(e)+" is not iterable");if(Qc(i)){for(o=0,a=eu(e);a>o;o++)if((s=v(e[o]))&&tu(su,s))return s;return new au(!1)}n=ru(e,i)}for(c=n.next;!(u=Jc(c,n)).done;){try{s=v(u.value)}catch(e){iu(n,"throw",e)}if("object"==typeof s&&s&&tu(su,s))return s}return new au(!1)},uu=Ze("iterator"),du=!1;try{var lu=0,hu={next:function(){return{done:!!lu++}},return:function(){du=!0}};hu[uu]=function(){return this},Array.from(hu,(function(){throw 2}))}catch(e){}var fu,pu,_u,vu,mu=function(e,t){if(!t&&!du)return!1;var r=!1;try{var n={};n[uu]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},Eu=mi,Su=he,gu=n.TypeError,yu=function(e){if(Eu(e))return e;throw gu(Su(e)+" is not a constructor")},bu=Dt,Tu=yu,Iu=Ze("species"),Ru=function(e,t){var r,n=bu(e).constructor;return void 0===n||null==(r=bu(n)[Iu])?t:Tu(r)},Au=n.TypeError,Cu=function(e,t){if(e<t)throw Au("Not enough arguments");return e},Ou=/(?:ipad|iphone|ipod).*applewebkit/i.test(X),Nu="process"==C(n.process),wu=n,Du=fa,ku=Yn,Pu=B,Mu=Ue,Uu=o,Lu=wo,xu=Pa,Vu=ft,Bu=Cu,ju=Ou,Fu=Nu,Gu=wu.setImmediate,Hu=wu.clearImmediate,zu=wu.process,Yu=wu.Dispatch,Ku=wu.Function,Xu=wu.MessageChannel,Wu=wu.String,qu=0,Ju={};try{fu=wu.location}catch(e){}var Zu=function(e){if(Mu(Ju,e)){var t=Ju[e];delete Ju[e],t()}},$u=function(e){return function(){Zu(e)}},Qu=function(e){Zu(e.data)},ed=function(e){wu.postMessage(Wu(e),fu.protocol+"//"+fu.host)};Gu&&Hu||(Gu=function(e){Bu(arguments.length,1);var t=Pu(e)?e:Ku(e),r=xu(arguments,1);return Ju[++qu]=function(){Du(t,void 0,r)},pu(qu),qu},Hu=function(e){delete Ju[e]},Fu?pu=function(e){zu.nextTick($u(e))}:Yu&&Yu.now?pu=function(e){Yu.now($u(e))}:Xu&&!ju?(vu=(_u=new Xu).port2,_u.port1.onmessage=Qu,pu=ku(vu.postMessage,vu)):wu.addEventListener&&Pu(wu.postMessage)&&!wu.importScripts&&fu&&"file:"!==fu.protocol&&!Uu(ed)?(pu=ed,wu.addEventListener("message",Qu,!1)):pu="onreadystatechange"in Vu("script")?function(e){Lu.appendChild(Vu("script")).onreadystatechange=function(){Lu.removeChild(this),Zu(e)}}:function(e){setTimeout($u(e),0)});var td,rd,nd,id,od,ad,sd,cd,ud={set:Gu,clear:Hu},dd=n,ld=/ipad|iphone|ipod/i.test(X)&&void 0!==dd.Pebble,hd=/web0s(?!.*chrome)/i.test(X),fd=n,pd=Yn,_d=i.f,vd=ud.set,md=Ou,Ed=ld,Sd=hd,gd=Nu,yd=fd.MutationObserver||fd.WebKitMutationObserver,bd=fd.document,Td=fd.process,Id=fd.Promise,Rd=_d(fd,"queueMicrotask"),Ad=Rd&&Rd.value;Ad||(td=function(){var e,t;for(gd&&(e=Td.domain)&&e.exit();rd;){t=rd.fn,rd=rd.next;try{t()}catch(e){throw rd?id():nd=void 0,e}}nd=void 0,e&&e.enter()},md||gd||Sd||!yd||!bd?!Ed&&Id&&Id.resolve?((sd=Id.resolve(void 0)).constructor=Id,cd=pd(sd.then,sd),id=function(){cd(td)}):gd?id=function(){Td.nextTick(td)}:(vd=pd(vd,fd),id=function(){vd(td)}):(od=!0,ad=bd.createTextNode(""),new yd(td).observe(ad,{characterData:!0}),id=function(){ad.data=od=!od}));var Cd=Ad||function(e){var t={fn:e,next:void 0};nd&&(nd.next=t),rd||(rd=t,id()),nd=t},Od={},Nd=ve,wd=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=Nd(t),this.reject=Nd(r)};Od.f=function(e){return new wd(e)};var Dd=Dt,kd=F,Pd=Od,Md=function(e,t){if(Dd(e),kd(t)&&t.constructor===e)return t;var r=Pd.f(e);return(0,r.resolve)(t),r.promise},Ud=n,Ld=function(){this.head=null,this.tail=null};Ld.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var xd,Vd,Bd,jd,Fd=Ld,Gd="object"==typeof window,Hd=Fn,zd=n,Yd=Y,Kd=d,Xd=mc,Wd=Ht.exports,qd=Sc,Jd=Eo,Zd=za,$d=Ic,Qd=ve,el=B,tl=F,rl=Cc,nl=Jt,il=cu,ol=mu,al=Ru,sl=ud.set,cl=Cd,ul=Md,dl=function(e,t){var r=Ud.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},ll=Od,hl=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},fl=Fd,pl=br,_l=Pn,vl=Gd,ml=Nu,El=ee,Sl=Ze("species"),gl="Promise",yl=pl.getterFor(gl),bl=pl.set,Tl=pl.getterFor(gl),Il=Xd&&Xd.prototype,Rl=Xd,Al=Il,Cl=zd.TypeError,Ol=zd.document,Nl=zd.process,wl=ll.f,Dl=wl,kl=!!(Ol&&Ol.createEvent&&zd.dispatchEvent),Pl=el(zd.PromiseRejectionEvent),Ml=!1,Ul=_l(gl,(function(){var e=nl(Rl),t=e!==String(Rl);if(!t&&66===El)return!0;if(El>=51&&/native code/.test(e))return!1;var r=new Rl((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};return(r.constructor={})[Sl]=n,!(Ml=r.then((function(){}))instanceof n)||!t&&vl&&!Pl})),Ll=Ul||!ol((function(e){Rl.all(e).catch((function(){}))})),xl=function(e){var t;return!(!tl(e)||!el(t=e.then))&&t},Vl=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&Hl(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(Cl("Promise-chain cycle")):(n=xl(r))?Kd(n,r,c,u):c(r)):u(o)}catch(e){d&&!i&&d.exit(),u(e)}},Bl=function(e,t){e.notified||(e.notified=!0,cl((function(){for(var r,n=e.reactions;r=n.get();)Vl(r,e);e.notified=!1,t&&!e.rejection&&Fl(e)})))},jl=function(e,t,r){var n,i;kl?((n=Ol.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),zd.dispatchEvent(n)):n={promise:t,reason:r},!Pl&&(i=zd["on"+e])?i(n):"unhandledrejection"===e&&dl("Unhandled promise rejection",r)},Fl=function(e){Kd(sl,zd,(function(){var t,r=e.facade,n=e.value;if(Gl(e)&&(t=hl((function(){ml?Nl.emit("unhandledRejection",n,r):jl("unhandledrejection",r,n)})),e.rejection=ml||Gl(e)?2:1,t.error))throw t.value}))},Gl=function(e){return 1!==e.rejection&&!e.parent},Hl=function(e){Kd(sl,zd,(function(){var t=e.facade;ml?Nl.emit("rejectionHandled",t):jl("rejectionhandled",t,e.value)}))},zl=function(e,t,r){return function(n){e(t,n,r)}},Yl=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Bl(e,!0))},Kl=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Cl("Promise can't be resolved itself");var n=xl(t);n?cl((function(){var r={done:!1};try{Kd(n,t,zl(Kl,r,e),zl(Yl,r,e))}catch(t){Yl(r,t,e)}})):(e.value=t,e.state=1,Bl(e,!1))}catch(t){Yl({done:!1},t,e)}}};if(Ul&&(Al=(Rl=function(e){rl(this,Al),Qd(e),Kd(xd,this);var t=yl(this);try{e(zl(Kl,t),zl(Yl,t))}catch(e){Yl(t,e)}}).prototype,(xd=function(e){bl(this,{type:gl,done:!1,notified:!1,parent:!1,reactions:new fl,rejection:!1,state:0,value:void 0})}).prototype=qd(Al,{then:function(e,t){var r=Tl(this),n=wl(al(this,Rl));return r.parent=!0,n.ok=!el(e)||e,n.fail=el(t)&&t,n.domain=ml?Nl.domain:void 0,0==r.state?r.reactions.add(n):cl((function(){Vl(n,r)})),n.promise},catch:function(e){return this.then(void 0,e)}}),Vd=function(){var e=new xd,t=yl(e);this.promise=e,this.resolve=zl(Kl,t),this.reject=zl(Yl,t)},ll.f=wl=function(e){return e===Rl||e===Bd?new Vd(e):Dl(e)},el(Xd)&&Il!==Object.prototype)){jd=Il.then,Ml||(Wd(Il,"then",(function(e,t){var r=this;return new Rl((function(e,t){Kd(jd,r,e,t)})).then(e,t)}),{unsafe:!0}),Wd(Il,"catch",Al.catch,{unsafe:!0}));try{delete Il.constructor}catch(e){}Jd&&Jd(Il,Al)}Hd({global:!0,wrap:!0,forced:Ul},{Promise:Rl}),Zd(Rl,gl,!1),$d(gl),Bd=Yd(gl),Hd({target:gl,stat:!0,forced:Ul},{reject:function(e){var t=wl(this);return Kd(t.reject,void 0,e),t.promise}}),Hd({target:gl,stat:!0,forced:Ul},{resolve:function(e){return ul(this,e)}}),Hd({target:gl,stat:!0,forced:Ll},{all:function(e){var t=this,r=wl(t),n=r.resolve,i=r.reject,o=hl((function(){var r=Qd(t.resolve),o=[],a=0,s=1;il(e,(function(e){var c=a++,u=!1;s++,Kd(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise},race:function(e){var t=this,r=wl(t),n=r.reject,i=hl((function(){var i=Qd(t.resolve);il(e,(function(e){Kd(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var Xl=Fn,Wl=a,ql=n,Jl=T,Zl=Ue,$l=B,Ql=K,eh=va,th=Rt.f,rh=In,nh=ql.Symbol,ih=nh&&nh.prototype;if(Wl&&$l(nh)&&(!("description"in ih)||void 0!==nh().description)){var oh={},ah=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:eh(arguments[0]),t=Ql(ih,this)?new nh(e):void 0===e?nh():nh(e);return""===e&&(oh[t]=!0),t};rh(ah,nh),ah.prototype=ih,ih.constructor=ah;var sh="Symbol(test)"==String(nh("test")),ch=Jl(ih.toString),uh=Jl(ih.valueOf),dh=/^Symbol\((.*)\)[^)]+$/,lh=Jl("".replace),hh=Jl("".slice);th(ih,"description",{configurable:!0,get:function(){var e=uh(this),t=ch(e);if(Zl(oh,e))return"";var r=sh?hh(t,7,-1):lh(t,dh,"$1");return""===r?void 0:r}}),Xl({global:!0,forced:!0},{Symbol:ah})}ja("iterator");var fh=Go,ph=Rt,_h=Ze("unscopables"),vh=Array.prototype;null==vh[_h]&&ph.f(vh,_h,{configurable:!0,value:fh(null)});var mh,Eh,Sh,gh=function(e){vh[_h][e]=!0},yh=!o((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),bh=n,Th=Ue,Ih=B,Rh=ke,Ah=yh,Ch=ir("IE_PROTO"),Oh=bh.Object,Nh=Oh.prototype,wh=Ah?Oh.getPrototypeOf:function(e){var t=Rh(e);if(Th(t,Ch))return t[Ch];var r=t.constructor;return Ih(r)&&t instanceof r?r.prototype:t instanceof Oh?Nh:null},Dh=o,kh=B,Ph=wh,Mh=Ht.exports,Uh=Ze("iterator"),Lh=!1;[].keys&&("next"in(Sh=[].keys())?(Eh=Ph(Ph(Sh)))!==Object.prototype&&(mh=Eh):Lh=!0);var xh=null==mh||Dh((function(){var e={};return mh[Uh].call(e)!==e}));xh&&(mh={}),kh(mh[Uh])||Mh(mh,Uh,(function(){return this}));var Vh={IteratorPrototype:mh,BUGGY_SAFARI_ITERATORS:Lh},Bh=Vh.IteratorPrototype,jh=Go,Fh=m,Gh=za,Hh=Oc,zh=function(){return this},Yh=function(e,t,r,n){var i=t+" Iterator";return e.prototype=jh(Bh,{next:Fh(+!n,r)}),Gh(e,i,!1),Hh[i]=zh,e},Kh=Fn,Xh=d,Wh=Or,qh=B,Jh=Yh,Zh=wh,$h=Eo,Qh=za,ef=Gt,tf=Ht.exports,rf=Oc,nf=Wh.PROPER,of=Wh.CONFIGURABLE,af=Vh.IteratorPrototype,sf=Vh.BUGGY_SAFARI_ITERATORS,cf=Ze("iterator"),uf=function(){return this},df=function(e,t,r,n,i,o,a){Jh(r,t,n);var s,c,u,d=function(e){if(e===i&&_)return _;if(!sf&&e in f)return f[e];switch(e){case"keys":case"values":case"entries":return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[cf]||f["@@iterator"]||i&&f[i],_=!sf&&p||d(i),v="Array"==t&&f.entries||p;if(v&&(s=Zh(v.call(new e)))!==Object.prototype&&s.next&&(Zh(s)!==af&&($h?$h(s,af):qh(s[cf])||tf(s,cf,uf)),Qh(s,l,!0)),nf&&"values"==i&&p&&"values"!==p.name&&(of?ef(f,"name","values"):(h=!0,_=function(){return Xh(p,this)})),i)if(c={values:d("values"),keys:o?_:d("keys"),entries:d("entries")},a)for(u in c)(sf||h||!(u in f))&&tf(f,u,c[u]);else Kh({target:t,proto:!0,forced:sf||h},c);return f[cf]!==_&&tf(f,cf,_,{name:i}),rf[t]=_,c},lf=V,hf=gh,ff=Oc,pf=br,_f=Rt.f,vf=df,mf=a,Ef=pf.set,Sf=pf.getterFor("Array Iterator"),gf=vf(Array,"Array",(function(e,t){Ef(this,{type:"Array Iterator",target:lf(e),index:0,kind:t})}),(function(){var e=Sf(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values"),yf=ff.Arguments=ff.Array;if(hf("keys"),hf("values"),hf("entries"),mf&&"values"!==yf.name)try{_f(yf,"name",{value:"values"})}catch(e){}var bf=T,Tf=Gr,If=va,Rf=U,Af=bf("".charAt),Cf=bf("".charCodeAt),Of=bf("".slice),Nf=function(e){return function(t,r){var n,i,o=If(Rf(t)),a=Tf(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=Cf(o,a))<55296||n>56319||a+1===s||(i=Cf(o,a+1))<56320||i>57343?e?Af(o,a):n:e?Of(o,a,a+2):i-56320+(n-55296<<10)+65536}},wf={codeAt:Nf(!1),charAt:Nf(!0)},Df=wf.charAt,kf=va,Pf=br,Mf=df,Uf=Pf.set,Lf=Pf.getterFor("String Iterator");Mf(String,"String",(function(e){Uf(this,{type:"String Iterator",string:kf(e),index:0})}),(function(){var e,t=Lf(this),r=t.string,n=t.index;return n>=r.length?{value:void 0,done:!0}:(e=Df(r,n),t.index+=e.length,{value:e,done:!1})}));var xf=n,Vf=Hi,Bf=Ki,jf=gf,Ff=Gt,Gf=Ze,Hf=Gf("iterator"),zf=Gf("toStringTag"),Yf=jf.values,Kf=function(e,t){if(e){if(e[Hf]!==Yf)try{Ff(e,Hf,Yf)}catch(t){e[Hf]=Yf}if(e[zf]||Ff(e,zf,t),Vf[t])for(var r in jf)if(e[r]!==jf[r])try{Ff(e,r,jf[r])}catch(t){e[r]=jf[r]}}};for(var Xf in Vf)Kf(xf[Xf]&&xf[Xf].prototype,Xf);Kf(Bf,"DOMTokenList");var Wf=o,qf=ee,Jf=Ze("species"),Zf=function(e){return qf>=51||!Wf((function(){var t=[];return(t.constructor={})[Jf]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},$f=Fn,Qf=n,ep=o,tp=Xn,rp=F,np=ke,ip=Zr,op=ya,ap=Ri,sp=Zf,cp=ee,up=Ze("isConcatSpreadable"),dp=Qf.TypeError,lp=cp>=51||!ep((function(){var e=[];return e[up]=!1,e.concat()[0]!==e})),hp=sp("concat"),fp=function(e){if(!rp(e))return!1;var t=e[up];return void 0!==t?!!t:tp(e)};$f({target:"Array",proto:!0,forced:!lp||!hp},{concat:function(e){var t,r,n,i,o,a=np(this),s=ap(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(fp(o=-1===t?a:arguments[t])){if(c+(i=ip(o))>9007199254740991)throw dp("Maximum allowed index exceeded");for(r=0;r<i;r++,c++)r in o&&op(s,c,o[r])}else{if(c>=9007199254740991)throw dp("Maximum allowed index exceeded");op(s,c++,o)}return s.length=c,s}});var pp=Fn,_p=n,vp=Xn,mp=mi,Ep=F,Sp=Kr,gp=Zr,yp=V,bp=ya,Tp=Ze,Ip=Pa,Rp=Zf("slice"),Ap=Tp("species"),Cp=_p.Array,Op=Math.max;pp({target:"Array",proto:!0,forced:!Rp},{slice:function(e,t){var r,n,i,o=yp(this),a=gp(o),s=Sp(e,a),c=Sp(void 0===t?a:t,a);if(vp(o)&&(r=o.constructor,(mp(r)&&(r===Cp||vp(r.prototype))||Ep(r)&&null===(r=r[Ap]))&&(r=void 0),r===Cp||void 0===r))return Ip(o,s,c);for(n=new(void 0===r?Cp:r)(Op(c-s,0)),i=0;s<c;s++,i++)s in o&&bp(n,i,o[s]);return n.length=i,n}}),ja("asyncIterator");var Np=function(e,t){return Np=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Np(e,t)};function wp(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Np(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Dp=function(){return Dp=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Dp.apply(this,arguments)};function kp(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"===("undefined"==typeof Reflect?"undefined":uo(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function Pp(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function Mp(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function Up(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Lp(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function xp(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function Vp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Bp=Dt,jp=function(){var e=Bp(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},Fp=o,Gp=n.RegExp,Hp=Fp((function(){var e=Gp("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),zp=Hp||Fp((function(){return!Gp("a","y").sticky})),Yp={BROKEN_CARET:Hp||Fp((function(){var e=Gp("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:zp,UNSUPPORTED_Y:Hp},Kp=o,Xp=n.RegExp,Wp=Kp((function(){var e=Xp(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),qp=o,Jp=n.RegExp,Zp=qp((function(){var e=Jp("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),$p=d,Qp=T,e_=va,t_=jp,r_=Yp,n_=Te.exports,i_=Go,o_=br.get,a_=Wp,s_=Zp,c_=n_("native-string-replace",String.prototype.replace),u_=RegExp.prototype.exec,d_=u_,l_=Qp("".charAt),h_=Qp("".indexOf),f_=Qp("".replace),p_=Qp("".slice),__=function(){var e=/a/,t=/b*/g;return $p(u_,e,"a"),$p(u_,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),v_=r_.BROKEN_CARET,m_=void 0!==/()??/.exec("")[1];(__||m_||v_||a_||s_)&&(d_=function(e){var t,r,n,i,o,a,s,c=this,u=o_(c),d=e_(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=$p(d_,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,f=v_&&c.sticky,p=$p(t_,c),_=c.source,v=0,m=d;if(f&&(p=f_(p,"y",""),-1===h_(p,"g")&&(p+="g"),m=p_(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==l_(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",p)),m_&&(r=new RegExp("^"+_+"$(?!\\s)",p)),__&&(n=c.lastIndex),i=$p(u_,f?r:c,m),f?i?(i.input=p_(i.input,v),i[0]=p_(i[0],v),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:__&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),m_&&i&&i.length>1&&$p(c_,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&h)for(i.groups=a=i_(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var E_=d_;Fn({target:"RegExp",proto:!0,forced:/./.exec!==E_},{exec:E_});var S_=T,g_=Ht.exports,y_=E_,b_=o,T_=Ze,I_=Gt,R_=T_("species"),A_=RegExp.prototype,C_=function(e,t,r,n){var i=T_(e),o=!b_((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!b_((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[R_]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=S_(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var a=S_(e),c=t.exec;return c===y_||c===A_.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));g_(String.prototype,e,c[0]),g_(A_,i,c[1])}n&&I_(A_[i],"sham",!0)},O_=wf.charAt,N_=function(e,t,r){return t+(r?O_(e,t).length:1)},w_=d,D_=Dt,k_=B,P_=C,M_=E_,U_=n.TypeError,L_=function(e,t){var r=e.exec;if(k_(r)){var n=w_(r,e,t);return null!==n&&D_(n),n}if("RegExp"===P_(e))return w_(M_,e,t);throw U_("RegExp#exec called on incompatible receiver")},x_=d,V_=Dt,B_=qr,j_=va,F_=U,G_=Ee,H_=N_,z_=L_;C_("match",(function(e,t,r){return[function(t){var r=F_(this),n=null==t?void 0:G_(t,e);return n?x_(n,t,r):new RegExp(t)[e](j_(r))},function(e){var n=V_(this),i=j_(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return z_(n,i);var a=n.unicode;n.lastIndex=0;for(var s,c=[],u=0;null!==(s=z_(n,i));){var d=j_(s[0]);c[u]=d,""===d&&(n.lastIndex=H_(i,B_(n.lastIndex),a)),u++}return 0===u?null:c}]}));var Y_="\t\n\v\f\r \u2028\u2029\ufeff",K_=U,X_=va,W_=T("".replace),q_="[\t\n\v\f\r \u2028\u2029\ufeff]",J_=RegExp("^"+q_+q_+"*"),Z_=RegExp(q_+q_+"*$"),$_=function(e){return function(t){var r=X_(K_(t));return 1&e&&(r=W_(r,J_,"")),2&e&&(r=W_(r,Z_,"")),r}},Q_={start:$_(1),end:$_(2),trim:$_(3)},ev=n,tv=o,rv=T,nv=va,iv=Q_.trim,ov=ev.parseInt,av=ev.Symbol,sv=av&&av.iterator,cv=/^[+-]?0x/i,uv=rv(cv.exec),dv=8!==ov("\t\n\v\f\r \u2028\u2029\ufeff08")||22!==ov("\t\n\v\f\r \u2028\u2029\ufeff0x16")||sv&&!tv((function(){ov(Object(sv))}))?function(e,t){var r=iv(nv(e));return ov(r,t>>>0||(uv(cv,r)?16:10))}:ov;Fn({global:!0,forced:parseInt!=dv},{parseInt:dv});var lv={exports:{}},hv=o((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),fv=o,pv=F,_v=C,vv=hv,mv=Object.isExtensible,Ev=fv((function(){mv(1)}))||vv?function(e){return!!pv(e)&&((!vv||"ArrayBuffer"!=_v(e))&&(!mv||mv(e)))}:mv,Sv=!o((function(){return Object.isExtensible(Object.preventExtensions({}))})),gv=Fn,yv=T,bv=or,Tv=F,Iv=Ue,Rv=Rt.f,Av=Br,Cv=ma,Ov=Ev,Nv=Sv,wv=!1,Dv=je("meta"),kv=0,Pv=function(e){Rv(e,Dv,{value:{objectID:"O"+kv++,weakData:{}}})},Mv=lv.exports={enable:function(){Mv.enable=function(){},wv=!0;var e=Av.f,t=yv([].splice),r={};r[Dv]=1,e(r).length&&(Av.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Dv){t(n,i,1);break}return n},gv({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Cv.f}))},fastKey:function(e,t){if(!Tv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Iv(e,Dv)){if(!Ov(e))return"F";if(!t)return"E";Pv(e)}return e[Dv].objectID},getWeakData:function(e,t){if(!Iv(e,Dv)){if(!Ov(e))return!0;if(!t)return!1;Pv(e)}return e[Dv].weakData},onFreeze:function(e){return Nv&&wv&&Ov(e)&&!Iv(e,Dv)&&Pv(e),e}};bv[Dv]=!0;var Uv=B,Lv=F,xv=Eo,Vv=function(e,t,r){var n,i;return xv&&Uv(n=t.constructor)&&n!==r&&Lv(i=n.prototype)&&i!==r.prototype&&xv(e,i),e},Bv=Fn,jv=n,Fv=T,Gv=Pn,Hv=Ht.exports,zv=lv.exports,Yv=cu,Kv=Cc,Xv=B,Wv=F,qv=o,Jv=mu,Zv=za,$v=Vv,Qv=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=jv[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=Fv(s[e]);Hv(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!Wv(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!Wv(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!Wv(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(Gv(e,!Xv(a)||!(i||s.forEach&&!qv((function(){(new a).entries().next()})))))c=r.getConstructor(t,e,n,o),zv.enable();else if(Gv(e,!0)){var l=new c,h=l[o](i?{}:-0,1)!=l,f=qv((function(){l.has(1)})),p=Jv((function(e){new a(e)})),_=!i&&qv((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((c=t((function(e,t){Kv(e,s);var r=$v(new a,e,c);return null!=t&&Yv(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=c),(f||_)&&(d("delete"),d("has"),n&&d("get")),(_||h)&&d(o),i&&s.clear&&delete s.clear}return u[e]=c,Bv({global:!0,forced:c!=a},u),Zv(c,e),i||r.setStrong(c,e,n),c},em=Rt.f,tm=Go,rm=Sc,nm=Yn,im=Cc,om=cu,am=df,sm=Ic,cm=a,um=lv.exports.fastKey,dm=br.set,lm=br.getterFor,hm={getConstructor:function(e,t,r,n){var i=e((function(e,i){im(e,o),dm(e,{type:t,index:tm(null),first:void 0,last:void 0,size:0}),cm||(e.size=0),null!=i&&om(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=lm(t),s=function(e,t,r){var n,i,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:i=um(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),cm?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=um(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return rm(o,{clear:function(){for(var e=a(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,cm?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),cm?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=nm(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),rm(o,r?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),cm&&em(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=lm(t),o=lm(n);am(e,t,(function(e,t){dm(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?"keys"==t?{value:r.key,done:!1}:"values"==t?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),r?"entries":"values",!r,!0),sm(t)}};Qv("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),hm);var fm=ke,pm=bo;Fn({target:"Object",stat:!0,forced:o((function(){pm(1)}))},{keys:function(e){return pm(fm(e))}});var _m=ve,vm=ke,mm=P,Em=Zr,Sm=n.TypeError,gm=function(e){return function(t,r,n,i){_m(r);var o=vm(t),a=mm(o),s=Em(o),c=e?s-1:0,u=e?-1:1;if(n<2)for(;;){if(c in a){i=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw Sm("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(i=r(i,a[c],c,o));return i}},ym={left:gm(!1),right:gm(!0)},bm=ym.left,Tm=ee,Im=Nu;Fn({target:"Array",proto:!0,forced:!Ui("reduce")||!Im&&Tm>79&&Tm<83},{reduce:function(e){var t=arguments.length;return bm(this,e,t,t>1?arguments[1]:void 0)}});var Rm,Am=F,Cm=C,Om=Ze("match"),Nm=function(e){var t;return Am(e)&&(void 0!==(t=e[Om])?!!t:"RegExp"==Cm(e))},wm=Nm,Dm=n.TypeError,km=function(e){if(wm(e))throw Dm("The method doesn't accept regular expressions");return e},Pm=Ze("match"),Mm=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Pm]=!1,"/./"[e](t)}catch(e){}}return!1},Um=Fn,Lm=T,xm=i.f,Vm=qr,Bm=va,jm=km,Fm=U,Gm=Mm,Hm=Lm("".endsWith),zm=Lm("".slice),Ym=Math.min,Km=Gm("endsWith");Um({target:"String",proto:!0,forced:!!(Km||(Rm=xm(String.prototype,"endsWith"),!Rm||Rm.writable))&&!Km},{endsWith:function(e){var t=Bm(Fm(this));jm(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:Ym(Vm(r),n),o=Bm(e);return Hm?Hm(t,o,i):zm(t,i-o.length,i)===o}});var Xm=!0,Wm=!0;function qm(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function Jm(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var o=function(e){var t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};var o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function Zm(e){return"boolean"!=typeof e?new Error("Argument type: "+uo(e)+". Please use a boolean."):(Xm=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function $m(e){return"boolean"!=typeof e?new Error("Argument type: "+uo(e)+". Please use a boolean."):(Wm=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function Qm(){if("object"===("undefined"==typeof window?"undefined":uo(window))){if(Xm)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function eE(e,t){Wm&&console.warn(e+" is deprecated, please use "+t+" instead.")}function tE(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var r=e.navigator;if(r.mozGetUserMedia)t.browser="firefox",t.version=qm(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=qm(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=qm(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function rE(e){return"[object Object]"===Object.prototype.toString.call(e)}function nE(e){return rE(e)?Object.keys(e).reduce((function(t,r){var n=rE(e[r]),i=n?nE(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,Vp({},r,i))}),{}):e}function iE(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?iE(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){iE(e,e.get(t),r)}))})))}function oE(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(r){r.type===n&&r.trackId===t.id&&iE(e,r,i)}))})),i}var aE=Fn,sE=Pi.find,cE=gh,uE=!0;"find"in[]&&Array(1).find((function(){uE=!1})),aE({target:"Array",proto:!0,forced:uE},{find:function(e){return sE(this,e,arguments.length>1?arguments[1]:void 0)}}),cE("find");var dE=Fn,lE=n,hE=Kr,fE=Gr,pE=Zr,_E=ke,vE=Ri,mE=ya,EE=Zf("splice"),SE=lE.TypeError,gE=Math.max,yE=Math.min;dE({target:"Array",proto:!0,forced:!EE},{splice:function(e,t){var r,n,i,o,a,s,c=_E(this),u=pE(c),d=hE(e,u),l=arguments.length;if(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=yE(gE(fE(t),0),u-d)),u+r-n>9007199254740991)throw SE("Maximum allowed length exceeded");for(i=vE(c,n),o=0;o<n;o++)(a=d+o)in c&&mE(i,o,c[a]);if(i.length=n,r<n){for(o=d;o<u-n;o++)s=o+r,(a=o+n)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-n+r;o--)delete c[o-1]}else if(r>n)for(o=u-n;o>d;o--)s=o+r-1,(a=o+n-1)in c?c[s]=c[a]:delete c[s];for(o=0;o<r;o++)c[o+d]=arguments[o+2];return c.length=u-n+r,i}});var bE=Pi.map;Fn({target:"Array",proto:!0,forced:!Zf("map")},{map:function(e){return bE(this,e,arguments.length>1?arguments[1]:void 0)}});var TE=Pi.filter;Fn({target:"Array",proto:!0,forced:!Zf("filter")},{filter:function(e){return TE(this,e,arguments.length>1?arguments[1]:void 0)}});var IE=T,RE=ke,AE=Math.floor,CE=IE("".charAt),OE=IE("".replace),NE=IE("".slice),wE=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,DE=/\$([$&'`]|\d{1,2})/g,kE=fa,PE=d,ME=T,UE=C_,LE=o,xE=Dt,VE=B,BE=Gr,jE=qr,FE=va,GE=U,HE=N_,zE=Ee,YE=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,c=DE;return void 0!==i&&(i=RE(i),c=wE),OE(o,c,(function(o,c){var u;switch(CE(c,0)){case"$":return"$";case"&":return e;case"`":return NE(t,0,r);case"'":return NE(t,a);case"<":u=i[NE(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=AE(d/10);return 0===l?o:l<=s?void 0===n[l-1]?CE(c,1):n[l-1]+CE(c,1):o}u=n[d-1]}return void 0===u?"":u}))},KE=L_,XE=Ze("replace"),WE=Math.max,qE=Math.min,JE=ME([].concat),ZE=ME([].push),$E=ME("".indexOf),QE=ME("".slice),eS="$0"==="a".replace(/./,"$0"),tS=!!/./[XE]&&""===/./[XE]("a","$0");UE("replace",(function(e,t,r){var n=tS?"$":"$0";return[function(e,r){var n=GE(this),i=null==e?void 0:zE(e,XE);return i?PE(i,e,n,r):PE(t,FE(n),e,r)},function(e,i){var o=xE(this),a=FE(e);if("string"==typeof i&&-1===$E(i,n)&&-1===$E(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var c=VE(i);c||(i=FE(i));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=KE(o,a);if(null===h)break;if(ZE(l,h),!u)break;""===FE(h[0])&&(o.lastIndex=HE(a,jE(o.lastIndex),d))}for(var f,p="",_=0,v=0;v<l.length;v++){for(var m=FE((h=l[v])[0]),E=WE(qE(BE(h.index),a.length),0),S=[],g=1;g<h.length;g++)ZE(S,void 0===(f=h[g])?f:String(f));var y=h.groups;if(c){var b=JE([m],S,E,a);void 0!==y&&ZE(b,y);var T=FE(kE(i,void 0,b))}else T=YE(m,a,E,S,y,i);E>=_&&(p+=QE(a,_,E)+T,_=E+m.length)}return p+QE(a,_)}]}),!!LE((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!eS||tS);var rS=a,nS=n,iS=T,oS=Pn,aS=Vv,sS=Gt,cS=Rt.f,uS=Br.f,dS=K,lS=Nm,hS=va,fS=jp,pS=Yp,_S=Ht.exports,vS=o,mS=Ue,ES=br.enforce,SS=Ic,gS=Wp,yS=Zp,bS=Ze("match"),TS=nS.RegExp,IS=TS.prototype,RS=nS.SyntaxError,AS=iS(fS),CS=iS(IS.exec),OS=iS("".charAt),NS=iS("".replace),wS=iS("".indexOf),DS=iS("".slice),kS=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,PS=/a/g,MS=/a/g,US=new TS(PS)!==PS,LS=pS.MISSED_STICKY,xS=pS.UNSUPPORTED_Y,VS=rS&&(!US||LS||gS||yS||vS((function(){return MS[bS]=!1,TS(PS)!=PS||TS(MS)==MS||"/a/i"!=TS(PS,"i")})));if(oS("RegExp",VS)){for(var BS=function(e,t){var r,n,i,o,a,s,c=dS(IS,this),u=lS(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===BS)return e;if((u||dS(IS,e))&&(e=e.source,d&&(t="flags"in h?h.flags:AS(h))),e=void 0===e?"":hS(e),t=void 0===t?"":hS(t),h=e,gS&&"dotAll"in PS&&(n=!!t&&wS(t,"s")>-1)&&(t=NS(t,/s/g,"")),r=t,LS&&"sticky"in PS&&(i=!!t&&wS(t,"y")>-1)&&xS&&(t=NS(t,/y/g,"")),yS&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,c=!1,u=0,d="";n<=r;n++){if("\\"===(t=OS(e,n)))t+=OS(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:CS(kS,DS(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||mS(a,d))throw new RS("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:i+=t}return[i,o]}(e),e=o[0],l=o[1]),a=aS(TS(e,t),c?this:IS,BS),(n||i||l.length)&&(s=ES(a),n&&(s.dotAll=!0,s.raw=BS(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=OS(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+OS(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{sS(a,"source",""===h?"(?:)":h)}catch(e){}return a},jS=function(e){e in BS||cS(BS,e,{configurable:!0,get:function(){return TS[e]},set:function(t){TS[e]=t}})},FS=uS(TS),GS=0;FS.length>GS;)jS(FS[GS++]);IS.constructor=BS,BS.prototype=IS,_S(nS,"RegExp",BS)}SS("RegExp");var HS=T,zS=Or.PROPER,YS=Ht.exports,KS=Dt,XS=K,WS=va,qS=o,JS=jp,ZS=RegExp.prototype,$S=ZS.toString,QS=HS(JS),eg=qS((function(){return"/a/b"!=$S.call({source:"a",flags:"b"})})),tg=zS&&"toString"!=$S.name;(eg||tg)&&YS(RegExp.prototype,"toString",(function(){var e=KS(this),t=WS(e.source),r=e.flags;return"/"+t+"/"+WS(void 0===r&&XS(ZS,e)&&!("flags"in ZS)?QS(e):r)}),{unsafe:!0});var rg=Pi.some;Fn({target:"Array",proto:!0,forced:!Ui("some")},{some:function(e){return rg(this,e,arguments.length>1?arguments[1]:void 0)}});var ng=rn.includes,ig=gh;Fn({target:"Array",proto:!0},{includes:function(e){return ng(this,e,arguments.length>1?arguments[1]:void 0)}}),ig("includes");var og=Fn,ag=km,sg=U,cg=va,ug=Mm,dg=T("".indexOf);og({target:"String",proto:!0,forced:!ug("includes")},{includes:function(e){return!!~dg(cg(sg(this)),cg(ag(e)),arguments.length>1?arguments[1]:void 0)}});var lg=a,hg=Or.EXISTS,fg=T,pg=Rt.f,_g=Function.prototype,vg=fg(_g.toString),mg=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Eg=fg(mg.exec);lg&&!hg&&pg(_g,"name",{configurable:!0,get:function(){try{return Eg(mg,vg(this))[1]}catch(e){return""}}});var Sg=T,gg=ve,yg=F,bg=Ue,Tg=Pa,Ig=s,Rg=n.Function,Ag=Sg([].concat),Cg=Sg([].join),Og={},Ng=function(e,t,r){if(!bg(Og,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";Og[t]=Rg("C,a","return new C("+Cg(n,",")+")")}return Og[t](e,r)},wg=Ig?Rg.bind:function(e){var t=gg(this),r=t.prototype,n=Tg(arguments,1),i=function(){var r=Ag(n,Tg(arguments));return this instanceof i?Ng(t,r.length,r):t.apply(e,r)};return yg(r)&&(i.prototype=r),i},Dg=wg;Fn({target:"Function",proto:!0,forced:Function.bind!==Dg},{bind:Dg});var kg=Qm;function Pg(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==uo(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n="object"===uo(e[r])?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",r)]=n.ideal,t.optional.push(o),(o={})[i("max",r)]=n.ideal,t.optional.push(o)):(o[i("",r)]=n.ideal,t.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===uo(e.audio)){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===uo(e.video)){var a=e.video.facingMode;a=a&&("object"===uo(a)?a:{ideal:a});var s,c=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s)return r.mediaDevices.enumerateDevices().then((function(t){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return s.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&s.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=a.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),kg("chrome: "+JSON.stringify(e)),i(e)}));e.video=n(e.video)}return kg("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return a(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(o(e))}))}))}}}}function Mg(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Ug(e){if("object"===uo(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var r=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.track.id})):{track:n.track};var o=new Event("track");o.track=n.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)})),t.stream.getTracks().forEach((function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.id})):{track:n};var o=new Event("track");o.track=n,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else Jm(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Lg(e){if("object"===uo(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((function(e){r._senders.push(t(r,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var r=t._senders.find((function(t){return t.track===e}));r&&t._senders.splice(t._senders.indexOf(r),1)}))}}else if("object"===uo(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=a.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function xg(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Array.prototype.slice.call(arguments),n=r[0],i=r[1],o=r[2];if(arguments.length>0&&"function"==typeof n)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof n))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t[r.id]=r})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){i(s(a(e)))};return t.apply(this,[c,n])}return new Promise((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function Vg(e){if("object"===uo(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return oE(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=n.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),Jm(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return oE(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?n=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(r?n=!0:r=e),e.track===o})),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Bg(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var n=this.getSenders();r.apply(this,arguments);var i=this.getSenders().filter((function(e){return-1===n.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(i)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(r){var n=t._shimmedLocalStreams[r].indexOf(e);-1!==n&&t._shimmedLocalStreams[r].splice(n,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function jg(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Bg(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(r.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}n.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){var n=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[r.id];if(a)a.addTrack(t),Promise.resolve().then((function(){n.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[r.id]=s,this._reverseStreams[s.id]=r,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=Vp({},t,(function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?r.apply(this,[function(r){var n=s(e,r);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=n[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(n){r._streams[n].getTracks().find((function(t){return e.track===t}))&&(t=r._streams[n])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function c(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function Fg(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=Vp({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}))}function Gg(e,t){Jm(e,"negotiationneeded",(function(e){var r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var Hg=Object.freeze({__proto__:null,shimMediaStream:Mg,shimOnTrack:Ug,shimGetSendersWithDtmf:Lg,shimGetStats:xg,shimSenderReceiverGetStats:Vg,shimAddTrackRemoveTrackWithNative:Bg,shimAddTrackRemoveTrack:jg,shimPeerConnection:Fg,fixNegotiationNeeded:Gg,shimGetUserMedia:Pg,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((function(t){var n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),zg=n,Yg=o,Kg=va,Xg=Q_.trim,Wg=T("".charAt),qg=zg.parseFloat,Jg=zg.Symbol,Zg=Jg&&Jg.iterator,$g=1/qg("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||Zg&&!Yg((function(){qg(Object(Zg))}))?function(e){var t=Xg(Kg(e)),r=qg(t);return 0===r&&"-"==Wg(t,0)?-0:r}:qg;Fn({global:!0,forced:parseFloat!=$g},{parseFloat:$g});var Qg=Fn,ey=mc,ty=o,ry=Y,ny=B,iy=Ru,oy=Md,ay=Ht.exports;if(Qg({target:"Promise",proto:!0,real:!0,forced:!!ey&&ty((function(){ey.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=iy(this,ry("Promise")),r=ny(e);return this.then(r?function(r){return oy(t,e()).then((function(){return r}))}:e,r?function(r){return oy(t,e()).then((function(){throw r}))}:e)}}),ny(ey)){var sy=ry("Promise").prototype.finally;ey.prototype.finally!==sy&&ay(ey.prototype,"finally",sy,{unsafe:!0})}function cy(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){eE("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===uo(e)&&"object"===uo(e.audio)&&(e=JSON.parse(JSON.stringify(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},n&&n.prototype.getSettings){var a=n.prototype.getSettings;n.prototype.getSettings=function(){var e=a.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===uo(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function uy(e){"object"===uo(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function dy(e,t){if("object"===uo(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=Vp({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}));var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),i=e[0],o=e[1],a=e[2];return n.apply(this,[i||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,n){e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function ly(e){if("object"===uo(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function hy(e){if("object"===uo(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r}),Jm(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function fy(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;eE("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function py(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function _y(e){if("object"===uo(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach((function(e){if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var n=t.apply(this,arguments);if(r){var i=n.sender,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,i.sendEncodings=e.sendEncodings,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function vy(e){if("object"===uo(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function my(e){if("object"===uo(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function Ey(e){if("object"===uo(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var Sy=Object.freeze({__proto__:null,shimOnTrack:uy,shimPeerConnection:dy,shimSenderGetStats:ly,shimReceiverGetStats:hy,shimRemoveStream:fy,shimRTCDataChannel:py,shimAddTransceiver:_y,shimGetParameters:vy,shimCreateOffer:my,shimCreateAnswer:Ey,shimGetUserMedia:cy,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,Promise.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function gy(e){if("object"===uo(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(n){return t.call(r,n,e)})),e.getVideoTracks().forEach((function(n){return t.call(r,n,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=this,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return i&&i.forEach((function(e){r._localStreams?r._localStreams.includes(e)||r._localStreams.push(e):r._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var r=this._localStreams.indexOf(e);if(-1!==r){this._localStreams.splice(r,1);var n=e.getTracks();this.getSenders().forEach((function(e){n.includes(e.track)&&t.removeTrack(e)}))}})}}function yy(e){if("object"===uo(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var r=new Event("addstream");r.stream=e,t.dispatchEvent(r)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}}))}),t.apply(e,arguments)}}}function by(e){if("object"===uo(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=s}}function Ty(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,n=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return n(Iy(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function Iy(e){return e&&void 0!==e.video?Object.assign({},e,{video:nE(e.video)}):e}function Ry(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(eE("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,n.push(o)):n.push(e.iceServers[i])}e.iceServers=n}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function Ay(e){"object"===uo(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Cy(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var n=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Oy(e){"object"!==uo(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Ny=Object.freeze({__proto__:null,shimLocalStreamsAPI:gy,shimRemoteStreamsAPI:yy,shimCallbacksAPI:by,shimGetUserMedia:Ty,shimConstraints:Iy,shimRTCIceServerUrls:Ry,shimTrackEventTransceiver:Ay,shimCreateOfferLegacy:Cy,shimAudioContext:Oy}),wy=ke,Dy=at;Fn({target:"Date",proto:!0,forced:o((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=wy(this),r=Dy(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}});var ky=d;Fn({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return ky(URL.prototype.toString,this)}});var Py=T(1..valueOf),My=a,Uy=n,Ly=T,xy=Pn,Vy=Ht.exports,By=Ue,jy=Vv,Fy=K,Gy=de,Hy=at,zy=o,Yy=Br.f,Ky=i.f,Xy=Rt.f,Wy=Py,qy=Q_.trim,Jy=Uy.Number,Zy=Jy.prototype,$y=Uy.TypeError,Qy=Ly("".slice),eb=Ly("".charCodeAt),tb=function(e){var t=Hy(e,"number");return"bigint"==typeof t?t:rb(t)},rb=function(e){var t,r,n,i,o,a,s,c,u=Hy(e,"number");if(Gy(u))throw $y("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=qy(u),43===(t=eb(u,0))||45===t){if(88===(r=eb(u,2))||120===r)return NaN}else if(48===t){switch(eb(u,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+u}for(a=(o=Qy(u,2)).length,s=0;s<a;s++)if((c=eb(o,s))<48||c>i)return NaN;return parseInt(o,n)}return+u};if(xy("Number",!Jy(" 0o1")||!Jy("0b1")||Jy("+0x1"))){for(var nb,ib=function(e){var t=arguments.length<1?0:Jy(tb(e)),r=this;return Fy(Zy,r)&&zy((function(){Wy(r)}))?jy(Object(t),r,ib):t},ob=My?Yy(Jy):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),ab=0;ob.length>ab;ab++)By(Jy,nb=ob[ab])&&!By(ib,nb)&&Xy(ib,nb,Ky(Jy,nb));ib.prototype=Zy,Zy.constructor=ib,Vy(Uy,"Number",ib)}var sb=Fn,cb=P,ub=V,db=Ui,lb=T([].join),hb=cb!=Object,fb=db("join",",");sb({target:"Array",proto:!0,forced:hb||!fb},{join:function(e){return lb(ub(this),void 0===e?",":e)}});var pb=fa,_b=d,vb=T,mb=C_,Eb=Nm,Sb=Dt,gb=U,yb=Ru,bb=N_,Tb=qr,Ib=va,Rb=Ee,Ab=Ca,Cb=L_,Ob=E_,Nb=o,wb=Yp.UNSUPPORTED_Y,Db=Math.min,kb=[].push,Pb=vb(/./.exec),Mb=vb(kb),Ub=vb("".slice);mb("split",(function(e,t,r){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,r){var n=Ib(gb(this)),i=void 0===r?4294967295:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!Eb(e))return _b(t,n,e,i);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=_b(Ob,l,n))&&!((a=l.lastIndex)>d&&(Mb(c,Ub(n,d,o.index)),o.length>1&&o.index<n.length&&pb(kb,c,Ab(o,1)),s=o[0].length,d=a,c.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&Pb(l,"")||Mb(c,""):Mb(c,Ub(n,d)),c.length>i?Ab(c,0,i):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:_b(t,this,e,r)}:t,[function(t,r){var i=gb(this),o=null==t?void 0:Rb(t,e);return o?_b(o,t,i,r):_b(n,Ib(i),t,r)},function(e,i){var o=Sb(this),a=Ib(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var c=yb(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(wb?"g":"y"),l=new c(wb?"^(?:"+o.source+")":o,d),h=void 0===i?4294967295:i>>>0;if(0===h)return[];if(0===a.length)return null===Cb(l,a)?[a]:[];for(var f=0,p=0,_=[];p<a.length;){l.lastIndex=wb?0:p;var v,m=Cb(l,wb?Ub(a,p):a);if(null===m||(v=Db(Tb(l.lastIndex+(wb?p:0)),a.length))===f)p=bb(a,p,u);else{if(Mb(_,Ub(a,f,p)),_.length===h)return _;for(var E=1;E<=m.length-1;E++)if(Mb(_,m[E]),_.length===h)return _;p=f=v}}return Mb(_,Ub(a,f)),_}]}),!!Nb((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]})),wb);var Lb=Or.PROPER,xb=o,Vb=Y_,Bb=Q_.trim;Fn({target:"String",proto:!0,forced:function(e){return xb((function(){return!!Vb[e]()||"
"!=="
"[e]()||Lb&&Vb[e].name!==e}))}("trim")},{trim:function(){return Bb(this)}});var jb={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:void 0===r[t[n]]&&(r[t[n]]=t[n+1])}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===uo(e.keyParams)?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));var i=0;return r.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((function(e){n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){var r,n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(r=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&c&&n.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,n.forEach((function(e){e.maxBitrate=d}))),n},t.parseRtcpParameters=function(e){var r={},n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){var r,n=t.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(r=parseInt(i[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:r};var a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){var i=void 0!==r?r:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){for(var n=t.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),n=0;n<r.length;n++)if(r[n].length<2||"="!==r[n].charAt(1))return!1;return!0},e.exports=t}(jb);var Fb=jb.exports,Gb=Object.freeze(e({__proto__:null,default:Fb},[jb.exports]));function Hb(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===uo(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var r=new t(e),n=Fb.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,Jm(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function zb(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var r=function(e){if(!e||!e.sdp)return!1;var t=Fb.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=Fb.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=parseInt(t[1],10);return r!=r?-1:r},i=function(e){var r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){var n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var i=Fb.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var c,u=n(arguments[0]),d=i(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function Yb(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return r(e,this),e},Jm(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}}function Kb(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}}function Xb(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var n=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return r.apply(this,arguments)}}}function Wb(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function qb(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==uo(t)||t.type&&t.sdp)return r.apply(this,arguments);if(!(t={type:t.type,sdp:t.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return r.apply(this,[t]);var n="offer"===t.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return r.apply(e,[t])}))})}}var Jb=Object.freeze({__proto__:null,shimRTCIceCandidate:Hb,shimMaxMessageSize:zb,shimSendThrowTypeError:Yb,shimConnectionState:Kb,removeExtmapAllowMixed:Xb,shimAddIceCandidateNullOrEmpty:Wb,shimParameterlessSetLocalDescription:qb});!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},n=Qm,i=tE(t),o={browserDetails:i,commonShim:Jb,extractVersion:qm,disableLog:Zm,disableWarnings:$m,sdp:Gb};switch(i.browser){case"chrome":if(!Hg||!Fg||!r.shimChrome)return n("Chrome shim is not included in this adapter release."),o;if(null===i.version)return n("Chrome shim can not determine version, not shimming."),o;n("adapter.js shimming chrome."),o.browserShim=Hg,Wb(t,i),qb(t),Pg(t,i),Mg(t),Fg(t,i),Ug(t),jg(t,i),Lg(t),xg(t),Vg(t),Gg(t,i),Hb(t),Kb(t),zb(t,i),Yb(t),Xb(t,i);break;case"firefox":if(!Sy||!dy||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=Sy,Wb(t,i),qb(t),cy(t,i),dy(t,i),uy(t),fy(t),ly(t),hy(t),py(t),_y(t),vy(t),my(t),Ey(t),Hb(t),Kb(t),zb(t,i),Yb(t);break;case"safari":if(!Ny||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=Ny,Wb(t,i),qb(t),Ry(t),Cy(t),by(t),gy(t),yy(t),Ay(t),Ty(t),Oy(t),Hb(t),zb(t,i),Yb(t),Xb(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),Fn({target:"Array",stat:!0},{isArray:Xn});var Zb=Ca,$b=Math.floor,Qb=function(e,t){var r=e.length,n=$b(r/2);return r<8?eT(e,t):tT(e,Qb(Zb(e,0,n),t),Qb(Zb(e,n),t),t)},eT=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},tT=function(e,t,r,n){for(var i=t.length,o=r.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?n(t[a],r[s])<=0?t[a++]:r[s++]:a<i?t[a++]:r[s++];return e},rT=Qb,nT=X.match(/firefox\/(\d+)/i),iT=!!nT&&+nT[1],oT=/MSIE|Trident/.test(X),aT=X.match(/AppleWebKit\/(\d+)\./),sT=!!aT&&+aT[1],cT=Fn,uT=T,dT=ve,lT=ke,hT=Zr,fT=va,pT=o,_T=rT,vT=Ui,mT=iT,ET=oT,ST=ee,gT=sT,yT=[],bT=uT(yT.sort),TT=uT(yT.push),IT=pT((function(){yT.sort(void 0)})),RT=pT((function(){yT.sort(null)})),AT=vT("sort"),CT=!pT((function(){if(ST)return ST<70;if(!(mT&&mT>3)){if(ET)return!0;if(gT)return gT<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)yT.push({k:t+n,v:r})}for(yT.sort((function(e,t){return t.v-e.v})),n=0;n<yT.length;n++)t=yT[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));cT({target:"Array",proto:!0,forced:IT||!RT||!AT||!CT},{sort:function(e){void 0!==e&&dT(e);var t=lT(this);if(CT)return void 0===e?bT(t):bT(t,e);var r,n,i=[],o=hT(t);for(n=0;n<o;n++)n in t&&TT(i,t[n]);for(_T(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:fT(t)>fT(r)?1:-1}}(e)),r=i.length,n=0;n<r;)t[n]=i[n++];for(;n<o;)delete t[n++];return t}});var OT="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,NT=Gr,wT=qr,DT=n.RangeError,kT=function(e){if(void 0===e)return 0;var t=NT(e),r=wT(t);if(t!==r)throw DT("Wrong length or index");return r},PT=n.Array,MT=Math.abs,UT=Math.pow,LT=Math.floor,xT=Math.log,VT=Math.LN2,BT={pack:function(e,t,r){var n,i,o,a=PT(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?UT(2,-24)-UT(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=MT(e))!=e||e===1/0?(i=e!=e?1:0,n=c):(n=LT(xT(e)/VT),e*(o=UT(2,-n))<1&&(n--,o*=2),(e+=n+u>=1?d/o:d*UT(2,1-u))*o>=2&&(n++,o/=2),n+u>=c?(i=0,n=c):n+u>=1?(i=(e*o-1)*UT(2,t),n+=u):(i=e*UT(2,u-1)*UT(2,t),n=0));t>=8;)a[h++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[h++]=255&n,n/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var r,n=e.length,i=8*n-t-1,o=(1<<i)-1,a=o>>1,s=i-7,c=n-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:u?-1/0:1/0;r+=UT(2,t),d-=a}return(u?-1:1)*r*UT(2,d-t)}},jT=ke,FT=Kr,GT=Zr,HT=function(e){for(var t=jT(this),r=GT(t),n=arguments.length,i=FT(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:FT(o,r);a>i;)t[i++]=e;return t},zT=n,YT=T,KT=a,XT=OT,WT=Or,qT=Gt,JT=Sc,ZT=o,$T=Cc,QT=Gr,eI=qr,tI=kT,rI=BT,nI=wh,iI=Eo,oI=Br.f,aI=Rt.f,sI=HT,cI=Ca,uI=za,dI=WT.PROPER,lI=WT.CONFIGURABLE,hI=br.get,fI=br.set,pI=zT.ArrayBuffer,_I=pI,vI=_I&&_I.prototype,mI=zT.DataView,EI=mI&&mI.prototype,SI=Object.prototype,gI=zT.Array,yI=zT.RangeError,bI=YT(sI),TI=YT([].reverse),II=rI.pack,RI=rI.unpack,AI=function(e){return[255&e]},CI=function(e){return[255&e,e>>8&255]},OI=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},NI=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},wI=function(e){return II(e,23,4)},DI=function(e){return II(e,52,8)},kI=function(e,t){aI(e.prototype,t,{get:function(){return hI(this)[t]}})},PI=function(e,t,r,n){var i=tI(r),o=hI(e);if(i+t>o.byteLength)throw yI("Wrong index");var a=hI(o.buffer).bytes,s=i+o.byteOffset,c=cI(a,s,s+t);return n?c:TI(c)},MI=function(e,t,r,n,i,o){var a=tI(r),s=hI(e);if(a+t>s.byteLength)throw yI("Wrong index");for(var c=hI(s.buffer).bytes,u=a+s.byteOffset,d=n(+i),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(XT){var UI=dI&&"ArrayBuffer"!==pI.name;if(ZT((function(){pI(1)}))&&ZT((function(){new pI(-1)}))&&!ZT((function(){return new pI,new pI(1.5),new pI(NaN),UI&&!lI})))UI&&lI&&qT(pI,"name","ArrayBuffer");else{(_I=function(e){return $T(this,vI),new pI(tI(e))}).prototype=vI;for(var LI,xI=oI(pI),VI=0;xI.length>VI;)(LI=xI[VI++])in _I||qT(_I,LI,pI[LI]);vI.constructor=_I}iI&&nI(EI)!==SI&&iI(EI,SI);var BI=new mI(new _I(2)),jI=YT(EI.setInt8);BI.setInt8(0,2147483648),BI.setInt8(1,2147483649),!BI.getInt8(0)&&BI.getInt8(1)||JT(EI,{setInt8:function(e,t){jI(this,e,t<<24>>24)},setUint8:function(e,t){jI(this,e,t<<24>>24)}},{unsafe:!0})}else vI=(_I=function(e){$T(this,vI);var t=tI(e);fI(this,{bytes:bI(gI(t),0),byteLength:t}),KT||(this.byteLength=t)}).prototype,EI=(mI=function(e,t,r){$T(this,EI),$T(e,vI);var n=hI(e).byteLength,i=QT(t);if(i<0||i>n)throw yI("Wrong offset");if(i+(r=void 0===r?n-i:eI(r))>n)throw yI("Wrong length");fI(this,{buffer:e,byteLength:r,byteOffset:i}),KT||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,KT&&(kI(_I,"byteLength"),kI(mI,"buffer"),kI(mI,"byteLength"),kI(mI,"byteOffset")),JT(EI,{getInt8:function(e){return PI(this,1,e)[0]<<24>>24},getUint8:function(e){return PI(this,1,e)[0]},getInt16:function(e){var t=PI(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=PI(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return NI(PI(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return NI(PI(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return RI(PI(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return RI(PI(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){MI(this,1,e,AI,t)},setUint8:function(e,t){MI(this,1,e,AI,t)},setInt16:function(e,t){MI(this,2,e,CI,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){MI(this,2,e,CI,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){MI(this,4,e,OI,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){MI(this,4,e,OI,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){MI(this,4,e,wI,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){MI(this,8,e,DI,t,arguments.length>2?arguments[2]:void 0)}});uI(_I,"ArrayBuffer"),uI(mI,"DataView");var FI={ArrayBuffer:_I,DataView:mI},GI=Fn,HI=T,zI=o,YI=Dt,KI=Kr,XI=qr,WI=Ru,qI=FI.ArrayBuffer,JI=FI.DataView,ZI=JI.prototype,$I=HI(qI.prototype.slice),QI=HI(ZI.getUint8),eR=HI(ZI.setUint8);GI({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:zI((function(){return!new qI(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if($I&&void 0===t)return $I(YI(this),e);for(var r=YI(this).byteLength,n=KI(e,r),i=KI(void 0===t?r:t,r),o=new(WI(this,qI))(XI(i-n)),a=new JI(this),s=new JI(o),c=0;n<i;)eR(s,c++,QI(a,n++));return o}});var tR,rR,nR,iR={exports:{}},oR=OT,aR=a,sR=n,cR=B,uR=F,dR=Ue,lR=ni,hR=he,fR=Gt,pR=Ht.exports,_R=Rt.f,vR=K,mR=wh,ER=Eo,SR=Ze,gR=je,yR=sR.Int8Array,bR=yR&&yR.prototype,TR=sR.Uint8ClampedArray,IR=TR&&TR.prototype,RR=yR&&mR(yR),AR=bR&&mR(bR),CR=Object.prototype,OR=sR.TypeError,NR=SR("toStringTag"),wR=gR("TYPED_ARRAY_TAG"),DR=gR("TYPED_ARRAY_CONSTRUCTOR"),kR=oR&&!!ER&&"Opera"!==lR(sR.opera),PR=!1,MR={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},UR={BigInt64Array:8,BigUint64Array:8},LR=function(e){if(!uR(e))return!1;var t=lR(e);return dR(MR,t)||dR(UR,t)};for(tR in MR)(nR=(rR=sR[tR])&&rR.prototype)?fR(nR,DR,rR):kR=!1;for(tR in UR)(nR=(rR=sR[tR])&&rR.prototype)&&fR(nR,DR,rR);if((!kR||!cR(RR)||RR===Function.prototype)&&(RR=function(){throw OR("Incorrect invocation")},kR))for(tR in MR)sR[tR]&&ER(sR[tR],RR);if((!kR||!AR||AR===CR)&&(AR=RR.prototype,kR))for(tR in MR)sR[tR]&&ER(sR[tR].prototype,AR);if(kR&&mR(IR)!==AR&&ER(IR,AR),aR&&!dR(AR,NR))for(tR in PR=!0,_R(AR,NR,{get:function(){return uR(this)?this[wR]:void 0}}),MR)sR[tR]&&fR(sR[tR],wR,tR);var xR={NATIVE_ARRAY_BUFFER_VIEWS:kR,TYPED_ARRAY_CONSTRUCTOR:DR,TYPED_ARRAY_TAG:PR&&wR,aTypedArray:function(e){if(LR(e))return e;throw OR("Target is not a typed array")},aTypedArrayConstructor:function(e){if(cR(e)&&(!ER||vR(RR,e)))return e;throw OR(hR(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(aR){if(r)for(var i in MR){var o=sR[i];if(o&&dR(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}AR[e]&&!r||pR(AR,e,r?t:kR&&bR[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(aR){if(ER){if(r)for(n in MR)if((i=sR[n])&&dR(i,e))try{delete i[e]}catch(e){}if(RR[e]&&!r)return;try{return pR(RR,e,r?t:kR&&RR[e]||t)}catch(e){}}for(n in MR)!(i=sR[n])||i[e]&&!r||pR(i,e,t)}},isView:function(e){if(!uR(e))return!1;var t=lR(e);return"DataView"===t||dR(MR,t)||dR(UR,t)},isTypedArray:LR,TypedArray:RR,TypedArrayPrototype:AR},VR=n,BR=o,jR=mu,FR=xR.NATIVE_ARRAY_BUFFER_VIEWS,GR=VR.ArrayBuffer,HR=VR.Int8Array,zR=!FR||!BR((function(){HR(1)}))||!BR((function(){new HR(-1)}))||!jR((function(e){new HR,new HR(null),new HR(1.5),new HR(e)}),!0)||BR((function(){return 1!==new HR(new GR(2),1,void 0).length})),YR=F,KR=Math.floor,XR=Number.isInteger||function(e){return!YR(e)&&isFinite(e)&&KR(e)===e},WR=Gr,qR=n.RangeError,JR=function(e){var t=WR(e);if(t<0)throw qR("The argument can't be less than 0");return t},ZR=n.RangeError,$R=function(e,t){var r=JR(e);if(r%t)throw ZR("Wrong offset");return r},QR=Yn,eA=d,tA=yu,rA=ke,nA=Zr,iA=zc,oA=xc,aA=kc,sA=xR.aTypedArrayConstructor,cA=Fn,uA=n,dA=d,lA=a,hA=zR,fA=xR,pA=FI,_A=Cc,vA=m,mA=Gt,EA=XR,SA=qr,gA=kT,yA=$R,bA=ut,TA=Ue,IA=ni,RA=F,AA=de,CA=Go,OA=K,NA=Eo,wA=Br.f,DA=function(e){var t,r,n,i,o,a,s=tA(this),c=rA(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=oA(c);if(h&&!aA(h))for(a=(o=iA(c,h)).next,c=[];!(i=eA(a,o)).done;)c.push(i.value);for(l&&u>2&&(d=QR(d,arguments[2])),r=nA(c),n=new(sA(s))(r),t=0;r>t;t++)n[t]=l?d(c[t],t):c[t];return n},kA=Pi.forEach,PA=Ic,MA=Rt,UA=i,LA=Vv,xA=br.get,VA=br.set,BA=MA.f,jA=UA.f,FA=Math.round,GA=uA.RangeError,HA=pA.ArrayBuffer,zA=HA.prototype,YA=pA.DataView,KA=fA.NATIVE_ARRAY_BUFFER_VIEWS,XA=fA.TYPED_ARRAY_CONSTRUCTOR,WA=fA.TYPED_ARRAY_TAG,qA=fA.TypedArray,JA=fA.TypedArrayPrototype,ZA=fA.aTypedArrayConstructor,$A=fA.isTypedArray,QA=function(e,t){ZA(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},eC=function(e,t){BA(e,t,{get:function(){return xA(this)[t]}})},tC=function(e){var t;return OA(zA,e)||"ArrayBuffer"==(t=IA(e))||"SharedArrayBuffer"==t},rC=function(e,t){return $A(e)&&!AA(t)&&t in e&&EA(+t)&&t>=0},nC=function(e,t){return t=bA(t),rC(e,t)?vA(2,e[t]):jA(e,t)},iC=function(e,t,r){return t=bA(t),!(rC(e,t)&&RA(r)&&TA(r,"value"))||TA(r,"get")||TA(r,"set")||r.configurable||TA(r,"writable")&&!r.writable||TA(r,"enumerable")&&!r.enumerable?BA(e,t,r):(e[t]=r.value,e)};lA?(KA||(UA.f=nC,MA.f=iC,eC(JA,"buffer"),eC(JA,"byteOffset"),eC(JA,"byteLength"),eC(JA,"length")),cA({target:"Object",stat:!0,forced:!KA},{getOwnPropertyDescriptor:nC,defineProperty:iC}),iR.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=uA[i],c=s,u=c&&c.prototype,d={},l=function(e,t){BA(e,t,{get:function(){return function(e,t){var r=xA(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=xA(e);r&&(i=(i=FA(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};KA?hA&&(c=t((function(e,t,r,i){return _A(e,u),LA(RA(t)?tC(t)?void 0!==i?new s(t,yA(r,n),i):void 0!==r?new s(t,yA(r,n)):new s(t):$A(t)?QA(c,t):dA(DA,c,t):new s(gA(t)),e,c)})),NA&&NA(c,qA),kA(wA(s),(function(e){e in c||mA(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,i){_A(e,u);var o,a,s,d=0,h=0;if(RA(t)){if(!tC(t))return $A(t)?QA(c,t):dA(DA,c,t);o=t,h=yA(r,n);var f=t.byteLength;if(void 0===i){if(f%n)throw GA("Wrong length");if((a=f-h)<0)throw GA("Wrong length")}else if((a=SA(i)*n)+h>f)throw GA("Wrong length");s=a/n}else s=gA(t),o=new HA(a=s*n);for(VA(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new YA(o)});d<s;)l(e,d++)})),NA&&NA(c,qA),u=c.prototype=CA(JA)),u.constructor!==c&&mA(u,"constructor",c),mA(u,XA,c),WA&&mA(u,WA,i),d[i]=c,cA({global:!0,forced:c!=s,sham:!KA},d),"BYTES_PER_ELEMENT"in c||mA(c,"BYTES_PER_ELEMENT",n),"BYTES_PER_ELEMENT"in u||mA(u,"BYTES_PER_ELEMENT",n),PA(i)}):iR.exports=function(){},(0,iR.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var oC=ke,aC=Kr,sC=Zr,cC=Math.min,uC=[].copyWithin||function(e,t){var r=oC(this),n=sC(r),i=aC(e,n),o=aC(t,n),a=arguments.length>2?arguments[2]:void 0,s=cC((void 0===a?n:aC(a,n))-o,n-i),c=1;for(o<i&&i<o+s&&(c=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:delete r[i],i+=c,o+=c;return r},dC=xR,lC=T(uC),hC=dC.aTypedArray;(0,dC.exportTypedArrayMethod)("copyWithin",(function(e,t){return lC(hC(this),e,t,arguments.length>2?arguments[2]:void 0)}));var fC=Pi.every,pC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("every",(function(e){return fC(pC(this),e,arguments.length>1?arguments[1]:void 0)}));var _C=d,vC=HT,mC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return _C(vC,mC(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var EC=Zr,SC=Ru,gC=xR.TYPED_ARRAY_CONSTRUCTOR,yC=xR.aTypedArrayConstructor,bC=function(e){return yC(SC(e,e[gC]))},TC=function(e,t){for(var r=0,n=EC(t),i=new e(n);n>r;)i[r]=t[r++];return i},IC=bC,RC=Pi.filter,AC=function(e,t){return TC(IC(e),t)},CC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("filter",(function(e){var t=RC(CC(this),e,arguments.length>1?arguments[1]:void 0);return AC(this,t)}));var OC=Pi.find,NC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("find",(function(e){return OC(NC(this),e,arguments.length>1?arguments[1]:void 0)}));var wC=Pi.findIndex,DC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("findIndex",(function(e){return wC(DC(this),e,arguments.length>1?arguments[1]:void 0)}));var kC=Pi.forEach,PC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("forEach",(function(e){kC(PC(this),e,arguments.length>1?arguments[1]:void 0)}));var MC=rn.includes,UC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("includes",(function(e){return MC(UC(this),e,arguments.length>1?arguments[1]:void 0)}));var LC=rn.indexOf,xC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("indexOf",(function(e){return LC(xC(this),e,arguments.length>1?arguments[1]:void 0)}));var VC=n,BC=o,jC=T,FC=xR,GC=gf,HC=Ze("iterator"),zC=VC.Uint8Array,YC=jC(GC.values),KC=jC(GC.keys),XC=jC(GC.entries),WC=FC.aTypedArray,qC=FC.exportTypedArrayMethod,JC=zC&&zC.prototype,ZC=!BC((function(){JC[HC].call([1])})),$C=!!JC&&JC.values&&JC[HC]===JC.values&&"values"===JC.values.name,QC=function(){return YC(WC(this))};qC("entries",(function(){return XC(WC(this))}),ZC),qC("keys",(function(){return KC(WC(this))}),ZC),qC("values",QC,ZC||!$C,{name:"values"}),qC(HC,QC,ZC||!$C,{name:"values"});var eO=xR.aTypedArray,tO=xR.exportTypedArrayMethod,rO=T([].join);tO("join",(function(e){return rO(eO(this),e)}));var nO=fa,iO=V,oO=Gr,aO=Zr,sO=Ui,cO=Math.min,uO=[].lastIndexOf,dO=!!uO&&1/[1].lastIndexOf(1,-0)<0,lO=sO("lastIndexOf"),hO=dO||!lO?function(e){if(dO)return nO(uO,this,arguments)||0;var t=iO(this),r=aO(t),n=r-1;for(arguments.length>1&&(n=cO(n,oO(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:uO,fO=fa,pO=hO,_O=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return fO(pO,_O(this),t>1?[e,arguments[1]]:[e])}));var vO=Pi.map,mO=bC,EO=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("map",(function(e){return vO(EO(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(mO(e))(t)}))}));var SO=ym.left,gO=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return SO(gO(this),e,t,t>1?arguments[1]:void 0)}));var yO=ym.right,bO=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return yO(bO(this),e,t,t>1?arguments[1]:void 0)}));var TO=xR.aTypedArray,IO=xR.exportTypedArrayMethod,RO=Math.floor;IO("reverse",(function(){for(var e,t=this,r=TO(t).length,n=RO(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var AO=n,CO=d,OO=xR,NO=Zr,wO=$R,DO=ke,kO=o,PO=AO.RangeError,MO=AO.Int8Array,UO=MO&&MO.prototype,LO=UO&&UO.set,xO=OO.aTypedArray,VO=OO.exportTypedArrayMethod,BO=!kO((function(){var e=new Uint8ClampedArray(2);return CO(LO,e,{length:1,0:3},1),3!==e[1]})),jO=BO&&OO.NATIVE_ARRAY_BUFFER_VIEWS&&kO((function(){var e=new MO(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));VO("set",(function(e){xO(this);var t=wO(arguments.length>1?arguments[1]:void 0,1),r=DO(e);if(BO)return CO(LO,this,r,t);var n=this.length,i=NO(r),o=0;if(i+t>n)throw PO("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!BO||jO);var FO=bC,GO=Pa,HO=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("slice",(function(e,t){for(var r=GO(HO(this),e,t),n=FO(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),o((function(){new Int8Array(1).slice()})));var zO=Pi.some,YO=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("some",(function(e){return zO(YO(this),e,arguments.length>1?arguments[1]:void 0)}));var KO=n,XO=T,WO=o,qO=ve,JO=rT,ZO=xR,$O=iT,QO=oT,eN=ee,tN=sT,rN=KO.Array,nN=ZO.aTypedArray,iN=ZO.exportTypedArrayMethod,oN=KO.Uint16Array,aN=oN&&XO(oN.prototype.sort),sN=!(!aN||WO((function(){aN(new oN(2),null)}))&&WO((function(){aN(new oN(2),{})}))),cN=!!aN&&!WO((function(){if(eN)return eN<74;if($O)return $O<67;if(QO)return!0;if(tN)return tN<602;var e,t,r=new oN(516),n=rN(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(aN(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));iN("sort",(function(e){return void 0!==e&&qO(e),cN?aN(this,e):JO(nN(this),function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}}(e))}),!cN||sN);var uN=qr,dN=Kr,lN=bC,hN=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("subarray",(function(e,t){var r=hN(this),n=r.length,i=dN(e,n);return new(lN(r))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,uN((void 0===t?n:dN(t,n))-i))}));var fN=fa,pN=xR,_N=o,vN=Pa,mN=n.Int8Array,EN=pN.aTypedArray,SN=pN.exportTypedArrayMethod,gN=[].toLocaleString,yN=!!mN&&_N((function(){gN.call(new mN(1))}));SN("toLocaleString",(function(){return fN(gN,yN?vN(EN(this)):EN(this),vN(arguments))}),_N((function(){return[1,2].toLocaleString()!=new mN([1,2]).toLocaleString()}))||!_N((function(){mN.prototype.toLocaleString.call([1,2])})));var bN=xR.exportTypedArrayMethod,TN=o,IN=T,RN=n.Uint8Array,AN=RN&&RN.prototype||{},CN=[].toString,ON=IN([].join);TN((function(){CN.call({})}))&&(CN=function(){return ON(this)});var NN=AN.toString!=CN;bN("toString",CN,NN);var wN=Fn,DN=n,kN=fa,PN=B,MN=Pa,UN=Cu,LN=/MSIE .\./.test(X),xN=DN.Function,VN=function(e){return function(t,r){var n=UN(arguments.length,1)>2,i=PN(t)?t:xN(t),o=n?MN(arguments,2):void 0;return e(n?function(){kN(i,this,o)}:i,r)}};wN({global:!0,bind:!0,forced:LN},{setTimeout:VN(DN.setTimeout),setInterval:VN(DN.setInterval)});var BN=Fn,jN=Pi.findIndex,FN=gh,GN=!0;"findIndex"in[]&&Array(1).findIndex((function(){GN=!1})),BN({target:"Array",proto:!0,forced:GN},{findIndex:function(e){return jN(this,e,arguments.length>1?arguments[1]:void 0)}}),FN("findIndex");var HN,zN,YN=Ic,KN=FI.ArrayBuffer;Fn({global:!0,forced:n.ArrayBuffer!==KN},{ArrayBuffer:KN}),YN("ArrayBuffer"),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVALID_TOKEN="INVALID_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_EXCEED_MAX_LENGTH="USER_MESSAGE_EXCEED_MAX_LENGTH",e.USER_MESSAGE_EMPTY_USER="USER_MESSAGE_EMPTY_USER",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN"}(HN||(HN={})),function(e){e[e.AUDIO_MIXING_ERROR_OK=0]="AUDIO_MIXING_ERROR_OK",e[e.AUDIO_MIXING_ERROR_PRELOAD_FAILED=1]="AUDIO_MIXING_ERROR_PRELOAD_FAILED",e[e.AUDIO_MIXING_ERROR_START_FAILED=2]="AUDIO_MIXING_ERROR_START_FAILED",e[e.AUDIO_MIXING_ERROR_ID_NOT_FOUND=3]="AUDIO_MIXING_ERROR_ID_NOT_FOUND",e[e.AUDIO_MIXING_ERROR_SET_POSITION_FAILED=4]="AUDIO_MIXING_ERROR_SET_POSITION_FAILED",e[e.AUDIO_MIXING_ERROR_INVALID_VOLUME=5]="AUDIO_MIXING_ERROR_INVALID_VOLUME",e[e.AUDIO_MIXING_ERROR_LOAD_CONFLICT=6]="AUDIO_MIXING_ERROR_LOAD_CONFLICT",e[e.AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH=7]="AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH",e[e.AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH=8]="AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH",e[e.AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK=9]="AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK"}(zN||(zN={}));var XN=function(e,t,r){this.code=e,this.message=t,this.error=r},WN=a,qN=T,JN=bo,ZN=V,$N=qN(l.f),QN=qN([].push),ew=function(e){return function(t){for(var r,n=ZN(t),i=JN(n),o=i.length,a=0,s=[];o>a;)r=i[a++],WN&&!$N(n,r)||QN(s,e?[r,n[r]]:n[r]);return s}},tw={entries:ew(!0),values:ew(!1)}.entries;Fn({target:"Object",stat:!0},{entries:function(e){return tw(e)}});var rw=Gr,nw=va,iw=U,ow=n.RangeError,aw=T,sw=qr,cw=va,uw=function(e){var t=nw(iw(this)),r="",n=rw(e);if(n<0||n==1/0)throw ow("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},dw=U,lw=aw(uw),hw=aw("".slice),fw=Math.ceil,pw=function(e){return function(t,r,n){var i,o,a=cw(dw(t)),s=sw(r),c=a.length,u=void 0===n?" ":cw(n);return s<=c||""==u?a:((o=lw(u,fw((i=s-c)/u.length))).length>i&&(o=hw(o,0,i)),e?a+o:o+a)}},_w={start:pw(!1),end:pw(!0)},vw=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(X),mw=_w.end;Fn({target:"String",proto:!0,forced:vw},{padEnd:function(e){return mw(this,e,arguments.length>1?arguments[1]:void 0)}});var Ew=dv;Fn({target:"Number",stat:!0,forced:Number.parseInt!=Ew},{parseInt:Ew});Fn({target:"ArrayBuffer",stat:!0,forced:!xR.NATIVE_ARRAY_BUFFER_VIEWS},{isView:xR.isView}),Fn({global:!0,forced:!OT},{DataView:FI.DataView});var Sw=Dt,gw=Wc,yw=Yn,bw=d,Tw=ke,Iw=function(e,t,r,n){try{return n?t(Sw(r)[0],r[1]):t(r)}catch(t){gw(e,"throw",t)}},Rw=kc,Aw=mi,Cw=Zr,Ow=ya,Nw=zc,ww=xc,Dw=n.Array,kw=function(e){var t=Tw(e),r=Aw(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=yw(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=ww(t),f=0;if(!h||this==Dw&&Rw(h))for(a=Cw(t),s=r?new this(a):Dw(a);a>f;f++)l=o?i(t[f],f):t[f],Ow(s,f,l);else for(d=(u=Nw(t,h)).next,s=r?new this:[];!(c=bw(d,u)).done;f++)l=o?Iw(u,i,[c.value,f],!0):c.value,Ow(s,f,l);return s.length=f,s},Pw=kw;Fn({target:"Array",stat:!0,forced:!mu((function(e){Array.from(e)}))},{from:Pw});var Mw,Uw=Fn,Lw=Xn,xw=T([].reverse),Vw=[1,2];Uw({target:"Array",proto:!0,forced:String(Vw)===String(Vw.reverse())},{reverse:function(){return Lw(this)&&(this.length=this.length),xw(this)}});var Bw=new Uint8Array(16);function jw(){if(!Mw&&!(Mw="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Mw(Bw)}var Fw=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Gw(e){return"string"==typeof e&&Fw.test(e)}for(var Hw=[],zw=0;zw<256;++zw)Hw.push((zw+256).toString(16).substr(1));function Yw(e,t,r){var n=(e=e||{}).random||(e.rng||jw)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(Hw[e[t+0]]+Hw[e[t+1]]+Hw[e[t+2]]+Hw[e[t+3]]+"-"+Hw[e[t+4]]+Hw[e[t+5]]+"-"+Hw[e[t+6]]+Hw[e[t+7]]+"-"+Hw[e[t+8]]+Hw[e[t+9]]+"-"+Hw[e[t+10]]+Hw[e[t+11]]+Hw[e[t+12]]+Hw[e[t+13]]+Hw[e[t+14]]+Hw[e[t+15]]).toLowerCase();if(!Gw(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var Kw=new TextDecoder,Xw=new TextEncoder,Ww=function(){return Yw()},qw=function(){return Date.now()};function Jw(e){for(var t,r,n,i,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=Up(o),u=c.next();!u.done;u=c.next()){s+=(p=u.value).length}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}var d=new e(s),l=0;try{for(var h=Up(o),f=h.next();!f.done;f=h.next()){var p=f.value;d.set(p,l),l+=p.length}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return d}var Zw=function(){return"undefined"==typeof window},$w=function(){function e(){}return e.token2auth=function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))},e.createUnsafeToken=function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))},e.merge=function(t,r){var n,i;void 0===t&&(t={}),void 0===r&&(r={});try{for(var o=Up(Object.entries(t)),a=o.next();!a.done;a=o.next()){var s=Lp(a.value,2),c=s[0],u=s[1];null!==u&&"object"===uo(u)?e.merge(t[c],r[c]):void 0!==r[c]&&(t[c]=r[c])}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}},e.ab2str=function(e){return Kw.decode(e)},e.ab2obj=function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(e){return{}}},e.str2ab=function(e){return Xw.encode(e).buffer},e.ab2b64str=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var r=new FileReader;r.onload=function(){return t(r.result)},r.readAsDataURL(new Blob([e]))}))];case 1:return[2,t.sent().split(",",2)[1]]}}))}))},e.b64str2ab=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function Qw(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,r){var n=r===t.length-1?"0":"1";return Number.parseInt(n+e.join(""),2)}))}function eD(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function tD(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var r=ArrayBuffer.isView(t)?t.buffer:t,n=r.byteLength,i=[];if(n>10){var o=new DataView(r),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return n-1-t})).reverse().map((function(e){return o.getUint8(e)}));i=xp(xp(xp([],Lp(a),!1),["..."],!1),Lp(s),!1)}else i=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(n,") [").concat(i.join(", "),"]")}if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var rD,nD=function(){return Pp(void 0,void 0,void 0,(function(){var e,t;return Mp(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),e.addTransceiver("audio",{direction:"recvonly"}),e.addTransceiver("video",{direction:"recvonly"}),[4,e.createOffer()];case 1:return t=r.sent(),e.close(),[2,t.sdp];case 2:return r.sent(),[3,3];case 3:return[2]}}))}))};function iD(e,t){if("boolean"!=typeof e)throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function oD(e,t,r,n){if(void 0===r&&(r=1),void 0===n&&(n=Number.POSITIVE_INFINITY),e<r||e>n||"number"!=typeof e)throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"))}function aD(e,t,r,n){if(void 0===r&&(r=1),void 0===n&&(n=Number.POSITIVE_INFINITY),null==e)throw new XN(HN.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e,t,r){void 0===t&&(t=1);void 0===r&&(r=Number.POSITIVE_INFINITY);return"string"==typeof e&&e.length<=r&&e.length>=t}(e,r,n))throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function sD(e,t,r){if(!r.includes(e))throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function cD(e,t){if(lD(e))throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function uD(e,t){if(!(e instanceof ArrayBuffer))throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function dD(e){var t,r;try{var n=navigator.mediaDevices.getSupportedConstraints();try{for(var i=Up(Object.keys(e)),o=i.next();!o.done;o=i.next()){var a=o.value;n[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}catch(e){}}function lD(e){return null==e}function hD(e){if("string"!=typeof e||!/^[a-zA-Z0-9 \_\-\@]{1,128}$/.test(e))throw new XN(HN.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_")}function fD(e){cD(e,"videoPlayerOption")}function pD(e,t){var r,n;if(void 0===t&&(t=64),!e||0===(null===(r=e)||void 0===r?void 0:r.byteLength))throw new XN(HN.INVALID_PARAMS,"The message cannot be empty");if((null==(n=e instanceof ArrayBuffer?e:$w.str2ab(JSON.stringify(e)))?void 0:n.byteLength)>1e3*t)throw new XN(HN.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function _D(e){return![rD.onRemoteStreamStats,rD.onLocalStreamStats].includes(e)}!function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onStreamAdd="onStreamAdd",e.onStreamRemove="onStreamRemove",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onUserMuteAudio="onUserMuteAudio",e.onUserMuteVideo="onUserMuteVideo",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onMediaDeviceStateChanged="onMediaDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom"}(rD||(rD={}));var vD={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,f=d.length;for(u=0;u<f;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,n);break;case 4:d[u].fn.call(d[u].context,t,n,i);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||n&&s[c].context!==n)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(vD);var mD=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},ED=d,SD=Dt,gD=U,yD=mD,bD=va,TD=Ee,ID=L_;C_("search",(function(e,t,r){return[function(t){var r=gD(this),n=null==t?void 0:TD(t,e);return n?ED(n,t,r):new RegExp(t)[e](bD(r))},function(e){var n=SD(this),i=bD(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;yD(a,0)||(n.lastIndex=0);var s=ID(n,i);return yD(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var RD=["#0050b3","#0050b3","#0050b3","#0050b3"],AD=!Zw()&&window.location.search.includes("_rtc_debug_"),CD=function(){function e(e,t,r){this._module=e,this._indent=t}return e.prototype.print=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(AD){for(var n="",i=0;i<this._indent;i++)n+=" ";console.log.apply(console,xp(["%c".concat("[VERTC]").concat(n,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(RD[this._indent],";")],Lp(t),!1))}},e}(),OD=new CD("VERTC",0),ND=function(e){function t(){return e.call(this)||this}return wp(t,e),t.prototype.safeEmit=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=this.listenerCount(t);try{return e.prototype.emit.apply(this,xp([t],Lp(r),!1))}catch(e){return OD.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(i)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return Pp(this,void 0,void 0,(function(){var r=this;return Mp(this,(function(n){return[2,new Promise((function(n,i){try{r.emit.apply(r,xp(xp([e],Lp(t),!1),[n,i],!1))}catch(t){OD.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),i(t)}}))]}))}))},t}(vD.exports.EventEmitter),wD=Ue,DD=function(e){return void 0!==e&&(wD(e,"value")||wD(e,"writable"))},kD=d,PD=F,MD=Dt,UD=DD,LD=i,xD=wh;Fn({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return MD(t)===o?t[r]:(n=LD.f(t,r))?UD(n)?n.value:void 0===n.get?void 0:kD(n.get,o):PD(i=xD(t))?e(i,r,o):void 0}});var VD=Fn,BD=d,jD=Dt,FD=F,GD=DD,HD=Rt,zD=i,YD=wh,KD=m;var XD,WD,qD,JD,ZD,$D,QD,ek,tk,rk,nk,ik,ok,ak,sk,ck,uk,dk=o((function(){var e=function(){},t=HD.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));VD({target:"Reflect",stat:!0,forced:dk},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],c=zD.f(jD(t),r);if(!c){if(FD(o=YD(t)))return e(o,r,n,s);c=KD(0)}if(GD(c)){if(!1===c.writable||!FD(s))return!1;if(i=zD.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,HD.f(s,r,i)}else HD.f(s,r,KD(0,n))}else{if(void 0===(a=c.set))return!1;BD(a,s,n)}return!0}}),function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(XD||(XD={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(WD||(WD={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(qD||(qD={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(JD||(JD={})),function(e){e[e.MUTE_STATE_OFF=0]="MUTE_STATE_OFF",e[e.MUTE_STATE_ON=1]="MUTE_STATE_ON"}(ZD||(ZD={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}($D||($D={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(QD||(QD={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(ek||(ek={})),function(e){e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO=0]="RTC_PAUSE_RESUME_CONTROL_AUDIO",e[e.RTC_PAUSE_RESUME_CONTROL_VIDEO=1]="RTC_PAUSE_RESUME_CONTROL_VIDEO",e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO=2]="RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO"}(tk||(tk={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(rk||(rk={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(nk||(nk={})),function(e){e[e.AUDIO_ONLY=0]="AUDIO_ONLY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.AUDIO_AND_VIDEO=2]="AUDIO_AND_VIDEO",e[e.NONE=3]="NONE"}(ik||(ik={})),function(e){e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER"}(ok||(ok={})),function(e){e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED"}(ak||(ak={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(sk||(sk={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(ck||(ck={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(uk||(uk={}));var lk="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function hk(e){return void 0===e&&(e=""),e.endsWith("com")||e.endsWith("net")||e.endsWith("org")?"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo"):e}var fk={VERSION:"4.38.0",ICE_CONFIG_REQUEST_URLS_INTERNAL:lk.map(hk),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:"https://web-log-report.rtcplus.com/video/v1/webrtc_log/"};function pk(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(fk.ICE_CONFIG_REQUEST_URLS=t.map(hk))):void("LOG_SERVER_URL"!==e||t!==ck.overseas?"LOG_SERVER_URL"!==e||t!==ck.domestic?fk[e]=t:fk.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/":fk.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function _k(e){return fk[e]}function vk(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||"AAC",bitRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.kBitRate)||48),sampleRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.sampleRate)||44.1),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||1,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||"LC"},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||"H264",fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||15,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||30,lowLatency:null===(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)||void 0===l||l,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||40),width:(null===(f=t.video)||void 0===f?void 0:f.width)||640,height:(null===(p=t.video)||void 0===p?void 0:p.height)||360},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||"#000000"},regions:(null===(m=null===(v=t.layout)||void 0===v?void 0:v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(E=t.layout)||void 0===E?void 0:E.appData)||""}}}}(0,iR.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,iR.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var mk={};!function(e){var t="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==uo(n))throw new TypeError(n+"must be non-object");for(var i in n)r(n,i)&&(e[i]=n[i])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},i={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)}(mk);var Ek={},Sk={},gk={},yk=mk;function bk(e){for(var t=e.length;--t>=0;)e[t]=0}var Tk=[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],Ik=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Rk=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Ak=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Ck=new Array(576);bk(Ck);var Ok=new Array(60);bk(Ok);var Nk=new Array(512);bk(Nk);var wk=new Array(256);bk(wk);var Dk=new Array(29);bk(Dk);var kk,Pk,Mk,Uk=new Array(30);function Lk(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function xk(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Vk(e){return e<256?Nk[e]:Nk[256+(e>>>7)]}function Bk(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function jk(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,Bk(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function Fk(e,t,r){jk(e,r[2*t],r[2*t+1])}function Gk(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function Hk(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=15;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=Gk(o[s]++,s))}}function zk(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Yk(e){e.bi_valid>8?Bk(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Kk(e,t,r,n){var i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function Xk(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&Kk(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Kk(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function Wk(e,t,r){var n,i,o,a,s=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===n?Fk(e,i,t):(Fk(e,(o=wk[i])+256+1,t),0!==(a=Tk[o])&&jk(e,i-=Dk[o],a),Fk(e,o=Vk(--n),r),0!==(a=Ik[o])&&jk(e,n-=Uk[o],a))}while(s<e.last_lit);Fk(e,256,t)}function qk(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<c;r++)0!==o[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)Xk(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Xk(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,Xk(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,_=0;for(o=0;o<=15;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=c[2*c[2*(n=e.heap[r])+1]+1]+1)>p&&(o=p,_++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=f&&(a=h[n-f]),s=c[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==_){do{for(o=p-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[p]--,_-=2}while(_>0);for(o=p;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),Hk(o,u,e.bl_count)}function Jk(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))}function Zk(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{Fk(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(Fk(e,i,e.bl_tree),s--),Fk(e,16,e.bl_tree),jk(e,s-3,2)):s<=10?(Fk(e,17,e.bl_tree),jk(e,s-3,3)):(Fk(e,18,e.bl_tree),jk(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}bk(Uk);var $k=!1;function Qk(e,t,r,n){jk(e,0+(n?1:0),3),function(e,t,r,n){Yk(e),n&&(Bk(e,r),Bk(e,~r)),yk.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}gk._tr_init=function(e){$k||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(Dk[n]=r,e=0;e<1<<Tk[n];e++)wk[r++]=n;for(wk[r-1]=n,i=0,n=0;n<16;n++)for(Uk[n]=i,e=0;e<1<<Ik[n];e++)Nk[i++]=n;for(i>>=7;n<30;n++)for(Uk[n]=i<<7,e=0;e<1<<Ik[n]-7;e++)Nk[256+i++]=n;for(t=0;t<=15;t++)o[t]=0;for(e=0;e<=143;)Ck[2*e+1]=8,e++,o[8]++;for(;e<=255;)Ck[2*e+1]=9,e++,o[9]++;for(;e<=279;)Ck[2*e+1]=7,e++,o[7]++;for(;e<=287;)Ck[2*e+1]=8,e++,o[8]++;for(Hk(Ck,287,o),e=0;e<30;e++)Ok[2*e+1]=5,Ok[2*e]=Gk(e,5);kk=new Lk(Ck,Tk,257,286,15),Pk=new Lk(Ok,Ik,0,30,15),Mk=new Lk(new Array(0),Rk,0,19,7)}(),$k=!0),e.l_desc=new xk(e.dyn_ltree,kk),e.d_desc=new xk(e.dyn_dtree,Pk),e.bl_desc=new xk(e.bl_tree,Mk),e.bi_buf=0,e.bi_valid=0,zk(e)},gk._tr_stored_block=Qk,gk._tr_flush_block=function(e,t,r,n){var i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),qk(e,e.l_desc),qk(e,e.d_desc),a=function(e){var t;for(Jk(e,e.dyn_ltree,e.l_desc.max_code),Jk(e,e.dyn_dtree,e.d_desc.max_code),qk(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Ak[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?Qk(e,t,r,n):4===e.strategy||o===i?(jk(e,2+(n?1:0),3),Wk(e,Ck,Ok)):(jk(e,4+(n?1:0),3),function(e,t,r,n){var i;for(jk(e,t-257,5),jk(e,r-1,5),jk(e,n-4,4),i=0;i<n;i++)jk(e,e.bl_tree[2*Ak[i]+1],3);Zk(e,e.dyn_ltree,t-1),Zk(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Wk(e,e.dyn_ltree,e.dyn_dtree)),zk(e),n&&Yk(e)},gk._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(wk[r]+256+1)]++,e.dyn_dtree[2*Vk(t)]++),e.last_lit===e.lit_bufsize-1},gk._tr_align=function(e){jk(e,2,3),Fk(e,256,Ck),function(e){16===e.bi_valid?(Bk(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)};var eP=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0};var tP=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var rP,nP=function(e,t,r,n){var i=tP,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},iP={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"},oP=mk,aP=gk,sP=eP,cP=nP,uP=iP;function dP(e,t){return e.msg=uP[t],t}function lP(e){return(e<<1)-(e>4?9:0)}function hP(e){for(var t=e.length;--t>=0;)e[t]=0}function fP(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(oP.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function pP(e,t){aP._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,fP(e.strm)}function _P(e,t){e.pending_buf[e.pending++]=t}function vP(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function mP(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+258,f=u[o+a-1],p=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===f&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<h);if(n=258-(h-o),o=h-258,n>a){if(e.match_start=t,a=n,n>=s)break;f=u[o+a-1],p=u[o+a]}}}while((t=l[t&d])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function EP(e){var t,r,n,i,o,a,s,c,u,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-262)){oP.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=i,d=void 0,(d=a.avail_in)>u&&(d=u),r=0===d?0:(a.avail_in-=d,oP.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=sP(a.adler,s,d,c):2===a.state.wrap&&(a.adler=cP(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=r,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)}function SP(e,t){for(var r,n;;){if(e.lookahead<262){if(EP(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-262&&(e.match_length=mP(e,r)),e.match_length>=3)if(n=aP._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=aP._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(pP(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(pP(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(pP(e,!1),0===e.strm.avail_out)?1:2}function gP(e,t){for(var r,n,i;;){if(e.lookahead<262){if(EP(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-262&&(e.match_length=mP(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=aP._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(pP(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=aP._tr_tally(e,0,e.window[e.strstart-1]))&&pP(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=aP._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(pP(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(pP(e,!1),0===e.strm.avail_out)?1:2}function yP(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function bP(){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 oP.Buf16(1146),this.dyn_dtree=new oP.Buf16(122),this.bl_tree=new oP.Buf16(78),hP(this.dyn_ltree),hP(this.dyn_dtree),hP(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new oP.Buf16(16),this.heap=new oP.Buf16(573),hP(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new oP.Buf16(573),hP(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 TP(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:113,e.adler=2===t.wrap?0:1,t.last_flush=0,aP._tr_init(t),0):dP(e,-2)}function IP(e){var t,r=TP(e);return 0===r&&((t=e.state).window_size=2*t.w_size,hP(t.head),t.max_lazy_match=rP[t.level].max_lazy,t.good_match=rP[t.level].good_length,t.nice_match=rP[t.level].nice_length,t.max_chain_length=rP[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),r}function RP(e,t,r,n,i,o){if(!e)return-2;var a=1;if(-1===t&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||8!==r||n<8||n>15||t<0||t>9||o<0||o>4)return dP(e,-2);8===n&&(n=9);var s=new bP;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new oP.Buf8(2*s.w_size),s.head=new oP.Buf16(s.hash_size),s.prev=new oP.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new oP.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=r,IP(e)}rP=[new yP(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(EP(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,pP(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(pP(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(pP(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(pP(e,!1),e.strm.avail_out),1)})),new yP(4,4,8,4,SP),new yP(4,5,16,8,SP),new yP(4,6,32,32,SP),new yP(4,4,16,16,gP),new yP(8,16,32,32,gP),new yP(8,16,128,128,gP),new yP(8,32,128,256,gP),new yP(32,128,258,1024,gP),new yP(32,258,258,4096,gP)],Sk.deflateInit=function(e,t){return RP(e,t,8,15,8,0)},Sk.deflateInit2=RP,Sk.deflateReset=IP,Sk.deflateResetKeep=TP,Sk.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?-2:(e.state.gzhead=t,0):-2},Sk.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?dP(e,-2):-2;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&4!==t)return dP(e,0===e.avail_out?-5:-2);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,_P(n,31),_P(n,139),_P(n,8),n.gzhead?(_P(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)),_P(n,255&n.gzhead.time),_P(n,n.gzhead.time>>8&255),_P(n,n.gzhead.time>>16&255),_P(n,n.gzhead.time>>24&255),_P(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),_P(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(_P(n,255&n.gzhead.extra.length),_P(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=cP(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(_P(n,0),_P(n,0),_P(n,0),_P(n,0),_P(n,0),_P(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),_P(n,3),n.status=113);else{var a=8+(n.w_bits-8<<4)<<8;a|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=113,vP(n,a),0!==n.strstart&&(vP(n,e.adler>>>16),vP(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=cP(e.adler,n.pending_buf,n.pending-i,i)),fP(e),i=n.pending,n.pending!==n.pending_buf_size));)_P(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=cP(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=cP(e.adler,n.pending_buf,n.pending-i,i)),fP(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,_P(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=cP(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=cP(e.adler,n.pending_buf,n.pending-i,i)),fP(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,_P(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=cP(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&fP(e),n.pending+2<=n.pending_buf_size&&(_P(n,255&e.adler),_P(n,e.adler>>8&255),e.adler=0,n.status=113)):n.status=113),0!==n.pending){if(fP(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&lP(t)<=lP(r)&&4!==t)return dP(e,-5);if(666===n.status&&0!==e.avail_in)return dP(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(EP(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=aP._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(pP(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(pP(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(pP(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=258){if(EP(e),e.lookahead<=258&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+258;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=258-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=aP._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=aP._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(pP(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(pP(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(pP(e,!1),0===e.strm.avail_out)?1:2}(n,t):rP[n.level].func(n,t);if(3!==s&&4!==s||(n.status=666),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?aP._tr_align(n):5!==t&&(aP._tr_stored_block(n,0,0,!1),3===t&&(hP(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),fP(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(_P(n,255&e.adler),_P(n,e.adler>>8&255),_P(n,e.adler>>16&255),_P(n,e.adler>>24&255),_P(n,255&e.total_in),_P(n,e.total_in>>8&255),_P(n,e.total_in>>16&255),_P(n,e.total_in>>24&255)):(vP(n,e.adler>>>16),vP(n,65535&e.adler)),fP(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},Sk.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&113!==t&&666!==t?dP(e,-2):(e.state=null,113===t?dP(e,-3):0):-2},Sk.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return-2;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return-2;for(1===o&&(e.adler=sP(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(hP(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new oP.Buf8(r.w_size),oP.arraySet(u,t,d-r.w_size,r.w_size,0),t=u,d=r.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,EP(r);r.lookahead>=3;){n=r.strstart,i=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--i);r.strstart=n,r.lookahead=2,EP(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,r.wrap=o,0},Sk.deflateInfo="pako deflate (from Nodeca project)";var AP={},CP=mk,OP=!0,NP=!0;try{String.fromCharCode.apply(null,[0])}catch(e){OP=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){NP=!1}for(var wP=new CP.Buf8(256),DP=0;DP<256;DP++)wP[DP]=DP>=252?6:DP>=248?5:DP>=240?4:DP>=224?3:DP>=192?2:1;function kP(e,t){if(t<65534&&(e.subarray&&NP||!e.subarray&&OP))return String.fromCharCode.apply(null,CP.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}wP[254]=wP[254]=1,AP.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new CP.Buf8(s),o=0,i=0;o<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},AP.buf2binstring=function(e){return kP(e,e.length)},AP.binstring2buf=function(e){for(var t=new CP.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},AP.buf2string=function(e,t){var r,n,i,o,a=t||e.length,s=new Array(2*a);for(n=0,r=0;r<a;)if((i=e[r++])<128)s[n++]=i;else if((o=wP[i])>4)s[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<a;)i=i<<6|63&e[r++],o--;o>1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return kP(s,n)},AP.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+wP[e[r]]>t?r:t};var PP=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},MP=Sk,UP=mk,LP=AP,xP=iP,VP=PP,BP=Object.prototype.toString;function jP(e){if(!(this instanceof jP))return new jP(e);this.options=UP.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new VP,this.strm.avail_out=0;var r=MP.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(xP[r]);if(t.header&&MP.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?LP.string2buf(t.dictionary):"[object ArrayBuffer]"===BP.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=MP.deflateSetDictionary(this.strm,n)))throw new Error(xP[r]);this._dict_set=!0}}function FP(e,t){var r=new jP(t);if(r.push(e,!0),r.err)throw r.msg||xP[r.err];return r.result}jP.prototype.push=function(e,t){var r,n,i=this.strm,o=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=LP.string2buf(e):"[object ArrayBuffer]"===BP.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new UP.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=MP.deflate(i,n))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(LP.buf2binstring(UP.shrinkBuf(i.output,i.next_out))):this.onData(UP.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=MP.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},jP.prototype.onData=function(e){this.chunks.push(e)},jP.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=UP.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},Ek.Deflate=jP,Ek.deflate=FP,Ek.deflateRaw=function(e,t){return(t=t||{}).raw=!0,FP(e,t)},Ek.gzip=function(e,t){return(t=t||{}).gzip=!0,FP(e,t)};var GP={},HP=a,zP=Rt,YP=jp,KP=o,XP=RegExp.prototype;HP&&KP((function(){return"sy"!==Object.getOwnPropertyDescriptor(XP,"flags").get.call({dotAll:!0,sticky:!0})}))&&zP.f(XP,"flags",{configurable:!0,get:YP});var WP={},qP=mk,JP=[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],ZP=[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],$P=[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],QP=[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],eM=mk,tM=eP,rM=nP,nM=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E,S,g,y,b,T,I,R,A;r=e.state,n=e.next_in,R=e.input,i=n+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,d=r.whave,l=r.wnext,h=r.window,f=r.hold,p=r.bits,_=r.lencode,v=r.distcode,m=(1<<r.lenbits)-1,E=(1<<r.distbits)-1;e:do{p<15&&(f+=R[n++]<<p,p+=8,f+=R[n++]<<p,p+=8),S=_[f&m];t:for(;;){if(f>>>=g=S>>>24,p-=g,0===(g=S>>>16&255))A[o++]=65535&S;else{if(!(16&g)){if(0==(64&g)){S=_[(65535&S)+(f&(1<<g)-1)];continue t}if(32&g){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}y=65535&S,(g&=15)&&(p<g&&(f+=R[n++]<<p,p+=8),y+=f&(1<<g)-1,f>>>=g,p-=g),p<15&&(f+=R[n++]<<p,p+=8,f+=R[n++]<<p,p+=8),S=v[f&E];r:for(;;){if(f>>>=g=S>>>24,p-=g,!(16&(g=S>>>16&255))){if(0==(64&g)){S=v[(65535&S)+(f&(1<<g)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&S,p<(g&=15)&&(f+=R[n++]<<p,(p+=8)<g&&(f+=R[n++]<<p,p+=8)),(b+=f&(1<<g)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=g,p-=g,b>(g=o-a)){if((g=b-g)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(T=0,I=h,0===l){if(T+=u-g,g<y){y-=g;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}}else if(l<g){if(T+=u+l-g,(g-=l)<y){y-=g;do{A[o++]=h[T++]}while(--g);if(T=0,l<y){y-=g=l;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}}}else if(T+=l-g,g<y){y-=g;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}for(;y>2;)A[o++]=I[T++],A[o++]=I[T++],A[o++]=I[T++],y-=3;y&&(A[o++]=I[T++],y>1&&(A[o++]=I[T++]))}else{T=o-b;do{A[o++]=A[T++],A[o++]=A[T++],A[o++]=A[T++],y-=3}while(y>2);y&&(A[o++]=A[T++],y>1&&(A[o++]=A[T++]))}break}}break}}while(n<i&&o<s);n-=y=p>>3,f&=(1<<(p-=y<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=f,r.bits=p},iM=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,f,p,_,v,m=s.bits,E=0,S=0,g=0,y=0,b=0,T=0,I=0,R=0,A=0,C=0,O=null,N=0,w=new qP.Buf16(16),D=new qP.Buf16(16),k=null,P=0;for(E=0;E<=15;E++)w[E]=0;for(S=0;S<n;S++)w[t[r+S]]++;for(b=m,y=15;y>=1&&0===w[y];y--);if(b>y&&(b=y),0===y)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(g=1;g<y&&0===w[g];g++);for(b<g&&(b=g),R=1,E=1;E<=15;E++)if(R<<=1,(R-=w[E])<0)return-1;if(R>0&&(0===e||1!==y))return-1;for(D[1]=0,E=1;E<15;E++)D[E+1]=D[E]+w[E];for(S=0;S<n;S++)0!==t[r+S]&&(a[D[t[r+S]]++]=S);if(0===e?(O=k=a,f=19):1===e?(O=JP,N-=257,k=ZP,P-=257,f=256):(O=$P,k=QP,f=-1),C=0,S=0,E=g,h=o,T=b,I=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){p=E-I,a[S]<f?(_=0,v=a[S]):a[S]>f?(_=k[P+a[S]],v=O[N+a[S]]):(_=96,v=0),c=1<<E-I,g=u=1<<T;do{i[h+(C>>I)+(u-=c)]=p<<24|_<<16|v|0}while(0!==u);for(c=1<<E-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,S++,0==--w[E]){if(E===y)break;E=t[r+a[S]]}if(E>b&&(C&l)!==d){for(0===I&&(I=b),h+=g,R=1<<(T=E-I);T+I<y&&!((R-=w[T+I])<=0);)T++,R<<=1;if(A+=1<<T,1===e&&A>852||2===e&&A>592)return 1;i[d=C&l]=b<<24|T<<16|h-o|0}}return 0!==C&&(i[h+C]=E-I<<24|64<<16|0),s.bits=b,0};function oM(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function aM(){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 eM.Buf16(320),this.work=new eM.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function sM(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 eM.Buf32(852),t.distcode=t.distdyn=new eM.Buf32(592),t.sane=1,t.back=-1,0):-2}function cM(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,sM(e)):-2}function uM(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,cM(e))):-2}function dM(e,t){var r,n;return e?(n=new aM,e.state=n,n.window=null,0!==(r=uM(e,t))&&(e.state=null),r):-2}var lM,hM,fM=!0;function pM(e){if(fM){var t;for(lM=new eM.Buf32(512),hM=new eM.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(iM(1,e.lens,0,288,lM,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;iM(2,e.lens,0,32,hM,0,e.work,{bits:5}),fM=!1}e.lencode=lM,e.lenbits=9,e.distcode=hM,e.distbits=5}function _M(e,t,r,n){var i,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new eM.Buf8(o.wsize)),n>=o.wsize?(eM.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),eM.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(eM.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}WP.inflateReset=cM,WP.inflateReset2=uM,WP.inflateResetKeep=sM,WP.inflateInit=function(e){return dM(e,15)},WP.inflateInit2=dM,WP.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E,S,g,y,b,T,I,R,A=0,C=new eM.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(r=e.state).mode&&(r.mode=13),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,T=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,C[0]=255&u,C[1]=u>>>8&255,r.check=rM(r.check,C,2,0),u=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(d-=4,b=8+(15&(u>>>=4)),0===r.wbits)r.wbits=b;else if(b>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:12,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.flags=u,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=rM(r.check,C,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.time=u),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,r.check=rM(r.check,C,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=rM(r.check,C,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=rM(r.check,C,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((f=r.length)>s&&(f=s),f&&(r.head&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),eM.arraySet(r.head.extra,n,o,f,b)),512&r.flags&&(r.check=rM(r.check,n,f,o)),s-=f,o+=f,r.length-=f),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&f<s);if(512&r.flags&&(r.check=rM(r.check,n,f,o)),s-=f,o+=f,b)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&f<s);if(512&r.flags&&(r.check=rM(r.check,n,f,o)),s-=f,o+=f,b)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}u=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=oM(u),u=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(pM(r),r.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(f=r.length){if(f>s&&(f=s),f>c&&(f=c),0===f)break e;eM.arraySet(i,n,o,f,a),s-=f,o+=f,c-=f,a+=f,r.length-=f;break}r.mode=12;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.nlen=257+(31&u),u>>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.lens[O[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,I={bits:r.lenbits},T=iM(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,E=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(E<16)u>>>=v,d-=v,r.lens[r.have++]=E;else{if(16===E){for(R=v+2;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}b=r.lens[r.have-1],f=3+(3&u),u>>>=2,d-=2}else if(17===E){for(R=v+3;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=v,b=0,f=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(R=v+7;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=v,b=0,f=11+(127&(u>>>=v)),u>>>=7,d-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;f--;)r.lens[r.have++]=b}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,I={bits:r.lenbits},T=iM(1,r.lens,0,r.nlen,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},T=iM(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,I),r.distbits=I.bits,T){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,nM(e,h),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,E=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(S=v,g=m,y=E;m=(A=r.lencode[y+((u&(1<<S+g)-1)>>S)])>>>16&255,E=65535&A,!(S+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=S,d-=S,r.back+=S}if(u>>>=v,d-=v,r.back+=v,r.length=E,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=12;break}if(64&m){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(R=r.extra;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<<r.distbits)-1])>>>16&255,E=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(S=v,g=m,y=E;m=(A=r.distcode[y+((u&(1<<S+g)-1)>>S)])>>>16&255,E=65535&A,!(S+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=S,d-=S,r.back+=S}if(u>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=30;break}r.offset=E,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(R=r.extra;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===c)break e;if(f=h-c,r.offset>f){if((f=r.offset-f)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),_=r.window}else _=i,p=a-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do{i[a++]=_[p++]}while(--f);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=n[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?rM(r.check,i,h,a-h):tM(r.check,i,h,a-h)),h=c,(r.flags?u:oM(u))!==r.check){e.msg="incorrect data check",r.mode=30;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}u=0,d=0}r.mode=29;case 29:T=1;break e;case 30:T=-3;break e;case 31:return-4;default:return-2}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&_M(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,r.total+=h,r.wrap&&h&&(e.adler=r.check=r.flags?rM(r.check,i,h,e.next_out-h):tM(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===T&&(T=-5),T},WP.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},WP.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?-2:(r.head=t,t.done=!1,0):-2},WP.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?-2:11===r.mode&&tM(1,t,n,0)!==r.check?-3:_M(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):-2},WP.inflateInfo="pako inflate (from Nodeca project)";var vM={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var mM=WP,EM=mk,SM=AP,gM=vM,yM=iP,bM=PP,TM=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},IM=Object.prototype.toString;function RM(e){if(!(this instanceof RM))return new RM(e);this.options=EM.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new bM,this.strm.avail_out=0;var r=mM.inflateInit2(this.strm,t.windowBits);if(r!==gM.Z_OK)throw new Error(yM[r]);if(this.header=new TM,mM.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=SM.string2buf(t.dictionary):"[object ArrayBuffer]"===IM.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=mM.inflateSetDictionary(this.strm,t.dictionary))!==gM.Z_OK))throw new Error(yM[r])}function AM(e,t){var r=new RM(t);if(r.push(e,!0),r.err)throw r.msg||yM[r.err];return r.result}RM.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?gM.Z_FINISH:gM.Z_NO_FLUSH,"string"==typeof e?s.input=SM.binstring2buf(e):"[object ArrayBuffer]"===IM.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 EM.Buf8(c),s.next_out=0,s.avail_out=c),(r=mM.inflate(s,gM.Z_NO_FLUSH))===gM.Z_NEED_DICT&&u&&(r=mM.inflateSetDictionary(this.strm,u)),r===gM.Z_BUF_ERROR&&!0===d&&(r=gM.Z_OK,d=!1),r!==gM.Z_STREAM_END&&r!==gM.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==gM.Z_STREAM_END&&(0!==s.avail_in||n!==gM.Z_FINISH&&n!==gM.Z_SYNC_FLUSH)||("string"===this.options.to?(i=SM.utf8border(s.output,s.next_out),o=s.next_out-i,a=SM.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&EM.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(EM.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(d=!0)}while((s.avail_in>0||0===s.avail_out)&&r!==gM.Z_STREAM_END);return r===gM.Z_STREAM_END&&(n=gM.Z_FINISH),n===gM.Z_FINISH?(r=mM.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===gM.Z_OK):n!==gM.Z_SYNC_FLUSH||(this.onEnd(gM.Z_OK),s.avail_out=0,!0)},RM.prototype.onData=function(e){this.chunks.push(e)},RM.prototype.onEnd=function(e){e===gM.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=EM.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},GP.Inflate=RM,GP.inflate=AM,GP.inflateRaw=function(e,t){return(t=t||{}).raw=!0,AM(e,t)},GP.ungzip=AM;var CM={};(0,mk.assign)(CM,Ek,GP,vM);var OM,NM,wM,DM,kM,PM,MM,UM,LM,xM,VM,BM,jM,FM,GM,HM,zM,YM,KM,XM,WM,qM,JM,ZM,$M,QM,eU,tU,rU,nU,iU,oU,aU,sU,cU,uU,dU,lU,hU,fU,pU,_U,vU,mU,EU,SU,gU=CM;!function(e){e.RTC_SDK_API_CALL="rtc_sdk_api_call",e.RTC_SDK_CALLBACK="rtc_sdk_callback",e.RTC_RECONNECT="rtc_reconnect",e.RTC_RECONNECTED="rtc_reconnected",e.RTC_GET_ACCESS="rtc_get_access",e.RTC_PRE_ICE_STATE="rtc_pre_ice_state",e.RTC_NODE_CHANGE="rtc_node_change",e.RTC_SIGNALING_MSG_ERROR="rtc_signaling_msg_error",e.RTC_SIGNALING="rtc_signaling",e.RTC_JOIN_ROOM="rtc_join_room",e.RTC_LEAVE_ROOM="rtc_leave_room",e.RTC_BEGIN_CREATE_OFFER="rtc_begin_create_offer",e.RTC_CREATE_OFFER="rtc_create_offer",e.RTC_SET_DESCRIPTION="rtc_set_description",e.RTC_RECV_ANSWER="rtc_recv_answer",e.FIRST_REMOTE_AUDIO_RENDER="first_remote_audio_render",e.FIRST_REMOTE_VIDEO_RENDER="first_remote_video_render",e.RTC_PUBLISH_STAT="rtc_publish_stat",e.RTC_SUBSCRIBE_STAT="rtc_subscribe_stat",e.RTC_AUDIO_DEVICE="rtc_audio_device",e.RTC_MEDIA_STATISTICS="rtc_media_statistics",e.RTC_MESSAGE_STATISTICS="rtc_message_statistics",e.RTC_ERROR="rtc_error",e.RTC_INVOKE_STATUS="rtc_invoke_status",e.RTC_FIRST_FRAME="rtc_first_frame",e.RTC_MUTE_REMOTE="rtc_mute_remote",e.SDK_INIT_ENGINE="sdk_init_engine",e.JOIN_ROOM="join_room",e.P2P_CONNECTION_STATUS="p2p_connection_status",e.P2P_CONNECT_CLOSED="p2p_connect_closed",e.RTC_DEVICE_ERROR="rtc_device_error",e.RTC_VIDEO_DEVICE="rtc_video_device",e.RTC_VIDEO_CAPTURE_EVENT="rtc_video_capture_event",e.RTC_ENCODE_FIRST_FRAME="rtc_encode_first_frame",e.RTC_FIRST_FRAME_ENCODED="rtc_first_frame_encoded",e.RTC_SEND_FIRST_PACKET="rtc_send_first_packet",e.RTC_RECV_FIRST_PACKET="rtc_recv_first_packet",e.RTC_RECV_FIRST_FRAME="rtc_recv_first_frame",e.RTC_DECODE_FIRST_FRAME="rtc_decode_first_frame"}(OM||(OM={})),function(e){e.RTC="rtc"}(NM||(NM={})),function(e){e.W_5="5"}(wM||(wM={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(DM||(DM={})),function(e){e.UNKNOWN="unknown",e.DISCONNECTED="disconnected",e.LAN="lan",e.WIFI="wifi",e.W_2="2g",e.W_3="3g",e.W_4="4g",e.W_5="5g"}(kM||(kM={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(PM||(PM={})),function(e){e.WEBSOCKET_RECONNECTING="websocket reconnecting",e.PEERCONNECTION_RECONNECTING="peerconnection reconnecting",e.DISCONNECTED="DISCONNECTED",e.LAN="LAN",e.WIFI="WIFI",e.W_2="2G",e.W_3="3G",e.W_4="4G",e.W_5="5G",e.UNKNOWN="UNKNOWN"}(MM||(MM={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(UM||(UM={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(LM||(LM={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(xM||(xM={})),function(e){e.REQUEST="request",e.RESPONSE="response",e.KCP_REQUEST="kcp request",e.KCP_RESPONSE="kcp response",e.QUIC_REQUEST="quic request",e.QUIC_RESPONSE="quic response"}(VM||(VM={})),function(e){e.NEW="NEW",e.CHECKING="CHECKING",e.CONNECTED="CONNECTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.DISCONNECTED="DISCONNECTED",e.CLOSED="CLOSED",e.DATACHANNEL_CONNECTING="DATACHANNEL_CONNECTING",e.DATACHANNEL_OPEN="DATACHANNEL_OPEN",e.DATACHANNEL_CLOSING="DATACHANNEL_CLOSING",e.DATACHANNEL_CLOSED="DATACHANNEL_CLOSED"}(BM||(BM={})),function(e){e.SUCCEED="succeed",e.MESSAGE_ID_ERROR="message id error",e.ZIP_FAILED="zip failed",e.UNZIP_FAILED="unzip failed",e.MESSAGE_KEY_EMPTY="message key empty",e.MESSAGE_KEY_PARSE_FAILED="message key parse failed",e.MESSAGE_KEY_INVALID="message key invalid",e.ENCRYPT_FAILED="encrypt failed",e.DECRYPT_FAILED="decrypt failed",e.MESSAGE_TOO_BIG="message too big",e.INVALID_DATA="invalid data",e.MESSAGE_PARSE_FAILED="message parse failed"}(jM||(jM={})),function(e){e.CALL_JOINROOM="call-joinRoom",e.JOINROOM="joinRoom",e.CALL_RECONNECTED="call-reconnected",e.RECONNECTED="reconnected",e.CALL_PUBLISH="call-publish",e.PUBLISH="publish",e.CALL_UPDATESTREAMATTRIBUTES="call-updateStreamAttributes",e.UPDATESTREAMATTRIBUTES="updateStreamAttributes",e.CALL_UNPUBLISH="call-unpublish",e.UNPUBLISH="unpublish",e.CALL_SUBSCRIBE="call-subscribe",e.SUBSCRIBE="subscribe",e.CALL_UPDATESUBSCRIBE="call-updateSubscribe",e.UPDATESUBSCRIBE="updateSubscribe",e.CALL_UNSUBSCRIBE="call-unsubscribe",e.UNSUBSCRIBE="unsubscribe",e.CALL_UPDATEUSERATTRIBUTES="call-updateUserAttributes",e.UPDATEUSERATTRIBUTES="updateUserAttributes",e.CALL_LEAVEROOM="call-leaveRoom",e.LEAVEROOM="leaveRoom",e.ON_USERCONNECTION="on-userConnection",e.ON_USERDISCONNECTION="on-userDisconnection",e.ON_ONADDSTREAM="on-onAddStream",e.ON_ONPUSHSTREAM="on-onPushStream",e.ON_ONREMOVESTREAM="on-onRemoveStream",e.ON_ONPUSHTRACK="on-onPushTrack",e.ON_ONREMOVETRACK="on-onRemoveTrack",e.ON_ONUPDATEUSERATTRIBUTES="on-onUpdateUserAttributes",e.ON_ONUPDATEROOMATTRIBUTES="on-onUpdateRoomAttributes",e.ON_ONUPDATESTREAMATTRIBUTES="on-onUpdateStreamAttributes",e.ON_STREAMFAILED="on-streamFailed",e.ON_POSTPROCESSINGMESSAGE="on-postProcessingMessage",e.ON_ENGINECONTROLMESSAGE="on-engineControlMessage",e.ON_WEBSOCKETENGINECUSTOMMESSAGE="on-websocketEngineCustomMessage",e.UNKNOWN="unknown",e.CALL_UPDATEPUBLISHSTREAMCHANNEL="call-updatePublishStreamChannel",e.UPDATEPUBLISHSTREAMCHANNEL="updatePublishStreamChannel",e.CALL_UPDATESUBSCRIBESTREAMCHANNEL="call-updateSubscribeStreamChannel",e.UPDATESUBSCRIBESTREAMCHANNEL="updateSubscribeStreamChannel",e.ON_ONSTREAMCHANNELCHANGE="on-onStreamChannelChange",e.P2PDIRECT="p2pdirect",e.INTERNAL_CUSTOM="internal_custom",e.REPORT="report",e.CONNECTION_CONTROL="connection_control",e.ON_INTERNAL_CUSTOM="on_internal_custom",e.CONTROLMESSAGE="controlMessage",e.CALL_LOGIN="call-login",e.LOGIN="login",e.CALL_RECONNECTLOGIN="call-reconnectLogin",e.RECONNECTLOGIN="reconnectLogin",e.CALL_LOGOUT="call-logout",e.LOGOUT="logout",e.CALL_UPDATELOGINTOKEN="call-updateLoginToken",e.UPDATELOGINTOKEN="updateLoginToken",e.CALL_SETSERVERPARAMS="call-setServerParams",e.SETSERVERPARAMS="setServerParams",e.CALL_GETPEERONLINESTATUS="call-getPeerOnlineStatus",e.GETPEERONLINESTATUS="getPeerOnlineStatus",e.ON_ONSCENECONFIG="on-onSceneConfig",e.ON_STREAMCONTROLMESSAGE="on-streamControlMessage",e.CALL_STARTPUSHSTREAM="call-startPushStream",e.STARTPUSHSTREAM="startPushStream",e.CALL_STOPPUSHSTREAM="call-stopPushStream",e.STOPPUSHSTREAM="stopPushStream",e.CALL_STARTPULLSTREAM="call-startPullStream",e.STARTPULLSTREAM="startPullStream",e.CALL_STOPPULLSTREAM="call-stopPullStream",e.STOPPULLSTREAM="stopPullStream",e.CALL_UPDATEPULLSTREAM="call-updatePullStream",e.UPDATEPULLSTREAM="updatePullStream",e.ON_ONSTREAMPUSHEDBYOTHER="on-onStreamPushedByOther",e.CALL_UPDATETOKEN="call-updateToken",e.UPDATETOKEN="updateToken",e.ON_ONTOKENWILLEXPIRE="on-onTokenWillExpire"}(FM||(FM={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(GM||(GM={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(HM||(HM={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(zM||(zM={})),function(e){e.W_0="0",e.W_1="1"}(YM||(YM={})),function(e){e.UP="up",e.DOWN="down"}(KM||(KM={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(XM||(XM={})),function(e){e.UP="up",e.DOWN="down"}(WM||(WM={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(qM||(qM={})),function(e){e.W_0="0",e.W_1="1"}(JM||(JM={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown"}(ZM||(ZM={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}($M||($M={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.ON_STREAM_REMOVE="on stream remove",e.PUBLISH_MUTE="publish mute",e.UNKNOWN="unknown",e.ON_STREAM_REMOVE_CLIENT_UNPUBLISHED="on stream remove:client unpublished",e.ON_STREAM_REMOVE_PUBLISH_FAILED="on stream remove:publish failed",e.ON_STREAM_REMOVE_STREAM_REMOVED="on stream remove:stream removed",e.ON_STREAM_REMOVE_CLIENT_DISCONNECTED="on stream remove:client disconnected",e.ON_STREAM_REMOVE_CLIENT_REPUBLISH="on stream remove:client republish"}(QM||(QM={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(eU||(eU={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(tU||(tU={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(rU||(rU={})),function(e){e.LOGIN="login",e.PUBLISHER="publisher",e.UNMUTE="unmute",e.ENABLE="enable",e.PUSH="push",e.PUBLISH="publish",e.ONDEMAND="ondemand",e.SUBSCRIBE="subscribe",e.PUSH_TRACK="push_track",e.REMOTE_UNMUTE="remote_unmute",e.P2P="p2p"}(nU||(nU={})),function(e){e.TIMEOUT="timeout",e.AUDIENCE="audience",e.MUTE="mute",e.DISABLE="disable",e.STOP_PUSH="stop_push",e.UNPUBLISH="unpublish",e.NO_DEMAND="no_demand",e.LEAVE_ROOM="leave_room",e.UNSUBSCRIBE="unsubscribe",e.REMOVE_TRACK="remove_track",e.REMOTE_MUTE="remote_mute",e.USER_LEAVE="user_leave"}(iU||(iU={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(oU||(oU={})),function(e){e.BEGIN="begin",e.END="end"}(aU||(aU={})),function(e){e.BEGIN="begin",e.END="end"}(sU||(sU={})),function(e){e.LEAVE_ROOM="leave_room",e.ACK_FAILED="ack_failed",e.TOKEN_ERROR="token_error",e.SIGNALING_ERROR="signaling_error",e.TIMEOUT_10="timeout_10",e.TIMEOUT_60="timeout_60"}(cU||(cU={})),function(e){e.UNKNOWN="unknown",e.NEW="new",e.CHECKING="checking",e.CONNECTED="connected",e.FAILED="failed",e.SELECTED="selected",e.CLOSING="closing",e.CLOSED="closed"}(uU||(uU={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(dU||(dU={})),function(e){e.UNKNOWN="UNKNOWN",e.AUDIO_RECORD="AUDIO_RECORD",e.AUDIO_PLAYOUT="AUDIO_PLAYOUT",e.VIDEO="VIDEO",e.SHARE_AUDIO_RECORD="SHARE_AUDIO_RECORD",e.SHARE_VIDEO="SHARE_VIDEO"}(lU||(lU={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(hU||(hU={})),function(e){e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped"}(fU||(fU={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2"}(pU||(pU={})),function(e){e.SUCCESS="success",e.CAMERA_DEVICE_NO_PERMISSION="camera_device_no_permission",e.CAMERA_DEVICE_BUSY="camera_device_busy",e.CAMERA_DEVICE_FAILURE="camera_device_failure",e.CAMERA_DEVICE_NOT_FOUND="camera_device_not_found",e.CAMERA_DEVICE_DISCONNECTED="camera_device_disconnected",e.TIMEOUT="timeout",e.ABORT="abort"}(_U||(_U={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(vU||(vU={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(mU||(mU={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(EU||(EU={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(SU||(SU={}));var yU,bU,TU,IU,RU,AU,CU,OU=function(){function e(e){this.monitor=e}return e.prototype.setStats=function(e){var t=this;Object.keys(e).forEach((function(r){t["_"+r]=e[r]})),this.monitor.StartUp()},Object.defineProperty(e.prototype,"event_key",{get:function(){return this._event_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_id",{get:function(){return this._device_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_app_id",{get:function(){return this._rtc_app_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"product_line",{get:function(){return this._product_line},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_version",{get:function(){return this._report_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"os",{get:function(){return this._os},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_version",{get:function(){return this._rtc_sdk_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_timestamp",{get:function(){return this._rtc_timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_git_commit",{get:function(){return this._rtc_sdk_git_commit},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_id",{get:function(){return this._report_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connection_id",{get:function(){return this._connection_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sid",{get:function(){return this._rtc_sid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"engine_session_id",{get:function(){return this._engine_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_business_id",{get:function(){return this._rtc_business_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"project_key",{get:function(){return this._project_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"network_type",{get:function(){return this._network_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app_version",{get:function(){return this._app_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aid",{get:function(){return this._aid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_model",{get:function(){return this._device_model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_brand",{get:function(){return this._device_brand},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"common_extra_info",{get:function(){return this._common_extra_info},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"had_selected_p2p",{get:function(){return this._had_selected_p2p},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_env_type",{get:function(){return this._rtc_env_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"room_id",{get:function(){return this._room_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_id",{get:function(){return this._user_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_session_id",{get:function(){return this._rtc_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_agent",{get:function(){return this._user_agent},enumerable:!1,configurable:!0}),e}(),NU=fk.LOG_SERVER_URL,wU=function(){function e(){var e=this;this.report_id=0,this.dataBuffer=[],this.posting=!1,this.report_common={},this.preSucTime=0,this.errSendDelay=100,this.commonStats=new OU(this),Zw()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)}))}return e.prototype.push=function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))},e.prototype.unshift=function(e){this.dataBuffer=e.concat(this.dataBuffer)},e.prototype.send=function(e,t){var r=this;if(e||this.dataBuffer.length){var n={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},i=new XMLHttpRequest;if(i.timeout=1e4,i.onreadystatechange=function(){if(4===i.readyState){e||(r.posting=!1);var o=void 0;if(200===i.status||304===i.status)try{o=JSON.parse(i.responseText)}catch(e){}o&&0===o.StatusCode?e||t||r.sucSend():e?r.send(e):(r.unshift(n.data),t?r.send():r.errSend())}},i.open("POST",NU,!0),e||(this.posting=!0),!Zw()&&window.location.search.includes("_rtc_debug_"))i.send(JSON.stringify(n));else{var o=gU.gzip(JSON.stringify(n));i.setRequestHeader("Content-Encoding","gzip"),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(o)}}},e.prototype.sucSend=function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)},e.prototype.errSend=function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2},e.prototype.StartUp=function(){var e=this.report_common,t=this.commonStats,r=t.event_key,n=t.device_id,i=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,c=t.rtc_sdk_version,u=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.connection_id,f=t.rtc_sid,p=t.engine_session_id,_=t.rtc_business_id,v=t.project_key,m=t.network_type,E=t.app_version,S=t.aid,g=t.device_model,y=t.device_brand,b=t.common_extra_info,T=t.had_selected_p2p,I=t.rtc_env_type,R=t.user_agent;Object.assign(e,{event_key:r,device_id:n,rtc_app_id:i,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,connection_id:h,rtc_sid:f,engine_session_id:p,rtc_business_id:_,project_key:v,network_type:m,app_version:E,aid:S,device_model:g,device_brand:y,common_extra_info:b,had_selected_p2p:T,rtc_env_type:I,user_agent:R}),this.commonStats.room_id&&(e.room_id=this.commonStats.room_id),this.commonStats.user_id&&(e.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(e.rtc_session_id=this.commonStats.rtc_session_id)},e.prototype.rtcSdkApiCall=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},n);this.push(i)},e.prototype.rtcSdkCallback=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},n);this.push(i)},e.prototype.rtcReconnect=function(e,t,r,n,i){void 0===i&&(i={});var o=Dp({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:n},i);this.push(o)},e.prototype.rtcReconnected=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},r);this.push(n)},e.prototype.rtcGetAccess=function(e,t,r,n,i,o,a){void 0===a&&(a={});var s=Dp({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:n,host:i,connect_session_id:o},a);this.push(s)},e.prototype.rtcPreIceState=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},r);this.push(n)},e.prototype.rtcNodeChange=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},n);this.push(i)},e.prototype.rtcSignalingMsgError=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},n);this.push(i)},e.prototype.rtcSignaling=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Dp({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:n,direction:i},o);this.push(a)},e.prototype.rtcJoinRoom=function(e,t,r,n,i){void 0===i&&(i={});var o=Dp({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:n},i);this.push(o)},e.prototype.rtcLeaveRoom=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},n);this.push(i)},e.prototype.rtcBeginCreateOffer=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},n);this.push(i)},e.prototype.rtcCreateOffer=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Dp({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:r,stream_user_id:n,elapse:i},o);this.push(a)},e.prototype.rtcSetDescription=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=Dp({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:i,stream_user_id:o,elapse:a},s);this.push(c)},e.prototype.rtcRecvAnswer=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=Dp({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:n,direction:i,stream_id:o,stream_user_id:a},s);this.push(c)},e.prototype.firstRemoteAudioRender=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},r);this.push(n)},e.prototype.firstRemoteVideoRender=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},r);this.push(n)},e.prototype.rtcPublishStat=function(e,t,r,n,i){void 0===i&&(i={});var o=Dp({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:n},i);this.push(o)},e.prototype.rtcSubscribeStat=function(e,t,r,n,i){void 0===i&&(i={});var o=Dp({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:n},i);this.push(o)},e.prototype.rtcAudioDevice=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},n);this.push(i)},e.prototype.rtcMediaStatistics=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcMessageStatistics=function(e,t,r,n){void 0===n&&(n={});var i=Dp(Dp(Dp(Dp({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),{media_server_ip:r}),n);this.push(i)},e.prototype.rtcError=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},r);this.push(n)},e.prototype.rtcInvokeStatus=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Dp({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:n,elapse:i},o);this.push(a)},e.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var r=Dp(Dp({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t);this.push(r)},e.prototype.rtcMuteRemote=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now()},e),{media_type:t}),r);this.push(n)},e.prototype.sdkInitEngine=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},r);this.push(n)},e.prototype.joinRoom=function(e,t,r,n,i){void 0===i&&(i={});var o=Dp({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},i);this.push(o)},e.prototype.p2pConnectionStatus=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Dp({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:n,elapse:i},o);this.push(a)},e.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var r=Dp({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},t);this.push(r)},e.prototype.rtcDeviceError=function(e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,_,v){void 0===v&&(v={});var m=Dp({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:r,system_error_code:n,system_api:i,call_parameters:o,location:a,message:s,media_device_id:c,media_device_name:u,elapse:d,scenario:l,event_session_id:h,device_pid:f,device_vid:p,media_mode:_},v);this.push(m)},e.prototype.rtcVideoDevice=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},r);this.push(n)},e.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var r=Dp(Dp({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t);this.push(r)},e.prototype.rtcEncodeFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcFirstFrameEncoded=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcSendFirstPacket=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcRecvFirstPacket=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcRecvFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcDecodeFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e}(),DU=new wU,kU=new wU,PU=DU.commonStats,MU=kU.commonStats;function UU(e){void 0===e&&(e=!1);for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return function(r,n,i){if("function"==typeof i.value){var o=i.value;i.value=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a={};return t.forEach((function(e,t){a[e]=r[t]})),(e?kU:DU).rtcSdkApiCall(n,0,JSON.stringify(tD(r)),a),o.apply(this,r)}}}}function LU(e,t,r){void 0===r&&(r=0),(e===rD.onUserMessageReceivedOutsideRoom||e===rD.onUserBinaryMessageReceivedOutsideRoom?kU:DU).rtcSdkCallback(e,r,JSON.stringify(t))}function xU(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=!1),(n?kU:DU).rtcInvokeStatus(JSON.stringify(t),r,e,"",0)}!function(e){e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted"}(yU||(yU={})),function(e){e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage"}(bU||(bU={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(TU||(TU={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(RU||(RU={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(AU||(AU={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.TIMEOUT=1]="TIMEOUT",e[e.BROKEN=2]="BROKEN",e[e.NO_RECEIVER=3]="NO_RECEIVER",e[e.NO_RELAYPATH=4]="NO_RELAYPATH",e[e.SEND_TO_SERVER_ERROR=17]="SEND_TO_SERVER_ERROR",e[e.SERVER_RESPONSE_ERROR=18]="SERVER_RESPONSE_ERROR",e[e.NOT_JOIN=100]="NOT_JOIN",e[e.INIT=101]="INIT",e[e.NO_CONNECTION=102]="NO_CONNECTION",e[e.EXCEED_MAX_LENGTH=103]="EXCEED_MAX_LENGTH",e[e.EMPTY_USER=104]="EMPTY_USER",e[e.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN"}(CU||(CU={}));var VU,BU,jU=((IU={})[CU.SUCCESS]=[0,"success"],IU[CU.TIMEOUT]=[HN.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],IU[CU.BROKEN]=[HN.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],IU[CU.NO_RECEIVER]=[HN.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],IU[CU.NO_RELAYPATH]=[HN.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],IU[CU.SEND_TO_SERVER_ERROR]=[HN.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],IU[CU.SERVER_RESPONSE_ERROR]=[HN.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],IU[CU.NOT_JOIN]=[HN.USER_MESSAGE_NOT_JOIN,"not join room"],IU[CU.INIT]=[HN.USER_MESSAGE_INIT,"not init."],IU[CU.NO_CONNECTION]=[HN.USER_MESSAGE_NO_CONNECTION,"no connection."],IU[CU.EXCEED_MAX_LENGTH]=[HN.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],IU[CU.EMPTY_USER]=[HN.USER_MESSAGE_EMPTY_USER,"user id is empty."],IU[CU.NOT_LOGIN]=[HN.USER_MESSAGE_NOT_LOGIN,"not login."],IU[CU.SERVER_PARAMS_NOTSET]=[HN.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],IU[CU.UNKNOWN]=[HN.USER_MESSAGE_UNKNOWN,"unknown."],IU),FU=new CD("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(VU||(VU={})),function(e){e[e.C2S=0]="C2S",e[e.C2C=1]="C2C",e[e.C2GW=2]="C2GW",e[e.C2CDirect=3]="C2CDirect",e[e.C2RTM=4]="C2RTM"}(BU||(BU={}));var GU=function(e){function t(t){var r=e.call(this)||this;return r._dataChannel=t,r._singlingCache=new Map,r._p2pCache=new Map,r._rttIds={},r._p2pMessageId=0,r._clearDataChannelListener=r._handleHandler(),window.__rtc_mock_signaling__=r.emit.bind(r),r}return wp(t,e),t.prototype.destroy=function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}},t.prototype.sendSignaling=function(e,t,r){var n=this;return DU.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",GM.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=Qw();var s=a.id.join("-"),c=setTimeout((function(){n._singlingCache.delete(s),o(new XN(HN.TIME_OUT,"".concat(e," message time out")))}),6e4);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),i(e)},error:function(e){clearTimeout(c),o(e)}}),FU.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),n._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:BU.C2GW})},t.prototype.sendP2PMessage=function(e,t){var r=e.msg,n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["msg"]);return Pp(this,void 0,void 0,(function(){var e,i,o,a,s;return Mp(this,(function(c){switch(c.label){case 0:return e=r instanceof ArrayBuffer,i=this._sendP2PMessage,o=[Dp({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:RU.SEND,type:AU.P2P,err:CU.SUCCESS},n)],s={binary:e},e?[4,$w.ab2b64str(r)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=JSON.stringify(r),c.label=3;case 3:return[2,i.apply(this,[Dp.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var r=this;return void 0===t&&(t={}),eD(e.msg)?this._rttIds[e.id]=e.id:FU.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(n,i){var o=r._genHeader(Dp(Dp({needAck:!0,functionType:BU.C2C},t),{id:Qw()}));if(e.dir===RU.SEND){var a=setTimeout((function(){r._p2pCache.delete(e.id),i(new XN(HN.TIME_OUT,"P2P message timeout"))}),6e4);r._p2pCache.set(e.id,{success:function(e){clearTimeout(a),n(e)},error:function(e){clearTimeout(a);var t=Lp(jU[e.err]||[HN.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],n=t[1];i({code:r,message:e.msg||n})}})}r._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new XN(HN.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var n=t.version+(+t.zip<<5)+(+t.encrypt<<6),i=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=$w.str2ab(JSON.stringify([e,r])),a=Jw(Uint8Array,xp([n,i],Lp(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),r=0,n=t[r++],i=t[r++],o={version:15&n,zip:16==(16&n),encrypt:32==(32&n),needAck:1==(1&i),direction:(2&i)>>1,functionType:(60&i)>>2,binary:64==(64&i)};if(o.needAck||o.direction===VU.ACK){for(;r<=6;r++)if(128!=(128&t[r])){r++;break}o.id=Array.from(t.slice(2,r))}return{header:o,data:t.slice(r)}},t.prototype._feedbackSignaling=function(e,t){var r=this._genHeader({needAck:!0,direction:VU.ACK,id:e.split("-").map((function(e){return+e}))});FU.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),r,"")},t.prototype._handleMessage=function(e){var t,r;return Pp(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E,S,g,y,b,T,I,R,A,C,O,N,w;return Mp(this,(function(D){switch(D.label){case 0:n=this._dispartData(e),i=n.header,o=n.data,i.zip&&((a=new gU.Inflate).push(o,!0),o=a.result),s=$w.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&DU.rtcSignalingMsgError(-1,e.message,jM.MESSAGE_PARSE_FAILED),[2]}switch(i.functionType){case BU.C2S:return[3,1];case BU.C2C:return[3,6];case BU.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=i.id)||void 0===t?void 0:t.join("-"))||"",i.direction!==VU.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],FU.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,$w.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=D.sent(),D.label=4;case 4:this.emit(d,Dp({},c)),DU.rtcSignaling(0,s,"on-".concat(d),"Recv",GM.DOWN),D.label=5;case 5:return[3,19];case 6:switch(Array.isArray(c)&&(c=c[1]),h=null==c?void 0:c.id,this._rttIds[h]||(null==c?void 0:c.dir)===RU.FEEDBACK||eD(null==c?void 0:c.msg)?delete this._rttIds[h]:FU.print("Signal","<<<<<< p2p response",c),c.dir){case RU.SEND:return[3,7];case RU.FEEDBACK:return[3,16]}return[3,17];case 7:return eD(null==c?void 0:c.msg)?[3,15]:(p=(f=c).binary,_=f.msg,v=f.room,m=f.to,E=f.from,S=""===v?p?bU.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:bU.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:p?bU.USER_BINARY_MESSAGE_RECEIVED:bU.USER_MESSAGE_RECEIVED,m?[3,11]:(g=this.emit,y=[bU.ON_CUSTOM_MESSAGE],N={clientId:E,binary:p},p?[4,$w.b64str2ab(_)]:[3,9]));case 8:return b=D.sent(),[3,10];case 9:b=_,D.label=10;case 10:return g.apply(this,y.concat([(N.message=b,N)])),[3,17];case 11:return T=this.emit,I=[S],R=[Dp({},c)],w={},p?[4,$w.b64str2ab(_)]:[3,13];case 12:return A=D.sent(),[3,14];case 13:A=_,D.label=14;case 14:T.apply(this,I.concat([Dp.apply(void 0,R.concat([(w.msg=A,w)]))])),D.label=15;case 15:return this._sendP2PMessage(Dp(Dp({},c),{dir:RU.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===CU.SUCCESS?C.success(c.id):C.error(c)),[3,17];case 17:return[3,19];case 18:i.direction===VU.ACK&&(O=(null===(r=i.id)||void 0===r?void 0:r.join("-"))||"",this._handleAckMessage(O,c[0]||{},s)),D.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){FU.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){FU.print("_handleHandler","dataChannel error",t),e.emit("close",t)},n=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",n),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",n)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),Dp({version:2,zip:!1,encrypt:!1,needAck:!0,direction:VU.SEND,functionType:BU.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,r){var n=this._singlingCache.get(e);n&&(this._singlingCache.delete(e),200===t.code?n.success(t):n.error(t),FU.print("Signal","<<<<<< [".concat(n.signalingType,"-ack]"),t)),DU.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack",GM.DOWN)},t}(vD.exports.EventEmitter),HU=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,r=e.method,n=e.url,i=e.body,o=void 0===i?{}:i,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,i){var a,c;t.isSending=!0;var d=new XMLHttpRequest;d.open(r,n,!0);try{for(var l=Up(Object.entries(s)),h=l.next();!h.done;h=l.next()){var f=Lp(h.value,2),p=f[0],_=f[1];d.setRequestHeader(p,_)}}catch(e){a={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(a)throw a.error}}d.onreadystatechange=function(){4===d.readyState&&(t.isSending=!1,200===d.status?e(JSON.parse(d.responseText)):i({message:d.statusText,code:d.status})),0===d.status&&i({code:0,message:"Request abort"})},d.onerror=function(e){var r=HN.UNEXPECTED_ERROR;t.isSending=!1,i({code:r,message:d.responseText||"unknown"})},u&&(o=JSON.stringify(o)),d.send(o),t.xhr=d}))},e.prototype.get=function(e,t){return this.ajax({method:"GET",url:e,headers:t})},e.prototype.post=function(e,t,r,n){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:n})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),zU=function(){function e(){}return e.prototype.get=function(e){var t=localStorage.getItem(e);if(!t)return null;try{var r=JSON.parse(t);return r.ttl>0&&Date.now()-r.saveTime>r.ttl?(this.delete(e),null):r.message}catch(e){return null}},e.prototype.set=function(e,t,r){void 0===r&&(r=-1);var n={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(n)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),YU=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wp(t,e),t.prototype.getDeviceId=function(){var e=this.get("RTC_DEVICE_ID");return e||(e=Yw()),this.set("RTC_DEVICE_ID",e),e},t.prototype.getAccessNode=function(e){return this.get("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus"))},t.prototype.setAccessNode=function(e,t,r){return this.set("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus"),t,1e3*r)},t.prototype.getAccessUrls=function(){return this.get("".concat("RTC_ACCESS_URLS","-BytePlus"))},t.prototype.setAccessUrls=function(e){var t=e.map((function(e){var t=e.host,r=e.path;return"https://".concat(t).concat(r)}));return this.set("".concat("RTC_ACCESS_URLS","-BytePlus"),t)},t.prototype.clearAccessUrls=function(){this.delete("".concat("RTC_ACCESS_URLS","-BytePlus"))},t}(zU),KU=new YU,XU=new CD("ICE Request",3),WU=function(){function e(){this._request=new HU}return e.prototype.getAccessNode=function(e,t,r,n,i,o){return Pp(this,void 0,void 0,(function(){var a;return Mp(this,(function(s){return(a=KU.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,r,n,i,o),xU("es.R.node.cache",a),[2,Promise.resolve(a)]):[2,this.getAccessNodeFromServer(e,t,r,n,i,o)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,r,n,i,o){return Pp(this,void 0,void 0,(function(){var a,s,c=this;return Mp(this,(function(u){return a=KU.getAccessUrls(),s=!0,xU("es.R.req.cache.urls",a),(null==a?void 0:a.length)>0||(a=fk.ICE_CONFIG_REQUEST_URLS,s=!1,xU("es.R.req.external.urls",a)),(null==a?void 0:a.length)>0||(a=fk.ICE_CONFIG_REQUEST_URLS_INTERNAL,s=!1,xU("es.R.req.internal.urls",a)),[2,this.getICEConfigFromServer(a,e,t,r,n,i,o).then((function(t){var r=t.nodes[0];return KU.setAccessNode(e,r,t.ttl||11200),KU.setAccessUrls(t.dispatchDomains),r})).catch((function(a){if(s)return xU("es.R.req.fallback",""),KU.clearAccessUrls(),c.getAccessNodeFromServer(e,t,r,n,i,o);throw a}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,r,n,i,o,a){var s;return Pp(this,void 0,void 0,(function(){var c,u,d,l=this;return Mp(this,(function(h){return c={appID:t,roomID:r,userID:n,deviceID:i,connectSessionID:Ww(),os:"web",sdkVersion:fk.VERSION,expectedAddr:_k("EXPECTED_ADDR"),productPlatform:"BytePlus"},o&&a&&(c.feedbackInfo=[{feedbackIP:null===(s=a.publicIPs[0])||void 0===s?void 0:s.ip,feedbackReason:{type:"NodeChanged",reason:o}}],delete c.expectedAddr),u=Date.now(),DU.rtcGetAccess(0,JSON.stringify(c),0,VM.REQUEST,e.join(","),c.connectSessionID),d=e.map((function(e,t){return Pp(l,void 0,void 0,(function(){var r,n,i;return Mp(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._request.post(e,c)];case 1:return r=o.sent(),[3,3];case 2:throw n=o.sent(),new XN(HN.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==r.code)throw new XN(HN.ICE_SERVER_WRONG,"get ICE config failed",{server_code:r.code,message:JSON.stringify(r)});if(!(i=r.nodes[0]))throw new XN(HN.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:r.code,message:JSON.stringify(r)});return[2,{result:r,firstNode:i,index:t}]}}))}))})),[2,Promise.race(d).then((function(t){var r=t.result;t.firstNode;var n=t.index;return DU.rtcGetAccess(200,JSON.stringify(r),Date.now()-u,VM.RESPONSE,e[n],c.connectSessionID),r})).catch((function(t){throw DU.rtcGetAccess(t.error.code||t.error.server_code,t.error.message,Date.now()-u,VM.RESPONSE,e.join(","),c.connectSessionID),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(XU.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),qU={},JU={},ZU={exports:{}},$U=ZU.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($U).forEach((function(e){$U[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(r[n[o]]=t(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},n=ZU.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(n[t]||[]).length;s+=1){var c=n[t][s];if(c.reg.test(i))return r(c,a,i)}})),t.media=o,t};var o=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],n=e.split(" ").map(t),i=0;i<n.length;i+=3)r.push({component:n[i],ip:n[i+1],port:n[i+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(JU);var QU=ZU.exports,eL=/%[sdv%]/g,tL=function(e){var t=1,r=arguments,n=r.length;return e.replace(eL,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},rL=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return tL.apply(null,n)},nL=["v","o","s","i","u","e","p","c","b","t","r","z","a"],iL=["i","c","b","a"],oL=JU,aL=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||nL,n=t.innerOrder||iL,i=[];return r.forEach((function(t){QU[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(rL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(rL(t,r,e))}))}))})),e.media.forEach((function(e){i.push(rL("m",QU.m[0],e)),n.forEach((function(t){QU[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(rL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(rL(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};qU.write=aL,qU.parse=oL.parse,qU.parseParams=oL.parseParams,qU.parseFmtpConfig=oL.parseFmtpConfig,qU.parsePayloads=oL.parsePayloads,qU.parseRemoteCandidates=oL.parseRemoteCandidates,qU.parseImageAttributes=oL.parseImageAttributes,qU.parseSimulcastStreamList=oL.parseSimulcastStreamList;var sL=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this._iceConfigNode.iceParams,n=qU.parse(e);return null===(t=n.media)||void 0===t||t.forEach((function(e){e.iceUfrag=null==r?void 0:r.clientIceUfrag,e.icePwd=null==r?void 0:r.clientIcePwd,e.iceOptions="renomination"})),qU.write(n)},e}(),cL=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this,n=this._iceConfigNode.certFingerprint,i=qU.parse(e);return(null==i?void 0:i.fingerprint)&&(i.fingerprint={type:"sha-256",hash:n}),null===(t=null==i?void 0:i.media)||void 0===t||t.forEach((function(e){return r.modifyMlineByIceNode(e)})),qU.write(i)},e.prototype.modifyMlineByIceNode=function(e){var t=this._iceConfigNode,r=t.publicIPs,n=t.certFingerprint,i=t.iceParams;e.fingerprint&&(e.fingerprint={type:"sha-256",hash:n}),e.icePwd=i.serverIcePwd,this._iceUfrag||(this._iceUfrag=EL(i.serverIceUfrag),PU.setStats({connection_id:this._iceUfrag})),e.iceUfrag=this._iceUfrag,e.setup="active",this._candidates||(this._candidates=mL(r)),e.candidates=this._candidates,e.iceOptions="renomination","application"===e.type&&(e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144})},e}();function uL(e,t){var r,n=qU.parse(e),i=[];return n.media=n.media.map((function(e){return t.includes(e.mid+"")?(e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.bundleOnly):"inactive"!==e.direction&&i.push(e.mid),e})),(null===(r=n.groups)||void 0===r?void 0:r[0])&&(n.groups[0].mids=i.join(" ")),n}var dL,lL,hL,fL,pL,_L=function(e,t){var r,n;try{var i=qU.parse(e),o=qU.parse(t),a="".concat(null===(r=o.groups)||void 0===r?void 0:r[0].mids).split(" "),s="".concat(null===(n=i.groups)||void 0===n?void 0:n[0].mids).split(" "),c={};a.forEach((function(e){return c[e]=e}));var u={};s.forEach((function(e){c[e]||(u[e]=e)}));var d="",l="";return i.media=i.media.filter((function(e){return u[e.mid]&&"audio"===e.type?d="".concat(e.mid):u[e.mid]&&"video"===e.type&&(l="".concat(e.mid)),u[e.mid]})),delete i.groups,delete i.msidSemantic,{partialSdp:qU.write(i),audioMid:d,videoMid:l}}catch(e){return null}},vL=function(e,t){var r;try{var n=qU.parse(e),i=[];return null===(r=n.media)||void 0===r||r.forEach((function(e){(null==t?void 0:t.includes("".concat(e.mid)))&&i.push(e)})),n.media=i,delete n.groups,delete n.msidSemantic,qU.write(n)}catch(e){return""}},mL=function(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,n=[];return e.forEach((function(e){var i={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){n.push(Dp(Dp({},i),{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push(Dp(Dp({},i),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n},EL=function(e){var t=new TextEncoder,r=t.encode("PREC"),n=new Uint8Array($w.str2ab(e)),i=t.encode(Date.now().toString()).slice(-4),o=new Uint8Array(4);o[0]=0,o[1]=1,o[2]=1,o[3]=1;var a=Jw(Uint8Array,r,n,i,o),s=$w.ab2str(a.buffer);return window.btoa(s)},SL="safari"===(dL="none",Zw()||(null!==window.navigator.userAgent.match("Firefox")?dL="mozilla":null!==window.navigator.userAgent.match("Chrome")?(dL="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(dL="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(dL="safari")),dL);!function(e){e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server"}(lL||(lL={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(hL||(hL={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(fL||(fL={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(pL||(pL={}));var gL,yL,bL,TL=function(){function e(e){this.peer=e,this.stats=[]}return e.prototype.handleCodec=function(e){return e},e.prototype.handleInboundRtp=function(e){return e},e.prototype.handleOutboundRtp=function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e},e.prototype.handleRemoteInboundRtp=function(e){return e},e.prototype.handleRemoteOutboundRtp=function(e){return e},e.prototype.handleMediaSource=function(e){return e},e.prototype.handleCsrc=function(e){return e},e.prototype.handlePeerConnection=function(e){return e},e.prototype.handleDataChannel=function(e){return e},e.prototype.handleStream=function(e){return e},e.prototype.handleTrack=function(e){return e},e.prototype.handleTransceiver=function(e){return e},e.prototype.handleSender=function(e){return e},e.prototype.handleReceiver=function(e){return e},e.prototype.handleTransport=function(e){return e},e.prototype.handleSctpTransport=function(e){return e},e.prototype.handleCandidatePair=function(e){return e},e.prototype.handleLocalCandidate=function(e){return e},e.prototype.handleRemoteCandidate=function(e){return e},e.prototype.handleCertificate=function(e){return e},e.prototype.handleIceServer=function(e){return e},e.prototype.processStats=function(e){var t=this;e.forEach((function(e){var r;switch(e.type){case lL.candidatePair:r=t.handleCandidatePair;break;case lL.certificate:r=t.handleCertificate;break;case lL.remoteCandidate:r=t.handleRemoteCandidate;break;case lL.remoteInboundRtp:r=t.handleInboundRtp;break;case lL.remoteOutboundRtp:r=t.handleOutboundRtp;break;case lL.sctpTransport:r=t.handleSctpTransport;break;case lL.sender:r=t.handleSender;break;case lL.stream:r=t.handleStream;break;case lL.track:r=t.handleTrack;break;case lL.transceiver:r=t.handleTransceiver;break;case lL.transport:r=t.handleTransport;break;case lL.codec:r=t.handleCodec;break;case lL.csrc:r=t.handleCsrc;break;case lL.dataChannel:r=t.handleDataChannel;break;case lL.iceServer:r=t.handleIceServer;break;case lL.mediaSource:r=t.handleMediaSource;break;case lL.outboundRtp:r=t.handleOutboundRtp;break;case lL.inboundRtp:r=t.handleInboundRtp;break;case lL.peerConnection:r=t.handlePeerConnection;break;case lL.receiver:r=t.handleReceiver;break;case lL.localCandidate:r=t.handleLocalCandidate;break;default:r=function(e){return e}}r=r.bind(t),t.stats.push(r(e))}))},e.prototype.getExtraStats=function(){return Pp(this,void 0,void 0,(function(){var e=this;return Mp(this,(function(t){return[2,new Promise((function(t,r){if(SL||void 0!==window.InstallTrigger)return t(e.stats);try{e.peer.getStats((function(r){r.result().forEach((function(t){if(!IL.includes(t.type)){var r={};t.names().forEach((function(e){r[e]=t.stat(e)})),r.id=t.id,r.type=t.type,r.timestamp=t.timestamp,e.stats.push(r)}})),t(e.stats)}))}catch(e){r(e)}}))]}))}))},e.prototype.getStats=function(e){return Pp(this,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),[4,this.peer.getStats(e)];case 1:t=r.sent(),this.processStats(t),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.getExtraStats()];case 3:case 4:return r.sent(),[3,5];case 5:return[3,7];case 6:return r.sent(),[3,7];case 7:return[2,this.stats]}}))}))},e}(),IL=["codec","inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp","media-source","csrc","peer-connection","data-channel","stream","track","transceiver","sender","receiver","transport","sctp-transport","candidate-pair","local-candidate","remote-candidate","certificate","ice-server"];!function(e){e[e.AUTO=0]="AUTO",e[e.MODE_L=1]="MODE_L",e[e.MODE_R=2]="MODE_R",e[e.MODE_MIX=3]="MODE_MIX"}(gL||(gL={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(yL||(yL={})),function(e){e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED"}(bL||(bL={}));var RL=function(){return Pp(void 0,void 0,void 0,(function(){var e,t,r,n;return Mp(this,(function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),Zw()||!window.RTCPeerConnection||!window.RTCPeerConnection.prototype.addTransceiver||!window.RTCPeerConnection.prototype.createDataChannel)return[2,!1];for(e=navigator.userAgent.toLowerCase(),t=["heytapbrowser","mqqbrowser","miuibrowser"],r=0;r<t.length;r++)if(e.includes(t[r]))return[2,!1];return[4,nD()];case 1:return(n=i.sent())&&(null==n?void 0:n.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"))?[2,!0]:[2,!1];case 2:return i.sent(),[2,!1];case 3:return[2]}}))}))},AL=function(){return"undefined"!=typeof TransformStream&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},CL=new CD("BasicHandler",3),OL=AL(),NL={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!OL||void 0},wL=function(e){function t(){var t=e.call(this)||this;return t._peerConnection=new RTCPeerConnection(NL),t._dataChannel=t._peerConnection.createDataChannel("signaling"),t._dataChannel.binaryType="arraybuffer",t._peerConnection.ontrack=function(e){var r,n;CL.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(n=null===(r=e.streams)||void 0===r?void 0:r[0])||void 0===n?void 0:n.id)),t.emit("ontrack",e)},t._peerConnection.onconnectionstatechange=function(e){CL.print("constructor","onconnectionstatechange ".concat(t._peerConnection.iceConnectionState," -> ").concat(t._peerConnection.connectionState)),"failed"!==t._peerConnection.iceConnectionState&&"closed"!==t._peerConnection.iceConnectionState&&"failed"!==t._peerConnection.connectionState||t.emit("disconnect")},t._peerConnection.oniceconnectionstatechange=function(){var e=t._peerConnection.iceConnectionState;DU.rtcPreIceState(e,BM["".concat(e.toUpperCase())])},t}return wp(t,e),t.prototype.connect=function(e){return Pp(this,void 0,void 0,(function(){var t,r,n=this;return Mp(this,(function(i){switch(i.label){case 0:return CL.print("connect","invoke connect"),[4,this._peerConnection.createOffer()];case 1:return t=i.sent(),this._localSdp=new sL(e),[4,this.setLocalDescription(t.sdp)];case 2:return i.sent(),this._remoteSdp=new cL(e),r=this._remoteSdp.modifyByIceNode(t.sdp),[4,this.setRemoteDescription(r)];case 3:return i.sent(),[4,new Promise((function(e,t){n._dataChannel.onopen=function(){CL.print("connect","dataChannel open"),xU("es.dc.open",""),e("")},n._dataChannel.onerror=function(e){DU.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,jM.INVALID_DATA),xU("es.dc.error",""),t(e)},n._dataChannel.onclose=function(e){xU("es.dc.close",""),t(e)},n._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==n._peerConnection.iceConnectionState&&"closed"!==n._peerConnection.iceConnectionState&&"failed"!==n._peerConnection.connectionState||t(e)}))}))];case 4:return i.sent(),CL.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){this.disconnect(),this._localSdp=void 0,this._remoteSdp=void 0},t.prototype.publish=function(e){var t;return Pp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E;return Mp(this,(function(S){switch(S.label){case 0:if(r=e.stream,n=null==e?void 0:e.videoTrack,i=null==e?void 0:e.audioTrack,o={},a=[],Array.isArray(null==e?void 0:e.videoEncodeConfig))for(s=null==e?void 0:e.videoEncodeConfig.length,c=null==n?void 0:n.getTrack(),u={width:640,height:480,framerate:30},c&&(d=null==c?void 0:c.getSettings(),u={width:Math.floor(d.width),height:Math.floor(d.height),framerate:Math.floor(d.frameRate)}),o.sendEncodings=[],l=0;l<s;l++)h=null==e?void 0:e.videoEncodeConfig[l],f={maxBitrate:1e3*h.maxKbps},p=Math.pow(2,l),s>1&&(f.rid="".concat(l),f.scaleResolutionDownBy=p),null===(t=o.sendEncodings)||void 0===t||t.unshift(f),a.push({width:Math.floor(u.width/p),height:Math.floor(u.height/p),framerate:u.framerate,maxkbps:h.maxKbps,rid:"".concat(l)});return CL.print("publish videoTransceiverInit videoDescriptions","",o,a),_=null==i?void 0:i.getTrack(),(null==i?void 0:i.mixType)!==yL.PLAYOUT&&(null==i?void 0:i.mixedAudioTrack)&&(_=null==i?void 0:i.mixedAudioTrack),e.audioTransceiver=this._peerConnection.addTransceiver(_||"audio",{direction:"sendonly",streams:[r]}),OL&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver((null==n?void 0:n.getTrack())||"video",Dp({direction:"sendonly",streams:[r]},o)),OL&&e.initVideoEncodedTransform(),CL.print("sender.getParameters()",e.videoTransceiver.sender.getParameters()),v=qw(),DU.rtcBeginCreateOffer(HM.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:if(m=S.sent(),DU.rtcCreateOffer(0,zM.UP,e.streamId,e.userId,qw()-v),E=_L(m.sdp,this.getLocalDescriptionSdp()),!m.sdp||!E)throw new XN(HN.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Dp(Dp({sdp:m.sdp},E),{type:"incroffer",semantics:"unified-plan",videoDescriptions:a})]}}))}))},t.prototype.subscribe=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n,i,o,a;return Mp(this,(function(s){switch(s.label){case 0:return r="incroffer",n="unified-plan",t?[2,{sdp:this.getLocalDescriptionSdp(),partialSdp:vL(this.getLocalDescriptionSdp(),[t.audioMid,t.videoMid]),audioMid:t.audioMid,videoMid:t.videoMid,type:r,semantics:n}]:(e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),OL&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),OL&&e.initVideoEncodedTransform(),i=qw(),DU.rtcBeginCreateOffer(HM.DOWN,e.streamId,e.userId),[4,this._peerConnection.createOffer()]);case 1:if(o=s.sent(),DU.rtcCreateOffer(0,zM.DOWN,e.streamId,e.userId,qw()-i),a=_L(o.sdp,this.getLocalDescriptionSdp()),!o.sdp||!a)throw new XN(HN.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Dp(Dp({sdp:o.sdp},a),{type:r,semantics:n})]}}))}))},t.prototype.setAnswerSdp=function(e,t,r,n,i){var o;return Pp(this,void 0,void 0,(function(){var a,s,c,u,d,l,h=this;return Mp(this,(function(f){switch(f.label){case 0:return DU.rtcRecvAnswer(0,XM.INCRANSWER,0,t,i,n.streamId,n.userId),a=this._peerConnection.remoteDescription,s=qU.parse(null==a?void 0:a.sdp),c=null===(o=s.media)||void 0===o?void 0:o.reduce((function(e,t){return e[t.mid]=t,e}),{}),qU.parse(t).media.forEach((function(e){return c[e.mid]=e})),u=[],d=qU.parse(e),l=d.media.map((function(e){var t;r&&r[e.mid]&&(e.mid=r[e.mid]),"inactive"!==e.direction&&u.push(e.mid);var n=c[e.mid];return null===(t=h._remoteSdp)||void 0===t||t.modifyMlineByIceNode(n),e.bundleOnly||(n.port=e.port),n})),s.media=l,d.groups=[{mids:u.join(" "),type:"BUNDLE"}],s.groups=d.groups,[4,this.setLocalDescription(qU.write(d),n,i)];case 1:return f.sent(),[4,this.setRemoteDescription(qU.write(s),n,i)];case 2:return f.sent(),[2]}}))}))},t.prototype.setLocalDescription=function(e,t,r){var n,i;return Pp(this,void 0,void 0,(function(){var o,a,s,c,u,d,l;return Mp(this,(function(h){switch(h.label){case 0:o=null===(n=this._localSdp)||void 0===n?void 0:n.modifyByIceNode(e),a=new RTCSessionDescription({type:"offer",sdp:o}),s=qw(),c=r||KM.UP,u=(null==t?void 0:t.streamId)||"",d=(null===(i=t)||void 0===i?void 0:i.userId)||"",h.label=1;case 1:return h.trys.push([1,3,,4]),CL.print("setOffer","set offer: ",a),[4,this._peerConnection.setLocalDescription(a)];case 2:return h.sent(),DU.rtcSetDescription(0,a.sdp,YM.W_1,c,u,d,qw()-s,{type:"offer"}),[3,4];case 3:throw(l=h.sent())instanceof Error&&DU.rtcSetDescription(-1,l.message,YM.W_1,c,u,d,qw()-s,{type:"offer"}),l;case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t,r){var n;return Pp(this,void 0,void 0,(function(){var i,o,a,s,c,u;return Mp(this,(function(d){switch(d.label){case 0:i=new RTCSessionDescription({type:"answer",sdp:e}),o=qw(),a=r||KM.UP,s=(null==t?void 0:t.streamId)||"",c=(null===(n=t)||void 0===n?void 0:n.userId)||"",d.label=1;case 1:return d.trys.push([1,3,,4]),CL.print("setAnswer","set answer: ",i),[4,this._peerConnection.setRemoteDescription(i)];case 2:return d.sent(),DU.rtcSetDescription(0,i.sdp,YM.W_0,a,s,c,qw()-o,{type:"answer"}),[3,4];case 3:throw(u=d.sent())instanceof Error&&DU.rtcSetDescription(-1,u.message,YM.W_0,a,s,c,qw()-o,{type:"answer"}),u;case 4:return[2]}}))}))},t.prototype.getLocalDescriptionSdp=function(){var e,t,r,n;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.localDescription)||void 0===t?void 0:t.sdp)return null===(n=null===(r=this._peerConnection)||void 0===r?void 0:r.localDescription)||void 0===n?void 0:n.sdp;throw Error()},t.prototype.getRemoteDescriptionSdp=function(){var e,t,r,n;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.remoteDescription)||void 0===t?void 0:t.sdp)return null===(n=null===(r=this._peerConnection)||void 0===r?void 0:r.remoteDescription)||void 0===n?void 0:n.sdp;throw Error()},t.prototype.closeMLine=function(e){var t,r;return Pp(this,void 0,void 0,(function(){var n,i,o,a,s=this;return Mp(this,(function(c){switch(c.label){case 0:return CL.print("closeMids","closeMids: ",e),n=this.getLocalDescriptionSdp(),i=uL(n,e),o=this.getRemoteDescriptionSdp(),a=uL(o,e),[4,this._peerConnection.createOffer()];case 1:return c.sent(),[4,this.setLocalDescription(qU.write(i))];case 2:return c.sent(),(null===(t=null==i?void 0:i.media)||void 0===t?void 0:t.length)!==(null===(r=null==a?void 0:a.media)||void 0===r?void 0:r.length)&&i.media.slice(a.media.length).forEach((function(e){var t;null===(t=s._remoteSdp)||void 0===t||t.modifyMlineByIceNode(e),a.media.push(e)})),Array.isArray(i.media)&&Array.isArray(a.media)&&i.media.forEach((function(e,t){a.media[t]&&(a.media[t].mid=e.mid)})),[4,this.setRemoteDescription(qU.write(a))];case 3:return c.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return Pp(this,void 0,void 0,(function(){var e;return Mp(this,(function(t){switch(t.label){case 0:return[4,nD()];case 1:if(!(e=t.sent()))throw new XN(HN.NOT_SUPPORTED,"Get offer Error");return[2,{sdp:e,semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.getStats=function(e){return t=this._peerConnection,r=e,Pp(void 0,void 0,void 0,(function(){var e;return Mp(this,(function(n){switch(n.label){case 0:return e=[],t instanceof RTCPeerConnection?[4,new TL(t).getStats(r)]:[2,e];case 1:return[2,e=n.sent()]}}))}));var t,r},t.prototype.rollback=function(e,t){var r;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(n){switch(n.label){case 0:return CL.print("rollback()","signalingState: %o",this._peerConnection.signalingState),"stable"!==this._peerConnection.signalingState?[3,2]:[4,null===(r=this._peerConnection)||void 0===r?void 0:r.setLocalDescription(new RTCSessionDescription({sdp:e,type:"offer"}))];case 1:n.sent(),n.label=2;case 2:return[4,this.closeMLine(t)];case 3:return n.sent(),[2]}}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t}(vD.exports.EventEmitter),DL=new CD("Locker",2),kL=1,PL=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=kL++,e&&(this.name=e),DL.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return Object.defineProperty(e.prototype,"isLocked",{get:function(){return this.locks>0},enumerable:!1,configurable:!0}),e.prototype.lock=function(){var e,t=this;this.locks+=1,DL.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var r=new Promise((function(r){e=function(){t.locks-=1,DL.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),n=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),n},e}(),ML=Math.log,UL=Math.LOG10E;Fn({target:"Math",stat:!0},{log10:Math.log10||function(e){return ML(e)*UL}}),Fn({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new CD("Stats",2);var LL,xL=function(){function e(e,t){this._client=e,this._handler=t,this.dataChannelRTT={},this._rttTimer={},this._remoteStreamStasEvtIntervals={},this._localStreamStasEvtIntervals={},this._firstFrameStarted={},this._videoInWaiting={}}return e.prototype.setRemoteStreamStatsEvtInterval=function(e){var t,r,n=this;this.getDataChannelRTT(e.userId);var i={audio:{},video:{},remoteStream:e},o=null===(t=e.audioTrack)||void 0===t?void 0:t.getTrack(),a=null===(r=e.videoTrack)||void 0===r?void 0:r.getTrack();this.getRemoteAudioStats(o,i),this.getRemoteVideoStats(a,i),this.delRemoteStreamStatsEvtInterval(e);this._remoteStreamStasEvtIntervals[e.streamId]=setInterval((function(){return Pp(n,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:return[4,Pp(n,void 0,void 0,(function(){var t,r,n,o,a,s;return Mp(this,(function(c){switch(c.label){case 0:return t=null===(a=e.audioTrack)||void 0===a?void 0:a.getTrack(),r=null===(s=e.videoTrack)||void 0===s?void 0:s.getTrack(),[4,this.getRemoteAudioStats(t,i)];case 1:return n=c.sent(),[4,this.getRemoteVideoStats(r,i)];case 2:return(o=c.sent()).isScreen=e.isScreen,[2,{audioStats:n,videoStats:o,isScreen:e.isScreen,userId:e.userId}]}}))}))];case 1:return t=r.sent(),this._client.emit("onRemoteStreamStats",t),[2]}}))}))}),2e3)},e.prototype.delRemoteStreamStatsEvtInterval=function(e){clearInterval(this._remoteStreamStasEvtIntervals[e.streamId])},e.prototype.unsubscribe=function(e){this.delRemoteStreamStatsEvtInterval(e),clearTimeout(this._rttTimer[e.userId]),this._videoInWaiting[e.streamId]=!1,this._firstFrameStarted["".concat(e.streamId,"-audio")]&&(DU.rtcFirstFrame({event_type:tU.RECV_END,media_type:e.isScreen?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-audio")],event_session_id:e.streamId,result:!1,reason:iU.UNSUBSCRIBE,stream_user_id:e.userId}),delete this._firstFrameStarted["".concat(e.streamId,"-audio")]),this._firstFrameStarted["".concat(e.streamId,"-video")]&&(DU.rtcFirstFrame({event_type:tU.RECV_END,media_type:e.isScreen?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-video")],event_session_id:e.streamId,result:!1,reason:iU.UNSUBSCRIBE,stream_user_id:e.userId}),delete this._firstFrameStarted["".concat(e.streamId,"-video")])},e.prototype.getRemoteAudioStats=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,f,p=this;return Mp(this,(function(_){switch(_.label){case 0:return r={},n={timestamp:Date.now()},i=t.remoteStream,o=i.streamId,a=i.userId,s=i.isScreen,c=i.audioMid,u=i.hasAudio,d={media_type:"audio",direction:"down",stream_id:o,stream_user_id:a,vid:c,remote_muted:!u},e&&this._handler?(t.audioStart||(t.audioStart=qw(),DU.rtcFirstFrame({event_type:tU.BEGIN_RECV,media_type:s?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.SUBSCRIBE,start:t.audioStart,event_session_id:o,stream_user_id:a}),u?this._firstFrameStarted["".concat(o,"-audio")]=t.audioStart:DU.rtcFirstFrame({event_type:tU.RECV_END,media_type:s?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.PUBLISH,start:t.audioStart,event_session_id:o,result:!1,reason:iU.DISABLE,stream_user_id:a})),[4,this._handler.getStats(e)]):[2,r];case 1:return(l=_.sent()).length?(l.forEach((function(e){var i=e.type,c=e.packetsLost,u=e.packetsReceived,l=e.bytesReceived,h=e.jitterBufferDelay,f=e.jitterBufferEmittedCount,_=e.clockRate,v=e.channels,m=e.totalSamplesReceived,E=e.concealedSamples,S=e.concealmentEvents,g=e.totalRoundTripTime,y=e.state,b=e.currentRoundTripTime,T=e.audioLevel,I=e.totalAudioEnergy,R=e.totalSamplesDuration,A=e.mimeType,C=e.googDecodingNormal,O=e.fecPacketsReceived,N=e.availableIncomingBitrate,w=e.availableOutgoingBitrate,D=e.bytesSent,k=e.nominated,P=e.id,M=e.writable,U=e.jitter,L=e.candidateType,x=e.ip,V=e.address,B=e.networkType,j=e.port,F=e.protocol,G=e.audioOutputLevel,H=e.requestsReceived,z=e.responsesReceived,Y=e.requestsSent,K=e.consentRequestsSent,X=e.responsesSent,W=e.ssrc,q=e.kind;"inbound-rtp"===i?(n.packetsLost=c,n.packetsReceived=u,d.packets=u,n.bytesReceived=l,d.bytes=l,void 0!==h&&(r.jitterBufferDelay=h/f*1e3,d.jitter_buffer_delay=r.jitterBufferDelay),void 0!==m&&(n.totalSamplesReceived=m,r.concealedSamples=E,n.concealedSamples=E,d.concealed_samples=E,r.concealmentEvents=S,d.total_samples_received=m),void 0!==O&&(d.fec_packets_received=O),d.jitter=1e3*U,d.ssrc=W,m>0&&p._firstFrameStarted["".concat(o,"-audio")]&&(DU.rtcFirstFrame({event_type:tU.RECV_END,media_type:s?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.SUBSCRIBE,event_session_id:o,result:!0,start:t.audioStart,stream_user_id:a}),delete p._firstFrameStarted["".concat(o,"-audio")])):"codec"===i?(r.recordSampleRate=_,v&&(r.numChannels=v),d.codec=A):"candidate-pair"===i?(d.ice_available_incoming_bitrate=N,d.ice_available_outgoing_bitrate=w,d.ice_bytes_received=l,d.ice_bytes_sent=D,d.ice_nominated=+k,d.ice_pair_id=P,d.ice_pair_rtt=b,d.rtt=1e3*b,d.ice_pair_state=y,d.ice_pair_writable=M,d.recv_ping_requests=H,d.recv_ping_responses=z,d.sent_ping_requests_before_first_response=Y,d.sent_ping_requests_total=Y+(K||0),d.sent_ping_responses=X,"succeeded"===y&&(r.rtt=1e3*b,r.total_rtt=1e3*g)):"track"===i&&"audio"===q?(d.audio_level=-10*Math.log10(Math.pow(T,2)),d.volume=255*T,d.total_audio_energy=I,d.total_samples_duration=R):"ssrc"===i?(d.decoding_normal=C,d.recv_level=G):"local-candidate"===i?(d.local_candidate_type=L,d.local_ip=x||V,d.local_network_type=B,d.local_port=j,d.protocol=F):"remote-candidate"===i&&(d.remote_candidate_type=L,d.remote_ip=x||V,d.remote_port=j)})),(h=t.audio).timestamp?(r.audioLossRate=(n.packetsLost-h.packetsLost)/(n.packetsReceived-h.packetsReceived+(n.packetsLost-h.packetsLost)),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,d.packets_lost=Math.round(n.packetsLost-h.packetsLost),d.fraction_lost=r.audioLossRate,d.packets_lost_rate=r.audioLossRate,r.statsInterval=n.timestamp-h.timestamp,r.receivedKBitrate=(n.bytesReceived-h.bytesReceived||0)/r.statsInterval,d.bitrate=Math.round(8e3*r.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),void 0!==n.concealedSamples&&(d.interval_concealed_samples=n.concealedSamples-h.concealedSamples,d.interval_samples_received=n.totalSamplesReceived-h.totalSamplesReceived,r.receivedSampleRate=1e3*d.interval_samples_received/r.statsInterval),t.audio=n,this.dataChannelRTT[t.remoteStream.userId]&&(f=this.dataChannelRTT[t.remoteStream.userId]/2,r.e2eDelay=f+(r.jitterBufferDelay||0),d.web_e2e_delay=r.e2eDelay,d.total_rtt_ms=f),t.remoteStream.subAudio&&DU.rtcMediaStatistics(d,{}),[2,r]):(t.audio=n,[2,r])):[2,r]}}))}))},e.prototype.getRemoteVideoStats=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,f,p=this;return Mp(this,(function(_){switch(_.label){case 0:return r={},n={timestamp:Date.now()},i=t.remoteStream,o=i.streamId,a=i.userId,s=i.isScreen,c=i.hasVideo,u={media_type:"video",direction:"down",stream_id:o,stream_user_id:a,vid:t.remoteStream.videoMid,remote_muted:!c},e&&this._handler?(t.videoStart||(t.videoStart=qw(),DU.rtcFirstFrame({event_type:tU.BEGIN_RECV,media_type:s?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.SUBSCRIBE,start:t.videoStart,event_session_id:o,stream_user_id:a}),c?this._firstFrameStarted["".concat(o,"-video")]=t.videoStart:DU.rtcFirstFrame({event_type:tU.RECV_END,media_type:s?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.PUBLISH,start:t.videoStart,event_session_id:o,result:!1,reason:iU.DISABLE,stream_user_id:a})),[4,this._handler.getStats(e)]):[2,r];case 1:return(d=_.sent()).length?(d.forEach((function(e){var i=e.type,c=e.frameHeight,d=e.frameWidth,l=e.packetsLost,h=e.packetsReceived,f=e.bytesReceived,_=e.framesDecoded;e.roundTripTime;var v=e.jitterBufferDelay,m=e.jitterBufferEmittedCount,E=e.mimeType,S=e.firCount,g=e.availableIncomingBitrate,y=e.availableOutgoingBitrate,b=e.bytesSent,T=e.nominated,I=e.id,R=e.currentRoundTripTime,A=e.state,C=e.writable,O=e.candidateType,N=e.ip,w=e.address,D=e.networkType,k=e.port,P=e.nackCount,M=e.pliCount,U=e.protocol,L=e.requestsReceived,x=e.responsesReceived,V=e.requestsSent,B=e.consentRequestsSent,j=e.responsesSent,F=e.ssrc;e.totalRoundTripTime;var G=e.kind,H=e.jitter,z=e.framesReceived,Y=e.keyFramesDecoded,K=e.totalDecodeTime,X=e.decoderImplementation,W=e.lastPacketReceivedTimestamp;"inbound-rtp"===i?(n.packetsLost=l,u.packets_lost=l,n.packetsReceived=h,u.packets=h,n.bytesReceived=f,u.bytes=f,n.framesDecoded=_,void 0!==v&&(n.jitterBufferDelay=v/m*1e3,u.jitter_buffer_delay=n.jitterBufferDelay),u.fir_count=S,u.nack_count=P,u.pli_count=M,u.ssrc=F,u.jitter=H,u.frames_received=z,u.frames_decoded=_,u.key_frames_decoded=Y,u.total_decode_time=K,u.decoder_implementation=X,u.last_packet_received_timestamp=W,_>0&&p._firstFrameStarted["".concat(o,"-video")]&&(DU.rtcFirstFrame({event_type:tU.RECV_END,media_type:s?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.SUBSCRIBE,event_session_id:o,result:!0,start:t.videoStart,stream_user_id:a}),delete p._firstFrameStarted["".concat(o,"-video")])):"track"===i&&"video"===G?(r.width=d,u.frame_size_width=d,r.height=c,u.frame_size_height=c,void 0!==z&&(u.frames_received=z)):"codec"===i?u.codec=E:"candidate-pair"===i?(u.ice_available_incoming_bitrate=g,u.ice_available_outgoing_bitrate=y,u.ice_bytes_received=f,u.ice_bytes_sent=b,u.ice_nominated=+T,u.ice_pair_id=I,u.ice_pair_rtt=R,u.rtt=1e3*R,r.rtt=u.rtt,u.ice_pair_state=A,u.ice_pair_writable=C,u.recv_ping_requests=L,u.recv_ping_responses=x,u.sent_ping_requests_before_first_response=V,u.sent_ping_requests_total=V+(B||0),u.sent_ping_responses=j):"local-candidate"===i?(u.local_candidate_type=O,u.local_ip=N||w,u.local_network_type=D,u.local_port=k,u.protocol=U):"remote-candidate"===i&&(u.remote_candidate_type=O,u.remote_ip=N||w,u.remote_port=k)})),l=t.video,h=t.remoteStream,l.timestamp?(r.videoLossRate=(n.packetsLost-l.packetsLost)/(n.packetsReceived-l.packetsReceived+(n.packetsLost-l.packetsLost)),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,u.fraction_lost=r.videoLossRate,u.packets_lost_rate=r.videoLossRate,r.statsInterval=n.timestamp-l.timestamp,r.receivedKBitrate=(n.bytesReceived-l.bytesReceived||0)/r.statsInterval,u.bitrate=Math.round(8e3*r.receivedKBitrate),u.bandwidth=Math.round(u.bitrate/1024),r.decoderOutputFrameRate=1e3*(n.framesDecoded-l.framesDecoded)/r.statsInterval,u.frame_rate_decoded=Math.round(r.decoderOutputFrameRate),u.frame_rate_received=u.frame_rate_decoded,t.video=n,this.dataChannelRTT[t.remoteStream.userId]&&(f=this.dataChannelRTT[t.remoteStream.userId]/2,r.e2eDelay=f+(n.jitterBufferDelay||0),u.web_e2e_delay=r.e2eDelay,u.total_rtt_ms=f),h.subVideo&&(this.processStall(h,u),DU.rtcMediaStatistics(u,{})),[2,r]):(t.video=n,[2,r])):[2,r]}}))}))},e.prototype.processStall=function(e,t){var r=0,n=0,i=0;e.recordedVideoFrames.forEach((function(e){e.isStall&&(r+=e.stallCount,n+=e.stallDuration),i=e.playTime})),e.recordedVideoFrames.length||(n=2e3,r=this._videoInWaiting[e.streamId]?0:1,this._videoInWaiting[e.streamId]=!0);var o=e.recordedVideoFrames.pop();o&&(o.isStall?this._videoInWaiting[e.streamId]=!0:this._videoInWaiting[e.streamId]=!1),e.recordedVideoFrames=[],t.stall_count=r,t.stall_duration=n,t.play_time=i},e.prototype.setLocalStreamStatsEvtInterval=function(e){var t,r,n=this,i={audio:{},video:{},localStream:e,firstframeReported:!1},o=null===(t=e.audioTrack)||void 0===t?void 0:t.getTrack(),a=null===(r=e.videoTrack)||void 0===r?void 0:r.getTrack();this.getAudioStats(o,i),this.getVideoStats(a,i),this.delLocalStreamStatsEvtInterval(e);this._localStreamStasEvtIntervals[e.streamId]=setInterval((function(){return Pp(n,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:return[4,Pp(n,void 0,void 0,(function(){var t,r,n,o,a,s;return Mp(this,(function(c){switch(c.label){case 0:return t=null===(a=e.audioTrack)||void 0===a?void 0:a.getTrack(),r=null===(s=e.videoTrack)||void 0===s?void 0:s.getTrack(),[4,this.getAudioStats(t,i)];case 1:return n=c.sent(),[4,this.getVideoStats(r,i)];case 2:return(o=c.sent()).isScreen=e.isScreen,[2,{audioStats:n,videoStats:o,isScreen:e.isScreen}]}}))}))];case 1:return t=r.sent(),this._client.emit("onLocalStreamStats",t),[2]}}))}))}),2e3)},e.prototype.delLocalStreamStatsEvtInterval=function(e){clearInterval(this._localStreamStasEvtIntervals[e.streamId])},e.prototype.unpublish=function(e){this.delLocalStreamStatsEvtInterval(e),this._firstFrameStarted["".concat(e.streamId,"-audio")]&&(DU.rtcFirstFrame({event_type:tU.SENT_END,media_type:e.isScreen?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-audio")],event_session_id:e.streamId,result:!1,reason:iU.UNPUBLISH}),delete this._firstFrameStarted["".concat(e.streamId,"-audio")]),this._firstFrameStarted["".concat(e.streamId,"-video")]&&(DU.rtcFirstFrame({event_type:tU.SENT_END,media_type:e.isScreen?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-video")],event_session_id:e.streamId,result:!1,reason:iU.UNPUBLISH}),delete this._firstFrameStarted["".concat(e.streamId,"-video")])},e.prototype.getAudioStats=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l=this;return Mp(this,(function(h){switch(h.label){case 0:return r={},n={timestamp:Date.now()},i=t.localStream,o=i.streamId,a=i.audioMid,s=i.isScreen,c={media_type:"audio",direction:"up",stream_id:o,vid:a},e&&this._handler?(t.audioStart||(t.audioStart=qw(),DU.rtcFirstFrame({event_type:tU.BEGIN_SEND,media_type:s?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.PUBLISH,start:t.audioStart,event_session_id:o}),this._firstFrameStarted["".concat(o,"-audio")]=t.audioStart),[4,this._handler.getStats(e)]):[2,r];case 1:return(u=h.sent()).length?(u.forEach((function(e){var i=e.type,a=e.packetsSent,u=e.packetsLost,d=e.bytesSent,h=e.clockRate,f=e.roundTripTime,p=e.channels,_=e.audioLevel,v=e.googRtt,m=e.mimeType,E=e.availableIncomingBitrate,S=e.availableOutgoingBitrate,g=e.bytesReceived,y=e.nominated,b=e.id,T=e.currentRoundTripTime,I=e.state,R=e.writable,A=e.requestsReceived,C=e.responsesReceived,O=e.requestsSent,N=e.consentRequestsSent,w=e.responsesSent,D=e.jitter,k=e.candidateType,P=e.ip,M=e.address,U=e.networkType,L=e.port,x=e.protocol,V=e.nackCount,B=e.retransmittedBytesSent,j=e.retransmittedPacketsSent,F=e.roundTripTimeMeasurements,G=e.audioInputLevel,H=e.ssrc,z=e.totalAudioEnergy,Y=e.totalSamplesDuration,K=e.mediaType;"outbound-rtp"===i?(n.packetsSent=a,a>0&&l._firstFrameStarted["".concat(o,"-audio")]&&(DU.rtcFirstFrame({event_type:tU.SENT_END,media_type:s?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.PUBLISH,event_session_id:o,result:!0,start:t.audioStart}),delete l._firstFrameStarted["".concat(o,"-audio")]),n.bytesSent=d,c.bytes=d,c.packets=a,c.nack_count=V,c.ssrc=H,c.retransmitted_bytes_sent=B,c.retransmitted_packets_sent=j):"remote-inbound-rtp"===i?(n.packetsLost=u,c.packets_lost=u,c.jitter=1e3*D,r.rtt=1e3*f,c.rtt=r.rtt,c.round_trip_time_measurements=F):"codec"===i?(r.recordSampleRate=h,r.numChannels=p,c.codec=m):"media-source"===i?(c.audio_level=-10*Math.log10(Math.pow(_,2)),c.volume=255*_,c.total_audio_energy=z,c.total_samples_duration=Y):"ssrc"===i&&"audio"===K?(c.audio_network_elapse=v,c.send_level=G):"candidate-pair"===i?(c.ice_available_incoming_bitrate=E,c.ice_available_outgoing_bitrate=S,c.ice_bytes_received=g,c.ice_bytes_sent=d,c.ice_nominated=+y,c.ice_pair_id=b,c.ice_pair_rtt=T,c.ice_pair_state=I,c.ice_pair_writable=R,c.recv_ping_requests=A,c.recv_ping_responses=C,c.sent_ping_requests_before_first_response=O,c.sent_ping_requests_total=O+(N||0),c.sent_ping_responses=w):"local-candidate"===i?(c.local_candidate_type=k,c.local_ip=P||M,c.local_network_type=U,c.local_port=L,c.protocol=x):"remote-candidate"===i&&(c.remote_candidate_type=k,c.remote_ip=P||M,c.remote_port=L)})),(d=t.audio).timestamp?(void 0!==n.packetsLost&&(r.audioLossRate=(n.packetsLost-d.packetsLost)/(n.packetsSent-d.packetsSent),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,c.fraction_lost=r.audioLossRate),r.statsInterval=n.timestamp-d.timestamp,r.sentKBitrate=(n.bytesSent-d.bytesSent||0)/r.statsInterval,c.bitrate=Math.round(8e3*r.sentKBitrate),c.bandwidth=Math.round(c.bitrate/1024),t.audio=n,DU.rtcMediaStatistics(c,{}),[2,r]):(t.audio=n,[2,r])):[2,r]}}))}))},e.prototype.getVideoStats=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l=this;return Mp(this,(function(h){switch(h.label){case 0:return r={},n={timestamp:Date.now()},i=t.localStream,o=i.streamId,a=i.videoMid,s=i.isScreen,c={media_type:"video",direction:"up",stream_id:o,vid:a},e&&this._handler?(t.videoStart||(t.videoStart=qw(),DU.rtcFirstFrame({event_type:tU.BEGIN_SEND,media_type:s?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.PUBLISH,start:t.videoStart,event_session_id:o}),this._firstFrameStarted["".concat(o,"-video")]=t.videoStart),[4,this._handler.getStats(e)]):[2,r];case 1:return(u=h.sent()).length?(u.forEach((function(e){var i=e.type,a=e.framesEncoded,u=e.packetsLost,d=e.bytesSent,h=e.framesSent,f=e.roundTripTime,p=e.mimeType,_=e.frameWidth,v=e.frameHeight,m=e.clockRate,E=e.packetsSent,S=e.googActualEncBitrate,g=e.googAvailableReceiveBandwidth,y=e.googAvailableSendBandwidth,b=e.googAvgEncodeMs,T=e.googBucketDelay,I=e.googEncodeUsagePercent,R=e.googFrameRateInput,A=e.availableIncomingBitrate,C=e.availableOutgoingBitrate,O=e.bytesReceived,N=e.nominated,w=e.id,D=e.currentRoundTripTime,k=e.state,P=e.writable,M=e.candidateType,U=e.ip,L=e.address,x=e.networkType,V=e.port,B=e.nackCount,j=e.pliCount,F=e.protocol,G=e.qpSum,H=e.requestsReceived,z=e.responsesReceived,Y=e.googRetransmitBitrate,K=e.requestsSent,X=e.consentRequestsSent,W=e.responsesSent,q=e.ssrc,J=e.googTargetEncBitrate,Z=e.googTransmitBitrate,$=e.googRtt,Q=e.retransmittedPacketsSent,ee=e.encoderImplementation,te=e.jitter;"outbound-rtp"===i?(n.framesEncoded=a,n.bytesSent=d,c.bytes=d,n.packetsSent=E,c.packets=E,c.nack_count=B,c.pli_count=j,c.qp_sum=G,c.ssrc=q,c.retransmitted_packets_sent=Q,c.encoder_implementation=ee):"track"===i?(h&&(n.framesSent=h,h>0&&l._firstFrameStarted["".concat(o,"-video")]&&(t.firstframeVideoReported=!0,DU.rtcFirstFrame({event_type:tU.SENT_END,media_type:s?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.PUBLISH,start:t.videoStart,event_session_id:o,result:!0}),delete l._firstFrameStarted["".concat(o,"-video")])),r.encodedFrameWidth=_,r.encodedFrameHeight=v,c.frame_size_height=v,c.frame_size_width=_):"remote-inbound-rtp"===i?(n.packetsLost=u,r.rtt=1e3*f,c.rtt=r.rtt,c.jitter=te,c.packets_lost=u):"codec"===i?(r.codecType=p,c.codec=p,r.inputFrameRate=m):"candidate-pair"===i?(c.ice_available_incoming_bitrate=A,c.ice_available_outgoing_bitrate=C,c.ice_bytes_received=O,c.ice_bytes_sent=d,c.ice_nominated=+N,c.ice_pair_id=w,c.ice_pair_rtt=D,c.ice_pair_state=k,c.ice_pair_writable=P,c.recv_ping_requests=H,c.recv_ping_responses=z,c.sent_ping_requests_before_first_response=K,c.sent_ping_requests_total=K+X,c.sent_ping_responses=W):"local-candidate"===i?(c.local_candidate_type=M,c.local_ip=U||L,c.local_network_type=x,c.local_port=V,c.protocol=F):"remote-candidate"===i?(c.remote_candidate_type=M,c.remote_ip=U||L,c.remote_port=V):"VideoBwe"===i?(c.actual_enc_bitrate=S,c.available_receive_bandwidth=g,c.available_send_bandwidth=y,c.bucket_delay=T,c.retransmit_bitrate=Y,c.target_enc_bitrate=J,c.transmit_bitrate=Z):"ssrc"===i&&(c.video_network_elapse=$,c.avg_encode_ms=b,c.encode_usage_percent=I,c.frame_rate_input=R)})),(d=t.video).timestamp?(r.statsInterval=n.timestamp-d.timestamp,r.encodedFrameCount=void 0!==n.framesSent?n.framesSent-d.framesSent:n.framesEncoded-d.framesEncoded,r.sentKBitrate=(n.bytesSent-d.bytesSent||0)/r.statsInterval,c.bitrate=Math.round(8e3*r.sentKBitrate),c.bandwidth=Math.round(c.bitrate/1024),r.encoderOutputFrameRate=1e3*(n.framesEncoded-d.framesEncoded)/r.statsInterval,c.frame_rate_encoded=Math.round(r.encoderOutputFrameRate),r.sentFrameRate=1e3*r.encodedFrameCount/r.statsInterval,c.frame_rate_sent=Math.round(r.sentFrameRate),r.videoLossRate=(n.packetsLost-d.packetsLost)/(n.packetsSent-d.packetsSent),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,c.fraction_lost=r.videoLossRate,t.video=n,DU.rtcMediaStatistics(c,{}),[2,r]):(t.video=n,[2,r])):[2,r]}}))}))},e.prototype.getDataChannelRTT=function(e){var t,r=this,n=qw();null===(t=this._client.sendUserMessage(e,"__web__rtc__rtt__"))||void 0===t||t.then((function(t){if("timeout"!==t){var i=Date.now()-n;i>0&&i<2e3&&(r.dataChannelRTT[e]=i)}else clearTimeout(r._rttTimer[e])})).catch((function(){clearTimeout(r._rttTimer[e])})),clearTimeout(this._rttTimer[e]),this._rttTimer[e]=setTimeout((function(){r.getDataChannelRTT(e)}),2e3)},e.prototype.destroy=function(){var e=this;Object.keys(this._localStreamStasEvtIntervals).forEach((function(t){clearInterval(e._localStreamStasEvtIntervals[t])})),Object.keys(this._remoteStreamStasEvtIntervals).forEach((function(t){clearInterval(e._remoteStreamStasEvtIntervals[t])})),Object.keys(this._rttTimer).forEach((function(t){clearTimeout(e._rttTimer[t])})),this._rttTimer={},this.dataChannelRTT={},this._videoInWaiting={}},e}(),VL=new CD("MediaServerClient",2);!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(LL||(LL={}));var BL=function(e,t){VL.print(e,"userId: %o, subAudio: %o, subVideo: %o, paused: %o, audioMid: %o, videoMid: %o, workaround_1_: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.paused,t.audioMid,t.videoMid,t._workaround_1_,t.sequenceId)},jL=function(e){function t(){var t=e.call(this)||this;return t._ontrackCallbackMap=new Map,t._pubSubLock=new PL("pubSubLock"),t._joinLeaveLock=new PL("joinLeaveLock"),t._state=LL.DISCONNECTED,t._roomAttributes={multiChatMode:!1,bigRoomMode:!1},t}return wp(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){VL.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(TU.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[bU.ON_ADD_STREAM,bU.ON_REMOVE_STREAM,bU.USER_CONNECTION,bU.USER_DISCONNECTION,bU.ON_UPDATE_STREAM_ATTRIBUTES,bU.ON_UPDATE_ROOM_ATTRIBUTES,bU.ON_PUSH_TRACK,bU.ON_REMOVE_TRACK,bU.NODE_CHANGE,bU.ON_CUSTOM_MESSAGE,bU.USER_MESSAGE_RECEIVED,bU.USER_BINARY_MESSAGE_RECEIVED,bU.POST_PROCESSING_MESSAGE].forEach((function(e){var r;null===(r=t._dataChannelSignal)||void 0===r||r.on(e,(function(r){t.safeEmit(e,r)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){VL.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(TU.ABNORMAL_DISCONNECTION)}))},t.prototype._removeSignalEventHandler=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()},Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(TU.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.join=function(e,t,r,n){var i,o;return void 0===t&&(t={}),void 0===r&&(r=!1),Pp(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,f,p=this;return Mp(this,(function(_){switch(_.label){case 0:return VL.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,r,n),this._appId=e.appId,this._token=e.token,this._roomId=e.roomId,this._clientId=e.userInfo.userId,this._businessId=e.userInfo.businessId,this._userInfo=e.userInfo,this._sessionId=Yw(),PU.setStats({rtc_session_id:this._sessionId}),this.connectionState=LL.CONNECTING,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),t.node?(a=t.node,xU("es.join.nodeChange",t),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return p.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new WU,[4,null===(i=this._iceConfigRequestManager)||void 0===i?void 0:i.getAccessNode(this._appId,this._roomId,this._clientId,KU.getDeviceId(),null==t?void 0:t.reason,this._prevICENode)];case 2:if(!(a=_.sent()))throw xU("es.join.getNodeFailed",""),new XN(HN.ICE_SERVER_WRONG,"get ICE config failed");xU("es.join.getNodeSuccess",a),_.label=3;case 3:this._prevICENode=a,this._handler=new wL,this._addHandlerEvents(),this._statsReport=new xL(this,this._handler),Promise.resolve().then((function(){return p.emit("onEstablishConnectionHook")})),_.label=4;case 4:return _.trys.push([4,6,,7]),[4,this._handler.connect(a)];case 5:return s=_.sent(),VL.print("join","establish peerConnection success"),[3,7];case 6:throw c=_.sent(),this.connectionState=LL.DISCONNECTED,new XN(HN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",c);case 7:return this._dataChannelSignal=new GU(s),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[4,null===(o=this._handler)||void 0===o?void 0:o.getDefaultSdp()];case 8:u=_.sent(),d={Authorization:$w.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId,timestamp:Date.now(),controlMessage:n,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role},params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:fk.VERSION,deviceId:KU.getDeviceId(),appId:this._appId,roomId:this._roomId,userId:this._clientId,businessId:this._businessId},options:{enableUnBundleMode:!0},sdpInfo:u},Promise.resolve().then((function(){return p.emit("onSendingJoinMessageHook")})),_.label=9;case 9:return _.trys.push([9,11,,12]),l=r?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(l,d)];case 10:return h=_.sent(),VL.print("join","send join message success"),this._authorization=d.Authorization,this.connectionState=LL.CONNECTED,[2,h];case 11:if(f=_.sent(),this.connectionState=LL.DISCONNECTED,705===(null==f?void 0:f.code))throw new XN(HN.INVALID_TOKEN,(null==f?void 0:f.message)||"Invalid token");if(200!==(null==f?void 0:f.code))throw new XN(HN.JOIN_ROOM_FAILED,(null==f?void 0:f.message)||"Join room failed");return[3,12];case 12:return[2]}}))}))},t.prototype.publish=function(e){var t,r,n,i,o,a,s,c;return Pp(this,void 0,void 0,(function(){var u,d,l,h,f,p,_,v,m,E,S;return Mp(this,(function(g){switch(g.label){case 0:VL.print("publish()","localStream: %o",e),u=e.videoTrack,d=e.audioTrack,l=qw(),h="",f="",p="",g.label=1;case 1:return g.trys.push([1,5,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e)];case 2:if(!(_=g.sent()))throw new XN(HN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return h=_.audioMid,f=_.videoMid,p=_.sdp,e.pubAttributes={localaudio:!!d,localvideo:!!u,videostream:!!(null===(r=null==u?void 0:u.getTrack())||void 0===r?void 0:r.enabled),audiostream:!!(null===(n=null==d?void 0:d.getTrack())||void 0===n?void 0:n.enabled)},v={attributes:Dp({videoDescriptions:_.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:h,videoMid:f,sdpInfo:{msid:e.stream.id,type:_.type,sdp:_.partialSdp,semantics:_.semantics}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("publish",v)];case 3:if(200!==(null==(m=g.sent())?void 0:m.code))throw new XN(HN.PUBLISH_FAILED,(null==m?void 0:m.message)||"publish failed");return E=null===(o=null==m?void 0:m.relayMessage)||void 0===o?void 0:o.sdp,[4,null===(a=this._handler)||void 0===a?void 0:a.setAnswerSdp(_.sdp,E,void 0,e,KM.UP)];case 4:return g.sent(),e.streamId=m.streamId,e.videoMid=f,e.audioMid=h,DU.rtcPublishStat(qM.SUCCESS,JM.W_0,l,ZM.UNKNOWN),null===(s=this._statsReport)||void 0===s||s.setLocalStreamStatsEvtInterval(e),[2];case 5:return(S=g.sent())instanceof Error&&DU.rtcPublishStat(qM.FAIL,JM.W_0,l,S.message),h&&f?[4,null===(c=this._handler)||void 0===c?void 0:c.rollback(p,[h,f])]:[3,7];case 6:g.sent(),g.label=7;case 7:throw S;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,r,n,i,o,a;return Pp(this,void 0,void 0,(function(){var s,c,u,d,l,h,f,p,_,v,m,E,S,g,y,b;return Mp(this,(function(T){switch(T.label){case 0:VL.print("updatePubTrack()","localStream: %o",e),s=e.videoTrack,c=e.audioTrack,null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack((null==s?void 0:s.getTrack())||null),c?(u=c.mixType,d=c.mixedAudioTrack,l=null==c?void 0:c.getTrack(),d&&u!==yL.PLAYOUT&&!0===l.enabled&&(l=d),null===(r=e.audioTransceiver)||void 0===r||r.sender.replaceTrack(l)):null===(n=e.audioTransceiver)||void 0===n||n.sender.replaceTrack(null),h={localaudio:!!c,localvideo:!!s,videostream:!!(null===(i=null==s?void 0:s.getTrack())||void 0===i?void 0:i.enabled),audiostream:!!(null===(o=null==c?void 0:c.getTrack())||void 0===o?void 0:o.enabled)},f={};try{for(p=Up(Object.entries(h)),_=p.next();!_.done;_=p.next())v=Lp(_.value,2),m=v[0],(E=v[1])!==Reflect.get(e.pubAttributes,m)&&Reflect.set(f,m,E)}catch(e){y={error:e}}finally{try{_&&!_.done&&(b=p.return)&&b.call(p)}finally{if(y)throw y.error}}return Object.keys(f).length?(e.pubAttributes=h,S={roomId:this._roomId,streamId:e.streamId,attributes:f},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateStreamAttributes",S)]):[2];case 1:if(200!==(null==(g=T.sent())?void 0:g.code))throw new XN(HN.UPDATE_TRACK_FAILED,(null==g?void 0:g.message)||"update track failed");return[2]}}))}))},t.prototype.unpublish=function(e){var t,r,n;return Pp(this,void 0,void 0,(function(){var i,o;return Mp(this,(function(a){switch(a.label){case 0:return VL.print("unpublish()","localStream: %o",e),i={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unpublish",i)];case 1:if(200!==(null==(o=a.sent())?void 0:o.code))throw new XN(HN.UNPUBLISH_FAILED,(null==o?void 0:o.message)||"unpublish failed");return[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 2:return a.sent(),null===(n=this._statsReport)||void 0===n||n.unpublish(e),[2]}}))}))},t.prototype.subscribe=function(e,t,r){var n,i,o,a,s,c,u,d,l;return Pp(this,void 0,void 0,(function(){var h,f,p,_,v,m,E,S,g,y,b,T,I,R,A,C,O,N,w,D;return Mp(this,(function(k){switch(k.label){case 0:if(e.hasSubscribed)return[2,this._updateSubTrack(e,t,r)];VL.print("subscribe()","mediaType: %o, config: %o",t,r),BL("subscribe()",e),h=!1,f=!1,t===ik.VIDEO_ONLY?h=!0:t===ik.AUDIO_ONLY?f=!0:t===ik.AUDIO_AND_VIDEO?(h=!0,f=!0):t===ik.NONE&&(h=!1,f=!1),p=qw(),_=e.audioMid,v=e.videoMid,E=!1,k.label=1;case 1:return k.trys.push([1,12,,15]),_&&v?(E=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e,{audioMid:_,videoMid:v})]):[3,3];case 2:return m=k.sent(),[3,5];case 3:return[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e)];case 4:if(!(m=k.sent()))throw new XN(HN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,k.label=5;case 5:return S={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:v,audioMid:_,sdpInfo:{sdp:null==m?void 0:m.partialSdp,semantics:null==m?void 0:m.semantics,type:null==m?void 0:m.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||f,video:h},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("subscribe",S)];case 6:if(200!==(null==(g=k.sent())?void 0:g.code))throw new XN(HN.SUBSCRIBE_FAILED,(null==g?void 0:g.message)||"subscribe failed");return y=[],b=!this._multiChatMode(),!(_&&v)&&y.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new XN(HN.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(i){"video"===i.mediaType&&(VL.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),b&&y.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new XN(HN.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(VL.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),T=function(t){e.ontrack(t)},null===(a=this._handler)||void 0===a||a.on("ontrack",T),this._ontrackCallbackMap.set(e,T),I=null==g?void 0:g.relayMessage,R=I.audioMid,A=I.videoMid,C=I.sequenceId,O=I.sdp,E&&_!==R?(VL.print("subscribe","mid mot match",_,R),[4,null===(s=this._handler)||void 0===s?void 0:s.closeMLine([_,v])]):[3,9];case 7:return k.sent(),[4,null===(c=this._handler)||void 0===c?void 0:c.subscribe(e)];case 8:if(!(m=k.sent()))throw new XN(HN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,k.label=9;case 9:return(D={})[_]=R,D[v]=A,N=D,e.videoMid=A,e.audioMid=R,e.sequenceId=C,e.subConfig=r,e._workaround_1_=!1,e.paused=!1,e.subMediaType=t,e.hasSubscribed=!0,[4,null===(u=this._handler)||void 0===u?void 0:u.setAnswerSdp(null==m?void 0:m.sdp,O,N,e,KM.DOWN)];case 10:return k.sent(),[4,Promise.all(y)];case 11:return k.sent(),this._multiChatMode()||(e.subAudio=f),e.subVideo=h,DU.rtcSubscribeStat($M.SUCCESS,p,QM.UNKNOWN,e.userId),null===(d=this._statsReport)||void 0===d||d.setRemoteStreamStatsEvtInterval(e),[2];case 12:return(w=k.sent())instanceof Error&&DU.rtcSubscribeStat($M.FAIL,p,w.message,e.userId),_&&v?[4,null===(l=this._handler)||void 0===l?void 0:l.rollback(null==m?void 0:m.sdp,[_,v])]:[3,14];case 13:k.sent(),k.label=14;case 14:throw w;case 15:return[2]}}))}))},t.prototype.controlMessage=function(e){var t;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){switch(r.label){case 0:return VL.print("controlMessage()","params: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",Dp(Dp({},e),{roomId:this._roomId}))];case 1:return r.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){switch(r.label){case 0:return VL.print("updateUserAttributes()","attributes: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:e})];case 1:return r.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(n){return[2,this._updateSubTrack(e,t,r)]}))}))},t.prototype._updateSubTrack=function(e,t,r){var n;return Pp(this,void 0,void 0,(function(){var i,o,a,s;return Mp(this,(function(c){switch(c.label){case 0:return VL.print("updateSubTrack()","mediaType: %o, config: %o",t,r),BL("updateSubTrack()",e),i=!1,o=!1,t===ik.VIDEO_ONLY?(i=!0,o=!1):t===ik.AUDIO_ONLY?(o=!0,i=!1):t===ik.AUDIO_AND_VIDEO?(i=!0,o=!0):t===ik.NONE&&(i=!1,o=!1),a={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:i,audio:!!this._multiChatMode()||o},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateSubscribe",a)];case 1:if(200!==(null==(s=c.sent())?void 0:s.code))throw new XN(HN.UPDATE_TRACK_FAILED,(null==s?void 0:s.message)||"update track failed");return e.paused=!i,this._multiChatMode()||(e.subAudio=o),e.subVideo=i,e.subMediaType=t,e.subConfig=r,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var r,n,i,o,a;return Pp(this,void 0,void 0,(function(){var s,c,u,d,l,h,f,p,_,v,m,E,S;return Mp(this,(function(g){switch(g.label){case 0:if(VL.print("subscribe4pushTrack()","streamInfo: %o",t),BL("subscribe4pushTrack()",e),s=null==t?void 0:t.message,c=s.audioMid,u=s.videoMid,d=s.sequenceId,l=s.sdp,e.subAudio=!0,d<e.sequenceId)return VL.print("subscribe4pushTrack","sequenceId return",d,e.sequenceId),[2];h=e.audioMid,f=e.videoMid,g.label=1;case 1:return g.trys.push([1,8,,11]),h&&f?[4,null===(r=this._handler)||void 0===r?void 0:r.subscribe(e,{audioMid:h,videoMid:f})]:[3,3];case 2:return p=g.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(p=g.sent()))throw new XN(HN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");h=p.audioMid,f=p.videoMid,g.label=5;case 5:return(S={})[h]=c,S[f]=u,_=S,VL.print("onpushtrack midmap",e.userId,_),e.audioMid=c,e.videoMid=u,e.sequenceId=d,v=[],e.audioTrack||v.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new XN(HN.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(VL.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),m=function(t){e.ontrack(t)},null===(i=this._handler)||void 0===i||i.on("ontrack",m),this._ontrackCallbackMap.set(e,m),[4,null===(o=this._handler)||void 0===o?void 0:o.setAnswerSdp(null==p?void 0:p.sdp,l,_,e,KM.DOWN)];case 6:return g.sent(),[4,Promise.all(v)];case 7:return g.sent(),[2];case 8:return E=g.sent(),p?[4,null===(a=this._handler)||void 0===a?void 0:a.rollback(null==p?void 0:p.sdp,[h,f])]:[3,10];case 9:g.sent(),g.label=10;case 10:throw E;case 11:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var r;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(n){switch(n.label){case 0:return BL("unsubscribe4removeTrack()",e),VL.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(VL.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])]);case 1:return n.sent(),VL.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),[2]}}))}))},t.prototype.unsubscribe=function(e){var t,r,n;return Pp(this,void 0,void 0,(function(){var i;return Mp(this,(function(o){switch(o.label){case 0:BL("unsubscribe()",e),i={roomId:this._roomId,streamId:e.streamId,userId:e.userId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unsubscribe",i)];case 2:case 3:return o.sent(),[3,4];case 4:return e.hasSubscribed=!1,e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),e.subAudio?[3,6]:[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 5:o.sent(),VL.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(n=this._statsReport)||void 0===n||n.unsubscribe(e),o.label=6;case 6:return[2]}}))}))},t.prototype.removeOnTrackListener=function(e){var t,r=this._ontrackCallbackMap.get(e);r&&(null===(t=this._handler)||void 0===t||t.off("ontrack",r),this._ontrackCallbackMap.delete(e))},t.prototype.handleRemoveStream=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){return BL("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==yU.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this.unsubscribe(e),[2]}))}))},t.prototype.leave=function(){var e;return Pp(this,void 0,void 0,(function(){var t,r;return Mp(this,(function(n){switch(n.label){case 0:return VL.print("leave()"),(this.connectionState=LL.CONNECTED)?(this.connectionState=LL.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]):[3,7];case 1:r=n.sent(),n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("leaveRoom",t)];case 3:case 4:return n.sent(),[3,6];case 5:return r(),[7];case 6:return[3,8];case 7:return[2,Promise.resolve()];case 8:return[2]}}))}))},t.prototype.destroy=function(){var e,t,r,n;VL.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(r=this._iceConfigRequestManager)||void 0===r||r.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),null===(n=this._statsReport)||void 0===n||n.destroy(),this.connectionState=LL.DISCONNECTED,this.emit("INTERRUPT")},t.prototype.sendUserMessage=function(e,t){var r;return null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})},t.prototype.sendRoomMessage=function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)},t.prototype._multiChatMode=function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode},Object.defineProperty(t.prototype,"handler",{get:function(){return this._handler},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomAttributes",{set:function(e){this._roomAttributes=e},enumerable:!1,configurable:!0}),kp([HL],t.prototype,"join",null),kp([GL,FL],t.prototype,"publish",null),kp([GL,FL],t.prototype,"updatePubTrack",null),kp([GL,FL],t.prototype,"unpublish",null),kp([GL,FL],t.prototype,"subscribe",null),kp([FL],t.prototype,"controlMessage",null),kp([FL],t.prototype,"updateUserAttributes",null),kp([GL,FL],t.prototype,"updateSubTrack",null),kp([GL,FL],t.prototype,"subscribe4pushTrack",null),kp([GL,FL],t.prototype,"unsubscribe4removeTrack",null),kp([GL,FL],t.prototype,"unsubscribe",null),kp([GL,FL],t.prototype,"handleRemoveStream",null),t}(ND);function FL(e,t,r){var n=r.value;return r.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){switch(r.label){case 0:return this._handler&&this._state===LL.CONNECTED?[4,n.apply(this,e)]:[3,2];case 1:return r.sent(),[3,3];case 2:throw new XN(HN.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},r}function GL(e,t,r){var n=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Pp(this,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:return[4,this._pubSubLock.lock()];case 1:t=r.sent(),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,n.apply(this,e)];case 3:return[2,r.sent()];case 4:return t(),[7];case 5:return[2]}}))}))},r}function HL(e,t,r){var n=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Pp(this,void 0,void 0,(function(){var t,r=this;return Mp(this,(function(i){return t=!1,[2,new Promise((function(i,o){return Pp(r,void 0,void 0,(function(){var r,a;return Mp(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new XN(HN.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.apply(this,e)];case 2:return r=s.sent(),i(r),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},r}var zL=T,YL=Sc,KL=lv.exports.getWeakData,XL=Dt,WL=F,qL=Cc,JL=cu,ZL=Ue,$L=br.set,QL=br.getterFor,ex=Pi.find,tx=Pi.findIndex,rx=zL([].splice),nx=0,ix=function(e){return e.frozen||(e.frozen=new ox)},ox=function(){this.entries=[]},ax=function(e,t){return ex(e.entries,(function(e){return e[0]===t}))};ox.prototype={get:function(e){var t=ax(this,e);if(t)return t[1]},has:function(e){return!!ax(this,e)},set:function(e,t){var r=ax(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=tx(this.entries,(function(t){return t[0]===e}));return~t&&rx(this.entries,t,1),!!~t}};var sx,cx={getConstructor:function(e,t,r,n){var i=e((function(e,i){qL(e,o),$L(e,{type:t,id:nx++,frozen:void 0}),null!=i&&JL(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=QL(t),s=function(e,t,r){var n=a(e),i=KL(XL(t),!0);return!0===i?ix(n).set(t,r):i[n.id]=r,e};return YL(o,{delete:function(e){var t=a(this);if(!WL(e))return!1;var r=KL(e);return!0===r?ix(t).delete(e):r&&ZL(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!WL(e))return!1;var r=KL(e);return!0===r?ix(t).has(e):r&&ZL(r,t.id)}}),YL(o,r?{get:function(e){var t=a(this);if(WL(e)){var r=KL(e);return!0===r?ix(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),i}},ux=n,dx=T,lx=Sc,hx=lv.exports,fx=Qv,px=cx,_x=F,vx=Ev,mx=br.enforce,Ex=er,Sx=!ux.ActiveXObject&&"ActiveXObject"in ux,gx=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},yx=fx("WeakMap",gx,px);if(Ex&&Sx){sx=px.getConstructor(gx,"WeakMap",!0),hx.enable();var bx=yx.prototype,Tx=dx(bx.delete),Ix=dx(bx.has),Rx=dx(bx.get),Ax=dx(bx.set);lx(bx,{delete:function(e){if(_x(e)&&!vx(e)){var t=mx(this);return t.frozen||(t.frozen=new sx),Tx(this,e)||t.frozen.delete(e)}return Tx(this,e)},has:function(e){if(_x(e)&&!vx(e)){var t=mx(this);return t.frozen||(t.frozen=new sx),Ix(this,e)||t.frozen.has(e)}return Ix(this,e)},get:function(e){if(_x(e)&&!vx(e)){var t=mx(this);return t.frozen||(t.frozen=new sx),Ix(this,e)?Rx(this,e):t.frozen.get(e)}return Rx(this,e)},set:function(e,t){if(_x(e)&&!vx(e)){var r=mx(this);r.frozen||(r.frozen=new sx),Ix(this,e)?Ax(this,e,t):r.frozen.set(e,t)}else Ax(this,e,t);return this}})}var Cx=function(e){function t(){var t=e.call(this)||this;return t._hasVideoPermission=!1,t._hasAudioPermission=!1,t.inited=!1,t.deviceMap=new Map,t._handleDeviceChange=t._handleDeviceChange.bind(t),!Zw()&&t.refreshDevices(),t}return wp(t,e),t.prototype.refreshDevices=function(){return Pp(this,void 0,void 0,(function(){var e=this;return Mp(this,(function(t){switch(t.label){case 0:return navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2];case 1:return t.sent().filter((function(e){return""!==e.deviceId})).forEach((function(t){e.deviceMap.set(t.deviceId,{deviceName:t.label,deviceInfo:t,deviceId:t.deviceId,deviceType:t.kind,deviceState:"active"})})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){return"function"==typeof(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",this._handleDeviceChange),[2]}))}))},t.prototype._handleDeviceChange=function(){return Pp(this,void 0,void 0,(function(){var e,t,r=this;return Mp(this,(function(n){switch(n.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return e=n.sent(),t=Array.from(this.deviceMap.values()),e.forEach((function(e){var t=r.deviceMap.get(e.deviceId);r.deviceMap.set(e.deviceId,{deviceName:e.label,deviceType:e.kind,deviceId:e.deviceId,deviceInfo:e,deviceState:"active"}),t&&"inactive"!==t.deviceState||r.emit("onMediaDeviceStateChanged",{deviceName:e.label,deviceType:e.kind,deviceId:e.deviceId,deviceInfo:e,deviceState:"active"})})),t.forEach((function(t){e.find((function(e){return e.deviceId===t.deviceId}))||(t.deviceState="inactive",r.deviceMap.delete(t.deviceId),r.emit(rD.onMediaDeviceStateChanged,t))})),[2]}}))}))},t.prototype.getVideoPermission=function(){return Pp(this,void 0,void 0,(function(){var e=this;return Mp(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new XN(HN.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasVideoPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasVideoPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasVideoPermission]}}))}))},t.prototype.getAudioPermission=function(){return Pp(this,void 0,void 0,(function(){var e=this;return Mp(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new XN(HN.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasAudioPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasAudioPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasAudioPermission]}}))}))},t.prototype.getDevices=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.getAudioPermission()];case 1:case 2:return e.sent(),[3,3];case 3:return e.trys.push([3,5,,6]),[4,this.getVideoPermission()];case 4:case 5:return e.sent(),[3,6];case 6:return[4,this.refreshDevices()];case 7:return e.sent(),[2,Array.from(this.deviceMap.values()).filter((function(e){return"active"===e.deviceState}))]}}))}))},t.prototype.getMicrophones=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.values()).filter((function(e){return"active"===e.deviceState})).filter((function(e){return"audioinput"===e.deviceType}))]}}))}))},t.prototype.getCameras=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.values()).filter((function(e){return"active"===e.deviceState})).filter((function(e){return"videoinput"===e.deviceType}))]}))}))},t.prototype.getAudioPlayback=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.values()).filter((function(e){return"active"===e.deviceState})).filter((function(e){return"audiooutput"===e.deviceType}))]}))}))},t.prototype.getDeviceById=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return[4,this.getDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},Object.defineProperty(t.prototype,"hasAudioPermission",{get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new XN(HN.NO_PERMISSION,"Cannot revoke audio permission");this.refreshDevices(),this._hasAudioPermission=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasVideoPermission",{get:function(){return this._hasVideoPermission},set:function(e){if(!e)throw new XN(HN.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}(ND),Ox=new Cx,Nx=function(){function e(){}return e.prototype.getAudioContextInstance=function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance},e}(),wx=function(){function e(e){var t=Dx.getAudioContextInstance();this._track=e;var r=new MediaStream;r.addTrack(e);var n=t.createMediaStreamSource(r),i=t.createAnalyser();n.connect(i),this._analyserNode=i}return e.prototype.getAudioLevel=function(){var e=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(e);var t=0;return e.forEach((function(e){return t=Math.max(t,Math.abs(e-128))})),t/128*255},e}(),Dx=new Nx,kx=new CD("VERTC",0),Px=new WeakMap,Mx=function(e){return Px.get(e)},Ux=function(e){function t(t,r){var n=e.call(this)||this;return n._trackId=t,n.mediaType=r,n}return wp(t,e),t.prototype.getId=function(){return this._trackId},t}(ND),Lx=function(e){function t(t,r,n){var i=e.call(this,r,n)||this;return i._mediaTrack=t,i._initListeners(),i}return wp(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t.prototype.close=function(){var e;return null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()},t.prototype._initListeners=function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){DU.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(Ux),xx=function(e){function t(t,r,n){var i=e.call(this,r,n)||this;return i._mediaTrack=t,i}return wp(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(Ux),Vx=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return wp(t,e),t.prototype.updateVideoCaptureConfig=function(){var e;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig?(kx.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.videoCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t}(Lx),Bx=function(e){function t(t,r){var n=e.call(this,t,r,"audio")||this;return n.mixType=yL.PLAYOUT_AND_PUBLISH,n}return wp(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new wx(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.updateAudioCaptureConfig=function(){var e;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(kx.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.audioCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t}(Lx),jx=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return wp(t,e),t}(xx),Fx=function(e){function t(t,r){return e.call(this,t,r,"audio")||this}return wp(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new wx(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(xx),Gx=function(e){function t(t,r){return e.call(this,t,r)||this}return wp(t,e),t}(Bx),Hx=function(e){function t(t,r){return e.call(this,t,r)||this}return wp(t,e),t}(Vx),zx=function(e){function t(t,r){return e.call(this,t,r)||this}return wp(t,e),t}(Vx),Yx=function(e){function t(t,r){return e.call(this,t,r)||this}return wp(t,e),t}(Bx),Kx=function(e){function t(t,r){return e.call(this,t,r)||this}return wp(t,e),t}(Vx),Xx=function(e){function t(t,r){return e.call(this,t,r)||this}return wp(t,e),t}(Bx);function Wx(e){var t;return Pp(this,void 0,void 0,(function(){var r,n,i,o,a,s;return Mp(this,(function(c){switch(c.label){case 0:n=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",c.label=1;case 1:return c.trys.push([1,3,,4]),kx.print("createCameraVideoTrack","constraints:",e),DU.rtcVideoCaptureEvent({event_type:fU.START,media_device_id:n}),i=qw(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return r=c.sent(),DU.rtcVideoCaptureEvent({event_type:fU.START_CAPTURE_RESULT,media_device_id:n,reason:_U.SUCCESS,elapse:qw()-i}),Ox.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),DU.rtcVideoCaptureEvent({event_type:fU.RUNNING_FAILED,media_device_id:n,error_code:o.code,reason:o.message}),new XN(HN.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getVideoTracks()[0],Px.set(a,r),(s=new Hx(a,Ww())).videoCaptureConfig=e,[2,s]}}))}))}function qx(e){var t;return Pp(this,void 0,void 0,(function(){var r,n,i,o,a;return Mp(this,(function(s){switch(s.label){case 0:kx.print("createCameraVideoTrack","constraints:",e),n=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",s.label=1;case 1:return s.trys.push([1,3,,4]),DU.rtcVideoCaptureEvent({event_type:fU.START,media_device_id:n}),i=qw(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return r=s.sent(),DU.rtcVideoCaptureEvent({event_type:fU.START_CAPTURE_RESULT,media_device_id:n,reason:_U.SUCCESS,elapse:qw()-i}),Ox.hasAudioPermission=!0,[3,4];case 3:throw o=s.sent(),DU.rtcVideoCaptureEvent({event_type:fU.RUNNING_FAILED,media_device_id:n,error_code:o.code,reason:o.message}),new XN(HN.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getAudioTracks()[0],Px.set(a,r),[2,new Gx(a,Ww())]}}))}))}function Jx(e){return void 0===e&&(e=!1),Pp(this,void 0,void 0,(function(){var t,r,n;return Mp(this,(function(i){switch(i.label){case 0:kx.print("createScreenStream","withAudio:",e),i.label=1;case 1:return i.trys.push([1,3,,4]),DU.rtcVideoCaptureEvent({event_type:fU.START,media_device_id:"screen"}),r=qw(),[4,navigator.mediaDevices.getDisplayMedia({video:!0,audio:e})];case 2:return t=i.sent(),DU.rtcVideoCaptureEvent({event_type:fU.START_CAPTURE_RESULT,media_device_id:"screen",reason:_U.SUCCESS,elapse:qw()-r}),[3,4];case 3:throw n=i.sent(),DU.rtcVideoCaptureEvent({event_type:fU.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.message}),new XN(HN.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,t]}}))}))}var Zx,$x,Qx=function(){function e(){}return e.getNalunits=function(t){if(t.length-t.position<4)return[];var r=t.position;return 1===t.getInt32(r)||0===t.getInt16(r)&&1===t.getInt8(r+2)?e.getAnnexbNals(t):e.getAvccNals(t)},e.getAnnexbNals=function(t){for(var r=[],n=e.getHeaderPositionAnnexB(t),i=n.pos,o=i;i<t.length-4;){var a=new Uint8Array(t.buffer.slice(i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(i+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&r.push(s),t.skip(o-t.position),i=o}return r},e.getAvccNals=function(t){for(var r=[];t.position<t.length-4;){var n=t.getInt32(t.position);if(!(t.length-t.position>=n))break;var i=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+n));t.skip(n);var a={header:i,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&r.push(a)}return r},e.analyseNal=function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}},e.getHeaderPositionAnnexB=function(e){for(var t=e.position,r=0,n=e.length;3!==r&&4!==r&&t<n-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===n-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=n:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=n)),{pos:t,headerLength:r}},e.getAvcc=function(e,t){var r=new Uint8Array(e.byteLength+t.byteLength+11);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var n=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),n),n+=2,r.set(e,n),r[n+=e.byteLength]=1,n++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),n),n+=2,r.set(t,n),r},e}(),eV=function(){function e(e){this._position=0,this._dataview=new DataView(e)}return Object.defineProperty(e.prototype,"length",{get:function(){return this.buffer.byteLength},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._dataview.buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),e.prototype.back=function(e){this.position-=e},e.prototype.getUint8=function(e){return this._dataview.getUint8(e)},e.prototype.getInt8=function(e){return this._dataview.getInt8(e)},e.prototype.getInt16=function(e){return this._dataview.getInt16(e)},e.prototype.getUint16=function(e){return this._dataview.getUint16(e)},e.prototype.getUint32=function(e){return this._dataview.getUint32(e)},e.prototype.getInt32=function(e){return this._dataview.getInt32(e)},e.prototype.skip=function(t){for(var r=Math.floor(t/4),n=t%4,i=0;i<r;i++)e.readByte(this,4);n>0&&e.readByte(this,n)},e.readByte=function(e,t,r){var n;switch(t){case 1:n=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:n=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");n=e.getUint8(e.position)<<16,n|=e.getUint8(e.position+1)<<8,n|=e.getUint8(e.position+2);break;case 4:n=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");n=e.getUint32(e.position)<<32,n|=e.getUint32(e.position+4);break;default:n=""}return e.position+=t,n},e.prototype.readUint8=function(){return e.readByte(this,1)},e.prototype.readUint16=function(){return e.readByte(this,2)},e.prototype.readUint24=function(){return e.readByte(this,3)},e.prototype.readUint32=function(){return e.readByte(this,4)},e.prototype.readUint64=function(){return e.readByte(this,8)},e.prototype.readInt8=function(){return e.readByte(this,1,!0)},e.prototype.readInt16=function(){return e.readByte(this,2,!0)},e.prototype.readInt32=function(){return e.readByte(this,4,!0)},e.prototype.writeUint32=function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])},e}(),tV=new CD("Stream",0),rV=function(){function e(){this.isScreen=!1,this.seiList=[],this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1}}return Object.defineProperty(e.prototype,"hasPublished",{get:function(){return this.videoTransceiver&&this.audioTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),e.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(AL()){var r=t.createEncodedStreams(),n=r.readable,i=r.writable,o=new TransformStream({transform:function(t,r){var n=e.seiList[0];if(n){var i=new Uint8Array(n.content.byteLength+5);i.set([0,0,0,1,6]),i.set(n.content,5);var o=new Uint8Array(i.byteLength+t.data.byteLength);0===n.repeatCount&&e.seiList.splice(0,1),n.repeatCount--,o.set(new Uint8Array(t.data)),o.set(i,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else tV.print("no sender found when trying to bind encodedTransform")},e.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else tV.print("no sender found when trying to bind encodedTransform")},e.prototype.clean=function(){this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0},e.prototype.updateVideoBitrate=function(e){var t,r=null===(t=null==e?void 0:e[0])||void 0===t?void 0:t.maxKbps;if("number"==typeof r&&r&&this.videoTransceiver){var n=this.videoTransceiver.sender,i=n.getParameters();i.encodings&&0!==i.encodings.length||(i.encodings=[{}]),i.encodings[0].maxBitrate=1e3*r,tV.print("updateVideoBitrate","set sendEncodings: ",i),n.setParameters(i)}},e.prototype.switchTrackEnableState=function(e,t){var r;"audio"===e?r=this.audioTrack:"video"===e&&(r=this.videoTrack);var n=null==r?void 0:r.getTrack();return!(!n||(null==n?void 0:n.enabled)===t)&&(n.enabled=t,!0)},e}(),nV=function(e){function t(t,r,n,i){var o=e.call(this)||this;return o.userId=t,o.isScreen=n,o.streamId=r,o.hasAudio=i.localaudio,o.hasVideo=i.localvideo,o._attributes=i,o.subVideo=!1,o.subAudio=!1,o._sequenceId=0,o.subMediaType=ik.NONE,o.recordedVideoFrames=[],o.subConfig={videoIndex:0},o.hasSubscribed=!1,o}return wp(t,e),Object.defineProperty(t.prototype,"sequenceId",{get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo,this.hasAudio=e.localaudio,this._attributes=e},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){var n=Qx.getNalunits(new eV(t.data)).find((function(e){return e.sei}));n&&e.safeEmit("onSEIMessage",n.body.slice(1)),r.enqueue(t)}})).pipeTo(n)}else tV.print("no receiver found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else tV.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,r,n;if((null===(r=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===r?void 0:r.id)===this.streamId){var i=e.track;"video"===(null==i?void 0:i.kind)?this._setVideoTrack(i):"audio"===(null===(n=e.track)||void 0===n?void 0:n.kind)&&this._setAudioTrack(i),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){tV.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=[],this.paused=!1,this._workaround_1_=!1},t.prototype.resetHasSubscribed=function(){this.hasSubscribed=!1},t.prototype._setStream=function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}},t.prototype._setAudioTrack=function(e){var t,r;(null===(r=null===(t=this.audioTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new Fx(e,Ww()),this.emit("ontrack",this.audioTrack))},t.prototype._setVideoTrack=function(e){var t,r;(null===(r=null===(t=this.videoTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new jx(e,Ww()),this.emit("ontrack",this.videoTrack))},t}(ND);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(Zx||(Zx={})),function(e){e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_MUTE_AUDIO="on_user_mute_audio",e.ON_USER_MUTE_VIDEO="on_user_mute_video",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result"}($x||($x={}));var iV=new CD("Room",1),oV=function(e){function t(t){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._roomConfig=t,r._mediaServerClient=new jL,r._addHandlerEventHandler(),r._isReconnecting=!1,r}return wp(t,e),Object.defineProperty(t.prototype,"hasScreenPublished",{get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasPublished",{get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._mediaServerClient.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){return this._remoteUsers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){return this._remoteStreams},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localStream",{get:function(){return this._localStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenStream",{get:function(){return this._localScreenStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomInfo",{get:function(){return this._roomInfo},enumerable:!1,configurable:!0}),t.prototype._addHandlerEventHandler=function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m=this;null===(e=this._mediaServerClient)||void 0===e||e.on(bU.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(bU.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(bU.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(bU.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(bU.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(bU.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(bU.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(bU.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(bU.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(bU.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(bU.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(bU.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(bU.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(TU.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(TU.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on("onRemoteStreamStats",(function(e){m.emit("onRemoteStreamStats",e)})),null===(v=this._mediaServerClient)||void 0===v||v.on("onLocalStreamStats",(function(e){m.emit("onLocalStreamStats",e)}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,r,n,i){return Pp(this,void 0,void 0,(function(){var o=this;return Mp(this,(function(a){return PU.setStats({rtc_app_id:e,room_id:t,user_id:n.userId}),iV.print("join()"),[2,new Promise((function(a,s){return Pp(o,void 0,void 0,(function(){var o;return Mp(this,(function(c){return this._joinResolveCallback=a,this._joinRejectCallback=s,this._controlMessage=i,this._roomInfo={appId:e,roomId:t,token:r,userInfo:n},o=qw(),DU.joinRoom(sU.BEGIN,o,!1,""),this._join((function(e){DU.joinRoom(sU.END,o,!0,e.message),a(e)}),(function(e){DU.joinRoom(sU.END,o,!1,e.message),s(e)})),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,r){var n;return void 0===r&&(r=!1),Pp(this,void 0,void 0,(function(){var i,o,a;return Mp(this,(function(s){switch(s.label){case 0:i=qw(),iV.print("_join()"),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback},r,this._controlMessage)];case 2:return o=s.sent(),this._mediaServerClient.roomAttributes=o.roomAttributes,this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e(null===(n=this._roomInfo)||void 0===n?void 0:n.userInfo),this._isReconnecting=!1,DU.rtcJoinRoom(0,"web","web",qw()-i),this._onJoinSucc(o,r),[3,4];case 3:return(a=s.sent()).code!==HN.OPERATION_CANCEL&&"function"==typeof t?[2,t(a)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,r){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(n){switch(n.label){case 0:return iV.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new rV,this._localScreenStream.isScreen=!0),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=r,this._localScreenStream.videoEncodeConfig=e,this._localScreenStream.hasPublished?[3,2]:[4,this._mediaServerClient.publish(this._localScreenStream)];case 1:return n.sent(),[3,4];case 2:return[4,this.updatePubScreenTrack()];case 3:n.sent(),n.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return iV.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),this._localScreenStream?[4,this._mediaServerClient.updatePubTrack(this._localScreenStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublishScreen=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return iV.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?[4,this._mediaServerClient.unpublish(this._localScreenStream)]:[3,2];case 1:e.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.controlMessage=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return iV.print("controlMessage","Invoke controlMessage"),this._controlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),"stopped"===e.action&&delete this._controlMessage,[2]}}))}))},t.prototype.updateUserAttributes=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return iV.print("updateUserAttributes","Invoke updateUserAttributes"),e.role&&this._roomInfo&&(this._roomInfo.userInfo.role=e.role),[4,this._mediaServerClient.updateUserAttributes(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.publish=function(e,t,r){return Pp(this,void 0,void 0,(function(){var n;return Mp(this,(function(i){switch(i.label){case 0:if(iV.print("publish","Invoke publish"),this._localStream||(this._localStream=new rV),this._localStream.videoTrack=t,this._localStream.audioTrack=r,this._localStream.videoEncodeConfig=e,this._localStream.hasPublished)return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._mediaServerClient.publish(this._localStream)];case 2:return i.sent(),this.emit($x.ON_PUBLISH_RESULT,{isScreen:!1,state:QD.PUBLISH_SUCC}),[3,4];case 3:throw n=i.sent(),this.emit($x.ON_PUBLISH_RESULT,{isScreen:!1,state:QD.PUBLISH_FAIL}),n;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:i.sent(),i.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return iV.print("updatePubTrack","Invoke updatePubTrack"),this._localStream?[4,this._mediaServerClient.updatePubTrack(this._localStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublish=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return iV.print("unpublish","Invoke unpublish"),this._localStream?[4,this._mediaServerClient.unpublish(this._localStream)]:[3,2];case 1:e.sent(),this._localStream.clean(),this._localStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.subscribe=function(e,t,r){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(n){switch(n.label){case 0:return iV.print("subscribe","remoteStream %o",e),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){var n,i;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(o){return iV.print("updateSubTrack","Invoke updateSubTrack"),e.subMediaType===t&&(null===(n=null==e?void 0:e.subConfig)||void 0===n?void 0:n.videoIndex)===(null==r?void 0:r.videoIndex)?[2,Promise.resolve(e)]:[2,null===(i=this._mediaServerClient)||void 0===i?void 0:i.updateSubTrack(e,t,r)]}))}))},t.prototype.unsubscribe=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return iV.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.leave=function(){return Pp(this,void 0,void 0,(function(){var e,t;return Mp(this,(function(r){switch(r.label){case 0:iV.print("leave","Invoke leave"),e=qw(),r.label=1;case 1:return r.trys.push([1,3,4,5]),clearTimeout(this._reconnectTimer),[4,this._mediaServerClient.leave()];case 2:return r.sent(),DU.rtcLeaveRoom(0,"",qw()-e),[3,5];case 3:return(t=r.sent())instanceof Error&&DU.rtcLeaveRoom(-1,t.message,qw()-e),[3,5];case 4:return this.destroy(),[7];case 5:return[2]}}))}))},t.prototype.destroy=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return iV.print("destroy","Invoke destroy"),this.connectionState!==LL.CONNECTED?[3,2]:[4,this.leave()];case 1:e.sent(),e.label=2;case 2:return this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map,this._remoteStreams=new Map,this._localStream=void 0,this._localScreenStream=void 0,this._removeHandlerEventHandler(),[2]}}))}))},t.prototype.updateToken=function(e){iV.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e)},t.prototype.muteLocalTrack=function(e,t){var r,n;return Pp(this,void 0,void 0,(function(){var i,o;return Mp(this,(function(a){switch(a.label){case 0:return this._localStream&&(null===(r=this._localStream)||void 0===r?void 0:r.hasPublished)?(i=t!==ZD.MUTE_STATE_OFF,(o=this._localStream.switchTrackEnableState(e,i))?[4,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updatePubTrack(this._localStream)]:[3,2]):[2,!1];case 1:a.sent(),a.label=2;case 2:return[2,o]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return Pp(this,void 0,void 0,(function(){var t,r,n,i,o,a,s=this;return Mp(this,(function(c){t=[];try{for(r=Up(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())i=n.value,Array.isArray(i)&&i.forEach((function(r){if(r.hasSubscribed){var n=null;switch(e){case tk.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===ik.AUDIO_ONLY?n=ik.NONE:r.subMediaType===ik.AUDIO_AND_VIDEO&&(n=ik.VIDEO_ONLY);break;case tk.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===ik.VIDEO_ONLY?n=ik.NONE:r.subMediaType===ik.AUDIO_AND_VIDEO&&(n=ik.AUDIO_ONLY);break;case tk.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==ik.NONE&&(n=ik.NONE)}if(null!==n){var i=s.updateSubTrack(r,n,r.subConfig);i&&t.push(i)}}}))}catch(e){o={error:e}}finally{try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return Pp(this,void 0,void 0,(function(){var t,r,n,i,o,a,s=this;return Mp(this,(function(c){t=[];try{for(r=Up(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())i=n.value,Array.isArray(i)&&i.forEach((function(r){if(r.hasSubscribed){var n=null;switch(e){case tk.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===ik.NONE?n=ik.AUDIO_ONLY:r.subMediaType===ik.VIDEO_ONLY&&(n=ik.AUDIO_AND_VIDEO);break;case tk.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===ik.NONE?n=ik.VIDEO_ONLY:r.subMediaType===ik.AUDIO_ONLY&&(n=ik.AUDIO_AND_VIDEO);break;case tk.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==ik.AUDIO_AND_VIDEO&&(n=ik.AUDIO_AND_VIDEO)}if(null!==n){var i=s.updateSubTrack(r,n,r.subConfig);i&&t.push(i)}}}))}catch(e){o={error:e}}finally{try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.sendUserMessage=function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)},t.prototype.sendRoomMessage=function(e,t){var r,n;return void 0===t&&(t=!1),Pp(this,void 0,void 0,(function(){var i,o;return Mp(this,(function(a){switch(a.label){case 0:return i={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:t,message:""},t?(o=i,[4,$w.ab2b64str(e)]):[3,2];case 1:return o.message=a.sent(),[3,3];case 2:i.message=e,a.label=3;case 3:return[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(i)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){iV.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new jL,this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var r,n,i,o,a,s=this;iV.print("JoinSuccess()");var c=[],u=[],d=[],l=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var r=s._remoteUsers.get(t.clientId);r?r._stillExist=!0:c.push(t)}}));try{for(var h=Up(this._remoteUsers.values()),f=h.next();!f.done;f=h.next()){var p=f.value;p._stillExist?delete p._stillExist:u.push({clientId:p.userId,leaveReason:"Left during disconnection"})}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}e.streams.forEach((function(e){var t=s._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):l.push(e)}));try{for(var _=Up(this._remoteStreams.values()),v=_.next();!v.done;v=_.next()){var m=v.value;Array.isArray(m)&&m.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:yU.clientDisconnected})}))}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=_.return)&&o.call(_)}finally{if(i)throw i.error}}setTimeout((function(){u.forEach((function(e){return s._onUserDisconnection(e)})),c.forEach((function(e){return s._onUserConnection(e)})),d.forEach((function(e){return s._onRemoveStream(e)})),l.forEach((function(e){return s._onAddStream(e)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,r=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));try{for(var n=Up(this._remoteStreams.values()),i=n.next();!i.done;i=n.next()){var o=i.value;Array.isArray(o)&&o.forEach((function(e){return Pp(r,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:if(!e.hasSubscribed)return[3,4];e.resetHasSubscribed(),r.label=1;case 1:return r.trys.push([1,3,,4]),iV.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType,e.subConfig)];case 2:return r.sent(),iV.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit($x.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=r.sent(),iV.print("failed resubscribe ".concat(e.userId," with ").concat(e.subMediaType,", error:").concat(t)),e.clean(),null==e||e.resetHasSubscribed(),[3,4];case 4:return[2]}}))}))}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},t.prototype._findRemoteStream=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.streamId===t})):null},t.prototype._findRemoteStreamByScreen=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.isScreen===t})):null},t.prototype._onAddStream=function(e,t){var r;if(void 0===t&&(t=!0),e.clientId!==(null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId)){var n=this._findRemoteStream(e.clientId,e.streamId);if(!n){n=new nV(e.clientId,e.streamId,e.screen,e.attributes),this._initStreamListeners(n);var i=this._remoteStreams.get(e.clientId);i?i.push(n):this._remoteStreams.set(e.clientId,[n])}return t&&this.safeEmit(bU.ON_ADD_STREAM,{stream:n}),!n.isScreen&&n.hasVideo&&this.safeEmit($x.ON_USER_START_VIDEO_CAPTURE,{userId:n.userId}),!n.isScreen&&n.hasAudio&&this.safeEmit($x.ON_USER_START_AUDIO_CAPTURE,{userId:n.userId}),n}},t.prototype._onUserConnection=function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,Dp(Dp({},r),{_stillExist:!0})),this.safeEmit(bU.USER_CONNECTION,{userInfo:r})}},t.prototype._onUserDisconnection=function(e){var t,r,n=this,i=e.clientId,o=e.leaveReason,a=this._remoteUsers.get(i);this._remoteUsers.delete(i);var s=this._remoteStreams.get(i);Array.isArray(s)&&s.length&&(s.forEach((function(e){n.safeEmit(bU.ON_REMOVE_STREAM,{stream:e,reason:"Client leave"})})),this._remoteStreams.delete(i)),"userDuplicateLogin"===e.tag&&i===(null===(r=null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo)||void 0===r?void 0:r.userId)&&(a={userId:i},o=e.tag),(null==a?void 0:a.userId)&&this.safeEmit(bU.USER_DISCONNECTION,{userInfo:{userId:null==a?void 0:a.userId},reason:o})},t.prototype._onRemoveStream=function(e){var t,r,n=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._remoteStreams.get(e.clientId);if(i){var o=i.find((function(t){return t.streamId==e.streamId}));o&&(null===(r=this._mediaServerClient)||void 0===r||r.handleRemoveStream(o,e).then((function(){if(!(null==o?void 0:o._workaround_1_)){var t=n._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),n._remoteStreams.set(e.clientId,t)}})),this.safeEmit(bU.ON_REMOVE_STREAM,{stream:o,reason:e.message}))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t=e.clientId,r=e.streamId,n=e.attributes,i=this._findRemoteStream(t,r);if(i){var o=i.attributes,a=Dp(Dp({},o),n);i.attributes=a,a.localaudio!==o.localaudio&&(a.localaudio?this.safeEmit($x.ON_USER_START_AUDIO_CAPTURE,{userId:t}):this.safeEmit($x.ON_USER_STOP_AUDIO_CAPTURE,{userId:t})),a.localvideo!==o.localvideo&&(a.localvideo?this.safeEmit($x.ON_USER_START_VIDEO_CAPTURE,{userId:t}):this.safeEmit($x.ON_USER_STOP_VIDEO_CAPTURE,{userId:t})),a.audiostream!==o.audiostream&&(a.audiostream?this.safeEmit($x.ON_USER_MUTE_AUDIO,{userInfo:{userId:t},muteState:ZD.MUTE_STATE_ON}):this.safeEmit($x.ON_USER_MUTE_AUDIO,{userInfo:{userId:t},muteState:ZD.MUTE_STATE_OFF})),a.videostream!==o.videostream&&(a.videostream?this.safeEmit($x.ON_USER_MUTE_VIDEO,{userInfo:{userId:t},muteState:ZD.MUTE_STATE_ON}):this.safeEmit($x.ON_USER_MUTE_VIDEO,{userInfo:{userId:t},muteState:ZD.MUTE_STATE_OFF}))}},t.prototype._onPushTrack=function(e){var t=this,r=e.clientId,n=e.streamId,i=this._findRemoteStream(r,n);i||(i=this._onAddStream(e,!1)),this._mediaServerClient.subscribe4pushTrack(i,e).then((function(){return t.safeEmit($x.SUBSCRIBE_PUSH_TRACK,{stream:i})})).catch((function(e){iV.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,r=e.clientId,n=e.streamId,i=e.message,o=this._findRemoteStream(r,n);o&&this._mediaServerClient.unsubscribe4removeTrack(o,i).then((function(){var e;if(o._workaround_1_){var i=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==n}));t._remoteStreams.set(r,i||[])}t.safeEmit($x.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){iV.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t=e.nodes,r=e.reason;this._destroyAndInitMediaServerClient(),Array.isArray(t)&&t.length?this._getAccessNode=t[0]:this._getAccessFeedback=r,DU.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(r)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,r=this;this._isReconnecting=!0,DU.rtcReconnect(1002,MM.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,UM.PEERCONNECTION);try{for(var n=Up(this._remoteStreams.values()),i=n.next();!i.done;i=n.next()){var o=i.value;Array.isArray(o)&&o.forEach((function(e){return e.clean()}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._join((function(){DU.rtcReconnected(LM.PEERCONNECTION_RECONNECTED,xM.PEERCONNECTION)}),(function(e){iV.print("Reconnecting error, will reconnect after 3s",e),r._reconnectTimer=setTimeout(r._reconnect.bind(r),3e3)}),!0)},t.prototype._handleAbnormalDisconnection=function(){iV.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=setTimeout(this._reconnect.bind(this),3e3)},t.prototype._onConnectionStateChange=function(e){var t;if(e.next===LL.DISCONNECTED)t=ak.CONNECTION_STATE_DISCONNECTED;else if(e.next===LL.CONNECTED)t=this._isReconnecting?ak.CONNECTION_STATE_RECONNECTED:ak.CONNECTION_STATE_CONNECTED;else{if(e.next!==LL.CONNECTING)return;t=this._isReconnecting?ak.CONNECTION_STATE_RECONNECTING:ak.CONNECTION_STATE_CONNECTING}this.safeEmit(TU.ON_CONNECTION_STATE_CHANGE,{state:t})},t.prototype._initStreamListeners=function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(r){var n;t.emit($x.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(n=t._roomInfo)||void 0===n?void 0:n.roomId,streamIndex:e.isScreen?nk.STREAM_INDEX_SCREEN:nk.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(bU.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){var t=e.msg;try{t=JSON.parse(t)}catch(e){}this.safeEmit(bU.USER_MESSAGE_RECEIVED,{userId:e.from,message:t})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(bU.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){var t,r=(null===(t=e.body)||void 0===t?void 0:t.error)||0;this.safeEmit(bU.POST_PROCESSING_MESSAGE,{code:r,message:["success","parameter error","subscription timeout","ffmpeg error","cdn error"][r]})},t}(ND),aV=function(e,t){return void 0===t&&(t={}),t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var r=Lp(t,2),n=r[0],i=r[1];e.setAttribute(n,i)})),e},sV=new CD("Player",0),cV=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],uV={playsinline:"","webkit-playsinline":""},dV={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},lV=function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var r="audio"===e?uV:dV;if("video"===e&&this.videoCache.length>0){if(n=this.videoCache.pop())return aV(n,{style:t,attributes:r}),n}else if("audio"===e&&this.audioCache.length>0){var n;if(n=this.audioCache.pop())return aV(n,{style:t,attributes:r}),n}return function(e,t){void 0===t&&(t={});var r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=Lp(e,2),n=t[0],i=t[1];r.setAttribute(n,i)})),r}(e,{style:t,attributes:r})},e.prototype.recycle=function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)},e}(),hV=new lV,fV=function(e){function t(t){var r=e.call(this)||this;r.emitVideoEvent=function(e){var t,n,i={type:"video",rawEvent:e,readyState:(null===(t=r._videoDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:e.type,currentTime:(null===(n=r._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:r.isScreen};r.emit("playback_event",i)},r._internalPlay=function(){var e;if(null===(e=r._videoDom)||void 0===e?void 0:e.paused){var t=r._videoDom.play();(null==t?void 0:t.then)&&t.catch((function(e){var t;DU.rtcError("video autoplay failed, userId: ".concat(r.userId),-1e3),r.emit("playback_event",{type:"video",rawEvent:e,readyState:r._videoDom.readyState||0,userId:r.userId,eventName:"autoplay-error",currentTime:(null===(t=r._videoDom)||void 0===t?void 0:t.currentTime)||0})}))}};var n=t.renderDom,i=t.userId;r.renderMode=void 0!==t.renderMode?t.renderMode:rk.RENDER_MODE_FIT;var o="string"==typeof n?document.getElementById(n):n;if(!o)throw new XN(HN.CANT_FIND_DOM,"can't find dom");return r._containerDom=o,r.userId=i,r.isScreen=!!t.isScreen,r._initVideo(),r}return wp(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=hV.getOrCreate("video",{width:"100%",height:"100%",background:"black"}),this._videoDom.id="".concat(this.userId,"_").concat(Ww()),this.renderMode===rk.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover"),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&cV.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._videoDom&&(cV.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(r){var n;if("timeupdate"===r.eventName){if(void 0===t.__cumulativeTime&&(t.__cumulativeTime=0),0===(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime))return;if(t._videoDom.currentTime>t.__cumulativeTime){var i=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),o=t._videoDom.currentTime-t.__cumulativeTime>.5;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:o,stallCount:o?1:0,stallDuration:i%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var r;return Pp(this,void 0,void 0,(function(){var n,i,o=this;return Mp(this,(function(a){return n=this._videoDom,sV.print("playVideo","play video track: ".concat(this.userId)),n&&n.srcObject instanceof MediaStream&&n.srcObject.getTrackById(null===(r=e.getTrack())||void 0===r?void 0:r.id)||(n||(this._initVideo(),n=this._videoDom),sV.print("playVideo","play video by dom: ".concat(null==n?void 0:n.id)),(i=new MediaStream).addTrack(e.getTrack()),n.srcObject=i,this._containerDom.appendChild(n),n.addEventListener("canplay",this._internalPlay),n.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return o._internalPlay()})),t&&this._recordFrame(t)),[2]}))}))},t.prototype.updateSrcObject=function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}},t.prototype.manuallyPlay=function(){if(sV.print("Invoke AudioPlayer.manuallyPlay"),!this._videoDom)throw new XN(HN.INVALID_PARAMS,"Player not found");var e=this._videoDom.play();return(null==e?void 0:e.then)?e:Promise.resolve(e)},t.prototype.mirror=function(e){sV.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;sV.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom),hV.recycle(this._videoDom),this._removeListeners(),delete this._videoDom),this._videoDom=void 0,this.__cumulativeTime=void 0},t.prototype.destroy=function(){this.stop(),e.prototype.removeAllListeners.call(this)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(vD.exports.EventEmitter),pV=function(e){function t(t,r){var n=e.call(this)||this;if(n.emitVideoEvent=function(e){var t,r,i={type:"audio",rawEvent:e,readyState:(null===(t=n._audioDom)||void 0===t?void 0:t.readyState)||0,userId:n.userId,eventName:e.type,currentTime:(null===(r=n._audioDom)||void 0===r?void 0:r.currentTime)||0};n.emit("playback_event",i)},n._internalPlay=function(){var e,t;if(xU("_internalPlay",{paused:null===(e=n._audioDom)||void 0===e?void 0:e.paused}),null===(t=n._audioDom)||void 0===t?void 0:t.paused)try{var r=n._audioDom.play();(null==r?void 0:r.then)&&r.catch((function(e){n._autoPlayError(e)})).then((function(){xU("_internalPlay successfully",{userId:n.userId})}))}catch(e){n._autoPlayError(e)}},r){var i=document.getElementById(r);if(!i)throw new XN(HN.CANT_FIND_DOM,"can't find dom");n._containerDom=i}else n._containerDom=document.body;return n.userId=t,n._initAudio(),n}return wp(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=hV.getOrCreate("audio",{display:"none"}),this._audioDom.id="".concat(this.userId,"_").concat(Ww()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&cV.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._audioDom&&(cV.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))},t.prototype.playAudio=function(e){var t;return Pp(this,void 0,void 0,(function(){var r,n,i=this;return Mp(this,(function(o){return sV.print("playAudio","play audio track: ".concat(this.userId)),(r=this._audioDom)&&r.srcObject instanceof MediaStream&&r.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)||(r||(this._initAudio(),r=this._audioDom),(n=new MediaStream).addTrack(e.getTrack()),r.srcObject=n,null==r||r.addEventListener("canplay",this._internalPlay),null==r||r.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return i._internalPlay()}))),[2]}))}))},t.prototype._autoPlayError=function(e){var t;DU.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:this._audioDom.readyState||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(t=this._audioDom)||void 0===t?void 0:t.currentTime)||0})},t.prototype.manuallyPlay=function(){if(sV.print("Invoke AudioPlayer.manuallyPlay"),!this._audioDom)throw new XN(HN.INVALID_PARAMS,"Player not found");var e=this._audioDom.play();return(null==e?void 0:e.then)?e:Promise.resolve(e)},t.prototype.setPlaybackDevice=function(e){return Pp(this,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:return sV.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,Ox.getAudioPlayback()];case 1:return t=r.sent(),t.map((function(e){return e.deviceId})).includes(e)&&this._audioDom&&this._audioDom.setSinkId?[4,this._audioDom.setSinkId(e)]:[2];case 2:return r.sent(),[2]}}))}))},t.prototype.stop=function(){var e=this._containerDom;sV.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom),hV.recycle(this._audioDom),this._removeListeners(),delete this._audioDom),this._audioDom=void 0},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){this.stop(),e.prototype.removeAllListeners.call(this)},t}(vD.exports.EventEmitter),_V="object"==("undefined"==typeof global?"undefined":uo(global))&&global&&global.Object===Object&&global,vV="object"==("undefined"==typeof self?"undefined":uo(self))&&self&&self.Object===Object&&self,mV=_V||vV||Function("return this")(),EV=mV.Symbol,SV=Object.prototype,gV=SV.hasOwnProperty,yV=SV.toString,bV=EV?EV.toStringTag:void 0;var TV=Object.prototype.toString;var IV=EV?EV.toStringTag:void 0;function RV(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":IV&&IV in Object(e)?function(e){var t=gV.call(e,bV),r=e[bV];try{e[bV]=void 0;var n=!0}catch(e){}var i=yV.call(e);return n&&(t?e[bV]=r:delete e[bV]),i}(e):function(e){return TV.call(e)}(e)}function AV(e){return null!=e&&"object"==uo(e)}var CV=Array.isArray;function OV(e){var t=uo(e);return null!=e&&("object"==t||"function"==t)}function NV(e){return e}function wV(e){if(!OV(e))return!1;var t=RV(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var DV=mV["__core-js_shared__"],kV=function(){var e=/[^.]+$/.exec(DV&&DV.keys&&DV.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var PV=Function.prototype.toString;var MV=/^\[object .+?Constructor\]$/,UV=Function.prototype,LV=Object.prototype,xV=UV.toString,VV=LV.hasOwnProperty,BV=RegExp("^"+xV.call(VV).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function jV(e){return!(!OV(e)||(t=e,kV&&kV in t))&&(wV(e)?BV:MV).test(function(e){if(null!=e){try{return PV.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function FV(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var GV=Date.now;var HV,zV,YV,KV=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return jV(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),XV=KV,WV=XV?function(e,t){return XV(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:NV,qV=(HV=WV,zV=0,YV=0,function(){var e=GV(),t=16-(e-YV);if(YV=e,t>0){if(++zV>=800)return arguments[0]}else zV=0;return HV.apply(void 0,arguments)}),JV=/^(?:0|[1-9]\d*)$/;function ZV(e,t){var r=uo(e);return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&JV.test(e))&&e>-1&&e%1==0&&e<t}function $V(e,t,r){"__proto__"==t&&XV?XV(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function QV(e,t){return e===t||e!=e&&t!=t}var eB=Object.prototype.hasOwnProperty;function tB(e,t,r){var n=e[t];eB.call(e,t)&&QV(n,r)&&(void 0!==r||t in e)||$V(e,t,r)}var rB=Math.max;function nB(e,t){return qV(function(e,t,r){return t=rB(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=rB(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),FV(e,this,s)}}(e,t,NV),e+"")}function iB(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function oB(e){return null!=e&&iB(e.length)&&!wV(e)}var aB=Object.prototype;function sB(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||aB)}function cB(e){return AV(e)&&"[object Arguments]"==RV(e)}var uB=Object.prototype,dB=uB.hasOwnProperty,lB=uB.propertyIsEnumerable,hB=cB(function(){return arguments}())?cB:function(e){return AV(e)&&dB.call(e,"callee")&&!lB.call(e,"callee")};var fB="object"==("undefined"==typeof exports?"undefined":uo(exports))&&exports&&!exports.nodeType&&exports,pB=fB&&"object"==("undefined"==typeof module?"undefined":uo(module))&&module&&!module.nodeType&&module,_B=pB&&pB.exports===fB?mV.Buffer:void 0,vB=(_B?_B.isBuffer:void 0)||function(){return!1},mB={};mB["[object Float32Array]"]=mB["[object Float64Array]"]=mB["[object Int8Array]"]=mB["[object Int16Array]"]=mB["[object Int32Array]"]=mB["[object Uint8Array]"]=mB["[object Uint8ClampedArray]"]=mB["[object Uint16Array]"]=mB["[object Uint32Array]"]=!0,mB["[object Arguments]"]=mB["[object Array]"]=mB["[object ArrayBuffer]"]=mB["[object Boolean]"]=mB["[object DataView]"]=mB["[object Date]"]=mB["[object Error]"]=mB["[object Function]"]=mB["[object Map]"]=mB["[object Number]"]=mB["[object Object]"]=mB["[object RegExp]"]=mB["[object Set]"]=mB["[object String]"]=mB["[object WeakMap]"]=!1;var EB="object"==("undefined"==typeof exports?"undefined":uo(exports))&&exports&&!exports.nodeType&&exports,SB=EB&&"object"==("undefined"==typeof module?"undefined":uo(module))&&module&&!module.nodeType&&module,gB=SB&&SB.exports===EB&&_V.process,yB=function(){try{var e=SB&&SB.require&&SB.require("util").types;return e||gB&&gB.binding&&gB.binding("util")}catch(e){}}(),bB=yB&&yB.isTypedArray,TB=bB?function(e){return function(t){return e(t)}}(bB):function(e){return AV(e)&&iB(e.length)&&!!mB[RV(e)]},IB=TB,RB=Object.prototype.hasOwnProperty;function AB(e,t){var r=CV(e),n=!r&&hB(e),i=!r&&!n&&vB(e),o=!r&&!n&&!i&&IB(e),a=r||n||i||o,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!RB.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ZV(u,c))||s.push(u);return s}var CB=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),OB=CB,NB=Object.prototype.hasOwnProperty;function wB(e){return oB(e)?AB(e):function(e){if(!sB(e))return OB(e);var t=[];for(var r in Object(e))NB.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var DB=Object.prototype.hasOwnProperty;function kB(e){if(!OV(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=sB(e),r=[];for(var n in e)("constructor"!=n||!t&&DB.call(e,n))&&r.push(n);return r}var PB,MB=(PB=function(e,t){!function(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),i?$V(r,s,c):tB(r,s,c)}}(t,function(e){return oB(e)?AB(e,!0):kB(e)}(t),e)},nB((function(e,t){var r=-1,n=t.length,i=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(i=PB.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!OV(r))return!1;var n=uo(t);return!!("number"==n?oB(r)&&ZV(t,r.length):"string"==n&&t in r)&&QV(r[t],e)}(t[0],t[1],o)&&(i=n<3?void 0:i,n=1),e=Object(e);++r<n;){var a=t[r];a&&PB(e,a,r,i)}return e}))),UB=MB;function LB(e,t){return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}function xB(e){return null==e?[]:LB(e,wB(e))}var VB=o,BB=Ze("iterator"),jB=!VB((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,n){t.delete("b"),r+=n+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[BB]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==r||"x"!==new URL("http://x",void 0).host})),FB=T,GB=/[^\0-\u007E]/,HB=/[.\u3002\uFF0E\uFF61]/g,zB="Overflow: input needs wider integers to process",YB=n.RangeError,KB=FB(HB.exec),XB=Math.floor,WB=String.fromCharCode,qB=FB("".charCodeAt),JB=FB([].join),ZB=FB([].push),$B=FB("".replace),QB=FB("".split),ej=FB("".toLowerCase),tj=function(e){return e+22+75*(e<26)},rj=function(e,t,r){var n=0;for(e=r?XB(e/700):e>>1,e+=XB(e/t);e>455;)e=XB(e/35),n+=36;return XB(n+36*e/(e+38))},nj=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=qB(e,r++);if(i>=55296&&i<=56319&&r<n){var o=qB(e,r++);56320==(64512&o)?ZB(t,((1023&i)<<10)+(1023&o)+65536):(ZB(t,i),r--)}else ZB(t,i)}return t}(e);var r,n,i=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&ZB(t,WB(n));var c=t.length,u=c;for(c&&ZB(t,"-");u<i;){var d=2147483647;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>XB((2147483647-a)/l))throw YB(zB);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>2147483647)throw YB(zB);if(n==o){for(var h=a,f=36;;){var p=f<=s?1:f>=s+26?26:f-s;if(h<p)break;var _=h-p,v=36-p;ZB(t,WB(tj(p+_%v))),h=XB(_/v),f+=36}ZB(t,WB(tj(h))),s=rj(a,l,u==c),a=0,u++}}a++,o++}return JB(t,"")},ij=Fn,oj=n,aj=Y,sj=d,cj=T,uj=jB,dj=Ht.exports,lj=Sc,hj=za,fj=Yh,pj=br,_j=Cc,vj=B,mj=Ue,Ej=Yn,Sj=ni,gj=Dt,yj=F,bj=va,Tj=Go,Ij=m,Rj=zc,Aj=xc,Cj=Cu,Oj=rT,Nj=Ze("iterator"),wj=pj.set,Dj=pj.getterFor("URLSearchParams"),kj=pj.getterFor("URLSearchParamsIterator"),Pj=aj("fetch"),Mj=aj("Request"),Uj=aj("Headers"),Lj=Mj&&Mj.prototype,xj=Uj&&Uj.prototype,Vj=oj.RegExp,Bj=oj.TypeError,jj=oj.decodeURIComponent,Fj=oj.encodeURIComponent,Gj=cj("".charAt),Hj=cj([].join),zj=cj([].push),Yj=cj("".replace),Kj=cj([].shift),Xj=cj([].splice),Wj=cj("".split),qj=cj("".slice),Jj=/\+/g,Zj=Array(4),$j=function(e){return Zj[e-1]||(Zj[e-1]=Vj("((?:%[\\da-f]{2}){"+e+"})","gi"))},Qj=function(e){try{return jj(e)}catch(t){return e}},eF=function(e){var t=Yj(e,Jj," "),r=4;try{return jj(t)}catch(e){for(;r;)t=Yj(t,$j(r--),Qj);return t}},tF=/[!'()~]|%20/g,rF={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},nF=function(e){return rF[e]},iF=function(e){return Yj(Fj(e),tF,nF)},oF=fj((function(e,t){wj(this,{type:"URLSearchParamsIterator",iterator:Rj(Dj(e).entries),kind:t})}),"Iterator",(function(){var e=kj(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),aF=function(e){this.entries=[],this.url=null,void 0!==e&&(yj(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===Gj(e,0)?qj(e,1):e:bj(e)))};aF.prototype={type:"URLSearchParams",bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=Aj(e);if(c)for(r=(t=Rj(e,c)).next;!(n=sj(r,t)).done;){if(o=(i=Rj(gj(n.value))).next,(a=sj(o,i)).done||(s=sj(o,i)).done||!sj(o,i).done)throw Bj("Expected sequence with length 2");zj(this.entries,{key:bj(a.value),value:bj(s.value)})}else for(var u in e)mj(e,u)&&zj(this.entries,{key:u,value:bj(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=Wj(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=Wj(t,"="),zj(this.entries,{key:eF(Kj(r)),value:eF(Hj(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],zj(r,iF(e.key)+"="+iF(e.value));return Hj(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var sF=function(){_j(this,cF);var e=arguments.length>0?arguments[0]:void 0;wj(this,new aF(e))},cF=sF.prototype;if(lj(cF,{append:function(e,t){Cj(arguments.length,2);var r=Dj(this);zj(r.entries,{key:bj(e),value:bj(t)}),r.updateURL()},delete:function(e){Cj(arguments.length,1);for(var t=Dj(this),r=t.entries,n=bj(e),i=0;i<r.length;)r[i].key===n?Xj(r,i,1):i++;t.updateURL()},get:function(e){Cj(arguments.length,1);for(var t=Dj(this).entries,r=bj(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){Cj(arguments.length,1);for(var t=Dj(this).entries,r=bj(e),n=[],i=0;i<t.length;i++)t[i].key===r&&zj(n,t[i].value);return n},has:function(e){Cj(arguments.length,1);for(var t=Dj(this).entries,r=bj(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){Cj(arguments.length,1);for(var r,n=Dj(this),i=n.entries,o=!1,a=bj(e),s=bj(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?Xj(i,c--,1):(o=!0,r.value=s));o||zj(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=Dj(this);Oj(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=Dj(this).entries,n=Ej(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new oF(this,"keys")},values:function(){return new oF(this,"values")},entries:function(){return new oF(this,"entries")}},{enumerable:!0}),dj(cF,Nj,cF.entries,{name:"entries"}),dj(cF,"toString",(function(){return Dj(this).serialize()}),{enumerable:!0}),hj(sF,"URLSearchParams"),ij({global:!0,forced:!uj},{URLSearchParams:sF}),!uj&&vj(Uj)){var uF=cj(xj.has),dF=cj(xj.set),lF=function(e){if(yj(e)){var t,r=e.body;if("URLSearchParams"===Sj(r))return t=e.headers?new Uj(e.headers):new Uj,uF(t,"content-type")||dF(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),Tj(e,{body:Ij(0,bj(r)),headers:Ij(0,t)})}return e};if(vj(Pj)&&ij({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Pj(e,arguments.length>1?lF(arguments[1]):{})}}),vj(Mj)){var hF=function(e){return _j(this,Lj),new Mj(e,arguments.length>1?lF(arguments[1]):{})};Lj.constructor=hF,hF.prototype=Lj,ij({global:!0,forced:!0},{Request:hF})}}var fF,pF={URLSearchParams:sF,getState:Dj},_F=Fn,vF=a,mF=jB,EF=n,SF=Yn,gF=T,yF=So.f,bF=Ht.exports,TF=Cc,IF=Ue,RF=ta,AF=kw,CF=Ca,OF=wf.codeAt,NF=function(e){var t,r,n=[],i=QB($B(ej(e),HB,"."),".");for(t=0;t<i.length;t++)r=i[t],ZB(n,KB(GB,r)?"xn--"+nj(r):r);return JB(n,".")},wF=va,DF=za,kF=Cu,PF=pF,MF=br,UF=MF.set,LF=MF.getterFor("URL"),xF=PF.URLSearchParams,VF=PF.getState,BF=EF.URL,jF=EF.TypeError,FF=EF.parseInt,GF=Math.floor,HF=Math.pow,zF=gF("".charAt),YF=gF(/./.exec),KF=gF([].join),XF=gF(1..toString),WF=gF([].pop),qF=gF([].push),JF=gF("".replace),ZF=gF([].shift),$F=gF("".split),QF=gF("".slice),eG=gF("".toLowerCase),tG=gF([].unshift),rG=/[a-z]/i,nG=/[\d+-.a-z]/i,iG=/\d/,oG=/^0x/i,aG=/^[0-7]+$/,sG=/^\d+$/,cG=/^[\da-f]+$/i,uG=/[\0\t\n\r #%/:<>?@[\\\]^|]/,dG=/[\0\t\n\r #/:<>?@[\\\]^|]/,lG=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,hG=/[\t\n\r]/g,fG=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)tG(t,e%256),e=GF(e/256);return KF(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r&&(t=n,r=i),t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=XF(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},pG={},_G=RF({},pG,{" ":1,'"':1,"<":1,">":1,"`":1}),vG=RF({},_G,{"#":1,"?":1,"{":1,"}":1}),mG=RF({},vG,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),EG=function(e,t){var r=OF(e,0);return r>32&&r<127&&!IF(t,e)?e:encodeURIComponent(e)},SG={ftp:21,file:null,http:80,https:443,ws:80,wss:443},gG=function(e,t){var r;return 2==e.length&&YF(rG,zF(e,0))&&(":"==(r=zF(e,1))||!t&&"|"==r)},yG=function(e){var t;return e.length>1&&gG(QF(e,0,2))&&(2==e.length||"/"===(t=zF(e,2))||"\\"===t||"?"===t||"#"===t)},bG=function(e){return"."===e||"%2e"===eG(e)},TG={},IG={},RG={},AG={},CG={},OG={},NG={},wG={},DG={},kG={},PG={},MG={},UG={},LG={},xG={},VG={},BG={},jG={},FG={},GG={},HG={},zG=function(e,t,r){var n,i,o,a=wF(e);if(t){if(i=this.parse(a))throw jF(i);this.searchParams=null}else{if(void 0!==r&&(n=new zG(r,!0)),i=this.parse(a,null,n))throw jF(i);(o=VF(new xF)).bindURL(this),this.searchParams=o}};zG.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||TG,d=0,l="",h=!1,f=!1,p=!1;for(e=wF(e),t||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,e=JF(e,lG,"")),e=JF(e,hG,""),n=AF(e);d<=n.length;){switch(i=n[d],u){case TG:if(!i||!YF(rG,i)){if(t)return"Invalid scheme";u=RG;continue}l+=eG(i),u=IG;break;case IG:if(i&&(YF(nG,i)||"+"==i||"-"==i||"."==i))l+=eG(i);else{if(":"!=i){if(t)return"Invalid scheme";l="",u=RG,d=0;continue}if(t&&(c.isSpecial()!=IF(SG,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&SG[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=LG:c.isSpecial()&&r&&r.scheme==c.scheme?u=AG:c.isSpecial()?u=wG:"/"==n[d+1]?(u=CG,d++):(c.cannotBeABaseURL=!0,qF(c.path,""),u=FG)}break;case RG:if(!r||r.cannotBeABaseURL&&"#"!=i)return"Invalid scheme";if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=CF(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=HG;break}u="file"==r.scheme?LG:OG;continue;case AG:if("/"!=i||"/"!=n[d+1]){u=OG;continue}u=DG,d++;break;case CG:if("/"==i){u=kG;break}u=jG;continue;case OG:if(c.scheme=r.scheme,i==fF)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=CF(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=NG;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=CF(r.path),c.query="",u=GG;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=CF(r.path),c.path.length--,u=jG;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=CF(r.path),c.query=r.query,c.fragment="",u=HG}break;case NG:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=jG;continue}u=kG}else u=DG;break;case wG:if(u=DG,"/"!=i||"/"!=zF(l,d+1))continue;d++;break;case DG:if("/"!=i&&"\\"!=i){u=kG;continue}break;case kG:if("@"==i){h&&(l="%40"+l),h=!0,o=AF(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||p){var m=EG(v,mG);p?c.password+=m:c.username+=m}else p=!0}l=""}else if(i==fF||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=AF(l).length+1,l="",u=PG}else l+=i;break;case PG:case MG:if(t&&"file"==c.scheme){u=VG;continue}if(":"!=i||f){if(i==fF||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return"Invalid host";if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=BG,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return"Invalid host";if(a=c.parseHost(l))return a;if(l="",u=UG,t==MG)return}break;case UG:if(!YF(iG,i)){if(i==fF||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var E=FF(l,10);if(E>65535)return"Invalid port";c.port=c.isSpecial()&&E===SG[c.scheme]?null:E,l=""}if(t)return;u=BG;continue}return"Invalid port"}l+=i;break;case LG:if(c.scheme="file","/"==i||"\\"==i)u=xG;else{if(!r||"file"!=r.scheme){u=jG;continue}if(i==fF)c.host=r.host,c.path=CF(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=CF(r.path),c.query="",u=GG;else{if("#"!=i){yG(KF(CF(n,d),""))||(c.host=r.host,c.path=CF(r.path),c.shortenPath()),u=jG;continue}c.host=r.host,c.path=CF(r.path),c.query=r.query,c.fragment="",u=HG}}break;case xG:if("/"==i||"\\"==i){u=VG;break}r&&"file"==r.scheme&&!yG(KF(CF(n,d),""))&&(gG(r.path[0],!0)?qF(c.path,r.path[0]):c.host=r.host),u=jG;continue;case VG:if(i==fF||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&gG(l))u=jG;else if(""==l){if(c.host="",t)return;u=BG}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=BG}continue}l+=i;break;case BG:if(c.isSpecial()){if(u=jG,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=fF&&(u=jG,"/"!=i))continue}else c.fragment="",u=HG;else c.query="",u=GG;break;case jG:if(i==fF||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=eG(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||qF(c.path,"")):bG(l)?"/"==i||"\\"==i&&c.isSpecial()||qF(c.path,""):("file"==c.scheme&&!c.path.length&&gG(l)&&(c.host&&(c.host=""),l=zF(l,0)+":"),qF(c.path,l)),l="","file"==c.scheme&&(i==fF||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)ZF(c.path);"?"==i?(c.query="",u=GG):"#"==i&&(c.fragment="",u=HG)}else l+=EG(i,vG);break;case FG:"?"==i?(c.query="",u=GG):"#"==i?(c.fragment="",u=HG):i!=fF&&(c.path[0]+=EG(i,pG));break;case GG:t||"#"!=i?i!=fF&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":EG(i,pG)):(c.fragment="",u=HG);break;case HG:i!=fF&&(c.fragment+=EG(i,_G))}d++}},parseHost:function(e){var t,r,n;if("["==zF(e,0)){if("]"!=zF(e,e.length-1))return"Invalid host";if(t=function(e){var t,r,n,i,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return zF(e,l)};if(":"==h()){if(":"!=zF(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&YF(cG,h());)t=16*t+FF(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!YF(iG,h()))return;for(;YF(iG,h());){if(o=FF(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!=n||u++}if(4!=n)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(QF(e,1,-1)),!t)return"Invalid host";this.host=t}else if(this.isSpecial()){if(e=NF(e),YF(uG,e))return"Invalid host";if(t=function(e){var t,r,n,i,o,a,s,c=$F(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(o=10,i.length>1&&"0"==zF(i,0)&&(o=YF(oG,i)?16:8,i=QF(i,8==o?1:2)),""===i)a=0;else{if(!YF(10==o?sG:8==o?aG:cG,i))return e;a=FF(i,o)}qF(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=HF(256,5-t))return null}else if(a>255)return null;for(s=WF(r),n=0;n<r.length;n++)s+=r[n]*HF(256,3-n);return s}(e),null===t)return"Invalid host";this.host=t}else{if(YF(dG,e))return"Invalid host";for(t="",r=AF(e),n=0;n<r.length;n++)t+=EG(r[n],pG);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return IF(SG,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&gG(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=fG(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+KF(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw jF(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new YG(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+fG(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(wF(e)+":",TG)},getUsername:function(){return this.username},setUsername:function(e){var t=AF(wF(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=EG(t[r],mG)}},getPassword:function(){return this.password},setPassword:function(e){var t=AF(wF(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=EG(t[r],mG)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?fG(e):fG(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,PG)},getHostname:function(){var e=this.host;return null===e?"":fG(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,MG)},getPort:function(){var e=this.port;return null===e?"":wF(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=wF(e))?this.port=null:this.parse(e,UG))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+KF(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,BG))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=wF(e))?this.query=null:("?"==zF(e,0)&&(e=QF(e,1)),this.query="",this.parse(e,GG)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=wF(e))?("#"==zF(e,0)&&(e=QF(e,1)),this.fragment="",this.parse(e,HG)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var YG=function(e){var t=TF(this,KG),r=kF(arguments.length,1)>1?arguments[1]:void 0,n=UF(t,new zG(e,!1,r));vF||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},KG=YG.prototype,XG=function(e,t){return{get:function(){return LF(this)[e]()},set:t&&function(e){return LF(this)[t](e)},configurable:!0,enumerable:!0}};if(vF&&yF(KG,{href:XG("serialize","setHref"),origin:XG("getOrigin"),protocol:XG("getProtocol","setProtocol"),username:XG("getUsername","setUsername"),password:XG("getPassword","setPassword"),host:XG("getHost","setHost"),hostname:XG("getHostname","setHostname"),port:XG("getPort","setPort"),pathname:XG("getPathname","setPathname"),search:XG("getSearch","setSearch"),searchParams:XG("getSearchParams"),hash:XG("getHash","setHash")}),bF(KG,"toJSON",(function(){return LF(this).serialize()}),{enumerable:!0}),bF(KG,"toString",(function(){return LF(this).serialize()}),{enumerable:!0}),BF){var WG=BF.createObjectURL,qG=BF.revokeObjectURL;WG&&bF(YG,"createObjectURL",SF(WG,BF)),qG&&bF(YG,"revokeObjectURL",SF(qG,BF))}DF(YG,"URL"),_F({global:!0,forced:!mF,sham:!vF},{URL:YG});var JG,ZG=function(){function e(e){this._sharedAudioContext=new AudioContext,this._audioDestination=this._sharedAudioContext.createMediaStreamDestination(),this._localGainNode=this._sharedAudioContext.createGain(),this._bufferGainNode=this._sharedAudioContext.createGain(),this.mixingMap=new Map,this.resourcesCache=new Map,this.volumeConfig=new Map,this.cachedBuffer=[],this._context=e,this._localGainNode.gain.value=1}return e.prototype.mixMediaStream=function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)},e.prototype.startAudioMixing=function(e,t,r){return Pp(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,f,p,_=this;return Mp(this,(function(v){switch(v.label){case 0:if(n=r.playCount,sD(i=r.type,"mixingType",xB(yL)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=Mx(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_STOPPED,error:zN.AUDIO_MIXING_ERROR_OK});try{s.gainNode.disconnect(this._audioDestination),s.audioSource.disconnect(s.gainNode)}catch(e){}}return(u=this.resourcesCache.get(e))&&u.filePath===t?(c=u.getAudioNode(),[3,3]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw _._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_FAILED,error:zN.AUDIO_MIXING_ERROR_START_FAILED}),new XN(HN.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:d=v.sent(),c=new Audio(URL.createObjectURL(new Blob([d]))),v.label=3;case 3:return c.crossOrigin="anonymous",n<=0?c.loop=!0:n>0&&(l=n,c.onended=function(){--l>0?c.play():_._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_FINISHED,error:zN.AUDIO_MIXING_ERROR_OK})}),[4,c.play()];case 4:if(v.sent(),h=this._sharedAudioContext.createMediaElementSource(c),f=this._sharedAudioContext.createGain(),p=this.volumeConfig.get(e),f.gain.value=p?p/100:1,h.connect(f).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:h,audioNode:c,gainNode:f,type:"file"}),i===yL.PUBLISH)try{f.disconnect(this._sharedAudioContext.destination)}catch(e){}else f.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],r.type),this._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_PLAYING,error:zN.AUDIO_MIXING_ERROR_OK}),[2]}}))}))},e.prototype.stopAudioMixing=function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_STOPPED,error:zN.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_PAUSED,error:zN.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())},e.prototype.resumeAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_PLAYING,error:zN.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n=this;return Mp(this,(function(i){switch(i.label){case 0:return this.stopAudioMixing(e),[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return n._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_PRELOADED,error:zN.AUDIO_MIXING_ERROR_OK}),t.arrayBuffer();throw n._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_FAILED,error:zN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new XN(HN.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(e){throw new XN(HN.LOAD_RESOURCES_FAILED,"Load resources failed",e)}))];case 1:return r=i.sent(),this.resourcesCache.set(e,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([r])))},filePath:t}),[2]}}))}))},e.prototype.unloadAudioMixing=function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)},e.prototype.getAudioMixingVolume=function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0},e.prototype.setAudioMixingVolume=function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var r=this.mixingMap.get(e);r&&(r.gainNode.gain.value=Number(t)/100)},e.prototype.getAudioMixingDuration=function(e){var t=this.mixingMap.get(e),r=this.mixingMap.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.audioNode.duration:0:0},e.prototype.getAudioMixingCurrentPosition=function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0},e.prototype.setAudioMixingPosition=function(e,t){var r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())},e.prototype.enableAudioMixingBuffer=function(e){sD(e,"type",xB(yL));var t=this._context.getLocalAudioTrack();if(t){var r=Mx(t.getTrack());if(r&&this.mixMediaStream(r),e===yL.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:bL.AUDIO_MIXING_STATE_PCM_ENABLED,error:zN.AUDIO_MIXING_ERROR_OK})}},e.prototype.disableAudioMixingBuffer=function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:bL.AUDIO_MIXING_STATE_PCM_DISABLED,error:zN.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;this._audioBufferSource&&this.cachedBuffer.push(e),this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode),this._audioBufferSource.start(),this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var r=t.cachedBuffer.shift();r&&t.pushAudioMixingBuffer(r)}}},e.prototype.stopAll=function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(e){}this.mixingMap.forEach((function(t,r){e.stopAudioMixing(r)}))},Object.defineProperty(e.prototype,"mixTrack",{get:function(){return this._audioDestination.stream.getAudioTracks()[0]},enumerable:!1,configurable:!0}),e.prototype.destroy=function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()},kp([UU(!1,"id","filePath","options")],e.prototype,"startAudioMixing",null),kp([UU(!1,"id")],e.prototype,"stopAudioMixing",null),kp([UU(!1,"id")],e.prototype,"pauseAudioMixing",null),kp([UU(!1,"id")],e.prototype,"resumeAudioMixing",null),kp([UU(!1,"id")],e.prototype,"preloadAudioMixing",null),kp([UU(!1,"id")],e.prototype,"unloadAudioMixing",null),kp([UU(!1,"id")],e.prototype,"getAudioMixingVolume",null),kp([UU(!1,"id","volume")],e.prototype,"setAudioMixingVolume",null),kp([UU(!1,"id")],e.prototype,"getAudioMixingDuration",null),kp([UU(!1,"id")],e.prototype,"getAudioMixingCurrentPosition",null),kp([UU(!1,"id","position")],e.prototype,"setAudioMixingPosition",null),kp([UU(!1,"type")],e.prototype,"enableAudioMixingBuffer",null),kp([UU()],e.prototype,"disableAudioMixingBuffer",null),kp([UU(!1,"buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(JG||(JG={}));var $G=new CD("RTMClient",1),QG=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r._dataChannelSignal=null,r._handler=null,r._dataChannelSignalState=LL.DISCONNECTED,r._loginSessionId=null,r._userId=null,r._token=null,r._isReconnecting=!1,r._reconnectTimer=null,r._loginResolveCallback=null,r._loginRejectCallback=null,r._iceConfigNode=null,r._wait_login_token=!1,r}return wp(t,e),t.prototype.login=function(e,t){var r=this;return new Promise((function(n,i){if($G.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new XN(HN.ALREADY_LOGIN,"Already logined");r._userId=t,r._token=e,MU.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():($G.print("login","init dataChannelSingling"),r._dataChannelSignalState=LL.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))},t.prototype.logout=function(){var e;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){if(!this._loginSessionId||!this._userId)throw new XN(HN.NOT_LOGIN,"login first");return null===(e=this._dataChannelSignal)||void 0===e||e.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:BU.C2RTM}).catch((function(){})),this._closeDataChannelSignaling(),this._clearState(),[2]}))}))},t.prototype.updateLoginToken=function(e){return Pp(this,void 0,void 0,(function(){var t=this;return Mp(this,(function(r){return this._token=e,[2,new Promise((function(e,r){t._wait_login_token?(t._loginResolveCallback=e,t._loginRejectCallback=r,t._login()):e()}))]}))}))},t.prototype.getPeerOnlineStatus=function(e){return Pp(this,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new XN(HN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:BU.C2RTM})];case 1:return[2,null==(t=r.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new XN(HN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:e,room:"",msg:t})];case 1:return r.sent(),[2]}}))}))},t.prototype.setServerParams=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new XN(HN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:e,url:t},{functionType:BU.C2RTM})];case 1:return r.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new XN(HN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:AU.BUSINESS_SERVER,msg:e})];case 1:return t.sent(),[2]}}))}))},t.prototype.destroy=function(){this._clearState(),this._closeDataChannelSignaling(),e.prototype.removeAllListeners.call(this)},t.prototype._login=function(){var e=this;if(this._userId){var t=Ww();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:$w.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now().toString(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:fk.VERSION,deviceId:KU.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:BU.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).catch((function(t){var r,n,i=t||{},o=i.code,a=i.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=HN.INVALID_PARAMS,n="Invalid userId"):(r=HN.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=HN.LOGIN_FAILED,n="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new XN(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){return Pp(this,void 0,void 0,(function(){var t,r,n,i,o,a=this;return Mp(this,(function(s){switch(s.label){case 0:if(t=new WU,r=this._iceConfigNode)return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,null==t?void 0:t.getAccessNode(this._appId,"",e,KU.getDeviceId(),"")];case 2:if(!(r=s.sent()))throw new Error;return[3,4];case 3:throw s.sent(),xU("rtm.login.getNodeFailed","",0,!0),new XN(HN.ICE_SERVER_WRONG,"get ICE config failed");case 4:xU("rtm.login.getNodeSuccess",r,0,!0),$G.print("_createDataChannelSignaling()","get node success",r),this._handler=new wL,this._handler.once("disconnect",(function(){$G.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),a._onDisconnect()})),s.label=5;case 5:return s.trys.push([5,7,,8]),[4,this._handler.connect(r)];case 6:return n=s.sent(),$G.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=LL.CONNECTED,[3,8];case 7:throw i=s.sent(),this._iceConfigNode=null,this._dataChannelSignalState=LL.DISCONNECTED,new XN(HN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",i);case 8:return o=new GU(n),$G.print("_createDataChannelSignaling()","send ping"),o.sendPingSignaling(),o.once("close",(function(){$G.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),a._onDisconnect()})),o.on(bU.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(bU.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(bU.USER_DISCONNECTION,(function(){a.emit("onUserDisconnection"),a._clearState()})),o.on(bU.NODE_CHANGE,(function(e){xU("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(a._iceConfigNode=e.nodes[0]),a._loginResolveCallback&&a._loginRejectCallback?a._login():a._reconnect()})),[2,o]}}))}))},t.prototype._closeDataChannelSignaling=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null},t.prototype._checkDataChannelSignal=function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==LL.CONNECTED)throw new XN(HN.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=LL.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._reconnect=function(){var e=this;!this._isReconnecting&&this._userId&&($G.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){$G.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){$G.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))},t.prototype._clearState=function(){this._userId=null,this._token=null,this._loginSessionId=null,null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)},t}(vD.exports.EventEmitter),eH=new CD("Engine",0),tH=function(e){function t(t){var r=e.call(this)||this;return r._visibility=!0,r._remoteVideoPlayer=new Map,r._remoteScreenPlayer=new Map,r._remoteAudioPlayer=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._videoStreamEncodeConfig=[{maxKbps:500}],r._screenStreamEncodeConfig=[{maxKbps:500}],r._pauseAllSubscribeState={audio:!1,video:!1},r._mirrorType=sk.MIRROR_TYPE_RENDER,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=yL.PLAYOUT_AND_PUBLISH),Pp(r,void 0,void 0,(function(){var r;return Mp(this,(function(n){switch(n.label){case 0:return eH.print("_updateMixAudioTrack()"),this._localAudioTrack?(e?(this._localAudioTrack.mixType=t,this._localAudioTrack.mixedAudioTrack=e):(delete this._localAudioTrack.mixType,delete this._localAudioTrack.mixedAudioTrack),(null===(r=this._room)||void 0===r?void 0:r.hasPublished)?[4,this._updatePublish()]:[3,2]):(e&&(this._tempMixingAudioTrack={track:e,type:t}),[2]);case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(rD.onAudioMixingStateChanged,e)},r._appId=t,r._pubLock=new PL("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new ZG({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage}),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=r,r._trackSourceType={video:XD.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:XD.VIDEO_SOURCE_TYPE_INTERNAL,audio:WD.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:WD.AUDIO_SOURCE_TYPE_INTERNAL},r._rtmClient=new QG(t),r._handleRTMClient(r._rtmClient),r}return wp(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t;eH.print("updateToken()","token: %s",e),aD(e,"token"),null===(t=this._room)||void 0===t||t.updateToken(e)},t.prototype.switchCamera=function(e){var t,r;return Pp(this,void 0,void 0,(function(){var n,i;return Mp(this,(function(o){switch(o.label){case 0:return eH.print("switchCamera()","deviceId: %s",e),aD(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((n=this._videoStreamConstraints).deviceId={exact:e},this._videoStreamConstraints=n,[4,Wx(n)]);case 1:return i=o.sent(),this._initLocalTrackEvents(i),this._localVideoTrack&&this._localVideoTrack.close(),this._localVideoTrack=i,this._videoPlayer&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(i),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},t.prototype.switchMicrophone=function(e){var t,r;return Pp(this,void 0,void 0,(function(){var n,i;return Mp(this,(function(o){switch(o.label){case 0:return eH.print("switchMicrophone()","deviceId: %s",e),aD(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((n=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=n,[4,qx(n)]);case 1:return i=o.sent(),this._initLocalTrackEvents(i),this._localAudioTrack&&this._localAudioTrack.close(),this._localAudioTrack=i,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){Ox.on(rD.onMediaDeviceStateChanged,this._onDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E,S,g,y,b,T=this;null===(e=this._room)||void 0===e||e.on(bU.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(bU.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(bU.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(bU.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._room)||void 0===i||i.on(bU.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(o=this._room)||void 0===o||o.on(bU.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(a=this._room)||void 0===a||a.on(bU.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(s=this._room)||void 0===s||s.on(bU.POST_PROCESSING_MESSAGE,this._onLiveTranscodingResult.bind(this)),null===(c=this._room)||void 0===c||c.on(TU.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(u=this._room)||void 0===u||u.on($x.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(d=this._room)||void 0===d||d.on($x.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(l=this._room)||void 0===l||l.on($x.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(h=this._room)||void 0===h||h.on($x.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(f=this._room)||void 0===f||f.on($x.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=T._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&T.safeEmit(rD.onAutoPublishResult,e)})),null===(p=this._room)||void 0===p||p.on("onRemoteStreamStats",(function(e){T.safeEmit(rD.onRemoteStreamStats,e)})),null===(_=this._room)||void 0===_||_.on("onLocalStreamStats",(function(e){T.safeEmit(rD.onLocalStreamStats,e)})),null===(v=this._room)||void 0===v||v.on($x.ON_USER_MUTE_AUDIO,this._onUserMuteAudio.bind(this)),null===(m=this._room)||void 0===m||m.on($x.ON_USER_MUTE_VIDEO,this._onUserMuteVideo.bind(this)),null===(E=this._room)||void 0===E||E.on($x.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;T.safeEmit(rD.onUserStartAudioCapture,{userId:t})})),null===(S=this._room)||void 0===S||S.on($x.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;T.safeEmit(rD.onUserStopAudioCapture,{userId:t})})),null===(g=this._room)||void 0===g||g.on($x.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;T.safeEmit(rD.onUserStartVideoCapture,{userId:t})})),null===(y=this._room)||void 0===y||y.on($x.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;T.safeEmit(rD.onUserStopVideoCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on($x.ON_SEI_MESSAGED_RECEIVED,(function(e){T.safeEmit(rD.onSEIMessageReceived,e)}))},t.prototype.safeEmit=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return _D(t)&&LU(t,tD(r)),e.prototype.safeEmit.apply(this,xp([t],Lp(r),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.joinRoom=function(e,t,r,n){return void 0===n&&(n={isAutoPublish:!1,isAutoSubscribeAudio:!1,isAutoSubscribeVideo:!1}),Pp(this,void 0,void 0,(function(){var i;return Mp(this,(function(o){switch(o.label){case 0:if(eH.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,r,n),lD(e)||aD(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9 \_\-\@]{1,128}$/.test(e))throw new XN(HN.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_")}(t),function(e){cD(e,"userInfo"),hD(e.userId),lD(e.extraInfo)||aD(e.extraInfo,"userInfo.extraInfo",1,200)}(r),function(e){cD(e,"roomConfig"),iD(e.isAutoPublish,"roomConfig.isAutoPublish"),iD(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),iD(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(n),!this._room||this._room.connectionState===LL.DISCONNECTED)return[3,1];throw new XN(HN.REPEAT_JOIN,"Already joined");case 1:return this._room=new oV(n),this._addHandlerEventHandler(),i=this._liveTranscodeConfig&&vk("started",this._liveTranscodeConfig),[4,this._room.join(this._appId,t,e,Dp(Dp({},r),{businessId:this._businessId,role:this._visibility?JG.NORMAL_USER:JG.SILENT_USER}),i)];case 2:return o.sent(),this._roomConfig=n,(this._localAudioTrack||this._localVideoTrack)&&n.isAutoPublish?[4,this._updatePublish()]:[3,4];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))},t.prototype.leaveRoom=function(){var e;eH.print("leaveRoom()"),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.leave().catch,this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.stop()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.stop()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.stop()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0},t.prototype.destroy=function(){var e,t,r;eH.print("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,null===(t=this._videoPlayer)||void 0===t||t.destroy(),null===(r=this._audioPlayer)||void 0===r||r.destroy(),this._videoPlayer=void 0,this._audioPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[{maxKbps:500}],this._screenStreamEncodeConfig=[{maxKbps:500}],this._pauseAllSubscribeState={audio:!1,video:!1},clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=void 0,this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.stop()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.stop()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.stop()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy()},t.prototype.publish=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:if(eH.print("publish()"),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.PUBLISH_BEFORE_JOIN,"join first");return[4,this._updatePublish()];case 1:return e.sent(),[2]}}))}))},t.prototype.unpublish=function(){return Pp(this,void 0,void 0,(function(){var e,t;return Mp(this,(function(r){switch(r.label){case 0:if(eH.print("unpublish()"),!this._room)throw new XN(HN.UNPUBLISH_BEFORE_JOIN,"join first");return[4,this._pubLock.lock()];case 1:e=r.sent(),r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.unpublish()];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof XN?t:new XN(HN.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype.subscribeUserStream=function(e,t,r,n){var i,o,a,s;return void 0===r&&(r=nk.STREAM_INDEX_MAIN),void 0===n&&(n={videoIndex:0}),Pp(this,void 0,void 0,(function(){var c,u,d,l,h,f;return Mp(this,(function(p){switch(p.label){case 0:if(eH.print("subscribeStream()","userId: %o, mediaType: %o, streamType: %o, configure: %o",e,t,r,n),hD(e),sD(t,"mediaType",[ik.AUDIO_AND_VIDEO,ik.AUDIO_ONLY,ik.VIDEO_ONLY,ik.NONE]),sD(r,"streamType",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),oD(n.videoIndex,"config.videoIndex",0,2),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.SUBSCRIBE_BEFORE_JOIN,"join first");if(c=this._room.remoteStreams.get(e),d=r===nk.STREAM_INDEX_SCREEN,!(u=d?null==c?void 0:c.find((function(e){return e.isScreen})):null==c?void 0:c.find((function(e){return!e.isScreen}))))throw new XN(HN.STREAM_NOT_EXIST,"stream not exist");p.label=1;case 1:return p.trys.push([1,3,,4]),l=t,this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?t=ik.NONE:this._pauseAllSubscribeState.audio&&!this._pauseAllSubscribeState.video?t===ik.AUDIO_AND_VIDEO?t=ik.VIDEO_ONLY:t===ik.AUDIO_ONLY&&(t=ik.NONE):!this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video&&(t===ik.AUDIO_AND_VIDEO?t=ik.AUDIO_ONLY:t===ik.VIDEO_ONLY&&(t=ik.NONE)),t!==l&&eH.print("subscribeUserStream","due to pauseAllState change sub mediaType from ".concat(l," to ").concat(t)),[4,this._room.subscribe(u,t,n)];case 2:return p.sent(),t!==ik.AUDIO_AND_VIDEO&&t!==ik.AUDIO_ONLY||this._updateAudioPlayerState(u),t!==ik.AUDIO_AND_VIDEO&&t!==ik.VIDEO_ONLY||this._updateVideoPlayerState(u),((null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)||(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo))&&(u.audioTrack||u.videoTrack)&&(f={userId:e,isScreen:d,state:$D.SUBSCRIBE_SUCC},this.safeEmit(rD.onAutoSubscribeResult,f)),[3,4];case 3:throw h=p.sent(),((null===(a=this._roomConfig)||void 0===a?void 0:a.isAutoSubscribeAudio)||(null===(s=this._roomConfig)||void 0===s?void 0:s.isAutoSubscribeVideo))&&(f={userId:e,isScreen:d,state:$D.SUBSCRIBE_FAIL},this.safeEmit(rD.onAutoSubscribeResult,f)),h;case 4:return[2]}}))}))},t.prototype.unSubscribe=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n;return Mp(this,(function(i){switch(i.label){case 0:if(eH.print("unSubscribe()","userId: %s, isScreen: %o",e,t),hD(e),iD(t,"isScreen"),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.SUBSCRIBE_BEFORE_JOIN,"join first");if(r=this._room.remoteStreams.get(e),!(n=t?null==r?void 0:r.find((function(e){return e.isScreen})):null==r?void 0:r.find((function(e){return!e.isScreen}))))throw new XN(HN.STREAM_NOT_EXIST,"stream not exist");return[4,this._room.unsubscribe(n)];case 1:return i.sent(),this._updateAudioPlayerState(n),this._updateVideoPlayerState(n),[2]}}))}))},t.prototype.startVideoCapture=function(e){return Pp(this,void 0,void 0,(function(){var t,r,n;return Mp(this,(function(i){switch(i.label){case 0:if(eH.print("startVideoCapture()","deviceId: %s",e),lD(e)||aD(e,"deviceId"),this._localVideoTrack)throw new XN(HN.REPEAT_CAPTURE,"Has already capture");return t=this._videoStreamConstraints,e&&(t.deviceId={exact:e},this._videoStreamConstraints=t),[4,Wx(t)];case 1:return r=i.sent(),this._initLocalTrackEvents(r),this._localVideoTrack=r,this._videoPlayer&&this._videoPlayer.playVideo(r),this._room?(n=this._room._roomConfig.isAutoPublish,this._room.hasPublished||n?[4,this._updatePublish()]:[3,3]):[2];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))},t.prototype.stopVideoCapture=function(){var e;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:if(eH.print("stopVideoCapture()"),this._trackSourceType.video===XD.VIDEO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");return this._videoPlayer&&this._videoPlayer.stop(),null===(e=this._localVideoTrack)||void 0===e||e.close(),this._localVideoTrack=void 0,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.startAudioCapture=function(e){return Pp(this,void 0,void 0,(function(){var t,r,n;return Mp(this,(function(i){switch(i.label){case 0:if(eH.print("startAudioCapture()","deviceId: $o",e),lD(e)||aD(e,"deviceId"),this._localAudioTrack)throw new XN(HN.REPEAT_CAPTURE,"Has already capture");return t=this._audioStreamConstraints,e&&(t.deviceId={exact:e},this._audioStreamConstraints=t),[4,qx(t)];case 1:return r=i.sent(),this._initLocalTrackEvents(r),this._localAudioTrack=r,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(n=this._room._roomConfig.isAutoPublish,this._room.hasPublished||n?[4,this._updatePublish()]:[3,3]):[2];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))},t.prototype.stopAudioCapture=function(){var e;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:if(eH.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===WD.AUDIO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.getAudioMixingManager=function(){return eH.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,r;return void 0===e&&(e={}),Pp(this,void 0,void 0,(function(){var n,i,o,a;return Mp(this,(function(s){switch(s.label){case 0:if(eH.print("startScreenCapture()","config: %o",e),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localScreenVideoTrack=void 0,n=e.enableAudio,i=void 0!==n&&n,this._trackSourceType.screenVideo===XD.VIDEO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===WD.AUDIO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,Jx(i)];case 1:return o=s.sent(),this._localScreenVideoTrack=new zx(o.getVideoTracks()[0],Ww()),(a=o.getAudioTracks()).length&&(this._localScreenAudioTrack=new Yx(a[0],Ww()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(r=this._screenPlayer)||void 0===r||r.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,r;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(n){return eH.print("stopScreenCapture()"),null===(e=this._screenPlayer)||void 0===e||e.stop(),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localScreenVideoTrack=void 0,null===(r=this._localScreenAudioTrack)||void 0===r||r.close(),this._localScreenAudioTrack=void 0,[2]}))}))},t.prototype.publishScreen=function(){return Pp(this,void 0,void 0,(function(){var e;return Mp(this,(function(t){switch(t.label){case 0:if(eH.print("publishScreen()"),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.PUBLISH_BEFORE_JOIN,"join first");if(!this._visibility)throw new XN(HN.NO_PUBLISH_PERMISSION,"no publish permission");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 2:return t.sent(),[3,4];case 3:throw(e=t.sent())instanceof XN?e:new XN(HN.UNEXPECTED_ERROR,"unexpected error",e);case 4:return[2]}}))}))},t.prototype.unpublishScreen=function(){return Pp(this,void 0,void 0,(function(){var e;return Mp(this,(function(t){switch(t.label){case 0:if(eH.print("unpublishScreen()"),!this._room)throw new XN(HN.UNPUBLISH_BEFORE_JOIN,"join first");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._room.unpublishScreen()];case 2:return t.sent(),[3,4];case 3:throw(e=t.sent())instanceof XN?e:new XN(HN.UNEXPECTED_ERROR,"unexpected error",e);case 4:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var r,n;eH.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),t&&t.renderDom?(fD(t),e==nk.STREAM_INDEX_MAIN?(this._videoPlayer=new fV(t),this._initPlayerEvents(this._videoPlayer),this._localVideoTrack&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.mirror(!!this._mirrorType)):(this._screenPlayer=new fV(Dp(Dp({},t),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&this._screenPlayer.playVideo(this._localScreenVideoTrack))):e==nk.STREAM_INDEX_MAIN?(null===(r=this._videoPlayer)||void 0===r||r.destroy(),delete this._videoPlayer):(null===(n=this._screenPlayer)||void 0===n||n.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return Pp(this,void 0,void 0,(function(){var r;return Mp(this,(function(n){switch(n.label){case 0:eH.print("startLiveTranscoding()","transcode: %o",e),aD(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.controlMessage(vk("started",this._liveTranscodeConfig))];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof XN?r:new XN(HN.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return Pp(this,void 0,void 0,(function(){var r;return Mp(this,(function(n){switch(n.label){case 0:if(eH.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=UB(this._liveTranscodeConfig,e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.controlMessage(vk("layoutChanged",this._liveTranscodeConfig))];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof XN?r:new XN(HN.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return Pp(this,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:if(eH.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,null===(e=this._room)||void 0===e?void 0:e.controlMessage({action:"stopped",type:"transcode"})];case 2:return r.sent(),[3,4];case 3:throw(t=r.sent())instanceof XN?t:new XN(HN.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){if(eH.print("setBusinessId()","businessId: %s",e),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9 \_\-\@]{1,128}$/.test(e))throw new XN(HN.INVALID_PARAMS,"The businessId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_")}(e),this._room)throw new XN(HN.ALREADY_IN_ROOM,"You should invoke setBusinessId before joinRoom");PU.setStats({rtc_business_id:e}),this._businessId=e},t.prototype.setUserVisibility=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:if(eH.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==LL.CONNECTED)throw new XN(HN.NOT_CONNECTED_YET,"server not connected");return!e?[4,this._room.unpublish()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[4,this._room.updateUserAttributes({role:e?JG.NORMAL_USER:JG.SILENT_USER})];case 3:return t.sent(),this._visibility=e,[2]}}))}))},t.prototype._initPlayerEvents=function(e){var t=this;e.on("playback_event",(function(r){var n,i;switch(r.eventName){case"timeupdate":return;case"loadeddata":if("audio"===r.type)t.safeEmit(rD.onAudioFirstFrameDecoded,{userId:e.userId}),DU.firstRemoteAudioRender("",r.userId);else{var o={userId:e.userId,height:(null===(n=e.domElement)||void 0===n?void 0:n.videoHeight)||0,width:(null===(i=e.domElement)||void 0===i?void 0:i.videoWidth)||0};t.safeEmit(rD.onVideoFirstFrameDecoded,o),t.safeEmit(rD.onVideoFirstFrameRendered,o),DU.firstRemoteVideoRender("",r.userId)}break;case"autoplay-error":return void t.safeEmit(rD.onAutoplayFailed,r)}t.safeEmit(rD.onPlayerEvent,r)}))},t.prototype._initLocalTrackEvents=function(e){var t=this;e.on("track-ended",(function(e){var r=!1;e!==t._localScreenAudioTrack&&e!==t._localScreenVideoTrack||(r=!0),t.safeEmit(rD.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var r,n,i,o,a,s;if(eH.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),t.renderDom){fD(t);var c=t.userId;if(e==nk.STREAM_INDEX_MAIN){var u=new fV(t);this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(o=null===(i=this._room)||void 0===i?void 0:i.remoteStreams.get(c))||void 0===o?void 0:o.find((function(e){return!e.isScreen})))&&this._updateVideoPlayerState(d)}else{var d;u=new fV(Dp(Dp({},t),{isScreen:!0}));this._remoteScreenPlayer.set(c,u),this._initPlayerEvents(u),(d=null===(s=null===(a=this._room)||void 0===a?void 0:a.remoteStreams.get(c))||void 0===s?void 0:s.find((function(e){return e.isScreen})))&&this._updateVideoPlayerState(d)}}else e==nk.STREAM_INDEX_MAIN?(null===(r=this._videoPlayer)||void 0===r||r.destroy(),delete this._videoPlayer):(null===(n=this._screenPlayer)||void 0===n||n.destroy(),delete this._screenPlayer)},t.prototype.setLocalVideoMirrorType=function(e){eH.print("setLocalVideoMirrorType()","mirrorType: %o",e),sD(e,"mirrorType",[sk.MIRROR_TYPE_NONE,sk.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){var t;return Pp(this,void 0,void 0,(function(){var r;return Mp(this,(function(n){switch(n.label){case 0:return eH.print("setAudioPlaybackDevice()","deviceId: %s",e),aD(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(eH.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,Ox.getDeviceById(e)];case 1:if(!(r=n.sent()))throw new XN(HN.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),null===(t=this._audioPlayer)||void 0===t||t.setPlaybackDevice(e),this._audioPlaybackDeviceId=e,r&&this.safeEmit(rD.onAudioPlaybackDeviceChanged,r),DU.rtcAudioDevice(eU.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e){return Pp(this,void 0,void 0,(function(){var t,r;return Mp(this,(function(n){if(eH.print("play()","userId: %s",e),hD(e),t=this._remoteAudioPlayer.get(e),r=this._remoteVideoPlayer.get(e),t||(t=this._audioPlayer),r||(r=this._videoPlayer),!t&&!r)throw new XN(HN.INVALID_PARAMS,"Player not found");return t&&t.manuallyPlay(),r&&r.manuallyPlay(),[2]}))}))},t.prototype.muteLocalAudio=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){if(eH.print("muteLocalAudio()","muteState: %o",e),sD(e,"muteState",[ZD.MUTE_STATE_OFF,ZD.MUTE_STATE_ON]),!this._room)throw new XN(HN.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("audio",e)]}))}))},t.prototype.muteLocalVideo=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){if(eH.print("muteLocalVideo()","muteState: %o",e),sD(e,"muteState",[ZD.MUTE_STATE_OFF,ZD.MUTE_STATE_ON]),!this._room)throw new XN(HN.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("video",e)]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return Pp(this,void 0,void 0,(function(){var t,r=this;return Mp(this,(function(n){return eH.print("pauseAllSubscribedStream()","mediaType: %o",e),sD(e,"mediaType",[tk.RTC_PAUSE_RESUME_CONTROL_AUDIO,tk.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,tk.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?[2,Promise.resolve()]:(t=function(){e===tk.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!0:e===tk.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!0:e===tk.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO&&(r._pauseAllSubscribeState.audio=!0,r._pauseAllSubscribeState.video=!0)},this._room?[2,this._room.pauseAllSubscribedStream(e).then((function(){t()}))]:(t(),[2,Promise.resolve()]))}))}))},t.prototype.resumeAllSubscribedStream=function(e){return Pp(this,void 0,void 0,(function(){var t,r=this;return Mp(this,(function(n){return eH.print("resumeAllSubscribedStream()","mediaType: %o",e),sD(e,"mediaType",[tk.RTC_PAUSE_RESUME_CONTROL_AUDIO,tk.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,tk.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video?(t=function(){e===tk.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!1:e===tk.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!1:e===tk.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO&&(r._pauseAllSubscribeState.audio=!1,r._pauseAllSubscribeState.video=!1)},this._room?[2,this._room.resumeAllSubscribedStream(e).then((function(){var e,n;t(),null===(n=null===(e=r._room)||void 0===e?void 0:e.remoteStreams)||void 0===n||n.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r._updateAudioPlayerState(e),r._updateVideoPlayerState(e)}))}))}))]:(t(),[2,Promise.resolve()])):[2,Promise.resolve()]}))}))},t.prototype.sendUserMessage=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){if(hD(e),pD(t),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){if(hD(e),uD(t,"message"),pD(t),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendRoomMessage=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){if(pD(e),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e)]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){if(pD(e),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e,!0)]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),Pp(this,void 0,void 0,(function(){var r;return Mp(this,(function(n){switch(n.label){case 0:return eH.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,dD(e),r=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=e,r&&(this._audioStreamConstraints.deviceId=r),this._localAudioTrack?(this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,[4,null===(t=this._localAudioTrack)||void 0===t?void 0:t.updateAudioCaptureConfig()]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),Pp(this,void 0,void 0,(function(){var r;return Mp(this,(function(n){switch(n.label){case 0:return eH.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,dD(e),r=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=e,r&&(this._videoStreamConstraints.deviceId=r),this._localVideoTrack?(this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,[4,null===(t=this._localVideoTrack)||void 0===t?void 0:t.updateVideoCaptureConfig()]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setVideoEncoderConfig=function(e,t){var r,n,i,o,a,s,c,u;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(d){if(eH.print("setVideoEncoderConfig()","streamIndex: %o, descriptions: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),function(e,t){if(!Array.isArray(e))throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,", should be array"))}(t,"descriptions"),t.length>3&&(t=t.slice(0,3)),t.sort((function(e,t){return t.maxKbps-e.maxKbps})),e===nk.STREAM_INDEX_MAIN){if(null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.hasPublished){if(1!==this._videoStreamEncodeConfig.length||1!==(null==t?void 0:t.length))throw new XN(HN.INVALID_PARAMS,"After publishing, only non simulcast streams can be modified");null===(o=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===o||o.updateVideoBitrate(t)}this._videoStreamEncodeConfig=t}else{if(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished){if(1!==this._screenStreamEncodeConfig.length||1!==(null==t?void 0:t.length))throw new XN(HN.INVALID_PARAMS,"After publishing, only non simulcast streams can be modified");null===(u=null===(c=this._room)||void 0===c?void 0:c.localScreenStream)||void 0===u||u.updateVideoBitrate([t[0]])}this._screenStreamEncodeConfig=t}return[2]}))}))},t.prototype.sendSEIMessage=function(e,t,r){var n,i,o,a,s,c;eH.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),oD(r,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array($w.str2ab(t)):t;if(t.length){var d;if(e===nk.STREAM_INDEX_MAIN){if(!(null===(i=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===i?void 0:i.hasPublished))return;d=null===(o=this._room)||void 0===o?void 0:o.localStream}else{if(!(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished))return;d=null===(c=this._room)||void 0===c?void 0:c.localScreenStream}if(u.byteLength>4096)eH.print("sei size must not bigger than 4KB");else{var l=Ww();d.seiList.push({content:u,uuid:l,repeatCount:r}),setTimeout((function(){if(d){var e=d.seiList.findIndex((function(e){return e.uuid===l}));e&&d.seiList.splice(e,1)}}),2e3)}}else eH.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;eH.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var r=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,n,i,o;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var n,i;if(0!==e.length){var o=null===(i=null===(n=e[0])||void 0===n?void 0:n.audioTrack)||void 0===i?void 0:i.getAudioLevel();r.push({userId:t,volume:o||0})}}));var a=null===(n=t._localAudioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:(null===(o=null===(i=t._room)||void 0===i?void 0:i.roomInfo)||void 0===o?void 0:o.userInfo.userId)||"local_user",volume:a||0}),t.safeEmit(rD.onAudioVolumeIndication,{speakers:r})}),e)},t.prototype.setVideoSourceType=function(e,t){var r,n,i,o,a;return Pp(this,void 0,void 0,(function(){var s,c;return Mp(this,(function(u){switch(u.label){case 0:return eH.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),sD(t,"VideoSourceType",[XD.VIDEO_SOURCE_TYPE_EXTERNAL,XD.VIDEO_SOURCE_TYPE_INTERNAL]),s=e===nk.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[s]===t?[3,4]:(this._trackSourceType[s]=t,eH.print("setVideoSourceType","set ".concat(s," source type to ").concat(t)),this._localVideoTrack&&e===nk.STREAM_INDEX_MAIN?(t===XD.VIDEO_SOURCE_TYPE_EXTERNAL&&this._localVideoTrack.close(),null===(r=this._videoPlayer)||void 0===r||r.stop(),this._localVideoTrack=void 0,c=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,(null===(i=this._room)||void 0===i?void 0:i.hasPublished)||c?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:u.sent(),u.label=2;case 2:return this._localScreenVideoTrack&&e===nk.STREAM_INDEX_SCREEN?(t===XD.VIDEO_SOURCE_TYPE_EXTERNAL&&this._localScreenVideoTrack.close(),null===(o=this._screenPlayer)||void 0===o||o.stop(),this._localScreenVideoTrack=void 0,(null===(a=this._room)||void 0===a?void 0:a.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:u.sent(),u.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var r,n,i,o,a;return Pp(this,void 0,void 0,(function(){var s;return Mp(this,(function(c){switch(c.label){case 0:if(eH.print("setExternalVideoTrack()","index: %o, track: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),e!==nk.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==XD.VIDEO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new Kx(t,Ww()),this._initLocalTrackEvents(this._localVideoTrack),null===(r=this._videoPlayer)||void 0===r||r.playVideo(this._localVideoTrack),s=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,(null===(i=this._room)||void 0===i?void 0:i.hasPublished)||s?[4,this._updatePublish()]:[3,2];case 1:c.sent(),c.label=2;case 2:if(e!==nk.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==XD.VIDEO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new Kx(t,Ww()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),(null===(a=this._room)||void 0===a?void 0:a.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:c.sent(),c.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var r,n,i;return Pp(this,void 0,void 0,(function(){var o,a;return Mp(this,(function(s){switch(s.label){case 0:return eH.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),sD(t,"audioSourceType",[WD.AUDIO_SOURCE_TYPE_EXTERNAL,WD.AUDIO_SOURCE_TYPE_INTERNAL]),o=e===nk.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[o]===t?[3,4]:(this._trackSourceType[o]=t,eH.print("setVideoSourceType","set ".concat(o," source type to ").concat(t)),this._localAudioTrack&&e===nk.STREAM_INDEX_MAIN?(this._trackSourceType.audio===WD.AUDIO_SOURCE_TYPE_EXTERNAL&&this._localAudioTrack.close(),this._localAudioTrack=void 0,a=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||a?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:s.sent(),s.label=2;case 2:return this._localScreenAudioTrack&&e===nk.STREAM_INDEX_SCREEN?(this._trackSourceType.audio===WD.AUDIO_SOURCE_TYPE_EXTERNAL&&this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0,(null===(i=this._room)||void 0===i?void 0:i.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:s.sent(),s.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var r,n,i;return Pp(this,void 0,void 0,(function(){var o;return Mp(this,(function(a){switch(a.label){case 0:if(eH.print("setExternalAudioTrack()","index: %o, track: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),e!==nk.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==WD.AUDIO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new Xx(t,Ww()),this._initLocalTrackEvents(this._localAudioTrack),o=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||o?[4,this._updatePublish()]:[3,2];case 1:a.sent(),a.label=2;case 2:if(e!==nk.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==WD.AUDIO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new Xx(t,Ww()),this._initLocalTrackEvents(this._localScreenAudioTrack),(null===(i=this._room)||void 0===i?void 0:i.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:a.sent(),a.label=4;case 4:return[2]}}))}))},t.prototype.login=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){return eH.print("login()","token: %o, userInfo: %o",e,t),lD(e)||aD(e,"token"),hD(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){return eH.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){return eH.print("updateLoginToken()","token: %o",e),lD(e)||aD(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){return eH.print("getPeerOnlineStatus()","userId: %o",e),hD(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){return hD(e),pD(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){return hD(e),uD(t,"message"),pD(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.setServerParams=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){return eH.print("setServerParams()","signature: %o, url: %0",e,t),aD(e,"signature"),aD(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){return aD(e,"message"),pD(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.sendServerBinaryMessage=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){return uD(e,"message"),pD(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype._updatePublish=function(){return Pp(this,void 0,void 0,(function(){var e,t;return Mp(this,(function(r){switch(r.label){case 0:if(eH.print("_updatePublish()"),!this._visibility)throw new XN(HN.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(e=r.sent(),!this._room||this._room.connectionState!==LL.CONNECTED)return e(),[2];r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._localVideoTrack,this._localAudioTrack)];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof XN?t:new XN(HN.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype._updateScreenPublish=function(){return Pp(this,void 0,void 0,(function(){var e,t;return Mp(this,(function(r){switch(r.label){case 0:return eH.print("_updateScreenPublish()"),[4,this._pubLock.lock()];case 1:if(e=r.sent(),!this._room||this._room.connectionState!==LL.CONNECTED)return e(),[2];r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof XN?t:new XN(HN.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){eH.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen;if(t=n?this._remoteAudioPlayer.get("".concat(r,"_screen")):this._remoteAudioPlayer.get(r),e.audioTrack){if(!t){var i=n?"".concat(r,"_screen"):r;t=new pV(i),this._initPlayerEvents(t),this._remoteAudioPlayer.set(i,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}t.playAudio(e.audioTrack)}else null==t||t.stop()},t.prototype._updateVideoPlayerState=function(e){eH.print("_updateVideoPlayerState()");var t,r=e.userId;t=e.isScreen?this._remoteScreenPlayer.get(r):this._remoteVideoPlayer.get(r),e.videoTrack?t&&t.playVideo(e.videoTrack,e):null==t||t.stop()},t.prototype._onAddStream=function(e){var t,r,n,i,o=e.stream,a={userId:o.userId,isScreen:o.isScreen,hasVideo:o.hasVideo,hasAudio:o.hasAudio,videoStreamDescriptions:o.attributes.videoDescriptions};this.safeEmit(rD.onStreamAdd,{stream:a});var s=null;(null===(t=this._roomConfig)||void 0===t?void 0:t.isAutoSubscribeAudio)&&(s=ik.AUDIO_ONLY),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(s=ik.VIDEO_ONLY),(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeVideo)&&(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)&&(s=ik.AUDIO_AND_VIDEO),eH.print("_onAddStream","autoSubType: ".concat(s)),null===s||o.isScreen||this.subscribeUserStream(o.userId,s)},t.prototype._onRemoveStream=function(e){var t=e.stream,r={userId:t.userId,isScreen:t.isScreen,hasVideo:t.hasVideo,hasAudio:t.hasAudio,videoStreamDescriptions:[]},n=rH[e.reason]||ok.STREAM_REMOVE_REASON_OTHER;this.safeEmit(rD.onStreamRemove,{stream:r,reason:n}),this._stopRemotePlayer(t.userId,t.isScreen)},t.prototype._onUserConnection=function(e){this.safeEmit(rD.onUserJoined,e)},t.prototype._onUserDisconnection=function(e){var t,r,n,i;(null===(t=null==e?void 0:e.userInfo)||void 0===t?void 0:t.userId)===(null===(i=null===(n=null===(r=this._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.userInfo)||void 0===i?void 0:i.userId)?"userDuplicateLogin"===(null==e?void 0:e.reason)&&this.safeEmit(rD.onError,{errorCode:HN.DUPLICATE_LOGIN}):this.safeEmit(rD.onUserLeave,{userInfo:e.userInfo,reason:"userLeave"===e.reason?0:1})},t.prototype._onConnectionStateChange=function(e){this.safeEmit(rD.onConnectionStateChanged,e)},t.prototype._stopRemotePlayer=function(e,t){var r=t?"".concat(e,"_screen"):e,n=this._remoteAudioPlayer.get(r),i=this._remoteVideoPlayer.get(r);n&&n.stop(),i&&i.stop()},t.prototype._onResubscribe=function(e){e.stream&&(this._stopRemotePlayer(e.stream.userId,e.stream.isScreen),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))},t.prototype._onSubscribePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onRemovePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onVideoFirstFrameDecoded=function(e){this.safeEmit(rD.onVideoFirstFrameDecoded,e)},t.prototype._onDeviceStateChange=function(e){this.safeEmit(rD.onMediaDeviceStateChanged,e)},t.prototype._onUserMuteAudio=function(e){this.safeEmit(rD.onUserMuteAudio,e)},t.prototype._onUserMuteVideo=function(e){this.safeEmit(rD.onUserMuteVideo,e)},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(rD.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(rD.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this.safeEmit(rD.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(rD.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(rD.onLiveTranscodingResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t.safeEmit(rD.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t.safeEmit(rD.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(rD.onError,{errorCode:HN.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(rD.onError,{errorCode:HN.RTM_TOKEN_ERROR})}))},kp([UU()],t.prototype,"updateToken",null),kp([UU()],t.prototype,"switchCamera",null),kp([UU()],t.prototype,"switchMicrophone",null),kp([UU()],t.prototype,"joinRoom",null),kp([UU()],t.prototype,"leaveRoom",null),kp([UU()],t.prototype,"destroy",null),kp([UU()],t.prototype,"publish",null),kp([UU()],t.prototype,"unpublish",null),kp([UU()],t.prototype,"subscribeUserStream",null),kp([UU()],t.prototype,"unSubscribe",null),kp([UU()],t.prototype,"startVideoCapture",null),kp([UU()],t.prototype,"stopVideoCapture",null),kp([UU()],t.prototype,"startAudioCapture",null),kp([UU()],t.prototype,"stopAudioCapture",null),kp([UU()],t.prototype,"getAudioMixingManager",null),kp([UU()],t.prototype,"startScreenCapture",null),kp([UU()],t.prototype,"stopScreenCapture",null),kp([UU()],t.prototype,"publishScreen",null),kp([UU()],t.prototype,"unpublishScreen",null),kp([UU()],t.prototype,"setLocalVideoPlayer",null),kp([UU()],t.prototype,"startLiveTranscoding",null),kp([UU()],t.prototype,"updateLiveTranscoding",null),kp([UU()],t.prototype,"stopLiveTranscoding",null),kp([UU()],t.prototype,"setBusinessId",null),kp([UU()],t.prototype,"setUserVisibility",null),kp([UU()],t.prototype,"setRemoteVideoPlayer",null),kp([UU()],t.prototype,"setLocalVideoMirrorType",null),kp([UU()],t.prototype,"setAudioPlaybackDevice",null),kp([UU()],t.prototype,"play",null),kp([UU()],t.prototype,"muteLocalAudio",null),kp([UU()],t.prototype,"muteLocalVideo",null),kp([UU()],t.prototype,"pauseAllSubscribedStream",null),kp([UU()],t.prototype,"resumeAllSubscribedStream",null),kp([UU()],t.prototype,"sendUserMessage",null),kp([UU()],t.prototype,"sendUserBinaryMessage",null),kp([UU()],t.prototype,"sendRoomMessage",null),kp([UU()],t.prototype,"sendRoomBinaryMessage",null),kp([UU()],t.prototype,"setAudioCaptureConfig",null),kp([UU()],t.prototype,"setVideoCaptureConfig",null),kp([UU()],t.prototype,"setVideoEncoderConfig",null),kp([UU()],t.prototype,"sendSEIMessage",null),kp([UU()],t.prototype,"setAudioVolumeIndicationInterval",null),kp([UU()],t.prototype,"setVideoSourceType",null),kp([UU()],t.prototype,"setExternalVideoTrack",null),kp([UU()],t.prototype,"setAudioSourceType",null),kp([UU()],t.prototype,"setExternalAudioTrack",null),kp([UU(!0)],t.prototype,"login",null),kp([UU(!0)],t.prototype,"logout",null),kp([UU(!0)],t.prototype,"updateLoginToken",null),kp([UU(!0)],t.prototype,"getPeerOnlineStatus",null),kp([UU(!0)],t.prototype,"sendUserMessageOutsideRoom",null),kp([UU(!0)],t.prototype,"sendUserBinaryMessageOutsideRoom",null),kp([UU(!0)],t.prototype,"setServerParams",null),kp([UU(!0)],t.prototype,"sendServerMessage",null),kp([UU(!0)],t.prototype,"sendServerBinaryMessage",null),t}(ND),rH={"client unpublished":ok.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":ok.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":ok.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":ok.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":ok.STREAM_REMOVE_REASON_REPUBLISH},nH=new CD("VERTC",0),iH=function(e){return nH.print("createEngine","Invoke VERTC.createEngine"),aD(e,"appId"),[PU,MU].forEach((function(t){return t.setStats({rtc_app_id:e,rtc_sdk_version:lH(),product_line:NM.RTC,report_version:wM.W_5,os:DM.WEB,device_id:KU.getDeviceId(),user_agent:null===navigator||void 0===navigator?void 0:navigator.userAgent})})),DU.sdkInitEngine(Date.now(),aU.BEGIN),new tH(e)},oH=function(e){if(nH.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof tH))throw new XN(HN.INVALID_ENGINE,"Invalid engine object");e.destroy(),DU.sdkInitEngine(Date.now(),aU.END)},aH=function(){return Pp(void 0,void 0,void 0,(function(){return Mp(this,(function(e){return[2,Ox.getDevices()]}))}))},sH=function(e){return void 0===e&&(e={video:!0,audio:!0}),Pp(void 0,void 0,void 0,(function(){var t,r,n,i,o;return Mp(this,(function(a){switch(a.label){case 0:if(t=e.video,r=e.audio,n={video:!1,audio:!1},!t)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),i=n,[4,Ox.getVideoPermission()];case 2:return i.video=a.sent(),[3,4];case 3:return a.sent(),[3,4];case 4:if(!r)return[3,8];a.label=5;case 5:return a.trys.push([5,7,,8]),o=n,[4,Ox.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,n]}}))}))},cH=function(){return Pp(void 0,void 0,void 0,(function(){return Mp(this,(function(e){return[2,Ox.getMicrophones()]}))}))},uH=function(){return Pp(void 0,void 0,void 0,(function(){return Mp(this,(function(e){return[2,Ox.getCameras()]}))}))},dH=function(){return Pp(void 0,void 0,void 0,(function(){return Mp(this,(function(e){return[2,Ox.getAudioPlayback()]}))}))},lH=function(){return fk.VERSION},hH=new function(){this.getSdkVersion=lH,this.createEngine=iH,this.destroyEngine=oH,this.getDevices=aH,this.enableDevices=sH,this.getMicrophones=cH,this.getCameras=uH,this.getAudioPlayback=dH,this.getParameter=_k,this.setParameter=pk,this.isSupported=RL,this.events=rD,this.ErrorCode=HN,this.platform="BytePlus"};export{gL as AudioMixingDualMonoMode,yL as AudioMixingType,WD as AudioSourceType,qD as ChannelProfile,ak as ConnectionState,ck as LogChannel,ek as MirrorMode,sk as MirrorType,ZD as MuteState,tk as PauseResumeControlMediaType,QD as PublishState,nk as StreamIndex,ok as StreamRemoveReason,ik as SubscribeMediaType,JD as SubscribeMode,$D as SubscribeState,uk as USER_ONLINE_STATUS,rk as VideoRenderMode,XD as VideoSourceType,hH as default};
|
|
6
|
+
function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(e){return e&&e.Math==Math&&e},n=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||Function("return this")(),i={},o=function(e){try{return!!e()}catch(e){return!0}},a=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),s=!o((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),c=s,u=Function.prototype.call,d=c?u.bind(u):function(){return u.apply(u,arguments)},l={},h={}.propertyIsEnumerable,f=Object.getOwnPropertyDescriptor,p=f&&!h.call({1:2},1);l.f=p?function(e){var t=f(this,e);return!!t&&t.enumerable}:h;var _,v,m=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},E=s,S=Function.prototype,g=S.bind,y=S.call,b=E&&g.bind(y,y),T=E?function(e){return e&&b(e)}:function(e){return e&&function(){return y.apply(e,arguments)}},I=T,R=I({}.toString),A=I("".slice),C=function(e){return A(R(e),8,-1)},O=T,N=o,w=C,D=n.Object,k=O("".split),P=N((function(){return!D("z").propertyIsEnumerable(0)}))?function(e){return"String"==w(e)?k(e,""):D(e)}:D,M=n.TypeError,U=function(e){if(null==e)throw M("Can't call method on "+e);return e},L=P,x=U,V=function(e){return L(x(e))},B=function(e){return"function"==typeof e},j=B,F=function(e){return"object"==typeof e?null!==e:j(e)},G=n,H=B,z=function(e){return H(e)?e:void 0},Y=function(e,t){return arguments.length<2?z(G[e]):G[e]&&G[e][t]},K=T({}.isPrototypeOf),X=Y("navigator","userAgent")||"",W=n,q=X,J=W.process,Z=W.Deno,$=J&&J.versions||Z&&Z.version,Q=$&&$.v8;Q&&(v=(_=Q.split("."))[0]>0&&_[0]<4?1:+(_[0]+_[1])),!v&&q&&(!(_=q.match(/Edge\/(\d+)/))||_[1]>=74)&&(_=q.match(/Chrome\/(\d+)/))&&(v=+_[1]);var ee=v,te=ee,re=o,ne=!!Object.getOwnPropertySymbols&&!re((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&te&&te<41})),ie=ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,oe=Y,ae=B,se=K,ce=ie,ue=n.Object,de=ce?function(e){return"symbol"==typeof e}:function(e){var t=oe("Symbol");return ae(t)&&se(t.prototype,ue(e))},le=n.String,he=function(e){try{return le(e)}catch(e){return"Object"}},fe=B,pe=he,_e=n.TypeError,ve=function(e){if(fe(e))return e;throw _e(pe(e)+" is not a function")},me=ve,Ee=function(e,t){var r=e[t];return null==r?void 0:me(r)},Se=d,ge=B,ye=F,be=n.TypeError,Te={exports:{}},Ie=n,Re=Object.defineProperty,Ae=function(e,t){try{Re(Ie,e,{value:t,configurable:!0,writable:!0})}catch(r){Ie[e]=t}return t},Ce=Ae,Oe=n["__core-js_shared__"]||Ce("__core-js_shared__",{}),Ne=Oe;(Te.exports=function(e,t){return Ne[e]||(Ne[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"});var we=U,De=n.Object,ke=function(e){return De(we(e))},Pe=ke,Me=T({}.hasOwnProperty),Ue=Object.hasOwn||function(e,t){return Me(Pe(e),t)},Le=T,xe=0,Ve=Math.random(),Be=Le(1..toString),je=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Be(++xe+Ve,36)},Fe=n,Ge=Te.exports,He=Ue,ze=je,Ye=ne,Ke=ie,Xe=Ge("wks"),We=Fe.Symbol,qe=We&&We.for,Je=Ke?We:We&&We.withoutSetter||ze,Ze=function(e){if(!He(Xe,e)||!Ye&&"string"!=typeof Xe[e]){var t="Symbol."+e;Ye&&He(We,e)?Xe[e]=We[e]:Xe[e]=Ke&&qe?qe(t):Je(t)}return Xe[e]},$e=d,Qe=F,et=de,tt=Ee,rt=function(e,t){var r,n;if("string"===t&&ge(r=e.toString)&&!ye(n=Se(r,e)))return n;if(ge(r=e.valueOf)&&!ye(n=Se(r,e)))return n;if("string"!==t&&ge(r=e.toString)&&!ye(n=Se(r,e)))return n;throw be("Can't convert object to primitive value")},nt=Ze,it=n.TypeError,ot=nt("toPrimitive"),at=function(e,t){if(!Qe(e)||et(e))return e;var r,n=tt(e,ot);if(n){if(void 0===t&&(t="default"),r=$e(n,e,t),!Qe(r)||et(r))return r;throw it("Can't convert object to primitive value")}return void 0===t&&(t="number"),rt(e,t)},st=at,ct=de,ut=function(e){var t=st(e,"string");return ct(t)?t:t+""},dt=F,lt=n.document,ht=dt(lt)&&dt(lt.createElement),ft=function(e){return ht?lt.createElement(e):{}},pt=ft,_t=!a&&!o((function(){return 7!=Object.defineProperty(pt("div"),"a",{get:function(){return 7}}).a})),vt=a,mt=d,Et=l,St=m,gt=V,yt=ut,bt=Ue,Tt=_t,It=Object.getOwnPropertyDescriptor;i.f=vt?It:function(e,t){if(e=gt(e),t=yt(t),Tt)try{return It(e,t)}catch(e){}if(bt(e,t))return St(!mt(Et.f,e,t),e[t])};var Rt={},At=a&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ct=n,Ot=F,Nt=Ct.String,wt=Ct.TypeError,Dt=function(e){if(Ot(e))return e;throw wt(Nt(e)+" is not an object")},kt=a,Pt=_t,Mt=At,Ut=Dt,Lt=ut,xt=n.TypeError,Vt=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor;Rt.f=kt?Mt?function(e,t,r){if(Ut(e),t=Lt(t),Ut(r),"function"==typeof e&&"prototype"===t&&"value"in r&&"writable"in r&&!r.writable){var n=Bt(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:"configurable"in r?r.configurable:n.configurable,enumerable:"enumerable"in r?r.enumerable:n.enumerable,writable:!1})}return Vt(e,t,r)}:Vt:function(e,t,r){if(Ut(e),t=Lt(t),Ut(r),Pt)try{return Vt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw xt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var jt=Rt,Ft=m,Gt=a?function(e,t,r){return jt.f(e,t,Ft(1,r))}:function(e,t,r){return e[t]=r,e},Ht={exports:{}},zt=B,Yt=Oe,Kt=T(Function.toString);zt(Yt.inspectSource)||(Yt.inspectSource=function(e){return Kt(e)});var Xt,Wt,qt,Jt=Yt.inspectSource,Zt=B,$t=Jt,Qt=n.WeakMap,er=Zt(Qt)&&/native code/.test($t(Qt)),tr=Te.exports,rr=je,nr=tr("keys"),ir=function(e){return nr[e]||(nr[e]=rr(e))},or={},ar=er,sr=n,cr=T,ur=F,dr=Gt,lr=Ue,hr=Oe,fr=ir,pr=or,_r=sr.TypeError,vr=sr.WeakMap;if(ar||hr.state){var mr=hr.state||(hr.state=new vr),Er=cr(mr.get),Sr=cr(mr.has),gr=cr(mr.set);Xt=function(e,t){if(Sr(mr,e))throw new _r("Object already initialized");return t.facade=e,gr(mr,e,t),t},Wt=function(e){return Er(mr,e)||{}},qt=function(e){return Sr(mr,e)}}else{var yr=fr("state");pr[yr]=!0,Xt=function(e,t){if(lr(e,yr))throw new _r("Object already initialized");return t.facade=e,dr(e,yr,t),t},Wt=function(e){return lr(e,yr)?e[yr]:{}},qt=function(e){return lr(e,yr)}}var br={set:Xt,get:Wt,has:qt,enforce:function(e){return qt(e)?Wt(e):Xt(e,{})},getterFor:function(e){return function(t){var r;if(!ur(t)||(r=Wt(t)).type!==e)throw _r("Incompatible receiver, "+e+" required");return r}}},Tr=a,Ir=Ue,Rr=Function.prototype,Ar=Tr&&Object.getOwnPropertyDescriptor,Cr=Ir(Rr,"name"),Or={EXISTS:Cr,PROPER:Cr&&"something"===function(){}.name,CONFIGURABLE:Cr&&(!Tr||Tr&&Ar(Rr,"name").configurable)},Nr=n,wr=B,Dr=Ue,kr=Gt,Pr=Ae,Mr=Jt,Ur=Or.CONFIGURABLE,Lr=br.get,xr=br.enforce,Vr=String(String).split("String");(Ht.exports=function(e,t,r,n){var i,o=!!n&&!!n.unsafe,a=!!n&&!!n.enumerable,s=!!n&&!!n.noTargetGet,c=n&&void 0!==n.name?n.name:t;wr(r)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Dr(r,"name")||Ur&&r.name!==c)&&kr(r,"name",c),(i=xr(r)).source||(i.source=Vr.join("string"==typeof c?c:""))),e!==Nr?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=r:kr(e,t,r)):a?e[t]=r:Pr(t,r)})(Function.prototype,"toString",(function(){return wr(this)&&Lr(this).source||Mr(this)}));var Br={},jr=Math.ceil,Fr=Math.floor,Gr=function(e){var t=+e;return t!=t||0===t?0:(t>0?Fr:jr)(t)},Hr=Gr,zr=Math.max,Yr=Math.min,Kr=function(e,t){var r=Hr(e);return r<0?zr(r+t,0):Yr(r,t)},Xr=Gr,Wr=Math.min,qr=function(e){return e>0?Wr(Xr(e),9007199254740991):0},Jr=qr,Zr=function(e){return Jr(e.length)},$r=V,Qr=Kr,en=Zr,tn=function(e){return function(t,r,n){var i,o=$r(t),a=en(o),s=Qr(n,a);if(e&&r!=r){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},rn={includes:tn(!0),indexOf:tn(!1)},nn=Ue,on=V,an=rn.indexOf,sn=or,cn=T([].push),un=function(e,t){var r,n=on(e),i=0,o=[];for(r in n)!nn(sn,r)&&nn(n,r)&&cn(o,r);for(;t.length>i;)nn(n,r=t[i++])&&(~an(o,r)||cn(o,r));return o},dn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ln=un,hn=dn.concat("length","prototype");Br.f=Object.getOwnPropertyNames||function(e){return ln(e,hn)};var fn={};fn.f=Object.getOwnPropertySymbols;var pn=Y,_n=Br,vn=fn,mn=Dt,En=T([].concat),Sn=pn("Reflect","ownKeys")||function(e){var t=_n.f(mn(e)),r=vn.f;return r?En(t,r(e)):t},gn=Ue,yn=Sn,bn=i,Tn=Rt,In=function(e,t,r){for(var n=yn(t),i=Tn.f,o=bn.f,a=0;a<n.length;a++){var s=n[a];gn(e,s)||r&&gn(r,s)||i(e,s,o(t,s))}},Rn=o,An=B,Cn=/#|\.prototype\./,On=function(e,t){var r=wn[Nn(e)];return r==kn||r!=Dn&&(An(t)?Rn(t):!!t)},Nn=On.normalize=function(e){return String(e).replace(Cn,".").toLowerCase()},wn=On.data={},Dn=On.NATIVE="N",kn=On.POLYFILL="P",Pn=On,Mn=n,Un=i.f,Ln=Gt,xn=Ht.exports,Vn=Ae,Bn=In,jn=Pn,Fn=function(e,t){var r,n,i,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?Mn:u?Mn[s]||Vn(s,{}):(Mn[s]||{}).prototype)for(n in t){if(o=t[n],i=e.noTargetGet?(a=Un(r,n))&&a.value:r[n],!jn(c?n:s+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;Bn(o,i)}(e.sham||i&&i.sham)&&Ln(o,"sham",!0),xn(r,n,o,e)}},Gn=ve,Hn=s,zn=T(T.bind),Yn=function(e,t){return Gn(e),void 0===t?e:Hn?zn(e,t):function(){return e.apply(t,arguments)}},Kn=C,Xn=Array.isArray||function(e){return"Array"==Kn(e)},Wn={};Wn[Ze("toStringTag")]="z";var qn="[object z]"===String(Wn),Jn=n,Zn=qn,$n=B,Qn=C,ei=Ze("toStringTag"),ti=Jn.Object,ri="Arguments"==Qn(function(){return arguments}()),ni=Zn?Qn:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=ti(e),ei))?r:ri?Qn(t):"Object"==(n=Qn(t))&&$n(t.callee)?"Arguments":n},ii=T,oi=o,ai=B,si=ni,ci=Jt,ui=function(){},di=[],li=Y("Reflect","construct"),hi=/^\s*(?:class|function)\b/,fi=ii(hi.exec),pi=!hi.exec(ui),_i=function(e){if(!ai(e))return!1;try{return li(ui,di,e),!0}catch(e){return!1}},vi=function(e){if(!ai(e))return!1;switch(si(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return pi||!!fi(hi,ci(e))}catch(e){return!0}};vi.sham=!0;var mi=!li||oi((function(){var e;return _i(_i.call)||!_i(Object)||!_i((function(){e=!0}))||e}))?vi:_i,Ei=n,Si=Xn,gi=mi,yi=F,bi=Ze("species"),Ti=Ei.Array,Ii=function(e){var t;return Si(e)&&(t=e.constructor,(gi(t)&&(t===Ti||Si(t.prototype))||yi(t)&&null===(t=t[bi]))&&(t=void 0)),void 0===t?Ti:t},Ri=function(e,t){return new(Ii(e))(0===t?0:t)},Ai=Yn,Ci=P,Oi=ke,Ni=Zr,wi=Ri,Di=T([].push),ki=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,f,p=Oi(c),_=Ci(p),v=Ai(u,d),m=Ni(_),E=0,S=l||wi,g=t?S(c,m):r||a?S(c,0):void 0;m>E;E++)if((s||E in _)&&(f=v(h=_[E],E,p),e))if(t)g[E]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return E;case 2:Di(g,h)}else switch(e){case 4:return!1;case 7:Di(g,h)}return o?-1:n||i?i:g}},Pi={forEach:ki(0),map:ki(1),filter:ki(2),some:ki(3),every:ki(4),find:ki(5),findIndex:ki(6),filterReject:ki(7)},Mi=o,Ui=function(e,t){var r=[][e];return!!r&&Mi((function(){r.call(null,t||function(){throw 1},1)}))},Li=Pi.forEach,xi=Ui("forEach")?[].forEach:function(e){return Li(this,e,arguments.length>1?arguments[1]:void 0)};Fn({target:"Array",proto:!0,forced:[].forEach!=xi},{forEach:xi});var Vi=ni,Bi=qn?{}.toString:function(){return"[object "+Vi(this)+"]"},ji=qn,Fi=Ht.exports,Gi=Bi;ji||Fi(Object.prototype,"toString",Gi,{unsafe:!0});var Hi={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},zi=ft("span").classList,Yi=zi&&zi.constructor&&zi.constructor.prototype,Ki=Yi===Object.prototype?void 0:Yi,Xi=n,Wi=Hi,qi=Ki,Ji=xi,Zi=Gt,$i=function(e){if(e&&e.forEach!==Ji)try{Zi(e,"forEach",Ji)}catch(t){e.forEach=Ji}};for(var Qi in Wi)Wi[Qi]&&$i(Xi[Qi]&&Xi[Qi].prototype);$i(qi);var eo=Fn,to=T,ro=n.Date,no=to(ro.prototype.getTime);eo({target:"Date",stat:!0},{now:function(){return no(new ro)}});var io=T,oo=Ht.exports,ao=Date.prototype,so=io(ao.toString),co=io(ao.getTime);function uo(e){return uo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uo(e)}"Invalid Date"!=String(new Date(NaN))&&oo(ao,"toString",(function(){var e=co(this);return e==e?so(this):"Invalid Date"}));var lo=n,ho=B,fo=lo.String,po=lo.TypeError,_o=T,vo=Dt,mo=function(e){if("object"==typeof e||ho(e))return e;throw po("Can't set "+fo(e)+" as a prototype")},Eo=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=_o(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return vo(r),mo(n),t?e(r,n):r.__proto__=n,r}}():void 0);Fn({target:"Object",stat:!0},{setPrototypeOf:Eo});var So={},go=un,yo=dn,bo=Object.keys||function(e){return go(e,yo)},To=a,Io=At,Ro=Rt,Ao=Dt,Co=V,Oo=bo;So.f=To&&!Io?Object.defineProperties:function(e,t){Ao(e);for(var r,n=Co(t),i=Oo(t),o=i.length,a=0;o>a;)Ro.f(e,r=i[a++],n[r]);return e};var No,wo=Y("document","documentElement"),Do=Dt,ko=So,Po=dn,Mo=or,Uo=wo,Lo=ft,xo=ir("IE_PROTO"),Vo=function(){},Bo=function(e){return"<script>"+e+"<\/script>"},jo=function(e){e.write(Bo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Fo=function(){try{No=new ActiveXObject("htmlfile")}catch(e){}var e,t;Fo="undefined"!=typeof document?document.domain&&No?jo(No):((t=Lo("iframe")).style.display="none",Uo.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Bo("document.F=Object")),e.close(),e.F):jo(No);for(var r=Po.length;r--;)delete Fo.prototype[Po[r]];return Fo()};Mo[xo]=!0;var Go=Object.create||function(e,t){var r;return null!==e?(Vo.prototype=Do(e),r=new Vo,Vo.prototype=null,r[xo]=e):r=Fo(),void 0===t?r:ko.f(r,t)};Fn({target:"Object",stat:!0,sham:!a},{create:Go});var Ho=a,zo=T,Yo=d,Ko=o,Xo=bo,Wo=fn,qo=l,Jo=ke,Zo=P,$o=Object.assign,Qo=Object.defineProperty,ea=zo([].concat),ta=!$o||Ko((function(){if(Ho&&1!==$o({b:1},$o(Qo({},"a",{enumerable:!0,get:function(){Qo(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=$o({},e)[r]||Xo($o({},t)).join("")!=n}))?function(e,t){for(var r=Jo(e),n=arguments.length,i=1,o=Wo.f,a=qo.f;n>i;)for(var s,c=Zo(arguments[i++]),u=o?ea(Xo(c),o(c)):Xo(c),d=u.length,l=0;d>l;)s=u[l++],Ho&&!Yo(a,c,s)||(r[s]=c[s]);return r}:$o,ra=ta;Fn({target:"Object",stat:!0,forced:Object.assign!==ra},{assign:ra});var na=Fn,ia=rn.indexOf,oa=Ui,aa=T([].indexOf),sa=!!aa&&1/aa([1],1,-0)<0,ca=oa("indexOf");na({target:"Array",proto:!0,forced:sa||!ca},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return sa?aa(this,e,t)||0:ia(this,e,t)}});var ua=s,da=Function.prototype,la=da.apply,ha=da.call,fa="object"==typeof Reflect&&Reflect.apply||(ua?ha.bind(la):function(){return ha.apply(la,arguments)}),pa=ni,_a=n.String,va=function(e){if("Symbol"===pa(e))throw TypeError("Cannot convert a Symbol value to a string");return _a(e)},ma={},Ea=ut,Sa=Rt,ga=m,ya=function(e,t,r){var n=Ea(t);n in e?Sa.f(e,n,ga(0,r)):e[n]=r},ba=Kr,Ta=Zr,Ia=ya,Ra=n.Array,Aa=Math.max,Ca=function(e,t,r){for(var n=Ta(e),i=ba(t,n),o=ba(void 0===r?n:r,n),a=Ra(Aa(o-i,0)),s=0;i<o;i++,s++)Ia(a,s,e[i]);return a.length=s,a},Oa=C,Na=V,wa=Br.f,Da=Ca,ka="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];ma.f=function(e){return ka&&"Window"==Oa(e)?function(e){try{return wa(e)}catch(e){return Da(ka)}}(e):wa(Na(e))};var Pa=T([].slice),Ma={},Ua=Ze;Ma.f=Ua;var La=n,xa=Ue,Va=Ma,Ba=Rt.f,ja=function(e){var t=La.Symbol||(La.Symbol={});xa(t,e)||Ba(t,e,{value:Va.f(e)})},Fa=Rt.f,Ga=Ue,Ha=Ze("toStringTag"),za=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Ga(e,Ha)&&Fa(e,Ha,{configurable:!0,value:t})},Ya=Fn,Ka=n,Xa=Y,Wa=fa,qa=d,Ja=T,Za=a,$a=ne,Qa=o,es=Ue,ts=Xn,rs=B,ns=F,is=K,os=de,as=Dt,ss=ke,cs=V,us=ut,ds=va,ls=m,hs=Go,fs=bo,ps=Br,_s=ma,vs=fn,ms=i,Es=Rt,Ss=So,gs=l,ys=Pa,bs=Ht.exports,Ts=Te.exports,Is=or,Rs=je,As=Ze,Cs=Ma,Os=ja,Ns=za,ws=br,Ds=Pi.forEach,ks=ir("hidden"),Ps=As("toPrimitive"),Ms=ws.set,Us=ws.getterFor("Symbol"),Ls=Object.prototype,xs=Ka.Symbol,Vs=xs&&xs.prototype,Bs=Ka.TypeError,js=Ka.QObject,Fs=Xa("JSON","stringify"),Gs=ms.f,Hs=Es.f,zs=_s.f,Ys=gs.f,Ks=Ja([].push),Xs=Ts("symbols"),Ws=Ts("op-symbols"),qs=Ts("string-to-symbol-registry"),Js=Ts("symbol-to-string-registry"),Zs=Ts("wks"),$s=!js||!js.prototype||!js.prototype.findChild,Qs=Za&&Qa((function(){return 7!=hs(Hs({},"a",{get:function(){return Hs(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Gs(Ls,t);n&&delete Ls[t],Hs(e,t,r),n&&e!==Ls&&Hs(Ls,t,n)}:Hs,ec=function(e,t){var r=Xs[e]=hs(Vs);return Ms(r,{type:"Symbol",tag:e,description:t}),Za||(r.description=t),r},tc=function(e,t,r){e===Ls&&tc(Ws,t,r),as(e);var n=us(t);return as(r),es(Xs,n)?(r.enumerable?(es(e,ks)&&e[ks][n]&&(e[ks][n]=!1),r=hs(r,{enumerable:ls(0,!1)})):(es(e,ks)||Hs(e,ks,ls(1,{})),e[ks][n]=!0),Qs(e,n,r)):Hs(e,n,r)},rc=function(e,t){as(e);var r=cs(t),n=fs(r).concat(ac(r));return Ds(n,(function(t){Za&&!qa(nc,r,t)||tc(e,t,r[t])})),e},nc=function(e){var t=us(e),r=qa(Ys,this,t);return!(this===Ls&&es(Xs,t)&&!es(Ws,t))&&(!(r||!es(this,t)||!es(Xs,t)||es(this,ks)&&this[ks][t])||r)},ic=function(e,t){var r=cs(e),n=us(t);if(r!==Ls||!es(Xs,n)||es(Ws,n)){var i=Gs(r,n);return!i||!es(Xs,n)||es(r,ks)&&r[ks][n]||(i.enumerable=!0),i}},oc=function(e){var t=zs(cs(e)),r=[];return Ds(t,(function(e){es(Xs,e)||es(Is,e)||Ks(r,e)})),r},ac=function(e){var t=e===Ls,r=zs(t?Ws:cs(e)),n=[];return Ds(r,(function(e){!es(Xs,e)||t&&!es(Ls,e)||Ks(n,Xs[e])})),n};($a||(bs(Vs=(xs=function(){if(is(Vs,this))throw Bs("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?ds(arguments[0]):void 0,t=Rs(e),r=function(e){this===Ls&&qa(r,Ws,e),es(this,ks)&&es(this[ks],t)&&(this[ks][t]=!1),Qs(this,t,ls(1,e))};return Za&&$s&&Qs(Ls,t,{configurable:!0,set:r}),ec(t,e)}).prototype,"toString",(function(){return Us(this).tag})),bs(xs,"withoutSetter",(function(e){return ec(Rs(e),e)})),gs.f=nc,Es.f=tc,Ss.f=rc,ms.f=ic,ps.f=_s.f=oc,vs.f=ac,Cs.f=function(e){return ec(As(e),e)},Za&&(Hs(Vs,"description",{configurable:!0,get:function(){return Us(this).description}}),bs(Ls,"propertyIsEnumerable",nc,{unsafe:!0}))),Ya({global:!0,wrap:!0,forced:!$a,sham:!$a},{Symbol:xs}),Ds(fs(Zs),(function(e){Os(e)})),Ya({target:"Symbol",stat:!0,forced:!$a},{for:function(e){var t=ds(e);if(es(qs,t))return qs[t];var r=xs(t);return qs[t]=r,Js[r]=t,r},keyFor:function(e){if(!os(e))throw Bs(e+" is not a symbol");if(es(Js,e))return Js[e]},useSetter:function(){$s=!0},useSimple:function(){$s=!1}}),Ya({target:"Object",stat:!0,forced:!$a,sham:!Za},{create:function(e,t){return void 0===t?hs(e):rc(hs(e),t)},defineProperty:tc,defineProperties:rc,getOwnPropertyDescriptor:ic}),Ya({target:"Object",stat:!0,forced:!$a},{getOwnPropertyNames:oc,getOwnPropertySymbols:ac}),Ya({target:"Object",stat:!0,forced:Qa((function(){vs.f(1)}))},{getOwnPropertySymbols:function(e){return vs.f(ss(e))}}),Fs)&&Ya({target:"JSON",stat:!0,forced:!$a||Qa((function(){var e=xs();return"[null]"!=Fs([e])||"{}"!=Fs({a:e})||"{}"!=Fs(Object(e))}))},{stringify:function(e,t,r){var n=ys(arguments),i=t;if((ns(t)||void 0!==e)&&!os(e))return ts(t)||(t=function(e,t){if(rs(i)&&(t=qa(i,this,e,t)),!os(t))return t}),n[1]=t,Wa(Fs,null,n)}});if(!Vs[Ps]){var sc=Vs.valueOf;bs(Vs,Ps,(function(e){return qa(sc,this)}))}Ns(xs,"Symbol"),Is[ks]=!0;var cc=Fn,uc=o,dc=V,lc=i.f,hc=a,fc=uc((function(){lc(1)}));cc({target:"Object",stat:!0,forced:!hc||fc,sham:!hc},{getOwnPropertyDescriptor:function(e,t){return lc(dc(e),t)}});var pc=Fn,_c=a,vc=Rt.f;pc({target:"Object",stat:!0,forced:Object.defineProperty!==vc,sham:!_c},{defineProperty:vc});var mc=n.Promise,Ec=Ht.exports,Sc=function(e,t,r){for(var n in t)Ec(e,n,t[n],r);return e},gc=Y,yc=Rt,bc=a,Tc=Ze("species"),Ic=function(e){var t=gc(e),r=yc.f;bc&&t&&!t[Tc]&&r(t,Tc,{configurable:!0,get:function(){return this}})},Rc=K,Ac=n.TypeError,Cc=function(e,t){if(Rc(t,e))return e;throw Ac("Incorrect invocation")},Oc={},Nc=Oc,wc=Ze("iterator"),Dc=Array.prototype,kc=function(e){return void 0!==e&&(Nc.Array===e||Dc[wc]===e)},Pc=ni,Mc=Ee,Uc=Oc,Lc=Ze("iterator"),xc=function(e){if(null!=e)return Mc(e,Lc)||Mc(e,"@@iterator")||Uc[Pc(e)]},Vc=d,Bc=ve,jc=Dt,Fc=he,Gc=xc,Hc=n.TypeError,zc=function(e,t){var r=arguments.length<2?Gc(e):t;if(Bc(r))return jc(Vc(r,e));throw Hc(Fc(e)+" is not iterable")},Yc=d,Kc=Dt,Xc=Ee,Wc=function(e,t,r){var n,i;Kc(e);try{if(!(n=Xc(e,"return"))){if("throw"===t)throw r;return r}n=Yc(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return Kc(n),r},qc=Yn,Jc=d,Zc=Dt,$c=he,Qc=kc,eu=Zr,tu=K,ru=zc,nu=xc,iu=Wc,ou=n.TypeError,au=function(e,t){this.stopped=e,this.result=t},su=au.prototype,cu=function(e,t,r){var n,i,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),p=qc(t,d),_=function(e){return n&&iu(n,"normal",e),new au(!0,e)},v=function(e){return l?(Zc(e),f?p(e[0],e[1],_):p(e[0],e[1])):f?p(e,_):p(e)};if(h)n=e;else{if(!(i=nu(e)))throw ou($c(e)+" is not iterable");if(Qc(i)){for(o=0,a=eu(e);a>o;o++)if((s=v(e[o]))&&tu(su,s))return s;return new au(!1)}n=ru(e,i)}for(c=n.next;!(u=Jc(c,n)).done;){try{s=v(u.value)}catch(e){iu(n,"throw",e)}if("object"==typeof s&&s&&tu(su,s))return s}return new au(!1)},uu=Ze("iterator"),du=!1;try{var lu=0,hu={next:function(){return{done:!!lu++}},return:function(){du=!0}};hu[uu]=function(){return this},Array.from(hu,(function(){throw 2}))}catch(e){}var fu,pu,_u,vu,mu=function(e,t){if(!t&&!du)return!1;var r=!1;try{var n={};n[uu]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},Eu=mi,Su=he,gu=n.TypeError,yu=function(e){if(Eu(e))return e;throw gu(Su(e)+" is not a constructor")},bu=Dt,Tu=yu,Iu=Ze("species"),Ru=function(e,t){var r,n=bu(e).constructor;return void 0===n||null==(r=bu(n)[Iu])?t:Tu(r)},Au=n.TypeError,Cu=function(e,t){if(e<t)throw Au("Not enough arguments");return e},Ou=/(?:ipad|iphone|ipod).*applewebkit/i.test(X),Nu="process"==C(n.process),wu=n,Du=fa,ku=Yn,Pu=B,Mu=Ue,Uu=o,Lu=wo,xu=Pa,Vu=ft,Bu=Cu,ju=Ou,Fu=Nu,Gu=wu.setImmediate,Hu=wu.clearImmediate,zu=wu.process,Yu=wu.Dispatch,Ku=wu.Function,Xu=wu.MessageChannel,Wu=wu.String,qu=0,Ju={};try{fu=wu.location}catch(e){}var Zu=function(e){if(Mu(Ju,e)){var t=Ju[e];delete Ju[e],t()}},$u=function(e){return function(){Zu(e)}},Qu=function(e){Zu(e.data)},ed=function(e){wu.postMessage(Wu(e),fu.protocol+"//"+fu.host)};Gu&&Hu||(Gu=function(e){Bu(arguments.length,1);var t=Pu(e)?e:Ku(e),r=xu(arguments,1);return Ju[++qu]=function(){Du(t,void 0,r)},pu(qu),qu},Hu=function(e){delete Ju[e]},Fu?pu=function(e){zu.nextTick($u(e))}:Yu&&Yu.now?pu=function(e){Yu.now($u(e))}:Xu&&!ju?(vu=(_u=new Xu).port2,_u.port1.onmessage=Qu,pu=ku(vu.postMessage,vu)):wu.addEventListener&&Pu(wu.postMessage)&&!wu.importScripts&&fu&&"file:"!==fu.protocol&&!Uu(ed)?(pu=ed,wu.addEventListener("message",Qu,!1)):pu="onreadystatechange"in Vu("script")?function(e){Lu.appendChild(Vu("script")).onreadystatechange=function(){Lu.removeChild(this),Zu(e)}}:function(e){setTimeout($u(e),0)});var td,rd,nd,id,od,ad,sd,cd,ud={set:Gu,clear:Hu},dd=n,ld=/ipad|iphone|ipod/i.test(X)&&void 0!==dd.Pebble,hd=/web0s(?!.*chrome)/i.test(X),fd=n,pd=Yn,_d=i.f,vd=ud.set,md=Ou,Ed=ld,Sd=hd,gd=Nu,yd=fd.MutationObserver||fd.WebKitMutationObserver,bd=fd.document,Td=fd.process,Id=fd.Promise,Rd=_d(fd,"queueMicrotask"),Ad=Rd&&Rd.value;Ad||(td=function(){var e,t;for(gd&&(e=Td.domain)&&e.exit();rd;){t=rd.fn,rd=rd.next;try{t()}catch(e){throw rd?id():nd=void 0,e}}nd=void 0,e&&e.enter()},md||gd||Sd||!yd||!bd?!Ed&&Id&&Id.resolve?((sd=Id.resolve(void 0)).constructor=Id,cd=pd(sd.then,sd),id=function(){cd(td)}):gd?id=function(){Td.nextTick(td)}:(vd=pd(vd,fd),id=function(){vd(td)}):(od=!0,ad=bd.createTextNode(""),new yd(td).observe(ad,{characterData:!0}),id=function(){ad.data=od=!od}));var Cd=Ad||function(e){var t={fn:e,next:void 0};nd&&(nd.next=t),rd||(rd=t,id()),nd=t},Od={},Nd=ve,wd=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=Nd(t),this.reject=Nd(r)};Od.f=function(e){return new wd(e)};var Dd=Dt,kd=F,Pd=Od,Md=function(e,t){if(Dd(e),kd(t)&&t.constructor===e)return t;var r=Pd.f(e);return(0,r.resolve)(t),r.promise},Ud=n,Ld=function(){this.head=null,this.tail=null};Ld.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var xd,Vd,Bd,jd,Fd=Ld,Gd="object"==typeof window,Hd=Fn,zd=n,Yd=Y,Kd=d,Xd=mc,Wd=Ht.exports,qd=Sc,Jd=Eo,Zd=za,$d=Ic,Qd=ve,el=B,tl=F,rl=Cc,nl=Jt,il=cu,ol=mu,al=Ru,sl=ud.set,cl=Cd,ul=Md,dl=function(e,t){var r=Ud.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},ll=Od,hl=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},fl=Fd,pl=br,_l=Pn,vl=Gd,ml=Nu,El=ee,Sl=Ze("species"),gl="Promise",yl=pl.getterFor(gl),bl=pl.set,Tl=pl.getterFor(gl),Il=Xd&&Xd.prototype,Rl=Xd,Al=Il,Cl=zd.TypeError,Ol=zd.document,Nl=zd.process,wl=ll.f,Dl=wl,kl=!!(Ol&&Ol.createEvent&&zd.dispatchEvent),Pl=el(zd.PromiseRejectionEvent),Ml=!1,Ul=_l(gl,(function(){var e=nl(Rl),t=e!==String(Rl);if(!t&&66===El)return!0;if(El>=51&&/native code/.test(e))return!1;var r=new Rl((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};return(r.constructor={})[Sl]=n,!(Ml=r.then((function(){}))instanceof n)||!t&&vl&&!Pl})),Ll=Ul||!ol((function(e){Rl.all(e).catch((function(){}))})),xl=function(e){var t;return!(!tl(e)||!el(t=e.then))&&t},Vl=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&Hl(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(Cl("Promise-chain cycle")):(n=xl(r))?Kd(n,r,c,u):c(r)):u(o)}catch(e){d&&!i&&d.exit(),u(e)}},Bl=function(e,t){e.notified||(e.notified=!0,cl((function(){for(var r,n=e.reactions;r=n.get();)Vl(r,e);e.notified=!1,t&&!e.rejection&&Fl(e)})))},jl=function(e,t,r){var n,i;kl?((n=Ol.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),zd.dispatchEvent(n)):n={promise:t,reason:r},!Pl&&(i=zd["on"+e])?i(n):"unhandledrejection"===e&&dl("Unhandled promise rejection",r)},Fl=function(e){Kd(sl,zd,(function(){var t,r=e.facade,n=e.value;if(Gl(e)&&(t=hl((function(){ml?Nl.emit("unhandledRejection",n,r):jl("unhandledrejection",r,n)})),e.rejection=ml||Gl(e)?2:1,t.error))throw t.value}))},Gl=function(e){return 1!==e.rejection&&!e.parent},Hl=function(e){Kd(sl,zd,(function(){var t=e.facade;ml?Nl.emit("rejectionHandled",t):jl("rejectionhandled",t,e.value)}))},zl=function(e,t,r){return function(n){e(t,n,r)}},Yl=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Bl(e,!0))},Kl=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Cl("Promise can't be resolved itself");var n=xl(t);n?cl((function(){var r={done:!1};try{Kd(n,t,zl(Kl,r,e),zl(Yl,r,e))}catch(t){Yl(r,t,e)}})):(e.value=t,e.state=1,Bl(e,!1))}catch(t){Yl({done:!1},t,e)}}};if(Ul&&(Al=(Rl=function(e){rl(this,Al),Qd(e),Kd(xd,this);var t=yl(this);try{e(zl(Kl,t),zl(Yl,t))}catch(e){Yl(t,e)}}).prototype,(xd=function(e){bl(this,{type:gl,done:!1,notified:!1,parent:!1,reactions:new fl,rejection:!1,state:0,value:void 0})}).prototype=qd(Al,{then:function(e,t){var r=Tl(this),n=wl(al(this,Rl));return r.parent=!0,n.ok=!el(e)||e,n.fail=el(t)&&t,n.domain=ml?Nl.domain:void 0,0==r.state?r.reactions.add(n):cl((function(){Vl(n,r)})),n.promise},catch:function(e){return this.then(void 0,e)}}),Vd=function(){var e=new xd,t=yl(e);this.promise=e,this.resolve=zl(Kl,t),this.reject=zl(Yl,t)},ll.f=wl=function(e){return e===Rl||e===Bd?new Vd(e):Dl(e)},el(Xd)&&Il!==Object.prototype)){jd=Il.then,Ml||(Wd(Il,"then",(function(e,t){var r=this;return new Rl((function(e,t){Kd(jd,r,e,t)})).then(e,t)}),{unsafe:!0}),Wd(Il,"catch",Al.catch,{unsafe:!0}));try{delete Il.constructor}catch(e){}Jd&&Jd(Il,Al)}Hd({global:!0,wrap:!0,forced:Ul},{Promise:Rl}),Zd(Rl,gl,!1),$d(gl),Bd=Yd(gl),Hd({target:gl,stat:!0,forced:Ul},{reject:function(e){var t=wl(this);return Kd(t.reject,void 0,e),t.promise}}),Hd({target:gl,stat:!0,forced:Ul},{resolve:function(e){return ul(this,e)}}),Hd({target:gl,stat:!0,forced:Ll},{all:function(e){var t=this,r=wl(t),n=r.resolve,i=r.reject,o=hl((function(){var r=Qd(t.resolve),o=[],a=0,s=1;il(e,(function(e){var c=a++,u=!1;s++,Kd(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise},race:function(e){var t=this,r=wl(t),n=r.reject,i=hl((function(){var i=Qd(t.resolve);il(e,(function(e){Kd(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var Xl=Fn,Wl=a,ql=n,Jl=T,Zl=Ue,$l=B,Ql=K,eh=va,th=Rt.f,rh=In,nh=ql.Symbol,ih=nh&&nh.prototype;if(Wl&&$l(nh)&&(!("description"in ih)||void 0!==nh().description)){var oh={},ah=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:eh(arguments[0]),t=Ql(ih,this)?new nh(e):void 0===e?nh():nh(e);return""===e&&(oh[t]=!0),t};rh(ah,nh),ah.prototype=ih,ih.constructor=ah;var sh="Symbol(test)"==String(nh("test")),ch=Jl(ih.toString),uh=Jl(ih.valueOf),dh=/^Symbol\((.*)\)[^)]+$/,lh=Jl("".replace),hh=Jl("".slice);th(ih,"description",{configurable:!0,get:function(){var e=uh(this),t=ch(e);if(Zl(oh,e))return"";var r=sh?hh(t,7,-1):lh(t,dh,"$1");return""===r?void 0:r}}),Xl({global:!0,forced:!0},{Symbol:ah})}ja("iterator");var fh=Go,ph=Rt,_h=Ze("unscopables"),vh=Array.prototype;null==vh[_h]&&ph.f(vh,_h,{configurable:!0,value:fh(null)});var mh,Eh,Sh,gh=function(e){vh[_h][e]=!0},yh=!o((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),bh=n,Th=Ue,Ih=B,Rh=ke,Ah=yh,Ch=ir("IE_PROTO"),Oh=bh.Object,Nh=Oh.prototype,wh=Ah?Oh.getPrototypeOf:function(e){var t=Rh(e);if(Th(t,Ch))return t[Ch];var r=t.constructor;return Ih(r)&&t instanceof r?r.prototype:t instanceof Oh?Nh:null},Dh=o,kh=B,Ph=wh,Mh=Ht.exports,Uh=Ze("iterator"),Lh=!1;[].keys&&("next"in(Sh=[].keys())?(Eh=Ph(Ph(Sh)))!==Object.prototype&&(mh=Eh):Lh=!0);var xh=null==mh||Dh((function(){var e={};return mh[Uh].call(e)!==e}));xh&&(mh={}),kh(mh[Uh])||Mh(mh,Uh,(function(){return this}));var Vh={IteratorPrototype:mh,BUGGY_SAFARI_ITERATORS:Lh},Bh=Vh.IteratorPrototype,jh=Go,Fh=m,Gh=za,Hh=Oc,zh=function(){return this},Yh=function(e,t,r,n){var i=t+" Iterator";return e.prototype=jh(Bh,{next:Fh(+!n,r)}),Gh(e,i,!1),Hh[i]=zh,e},Kh=Fn,Xh=d,Wh=Or,qh=B,Jh=Yh,Zh=wh,$h=Eo,Qh=za,ef=Gt,tf=Ht.exports,rf=Oc,nf=Wh.PROPER,of=Wh.CONFIGURABLE,af=Vh.IteratorPrototype,sf=Vh.BUGGY_SAFARI_ITERATORS,cf=Ze("iterator"),uf=function(){return this},df=function(e,t,r,n,i,o,a){Jh(r,t,n);var s,c,u,d=function(e){if(e===i&&_)return _;if(!sf&&e in f)return f[e];switch(e){case"keys":case"values":case"entries":return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[cf]||f["@@iterator"]||i&&f[i],_=!sf&&p||d(i),v="Array"==t&&f.entries||p;if(v&&(s=Zh(v.call(new e)))!==Object.prototype&&s.next&&(Zh(s)!==af&&($h?$h(s,af):qh(s[cf])||tf(s,cf,uf)),Qh(s,l,!0)),nf&&"values"==i&&p&&"values"!==p.name&&(of?ef(f,"name","values"):(h=!0,_=function(){return Xh(p,this)})),i)if(c={values:d("values"),keys:o?_:d("keys"),entries:d("entries")},a)for(u in c)(sf||h||!(u in f))&&tf(f,u,c[u]);else Kh({target:t,proto:!0,forced:sf||h},c);return f[cf]!==_&&tf(f,cf,_,{name:i}),rf[t]=_,c},lf=V,hf=gh,ff=Oc,pf=br,_f=Rt.f,vf=df,mf=a,Ef=pf.set,Sf=pf.getterFor("Array Iterator"),gf=vf(Array,"Array",(function(e,t){Ef(this,{type:"Array Iterator",target:lf(e),index:0,kind:t})}),(function(){var e=Sf(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values"),yf=ff.Arguments=ff.Array;if(hf("keys"),hf("values"),hf("entries"),mf&&"values"!==yf.name)try{_f(yf,"name",{value:"values"})}catch(e){}var bf=T,Tf=Gr,If=va,Rf=U,Af=bf("".charAt),Cf=bf("".charCodeAt),Of=bf("".slice),Nf=function(e){return function(t,r){var n,i,o=If(Rf(t)),a=Tf(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=Cf(o,a))<55296||n>56319||a+1===s||(i=Cf(o,a+1))<56320||i>57343?e?Af(o,a):n:e?Of(o,a,a+2):i-56320+(n-55296<<10)+65536}},wf={codeAt:Nf(!1),charAt:Nf(!0)},Df=wf.charAt,kf=va,Pf=br,Mf=df,Uf=Pf.set,Lf=Pf.getterFor("String Iterator");Mf(String,"String",(function(e){Uf(this,{type:"String Iterator",string:kf(e),index:0})}),(function(){var e,t=Lf(this),r=t.string,n=t.index;return n>=r.length?{value:void 0,done:!0}:(e=Df(r,n),t.index+=e.length,{value:e,done:!1})}));var xf=n,Vf=Hi,Bf=Ki,jf=gf,Ff=Gt,Gf=Ze,Hf=Gf("iterator"),zf=Gf("toStringTag"),Yf=jf.values,Kf=function(e,t){if(e){if(e[Hf]!==Yf)try{Ff(e,Hf,Yf)}catch(t){e[Hf]=Yf}if(e[zf]||Ff(e,zf,t),Vf[t])for(var r in jf)if(e[r]!==jf[r])try{Ff(e,r,jf[r])}catch(t){e[r]=jf[r]}}};for(var Xf in Vf)Kf(xf[Xf]&&xf[Xf].prototype,Xf);Kf(Bf,"DOMTokenList");var Wf=o,qf=ee,Jf=Ze("species"),Zf=function(e){return qf>=51||!Wf((function(){var t=[];return(t.constructor={})[Jf]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},$f=Fn,Qf=n,ep=o,tp=Xn,rp=F,np=ke,ip=Zr,op=ya,ap=Ri,sp=Zf,cp=ee,up=Ze("isConcatSpreadable"),dp=Qf.TypeError,lp=cp>=51||!ep((function(){var e=[];return e[up]=!1,e.concat()[0]!==e})),hp=sp("concat"),fp=function(e){if(!rp(e))return!1;var t=e[up];return void 0!==t?!!t:tp(e)};$f({target:"Array",proto:!0,forced:!lp||!hp},{concat:function(e){var t,r,n,i,o,a=np(this),s=ap(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(fp(o=-1===t?a:arguments[t])){if(c+(i=ip(o))>9007199254740991)throw dp("Maximum allowed index exceeded");for(r=0;r<i;r++,c++)r in o&&op(s,c,o[r])}else{if(c>=9007199254740991)throw dp("Maximum allowed index exceeded");op(s,c++,o)}return s.length=c,s}});var pp=Fn,_p=n,vp=Xn,mp=mi,Ep=F,Sp=Kr,gp=Zr,yp=V,bp=ya,Tp=Ze,Ip=Pa,Rp=Zf("slice"),Ap=Tp("species"),Cp=_p.Array,Op=Math.max;pp({target:"Array",proto:!0,forced:!Rp},{slice:function(e,t){var r,n,i,o=yp(this),a=gp(o),s=Sp(e,a),c=Sp(void 0===t?a:t,a);if(vp(o)&&(r=o.constructor,(mp(r)&&(r===Cp||vp(r.prototype))||Ep(r)&&null===(r=r[Ap]))&&(r=void 0),r===Cp||void 0===r))return Ip(o,s,c);for(n=new(void 0===r?Cp:r)(Op(c-s,0)),i=0;s<c;s++,i++)s in o&&bp(n,i,o[s]);return n.length=i,n}}),ja("asyncIterator");var Np=function(e,t){return Np=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Np(e,t)};function wp(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Np(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Dp=function(){return Dp=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Dp.apply(this,arguments)};function kp(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"===("undefined"==typeof Reflect?"undefined":uo(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function Pp(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function Mp(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function Up(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Lp(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function xp(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function Vp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Bp=Dt,jp=function(){var e=Bp(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},Fp=o,Gp=n.RegExp,Hp=Fp((function(){var e=Gp("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),zp=Hp||Fp((function(){return!Gp("a","y").sticky})),Yp={BROKEN_CARET:Hp||Fp((function(){var e=Gp("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:zp,UNSUPPORTED_Y:Hp},Kp=o,Xp=n.RegExp,Wp=Kp((function(){var e=Xp(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),qp=o,Jp=n.RegExp,Zp=qp((function(){var e=Jp("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),$p=d,Qp=T,e_=va,t_=jp,r_=Yp,n_=Te.exports,i_=Go,o_=br.get,a_=Wp,s_=Zp,c_=n_("native-string-replace",String.prototype.replace),u_=RegExp.prototype.exec,d_=u_,l_=Qp("".charAt),h_=Qp("".indexOf),f_=Qp("".replace),p_=Qp("".slice),__=function(){var e=/a/,t=/b*/g;return $p(u_,e,"a"),$p(u_,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),v_=r_.BROKEN_CARET,m_=void 0!==/()??/.exec("")[1];(__||m_||v_||a_||s_)&&(d_=function(e){var t,r,n,i,o,a,s,c=this,u=o_(c),d=e_(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=$p(d_,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,f=v_&&c.sticky,p=$p(t_,c),_=c.source,v=0,m=d;if(f&&(p=f_(p,"y",""),-1===h_(p,"g")&&(p+="g"),m=p_(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==l_(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",p)),m_&&(r=new RegExp("^"+_+"$(?!\\s)",p)),__&&(n=c.lastIndex),i=$p(u_,f?r:c,m),f?i?(i.input=p_(i.input,v),i[0]=p_(i[0],v),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:__&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),m_&&i&&i.length>1&&$p(c_,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&h)for(i.groups=a=i_(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var E_=d_;Fn({target:"RegExp",proto:!0,forced:/./.exec!==E_},{exec:E_});var S_=T,g_=Ht.exports,y_=E_,b_=o,T_=Ze,I_=Gt,R_=T_("species"),A_=RegExp.prototype,C_=function(e,t,r,n){var i=T_(e),o=!b_((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!b_((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[R_]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=S_(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var a=S_(e),c=t.exec;return c===y_||c===A_.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));g_(String.prototype,e,c[0]),g_(A_,i,c[1])}n&&I_(A_[i],"sham",!0)},O_=wf.charAt,N_=function(e,t,r){return t+(r?O_(e,t).length:1)},w_=d,D_=Dt,k_=B,P_=C,M_=E_,U_=n.TypeError,L_=function(e,t){var r=e.exec;if(k_(r)){var n=w_(r,e,t);return null!==n&&D_(n),n}if("RegExp"===P_(e))return w_(M_,e,t);throw U_("RegExp#exec called on incompatible receiver")},x_=d,V_=Dt,B_=qr,j_=va,F_=U,G_=Ee,H_=N_,z_=L_;C_("match",(function(e,t,r){return[function(t){var r=F_(this),n=null==t?void 0:G_(t,e);return n?x_(n,t,r):new RegExp(t)[e](j_(r))},function(e){var n=V_(this),i=j_(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return z_(n,i);var a=n.unicode;n.lastIndex=0;for(var s,c=[],u=0;null!==(s=z_(n,i));){var d=j_(s[0]);c[u]=d,""===d&&(n.lastIndex=H_(i,B_(n.lastIndex),a)),u++}return 0===u?null:c}]}));var Y_="\t\n\v\f\r \u2028\u2029\ufeff",K_=U,X_=va,W_=T("".replace),q_="[\t\n\v\f\r \u2028\u2029\ufeff]",J_=RegExp("^"+q_+q_+"*"),Z_=RegExp(q_+q_+"*$"),$_=function(e){return function(t){var r=X_(K_(t));return 1&e&&(r=W_(r,J_,"")),2&e&&(r=W_(r,Z_,"")),r}},Q_={start:$_(1),end:$_(2),trim:$_(3)},ev=n,tv=o,rv=T,nv=va,iv=Q_.trim,ov=ev.parseInt,av=ev.Symbol,sv=av&&av.iterator,cv=/^[+-]?0x/i,uv=rv(cv.exec),dv=8!==ov("\t\n\v\f\r \u2028\u2029\ufeff08")||22!==ov("\t\n\v\f\r \u2028\u2029\ufeff0x16")||sv&&!tv((function(){ov(Object(sv))}))?function(e,t){var r=iv(nv(e));return ov(r,t>>>0||(uv(cv,r)?16:10))}:ov;Fn({global:!0,forced:parseInt!=dv},{parseInt:dv});var lv={exports:{}},hv=o((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),fv=o,pv=F,_v=C,vv=hv,mv=Object.isExtensible,Ev=fv((function(){mv(1)}))||vv?function(e){return!!pv(e)&&((!vv||"ArrayBuffer"!=_v(e))&&(!mv||mv(e)))}:mv,Sv=!o((function(){return Object.isExtensible(Object.preventExtensions({}))})),gv=Fn,yv=T,bv=or,Tv=F,Iv=Ue,Rv=Rt.f,Av=Br,Cv=ma,Ov=Ev,Nv=Sv,wv=!1,Dv=je("meta"),kv=0,Pv=function(e){Rv(e,Dv,{value:{objectID:"O"+kv++,weakData:{}}})},Mv=lv.exports={enable:function(){Mv.enable=function(){},wv=!0;var e=Av.f,t=yv([].splice),r={};r[Dv]=1,e(r).length&&(Av.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Dv){t(n,i,1);break}return n},gv({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Cv.f}))},fastKey:function(e,t){if(!Tv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Iv(e,Dv)){if(!Ov(e))return"F";if(!t)return"E";Pv(e)}return e[Dv].objectID},getWeakData:function(e,t){if(!Iv(e,Dv)){if(!Ov(e))return!0;if(!t)return!1;Pv(e)}return e[Dv].weakData},onFreeze:function(e){return Nv&&wv&&Ov(e)&&!Iv(e,Dv)&&Pv(e),e}};bv[Dv]=!0;var Uv=B,Lv=F,xv=Eo,Vv=function(e,t,r){var n,i;return xv&&Uv(n=t.constructor)&&n!==r&&Lv(i=n.prototype)&&i!==r.prototype&&xv(e,i),e},Bv=Fn,jv=n,Fv=T,Gv=Pn,Hv=Ht.exports,zv=lv.exports,Yv=cu,Kv=Cc,Xv=B,Wv=F,qv=o,Jv=mu,Zv=za,$v=Vv,Qv=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=jv[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=Fv(s[e]);Hv(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!Wv(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!Wv(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!Wv(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(Gv(e,!Xv(a)||!(i||s.forEach&&!qv((function(){(new a).entries().next()})))))c=r.getConstructor(t,e,n,o),zv.enable();else if(Gv(e,!0)){var l=new c,h=l[o](i?{}:-0,1)!=l,f=qv((function(){l.has(1)})),p=Jv((function(e){new a(e)})),_=!i&&qv((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((c=t((function(e,t){Kv(e,s);var r=$v(new a,e,c);return null!=t&&Yv(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=c),(f||_)&&(d("delete"),d("has"),n&&d("get")),(_||h)&&d(o),i&&s.clear&&delete s.clear}return u[e]=c,Bv({global:!0,forced:c!=a},u),Zv(c,e),i||r.setStrong(c,e,n),c},em=Rt.f,tm=Go,rm=Sc,nm=Yn,im=Cc,om=cu,am=df,sm=Ic,cm=a,um=lv.exports.fastKey,dm=br.set,lm=br.getterFor,hm={getConstructor:function(e,t,r,n){var i=e((function(e,i){im(e,o),dm(e,{type:t,index:tm(null),first:void 0,last:void 0,size:0}),cm||(e.size=0),null!=i&&om(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=lm(t),s=function(e,t,r){var n,i,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:i=um(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),cm?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=um(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return rm(o,{clear:function(){for(var e=a(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,cm?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),cm?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=nm(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),rm(o,r?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),cm&&em(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=lm(t),o=lm(n);am(e,t,(function(e,t){dm(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?"keys"==t?{value:r.key,done:!1}:"values"==t?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),r?"entries":"values",!r,!0),sm(t)}};Qv("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),hm);var fm=ke,pm=bo;Fn({target:"Object",stat:!0,forced:o((function(){pm(1)}))},{keys:function(e){return pm(fm(e))}});var _m=ve,vm=ke,mm=P,Em=Zr,Sm=n.TypeError,gm=function(e){return function(t,r,n,i){_m(r);var o=vm(t),a=mm(o),s=Em(o),c=e?s-1:0,u=e?-1:1;if(n<2)for(;;){if(c in a){i=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw Sm("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(i=r(i,a[c],c,o));return i}},ym={left:gm(!1),right:gm(!0)},bm=ym.left,Tm=ee,Im=Nu;Fn({target:"Array",proto:!0,forced:!Ui("reduce")||!Im&&Tm>79&&Tm<83},{reduce:function(e){var t=arguments.length;return bm(this,e,t,t>1?arguments[1]:void 0)}});var Rm,Am=F,Cm=C,Om=Ze("match"),Nm=function(e){var t;return Am(e)&&(void 0!==(t=e[Om])?!!t:"RegExp"==Cm(e))},wm=Nm,Dm=n.TypeError,km=function(e){if(wm(e))throw Dm("The method doesn't accept regular expressions");return e},Pm=Ze("match"),Mm=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Pm]=!1,"/./"[e](t)}catch(e){}}return!1},Um=Fn,Lm=T,xm=i.f,Vm=qr,Bm=va,jm=km,Fm=U,Gm=Mm,Hm=Lm("".endsWith),zm=Lm("".slice),Ym=Math.min,Km=Gm("endsWith");Um({target:"String",proto:!0,forced:!!(Km||(Rm=xm(String.prototype,"endsWith"),!Rm||Rm.writable))&&!Km},{endsWith:function(e){var t=Bm(Fm(this));jm(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:Ym(Vm(r),n),o=Bm(e);return Hm?Hm(t,o,i):zm(t,i-o.length,i)===o}});var Xm=!0,Wm=!0;function qm(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function Jm(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var o=function(e){var t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};var o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function Zm(e){return"boolean"!=typeof e?new Error("Argument type: "+uo(e)+". Please use a boolean."):(Xm=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function $m(e){return"boolean"!=typeof e?new Error("Argument type: "+uo(e)+". Please use a boolean."):(Wm=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function Qm(){if("object"===("undefined"==typeof window?"undefined":uo(window))){if(Xm)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function eE(e,t){Wm&&console.warn(e+" is deprecated, please use "+t+" instead.")}function tE(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var r=e.navigator;if(r.mozGetUserMedia)t.browser="firefox",t.version=qm(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=qm(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=qm(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function rE(e){return"[object Object]"===Object.prototype.toString.call(e)}function nE(e){return rE(e)?Object.keys(e).reduce((function(t,r){var n=rE(e[r]),i=n?nE(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,Vp({},r,i))}),{}):e}function iE(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?iE(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){iE(e,e.get(t),r)}))})))}function oE(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(r){r.type===n&&r.trackId===t.id&&iE(e,r,i)}))})),i}var aE=Fn,sE=Pi.find,cE=gh,uE=!0;"find"in[]&&Array(1).find((function(){uE=!1})),aE({target:"Array",proto:!0,forced:uE},{find:function(e){return sE(this,e,arguments.length>1?arguments[1]:void 0)}}),cE("find");var dE=Fn,lE=n,hE=Kr,fE=Gr,pE=Zr,_E=ke,vE=Ri,mE=ya,EE=Zf("splice"),SE=lE.TypeError,gE=Math.max,yE=Math.min;dE({target:"Array",proto:!0,forced:!EE},{splice:function(e,t){var r,n,i,o,a,s,c=_E(this),u=pE(c),d=hE(e,u),l=arguments.length;if(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=yE(gE(fE(t),0),u-d)),u+r-n>9007199254740991)throw SE("Maximum allowed length exceeded");for(i=vE(c,n),o=0;o<n;o++)(a=d+o)in c&&mE(i,o,c[a]);if(i.length=n,r<n){for(o=d;o<u-n;o++)s=o+r,(a=o+n)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-n+r;o--)delete c[o-1]}else if(r>n)for(o=u-n;o>d;o--)s=o+r-1,(a=o+n-1)in c?c[s]=c[a]:delete c[s];for(o=0;o<r;o++)c[o+d]=arguments[o+2];return c.length=u-n+r,i}});var bE=Pi.map;Fn({target:"Array",proto:!0,forced:!Zf("map")},{map:function(e){return bE(this,e,arguments.length>1?arguments[1]:void 0)}});var TE=Pi.filter;Fn({target:"Array",proto:!0,forced:!Zf("filter")},{filter:function(e){return TE(this,e,arguments.length>1?arguments[1]:void 0)}});var IE=T,RE=ke,AE=Math.floor,CE=IE("".charAt),OE=IE("".replace),NE=IE("".slice),wE=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,DE=/\$([$&'`]|\d{1,2})/g,kE=fa,PE=d,ME=T,UE=C_,LE=o,xE=Dt,VE=B,BE=Gr,jE=qr,FE=va,GE=U,HE=N_,zE=Ee,YE=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,c=DE;return void 0!==i&&(i=RE(i),c=wE),OE(o,c,(function(o,c){var u;switch(CE(c,0)){case"$":return"$";case"&":return e;case"`":return NE(t,0,r);case"'":return NE(t,a);case"<":u=i[NE(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=AE(d/10);return 0===l?o:l<=s?void 0===n[l-1]?CE(c,1):n[l-1]+CE(c,1):o}u=n[d-1]}return void 0===u?"":u}))},KE=L_,XE=Ze("replace"),WE=Math.max,qE=Math.min,JE=ME([].concat),ZE=ME([].push),$E=ME("".indexOf),QE=ME("".slice),eS="$0"==="a".replace(/./,"$0"),tS=!!/./[XE]&&""===/./[XE]("a","$0");UE("replace",(function(e,t,r){var n=tS?"$":"$0";return[function(e,r){var n=GE(this),i=null==e?void 0:zE(e,XE);return i?PE(i,e,n,r):PE(t,FE(n),e,r)},function(e,i){var o=xE(this),a=FE(e);if("string"==typeof i&&-1===$E(i,n)&&-1===$E(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var c=VE(i);c||(i=FE(i));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=KE(o,a);if(null===h)break;if(ZE(l,h),!u)break;""===FE(h[0])&&(o.lastIndex=HE(a,jE(o.lastIndex),d))}for(var f,p="",_=0,v=0;v<l.length;v++){for(var m=FE((h=l[v])[0]),E=WE(qE(BE(h.index),a.length),0),S=[],g=1;g<h.length;g++)ZE(S,void 0===(f=h[g])?f:String(f));var y=h.groups;if(c){var b=JE([m],S,E,a);void 0!==y&&ZE(b,y);var T=FE(kE(i,void 0,b))}else T=YE(m,a,E,S,y,i);E>=_&&(p+=QE(a,_,E)+T,_=E+m.length)}return p+QE(a,_)}]}),!!LE((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!eS||tS);var rS=a,nS=n,iS=T,oS=Pn,aS=Vv,sS=Gt,cS=Rt.f,uS=Br.f,dS=K,lS=Nm,hS=va,fS=jp,pS=Yp,_S=Ht.exports,vS=o,mS=Ue,ES=br.enforce,SS=Ic,gS=Wp,yS=Zp,bS=Ze("match"),TS=nS.RegExp,IS=TS.prototype,RS=nS.SyntaxError,AS=iS(fS),CS=iS(IS.exec),OS=iS("".charAt),NS=iS("".replace),wS=iS("".indexOf),DS=iS("".slice),kS=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,PS=/a/g,MS=/a/g,US=new TS(PS)!==PS,LS=pS.MISSED_STICKY,xS=pS.UNSUPPORTED_Y,VS=rS&&(!US||LS||gS||yS||vS((function(){return MS[bS]=!1,TS(PS)!=PS||TS(MS)==MS||"/a/i"!=TS(PS,"i")})));if(oS("RegExp",VS)){for(var BS=function(e,t){var r,n,i,o,a,s,c=dS(IS,this),u=lS(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===BS)return e;if((u||dS(IS,e))&&(e=e.source,d&&(t="flags"in h?h.flags:AS(h))),e=void 0===e?"":hS(e),t=void 0===t?"":hS(t),h=e,gS&&"dotAll"in PS&&(n=!!t&&wS(t,"s")>-1)&&(t=NS(t,/s/g,"")),r=t,LS&&"sticky"in PS&&(i=!!t&&wS(t,"y")>-1)&&xS&&(t=NS(t,/y/g,"")),yS&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,c=!1,u=0,d="";n<=r;n++){if("\\"===(t=OS(e,n)))t+=OS(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:CS(kS,DS(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||mS(a,d))throw new RS("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:i+=t}return[i,o]}(e),e=o[0],l=o[1]),a=aS(TS(e,t),c?this:IS,BS),(n||i||l.length)&&(s=ES(a),n&&(s.dotAll=!0,s.raw=BS(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=OS(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+OS(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{sS(a,"source",""===h?"(?:)":h)}catch(e){}return a},jS=function(e){e in BS||cS(BS,e,{configurable:!0,get:function(){return TS[e]},set:function(t){TS[e]=t}})},FS=uS(TS),GS=0;FS.length>GS;)jS(FS[GS++]);IS.constructor=BS,BS.prototype=IS,_S(nS,"RegExp",BS)}SS("RegExp");var HS=T,zS=Or.PROPER,YS=Ht.exports,KS=Dt,XS=K,WS=va,qS=o,JS=jp,ZS=RegExp.prototype,$S=ZS.toString,QS=HS(JS),eg=qS((function(){return"/a/b"!=$S.call({source:"a",flags:"b"})})),tg=zS&&"toString"!=$S.name;(eg||tg)&&YS(RegExp.prototype,"toString",(function(){var e=KS(this),t=WS(e.source),r=e.flags;return"/"+t+"/"+WS(void 0===r&&XS(ZS,e)&&!("flags"in ZS)?QS(e):r)}),{unsafe:!0});var rg=Pi.some;Fn({target:"Array",proto:!0,forced:!Ui("some")},{some:function(e){return rg(this,e,arguments.length>1?arguments[1]:void 0)}});var ng=rn.includes,ig=gh;Fn({target:"Array",proto:!0},{includes:function(e){return ng(this,e,arguments.length>1?arguments[1]:void 0)}}),ig("includes");var og=Fn,ag=km,sg=U,cg=va,ug=Mm,dg=T("".indexOf);og({target:"String",proto:!0,forced:!ug("includes")},{includes:function(e){return!!~dg(cg(sg(this)),cg(ag(e)),arguments.length>1?arguments[1]:void 0)}});var lg=a,hg=Or.EXISTS,fg=T,pg=Rt.f,_g=Function.prototype,vg=fg(_g.toString),mg=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Eg=fg(mg.exec);lg&&!hg&&pg(_g,"name",{configurable:!0,get:function(){try{return Eg(mg,vg(this))[1]}catch(e){return""}}});var Sg=T,gg=ve,yg=F,bg=Ue,Tg=Pa,Ig=s,Rg=n.Function,Ag=Sg([].concat),Cg=Sg([].join),Og={},Ng=function(e,t,r){if(!bg(Og,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";Og[t]=Rg("C,a","return new C("+Cg(n,",")+")")}return Og[t](e,r)},wg=Ig?Rg.bind:function(e){var t=gg(this),r=t.prototype,n=Tg(arguments,1),i=function(){var r=Ag(n,Tg(arguments));return this instanceof i?Ng(t,r.length,r):t.apply(e,r)};return yg(r)&&(i.prototype=r),i},Dg=wg;Fn({target:"Function",proto:!0,forced:Function.bind!==Dg},{bind:Dg});var kg=Qm;function Pg(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==uo(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n="object"===uo(e[r])?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",r)]=n.ideal,t.optional.push(o),(o={})[i("max",r)]=n.ideal,t.optional.push(o)):(o[i("",r)]=n.ideal,t.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===uo(e.audio)){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===uo(e.video)){var a=e.video.facingMode;a=a&&("object"===uo(a)?a:{ideal:a});var s,c=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s)return r.mediaDevices.enumerateDevices().then((function(t){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return s.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&s.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=a.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),kg("chrome: "+JSON.stringify(e)),i(e)}));e.video=n(e.video)}return kg("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return a(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(o(e))}))}))}}}}function Mg(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Ug(e){if("object"===uo(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var r=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.track.id})):{track:n.track};var o=new Event("track");o.track=n.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)})),t.stream.getTracks().forEach((function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.id})):{track:n};var o=new Event("track");o.track=n,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else Jm(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Lg(e){if("object"===uo(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((function(e){r._senders.push(t(r,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var r=t._senders.find((function(t){return t.track===e}));r&&t._senders.splice(t._senders.indexOf(r),1)}))}}else if("object"===uo(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=a.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function xg(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Array.prototype.slice.call(arguments),n=r[0],i=r[1],o=r[2];if(arguments.length>0&&"function"==typeof n)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof n))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t[r.id]=r})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){i(s(a(e)))};return t.apply(this,[c,n])}return new Promise((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function Vg(e){if("object"===uo(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return oE(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=n.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),Jm(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return oE(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?n=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(r?n=!0:r=e),e.track===o})),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Bg(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var n=this.getSenders();r.apply(this,arguments);var i=this.getSenders().filter((function(e){return-1===n.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(i)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(r){var n=t._shimmedLocalStreams[r].indexOf(e);-1!==n&&t._shimmedLocalStreams[r].splice(n,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function jg(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Bg(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(r.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}n.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){var n=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[r.id];if(a)a.addTrack(t),Promise.resolve().then((function(){n.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[r.id]=s,this._reverseStreams[s.id]=r,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=Vp({},t,(function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?r.apply(this,[function(r){var n=s(e,r);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=n[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(n){r._streams[n].getTracks().find((function(t){return e.track===t}))&&(t=r._streams[n])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function c(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function Fg(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=Vp({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}))}function Gg(e,t){Jm(e,"negotiationneeded",(function(e){var r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var Hg=Object.freeze({__proto__:null,shimMediaStream:Mg,shimOnTrack:Ug,shimGetSendersWithDtmf:Lg,shimGetStats:xg,shimSenderReceiverGetStats:Vg,shimAddTrackRemoveTrackWithNative:Bg,shimAddTrackRemoveTrack:jg,shimPeerConnection:Fg,fixNegotiationNeeded:Gg,shimGetUserMedia:Pg,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((function(t){var n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),zg=n,Yg=o,Kg=va,Xg=Q_.trim,Wg=T("".charAt),qg=zg.parseFloat,Jg=zg.Symbol,Zg=Jg&&Jg.iterator,$g=1/qg("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||Zg&&!Yg((function(){qg(Object(Zg))}))?function(e){var t=Xg(Kg(e)),r=qg(t);return 0===r&&"-"==Wg(t,0)?-0:r}:qg;Fn({global:!0,forced:parseFloat!=$g},{parseFloat:$g});var Qg=Fn,ey=mc,ty=o,ry=Y,ny=B,iy=Ru,oy=Md,ay=Ht.exports;if(Qg({target:"Promise",proto:!0,real:!0,forced:!!ey&&ty((function(){ey.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=iy(this,ry("Promise")),r=ny(e);return this.then(r?function(r){return oy(t,e()).then((function(){return r}))}:e,r?function(r){return oy(t,e()).then((function(){throw r}))}:e)}}),ny(ey)){var sy=ry("Promise").prototype.finally;ey.prototype.finally!==sy&&ay(ey.prototype,"finally",sy,{unsafe:!0})}function cy(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){eE("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===uo(e)&&"object"===uo(e.audio)&&(e=JSON.parse(JSON.stringify(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},n&&n.prototype.getSettings){var a=n.prototype.getSettings;n.prototype.getSettings=function(){var e=a.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===uo(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function uy(e){"object"===uo(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function dy(e,t){if("object"===uo(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=Vp({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}));var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),i=e[0],o=e[1],a=e[2];return n.apply(this,[i||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,n){e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function ly(e){if("object"===uo(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function hy(e){if("object"===uo(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r}),Jm(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function fy(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;eE("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function py(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function _y(e){if("object"===uo(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach((function(e){if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var n=t.apply(this,arguments);if(r){var i=n.sender,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,i.sendEncodings=e.sendEncodings,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function vy(e){if("object"===uo(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function my(e){if("object"===uo(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function Ey(e){if("object"===uo(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var Sy=Object.freeze({__proto__:null,shimOnTrack:uy,shimPeerConnection:dy,shimSenderGetStats:ly,shimReceiverGetStats:hy,shimRemoveStream:fy,shimRTCDataChannel:py,shimAddTransceiver:_y,shimGetParameters:vy,shimCreateOffer:my,shimCreateAnswer:Ey,shimGetUserMedia:cy,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,Promise.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function gy(e){if("object"===uo(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(n){return t.call(r,n,e)})),e.getVideoTracks().forEach((function(n){return t.call(r,n,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=this,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return i&&i.forEach((function(e){r._localStreams?r._localStreams.includes(e)||r._localStreams.push(e):r._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var r=this._localStreams.indexOf(e);if(-1!==r){this._localStreams.splice(r,1);var n=e.getTracks();this.getSenders().forEach((function(e){n.includes(e.track)&&t.removeTrack(e)}))}})}}function yy(e){if("object"===uo(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var r=new Event("addstream");r.stream=e,t.dispatchEvent(r)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}}))}),t.apply(e,arguments)}}}function by(e){if("object"===uo(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=s}}function Ty(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,n=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return n(Iy(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function Iy(e){return e&&void 0!==e.video?Object.assign({},e,{video:nE(e.video)}):e}function Ry(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(eE("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,n.push(o)):n.push(e.iceServers[i])}e.iceServers=n}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function Ay(e){"object"===uo(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Cy(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var n=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Oy(e){"object"!==uo(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Ny=Object.freeze({__proto__:null,shimLocalStreamsAPI:gy,shimRemoteStreamsAPI:yy,shimCallbacksAPI:by,shimGetUserMedia:Ty,shimConstraints:Iy,shimRTCIceServerUrls:Ry,shimTrackEventTransceiver:Ay,shimCreateOfferLegacy:Cy,shimAudioContext:Oy}),wy=ke,Dy=at;Fn({target:"Date",proto:!0,forced:o((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=wy(this),r=Dy(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}});var ky=d;Fn({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return ky(URL.prototype.toString,this)}});var Py=T(1..valueOf),My=a,Uy=n,Ly=T,xy=Pn,Vy=Ht.exports,By=Ue,jy=Vv,Fy=K,Gy=de,Hy=at,zy=o,Yy=Br.f,Ky=i.f,Xy=Rt.f,Wy=Py,qy=Q_.trim,Jy=Uy.Number,Zy=Jy.prototype,$y=Uy.TypeError,Qy=Ly("".slice),eb=Ly("".charCodeAt),tb=function(e){var t=Hy(e,"number");return"bigint"==typeof t?t:rb(t)},rb=function(e){var t,r,n,i,o,a,s,c,u=Hy(e,"number");if(Gy(u))throw $y("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=qy(u),43===(t=eb(u,0))||45===t){if(88===(r=eb(u,2))||120===r)return NaN}else if(48===t){switch(eb(u,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+u}for(a=(o=Qy(u,2)).length,s=0;s<a;s++)if((c=eb(o,s))<48||c>i)return NaN;return parseInt(o,n)}return+u};if(xy("Number",!Jy(" 0o1")||!Jy("0b1")||Jy("+0x1"))){for(var nb,ib=function(e){var t=arguments.length<1?0:Jy(tb(e)),r=this;return Fy(Zy,r)&&zy((function(){Wy(r)}))?jy(Object(t),r,ib):t},ob=My?Yy(Jy):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),ab=0;ob.length>ab;ab++)By(Jy,nb=ob[ab])&&!By(ib,nb)&&Xy(ib,nb,Ky(Jy,nb));ib.prototype=Zy,Zy.constructor=ib,Vy(Uy,"Number",ib)}var sb=Fn,cb=P,ub=V,db=Ui,lb=T([].join),hb=cb!=Object,fb=db("join",",");sb({target:"Array",proto:!0,forced:hb||!fb},{join:function(e){return lb(ub(this),void 0===e?",":e)}});var pb=fa,_b=d,vb=T,mb=C_,Eb=Nm,Sb=Dt,gb=U,yb=Ru,bb=N_,Tb=qr,Ib=va,Rb=Ee,Ab=Ca,Cb=L_,Ob=E_,Nb=o,wb=Yp.UNSUPPORTED_Y,Db=Math.min,kb=[].push,Pb=vb(/./.exec),Mb=vb(kb),Ub=vb("".slice);mb("split",(function(e,t,r){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,r){var n=Ib(gb(this)),i=void 0===r?4294967295:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!Eb(e))return _b(t,n,e,i);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=_b(Ob,l,n))&&!((a=l.lastIndex)>d&&(Mb(c,Ub(n,d,o.index)),o.length>1&&o.index<n.length&&pb(kb,c,Ab(o,1)),s=o[0].length,d=a,c.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&Pb(l,"")||Mb(c,""):Mb(c,Ub(n,d)),c.length>i?Ab(c,0,i):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:_b(t,this,e,r)}:t,[function(t,r){var i=gb(this),o=null==t?void 0:Rb(t,e);return o?_b(o,t,i,r):_b(n,Ib(i),t,r)},function(e,i){var o=Sb(this),a=Ib(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var c=yb(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(wb?"g":"y"),l=new c(wb?"^(?:"+o.source+")":o,d),h=void 0===i?4294967295:i>>>0;if(0===h)return[];if(0===a.length)return null===Cb(l,a)?[a]:[];for(var f=0,p=0,_=[];p<a.length;){l.lastIndex=wb?0:p;var v,m=Cb(l,wb?Ub(a,p):a);if(null===m||(v=Db(Tb(l.lastIndex+(wb?p:0)),a.length))===f)p=bb(a,p,u);else{if(Mb(_,Ub(a,f,p)),_.length===h)return _;for(var E=1;E<=m.length-1;E++)if(Mb(_,m[E]),_.length===h)return _;p=f=v}}return Mb(_,Ub(a,f)),_}]}),!!Nb((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]})),wb);var Lb=Or.PROPER,xb=o,Vb=Y_,Bb=Q_.trim;Fn({target:"String",proto:!0,forced:function(e){return xb((function(){return!!Vb[e]()||"
"!=="
"[e]()||Lb&&Vb[e].name!==e}))}("trim")},{trim:function(){return Bb(this)}});var jb={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:void 0===r[t[n]]&&(r[t[n]]=t[n+1])}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===uo(e.keyParams)?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));var i=0;return r.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((function(e){n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){var r,n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(r=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&c&&n.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,n.forEach((function(e){e.maxBitrate=d}))),n},t.parseRtcpParameters=function(e){var r={},n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){var r,n=t.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(r=parseInt(i[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:r};var a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){var i=void 0!==r?r:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){for(var n=t.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),n=0;n<r.length;n++)if(r[n].length<2||"="!==r[n].charAt(1))return!1;return!0},e.exports=t}(jb);var Fb=jb.exports,Gb=Object.freeze(e({__proto__:null,default:Fb},[jb.exports]));function Hb(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===uo(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var r=new t(e),n=Fb.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,Jm(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function zb(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var r=function(e){if(!e||!e.sdp)return!1;var t=Fb.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=Fb.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=parseInt(t[1],10);return r!=r?-1:r},i=function(e){var r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){var n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var i=Fb.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var c,u=n(arguments[0]),d=i(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function Yb(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return r(e,this),e},Jm(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}}function Kb(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}}function Xb(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var n=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return r.apply(this,arguments)}}}function Wb(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function qb(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==uo(t)||t.type&&t.sdp)return r.apply(this,arguments);if(!(t={type:t.type,sdp:t.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return r.apply(this,[t]);var n="offer"===t.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return r.apply(e,[t])}))})}}var Jb=Object.freeze({__proto__:null,shimRTCIceCandidate:Hb,shimMaxMessageSize:zb,shimSendThrowTypeError:Yb,shimConnectionState:Kb,removeExtmapAllowMixed:Xb,shimAddIceCandidateNullOrEmpty:Wb,shimParameterlessSetLocalDescription:qb});!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},n=Qm,i=tE(t),o={browserDetails:i,commonShim:Jb,extractVersion:qm,disableLog:Zm,disableWarnings:$m,sdp:Gb};switch(i.browser){case"chrome":if(!Hg||!Fg||!r.shimChrome)return n("Chrome shim is not included in this adapter release."),o;if(null===i.version)return n("Chrome shim can not determine version, not shimming."),o;n("adapter.js shimming chrome."),o.browserShim=Hg,Wb(t,i),qb(t),Pg(t,i),Mg(t),Fg(t,i),Ug(t),jg(t,i),Lg(t),xg(t),Vg(t),Gg(t,i),Hb(t),Kb(t),zb(t,i),Yb(t),Xb(t,i);break;case"firefox":if(!Sy||!dy||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=Sy,Wb(t,i),qb(t),cy(t,i),dy(t,i),uy(t),fy(t),ly(t),hy(t),py(t),_y(t),vy(t),my(t),Ey(t),Hb(t),Kb(t),zb(t,i),Yb(t);break;case"safari":if(!Ny||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=Ny,Wb(t,i),qb(t),Ry(t),Cy(t),by(t),gy(t),yy(t),Ay(t),Ty(t),Oy(t),Hb(t),zb(t,i),Yb(t),Xb(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),Fn({target:"Array",stat:!0},{isArray:Xn});var Zb=Ca,$b=Math.floor,Qb=function(e,t){var r=e.length,n=$b(r/2);return r<8?eT(e,t):tT(e,Qb(Zb(e,0,n),t),Qb(Zb(e,n),t),t)},eT=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},tT=function(e,t,r,n){for(var i=t.length,o=r.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?n(t[a],r[s])<=0?t[a++]:r[s++]:a<i?t[a++]:r[s++];return e},rT=Qb,nT=X.match(/firefox\/(\d+)/i),iT=!!nT&&+nT[1],oT=/MSIE|Trident/.test(X),aT=X.match(/AppleWebKit\/(\d+)\./),sT=!!aT&&+aT[1],cT=Fn,uT=T,dT=ve,lT=ke,hT=Zr,fT=va,pT=o,_T=rT,vT=Ui,mT=iT,ET=oT,ST=ee,gT=sT,yT=[],bT=uT(yT.sort),TT=uT(yT.push),IT=pT((function(){yT.sort(void 0)})),RT=pT((function(){yT.sort(null)})),AT=vT("sort"),CT=!pT((function(){if(ST)return ST<70;if(!(mT&&mT>3)){if(ET)return!0;if(gT)return gT<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)yT.push({k:t+n,v:r})}for(yT.sort((function(e,t){return t.v-e.v})),n=0;n<yT.length;n++)t=yT[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));cT({target:"Array",proto:!0,forced:IT||!RT||!AT||!CT},{sort:function(e){void 0!==e&&dT(e);var t=lT(this);if(CT)return void 0===e?bT(t):bT(t,e);var r,n,i=[],o=hT(t);for(n=0;n<o;n++)n in t&&TT(i,t[n]);for(_T(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:fT(t)>fT(r)?1:-1}}(e)),r=i.length,n=0;n<r;)t[n]=i[n++];for(;n<o;)delete t[n++];return t}});var OT="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,NT=Gr,wT=qr,DT=n.RangeError,kT=function(e){if(void 0===e)return 0;var t=NT(e),r=wT(t);if(t!==r)throw DT("Wrong length or index");return r},PT=n.Array,MT=Math.abs,UT=Math.pow,LT=Math.floor,xT=Math.log,VT=Math.LN2,BT={pack:function(e,t,r){var n,i,o,a=PT(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?UT(2,-24)-UT(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=MT(e))!=e||e===1/0?(i=e!=e?1:0,n=c):(n=LT(xT(e)/VT),e*(o=UT(2,-n))<1&&(n--,o*=2),(e+=n+u>=1?d/o:d*UT(2,1-u))*o>=2&&(n++,o/=2),n+u>=c?(i=0,n=c):n+u>=1?(i=(e*o-1)*UT(2,t),n+=u):(i=e*UT(2,u-1)*UT(2,t),n=0));t>=8;)a[h++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[h++]=255&n,n/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var r,n=e.length,i=8*n-t-1,o=(1<<i)-1,a=o>>1,s=i-7,c=n-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:u?-1/0:1/0;r+=UT(2,t),d-=a}return(u?-1:1)*r*UT(2,d-t)}},jT=ke,FT=Kr,GT=Zr,HT=function(e){for(var t=jT(this),r=GT(t),n=arguments.length,i=FT(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:FT(o,r);a>i;)t[i++]=e;return t},zT=n,YT=T,KT=a,XT=OT,WT=Or,qT=Gt,JT=Sc,ZT=o,$T=Cc,QT=Gr,eI=qr,tI=kT,rI=BT,nI=wh,iI=Eo,oI=Br.f,aI=Rt.f,sI=HT,cI=Ca,uI=za,dI=WT.PROPER,lI=WT.CONFIGURABLE,hI=br.get,fI=br.set,pI=zT.ArrayBuffer,_I=pI,vI=_I&&_I.prototype,mI=zT.DataView,EI=mI&&mI.prototype,SI=Object.prototype,gI=zT.Array,yI=zT.RangeError,bI=YT(sI),TI=YT([].reverse),II=rI.pack,RI=rI.unpack,AI=function(e){return[255&e]},CI=function(e){return[255&e,e>>8&255]},OI=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},NI=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},wI=function(e){return II(e,23,4)},DI=function(e){return II(e,52,8)},kI=function(e,t){aI(e.prototype,t,{get:function(){return hI(this)[t]}})},PI=function(e,t,r,n){var i=tI(r),o=hI(e);if(i+t>o.byteLength)throw yI("Wrong index");var a=hI(o.buffer).bytes,s=i+o.byteOffset,c=cI(a,s,s+t);return n?c:TI(c)},MI=function(e,t,r,n,i,o){var a=tI(r),s=hI(e);if(a+t>s.byteLength)throw yI("Wrong index");for(var c=hI(s.buffer).bytes,u=a+s.byteOffset,d=n(+i),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(XT){var UI=dI&&"ArrayBuffer"!==pI.name;if(ZT((function(){pI(1)}))&&ZT((function(){new pI(-1)}))&&!ZT((function(){return new pI,new pI(1.5),new pI(NaN),UI&&!lI})))UI&&lI&&qT(pI,"name","ArrayBuffer");else{(_I=function(e){return $T(this,vI),new pI(tI(e))}).prototype=vI;for(var LI,xI=oI(pI),VI=0;xI.length>VI;)(LI=xI[VI++])in _I||qT(_I,LI,pI[LI]);vI.constructor=_I}iI&&nI(EI)!==SI&&iI(EI,SI);var BI=new mI(new _I(2)),jI=YT(EI.setInt8);BI.setInt8(0,2147483648),BI.setInt8(1,2147483649),!BI.getInt8(0)&&BI.getInt8(1)||JT(EI,{setInt8:function(e,t){jI(this,e,t<<24>>24)},setUint8:function(e,t){jI(this,e,t<<24>>24)}},{unsafe:!0})}else vI=(_I=function(e){$T(this,vI);var t=tI(e);fI(this,{bytes:bI(gI(t),0),byteLength:t}),KT||(this.byteLength=t)}).prototype,EI=(mI=function(e,t,r){$T(this,EI),$T(e,vI);var n=hI(e).byteLength,i=QT(t);if(i<0||i>n)throw yI("Wrong offset");if(i+(r=void 0===r?n-i:eI(r))>n)throw yI("Wrong length");fI(this,{buffer:e,byteLength:r,byteOffset:i}),KT||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,KT&&(kI(_I,"byteLength"),kI(mI,"buffer"),kI(mI,"byteLength"),kI(mI,"byteOffset")),JT(EI,{getInt8:function(e){return PI(this,1,e)[0]<<24>>24},getUint8:function(e){return PI(this,1,e)[0]},getInt16:function(e){var t=PI(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=PI(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return NI(PI(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return NI(PI(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return RI(PI(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return RI(PI(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){MI(this,1,e,AI,t)},setUint8:function(e,t){MI(this,1,e,AI,t)},setInt16:function(e,t){MI(this,2,e,CI,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){MI(this,2,e,CI,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){MI(this,4,e,OI,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){MI(this,4,e,OI,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){MI(this,4,e,wI,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){MI(this,8,e,DI,t,arguments.length>2?arguments[2]:void 0)}});uI(_I,"ArrayBuffer"),uI(mI,"DataView");var FI={ArrayBuffer:_I,DataView:mI},GI=Fn,HI=T,zI=o,YI=Dt,KI=Kr,XI=qr,WI=Ru,qI=FI.ArrayBuffer,JI=FI.DataView,ZI=JI.prototype,$I=HI(qI.prototype.slice),QI=HI(ZI.getUint8),eR=HI(ZI.setUint8);GI({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:zI((function(){return!new qI(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if($I&&void 0===t)return $I(YI(this),e);for(var r=YI(this).byteLength,n=KI(e,r),i=KI(void 0===t?r:t,r),o=new(WI(this,qI))(XI(i-n)),a=new JI(this),s=new JI(o),c=0;n<i;)eR(s,c++,QI(a,n++));return o}});var tR,rR,nR,iR={exports:{}},oR=OT,aR=a,sR=n,cR=B,uR=F,dR=Ue,lR=ni,hR=he,fR=Gt,pR=Ht.exports,_R=Rt.f,vR=K,mR=wh,ER=Eo,SR=Ze,gR=je,yR=sR.Int8Array,bR=yR&&yR.prototype,TR=sR.Uint8ClampedArray,IR=TR&&TR.prototype,RR=yR&&mR(yR),AR=bR&&mR(bR),CR=Object.prototype,OR=sR.TypeError,NR=SR("toStringTag"),wR=gR("TYPED_ARRAY_TAG"),DR=gR("TYPED_ARRAY_CONSTRUCTOR"),kR=oR&&!!ER&&"Opera"!==lR(sR.opera),PR=!1,MR={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},UR={BigInt64Array:8,BigUint64Array:8},LR=function(e){if(!uR(e))return!1;var t=lR(e);return dR(MR,t)||dR(UR,t)};for(tR in MR)(nR=(rR=sR[tR])&&rR.prototype)?fR(nR,DR,rR):kR=!1;for(tR in UR)(nR=(rR=sR[tR])&&rR.prototype)&&fR(nR,DR,rR);if((!kR||!cR(RR)||RR===Function.prototype)&&(RR=function(){throw OR("Incorrect invocation")},kR))for(tR in MR)sR[tR]&&ER(sR[tR],RR);if((!kR||!AR||AR===CR)&&(AR=RR.prototype,kR))for(tR in MR)sR[tR]&&ER(sR[tR].prototype,AR);if(kR&&mR(IR)!==AR&&ER(IR,AR),aR&&!dR(AR,NR))for(tR in PR=!0,_R(AR,NR,{get:function(){return uR(this)?this[wR]:void 0}}),MR)sR[tR]&&fR(sR[tR],wR,tR);var xR={NATIVE_ARRAY_BUFFER_VIEWS:kR,TYPED_ARRAY_CONSTRUCTOR:DR,TYPED_ARRAY_TAG:PR&&wR,aTypedArray:function(e){if(LR(e))return e;throw OR("Target is not a typed array")},aTypedArrayConstructor:function(e){if(cR(e)&&(!ER||vR(RR,e)))return e;throw OR(hR(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(aR){if(r)for(var i in MR){var o=sR[i];if(o&&dR(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}AR[e]&&!r||pR(AR,e,r?t:kR&&bR[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(aR){if(ER){if(r)for(n in MR)if((i=sR[n])&&dR(i,e))try{delete i[e]}catch(e){}if(RR[e]&&!r)return;try{return pR(RR,e,r?t:kR&&RR[e]||t)}catch(e){}}for(n in MR)!(i=sR[n])||i[e]&&!r||pR(i,e,t)}},isView:function(e){if(!uR(e))return!1;var t=lR(e);return"DataView"===t||dR(MR,t)||dR(UR,t)},isTypedArray:LR,TypedArray:RR,TypedArrayPrototype:AR},VR=n,BR=o,jR=mu,FR=xR.NATIVE_ARRAY_BUFFER_VIEWS,GR=VR.ArrayBuffer,HR=VR.Int8Array,zR=!FR||!BR((function(){HR(1)}))||!BR((function(){new HR(-1)}))||!jR((function(e){new HR,new HR(null),new HR(1.5),new HR(e)}),!0)||BR((function(){return 1!==new HR(new GR(2),1,void 0).length})),YR=F,KR=Math.floor,XR=Number.isInteger||function(e){return!YR(e)&&isFinite(e)&&KR(e)===e},WR=Gr,qR=n.RangeError,JR=function(e){var t=WR(e);if(t<0)throw qR("The argument can't be less than 0");return t},ZR=n.RangeError,$R=function(e,t){var r=JR(e);if(r%t)throw ZR("Wrong offset");return r},QR=Yn,eA=d,tA=yu,rA=ke,nA=Zr,iA=zc,oA=xc,aA=kc,sA=xR.aTypedArrayConstructor,cA=Fn,uA=n,dA=d,lA=a,hA=zR,fA=xR,pA=FI,_A=Cc,vA=m,mA=Gt,EA=XR,SA=qr,gA=kT,yA=$R,bA=ut,TA=Ue,IA=ni,RA=F,AA=de,CA=Go,OA=K,NA=Eo,wA=Br.f,DA=function(e){var t,r,n,i,o,a,s=tA(this),c=rA(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=oA(c);if(h&&!aA(h))for(a=(o=iA(c,h)).next,c=[];!(i=eA(a,o)).done;)c.push(i.value);for(l&&u>2&&(d=QR(d,arguments[2])),r=nA(c),n=new(sA(s))(r),t=0;r>t;t++)n[t]=l?d(c[t],t):c[t];return n},kA=Pi.forEach,PA=Ic,MA=Rt,UA=i,LA=Vv,xA=br.get,VA=br.set,BA=MA.f,jA=UA.f,FA=Math.round,GA=uA.RangeError,HA=pA.ArrayBuffer,zA=HA.prototype,YA=pA.DataView,KA=fA.NATIVE_ARRAY_BUFFER_VIEWS,XA=fA.TYPED_ARRAY_CONSTRUCTOR,WA=fA.TYPED_ARRAY_TAG,qA=fA.TypedArray,JA=fA.TypedArrayPrototype,ZA=fA.aTypedArrayConstructor,$A=fA.isTypedArray,QA=function(e,t){ZA(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},eC=function(e,t){BA(e,t,{get:function(){return xA(this)[t]}})},tC=function(e){var t;return OA(zA,e)||"ArrayBuffer"==(t=IA(e))||"SharedArrayBuffer"==t},rC=function(e,t){return $A(e)&&!AA(t)&&t in e&&EA(+t)&&t>=0},nC=function(e,t){return t=bA(t),rC(e,t)?vA(2,e[t]):jA(e,t)},iC=function(e,t,r){return t=bA(t),!(rC(e,t)&&RA(r)&&TA(r,"value"))||TA(r,"get")||TA(r,"set")||r.configurable||TA(r,"writable")&&!r.writable||TA(r,"enumerable")&&!r.enumerable?BA(e,t,r):(e[t]=r.value,e)};lA?(KA||(UA.f=nC,MA.f=iC,eC(JA,"buffer"),eC(JA,"byteOffset"),eC(JA,"byteLength"),eC(JA,"length")),cA({target:"Object",stat:!0,forced:!KA},{getOwnPropertyDescriptor:nC,defineProperty:iC}),iR.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=uA[i],c=s,u=c&&c.prototype,d={},l=function(e,t){BA(e,t,{get:function(){return function(e,t){var r=xA(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=xA(e);r&&(i=(i=FA(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};KA?hA&&(c=t((function(e,t,r,i){return _A(e,u),LA(RA(t)?tC(t)?void 0!==i?new s(t,yA(r,n),i):void 0!==r?new s(t,yA(r,n)):new s(t):$A(t)?QA(c,t):dA(DA,c,t):new s(gA(t)),e,c)})),NA&&NA(c,qA),kA(wA(s),(function(e){e in c||mA(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,i){_A(e,u);var o,a,s,d=0,h=0;if(RA(t)){if(!tC(t))return $A(t)?QA(c,t):dA(DA,c,t);o=t,h=yA(r,n);var f=t.byteLength;if(void 0===i){if(f%n)throw GA("Wrong length");if((a=f-h)<0)throw GA("Wrong length")}else if((a=SA(i)*n)+h>f)throw GA("Wrong length");s=a/n}else s=gA(t),o=new HA(a=s*n);for(VA(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new YA(o)});d<s;)l(e,d++)})),NA&&NA(c,qA),u=c.prototype=CA(JA)),u.constructor!==c&&mA(u,"constructor",c),mA(u,XA,c),WA&&mA(u,WA,i),d[i]=c,cA({global:!0,forced:c!=s,sham:!KA},d),"BYTES_PER_ELEMENT"in c||mA(c,"BYTES_PER_ELEMENT",n),"BYTES_PER_ELEMENT"in u||mA(u,"BYTES_PER_ELEMENT",n),PA(i)}):iR.exports=function(){},(0,iR.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var oC=ke,aC=Kr,sC=Zr,cC=Math.min,uC=[].copyWithin||function(e,t){var r=oC(this),n=sC(r),i=aC(e,n),o=aC(t,n),a=arguments.length>2?arguments[2]:void 0,s=cC((void 0===a?n:aC(a,n))-o,n-i),c=1;for(o<i&&i<o+s&&(c=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:delete r[i],i+=c,o+=c;return r},dC=xR,lC=T(uC),hC=dC.aTypedArray;(0,dC.exportTypedArrayMethod)("copyWithin",(function(e,t){return lC(hC(this),e,t,arguments.length>2?arguments[2]:void 0)}));var fC=Pi.every,pC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("every",(function(e){return fC(pC(this),e,arguments.length>1?arguments[1]:void 0)}));var _C=d,vC=HT,mC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return _C(vC,mC(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var EC=Zr,SC=Ru,gC=xR.TYPED_ARRAY_CONSTRUCTOR,yC=xR.aTypedArrayConstructor,bC=function(e){return yC(SC(e,e[gC]))},TC=function(e,t){for(var r=0,n=EC(t),i=new e(n);n>r;)i[r]=t[r++];return i},IC=bC,RC=Pi.filter,AC=function(e,t){return TC(IC(e),t)},CC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("filter",(function(e){var t=RC(CC(this),e,arguments.length>1?arguments[1]:void 0);return AC(this,t)}));var OC=Pi.find,NC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("find",(function(e){return OC(NC(this),e,arguments.length>1?arguments[1]:void 0)}));var wC=Pi.findIndex,DC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("findIndex",(function(e){return wC(DC(this),e,arguments.length>1?arguments[1]:void 0)}));var kC=Pi.forEach,PC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("forEach",(function(e){kC(PC(this),e,arguments.length>1?arguments[1]:void 0)}));var MC=rn.includes,UC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("includes",(function(e){return MC(UC(this),e,arguments.length>1?arguments[1]:void 0)}));var LC=rn.indexOf,xC=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("indexOf",(function(e){return LC(xC(this),e,arguments.length>1?arguments[1]:void 0)}));var VC=n,BC=o,jC=T,FC=xR,GC=gf,HC=Ze("iterator"),zC=VC.Uint8Array,YC=jC(GC.values),KC=jC(GC.keys),XC=jC(GC.entries),WC=FC.aTypedArray,qC=FC.exportTypedArrayMethod,JC=zC&&zC.prototype,ZC=!BC((function(){JC[HC].call([1])})),$C=!!JC&&JC.values&&JC[HC]===JC.values&&"values"===JC.values.name,QC=function(){return YC(WC(this))};qC("entries",(function(){return XC(WC(this))}),ZC),qC("keys",(function(){return KC(WC(this))}),ZC),qC("values",QC,ZC||!$C,{name:"values"}),qC(HC,QC,ZC||!$C,{name:"values"});var eO=xR.aTypedArray,tO=xR.exportTypedArrayMethod,rO=T([].join);tO("join",(function(e){return rO(eO(this),e)}));var nO=fa,iO=V,oO=Gr,aO=Zr,sO=Ui,cO=Math.min,uO=[].lastIndexOf,dO=!!uO&&1/[1].lastIndexOf(1,-0)<0,lO=sO("lastIndexOf"),hO=dO||!lO?function(e){if(dO)return nO(uO,this,arguments)||0;var t=iO(this),r=aO(t),n=r-1;for(arguments.length>1&&(n=cO(n,oO(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:uO,fO=fa,pO=hO,_O=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return fO(pO,_O(this),t>1?[e,arguments[1]]:[e])}));var vO=Pi.map,mO=bC,EO=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("map",(function(e){return vO(EO(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(mO(e))(t)}))}));var SO=ym.left,gO=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return SO(gO(this),e,t,t>1?arguments[1]:void 0)}));var yO=ym.right,bO=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return yO(bO(this),e,t,t>1?arguments[1]:void 0)}));var TO=xR.aTypedArray,IO=xR.exportTypedArrayMethod,RO=Math.floor;IO("reverse",(function(){for(var e,t=this,r=TO(t).length,n=RO(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var AO=n,CO=d,OO=xR,NO=Zr,wO=$R,DO=ke,kO=o,PO=AO.RangeError,MO=AO.Int8Array,UO=MO&&MO.prototype,LO=UO&&UO.set,xO=OO.aTypedArray,VO=OO.exportTypedArrayMethod,BO=!kO((function(){var e=new Uint8ClampedArray(2);return CO(LO,e,{length:1,0:3},1),3!==e[1]})),jO=BO&&OO.NATIVE_ARRAY_BUFFER_VIEWS&&kO((function(){var e=new MO(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));VO("set",(function(e){xO(this);var t=wO(arguments.length>1?arguments[1]:void 0,1),r=DO(e);if(BO)return CO(LO,this,r,t);var n=this.length,i=NO(r),o=0;if(i+t>n)throw PO("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!BO||jO);var FO=bC,GO=Pa,HO=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("slice",(function(e,t){for(var r=GO(HO(this),e,t),n=FO(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),o((function(){new Int8Array(1).slice()})));var zO=Pi.some,YO=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("some",(function(e){return zO(YO(this),e,arguments.length>1?arguments[1]:void 0)}));var KO=n,XO=T,WO=o,qO=ve,JO=rT,ZO=xR,$O=iT,QO=oT,eN=ee,tN=sT,rN=KO.Array,nN=ZO.aTypedArray,iN=ZO.exportTypedArrayMethod,oN=KO.Uint16Array,aN=oN&&XO(oN.prototype.sort),sN=!(!aN||WO((function(){aN(new oN(2),null)}))&&WO((function(){aN(new oN(2),{})}))),cN=!!aN&&!WO((function(){if(eN)return eN<74;if($O)return $O<67;if(QO)return!0;if(tN)return tN<602;var e,t,r=new oN(516),n=rN(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(aN(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));iN("sort",(function(e){return void 0!==e&&qO(e),cN?aN(this,e):JO(nN(this),function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}}(e))}),!cN||sN);var uN=qr,dN=Kr,lN=bC,hN=xR.aTypedArray;(0,xR.exportTypedArrayMethod)("subarray",(function(e,t){var r=hN(this),n=r.length,i=dN(e,n);return new(lN(r))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,uN((void 0===t?n:dN(t,n))-i))}));var fN=fa,pN=xR,_N=o,vN=Pa,mN=n.Int8Array,EN=pN.aTypedArray,SN=pN.exportTypedArrayMethod,gN=[].toLocaleString,yN=!!mN&&_N((function(){gN.call(new mN(1))}));SN("toLocaleString",(function(){return fN(gN,yN?vN(EN(this)):EN(this),vN(arguments))}),_N((function(){return[1,2].toLocaleString()!=new mN([1,2]).toLocaleString()}))||!_N((function(){mN.prototype.toLocaleString.call([1,2])})));var bN=xR.exportTypedArrayMethod,TN=o,IN=T,RN=n.Uint8Array,AN=RN&&RN.prototype||{},CN=[].toString,ON=IN([].join);TN((function(){CN.call({})}))&&(CN=function(){return ON(this)});var NN=AN.toString!=CN;bN("toString",CN,NN);var wN=Fn,DN=n,kN=fa,PN=B,MN=Pa,UN=Cu,LN=/MSIE .\./.test(X),xN=DN.Function,VN=function(e){return function(t,r){var n=UN(arguments.length,1)>2,i=PN(t)?t:xN(t),o=n?MN(arguments,2):void 0;return e(n?function(){kN(i,this,o)}:i,r)}};wN({global:!0,bind:!0,forced:LN},{setTimeout:VN(DN.setTimeout),setInterval:VN(DN.setInterval)});var BN=Fn,jN=Pi.findIndex,FN=gh,GN=!0;"findIndex"in[]&&Array(1).findIndex((function(){GN=!1})),BN({target:"Array",proto:!0,forced:GN},{findIndex:function(e){return jN(this,e,arguments.length>1?arguments[1]:void 0)}}),FN("findIndex");var HN,zN,YN=Ic,KN=FI.ArrayBuffer;Fn({global:!0,forced:n.ArrayBuffer!==KN},{ArrayBuffer:KN}),YN("ArrayBuffer"),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVALID_TOKEN="INVALID_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_EXCEED_MAX_LENGTH="USER_MESSAGE_EXCEED_MAX_LENGTH",e.USER_MESSAGE_EMPTY_USER="USER_MESSAGE_EMPTY_USER",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN"}(HN||(HN={})),function(e){e[e.AUDIO_MIXING_ERROR_OK=0]="AUDIO_MIXING_ERROR_OK",e[e.AUDIO_MIXING_ERROR_PRELOAD_FAILED=1]="AUDIO_MIXING_ERROR_PRELOAD_FAILED",e[e.AUDIO_MIXING_ERROR_START_FAILED=2]="AUDIO_MIXING_ERROR_START_FAILED",e[e.AUDIO_MIXING_ERROR_ID_NOT_FOUND=3]="AUDIO_MIXING_ERROR_ID_NOT_FOUND",e[e.AUDIO_MIXING_ERROR_SET_POSITION_FAILED=4]="AUDIO_MIXING_ERROR_SET_POSITION_FAILED",e[e.AUDIO_MIXING_ERROR_INVALID_VOLUME=5]="AUDIO_MIXING_ERROR_INVALID_VOLUME",e[e.AUDIO_MIXING_ERROR_LOAD_CONFLICT=6]="AUDIO_MIXING_ERROR_LOAD_CONFLICT",e[e.AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH=7]="AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH",e[e.AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH=8]="AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH",e[e.AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK=9]="AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK"}(zN||(zN={}));var XN=function(e,t,r){this.code=e,this.message=t,this.error=r},WN=a,qN=T,JN=bo,ZN=V,$N=qN(l.f),QN=qN([].push),ew=function(e){return function(t){for(var r,n=ZN(t),i=JN(n),o=i.length,a=0,s=[];o>a;)r=i[a++],WN&&!$N(n,r)||QN(s,e?[r,n[r]]:n[r]);return s}},tw={entries:ew(!0),values:ew(!1)}.entries;Fn({target:"Object",stat:!0},{entries:function(e){return tw(e)}});var rw=Gr,nw=va,iw=U,ow=n.RangeError,aw=T,sw=qr,cw=va,uw=function(e){var t=nw(iw(this)),r="",n=rw(e);if(n<0||n==1/0)throw ow("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},dw=U,lw=aw(uw),hw=aw("".slice),fw=Math.ceil,pw=function(e){return function(t,r,n){var i,o,a=cw(dw(t)),s=sw(r),c=a.length,u=void 0===n?" ":cw(n);return s<=c||""==u?a:((o=lw(u,fw((i=s-c)/u.length))).length>i&&(o=hw(o,0,i)),e?a+o:o+a)}},_w={start:pw(!1),end:pw(!0)},vw=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(X),mw=_w.end;Fn({target:"String",proto:!0,forced:vw},{padEnd:function(e){return mw(this,e,arguments.length>1?arguments[1]:void 0)}});var Ew=dv;Fn({target:"Number",stat:!0,forced:Number.parseInt!=Ew},{parseInt:Ew});Fn({target:"ArrayBuffer",stat:!0,forced:!xR.NATIVE_ARRAY_BUFFER_VIEWS},{isView:xR.isView}),Fn({global:!0,forced:!OT},{DataView:FI.DataView});var Sw=Dt,gw=Wc,yw=Yn,bw=d,Tw=ke,Iw=function(e,t,r,n){try{return n?t(Sw(r)[0],r[1]):t(r)}catch(t){gw(e,"throw",t)}},Rw=kc,Aw=mi,Cw=Zr,Ow=ya,Nw=zc,ww=xc,Dw=n.Array,kw=function(e){var t=Tw(e),r=Aw(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=yw(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=ww(t),f=0;if(!h||this==Dw&&Rw(h))for(a=Cw(t),s=r?new this(a):Dw(a);a>f;f++)l=o?i(t[f],f):t[f],Ow(s,f,l);else for(d=(u=Nw(t,h)).next,s=r?new this:[];!(c=bw(d,u)).done;f++)l=o?Iw(u,i,[c.value,f],!0):c.value,Ow(s,f,l);return s.length=f,s},Pw=kw;Fn({target:"Array",stat:!0,forced:!mu((function(e){Array.from(e)}))},{from:Pw});var Mw,Uw=Fn,Lw=Xn,xw=T([].reverse),Vw=[1,2];Uw({target:"Array",proto:!0,forced:String(Vw)===String(Vw.reverse())},{reverse:function(){return Lw(this)&&(this.length=this.length),xw(this)}});var Bw=new Uint8Array(16);function jw(){if(!Mw&&!(Mw="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Mw(Bw)}var Fw=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Gw(e){return"string"==typeof e&&Fw.test(e)}for(var Hw=[],zw=0;zw<256;++zw)Hw.push((zw+256).toString(16).substr(1));function Yw(e,t,r){var n=(e=e||{}).random||(e.rng||jw)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(Hw[e[t+0]]+Hw[e[t+1]]+Hw[e[t+2]]+Hw[e[t+3]]+"-"+Hw[e[t+4]]+Hw[e[t+5]]+"-"+Hw[e[t+6]]+Hw[e[t+7]]+"-"+Hw[e[t+8]]+Hw[e[t+9]]+"-"+Hw[e[t+10]]+Hw[e[t+11]]+Hw[e[t+12]]+Hw[e[t+13]]+Hw[e[t+14]]+Hw[e[t+15]]).toLowerCase();if(!Gw(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var Kw=new TextDecoder,Xw=new TextEncoder,Ww=function(){return Yw()},qw=function(){return Date.now()};function Jw(e){for(var t,r,n,i,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=Up(o),u=c.next();!u.done;u=c.next()){s+=(p=u.value).length}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}var d=new e(s),l=0;try{for(var h=Up(o),f=h.next();!f.done;f=h.next()){var p=f.value;d.set(p,l),l+=p.length}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return d}var Zw=function(){return"undefined"==typeof window},$w=function(){function e(){}return e.token2auth=function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))},e.createUnsafeToken=function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))},e.merge=function(t,r){var n,i;void 0===t&&(t={}),void 0===r&&(r={});try{for(var o=Up(Object.entries(t)),a=o.next();!a.done;a=o.next()){var s=Lp(a.value,2),c=s[0],u=s[1];null!==u&&"object"===uo(u)?e.merge(t[c],r[c]):void 0!==r[c]&&(t[c]=r[c])}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}},e.ab2str=function(e){return Kw.decode(e)},e.ab2obj=function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(e){return{}}},e.str2ab=function(e){return Xw.encode(e).buffer},e.ab2b64str=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var r=new FileReader;r.onload=function(){return t(r.result)},r.readAsDataURL(new Blob([e]))}))];case 1:return[2,t.sent().split(",",2)[1]]}}))}))},e.b64str2ab=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function Qw(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,r){var n=r===t.length-1?"0":"1";return Number.parseInt(n+e.join(""),2)}))}function eD(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function tD(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var r=ArrayBuffer.isView(t)?t.buffer:t,n=r.byteLength,i=[];if(n>10){var o=new DataView(r),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return n-1-t})).reverse().map((function(e){return o.getUint8(e)}));i=xp(xp(xp([],Lp(a),!1),["..."],!1),Lp(s),!1)}else i=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(n,") [").concat(i.join(", "),"]")}if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var rD,nD=function(){return Pp(void 0,void 0,void 0,(function(){var e,t;return Mp(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),e.addTransceiver("audio",{direction:"recvonly"}),e.addTransceiver("video",{direction:"recvonly"}),[4,e.createOffer()];case 1:return t=r.sent(),e.close(),[2,t.sdp];case 2:return r.sent(),[3,3];case 3:return[2]}}))}))};function iD(e,t){if("boolean"!=typeof e)throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function oD(e,t,r,n){if(void 0===r&&(r=1),void 0===n&&(n=Number.POSITIVE_INFINITY),e<r||e>n||"number"!=typeof e)throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"))}function aD(e,t,r,n){if(void 0===r&&(r=1),void 0===n&&(n=Number.POSITIVE_INFINITY),null==e)throw new XN(HN.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e,t,r){void 0===t&&(t=1);void 0===r&&(r=Number.POSITIVE_INFINITY);return"string"==typeof e&&e.length<=r&&e.length>=t}(e,r,n))throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function sD(e,t,r){if(!r.includes(e))throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function cD(e,t){if(lD(e))throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function uD(e,t){if(!(e instanceof ArrayBuffer))throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function dD(e){var t,r;try{var n=navigator.mediaDevices.getSupportedConstraints();try{for(var i=Up(Object.keys(e)),o=i.next();!o.done;o=i.next()){var a=o.value;n[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}catch(e){}}function lD(e){return null==e}function hD(e){if("string"!=typeof e||!/^[a-zA-Z0-9 \_\-\@]{1,128}$/.test(e))throw new XN(HN.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_")}function fD(e){cD(e,"videoPlayerOption")}function pD(e,t){var r,n;if(void 0===t&&(t=64),!e||0===(null===(r=e)||void 0===r?void 0:r.byteLength))throw new XN(HN.INVALID_PARAMS,"The message cannot be empty");if((null==(n=e instanceof ArrayBuffer?e:$w.str2ab(JSON.stringify(e)))?void 0:n.byteLength)>1e3*t)throw new XN(HN.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function _D(e){return![rD.onRemoteStreamStats,rD.onLocalStreamStats].includes(e)}!function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onStreamAdd="onStreamAdd",e.onStreamRemove="onStreamRemove",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onUserMuteAudio="onUserMuteAudio",e.onUserMuteVideo="onUserMuteVideo",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onMediaDeviceStateChanged="onMediaDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom"}(rD||(rD={}));var vD={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,f=d.length;for(u=0;u<f;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,n);break;case 4:d[u].fn.call(d[u].context,t,n,i);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||n&&s[c].context!==n)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(vD);var mD=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},ED=d,SD=Dt,gD=U,yD=mD,bD=va,TD=Ee,ID=L_;C_("search",(function(e,t,r){return[function(t){var r=gD(this),n=null==t?void 0:TD(t,e);return n?ED(n,t,r):new RegExp(t)[e](bD(r))},function(e){var n=SD(this),i=bD(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;yD(a,0)||(n.lastIndex=0);var s=ID(n,i);return yD(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var RD=["#0050b3","#0050b3","#0050b3","#0050b3"],AD=!Zw()&&window.location.search.includes("_rtc_debug_"),CD=function(){function e(e,t,r){this._module=e,this._indent=t}return e.prototype.print=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(AD){for(var n="",i=0;i<this._indent;i++)n+=" ";console.log.apply(console,xp(["%c".concat("[VERTC]").concat(n,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(RD[this._indent],";")],Lp(t),!1))}},e}(),OD=new CD("VERTC",0),ND=function(e){function t(){return e.call(this)||this}return wp(t,e),t.prototype.safeEmit=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=this.listenerCount(t);try{return e.prototype.emit.apply(this,xp([t],Lp(r),!1))}catch(e){return OD.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(i)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return Pp(this,void 0,void 0,(function(){var r=this;return Mp(this,(function(n){return[2,new Promise((function(n,i){try{r.emit.apply(r,xp(xp([e],Lp(t),!1),[n,i],!1))}catch(t){OD.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),i(t)}}))]}))}))},t}(vD.exports.EventEmitter),wD=Ue,DD=function(e){return void 0!==e&&(wD(e,"value")||wD(e,"writable"))},kD=d,PD=F,MD=Dt,UD=DD,LD=i,xD=wh;Fn({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return MD(t)===o?t[r]:(n=LD.f(t,r))?UD(n)?n.value:void 0===n.get?void 0:kD(n.get,o):PD(i=xD(t))?e(i,r,o):void 0}});var VD=Fn,BD=d,jD=Dt,FD=F,GD=DD,HD=Rt,zD=i,YD=wh,KD=m;var XD,WD,qD,JD,ZD,$D,QD,ek,tk,rk,nk,ik,ok,ak,sk,ck,uk,dk=o((function(){var e=function(){},t=HD.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));VD({target:"Reflect",stat:!0,forced:dk},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],c=zD.f(jD(t),r);if(!c){if(FD(o=YD(t)))return e(o,r,n,s);c=KD(0)}if(GD(c)){if(!1===c.writable||!FD(s))return!1;if(i=zD.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,HD.f(s,r,i)}else HD.f(s,r,KD(0,n))}else{if(void 0===(a=c.set))return!1;BD(a,s,n)}return!0}}),function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(XD||(XD={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(WD||(WD={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(qD||(qD={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(JD||(JD={})),function(e){e[e.MUTE_STATE_OFF=0]="MUTE_STATE_OFF",e[e.MUTE_STATE_ON=1]="MUTE_STATE_ON"}(ZD||(ZD={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}($D||($D={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(QD||(QD={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(ek||(ek={})),function(e){e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO=0]="RTC_PAUSE_RESUME_CONTROL_AUDIO",e[e.RTC_PAUSE_RESUME_CONTROL_VIDEO=1]="RTC_PAUSE_RESUME_CONTROL_VIDEO",e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO=2]="RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO"}(tk||(tk={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(rk||(rk={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(nk||(nk={})),function(e){e[e.AUDIO_ONLY=0]="AUDIO_ONLY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.AUDIO_AND_VIDEO=2]="AUDIO_AND_VIDEO",e[e.NONE=3]="NONE"}(ik||(ik={})),function(e){e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER"}(ok||(ok={})),function(e){e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED"}(ak||(ak={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(sk||(sk={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(ck||(ck={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(uk||(uk={}));var lk="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function hk(e){return void 0===e&&(e=""),e.endsWith("com")||e.endsWith("net")||e.endsWith("org")?"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo"):e}var fk={VERSION:"4.38.1",ICE_CONFIG_REQUEST_URLS_INTERNAL:lk.map(hk),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:"https://web-log-report.rtcplus.com/video/v1/webrtc_log/"};function pk(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(fk.ICE_CONFIG_REQUEST_URLS=t.map(hk))):void("LOG_SERVER_URL"!==e||t!==ck.overseas?"LOG_SERVER_URL"!==e||t!==ck.domestic?fk[e]=t:fk.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/":fk.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function _k(e){return fk[e]}function vk(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||"AAC",bitRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.kBitRate)||48),sampleRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.sampleRate)||44.1),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||1,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||"LC"},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||"H264",fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||15,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||30,lowLatency:null===(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)||void 0===l||l,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||40),width:(null===(f=t.video)||void 0===f?void 0:f.width)||640,height:(null===(p=t.video)||void 0===p?void 0:p.height)||360},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||"#000000"},regions:(null===(m=null===(v=t.layout)||void 0===v?void 0:v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(E=t.layout)||void 0===E?void 0:E.appData)||""}}}}(0,iR.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,iR.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var mk={};!function(e){var t="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==uo(n))throw new TypeError(n+"must be non-object");for(var i in n)r(n,i)&&(e[i]=n[i])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},i={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)}(mk);var Ek={},Sk={},gk={},yk=mk;function bk(e){for(var t=e.length;--t>=0;)e[t]=0}var Tk=[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],Ik=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Rk=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Ak=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Ck=new Array(576);bk(Ck);var Ok=new Array(60);bk(Ok);var Nk=new Array(512);bk(Nk);var wk=new Array(256);bk(wk);var Dk=new Array(29);bk(Dk);var kk,Pk,Mk,Uk=new Array(30);function Lk(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function xk(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Vk(e){return e<256?Nk[e]:Nk[256+(e>>>7)]}function Bk(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function jk(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,Bk(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function Fk(e,t,r){jk(e,r[2*t],r[2*t+1])}function Gk(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function Hk(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=15;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=Gk(o[s]++,s))}}function zk(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Yk(e){e.bi_valid>8?Bk(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Kk(e,t,r,n){var i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function Xk(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&Kk(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Kk(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function Wk(e,t,r){var n,i,o,a,s=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===n?Fk(e,i,t):(Fk(e,(o=wk[i])+256+1,t),0!==(a=Tk[o])&&jk(e,i-=Dk[o],a),Fk(e,o=Vk(--n),r),0!==(a=Ik[o])&&jk(e,n-=Uk[o],a))}while(s<e.last_lit);Fk(e,256,t)}function qk(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<c;r++)0!==o[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)Xk(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Xk(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,Xk(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,_=0;for(o=0;o<=15;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=c[2*c[2*(n=e.heap[r])+1]+1]+1)>p&&(o=p,_++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=f&&(a=h[n-f]),s=c[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==_){do{for(o=p-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[p]--,_-=2}while(_>0);for(o=p;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),Hk(o,u,e.bl_count)}function Jk(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))}function Zk(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{Fk(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(Fk(e,i,e.bl_tree),s--),Fk(e,16,e.bl_tree),jk(e,s-3,2)):s<=10?(Fk(e,17,e.bl_tree),jk(e,s-3,3)):(Fk(e,18,e.bl_tree),jk(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}bk(Uk);var $k=!1;function Qk(e,t,r,n){jk(e,0+(n?1:0),3),function(e,t,r,n){Yk(e),n&&(Bk(e,r),Bk(e,~r)),yk.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}gk._tr_init=function(e){$k||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(Dk[n]=r,e=0;e<1<<Tk[n];e++)wk[r++]=n;for(wk[r-1]=n,i=0,n=0;n<16;n++)for(Uk[n]=i,e=0;e<1<<Ik[n];e++)Nk[i++]=n;for(i>>=7;n<30;n++)for(Uk[n]=i<<7,e=0;e<1<<Ik[n]-7;e++)Nk[256+i++]=n;for(t=0;t<=15;t++)o[t]=0;for(e=0;e<=143;)Ck[2*e+1]=8,e++,o[8]++;for(;e<=255;)Ck[2*e+1]=9,e++,o[9]++;for(;e<=279;)Ck[2*e+1]=7,e++,o[7]++;for(;e<=287;)Ck[2*e+1]=8,e++,o[8]++;for(Hk(Ck,287,o),e=0;e<30;e++)Ok[2*e+1]=5,Ok[2*e]=Gk(e,5);kk=new Lk(Ck,Tk,257,286,15),Pk=new Lk(Ok,Ik,0,30,15),Mk=new Lk(new Array(0),Rk,0,19,7)}(),$k=!0),e.l_desc=new xk(e.dyn_ltree,kk),e.d_desc=new xk(e.dyn_dtree,Pk),e.bl_desc=new xk(e.bl_tree,Mk),e.bi_buf=0,e.bi_valid=0,zk(e)},gk._tr_stored_block=Qk,gk._tr_flush_block=function(e,t,r,n){var i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),qk(e,e.l_desc),qk(e,e.d_desc),a=function(e){var t;for(Jk(e,e.dyn_ltree,e.l_desc.max_code),Jk(e,e.dyn_dtree,e.d_desc.max_code),qk(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Ak[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?Qk(e,t,r,n):4===e.strategy||o===i?(jk(e,2+(n?1:0),3),Wk(e,Ck,Ok)):(jk(e,4+(n?1:0),3),function(e,t,r,n){var i;for(jk(e,t-257,5),jk(e,r-1,5),jk(e,n-4,4),i=0;i<n;i++)jk(e,e.bl_tree[2*Ak[i]+1],3);Zk(e,e.dyn_ltree,t-1),Zk(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Wk(e,e.dyn_ltree,e.dyn_dtree)),zk(e),n&&Yk(e)},gk._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(wk[r]+256+1)]++,e.dyn_dtree[2*Vk(t)]++),e.last_lit===e.lit_bufsize-1},gk._tr_align=function(e){jk(e,2,3),Fk(e,256,Ck),function(e){16===e.bi_valid?(Bk(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)};var eP=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0};var tP=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var rP,nP=function(e,t,r,n){var i=tP,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},iP={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"},oP=mk,aP=gk,sP=eP,cP=nP,uP=iP;function dP(e,t){return e.msg=uP[t],t}function lP(e){return(e<<1)-(e>4?9:0)}function hP(e){for(var t=e.length;--t>=0;)e[t]=0}function fP(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(oP.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function pP(e,t){aP._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,fP(e.strm)}function _P(e,t){e.pending_buf[e.pending++]=t}function vP(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function mP(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+258,f=u[o+a-1],p=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===f&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<h);if(n=258-(h-o),o=h-258,n>a){if(e.match_start=t,a=n,n>=s)break;f=u[o+a-1],p=u[o+a]}}}while((t=l[t&d])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function EP(e){var t,r,n,i,o,a,s,c,u,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-262)){oP.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=i,d=void 0,(d=a.avail_in)>u&&(d=u),r=0===d?0:(a.avail_in-=d,oP.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=sP(a.adler,s,d,c):2===a.state.wrap&&(a.adler=cP(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=r,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)}function SP(e,t){for(var r,n;;){if(e.lookahead<262){if(EP(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-262&&(e.match_length=mP(e,r)),e.match_length>=3)if(n=aP._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=aP._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(pP(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(pP(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(pP(e,!1),0===e.strm.avail_out)?1:2}function gP(e,t){for(var r,n,i;;){if(e.lookahead<262){if(EP(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-262&&(e.match_length=mP(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=aP._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(pP(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=aP._tr_tally(e,0,e.window[e.strstart-1]))&&pP(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=aP._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(pP(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(pP(e,!1),0===e.strm.avail_out)?1:2}function yP(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function bP(){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 oP.Buf16(1146),this.dyn_dtree=new oP.Buf16(122),this.bl_tree=new oP.Buf16(78),hP(this.dyn_ltree),hP(this.dyn_dtree),hP(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new oP.Buf16(16),this.heap=new oP.Buf16(573),hP(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new oP.Buf16(573),hP(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 TP(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:113,e.adler=2===t.wrap?0:1,t.last_flush=0,aP._tr_init(t),0):dP(e,-2)}function IP(e){var t,r=TP(e);return 0===r&&((t=e.state).window_size=2*t.w_size,hP(t.head),t.max_lazy_match=rP[t.level].max_lazy,t.good_match=rP[t.level].good_length,t.nice_match=rP[t.level].nice_length,t.max_chain_length=rP[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),r}function RP(e,t,r,n,i,o){if(!e)return-2;var a=1;if(-1===t&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||8!==r||n<8||n>15||t<0||t>9||o<0||o>4)return dP(e,-2);8===n&&(n=9);var s=new bP;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new oP.Buf8(2*s.w_size),s.head=new oP.Buf16(s.hash_size),s.prev=new oP.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new oP.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=r,IP(e)}rP=[new yP(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(EP(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,pP(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(pP(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(pP(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(pP(e,!1),e.strm.avail_out),1)})),new yP(4,4,8,4,SP),new yP(4,5,16,8,SP),new yP(4,6,32,32,SP),new yP(4,4,16,16,gP),new yP(8,16,32,32,gP),new yP(8,16,128,128,gP),new yP(8,32,128,256,gP),new yP(32,128,258,1024,gP),new yP(32,258,258,4096,gP)],Sk.deflateInit=function(e,t){return RP(e,t,8,15,8,0)},Sk.deflateInit2=RP,Sk.deflateReset=IP,Sk.deflateResetKeep=TP,Sk.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?-2:(e.state.gzhead=t,0):-2},Sk.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?dP(e,-2):-2;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&4!==t)return dP(e,0===e.avail_out?-5:-2);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,_P(n,31),_P(n,139),_P(n,8),n.gzhead?(_P(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)),_P(n,255&n.gzhead.time),_P(n,n.gzhead.time>>8&255),_P(n,n.gzhead.time>>16&255),_P(n,n.gzhead.time>>24&255),_P(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),_P(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(_P(n,255&n.gzhead.extra.length),_P(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=cP(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(_P(n,0),_P(n,0),_P(n,0),_P(n,0),_P(n,0),_P(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),_P(n,3),n.status=113);else{var a=8+(n.w_bits-8<<4)<<8;a|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=113,vP(n,a),0!==n.strstart&&(vP(n,e.adler>>>16),vP(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=cP(e.adler,n.pending_buf,n.pending-i,i)),fP(e),i=n.pending,n.pending!==n.pending_buf_size));)_P(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=cP(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=cP(e.adler,n.pending_buf,n.pending-i,i)),fP(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,_P(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=cP(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=cP(e.adler,n.pending_buf,n.pending-i,i)),fP(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,_P(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=cP(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&fP(e),n.pending+2<=n.pending_buf_size&&(_P(n,255&e.adler),_P(n,e.adler>>8&255),e.adler=0,n.status=113)):n.status=113),0!==n.pending){if(fP(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&lP(t)<=lP(r)&&4!==t)return dP(e,-5);if(666===n.status&&0!==e.avail_in)return dP(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(EP(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=aP._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(pP(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(pP(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(pP(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=258){if(EP(e),e.lookahead<=258&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+258;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=258-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=aP._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=aP._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(pP(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(pP(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(pP(e,!1),0===e.strm.avail_out)?1:2}(n,t):rP[n.level].func(n,t);if(3!==s&&4!==s||(n.status=666),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?aP._tr_align(n):5!==t&&(aP._tr_stored_block(n,0,0,!1),3===t&&(hP(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),fP(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(_P(n,255&e.adler),_P(n,e.adler>>8&255),_P(n,e.adler>>16&255),_P(n,e.adler>>24&255),_P(n,255&e.total_in),_P(n,e.total_in>>8&255),_P(n,e.total_in>>16&255),_P(n,e.total_in>>24&255)):(vP(n,e.adler>>>16),vP(n,65535&e.adler)),fP(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},Sk.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&113!==t&&666!==t?dP(e,-2):(e.state=null,113===t?dP(e,-3):0):-2},Sk.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return-2;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return-2;for(1===o&&(e.adler=sP(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(hP(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new oP.Buf8(r.w_size),oP.arraySet(u,t,d-r.w_size,r.w_size,0),t=u,d=r.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,EP(r);r.lookahead>=3;){n=r.strstart,i=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--i);r.strstart=n,r.lookahead=2,EP(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,r.wrap=o,0},Sk.deflateInfo="pako deflate (from Nodeca project)";var AP={},CP=mk,OP=!0,NP=!0;try{String.fromCharCode.apply(null,[0])}catch(e){OP=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){NP=!1}for(var wP=new CP.Buf8(256),DP=0;DP<256;DP++)wP[DP]=DP>=252?6:DP>=248?5:DP>=240?4:DP>=224?3:DP>=192?2:1;function kP(e,t){if(t<65534&&(e.subarray&&NP||!e.subarray&&OP))return String.fromCharCode.apply(null,CP.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}wP[254]=wP[254]=1,AP.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new CP.Buf8(s),o=0,i=0;o<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},AP.buf2binstring=function(e){return kP(e,e.length)},AP.binstring2buf=function(e){for(var t=new CP.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},AP.buf2string=function(e,t){var r,n,i,o,a=t||e.length,s=new Array(2*a);for(n=0,r=0;r<a;)if((i=e[r++])<128)s[n++]=i;else if((o=wP[i])>4)s[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<a;)i=i<<6|63&e[r++],o--;o>1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return kP(s,n)},AP.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+wP[e[r]]>t?r:t};var PP=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},MP=Sk,UP=mk,LP=AP,xP=iP,VP=PP,BP=Object.prototype.toString;function jP(e){if(!(this instanceof jP))return new jP(e);this.options=UP.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new VP,this.strm.avail_out=0;var r=MP.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(xP[r]);if(t.header&&MP.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?LP.string2buf(t.dictionary):"[object ArrayBuffer]"===BP.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=MP.deflateSetDictionary(this.strm,n)))throw new Error(xP[r]);this._dict_set=!0}}function FP(e,t){var r=new jP(t);if(r.push(e,!0),r.err)throw r.msg||xP[r.err];return r.result}jP.prototype.push=function(e,t){var r,n,i=this.strm,o=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=LP.string2buf(e):"[object ArrayBuffer]"===BP.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new UP.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=MP.deflate(i,n))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(LP.buf2binstring(UP.shrinkBuf(i.output,i.next_out))):this.onData(UP.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=MP.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},jP.prototype.onData=function(e){this.chunks.push(e)},jP.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=UP.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},Ek.Deflate=jP,Ek.deflate=FP,Ek.deflateRaw=function(e,t){return(t=t||{}).raw=!0,FP(e,t)},Ek.gzip=function(e,t){return(t=t||{}).gzip=!0,FP(e,t)};var GP={},HP=a,zP=Rt,YP=jp,KP=o,XP=RegExp.prototype;HP&&KP((function(){return"sy"!==Object.getOwnPropertyDescriptor(XP,"flags").get.call({dotAll:!0,sticky:!0})}))&&zP.f(XP,"flags",{configurable:!0,get:YP});var WP={},qP=mk,JP=[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],ZP=[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],$P=[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],QP=[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],eM=mk,tM=eP,rM=nP,nM=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E,S,g,y,b,T,I,R,A;r=e.state,n=e.next_in,R=e.input,i=n+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,d=r.whave,l=r.wnext,h=r.window,f=r.hold,p=r.bits,_=r.lencode,v=r.distcode,m=(1<<r.lenbits)-1,E=(1<<r.distbits)-1;e:do{p<15&&(f+=R[n++]<<p,p+=8,f+=R[n++]<<p,p+=8),S=_[f&m];t:for(;;){if(f>>>=g=S>>>24,p-=g,0===(g=S>>>16&255))A[o++]=65535&S;else{if(!(16&g)){if(0==(64&g)){S=_[(65535&S)+(f&(1<<g)-1)];continue t}if(32&g){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}y=65535&S,(g&=15)&&(p<g&&(f+=R[n++]<<p,p+=8),y+=f&(1<<g)-1,f>>>=g,p-=g),p<15&&(f+=R[n++]<<p,p+=8,f+=R[n++]<<p,p+=8),S=v[f&E];r:for(;;){if(f>>>=g=S>>>24,p-=g,!(16&(g=S>>>16&255))){if(0==(64&g)){S=v[(65535&S)+(f&(1<<g)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&S,p<(g&=15)&&(f+=R[n++]<<p,(p+=8)<g&&(f+=R[n++]<<p,p+=8)),(b+=f&(1<<g)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=g,p-=g,b>(g=o-a)){if((g=b-g)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(T=0,I=h,0===l){if(T+=u-g,g<y){y-=g;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}}else if(l<g){if(T+=u+l-g,(g-=l)<y){y-=g;do{A[o++]=h[T++]}while(--g);if(T=0,l<y){y-=g=l;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}}}else if(T+=l-g,g<y){y-=g;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}for(;y>2;)A[o++]=I[T++],A[o++]=I[T++],A[o++]=I[T++],y-=3;y&&(A[o++]=I[T++],y>1&&(A[o++]=I[T++]))}else{T=o-b;do{A[o++]=A[T++],A[o++]=A[T++],A[o++]=A[T++],y-=3}while(y>2);y&&(A[o++]=A[T++],y>1&&(A[o++]=A[T++]))}break}}break}}while(n<i&&o<s);n-=y=p>>3,f&=(1<<(p-=y<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=f,r.bits=p},iM=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,f,p,_,v,m=s.bits,E=0,S=0,g=0,y=0,b=0,T=0,I=0,R=0,A=0,C=0,O=null,N=0,w=new qP.Buf16(16),D=new qP.Buf16(16),k=null,P=0;for(E=0;E<=15;E++)w[E]=0;for(S=0;S<n;S++)w[t[r+S]]++;for(b=m,y=15;y>=1&&0===w[y];y--);if(b>y&&(b=y),0===y)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(g=1;g<y&&0===w[g];g++);for(b<g&&(b=g),R=1,E=1;E<=15;E++)if(R<<=1,(R-=w[E])<0)return-1;if(R>0&&(0===e||1!==y))return-1;for(D[1]=0,E=1;E<15;E++)D[E+1]=D[E]+w[E];for(S=0;S<n;S++)0!==t[r+S]&&(a[D[t[r+S]]++]=S);if(0===e?(O=k=a,f=19):1===e?(O=JP,N-=257,k=ZP,P-=257,f=256):(O=$P,k=QP,f=-1),C=0,S=0,E=g,h=o,T=b,I=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){p=E-I,a[S]<f?(_=0,v=a[S]):a[S]>f?(_=k[P+a[S]],v=O[N+a[S]]):(_=96,v=0),c=1<<E-I,g=u=1<<T;do{i[h+(C>>I)+(u-=c)]=p<<24|_<<16|v|0}while(0!==u);for(c=1<<E-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,S++,0==--w[E]){if(E===y)break;E=t[r+a[S]]}if(E>b&&(C&l)!==d){for(0===I&&(I=b),h+=g,R=1<<(T=E-I);T+I<y&&!((R-=w[T+I])<=0);)T++,R<<=1;if(A+=1<<T,1===e&&A>852||2===e&&A>592)return 1;i[d=C&l]=b<<24|T<<16|h-o|0}}return 0!==C&&(i[h+C]=E-I<<24|64<<16|0),s.bits=b,0};function oM(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function aM(){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 eM.Buf16(320),this.work=new eM.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function sM(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 eM.Buf32(852),t.distcode=t.distdyn=new eM.Buf32(592),t.sane=1,t.back=-1,0):-2}function cM(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,sM(e)):-2}function uM(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,cM(e))):-2}function dM(e,t){var r,n;return e?(n=new aM,e.state=n,n.window=null,0!==(r=uM(e,t))&&(e.state=null),r):-2}var lM,hM,fM=!0;function pM(e){if(fM){var t;for(lM=new eM.Buf32(512),hM=new eM.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(iM(1,e.lens,0,288,lM,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;iM(2,e.lens,0,32,hM,0,e.work,{bits:5}),fM=!1}e.lencode=lM,e.lenbits=9,e.distcode=hM,e.distbits=5}function _M(e,t,r,n){var i,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new eM.Buf8(o.wsize)),n>=o.wsize?(eM.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),eM.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(eM.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}WP.inflateReset=cM,WP.inflateReset2=uM,WP.inflateResetKeep=sM,WP.inflateInit=function(e){return dM(e,15)},WP.inflateInit2=dM,WP.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E,S,g,y,b,T,I,R,A=0,C=new eM.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(r=e.state).mode&&(r.mode=13),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,T=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,C[0]=255&u,C[1]=u>>>8&255,r.check=rM(r.check,C,2,0),u=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(d-=4,b=8+(15&(u>>>=4)),0===r.wbits)r.wbits=b;else if(b>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:12,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.flags=u,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=rM(r.check,C,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.time=u),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,r.check=rM(r.check,C,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=rM(r.check,C,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=rM(r.check,C,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((f=r.length)>s&&(f=s),f&&(r.head&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),eM.arraySet(r.head.extra,n,o,f,b)),512&r.flags&&(r.check=rM(r.check,n,f,o)),s-=f,o+=f,r.length-=f),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&f<s);if(512&r.flags&&(r.check=rM(r.check,n,f,o)),s-=f,o+=f,b)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&f<s);if(512&r.flags&&(r.check=rM(r.check,n,f,o)),s-=f,o+=f,b)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}u=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=oM(u),u=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(pM(r),r.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(f=r.length){if(f>s&&(f=s),f>c&&(f=c),0===f)break e;eM.arraySet(i,n,o,f,a),s-=f,o+=f,c-=f,a+=f,r.length-=f;break}r.mode=12;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.nlen=257+(31&u),u>>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.lens[O[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,I={bits:r.lenbits},T=iM(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,E=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(E<16)u>>>=v,d-=v,r.lens[r.have++]=E;else{if(16===E){for(R=v+2;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}b=r.lens[r.have-1],f=3+(3&u),u>>>=2,d-=2}else if(17===E){for(R=v+3;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=v,b=0,f=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(R=v+7;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=v,b=0,f=11+(127&(u>>>=v)),u>>>=7,d-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;f--;)r.lens[r.have++]=b}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,I={bits:r.lenbits},T=iM(1,r.lens,0,r.nlen,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},T=iM(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,I),r.distbits=I.bits,T){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,nM(e,h),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,E=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(S=v,g=m,y=E;m=(A=r.lencode[y+((u&(1<<S+g)-1)>>S)])>>>16&255,E=65535&A,!(S+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=S,d-=S,r.back+=S}if(u>>>=v,d-=v,r.back+=v,r.length=E,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=12;break}if(64&m){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(R=r.extra;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<<r.distbits)-1])>>>16&255,E=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(S=v,g=m,y=E;m=(A=r.distcode[y+((u&(1<<S+g)-1)>>S)])>>>16&255,E=65535&A,!(S+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=S,d-=S,r.back+=S}if(u>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=30;break}r.offset=E,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(R=r.extra;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===c)break e;if(f=h-c,r.offset>f){if((f=r.offset-f)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),_=r.window}else _=i,p=a-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do{i[a++]=_[p++]}while(--f);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=n[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?rM(r.check,i,h,a-h):tM(r.check,i,h,a-h)),h=c,(r.flags?u:oM(u))!==r.check){e.msg="incorrect data check",r.mode=30;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}u=0,d=0}r.mode=29;case 29:T=1;break e;case 30:T=-3;break e;case 31:return-4;default:return-2}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&_M(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,r.total+=h,r.wrap&&h&&(e.adler=r.check=r.flags?rM(r.check,i,h,e.next_out-h):tM(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===T&&(T=-5),T},WP.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},WP.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?-2:(r.head=t,t.done=!1,0):-2},WP.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?-2:11===r.mode&&tM(1,t,n,0)!==r.check?-3:_M(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):-2},WP.inflateInfo="pako inflate (from Nodeca project)";var vM={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var mM=WP,EM=mk,SM=AP,gM=vM,yM=iP,bM=PP,TM=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},IM=Object.prototype.toString;function RM(e){if(!(this instanceof RM))return new RM(e);this.options=EM.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new bM,this.strm.avail_out=0;var r=mM.inflateInit2(this.strm,t.windowBits);if(r!==gM.Z_OK)throw new Error(yM[r]);if(this.header=new TM,mM.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=SM.string2buf(t.dictionary):"[object ArrayBuffer]"===IM.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=mM.inflateSetDictionary(this.strm,t.dictionary))!==gM.Z_OK))throw new Error(yM[r])}function AM(e,t){var r=new RM(t);if(r.push(e,!0),r.err)throw r.msg||yM[r.err];return r.result}RM.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?gM.Z_FINISH:gM.Z_NO_FLUSH,"string"==typeof e?s.input=SM.binstring2buf(e):"[object ArrayBuffer]"===IM.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 EM.Buf8(c),s.next_out=0,s.avail_out=c),(r=mM.inflate(s,gM.Z_NO_FLUSH))===gM.Z_NEED_DICT&&u&&(r=mM.inflateSetDictionary(this.strm,u)),r===gM.Z_BUF_ERROR&&!0===d&&(r=gM.Z_OK,d=!1),r!==gM.Z_STREAM_END&&r!==gM.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==gM.Z_STREAM_END&&(0!==s.avail_in||n!==gM.Z_FINISH&&n!==gM.Z_SYNC_FLUSH)||("string"===this.options.to?(i=SM.utf8border(s.output,s.next_out),o=s.next_out-i,a=SM.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&EM.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(EM.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(d=!0)}while((s.avail_in>0||0===s.avail_out)&&r!==gM.Z_STREAM_END);return r===gM.Z_STREAM_END&&(n=gM.Z_FINISH),n===gM.Z_FINISH?(r=mM.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===gM.Z_OK):n!==gM.Z_SYNC_FLUSH||(this.onEnd(gM.Z_OK),s.avail_out=0,!0)},RM.prototype.onData=function(e){this.chunks.push(e)},RM.prototype.onEnd=function(e){e===gM.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=EM.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},GP.Inflate=RM,GP.inflate=AM,GP.inflateRaw=function(e,t){return(t=t||{}).raw=!0,AM(e,t)},GP.ungzip=AM;var CM={};(0,mk.assign)(CM,Ek,GP,vM);var OM,NM,wM,DM,kM,PM,MM,UM,LM,xM,VM,BM,jM,FM,GM,HM,zM,YM,KM,XM,WM,qM,JM,ZM,$M,QM,eU,tU,rU,nU,iU,oU,aU,sU,cU,uU,dU,lU,hU,fU,pU,_U,vU,mU,EU,SU,gU=CM;!function(e){e.RTC_SDK_API_CALL="rtc_sdk_api_call",e.RTC_SDK_CALLBACK="rtc_sdk_callback",e.RTC_RECONNECT="rtc_reconnect",e.RTC_RECONNECTED="rtc_reconnected",e.RTC_GET_ACCESS="rtc_get_access",e.RTC_PRE_ICE_STATE="rtc_pre_ice_state",e.RTC_NODE_CHANGE="rtc_node_change",e.RTC_SIGNALING_MSG_ERROR="rtc_signaling_msg_error",e.RTC_SIGNALING="rtc_signaling",e.RTC_JOIN_ROOM="rtc_join_room",e.RTC_LEAVE_ROOM="rtc_leave_room",e.RTC_BEGIN_CREATE_OFFER="rtc_begin_create_offer",e.RTC_CREATE_OFFER="rtc_create_offer",e.RTC_SET_DESCRIPTION="rtc_set_description",e.RTC_RECV_ANSWER="rtc_recv_answer",e.FIRST_REMOTE_AUDIO_RENDER="first_remote_audio_render",e.FIRST_REMOTE_VIDEO_RENDER="first_remote_video_render",e.RTC_PUBLISH_STAT="rtc_publish_stat",e.RTC_SUBSCRIBE_STAT="rtc_subscribe_stat",e.RTC_AUDIO_DEVICE="rtc_audio_device",e.RTC_MEDIA_STATISTICS="rtc_media_statistics",e.RTC_MESSAGE_STATISTICS="rtc_message_statistics",e.RTC_ERROR="rtc_error",e.RTC_INVOKE_STATUS="rtc_invoke_status",e.RTC_FIRST_FRAME="rtc_first_frame",e.RTC_MUTE_REMOTE="rtc_mute_remote",e.SDK_INIT_ENGINE="sdk_init_engine",e.JOIN_ROOM="join_room",e.P2P_CONNECTION_STATUS="p2p_connection_status",e.P2P_CONNECT_CLOSED="p2p_connect_closed",e.RTC_DEVICE_ERROR="rtc_device_error",e.RTC_VIDEO_DEVICE="rtc_video_device",e.RTC_VIDEO_CAPTURE_EVENT="rtc_video_capture_event",e.RTC_ENCODE_FIRST_FRAME="rtc_encode_first_frame",e.RTC_FIRST_FRAME_ENCODED="rtc_first_frame_encoded",e.RTC_SEND_FIRST_PACKET="rtc_send_first_packet",e.RTC_RECV_FIRST_PACKET="rtc_recv_first_packet",e.RTC_RECV_FIRST_FRAME="rtc_recv_first_frame",e.RTC_DECODE_FIRST_FRAME="rtc_decode_first_frame"}(OM||(OM={})),function(e){e.RTC="rtc"}(NM||(NM={})),function(e){e.W_5="5"}(wM||(wM={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(DM||(DM={})),function(e){e.UNKNOWN="unknown",e.DISCONNECTED="disconnected",e.LAN="lan",e.WIFI="wifi",e.W_2="2g",e.W_3="3g",e.W_4="4g",e.W_5="5g"}(kM||(kM={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(PM||(PM={})),function(e){e.WEBSOCKET_RECONNECTING="websocket reconnecting",e.PEERCONNECTION_RECONNECTING="peerconnection reconnecting",e.DISCONNECTED="DISCONNECTED",e.LAN="LAN",e.WIFI="WIFI",e.W_2="2G",e.W_3="3G",e.W_4="4G",e.W_5="5G",e.UNKNOWN="UNKNOWN"}(MM||(MM={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(UM||(UM={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(LM||(LM={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(xM||(xM={})),function(e){e.REQUEST="request",e.RESPONSE="response",e.KCP_REQUEST="kcp request",e.KCP_RESPONSE="kcp response",e.QUIC_REQUEST="quic request",e.QUIC_RESPONSE="quic response"}(VM||(VM={})),function(e){e.NEW="NEW",e.CHECKING="CHECKING",e.CONNECTED="CONNECTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.DISCONNECTED="DISCONNECTED",e.CLOSED="CLOSED",e.DATACHANNEL_CONNECTING="DATACHANNEL_CONNECTING",e.DATACHANNEL_OPEN="DATACHANNEL_OPEN",e.DATACHANNEL_CLOSING="DATACHANNEL_CLOSING",e.DATACHANNEL_CLOSED="DATACHANNEL_CLOSED"}(BM||(BM={})),function(e){e.SUCCEED="succeed",e.MESSAGE_ID_ERROR="message id error",e.ZIP_FAILED="zip failed",e.UNZIP_FAILED="unzip failed",e.MESSAGE_KEY_EMPTY="message key empty",e.MESSAGE_KEY_PARSE_FAILED="message key parse failed",e.MESSAGE_KEY_INVALID="message key invalid",e.ENCRYPT_FAILED="encrypt failed",e.DECRYPT_FAILED="decrypt failed",e.MESSAGE_TOO_BIG="message too big",e.INVALID_DATA="invalid data",e.MESSAGE_PARSE_FAILED="message parse failed"}(jM||(jM={})),function(e){e.CALL_JOINROOM="call-joinRoom",e.JOINROOM="joinRoom",e.CALL_RECONNECTED="call-reconnected",e.RECONNECTED="reconnected",e.CALL_PUBLISH="call-publish",e.PUBLISH="publish",e.CALL_UPDATESTREAMATTRIBUTES="call-updateStreamAttributes",e.UPDATESTREAMATTRIBUTES="updateStreamAttributes",e.CALL_UNPUBLISH="call-unpublish",e.UNPUBLISH="unpublish",e.CALL_SUBSCRIBE="call-subscribe",e.SUBSCRIBE="subscribe",e.CALL_UPDATESUBSCRIBE="call-updateSubscribe",e.UPDATESUBSCRIBE="updateSubscribe",e.CALL_UNSUBSCRIBE="call-unsubscribe",e.UNSUBSCRIBE="unsubscribe",e.CALL_UPDATEUSERATTRIBUTES="call-updateUserAttributes",e.UPDATEUSERATTRIBUTES="updateUserAttributes",e.CALL_LEAVEROOM="call-leaveRoom",e.LEAVEROOM="leaveRoom",e.ON_USERCONNECTION="on-userConnection",e.ON_USERDISCONNECTION="on-userDisconnection",e.ON_ONADDSTREAM="on-onAddStream",e.ON_ONPUSHSTREAM="on-onPushStream",e.ON_ONREMOVESTREAM="on-onRemoveStream",e.ON_ONPUSHTRACK="on-onPushTrack",e.ON_ONREMOVETRACK="on-onRemoveTrack",e.ON_ONUPDATEUSERATTRIBUTES="on-onUpdateUserAttributes",e.ON_ONUPDATEROOMATTRIBUTES="on-onUpdateRoomAttributes",e.ON_ONUPDATESTREAMATTRIBUTES="on-onUpdateStreamAttributes",e.ON_STREAMFAILED="on-streamFailed",e.ON_POSTPROCESSINGMESSAGE="on-postProcessingMessage",e.ON_ENGINECONTROLMESSAGE="on-engineControlMessage",e.ON_WEBSOCKETENGINECUSTOMMESSAGE="on-websocketEngineCustomMessage",e.UNKNOWN="unknown",e.CALL_UPDATEPUBLISHSTREAMCHANNEL="call-updatePublishStreamChannel",e.UPDATEPUBLISHSTREAMCHANNEL="updatePublishStreamChannel",e.CALL_UPDATESUBSCRIBESTREAMCHANNEL="call-updateSubscribeStreamChannel",e.UPDATESUBSCRIBESTREAMCHANNEL="updateSubscribeStreamChannel",e.ON_ONSTREAMCHANNELCHANGE="on-onStreamChannelChange",e.P2PDIRECT="p2pdirect",e.INTERNAL_CUSTOM="internal_custom",e.REPORT="report",e.CONNECTION_CONTROL="connection_control",e.ON_INTERNAL_CUSTOM="on_internal_custom",e.CONTROLMESSAGE="controlMessage",e.CALL_LOGIN="call-login",e.LOGIN="login",e.CALL_RECONNECTLOGIN="call-reconnectLogin",e.RECONNECTLOGIN="reconnectLogin",e.CALL_LOGOUT="call-logout",e.LOGOUT="logout",e.CALL_UPDATELOGINTOKEN="call-updateLoginToken",e.UPDATELOGINTOKEN="updateLoginToken",e.CALL_SETSERVERPARAMS="call-setServerParams",e.SETSERVERPARAMS="setServerParams",e.CALL_GETPEERONLINESTATUS="call-getPeerOnlineStatus",e.GETPEERONLINESTATUS="getPeerOnlineStatus",e.ON_ONSCENECONFIG="on-onSceneConfig",e.ON_STREAMCONTROLMESSAGE="on-streamControlMessage",e.CALL_STARTPUSHSTREAM="call-startPushStream",e.STARTPUSHSTREAM="startPushStream",e.CALL_STOPPUSHSTREAM="call-stopPushStream",e.STOPPUSHSTREAM="stopPushStream",e.CALL_STARTPULLSTREAM="call-startPullStream",e.STARTPULLSTREAM="startPullStream",e.CALL_STOPPULLSTREAM="call-stopPullStream",e.STOPPULLSTREAM="stopPullStream",e.CALL_UPDATEPULLSTREAM="call-updatePullStream",e.UPDATEPULLSTREAM="updatePullStream",e.ON_ONSTREAMPUSHEDBYOTHER="on-onStreamPushedByOther",e.CALL_UPDATETOKEN="call-updateToken",e.UPDATETOKEN="updateToken",e.ON_ONTOKENWILLEXPIRE="on-onTokenWillExpire"}(FM||(FM={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(GM||(GM={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(HM||(HM={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(zM||(zM={})),function(e){e.W_0="0",e.W_1="1"}(YM||(YM={})),function(e){e.UP="up",e.DOWN="down"}(KM||(KM={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(XM||(XM={})),function(e){e.UP="up",e.DOWN="down"}(WM||(WM={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(qM||(qM={})),function(e){e.W_0="0",e.W_1="1"}(JM||(JM={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown"}(ZM||(ZM={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}($M||($M={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.ON_STREAM_REMOVE="on stream remove",e.PUBLISH_MUTE="publish mute",e.UNKNOWN="unknown",e.ON_STREAM_REMOVE_CLIENT_UNPUBLISHED="on stream remove:client unpublished",e.ON_STREAM_REMOVE_PUBLISH_FAILED="on stream remove:publish failed",e.ON_STREAM_REMOVE_STREAM_REMOVED="on stream remove:stream removed",e.ON_STREAM_REMOVE_CLIENT_DISCONNECTED="on stream remove:client disconnected",e.ON_STREAM_REMOVE_CLIENT_REPUBLISH="on stream remove:client republish"}(QM||(QM={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(eU||(eU={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(tU||(tU={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(rU||(rU={})),function(e){e.LOGIN="login",e.PUBLISHER="publisher",e.UNMUTE="unmute",e.ENABLE="enable",e.PUSH="push",e.PUBLISH="publish",e.ONDEMAND="ondemand",e.SUBSCRIBE="subscribe",e.PUSH_TRACK="push_track",e.REMOTE_UNMUTE="remote_unmute",e.P2P="p2p"}(nU||(nU={})),function(e){e.TIMEOUT="timeout",e.AUDIENCE="audience",e.MUTE="mute",e.DISABLE="disable",e.STOP_PUSH="stop_push",e.UNPUBLISH="unpublish",e.NO_DEMAND="no_demand",e.LEAVE_ROOM="leave_room",e.UNSUBSCRIBE="unsubscribe",e.REMOVE_TRACK="remove_track",e.REMOTE_MUTE="remote_mute",e.USER_LEAVE="user_leave"}(iU||(iU={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(oU||(oU={})),function(e){e.BEGIN="begin",e.END="end"}(aU||(aU={})),function(e){e.BEGIN="begin",e.END="end"}(sU||(sU={})),function(e){e.LEAVE_ROOM="leave_room",e.ACK_FAILED="ack_failed",e.TOKEN_ERROR="token_error",e.SIGNALING_ERROR="signaling_error",e.TIMEOUT_10="timeout_10",e.TIMEOUT_60="timeout_60"}(cU||(cU={})),function(e){e.UNKNOWN="unknown",e.NEW="new",e.CHECKING="checking",e.CONNECTED="connected",e.FAILED="failed",e.SELECTED="selected",e.CLOSING="closing",e.CLOSED="closed"}(uU||(uU={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(dU||(dU={})),function(e){e.UNKNOWN="UNKNOWN",e.AUDIO_RECORD="AUDIO_RECORD",e.AUDIO_PLAYOUT="AUDIO_PLAYOUT",e.VIDEO="VIDEO",e.SHARE_AUDIO_RECORD="SHARE_AUDIO_RECORD",e.SHARE_VIDEO="SHARE_VIDEO"}(lU||(lU={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(hU||(hU={})),function(e){e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped"}(fU||(fU={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2"}(pU||(pU={})),function(e){e.SUCCESS="success",e.CAMERA_DEVICE_NO_PERMISSION="camera_device_no_permission",e.CAMERA_DEVICE_BUSY="camera_device_busy",e.CAMERA_DEVICE_FAILURE="camera_device_failure",e.CAMERA_DEVICE_NOT_FOUND="camera_device_not_found",e.CAMERA_DEVICE_DISCONNECTED="camera_device_disconnected",e.TIMEOUT="timeout",e.ABORT="abort"}(_U||(_U={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(vU||(vU={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(mU||(mU={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(EU||(EU={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(SU||(SU={}));var yU,bU,TU,IU,RU,AU,CU,OU=function(){function e(e){this.monitor=e}return e.prototype.setStats=function(e){var t=this;Object.keys(e).forEach((function(r){t["_"+r]=e[r]})),this.monitor.StartUp()},Object.defineProperty(e.prototype,"event_key",{get:function(){return this._event_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_id",{get:function(){return this._device_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_app_id",{get:function(){return this._rtc_app_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"product_line",{get:function(){return this._product_line},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_version",{get:function(){return this._report_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"os",{get:function(){return this._os},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_version",{get:function(){return this._rtc_sdk_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_timestamp",{get:function(){return this._rtc_timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_git_commit",{get:function(){return this._rtc_sdk_git_commit},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_id",{get:function(){return this._report_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connection_id",{get:function(){return this._connection_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sid",{get:function(){return this._rtc_sid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"engine_session_id",{get:function(){return this._engine_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_business_id",{get:function(){return this._rtc_business_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"project_key",{get:function(){return this._project_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"network_type",{get:function(){return this._network_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app_version",{get:function(){return this._app_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aid",{get:function(){return this._aid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_model",{get:function(){return this._device_model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_brand",{get:function(){return this._device_brand},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"common_extra_info",{get:function(){return this._common_extra_info},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"had_selected_p2p",{get:function(){return this._had_selected_p2p},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_env_type",{get:function(){return this._rtc_env_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"room_id",{get:function(){return this._room_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_id",{get:function(){return this._user_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_session_id",{get:function(){return this._rtc_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_agent",{get:function(){return this._user_agent},enumerable:!1,configurable:!0}),e}(),NU=fk.LOG_SERVER_URL,wU=function(){function e(){var e=this;this.report_id=0,this.dataBuffer=[],this.posting=!1,this.report_common={},this.preSucTime=0,this.errSendDelay=100,this.commonStats=new OU(this),Zw()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)}))}return e.prototype.push=function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))},e.prototype.unshift=function(e){this.dataBuffer=e.concat(this.dataBuffer)},e.prototype.send=function(e,t){var r=this;if(e||this.dataBuffer.length){var n={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},i=new XMLHttpRequest;if(i.timeout=1e4,i.onreadystatechange=function(){if(4===i.readyState){e||(r.posting=!1);var o=void 0;if(200===i.status||304===i.status)try{o=JSON.parse(i.responseText)}catch(e){}o&&0===o.StatusCode?e||t||r.sucSend():e?r.send(e):(r.unshift(n.data),t?r.send():r.errSend())}},i.open("POST",NU,!0),e||(this.posting=!0),!Zw()&&window.location.search.includes("_rtc_debug_"))i.send(JSON.stringify(n));else{var o=gU.gzip(JSON.stringify(n));i.setRequestHeader("Content-Encoding","gzip"),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(o)}}},e.prototype.sucSend=function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)},e.prototype.errSend=function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2},e.prototype.StartUp=function(){var e=this.report_common,t=this.commonStats,r=t.event_key,n=t.device_id,i=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,c=t.rtc_sdk_version,u=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.connection_id,f=t.rtc_sid,p=t.engine_session_id,_=t.rtc_business_id,v=t.project_key,m=t.network_type,E=t.app_version,S=t.aid,g=t.device_model,y=t.device_brand,b=t.common_extra_info,T=t.had_selected_p2p,I=t.rtc_env_type,R=t.user_agent;Object.assign(e,{event_key:r,device_id:n,rtc_app_id:i,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,connection_id:h,rtc_sid:f,engine_session_id:p,rtc_business_id:_,project_key:v,network_type:m,app_version:E,aid:S,device_model:g,device_brand:y,common_extra_info:b,had_selected_p2p:T,rtc_env_type:I,user_agent:R}),this.commonStats.room_id&&(e.room_id=this.commonStats.room_id),this.commonStats.user_id&&(e.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(e.rtc_session_id=this.commonStats.rtc_session_id)},e.prototype.rtcSdkApiCall=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},n);this.push(i)},e.prototype.rtcSdkCallback=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},n);this.push(i)},e.prototype.rtcReconnect=function(e,t,r,n,i){void 0===i&&(i={});var o=Dp({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:n},i);this.push(o)},e.prototype.rtcReconnected=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},r);this.push(n)},e.prototype.rtcGetAccess=function(e,t,r,n,i,o,a){void 0===a&&(a={});var s=Dp({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:n,host:i,connect_session_id:o},a);this.push(s)},e.prototype.rtcPreIceState=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},r);this.push(n)},e.prototype.rtcNodeChange=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},n);this.push(i)},e.prototype.rtcSignalingMsgError=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},n);this.push(i)},e.prototype.rtcSignaling=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Dp({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:n,direction:i},o);this.push(a)},e.prototype.rtcJoinRoom=function(e,t,r,n,i){void 0===i&&(i={});var o=Dp({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:n},i);this.push(o)},e.prototype.rtcLeaveRoom=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},n);this.push(i)},e.prototype.rtcBeginCreateOffer=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},n);this.push(i)},e.prototype.rtcCreateOffer=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Dp({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:r,stream_user_id:n,elapse:i},o);this.push(a)},e.prototype.rtcSetDescription=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=Dp({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:i,stream_user_id:o,elapse:a},s);this.push(c)},e.prototype.rtcRecvAnswer=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=Dp({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:n,direction:i,stream_id:o,stream_user_id:a},s);this.push(c)},e.prototype.firstRemoteAudioRender=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},r);this.push(n)},e.prototype.firstRemoteVideoRender=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},r);this.push(n)},e.prototype.rtcPublishStat=function(e,t,r,n,i){void 0===i&&(i={});var o=Dp({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:n},i);this.push(o)},e.prototype.rtcSubscribeStat=function(e,t,r,n,i){void 0===i&&(i={});var o=Dp({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:n},i);this.push(o)},e.prototype.rtcAudioDevice=function(e,t,r,n){void 0===n&&(n={});var i=Dp({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},n);this.push(i)},e.prototype.rtcMediaStatistics=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcMessageStatistics=function(e,t,r,n){void 0===n&&(n={});var i=Dp(Dp(Dp(Dp({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),{media_server_ip:r}),n);this.push(i)},e.prototype.rtcError=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},r);this.push(n)},e.prototype.rtcInvokeStatus=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Dp({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:n,elapse:i},o);this.push(a)},e.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var r=Dp(Dp({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t);this.push(r)},e.prototype.rtcMuteRemote=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now()},e),{media_type:t}),r);this.push(n)},e.prototype.sdkInitEngine=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},r);this.push(n)},e.prototype.joinRoom=function(e,t,r,n,i){void 0===i&&(i={});var o=Dp({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},i);this.push(o)},e.prototype.p2pConnectionStatus=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Dp({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:n,elapse:i},o);this.push(a)},e.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var r=Dp({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},t);this.push(r)},e.prototype.rtcDeviceError=function(e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,_,v){void 0===v&&(v={});var m=Dp({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:r,system_error_code:n,system_api:i,call_parameters:o,location:a,message:s,media_device_id:c,media_device_name:u,elapse:d,scenario:l,event_session_id:h,device_pid:f,device_vid:p,media_mode:_},v);this.push(m)},e.prototype.rtcVideoDevice=function(e,t,r){void 0===r&&(r={});var n=Dp({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},r);this.push(n)},e.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var r=Dp(Dp({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t);this.push(r)},e.prototype.rtcEncodeFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcFirstFrameEncoded=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcSendFirstPacket=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcRecvFirstPacket=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcRecvFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcDecodeFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Dp(Dp(Dp({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e}(),DU=new wU,kU=new wU,PU=DU.commonStats,MU=kU.commonStats;function UU(e){void 0===e&&(e=!1);for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return function(r,n,i){if("function"==typeof i.value){var o=i.value;i.value=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a={};return t.forEach((function(e,t){a[e]=r[t]})),(e?kU:DU).rtcSdkApiCall(n,0,JSON.stringify(tD(r)),a),o.apply(this,r)}}}}function LU(e,t,r){void 0===r&&(r=0),(e===rD.onUserMessageReceivedOutsideRoom||e===rD.onUserBinaryMessageReceivedOutsideRoom?kU:DU).rtcSdkCallback(e,r,JSON.stringify(t))}function xU(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=!1),(n?kU:DU).rtcInvokeStatus(JSON.stringify(t),r,e,"",0)}!function(e){e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted"}(yU||(yU={})),function(e){e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage"}(bU||(bU={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(TU||(TU={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(RU||(RU={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(AU||(AU={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.TIMEOUT=1]="TIMEOUT",e[e.BROKEN=2]="BROKEN",e[e.NO_RECEIVER=3]="NO_RECEIVER",e[e.NO_RELAYPATH=4]="NO_RELAYPATH",e[e.SEND_TO_SERVER_ERROR=17]="SEND_TO_SERVER_ERROR",e[e.SERVER_RESPONSE_ERROR=18]="SERVER_RESPONSE_ERROR",e[e.NOT_JOIN=100]="NOT_JOIN",e[e.INIT=101]="INIT",e[e.NO_CONNECTION=102]="NO_CONNECTION",e[e.EXCEED_MAX_LENGTH=103]="EXCEED_MAX_LENGTH",e[e.EMPTY_USER=104]="EMPTY_USER",e[e.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN"}(CU||(CU={}));var VU,BU,jU=((IU={})[CU.SUCCESS]=[0,"success"],IU[CU.TIMEOUT]=[HN.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],IU[CU.BROKEN]=[HN.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],IU[CU.NO_RECEIVER]=[HN.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],IU[CU.NO_RELAYPATH]=[HN.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],IU[CU.SEND_TO_SERVER_ERROR]=[HN.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],IU[CU.SERVER_RESPONSE_ERROR]=[HN.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],IU[CU.NOT_JOIN]=[HN.USER_MESSAGE_NOT_JOIN,"not join room"],IU[CU.INIT]=[HN.USER_MESSAGE_INIT,"not init."],IU[CU.NO_CONNECTION]=[HN.USER_MESSAGE_NO_CONNECTION,"no connection."],IU[CU.EXCEED_MAX_LENGTH]=[HN.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],IU[CU.EMPTY_USER]=[HN.USER_MESSAGE_EMPTY_USER,"user id is empty."],IU[CU.NOT_LOGIN]=[HN.USER_MESSAGE_NOT_LOGIN,"not login."],IU[CU.SERVER_PARAMS_NOTSET]=[HN.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],IU[CU.UNKNOWN]=[HN.USER_MESSAGE_UNKNOWN,"unknown."],IU),FU=new CD("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(VU||(VU={})),function(e){e[e.C2S=0]="C2S",e[e.C2C=1]="C2C",e[e.C2GW=2]="C2GW",e[e.C2CDirect=3]="C2CDirect",e[e.C2RTM=4]="C2RTM"}(BU||(BU={}));var GU=function(e){function t(t){var r=e.call(this)||this;return r._dataChannel=t,r._singlingCache=new Map,r._p2pCache=new Map,r._rttIds={},r._p2pMessageId=0,r._clearDataChannelListener=r._handleHandler(),window.__rtc_mock_signaling__=r.emit.bind(r),r}return wp(t,e),t.prototype.destroy=function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}},t.prototype.sendSignaling=function(e,t,r){var n=this;return DU.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",GM.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=Qw();var s=a.id.join("-"),c=setTimeout((function(){n._singlingCache.delete(s),o(new XN(HN.TIME_OUT,"".concat(e," message time out")))}),6e4);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),i(e)},error:function(e){clearTimeout(c),o(e)}}),FU.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),n._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:BU.C2GW})},t.prototype.sendP2PMessage=function(e,t){var r=e.msg,n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["msg"]);return Pp(this,void 0,void 0,(function(){var e,i,o,a,s;return Mp(this,(function(c){switch(c.label){case 0:return e=r instanceof ArrayBuffer,i=this._sendP2PMessage,o=[Dp({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:RU.SEND,type:AU.P2P,err:CU.SUCCESS},n)],s={binary:e},e?[4,$w.ab2b64str(r)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=JSON.stringify(r),c.label=3;case 3:return[2,i.apply(this,[Dp.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var r=this;return void 0===t&&(t={}),eD(e.msg)?this._rttIds[e.id]=e.id:FU.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(n,i){var o=r._genHeader(Dp(Dp({needAck:!0,functionType:BU.C2C},t),{id:Qw()}));if(e.dir===RU.SEND){var a=setTimeout((function(){r._p2pCache.delete(e.id),i(new XN(HN.TIME_OUT,"P2P message timeout"))}),6e4);r._p2pCache.set(e.id,{success:function(e){clearTimeout(a),n(e)},error:function(e){clearTimeout(a);var t=Lp(jU[e.err]||[HN.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],n=t[1];i({code:r,message:e.msg||n})}})}r._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new XN(HN.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var n=t.version+(+t.zip<<5)+(+t.encrypt<<6),i=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=$w.str2ab(JSON.stringify([e,r])),a=Jw(Uint8Array,xp([n,i],Lp(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),r=0,n=t[r++],i=t[r++],o={version:15&n,zip:16==(16&n),encrypt:32==(32&n),needAck:1==(1&i),direction:(2&i)>>1,functionType:(60&i)>>2,binary:64==(64&i)};if(o.needAck||o.direction===VU.ACK){for(;r<=6;r++)if(128!=(128&t[r])){r++;break}o.id=Array.from(t.slice(2,r))}return{header:o,data:t.slice(r)}},t.prototype._feedbackSignaling=function(e,t){var r=this._genHeader({needAck:!0,direction:VU.ACK,id:e.split("-").map((function(e){return+e}))});FU.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),r,"")},t.prototype._handleMessage=function(e){var t,r;return Pp(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E,S,g,y,b,T,I,R,A,C,O,N,w;return Mp(this,(function(D){switch(D.label){case 0:n=this._dispartData(e),i=n.header,o=n.data,i.zip&&((a=new gU.Inflate).push(o,!0),o=a.result),s=$w.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&DU.rtcSignalingMsgError(-1,e.message,jM.MESSAGE_PARSE_FAILED),[2]}switch(i.functionType){case BU.C2S:return[3,1];case BU.C2C:return[3,6];case BU.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=i.id)||void 0===t?void 0:t.join("-"))||"",i.direction!==VU.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],FU.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,$w.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=D.sent(),D.label=4;case 4:this.emit(d,Dp({},c)),DU.rtcSignaling(0,s,"on-".concat(d),"Recv",GM.DOWN),D.label=5;case 5:return[3,19];case 6:switch(Array.isArray(c)&&(c=c[1]),h=null==c?void 0:c.id,this._rttIds[h]||(null==c?void 0:c.dir)===RU.FEEDBACK||eD(null==c?void 0:c.msg)?delete this._rttIds[h]:FU.print("Signal","<<<<<< p2p response",c),c.dir){case RU.SEND:return[3,7];case RU.FEEDBACK:return[3,16]}return[3,17];case 7:return eD(null==c?void 0:c.msg)?[3,15]:(p=(f=c).binary,_=f.msg,v=f.room,m=f.to,E=f.from,S=""===v?p?bU.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:bU.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:p?bU.USER_BINARY_MESSAGE_RECEIVED:bU.USER_MESSAGE_RECEIVED,m?[3,11]:(g=this.emit,y=[bU.ON_CUSTOM_MESSAGE],N={clientId:E,binary:p},p?[4,$w.b64str2ab(_)]:[3,9]));case 8:return b=D.sent(),[3,10];case 9:b=_,D.label=10;case 10:return g.apply(this,y.concat([(N.message=b,N)])),[3,17];case 11:return T=this.emit,I=[S],R=[Dp({},c)],w={},p?[4,$w.b64str2ab(_)]:[3,13];case 12:return A=D.sent(),[3,14];case 13:A=_,D.label=14;case 14:T.apply(this,I.concat([Dp.apply(void 0,R.concat([(w.msg=A,w)]))])),D.label=15;case 15:return this._sendP2PMessage(Dp(Dp({},c),{dir:RU.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===CU.SUCCESS?C.success(c.id):C.error(c)),[3,17];case 17:return[3,19];case 18:i.direction===VU.ACK&&(O=(null===(r=i.id)||void 0===r?void 0:r.join("-"))||"",this._handleAckMessage(O,c[0]||{},s)),D.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){FU.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){FU.print("_handleHandler","dataChannel error",t),e.emit("close",t)},n=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",n),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",n)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),Dp({version:2,zip:!1,encrypt:!1,needAck:!0,direction:VU.SEND,functionType:BU.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,r){var n=this._singlingCache.get(e);n&&(this._singlingCache.delete(e),200===t.code?n.success(t):n.error(t),FU.print("Signal","<<<<<< [".concat(n.signalingType,"-ack]"),t)),DU.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack",GM.DOWN)},t}(vD.exports.EventEmitter),HU=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,r=e.method,n=e.url,i=e.body,o=void 0===i?{}:i,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,i){var a,c;t.isSending=!0;var d=new XMLHttpRequest;d.open(r,n,!0);try{for(var l=Up(Object.entries(s)),h=l.next();!h.done;h=l.next()){var f=Lp(h.value,2),p=f[0],_=f[1];d.setRequestHeader(p,_)}}catch(e){a={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(a)throw a.error}}d.onreadystatechange=function(){4===d.readyState&&(t.isSending=!1,200===d.status?e(JSON.parse(d.responseText)):i({message:d.statusText,code:d.status})),0===d.status&&i({code:0,message:"Request abort"})},d.onerror=function(e){var r=HN.UNEXPECTED_ERROR;t.isSending=!1,i({code:r,message:d.responseText||"unknown"})},u&&(o=JSON.stringify(o)),d.send(o),t.xhr=d}))},e.prototype.get=function(e,t){return this.ajax({method:"GET",url:e,headers:t})},e.prototype.post=function(e,t,r,n){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:n})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),zU=function(){function e(){}return e.prototype.get=function(e){var t=localStorage.getItem(e);if(!t)return null;try{var r=JSON.parse(t);return r.ttl>0&&Date.now()-r.saveTime>r.ttl?(this.delete(e),null):r.message}catch(e){return null}},e.prototype.set=function(e,t,r){void 0===r&&(r=-1);var n={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(n)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),YU=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wp(t,e),t.prototype.getDeviceId=function(){var e=this.get("RTC_DEVICE_ID");return e||(e=Yw()),this.set("RTC_DEVICE_ID",e),e},t.prototype.getAccessNode=function(e){return this.get("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus"))},t.prototype.setAccessNode=function(e,t,r){return this.set("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus"),t,1e3*r)},t.prototype.getAccessUrls=function(){return this.get("".concat("RTC_ACCESS_URLS","-BytePlus"))},t.prototype.setAccessUrls=function(e){var t=e.map((function(e){var t=e.host,r=e.path;return"https://".concat(t).concat(r)}));return this.set("".concat("RTC_ACCESS_URLS","-BytePlus"),t)},t.prototype.clearAccessUrls=function(){this.delete("".concat("RTC_ACCESS_URLS","-BytePlus"))},t}(zU),KU=new YU,XU=new CD("ICE Request",3),WU=function(){function e(){this._request=new HU}return e.prototype.getAccessNode=function(e,t,r,n,i,o){return Pp(this,void 0,void 0,(function(){var a;return Mp(this,(function(s){return(a=KU.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,r,n,i,o),xU("es.R.node.cache",a),[2,Promise.resolve(a)]):[2,this.getAccessNodeFromServer(e,t,r,n,i,o)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,r,n,i,o){return Pp(this,void 0,void 0,(function(){var a,s,c=this;return Mp(this,(function(u){return a=KU.getAccessUrls(),s=!0,xU("es.R.req.cache.urls",a),(null==a?void 0:a.length)>0||(a=fk.ICE_CONFIG_REQUEST_URLS,s=!1,xU("es.R.req.external.urls",a)),(null==a?void 0:a.length)>0||(a=fk.ICE_CONFIG_REQUEST_URLS_INTERNAL,s=!1,xU("es.R.req.internal.urls",a)),[2,this.getICEConfigFromServer(a,e,t,r,n,i,o).then((function(t){var r=t.nodes[0];return KU.setAccessNode(e,r,t.ttl||11200),KU.setAccessUrls(t.dispatchDomains),r})).catch((function(a){if(s)return xU("es.R.req.fallback",""),KU.clearAccessUrls(),c.getAccessNodeFromServer(e,t,r,n,i,o);throw a}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,r,n,i,o,a){var s;return Pp(this,void 0,void 0,(function(){var c,u,d,l=this;return Mp(this,(function(h){return c={appID:t,roomID:r,userID:n,deviceID:i,connectSessionID:Ww(),os:"web",sdkVersion:fk.VERSION,expectedAddr:_k("EXPECTED_ADDR"),productPlatform:"BytePlus"},o&&a&&(c.feedbackInfo=[{feedbackIP:null===(s=a.publicIPs[0])||void 0===s?void 0:s.ip,feedbackReason:{type:"NodeChanged",reason:o}}],delete c.expectedAddr),u=Date.now(),DU.rtcGetAccess(0,JSON.stringify(c),0,VM.REQUEST,e.join(","),c.connectSessionID),d=e.map((function(e,t){return Pp(l,void 0,void 0,(function(){var r,n,i;return Mp(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._request.post(e,c)];case 1:return r=o.sent(),[3,3];case 2:throw n=o.sent(),new XN(HN.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==r.code)throw new XN(HN.ICE_SERVER_WRONG,"get ICE config failed",{server_code:r.code,message:JSON.stringify(r)});if(!(i=r.nodes[0]))throw new XN(HN.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:r.code,message:JSON.stringify(r)});return[2,{result:r,firstNode:i,index:t}]}}))}))})),[2,Promise.race(d).then((function(t){var r=t.result;t.firstNode;var n=t.index;return DU.rtcGetAccess(200,JSON.stringify(r),Date.now()-u,VM.RESPONSE,e[n],c.connectSessionID),r})).catch((function(t){throw DU.rtcGetAccess(t.error.code||t.error.server_code,t.error.message,Date.now()-u,VM.RESPONSE,e.join(","),c.connectSessionID),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(XU.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),qU={},JU={},ZU={exports:{}},$U=ZU.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($U).forEach((function(e){$U[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(r[n[o]]=t(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},n=ZU.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(n[t]||[]).length;s+=1){var c=n[t][s];if(c.reg.test(i))return r(c,a,i)}})),t.media=o,t};var o=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],n=e.split(" ").map(t),i=0;i<n.length;i+=3)r.push({component:n[i],ip:n[i+1],port:n[i+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(JU);var QU=ZU.exports,eL=/%[sdv%]/g,tL=function(e){var t=1,r=arguments,n=r.length;return e.replace(eL,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},rL=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return tL.apply(null,n)},nL=["v","o","s","i","u","e","p","c","b","t","r","z","a"],iL=["i","c","b","a"],oL=JU,aL=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||nL,n=t.innerOrder||iL,i=[];return r.forEach((function(t){QU[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(rL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(rL(t,r,e))}))}))})),e.media.forEach((function(e){i.push(rL("m",QU.m[0],e)),n.forEach((function(t){QU[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(rL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(rL(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};qU.write=aL,qU.parse=oL.parse,qU.parseParams=oL.parseParams,qU.parseFmtpConfig=oL.parseFmtpConfig,qU.parsePayloads=oL.parsePayloads,qU.parseRemoteCandidates=oL.parseRemoteCandidates,qU.parseImageAttributes=oL.parseImageAttributes,qU.parseSimulcastStreamList=oL.parseSimulcastStreamList;var sL=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this._iceConfigNode.iceParams,n=qU.parse(e);return null===(t=n.media)||void 0===t||t.forEach((function(e){e.iceUfrag=null==r?void 0:r.clientIceUfrag,e.icePwd=null==r?void 0:r.clientIcePwd,e.iceOptions="renomination"})),qU.write(n)},e}(),cL=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this,n=this._iceConfigNode.certFingerprint,i=qU.parse(e);return(null==i?void 0:i.fingerprint)&&(i.fingerprint={type:"sha-256",hash:n}),null===(t=null==i?void 0:i.media)||void 0===t||t.forEach((function(e){return r.modifyMlineByIceNode(e)})),qU.write(i)},e.prototype.modifyMlineByIceNode=function(e){var t=this._iceConfigNode,r=t.publicIPs,n=t.certFingerprint,i=t.iceParams;e.fingerprint&&(e.fingerprint={type:"sha-256",hash:n}),e.icePwd=i.serverIcePwd,this._iceUfrag||(this._iceUfrag=EL(i.serverIceUfrag),PU.setStats({connection_id:this._iceUfrag})),e.iceUfrag=this._iceUfrag,e.setup="active",this._candidates||(this._candidates=mL(r)),e.candidates=this._candidates,e.iceOptions="renomination","application"===e.type&&(e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144})},e}();function uL(e,t){var r,n=qU.parse(e),i=[];return n.media=n.media.map((function(e){return t.includes(e.mid+"")?(e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.bundleOnly):"inactive"!==e.direction&&i.push(e.mid),e})),(null===(r=n.groups)||void 0===r?void 0:r[0])&&(n.groups[0].mids=i.join(" ")),n}var dL,lL,hL,fL,pL,_L=function(e,t){var r,n;try{var i=qU.parse(e),o=qU.parse(t),a="".concat(null===(r=o.groups)||void 0===r?void 0:r[0].mids).split(" "),s="".concat(null===(n=i.groups)||void 0===n?void 0:n[0].mids).split(" "),c={};a.forEach((function(e){return c[e]=e}));var u={};s.forEach((function(e){c[e]||(u[e]=e)}));var d="",l="";return i.media=i.media.filter((function(e){return u[e.mid]&&"audio"===e.type?d="".concat(e.mid):u[e.mid]&&"video"===e.type&&(l="".concat(e.mid)),u[e.mid]})),delete i.groups,delete i.msidSemantic,{partialSdp:qU.write(i),audioMid:d,videoMid:l}}catch(e){return null}},vL=function(e,t){var r;try{var n=qU.parse(e),i=[];return null===(r=n.media)||void 0===r||r.forEach((function(e){(null==t?void 0:t.includes("".concat(e.mid)))&&i.push(e)})),n.media=i,delete n.groups,delete n.msidSemantic,qU.write(n)}catch(e){return""}},mL=function(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,n=[];return e.forEach((function(e){var i={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){n.push(Dp(Dp({},i),{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push(Dp(Dp({},i),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n},EL=function(e){var t=new TextEncoder,r=t.encode("PREC"),n=new Uint8Array($w.str2ab(e)),i=t.encode(Date.now().toString()).slice(-4),o=new Uint8Array(4);o[0]=0,o[1]=1,o[2]=1,o[3]=1;var a=Jw(Uint8Array,r,n,i,o),s=$w.ab2str(a.buffer);return window.btoa(s)},SL="safari"===(dL="none",Zw()||(null!==window.navigator.userAgent.match("Firefox")?dL="mozilla":null!==window.navigator.userAgent.match("Chrome")?(dL="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(dL="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(dL="safari")),dL);!function(e){e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server"}(lL||(lL={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(hL||(hL={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(fL||(fL={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(pL||(pL={}));var gL,yL,bL,TL=function(){function e(e){this.peer=e,this.stats=[]}return e.prototype.handleCodec=function(e){return e},e.prototype.handleInboundRtp=function(e){return e},e.prototype.handleOutboundRtp=function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e},e.prototype.handleRemoteInboundRtp=function(e){return e},e.prototype.handleRemoteOutboundRtp=function(e){return e},e.prototype.handleMediaSource=function(e){return e},e.prototype.handleCsrc=function(e){return e},e.prototype.handlePeerConnection=function(e){return e},e.prototype.handleDataChannel=function(e){return e},e.prototype.handleStream=function(e){return e},e.prototype.handleTrack=function(e){return e},e.prototype.handleTransceiver=function(e){return e},e.prototype.handleSender=function(e){return e},e.prototype.handleReceiver=function(e){return e},e.prototype.handleTransport=function(e){return e},e.prototype.handleSctpTransport=function(e){return e},e.prototype.handleCandidatePair=function(e){return e},e.prototype.handleLocalCandidate=function(e){return e},e.prototype.handleRemoteCandidate=function(e){return e},e.prototype.handleCertificate=function(e){return e},e.prototype.handleIceServer=function(e){return e},e.prototype.processStats=function(e){var t=this;e.forEach((function(e){var r;switch(e.type){case lL.candidatePair:r=t.handleCandidatePair;break;case lL.certificate:r=t.handleCertificate;break;case lL.remoteCandidate:r=t.handleRemoteCandidate;break;case lL.remoteInboundRtp:r=t.handleInboundRtp;break;case lL.remoteOutboundRtp:r=t.handleOutboundRtp;break;case lL.sctpTransport:r=t.handleSctpTransport;break;case lL.sender:r=t.handleSender;break;case lL.stream:r=t.handleStream;break;case lL.track:r=t.handleTrack;break;case lL.transceiver:r=t.handleTransceiver;break;case lL.transport:r=t.handleTransport;break;case lL.codec:r=t.handleCodec;break;case lL.csrc:r=t.handleCsrc;break;case lL.dataChannel:r=t.handleDataChannel;break;case lL.iceServer:r=t.handleIceServer;break;case lL.mediaSource:r=t.handleMediaSource;break;case lL.outboundRtp:r=t.handleOutboundRtp;break;case lL.inboundRtp:r=t.handleInboundRtp;break;case lL.peerConnection:r=t.handlePeerConnection;break;case lL.receiver:r=t.handleReceiver;break;case lL.localCandidate:r=t.handleLocalCandidate;break;default:r=function(e){return e}}r=r.bind(t),t.stats.push(r(e))}))},e.prototype.getExtraStats=function(){return Pp(this,void 0,void 0,(function(){var e=this;return Mp(this,(function(t){return[2,new Promise((function(t,r){if(SL||void 0!==window.InstallTrigger)return t(e.stats);try{e.peer.getStats((function(r){r.result().forEach((function(t){if(!IL.includes(t.type)){var r={};t.names().forEach((function(e){r[e]=t.stat(e)})),r.id=t.id,r.type=t.type,r.timestamp=t.timestamp,e.stats.push(r)}})),t(e.stats)}))}catch(e){r(e)}}))]}))}))},e.prototype.getStats=function(e){return Pp(this,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),[4,this.peer.getStats(e)];case 1:t=r.sent(),this.processStats(t),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.getExtraStats()];case 3:case 4:return r.sent(),[3,5];case 5:return[3,7];case 6:return r.sent(),[3,7];case 7:return[2,this.stats]}}))}))},e}(),IL=["codec","inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp","media-source","csrc","peer-connection","data-channel","stream","track","transceiver","sender","receiver","transport","sctp-transport","candidate-pair","local-candidate","remote-candidate","certificate","ice-server"];!function(e){e[e.AUTO=0]="AUTO",e[e.MODE_L=1]="MODE_L",e[e.MODE_R=2]="MODE_R",e[e.MODE_MIX=3]="MODE_MIX"}(gL||(gL={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(yL||(yL={})),function(e){e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED"}(bL||(bL={}));var RL=function(){return Pp(void 0,void 0,void 0,(function(){var e,t,r,n;return Mp(this,(function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),Zw()||!window.RTCPeerConnection||!window.RTCPeerConnection.prototype.addTransceiver||!window.RTCPeerConnection.prototype.createDataChannel)return[2,!1];for(e=navigator.userAgent.toLowerCase(),t=["heytapbrowser","mqqbrowser","miuibrowser"],r=0;r<t.length;r++)if(e.includes(t[r]))return[2,!1];return[4,nD()];case 1:return(n=i.sent())&&(null==n?void 0:n.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"))?[2,!0]:[2,!1];case 2:return i.sent(),[2,!1];case 3:return[2]}}))}))},AL=function(){return"undefined"!=typeof TransformStream&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},CL=new CD("BasicHandler",3),OL=AL(),NL={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!OL||void 0},wL=function(e){function t(){var t=e.call(this)||this;return t._peerConnection=new RTCPeerConnection(NL),t._dataChannel=t._peerConnection.createDataChannel("signaling"),t._dataChannel.binaryType="arraybuffer",t._peerConnection.ontrack=function(e){var r,n;CL.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(n=null===(r=e.streams)||void 0===r?void 0:r[0])||void 0===n?void 0:n.id)),t.emit("ontrack",e)},t._peerConnection.onconnectionstatechange=function(e){CL.print("constructor","onconnectionstatechange ".concat(t._peerConnection.iceConnectionState," -> ").concat(t._peerConnection.connectionState)),"failed"!==t._peerConnection.iceConnectionState&&"closed"!==t._peerConnection.iceConnectionState&&"failed"!==t._peerConnection.connectionState||t.emit("disconnect")},t._peerConnection.oniceconnectionstatechange=function(){var e=t._peerConnection.iceConnectionState;DU.rtcPreIceState(e,BM["".concat(e.toUpperCase())])},t}return wp(t,e),t.prototype.connect=function(e){return Pp(this,void 0,void 0,(function(){var t,r,n=this;return Mp(this,(function(i){switch(i.label){case 0:return CL.print("connect","invoke connect"),[4,this._peerConnection.createOffer()];case 1:return t=i.sent(),this._localSdp=new sL(e),[4,this.setLocalDescription(t.sdp)];case 2:return i.sent(),this._remoteSdp=new cL(e),r=this._remoteSdp.modifyByIceNode(t.sdp),[4,this.setRemoteDescription(r)];case 3:return i.sent(),[4,new Promise((function(e,t){n._dataChannel.onopen=function(){CL.print("connect","dataChannel open"),xU("es.dc.open",""),e("")},n._dataChannel.onerror=function(e){DU.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,jM.INVALID_DATA),xU("es.dc.error",""),t(e)},n._dataChannel.onclose=function(e){xU("es.dc.close",""),t(e)},n._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==n._peerConnection.iceConnectionState&&"closed"!==n._peerConnection.iceConnectionState&&"failed"!==n._peerConnection.connectionState||t(e)}))}))];case 4:return i.sent(),CL.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){this.disconnect(),this._localSdp=void 0,this._remoteSdp=void 0},t.prototype.publish=function(e){var t;return Pp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E;return Mp(this,(function(S){switch(S.label){case 0:if(r=e.stream,n=null==e?void 0:e.videoTrack,i=null==e?void 0:e.audioTrack,o={},a=[],Array.isArray(null==e?void 0:e.videoEncodeConfig))for(s=null==e?void 0:e.videoEncodeConfig.length,c=null==n?void 0:n.getTrack(),u={width:640,height:480,framerate:30},c&&(d=null==c?void 0:c.getSettings(),u={width:Math.floor(d.width),height:Math.floor(d.height),framerate:Math.floor(d.frameRate)}),o.sendEncodings=[],l=0;l<s;l++)h=null==e?void 0:e.videoEncodeConfig[l],f={maxBitrate:1e3*h.maxKbps},p=Math.pow(2,l),s>1&&(f.rid="".concat(l),f.scaleResolutionDownBy=p),null===(t=o.sendEncodings)||void 0===t||t.unshift(f),a.push({width:Math.floor(u.width/p),height:Math.floor(u.height/p),framerate:u.framerate,maxkbps:h.maxKbps,rid:"".concat(l)});return CL.print("publish videoTransceiverInit videoDescriptions","",o,a),_=null==i?void 0:i.getTrack(),(null==i?void 0:i.mixType)!==yL.PLAYOUT&&(null==i?void 0:i.mixedAudioTrack)&&(_=null==i?void 0:i.mixedAudioTrack),e.audioTransceiver=this._peerConnection.addTransceiver(_||"audio",{direction:"sendonly",streams:[r]}),OL&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver((null==n?void 0:n.getTrack())||"video",Dp({direction:"sendonly",streams:[r]},o)),OL&&e.initVideoEncodedTransform(),CL.print("sender.getParameters()",e.videoTransceiver.sender.getParameters()),v=qw(),DU.rtcBeginCreateOffer(HM.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:if(m=S.sent(),DU.rtcCreateOffer(0,zM.UP,e.streamId,e.userId,qw()-v),E=_L(m.sdp,this.getLocalDescriptionSdp()),!m.sdp||!E)throw new XN(HN.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Dp(Dp({sdp:m.sdp},E),{type:"incroffer",semantics:"unified-plan",videoDescriptions:a})]}}))}))},t.prototype.subscribe=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n,i,o,a;return Mp(this,(function(s){switch(s.label){case 0:return r="incroffer",n="unified-plan",t?[2,{sdp:this.getLocalDescriptionSdp(),partialSdp:vL(this.getLocalDescriptionSdp(),[t.audioMid,t.videoMid]),audioMid:t.audioMid,videoMid:t.videoMid,type:r,semantics:n}]:(e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),OL&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),OL&&e.initVideoEncodedTransform(),i=qw(),DU.rtcBeginCreateOffer(HM.DOWN,e.streamId,e.userId),[4,this._peerConnection.createOffer()]);case 1:if(o=s.sent(),DU.rtcCreateOffer(0,zM.DOWN,e.streamId,e.userId,qw()-i),a=_L(o.sdp,this.getLocalDescriptionSdp()),!o.sdp||!a)throw new XN(HN.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Dp(Dp({sdp:o.sdp},a),{type:r,semantics:n})]}}))}))},t.prototype.setAnswerSdp=function(e,t,r,n,i){var o;return Pp(this,void 0,void 0,(function(){var a,s,c,u,d,l,h=this;return Mp(this,(function(f){switch(f.label){case 0:return DU.rtcRecvAnswer(0,XM.INCRANSWER,0,t,i,n.streamId,n.userId),a=this._peerConnection.remoteDescription,s=qU.parse(null==a?void 0:a.sdp),c=null===(o=s.media)||void 0===o?void 0:o.reduce((function(e,t){return e[t.mid]=t,e}),{}),qU.parse(t).media.forEach((function(e){return c[e.mid]=e})),u=[],d=qU.parse(e),l=d.media.map((function(e){var t;r&&r[e.mid]&&(e.mid=r[e.mid]),"inactive"!==e.direction&&u.push(e.mid);var n=c[e.mid];return null===(t=h._remoteSdp)||void 0===t||t.modifyMlineByIceNode(n),e.bundleOnly||(n.port=e.port),n})),s.media=l,d.groups=[{mids:u.join(" "),type:"BUNDLE"}],s.groups=d.groups,[4,this.setLocalDescription(qU.write(d),n,i)];case 1:return f.sent(),[4,this.setRemoteDescription(qU.write(s),n,i)];case 2:return f.sent(),[2]}}))}))},t.prototype.setLocalDescription=function(e,t,r){var n,i;return Pp(this,void 0,void 0,(function(){var o,a,s,c,u,d,l;return Mp(this,(function(h){switch(h.label){case 0:o=null===(n=this._localSdp)||void 0===n?void 0:n.modifyByIceNode(e),a=new RTCSessionDescription({type:"offer",sdp:o}),s=qw(),c=r||KM.UP,u=(null==t?void 0:t.streamId)||"",d=(null===(i=t)||void 0===i?void 0:i.userId)||"",h.label=1;case 1:return h.trys.push([1,3,,4]),CL.print("setOffer","set offer: ",a),[4,this._peerConnection.setLocalDescription(a)];case 2:return h.sent(),DU.rtcSetDescription(0,a.sdp,YM.W_1,c,u,d,qw()-s,{type:"offer"}),[3,4];case 3:throw(l=h.sent())instanceof Error&&DU.rtcSetDescription(-1,l.message,YM.W_1,c,u,d,qw()-s,{type:"offer"}),l;case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t,r){var n;return Pp(this,void 0,void 0,(function(){var i,o,a,s,c,u;return Mp(this,(function(d){switch(d.label){case 0:i=new RTCSessionDescription({type:"answer",sdp:e}),o=qw(),a=r||KM.UP,s=(null==t?void 0:t.streamId)||"",c=(null===(n=t)||void 0===n?void 0:n.userId)||"",d.label=1;case 1:return d.trys.push([1,3,,4]),CL.print("setAnswer","set answer: ",i),[4,this._peerConnection.setRemoteDescription(i)];case 2:return d.sent(),DU.rtcSetDescription(0,i.sdp,YM.W_0,a,s,c,qw()-o,{type:"answer"}),[3,4];case 3:throw(u=d.sent())instanceof Error&&DU.rtcSetDescription(-1,u.message,YM.W_0,a,s,c,qw()-o,{type:"answer"}),u;case 4:return[2]}}))}))},t.prototype.getLocalDescriptionSdp=function(){var e,t,r,n;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.localDescription)||void 0===t?void 0:t.sdp)return null===(n=null===(r=this._peerConnection)||void 0===r?void 0:r.localDescription)||void 0===n?void 0:n.sdp;throw Error()},t.prototype.getRemoteDescriptionSdp=function(){var e,t,r,n;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.remoteDescription)||void 0===t?void 0:t.sdp)return null===(n=null===(r=this._peerConnection)||void 0===r?void 0:r.remoteDescription)||void 0===n?void 0:n.sdp;throw Error()},t.prototype.closeMLine=function(e){var t,r;return Pp(this,void 0,void 0,(function(){var n,i,o,a,s=this;return Mp(this,(function(c){switch(c.label){case 0:return CL.print("closeMids","closeMids: ",e),n=this.getLocalDescriptionSdp(),i=uL(n,e),o=this.getRemoteDescriptionSdp(),a=uL(o,e),[4,this._peerConnection.createOffer()];case 1:return c.sent(),[4,this.setLocalDescription(qU.write(i))];case 2:return c.sent(),(null===(t=null==i?void 0:i.media)||void 0===t?void 0:t.length)!==(null===(r=null==a?void 0:a.media)||void 0===r?void 0:r.length)&&i.media.slice(a.media.length).forEach((function(e){var t;null===(t=s._remoteSdp)||void 0===t||t.modifyMlineByIceNode(e),a.media.push(e)})),Array.isArray(i.media)&&Array.isArray(a.media)&&i.media.forEach((function(e,t){a.media[t]&&(a.media[t].mid=e.mid)})),[4,this.setRemoteDescription(qU.write(a))];case 3:return c.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return Pp(this,void 0,void 0,(function(){var e;return Mp(this,(function(t){switch(t.label){case 0:return[4,nD()];case 1:if(!(e=t.sent()))throw new XN(HN.NOT_SUPPORTED,"Get offer Error");return[2,{sdp:e,semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.getStats=function(e){return t=this._peerConnection,r=e,Pp(void 0,void 0,void 0,(function(){var e;return Mp(this,(function(n){switch(n.label){case 0:return e=[],t instanceof RTCPeerConnection?[4,new TL(t).getStats(r)]:[2,e];case 1:return[2,e=n.sent()]}}))}));var t,r},t.prototype.rollback=function(e,t){var r;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(n){switch(n.label){case 0:return CL.print("rollback()","signalingState: %o",this._peerConnection.signalingState),"stable"!==this._peerConnection.signalingState?[3,2]:[4,null===(r=this._peerConnection)||void 0===r?void 0:r.setLocalDescription(new RTCSessionDescription({sdp:e,type:"offer"}))];case 1:n.sent(),n.label=2;case 2:return[4,this.closeMLine(t)];case 3:return n.sent(),[2]}}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t}(vD.exports.EventEmitter),DL=new CD("Locker",2),kL=1,PL=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=kL++,e&&(this.name=e),DL.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return Object.defineProperty(e.prototype,"isLocked",{get:function(){return this.locks>0},enumerable:!1,configurable:!0}),e.prototype.lock=function(){var e,t=this;this.locks+=1,DL.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var r=new Promise((function(r){e=function(){t.locks-=1,DL.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),n=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),n},e}(),ML=Math.log,UL=Math.LOG10E;Fn({target:"Math",stat:!0},{log10:Math.log10||function(e){return ML(e)*UL}}),Fn({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new CD("Stats",2);var LL,xL=function(){function e(e,t){this._client=e,this._handler=t,this.dataChannelRTT={},this._rttTimer={},this._remoteStreamStasEvtIntervals={},this._localStreamStasEvtIntervals={},this._firstFrameStarted={},this._videoInWaiting={}}return e.prototype.setRemoteStreamStatsEvtInterval=function(e){var t,r,n=this;this.getDataChannelRTT(e.userId);var i={audio:{},video:{},remoteStream:e},o=null===(t=e.audioTrack)||void 0===t?void 0:t.getTrack(),a=null===(r=e.videoTrack)||void 0===r?void 0:r.getTrack();this.getRemoteAudioStats(o,i),this.getRemoteVideoStats(a,i),this.delRemoteStreamStatsEvtInterval(e);this._remoteStreamStasEvtIntervals[e.streamId]=setInterval((function(){return Pp(n,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:return[4,Pp(n,void 0,void 0,(function(){var t,r,n,o,a,s;return Mp(this,(function(c){switch(c.label){case 0:return t=null===(a=e.audioTrack)||void 0===a?void 0:a.getTrack(),r=null===(s=e.videoTrack)||void 0===s?void 0:s.getTrack(),[4,this.getRemoteAudioStats(t,i)];case 1:return n=c.sent(),[4,this.getRemoteVideoStats(r,i)];case 2:return(o=c.sent()).isScreen=e.isScreen,[2,{audioStats:n,videoStats:o,isScreen:e.isScreen,userId:e.userId}]}}))}))];case 1:return t=r.sent(),this._client.emit("onRemoteStreamStats",t),[2]}}))}))}),2e3)},e.prototype.delRemoteStreamStatsEvtInterval=function(e){clearInterval(this._remoteStreamStasEvtIntervals[e.streamId])},e.prototype.unsubscribe=function(e){this.delRemoteStreamStatsEvtInterval(e),clearTimeout(this._rttTimer[e.userId]),this._videoInWaiting[e.streamId]=!1,this._firstFrameStarted["".concat(e.streamId,"-audio")]&&(DU.rtcFirstFrame({event_type:tU.RECV_END,media_type:e.isScreen?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-audio")],event_session_id:e.streamId,result:!1,reason:iU.UNSUBSCRIBE,stream_user_id:e.userId}),delete this._firstFrameStarted["".concat(e.streamId,"-audio")]),this._firstFrameStarted["".concat(e.streamId,"-video")]&&(DU.rtcFirstFrame({event_type:tU.RECV_END,media_type:e.isScreen?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-video")],event_session_id:e.streamId,result:!1,reason:iU.UNSUBSCRIBE,stream_user_id:e.userId}),delete this._firstFrameStarted["".concat(e.streamId,"-video")])},e.prototype.getRemoteAudioStats=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,f,p=this;return Mp(this,(function(_){switch(_.label){case 0:return r={},n={timestamp:Date.now()},i=t.remoteStream,o=i.streamId,a=i.userId,s=i.isScreen,c=i.audioMid,u=i.hasAudio,d={media_type:"audio",direction:"down",stream_id:o,stream_user_id:a,vid:c,remote_muted:!u},e&&this._handler?(t.audioStart||(t.audioStart=qw(),DU.rtcFirstFrame({event_type:tU.BEGIN_RECV,media_type:s?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.SUBSCRIBE,start:t.audioStart,event_session_id:o,stream_user_id:a}),u?this._firstFrameStarted["".concat(o,"-audio")]=t.audioStart:DU.rtcFirstFrame({event_type:tU.RECV_END,media_type:s?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.PUBLISH,start:t.audioStart,event_session_id:o,result:!1,reason:iU.DISABLE,stream_user_id:a})),[4,this._handler.getStats(e)]):[2,r];case 1:return(l=_.sent()).length?(l.forEach((function(e){var i=e.type,c=e.packetsLost,u=e.packetsReceived,l=e.bytesReceived,h=e.jitterBufferDelay,f=e.jitterBufferEmittedCount,_=e.clockRate,v=e.channels,m=e.totalSamplesReceived,E=e.concealedSamples,S=e.concealmentEvents,g=e.totalRoundTripTime,y=e.state,b=e.currentRoundTripTime,T=e.audioLevel,I=e.totalAudioEnergy,R=e.totalSamplesDuration,A=e.mimeType,C=e.googDecodingNormal,O=e.fecPacketsReceived,N=e.availableIncomingBitrate,w=e.availableOutgoingBitrate,D=e.bytesSent,k=e.nominated,P=e.id,M=e.writable,U=e.jitter,L=e.candidateType,x=e.ip,V=e.address,B=e.networkType,j=e.port,F=e.protocol,G=e.audioOutputLevel,H=e.requestsReceived,z=e.responsesReceived,Y=e.requestsSent,K=e.consentRequestsSent,X=e.responsesSent,W=e.ssrc,q=e.kind;"inbound-rtp"===i?(n.packetsLost=c,n.packetsReceived=u,d.packets=u,n.bytesReceived=l,d.bytes=l,void 0!==h&&(r.jitterBufferDelay=h/f*1e3,d.jitter_buffer_delay=r.jitterBufferDelay),void 0!==m&&(n.totalSamplesReceived=m,r.concealedSamples=E,n.concealedSamples=E,d.concealed_samples=E,r.concealmentEvents=S,d.total_samples_received=m),void 0!==O&&(d.fec_packets_received=O),d.jitter=1e3*U,d.ssrc=W,m>0&&p._firstFrameStarted["".concat(o,"-audio")]&&(DU.rtcFirstFrame({event_type:tU.RECV_END,media_type:s?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.SUBSCRIBE,event_session_id:o,result:!0,start:t.audioStart,stream_user_id:a}),delete p._firstFrameStarted["".concat(o,"-audio")])):"codec"===i?(r.recordSampleRate=_,v&&(r.numChannels=v),d.codec=A):"candidate-pair"===i?(d.ice_available_incoming_bitrate=N,d.ice_available_outgoing_bitrate=w,d.ice_bytes_received=l,d.ice_bytes_sent=D,d.ice_nominated=+k,d.ice_pair_id=P,d.ice_pair_rtt=b,d.rtt=1e3*b,d.ice_pair_state=y,d.ice_pair_writable=M,d.recv_ping_requests=H,d.recv_ping_responses=z,d.sent_ping_requests_before_first_response=Y,d.sent_ping_requests_total=Y+(K||0),d.sent_ping_responses=X,"succeeded"===y&&(r.rtt=1e3*b,r.total_rtt=1e3*g)):"track"===i&&"audio"===q?(d.audio_level=-10*Math.log10(Math.pow(T,2)),d.volume=255*T,d.total_audio_energy=I,d.total_samples_duration=R):"ssrc"===i?(d.decoding_normal=C,d.recv_level=G):"local-candidate"===i?(d.local_candidate_type=L,d.local_ip=x||V,d.local_network_type=B,d.local_port=j,d.protocol=F):"remote-candidate"===i&&(d.remote_candidate_type=L,d.remote_ip=x||V,d.remote_port=j)})),(h=t.audio).timestamp?(r.audioLossRate=(n.packetsLost-h.packetsLost)/(n.packetsReceived-h.packetsReceived+(n.packetsLost-h.packetsLost)),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,d.packets_lost=Math.round(n.packetsLost-h.packetsLost),d.fraction_lost=r.audioLossRate,d.packets_lost_rate=r.audioLossRate,r.statsInterval=n.timestamp-h.timestamp,r.receivedKBitrate=(n.bytesReceived-h.bytesReceived||0)/r.statsInterval,d.bitrate=Math.round(8e3*r.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),void 0!==n.concealedSamples&&(d.interval_concealed_samples=n.concealedSamples-h.concealedSamples,d.interval_samples_received=n.totalSamplesReceived-h.totalSamplesReceived,r.receivedSampleRate=1e3*d.interval_samples_received/r.statsInterval),t.audio=n,this.dataChannelRTT[t.remoteStream.userId]&&(f=this.dataChannelRTT[t.remoteStream.userId]/2,r.e2eDelay=f+(r.jitterBufferDelay||0),d.web_e2e_delay=r.e2eDelay,d.total_rtt_ms=f),t.remoteStream.subAudio&&DU.rtcMediaStatistics(d,{}),[2,r]):(t.audio=n,[2,r])):[2,r]}}))}))},e.prototype.getRemoteVideoStats=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,f,p=this;return Mp(this,(function(_){switch(_.label){case 0:return r={},n={timestamp:Date.now()},i=t.remoteStream,o=i.streamId,a=i.userId,s=i.isScreen,c=i.hasVideo,u={media_type:"video",direction:"down",stream_id:o,stream_user_id:a,vid:t.remoteStream.videoMid,remote_muted:!c},e&&this._handler?(t.videoStart||(t.videoStart=qw(),DU.rtcFirstFrame({event_type:tU.BEGIN_RECV,media_type:s?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.SUBSCRIBE,start:t.videoStart,event_session_id:o,stream_user_id:a}),c?this._firstFrameStarted["".concat(o,"-video")]=t.videoStart:DU.rtcFirstFrame({event_type:tU.RECV_END,media_type:s?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.PUBLISH,start:t.videoStart,event_session_id:o,result:!1,reason:iU.DISABLE,stream_user_id:a})),[4,this._handler.getStats(e)]):[2,r];case 1:return(d=_.sent()).length?(d.forEach((function(e){var i=e.type,c=e.frameHeight,d=e.frameWidth,l=e.packetsLost,h=e.packetsReceived,f=e.bytesReceived,_=e.framesDecoded;e.roundTripTime;var v=e.jitterBufferDelay,m=e.jitterBufferEmittedCount,E=e.mimeType,S=e.firCount,g=e.availableIncomingBitrate,y=e.availableOutgoingBitrate,b=e.bytesSent,T=e.nominated,I=e.id,R=e.currentRoundTripTime,A=e.state,C=e.writable,O=e.candidateType,N=e.ip,w=e.address,D=e.networkType,k=e.port,P=e.nackCount,M=e.pliCount,U=e.protocol,L=e.requestsReceived,x=e.responsesReceived,V=e.requestsSent,B=e.consentRequestsSent,j=e.responsesSent,F=e.ssrc;e.totalRoundTripTime;var G=e.kind,H=e.jitter,z=e.framesReceived,Y=e.keyFramesDecoded,K=e.totalDecodeTime,X=e.decoderImplementation,W=e.lastPacketReceivedTimestamp;"inbound-rtp"===i?(n.packetsLost=l,u.packets_lost=l,n.packetsReceived=h,u.packets=h,n.bytesReceived=f,u.bytes=f,n.framesDecoded=_,void 0!==v&&(n.jitterBufferDelay=v/m*1e3,u.jitter_buffer_delay=n.jitterBufferDelay),u.fir_count=S,u.nack_count=P,u.pli_count=M,u.ssrc=F,u.jitter=H,u.frames_received=z,u.frames_decoded=_,u.key_frames_decoded=Y,u.total_decode_time=K,u.decoder_implementation=X,u.last_packet_received_timestamp=W,_>0&&p._firstFrameStarted["".concat(o,"-video")]&&(DU.rtcFirstFrame({event_type:tU.RECV_END,media_type:s?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.SUBSCRIBE,event_session_id:o,result:!0,start:t.videoStart,stream_user_id:a}),delete p._firstFrameStarted["".concat(o,"-video")])):"track"===i&&"video"===G?(r.width=d,u.frame_size_width=d,r.height=c,u.frame_size_height=c,void 0!==z&&(u.frames_received=z)):"codec"===i?u.codec=E:"candidate-pair"===i?(u.ice_available_incoming_bitrate=g,u.ice_available_outgoing_bitrate=y,u.ice_bytes_received=f,u.ice_bytes_sent=b,u.ice_nominated=+T,u.ice_pair_id=I,u.ice_pair_rtt=R,u.rtt=1e3*R,r.rtt=u.rtt,u.ice_pair_state=A,u.ice_pair_writable=C,u.recv_ping_requests=L,u.recv_ping_responses=x,u.sent_ping_requests_before_first_response=V,u.sent_ping_requests_total=V+(B||0),u.sent_ping_responses=j):"local-candidate"===i?(u.local_candidate_type=O,u.local_ip=N||w,u.local_network_type=D,u.local_port=k,u.protocol=U):"remote-candidate"===i&&(u.remote_candidate_type=O,u.remote_ip=N||w,u.remote_port=k)})),l=t.video,h=t.remoteStream,l.timestamp?(r.videoLossRate=(n.packetsLost-l.packetsLost)/(n.packetsReceived-l.packetsReceived+(n.packetsLost-l.packetsLost)),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,u.fraction_lost=r.videoLossRate,u.packets_lost_rate=r.videoLossRate,r.statsInterval=n.timestamp-l.timestamp,r.receivedKBitrate=(n.bytesReceived-l.bytesReceived||0)/r.statsInterval,u.bitrate=Math.round(8e3*r.receivedKBitrate),u.bandwidth=Math.round(u.bitrate/1024),r.decoderOutputFrameRate=1e3*(n.framesDecoded-l.framesDecoded)/r.statsInterval,u.frame_rate_decoded=Math.round(r.decoderOutputFrameRate),u.frame_rate_received=u.frame_rate_decoded,t.video=n,this.dataChannelRTT[t.remoteStream.userId]&&(f=this.dataChannelRTT[t.remoteStream.userId]/2,r.e2eDelay=f+(n.jitterBufferDelay||0),u.web_e2e_delay=r.e2eDelay,u.total_rtt_ms=f),h.subVideo&&(this.processStall(h,u),DU.rtcMediaStatistics(u,{})),[2,r]):(t.video=n,[2,r])):[2,r]}}))}))},e.prototype.processStall=function(e,t){var r=0,n=0,i=0;e.recordedVideoFrames.forEach((function(e){e.isStall&&(r+=e.stallCount,n+=e.stallDuration),i=e.playTime})),e.recordedVideoFrames.length||(n=2e3,r=this._videoInWaiting[e.streamId]?0:1,this._videoInWaiting[e.streamId]=!0);var o=e.recordedVideoFrames.pop();o&&(o.isStall?this._videoInWaiting[e.streamId]=!0:this._videoInWaiting[e.streamId]=!1),e.recordedVideoFrames=[],t.stall_count=r,t.stall_duration=n,t.play_time=i},e.prototype.setLocalStreamStatsEvtInterval=function(e){var t,r,n=this,i={audio:{},video:{},localStream:e,firstframeReported:!1},o=null===(t=e.audioTrack)||void 0===t?void 0:t.getTrack(),a=null===(r=e.videoTrack)||void 0===r?void 0:r.getTrack();this.getAudioStats(o,i),this.getVideoStats(a,i),this.delLocalStreamStatsEvtInterval(e);this._localStreamStasEvtIntervals[e.streamId]=setInterval((function(){return Pp(n,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:return[4,Pp(n,void 0,void 0,(function(){var t,r,n,o,a,s;return Mp(this,(function(c){switch(c.label){case 0:return t=null===(a=e.audioTrack)||void 0===a?void 0:a.getTrack(),r=null===(s=e.videoTrack)||void 0===s?void 0:s.getTrack(),[4,this.getAudioStats(t,i)];case 1:return n=c.sent(),[4,this.getVideoStats(r,i)];case 2:return(o=c.sent()).isScreen=e.isScreen,[2,{audioStats:n,videoStats:o,isScreen:e.isScreen}]}}))}))];case 1:return t=r.sent(),this._client.emit("onLocalStreamStats",t),[2]}}))}))}),2e3)},e.prototype.delLocalStreamStatsEvtInterval=function(e){clearInterval(this._localStreamStasEvtIntervals[e.streamId])},e.prototype.unpublish=function(e){this.delLocalStreamStatsEvtInterval(e),this._firstFrameStarted["".concat(e.streamId,"-audio")]&&(DU.rtcFirstFrame({event_type:tU.SENT_END,media_type:e.isScreen?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-audio")],event_session_id:e.streamId,result:!1,reason:iU.UNPUBLISH}),delete this._firstFrameStarted["".concat(e.streamId,"-audio")]),this._firstFrameStarted["".concat(e.streamId,"-video")]&&(DU.rtcFirstFrame({event_type:tU.SENT_END,media_type:e.isScreen?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-video")],event_session_id:e.streamId,result:!1,reason:iU.UNPUBLISH}),delete this._firstFrameStarted["".concat(e.streamId,"-video")])},e.prototype.getAudioStats=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l=this;return Mp(this,(function(h){switch(h.label){case 0:return r={},n={timestamp:Date.now()},i=t.localStream,o=i.streamId,a=i.audioMid,s=i.isScreen,c={media_type:"audio",direction:"up",stream_id:o,vid:a},e&&this._handler?(t.audioStart||(t.audioStart=qw(),DU.rtcFirstFrame({event_type:tU.BEGIN_SEND,media_type:s?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.PUBLISH,start:t.audioStart,event_session_id:o}),this._firstFrameStarted["".concat(o,"-audio")]=t.audioStart),[4,this._handler.getStats(e)]):[2,r];case 1:return(u=h.sent()).length?(u.forEach((function(e){var i=e.type,a=e.packetsSent,u=e.packetsLost,d=e.bytesSent,h=e.clockRate,f=e.roundTripTime,p=e.channels,_=e.audioLevel,v=e.googRtt,m=e.mimeType,E=e.availableIncomingBitrate,S=e.availableOutgoingBitrate,g=e.bytesReceived,y=e.nominated,b=e.id,T=e.currentRoundTripTime,I=e.state,R=e.writable,A=e.requestsReceived,C=e.responsesReceived,O=e.requestsSent,N=e.consentRequestsSent,w=e.responsesSent,D=e.jitter,k=e.candidateType,P=e.ip,M=e.address,U=e.networkType,L=e.port,x=e.protocol,V=e.nackCount,B=e.retransmittedBytesSent,j=e.retransmittedPacketsSent,F=e.roundTripTimeMeasurements,G=e.audioInputLevel,H=e.ssrc,z=e.totalAudioEnergy,Y=e.totalSamplesDuration,K=e.mediaType;"outbound-rtp"===i?(n.packetsSent=a,a>0&&l._firstFrameStarted["".concat(o,"-audio")]&&(DU.rtcFirstFrame({event_type:tU.SENT_END,media_type:s?rU.SCREEN_AUDIO:rU.AUDIO,type:nU.PUBLISH,event_session_id:o,result:!0,start:t.audioStart}),delete l._firstFrameStarted["".concat(o,"-audio")]),n.bytesSent=d,c.bytes=d,c.packets=a,c.nack_count=V,c.ssrc=H,c.retransmitted_bytes_sent=B,c.retransmitted_packets_sent=j):"remote-inbound-rtp"===i?(n.packetsLost=u,c.packets_lost=u,c.jitter=1e3*D,r.rtt=1e3*f,c.rtt=r.rtt,c.round_trip_time_measurements=F):"codec"===i?(r.recordSampleRate=h,r.numChannels=p,c.codec=m):"media-source"===i?(c.audio_level=-10*Math.log10(Math.pow(_,2)),c.volume=255*_,c.total_audio_energy=z,c.total_samples_duration=Y):"ssrc"===i&&"audio"===K?(c.audio_network_elapse=v,c.send_level=G):"candidate-pair"===i?(c.ice_available_incoming_bitrate=E,c.ice_available_outgoing_bitrate=S,c.ice_bytes_received=g,c.ice_bytes_sent=d,c.ice_nominated=+y,c.ice_pair_id=b,c.ice_pair_rtt=T,c.ice_pair_state=I,c.ice_pair_writable=R,c.recv_ping_requests=A,c.recv_ping_responses=C,c.sent_ping_requests_before_first_response=O,c.sent_ping_requests_total=O+(N||0),c.sent_ping_responses=w):"local-candidate"===i?(c.local_candidate_type=k,c.local_ip=P||M,c.local_network_type=U,c.local_port=L,c.protocol=x):"remote-candidate"===i&&(c.remote_candidate_type=k,c.remote_ip=P||M,c.remote_port=L)})),(d=t.audio).timestamp?(void 0!==n.packetsLost&&(r.audioLossRate=(n.packetsLost-d.packetsLost)/(n.packetsSent-d.packetsSent),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,c.fraction_lost=r.audioLossRate),r.statsInterval=n.timestamp-d.timestamp,r.sentKBitrate=(n.bytesSent-d.bytesSent||0)/r.statsInterval,c.bitrate=Math.round(8e3*r.sentKBitrate),c.bandwidth=Math.round(c.bitrate/1024),t.audio=n,DU.rtcMediaStatistics(c,{}),[2,r]):(t.audio=n,[2,r])):[2,r]}}))}))},e.prototype.getVideoStats=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l=this;return Mp(this,(function(h){switch(h.label){case 0:return r={},n={timestamp:Date.now()},i=t.localStream,o=i.streamId,a=i.videoMid,s=i.isScreen,c={media_type:"video",direction:"up",stream_id:o,vid:a},e&&this._handler?(t.videoStart||(t.videoStart=qw(),DU.rtcFirstFrame({event_type:tU.BEGIN_SEND,media_type:s?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.PUBLISH,start:t.videoStart,event_session_id:o}),this._firstFrameStarted["".concat(o,"-video")]=t.videoStart),[4,this._handler.getStats(e)]):[2,r];case 1:return(u=h.sent()).length?(u.forEach((function(e){var i=e.type,a=e.framesEncoded,u=e.packetsLost,d=e.bytesSent,h=e.framesSent,f=e.roundTripTime,p=e.mimeType,_=e.frameWidth,v=e.frameHeight,m=e.clockRate,E=e.packetsSent,S=e.googActualEncBitrate,g=e.googAvailableReceiveBandwidth,y=e.googAvailableSendBandwidth,b=e.googAvgEncodeMs,T=e.googBucketDelay,I=e.googEncodeUsagePercent,R=e.googFrameRateInput,A=e.availableIncomingBitrate,C=e.availableOutgoingBitrate,O=e.bytesReceived,N=e.nominated,w=e.id,D=e.currentRoundTripTime,k=e.state,P=e.writable,M=e.candidateType,U=e.ip,L=e.address,x=e.networkType,V=e.port,B=e.nackCount,j=e.pliCount,F=e.protocol,G=e.qpSum,H=e.requestsReceived,z=e.responsesReceived,Y=e.googRetransmitBitrate,K=e.requestsSent,X=e.consentRequestsSent,W=e.responsesSent,q=e.ssrc,J=e.googTargetEncBitrate,Z=e.googTransmitBitrate,$=e.googRtt,Q=e.retransmittedPacketsSent,ee=e.encoderImplementation,te=e.jitter;"outbound-rtp"===i?(n.framesEncoded=a,n.bytesSent=d,c.bytes=d,n.packetsSent=E,c.packets=E,c.nack_count=B,c.pli_count=j,c.qp_sum=G,c.ssrc=q,c.retransmitted_packets_sent=Q,c.encoder_implementation=ee):"track"===i?(h&&(n.framesSent=h,h>0&&l._firstFrameStarted["".concat(o,"-video")]&&(t.firstframeVideoReported=!0,DU.rtcFirstFrame({event_type:tU.SENT_END,media_type:s?rU.SCREEN_VIDEO:rU.VIDEO,type:nU.PUBLISH,start:t.videoStart,event_session_id:o,result:!0}),delete l._firstFrameStarted["".concat(o,"-video")])),r.encodedFrameWidth=_,r.encodedFrameHeight=v,c.frame_size_height=v,c.frame_size_width=_):"remote-inbound-rtp"===i?(n.packetsLost=u,r.rtt=1e3*f,c.rtt=r.rtt,c.jitter=te,c.packets_lost=u):"codec"===i?(r.codecType=p,c.codec=p,r.inputFrameRate=m):"candidate-pair"===i?(c.ice_available_incoming_bitrate=A,c.ice_available_outgoing_bitrate=C,c.ice_bytes_received=O,c.ice_bytes_sent=d,c.ice_nominated=+N,c.ice_pair_id=w,c.ice_pair_rtt=D,c.ice_pair_state=k,c.ice_pair_writable=P,c.recv_ping_requests=H,c.recv_ping_responses=z,c.sent_ping_requests_before_first_response=K,c.sent_ping_requests_total=K+X,c.sent_ping_responses=W):"local-candidate"===i?(c.local_candidate_type=M,c.local_ip=U||L,c.local_network_type=x,c.local_port=V,c.protocol=F):"remote-candidate"===i?(c.remote_candidate_type=M,c.remote_ip=U||L,c.remote_port=V):"VideoBwe"===i?(c.actual_enc_bitrate=S,c.available_receive_bandwidth=g,c.available_send_bandwidth=y,c.bucket_delay=T,c.retransmit_bitrate=Y,c.target_enc_bitrate=J,c.transmit_bitrate=Z):"ssrc"===i&&(c.video_network_elapse=$,c.avg_encode_ms=b,c.encode_usage_percent=I,c.frame_rate_input=R)})),(d=t.video).timestamp?(r.statsInterval=n.timestamp-d.timestamp,r.encodedFrameCount=void 0!==n.framesSent?n.framesSent-d.framesSent:n.framesEncoded-d.framesEncoded,r.sentKBitrate=(n.bytesSent-d.bytesSent||0)/r.statsInterval,c.bitrate=Math.round(8e3*r.sentKBitrate),c.bandwidth=Math.round(c.bitrate/1024),r.encoderOutputFrameRate=1e3*(n.framesEncoded-d.framesEncoded)/r.statsInterval,c.frame_rate_encoded=Math.round(r.encoderOutputFrameRate),r.sentFrameRate=1e3*r.encodedFrameCount/r.statsInterval,c.frame_rate_sent=Math.round(r.sentFrameRate),r.videoLossRate=(n.packetsLost-d.packetsLost)/(n.packetsSent-d.packetsSent),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,c.fraction_lost=r.videoLossRate,t.video=n,DU.rtcMediaStatistics(c,{}),[2,r]):(t.video=n,[2,r])):[2,r]}}))}))},e.prototype.getDataChannelRTT=function(e){var t,r=this,n=qw();null===(t=this._client.sendUserMessage(e,"__web__rtc__rtt__"))||void 0===t||t.then((function(t){if("timeout"!==t){var i=Date.now()-n;i>0&&i<2e3&&(r.dataChannelRTT[e]=i)}else clearTimeout(r._rttTimer[e])})).catch((function(){clearTimeout(r._rttTimer[e])})),clearTimeout(this._rttTimer[e]),this._rttTimer[e]=setTimeout((function(){r.getDataChannelRTT(e)}),2e3)},e.prototype.destroy=function(){var e=this;Object.keys(this._localStreamStasEvtIntervals).forEach((function(t){clearInterval(e._localStreamStasEvtIntervals[t])})),Object.keys(this._remoteStreamStasEvtIntervals).forEach((function(t){clearInterval(e._remoteStreamStasEvtIntervals[t])})),Object.keys(this._rttTimer).forEach((function(t){clearTimeout(e._rttTimer[t])})),this._rttTimer={},this.dataChannelRTT={},this._videoInWaiting={}},e}(),VL=new CD("MediaServerClient",2);!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(LL||(LL={}));var BL=function(e,t){VL.print(e,"userId: %o, subAudio: %o, subVideo: %o, paused: %o, audioMid: %o, videoMid: %o, workaround_1_: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.paused,t.audioMid,t.videoMid,t._workaround_1_,t.sequenceId)},jL=function(e){function t(){var t=e.call(this)||this;return t._ontrackCallbackMap=new Map,t._pubSubLock=new PL("pubSubLock"),t._joinLeaveLock=new PL("joinLeaveLock"),t._state=LL.DISCONNECTED,t._roomAttributes={multiChatMode:!1,bigRoomMode:!1},t}return wp(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){VL.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(TU.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[bU.ON_ADD_STREAM,bU.ON_REMOVE_STREAM,bU.USER_CONNECTION,bU.USER_DISCONNECTION,bU.ON_UPDATE_STREAM_ATTRIBUTES,bU.ON_UPDATE_ROOM_ATTRIBUTES,bU.ON_PUSH_TRACK,bU.ON_REMOVE_TRACK,bU.NODE_CHANGE,bU.ON_CUSTOM_MESSAGE,bU.USER_MESSAGE_RECEIVED,bU.USER_BINARY_MESSAGE_RECEIVED,bU.POST_PROCESSING_MESSAGE].forEach((function(e){var r;null===(r=t._dataChannelSignal)||void 0===r||r.on(e,(function(r){t.safeEmit(e,r)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){VL.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(TU.ABNORMAL_DISCONNECTION)}))},t.prototype._removeSignalEventHandler=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()},Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(TU.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.join=function(e,t,r,n){var i,o;return void 0===t&&(t={}),void 0===r&&(r=!1),Pp(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,f,p=this;return Mp(this,(function(_){switch(_.label){case 0:return VL.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,r,n),this._appId=e.appId,this._token=e.token,this._roomId=e.roomId,this._clientId=e.userInfo.userId,this._businessId=e.userInfo.businessId,this._userInfo=e.userInfo,this._sessionId=Yw(),PU.setStats({rtc_session_id:this._sessionId}),this.connectionState=LL.CONNECTING,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),t.node?(a=t.node,xU("es.join.nodeChange",t),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return p.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new WU,[4,null===(i=this._iceConfigRequestManager)||void 0===i?void 0:i.getAccessNode(this._appId,this._roomId,this._clientId,KU.getDeviceId(),null==t?void 0:t.reason,this._prevICENode)];case 2:if(!(a=_.sent()))throw xU("es.join.getNodeFailed",""),new XN(HN.ICE_SERVER_WRONG,"get ICE config failed");xU("es.join.getNodeSuccess",a),_.label=3;case 3:this._prevICENode=a,this._handler=new wL,this._addHandlerEvents(),this._statsReport=new xL(this,this._handler),Promise.resolve().then((function(){return p.emit("onEstablishConnectionHook")})),_.label=4;case 4:return _.trys.push([4,6,,7]),[4,this._handler.connect(a)];case 5:return s=_.sent(),VL.print("join","establish peerConnection success"),[3,7];case 6:throw c=_.sent(),this.connectionState=LL.DISCONNECTED,new XN(HN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",c);case 7:return this._dataChannelSignal=new GU(s),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[4,null===(o=this._handler)||void 0===o?void 0:o.getDefaultSdp()];case 8:u=_.sent(),d={Authorization:$w.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId,timestamp:Date.now(),controlMessage:n,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role},params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:fk.VERSION,deviceId:KU.getDeviceId(),appId:this._appId,roomId:this._roomId,userId:this._clientId,businessId:this._businessId},options:{enableUnBundleMode:!0},sdpInfo:u},Promise.resolve().then((function(){return p.emit("onSendingJoinMessageHook")})),_.label=9;case 9:return _.trys.push([9,11,,12]),l=r?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(l,d)];case 10:return h=_.sent(),VL.print("join","send join message success"),this._authorization=d.Authorization,this.connectionState=LL.CONNECTED,[2,h];case 11:if(f=_.sent(),this.connectionState=LL.DISCONNECTED,705===(null==f?void 0:f.code))throw new XN(HN.INVALID_TOKEN,(null==f?void 0:f.message)||"Invalid token");if(200!==(null==f?void 0:f.code))throw new XN(HN.JOIN_ROOM_FAILED,(null==f?void 0:f.message)||"Join room failed");return[3,12];case 12:return[2]}}))}))},t.prototype.publish=function(e){var t,r,n,i,o,a,s,c;return Pp(this,void 0,void 0,(function(){var u,d,l,h,f,p,_,v,m,E,S;return Mp(this,(function(g){switch(g.label){case 0:VL.print("publish()","localStream: %o",e),u=e.videoTrack,d=e.audioTrack,l=qw(),h="",f="",p="",g.label=1;case 1:return g.trys.push([1,5,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e)];case 2:if(!(_=g.sent()))throw new XN(HN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return h=_.audioMid,f=_.videoMid,p=_.sdp,e.pubAttributes={localaudio:!!d,localvideo:!!u,videostream:!!(null===(r=null==u?void 0:u.getTrack())||void 0===r?void 0:r.enabled),audiostream:!!(null===(n=null==d?void 0:d.getTrack())||void 0===n?void 0:n.enabled)},v={attributes:Dp({videoDescriptions:_.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:h,videoMid:f,sdpInfo:{msid:e.stream.id,type:_.type,sdp:_.partialSdp,semantics:_.semantics}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("publish",v)];case 3:if(200!==(null==(m=g.sent())?void 0:m.code))throw new XN(HN.PUBLISH_FAILED,(null==m?void 0:m.message)||"publish failed");return E=null===(o=null==m?void 0:m.relayMessage)||void 0===o?void 0:o.sdp,[4,null===(a=this._handler)||void 0===a?void 0:a.setAnswerSdp(_.sdp,E,void 0,e,KM.UP)];case 4:return g.sent(),e.streamId=m.streamId,e.videoMid=f,e.audioMid=h,DU.rtcPublishStat(qM.SUCCESS,JM.W_0,l,ZM.UNKNOWN),null===(s=this._statsReport)||void 0===s||s.setLocalStreamStatsEvtInterval(e),[2];case 5:return(S=g.sent())instanceof Error&&DU.rtcPublishStat(qM.FAIL,JM.W_0,l,S.message),h&&f?[4,null===(c=this._handler)||void 0===c?void 0:c.rollback(p,[h,f])]:[3,7];case 6:g.sent(),g.label=7;case 7:throw S;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,r,n,i,o,a;return Pp(this,void 0,void 0,(function(){var s,c,u,d,l,h,f,p,_,v,m,E,S,g,y,b;return Mp(this,(function(T){switch(T.label){case 0:VL.print("updatePubTrack()","localStream: %o",e),s=e.videoTrack,c=e.audioTrack,null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack((null==s?void 0:s.getTrack())||null),c?(u=c.mixType,d=c.mixedAudioTrack,l=null==c?void 0:c.getTrack(),d&&u!==yL.PLAYOUT&&!0===l.enabled&&(l=d),null===(r=e.audioTransceiver)||void 0===r||r.sender.replaceTrack(l)):null===(n=e.audioTransceiver)||void 0===n||n.sender.replaceTrack(null),h={localaudio:!!c,localvideo:!!s,videostream:!!(null===(i=null==s?void 0:s.getTrack())||void 0===i?void 0:i.enabled),audiostream:!!(null===(o=null==c?void 0:c.getTrack())||void 0===o?void 0:o.enabled)},f={};try{for(p=Up(Object.entries(h)),_=p.next();!_.done;_=p.next())v=Lp(_.value,2),m=v[0],(E=v[1])!==Reflect.get(e.pubAttributes,m)&&Reflect.set(f,m,E)}catch(e){y={error:e}}finally{try{_&&!_.done&&(b=p.return)&&b.call(p)}finally{if(y)throw y.error}}return Object.keys(f).length?(e.pubAttributes=h,S={roomId:this._roomId,streamId:e.streamId,attributes:f},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateStreamAttributes",S)]):[2];case 1:if(200!==(null==(g=T.sent())?void 0:g.code))throw new XN(HN.UPDATE_TRACK_FAILED,(null==g?void 0:g.message)||"update track failed");return[2]}}))}))},t.prototype.unpublish=function(e){var t,r,n;return Pp(this,void 0,void 0,(function(){var i,o;return Mp(this,(function(a){switch(a.label){case 0:return VL.print("unpublish()","localStream: %o",e),i={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unpublish",i)];case 1:if(200!==(null==(o=a.sent())?void 0:o.code))throw new XN(HN.UNPUBLISH_FAILED,(null==o?void 0:o.message)||"unpublish failed");return[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 2:return a.sent(),null===(n=this._statsReport)||void 0===n||n.unpublish(e),[2]}}))}))},t.prototype.subscribe=function(e,t,r){var n,i,o,a,s,c,u,d,l;return Pp(this,void 0,void 0,(function(){var h,f,p,_,v,m,E,S,g,y,b,T,I,R,A,C,O,N,w,D;return Mp(this,(function(k){switch(k.label){case 0:if(e.hasSubscribed)return[2,this._updateSubTrack(e,t,r)];VL.print("subscribe()","mediaType: %o, config: %o",t,r),BL("subscribe()",e),h=!1,f=!1,t===ik.VIDEO_ONLY?h=!0:t===ik.AUDIO_ONLY?f=!0:t===ik.AUDIO_AND_VIDEO?(h=!0,f=!0):t===ik.NONE&&(h=!1,f=!1),p=qw(),_=e.audioMid,v=e.videoMid,E=!1,k.label=1;case 1:return k.trys.push([1,12,,15]),_&&v?(E=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e,{audioMid:_,videoMid:v})]):[3,3];case 2:return m=k.sent(),[3,5];case 3:return[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e)];case 4:if(!(m=k.sent()))throw new XN(HN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,k.label=5;case 5:return S={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:v,audioMid:_,sdpInfo:{sdp:null==m?void 0:m.partialSdp,semantics:null==m?void 0:m.semantics,type:null==m?void 0:m.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||f,video:h},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("subscribe",S)];case 6:if(200!==(null==(g=k.sent())?void 0:g.code))throw new XN(HN.SUBSCRIBE_FAILED,(null==g?void 0:g.message)||"subscribe failed");return y=[],b=!this._multiChatMode(),!(_&&v)&&y.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new XN(HN.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(i){"video"===i.mediaType&&(VL.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),b&&y.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new XN(HN.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(VL.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),T=function(t){e.ontrack(t)},null===(a=this._handler)||void 0===a||a.on("ontrack",T),this._ontrackCallbackMap.set(e,T),I=null==g?void 0:g.relayMessage,R=I.audioMid,A=I.videoMid,C=I.sequenceId,O=I.sdp,E&&_!==R?(VL.print("subscribe","mid mot match",_,R),[4,null===(s=this._handler)||void 0===s?void 0:s.closeMLine([_,v])]):[3,9];case 7:return k.sent(),[4,null===(c=this._handler)||void 0===c?void 0:c.subscribe(e)];case 8:if(!(m=k.sent()))throw new XN(HN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,k.label=9;case 9:return(D={})[_]=R,D[v]=A,N=D,e.videoMid=A,e.audioMid=R,e.sequenceId=C,e.subConfig=r,e._workaround_1_=!1,e.paused=!1,e.subMediaType=t,e.hasSubscribed=!0,[4,null===(u=this._handler)||void 0===u?void 0:u.setAnswerSdp(null==m?void 0:m.sdp,O,N,e,KM.DOWN)];case 10:return k.sent(),[4,Promise.all(y)];case 11:return k.sent(),this._multiChatMode()||(e.subAudio=f),e.subVideo=h,DU.rtcSubscribeStat($M.SUCCESS,p,QM.UNKNOWN,e.userId),null===(d=this._statsReport)||void 0===d||d.setRemoteStreamStatsEvtInterval(e),[2];case 12:return(w=k.sent())instanceof Error&&DU.rtcSubscribeStat($M.FAIL,p,w.message,e.userId),_&&v?[4,null===(l=this._handler)||void 0===l?void 0:l.rollback(null==m?void 0:m.sdp,[_,v])]:[3,14];case 13:k.sent(),k.label=14;case 14:throw w;case 15:return[2]}}))}))},t.prototype.controlMessage=function(e){var t;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){switch(r.label){case 0:return VL.print("controlMessage()","params: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",Dp(Dp({},e),{roomId:this._roomId}))];case 1:return r.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){switch(r.label){case 0:return VL.print("updateUserAttributes()","attributes: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:e})];case 1:return r.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(n){return[2,this._updateSubTrack(e,t,r)]}))}))},t.prototype._updateSubTrack=function(e,t,r){var n;return Pp(this,void 0,void 0,(function(){var i,o,a,s;return Mp(this,(function(c){switch(c.label){case 0:return VL.print("updateSubTrack()","mediaType: %o, config: %o",t,r),BL("updateSubTrack()",e),i=!1,o=!1,t===ik.VIDEO_ONLY?(i=!0,o=!1):t===ik.AUDIO_ONLY?(o=!0,i=!1):t===ik.AUDIO_AND_VIDEO?(i=!0,o=!0):t===ik.NONE&&(i=!1,o=!1),a={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:i,audio:!!this._multiChatMode()||o},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateSubscribe",a)];case 1:if(200!==(null==(s=c.sent())?void 0:s.code))throw new XN(HN.UPDATE_TRACK_FAILED,(null==s?void 0:s.message)||"update track failed");return e.paused=!i,this._multiChatMode()||(e.subAudio=o),e.subVideo=i,e.subMediaType=t,e.subConfig=r,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var r,n,i,o,a;return Pp(this,void 0,void 0,(function(){var s,c,u,d,l,h,f,p,_,v,m,E,S;return Mp(this,(function(g){switch(g.label){case 0:if(VL.print("subscribe4pushTrack()","streamInfo: %o",t),BL("subscribe4pushTrack()",e),s=null==t?void 0:t.message,c=s.audioMid,u=s.videoMid,d=s.sequenceId,l=s.sdp,e.subAudio=!0,d<e.sequenceId)return VL.print("subscribe4pushTrack","sequenceId return",d,e.sequenceId),[2];h=e.audioMid,f=e.videoMid,g.label=1;case 1:return g.trys.push([1,8,,11]),h&&f?[4,null===(r=this._handler)||void 0===r?void 0:r.subscribe(e,{audioMid:h,videoMid:f})]:[3,3];case 2:return p=g.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(p=g.sent()))throw new XN(HN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");h=p.audioMid,f=p.videoMid,g.label=5;case 5:return(S={})[h]=c,S[f]=u,_=S,VL.print("onpushtrack midmap",e.userId,_),e.audioMid=c,e.videoMid=u,e.sequenceId=d,v=[],e.audioTrack||v.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new XN(HN.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(VL.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),m=function(t){e.ontrack(t)},null===(i=this._handler)||void 0===i||i.on("ontrack",m),this._ontrackCallbackMap.set(e,m),[4,null===(o=this._handler)||void 0===o?void 0:o.setAnswerSdp(null==p?void 0:p.sdp,l,_,e,KM.DOWN)];case 6:return g.sent(),[4,Promise.all(v)];case 7:return g.sent(),[2];case 8:return E=g.sent(),p?[4,null===(a=this._handler)||void 0===a?void 0:a.rollback(null==p?void 0:p.sdp,[h,f])]:[3,10];case 9:g.sent(),g.label=10;case 10:throw E;case 11:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var r;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(n){switch(n.label){case 0:return BL("unsubscribe4removeTrack()",e),VL.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(VL.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])]);case 1:return n.sent(),VL.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),[2]}}))}))},t.prototype.unsubscribe=function(e){var t,r,n;return Pp(this,void 0,void 0,(function(){var i;return Mp(this,(function(o){switch(o.label){case 0:BL("unsubscribe()",e),i={roomId:this._roomId,streamId:e.streamId,userId:e.userId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unsubscribe",i)];case 2:case 3:return o.sent(),[3,4];case 4:return e.hasSubscribed=!1,e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),e.subAudio?[3,6]:[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 5:o.sent(),VL.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(n=this._statsReport)||void 0===n||n.unsubscribe(e),o.label=6;case 6:return[2]}}))}))},t.prototype.removeOnTrackListener=function(e){var t,r=this._ontrackCallbackMap.get(e);r&&(null===(t=this._handler)||void 0===t||t.off("ontrack",r),this._ontrackCallbackMap.delete(e))},t.prototype.handleRemoveStream=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){return BL("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==yU.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this.unsubscribe(e),[2]}))}))},t.prototype.leave=function(){var e;return Pp(this,void 0,void 0,(function(){var t,r;return Mp(this,(function(n){switch(n.label){case 0:return VL.print("leave()"),(this.connectionState=LL.CONNECTED)?(this.connectionState=LL.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]):[3,7];case 1:r=n.sent(),n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("leaveRoom",t)];case 3:case 4:return n.sent(),[3,6];case 5:return r(),[7];case 6:return[3,8];case 7:return[2,Promise.resolve()];case 8:return[2]}}))}))},t.prototype.destroy=function(){var e,t,r,n;VL.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(r=this._iceConfigRequestManager)||void 0===r||r.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),null===(n=this._statsReport)||void 0===n||n.destroy(),this.connectionState=LL.DISCONNECTED,this.emit("INTERRUPT")},t.prototype.sendUserMessage=function(e,t){var r;return null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})},t.prototype.sendRoomMessage=function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)},t.prototype._multiChatMode=function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode},Object.defineProperty(t.prototype,"handler",{get:function(){return this._handler},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomAttributes",{set:function(e){this._roomAttributes=e},enumerable:!1,configurable:!0}),kp([HL],t.prototype,"join",null),kp([GL,FL],t.prototype,"publish",null),kp([GL,FL],t.prototype,"updatePubTrack",null),kp([GL,FL],t.prototype,"unpublish",null),kp([GL,FL],t.prototype,"subscribe",null),kp([FL],t.prototype,"controlMessage",null),kp([FL],t.prototype,"updateUserAttributes",null),kp([GL,FL],t.prototype,"updateSubTrack",null),kp([GL,FL],t.prototype,"subscribe4pushTrack",null),kp([GL,FL],t.prototype,"unsubscribe4removeTrack",null),kp([GL,FL],t.prototype,"unsubscribe",null),kp([GL,FL],t.prototype,"handleRemoveStream",null),t}(ND);function FL(e,t,r){var n=r.value;return r.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){switch(r.label){case 0:return this._handler&&this._state===LL.CONNECTED?[4,n.apply(this,e)]:[3,2];case 1:return r.sent(),[3,3];case 2:throw new XN(HN.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},r}function GL(e,t,r){var n=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Pp(this,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:return[4,this._pubSubLock.lock()];case 1:t=r.sent(),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,n.apply(this,e)];case 3:return[2,r.sent()];case 4:return t(),[7];case 5:return[2]}}))}))},r}function HL(e,t,r){var n=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Pp(this,void 0,void 0,(function(){var t,r=this;return Mp(this,(function(i){return t=!1,[2,new Promise((function(i,o){return Pp(r,void 0,void 0,(function(){var r,a;return Mp(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new XN(HN.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.apply(this,e)];case 2:return r=s.sent(),i(r),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},r}var zL=T,YL=Sc,KL=lv.exports.getWeakData,XL=Dt,WL=F,qL=Cc,JL=cu,ZL=Ue,$L=br.set,QL=br.getterFor,ex=Pi.find,tx=Pi.findIndex,rx=zL([].splice),nx=0,ix=function(e){return e.frozen||(e.frozen=new ox)},ox=function(){this.entries=[]},ax=function(e,t){return ex(e.entries,(function(e){return e[0]===t}))};ox.prototype={get:function(e){var t=ax(this,e);if(t)return t[1]},has:function(e){return!!ax(this,e)},set:function(e,t){var r=ax(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=tx(this.entries,(function(t){return t[0]===e}));return~t&&rx(this.entries,t,1),!!~t}};var sx,cx={getConstructor:function(e,t,r,n){var i=e((function(e,i){qL(e,o),$L(e,{type:t,id:nx++,frozen:void 0}),null!=i&&JL(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=QL(t),s=function(e,t,r){var n=a(e),i=KL(XL(t),!0);return!0===i?ix(n).set(t,r):i[n.id]=r,e};return YL(o,{delete:function(e){var t=a(this);if(!WL(e))return!1;var r=KL(e);return!0===r?ix(t).delete(e):r&&ZL(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!WL(e))return!1;var r=KL(e);return!0===r?ix(t).has(e):r&&ZL(r,t.id)}}),YL(o,r?{get:function(e){var t=a(this);if(WL(e)){var r=KL(e);return!0===r?ix(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),i}},ux=n,dx=T,lx=Sc,hx=lv.exports,fx=Qv,px=cx,_x=F,vx=Ev,mx=br.enforce,Ex=er,Sx=!ux.ActiveXObject&&"ActiveXObject"in ux,gx=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},yx=fx("WeakMap",gx,px);if(Ex&&Sx){sx=px.getConstructor(gx,"WeakMap",!0),hx.enable();var bx=yx.prototype,Tx=dx(bx.delete),Ix=dx(bx.has),Rx=dx(bx.get),Ax=dx(bx.set);lx(bx,{delete:function(e){if(_x(e)&&!vx(e)){var t=mx(this);return t.frozen||(t.frozen=new sx),Tx(this,e)||t.frozen.delete(e)}return Tx(this,e)},has:function(e){if(_x(e)&&!vx(e)){var t=mx(this);return t.frozen||(t.frozen=new sx),Ix(this,e)||t.frozen.has(e)}return Ix(this,e)},get:function(e){if(_x(e)&&!vx(e)){var t=mx(this);return t.frozen||(t.frozen=new sx),Ix(this,e)?Rx(this,e):t.frozen.get(e)}return Rx(this,e)},set:function(e,t){if(_x(e)&&!vx(e)){var r=mx(this);r.frozen||(r.frozen=new sx),Ix(this,e)?Ax(this,e,t):r.frozen.set(e,t)}else Ax(this,e,t);return this}})}var Cx=function(e){function t(){var t=e.call(this)||this;return t._hasVideoPermission=!1,t._hasAudioPermission=!1,t.inited=!1,t.deviceMap=new Map,t._handleDeviceChange=t._handleDeviceChange.bind(t),!Zw()&&t.refreshDevices(),t}return wp(t,e),t.prototype.refreshDevices=function(){return Pp(this,void 0,void 0,(function(){var e=this;return Mp(this,(function(t){switch(t.label){case 0:return navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2];case 1:return t.sent().filter((function(e){return""!==e.deviceId})).forEach((function(t){e.deviceMap.set(t.deviceId,{deviceName:t.label,deviceInfo:t,deviceId:t.deviceId,deviceType:t.kind,deviceState:"active"})})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){return"function"==typeof(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",this._handleDeviceChange),[2]}))}))},t.prototype._handleDeviceChange=function(){return Pp(this,void 0,void 0,(function(){var e,t,r=this;return Mp(this,(function(n){switch(n.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return e=n.sent(),t=Array.from(this.deviceMap.values()),e.forEach((function(e){var t=r.deviceMap.get(e.deviceId);r.deviceMap.set(e.deviceId,{deviceName:e.label,deviceType:e.kind,deviceId:e.deviceId,deviceInfo:e,deviceState:"active"}),t&&"inactive"!==t.deviceState||r.emit("onMediaDeviceStateChanged",{deviceName:e.label,deviceType:e.kind,deviceId:e.deviceId,deviceInfo:e,deviceState:"active"})})),t.forEach((function(t){e.find((function(e){return e.deviceId===t.deviceId}))||(t.deviceState="inactive",r.deviceMap.delete(t.deviceId),r.emit(rD.onMediaDeviceStateChanged,t))})),[2]}}))}))},t.prototype.getVideoPermission=function(){return Pp(this,void 0,void 0,(function(){var e=this;return Mp(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new XN(HN.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasVideoPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasVideoPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasVideoPermission]}}))}))},t.prototype.getAudioPermission=function(){return Pp(this,void 0,void 0,(function(){var e=this;return Mp(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new XN(HN.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasAudioPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasAudioPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasAudioPermission]}}))}))},t.prototype.getDevices=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.getAudioPermission()];case 1:case 2:return e.sent(),[3,3];case 3:return e.trys.push([3,5,,6]),[4,this.getVideoPermission()];case 4:case 5:return e.sent(),[3,6];case 6:return[4,this.refreshDevices()];case 7:return e.sent(),[2,Array.from(this.deviceMap.values()).filter((function(e){return"active"===e.deviceState}))]}}))}))},t.prototype.getMicrophones=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.values()).filter((function(e){return"active"===e.deviceState})).filter((function(e){return"audioinput"===e.deviceType}))]}}))}))},t.prototype.getCameras=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.values()).filter((function(e){return"active"===e.deviceState})).filter((function(e){return"videoinput"===e.deviceType}))]}))}))},t.prototype.getAudioPlayback=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.values()).filter((function(e){return"active"===e.deviceState})).filter((function(e){return"audiooutput"===e.deviceType}))]}))}))},t.prototype.getDeviceById=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return[4,this.getDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},Object.defineProperty(t.prototype,"hasAudioPermission",{get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new XN(HN.NO_PERMISSION,"Cannot revoke audio permission");this.refreshDevices(),this._hasAudioPermission=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasVideoPermission",{get:function(){return this._hasVideoPermission},set:function(e){if(!e)throw new XN(HN.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}(ND),Ox=new Cx,Nx=function(){function e(){}return e.prototype.getAudioContextInstance=function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance},e}(),wx=function(){function e(e){var t=Dx.getAudioContextInstance();this._track=e;var r=new MediaStream;r.addTrack(e);var n=t.createMediaStreamSource(r),i=t.createAnalyser();n.connect(i),this._analyserNode=i}return e.prototype.getAudioLevel=function(){var e=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(e);var t=0;return e.forEach((function(e){return t=Math.max(t,Math.abs(e-128))})),t/128*255},e}(),Dx=new Nx,kx=new CD("VERTC",0),Px=new WeakMap,Mx=function(e){return Px.get(e)},Ux=function(e){function t(t,r){var n=e.call(this)||this;return n._trackId=t,n.mediaType=r,n}return wp(t,e),t.prototype.getId=function(){return this._trackId},t}(ND),Lx=function(e){function t(t,r,n){var i=e.call(this,r,n)||this;return i._mediaTrack=t,i._initListeners(),i}return wp(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t.prototype.close=function(){var e;return null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()},t.prototype._initListeners=function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){DU.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(Ux),xx=function(e){function t(t,r,n){var i=e.call(this,r,n)||this;return i._mediaTrack=t,i}return wp(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(Ux),Vx=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return wp(t,e),t.prototype.updateVideoCaptureConfig=function(){var e;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig?(kx.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.videoCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t}(Lx),Bx=function(e){function t(t,r){var n=e.call(this,t,r,"audio")||this;return n.mixType=yL.PLAYOUT_AND_PUBLISH,n}return wp(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new wx(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.updateAudioCaptureConfig=function(){var e;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(kx.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.audioCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t}(Lx),jx=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return wp(t,e),t}(xx),Fx=function(e){function t(t,r){return e.call(this,t,r,"audio")||this}return wp(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new wx(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(xx),Gx=function(e){function t(t,r){return e.call(this,t,r)||this}return wp(t,e),t}(Bx),Hx=function(e){function t(t,r){return e.call(this,t,r)||this}return wp(t,e),t}(Vx),zx=function(e){function t(t,r){return e.call(this,t,r)||this}return wp(t,e),t}(Vx),Yx=function(e){function t(t,r){return e.call(this,t,r)||this}return wp(t,e),t}(Bx),Kx=function(e){function t(t,r){return e.call(this,t,r)||this}return wp(t,e),t}(Vx),Xx=function(e){function t(t,r){return e.call(this,t,r)||this}return wp(t,e),t}(Bx);function Wx(e){var t;return Pp(this,void 0,void 0,(function(){var r,n,i,o,a,s;return Mp(this,(function(c){switch(c.label){case 0:n=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",c.label=1;case 1:return c.trys.push([1,3,,4]),kx.print("createCameraVideoTrack","constraints:",e),DU.rtcVideoCaptureEvent({event_type:fU.START,media_device_id:n}),i=qw(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return r=c.sent(),DU.rtcVideoCaptureEvent({event_type:fU.START_CAPTURE_RESULT,media_device_id:n,reason:_U.SUCCESS,elapse:qw()-i}),Ox.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),DU.rtcVideoCaptureEvent({event_type:fU.RUNNING_FAILED,media_device_id:n,error_code:o.code,reason:o.message}),new XN(HN.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getVideoTracks()[0],Px.set(a,r),(s=new Hx(a,Ww())).videoCaptureConfig=e,[2,s]}}))}))}function qx(e){var t;return Pp(this,void 0,void 0,(function(){var r,n,i,o,a;return Mp(this,(function(s){switch(s.label){case 0:kx.print("createCameraVideoTrack","constraints:",e),n=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",s.label=1;case 1:return s.trys.push([1,3,,4]),DU.rtcVideoCaptureEvent({event_type:fU.START,media_device_id:n}),i=qw(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return r=s.sent(),DU.rtcVideoCaptureEvent({event_type:fU.START_CAPTURE_RESULT,media_device_id:n,reason:_U.SUCCESS,elapse:qw()-i}),Ox.hasAudioPermission=!0,[3,4];case 3:throw o=s.sent(),DU.rtcVideoCaptureEvent({event_type:fU.RUNNING_FAILED,media_device_id:n,error_code:o.code,reason:o.message}),new XN(HN.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getAudioTracks()[0],Px.set(a,r),[2,new Gx(a,Ww())]}}))}))}function Jx(e){return void 0===e&&(e=!1),Pp(this,void 0,void 0,(function(){var t,r,n;return Mp(this,(function(i){switch(i.label){case 0:kx.print("createScreenStream","withAudio:",e),i.label=1;case 1:return i.trys.push([1,3,,4]),DU.rtcVideoCaptureEvent({event_type:fU.START,media_device_id:"screen"}),r=qw(),[4,navigator.mediaDevices.getDisplayMedia({video:!0,audio:e})];case 2:return t=i.sent(),DU.rtcVideoCaptureEvent({event_type:fU.START_CAPTURE_RESULT,media_device_id:"screen",reason:_U.SUCCESS,elapse:qw()-r}),[3,4];case 3:throw n=i.sent(),DU.rtcVideoCaptureEvent({event_type:fU.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.message}),new XN(HN.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,t]}}))}))}var Zx,$x,Qx=function(){function e(){}return e.getNalunits=function(t){if(t.length-t.position<4)return[];var r=t.position;return 1===t.getInt32(r)||0===t.getInt16(r)&&1===t.getInt8(r+2)?e.getAnnexbNals(t):e.getAvccNals(t)},e.getAnnexbNals=function(t){for(var r=[],n=e.getHeaderPositionAnnexB(t),i=n.pos,o=i;i<t.length-4;){var a=new Uint8Array(t.buffer.slice(i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(i+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&r.push(s),t.skip(o-t.position),i=o}return r},e.getAvccNals=function(t){for(var r=[];t.position<t.length-4;){var n=t.getInt32(t.position);if(!(t.length-t.position>=n))break;var i=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+n));t.skip(n);var a={header:i,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&r.push(a)}return r},e.analyseNal=function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}},e.getHeaderPositionAnnexB=function(e){for(var t=e.position,r=0,n=e.length;3!==r&&4!==r&&t<n-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===n-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=n:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=n)),{pos:t,headerLength:r}},e.getAvcc=function(e,t){var r=new Uint8Array(e.byteLength+t.byteLength+11);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var n=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),n),n+=2,r.set(e,n),r[n+=e.byteLength]=1,n++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),n),n+=2,r.set(t,n),r},e}(),eV=function(){function e(e){this._position=0,this._dataview=new DataView(e)}return Object.defineProperty(e.prototype,"length",{get:function(){return this.buffer.byteLength},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._dataview.buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),e.prototype.back=function(e){this.position-=e},e.prototype.getUint8=function(e){return this._dataview.getUint8(e)},e.prototype.getInt8=function(e){return this._dataview.getInt8(e)},e.prototype.getInt16=function(e){return this._dataview.getInt16(e)},e.prototype.getUint16=function(e){return this._dataview.getUint16(e)},e.prototype.getUint32=function(e){return this._dataview.getUint32(e)},e.prototype.getInt32=function(e){return this._dataview.getInt32(e)},e.prototype.skip=function(t){for(var r=Math.floor(t/4),n=t%4,i=0;i<r;i++)e.readByte(this,4);n>0&&e.readByte(this,n)},e.readByte=function(e,t,r){var n;switch(t){case 1:n=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:n=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");n=e.getUint8(e.position)<<16,n|=e.getUint8(e.position+1)<<8,n|=e.getUint8(e.position+2);break;case 4:n=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");n=e.getUint32(e.position)<<32,n|=e.getUint32(e.position+4);break;default:n=""}return e.position+=t,n},e.prototype.readUint8=function(){return e.readByte(this,1)},e.prototype.readUint16=function(){return e.readByte(this,2)},e.prototype.readUint24=function(){return e.readByte(this,3)},e.prototype.readUint32=function(){return e.readByte(this,4)},e.prototype.readUint64=function(){return e.readByte(this,8)},e.prototype.readInt8=function(){return e.readByte(this,1,!0)},e.prototype.readInt16=function(){return e.readByte(this,2,!0)},e.prototype.readInt32=function(){return e.readByte(this,4,!0)},e.prototype.writeUint32=function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])},e}(),tV=new CD("Stream",0),rV=function(){function e(){this.isScreen=!1,this.seiList=[],this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1}}return Object.defineProperty(e.prototype,"hasPublished",{get:function(){return this.videoTransceiver&&this.audioTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),e.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(AL()){var r=t.createEncodedStreams(),n=r.readable,i=r.writable,o=new TransformStream({transform:function(t,r){var n=e.seiList[0];if(n){var i=new Uint8Array(n.content.byteLength+5);i.set([0,0,0,1,6]),i.set(n.content,5);var o=new Uint8Array(i.byteLength+t.data.byteLength);0===n.repeatCount&&e.seiList.splice(0,1),n.repeatCount--,o.set(new Uint8Array(t.data)),o.set(i,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else tV.print("no sender found when trying to bind encodedTransform")},e.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else tV.print("no sender found when trying to bind encodedTransform")},e.prototype.clean=function(){this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0},e.prototype.updateVideoBitrate=function(e){var t,r=null===(t=null==e?void 0:e[0])||void 0===t?void 0:t.maxKbps;if("number"==typeof r&&r&&this.videoTransceiver){var n=this.videoTransceiver.sender,i=n.getParameters();i.encodings&&0!==i.encodings.length||(i.encodings=[{}]),i.encodings[0].maxBitrate=1e3*r,tV.print("updateVideoBitrate","set sendEncodings: ",i),n.setParameters(i)}},e.prototype.switchTrackEnableState=function(e,t){var r;"audio"===e?r=this.audioTrack:"video"===e&&(r=this.videoTrack);var n=null==r?void 0:r.getTrack();return!(!n||(null==n?void 0:n.enabled)===t)&&(n.enabled=t,!0)},e}(),nV=function(e){function t(t,r,n,i){var o=e.call(this)||this;return o.userId=t,o.isScreen=n,o.streamId=r,o.hasAudio=i.localaudio,o.hasVideo=i.localvideo,o._attributes=i,o.subVideo=!1,o.subAudio=!1,o._sequenceId=0,o.subMediaType=ik.NONE,o.recordedVideoFrames=[],o.subConfig={videoIndex:0},o.hasSubscribed=!1,o}return wp(t,e),Object.defineProperty(t.prototype,"sequenceId",{get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo,this.hasAudio=e.localaudio,this._attributes=e},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){var n=Qx.getNalunits(new eV(t.data)).find((function(e){return e.sei}));n&&e.safeEmit("onSEIMessage",n.body.slice(1)),r.enqueue(t)}})).pipeTo(n)}else tV.print("no receiver found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else tV.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,r,n;if((null===(r=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===r?void 0:r.id)===this.streamId){var i=e.track;"video"===(null==i?void 0:i.kind)?this._setVideoTrack(i):"audio"===(null===(n=e.track)||void 0===n?void 0:n.kind)&&this._setAudioTrack(i),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){tV.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=[],this.paused=!1,this._workaround_1_=!1},t.prototype.resetHasSubscribed=function(){this.hasSubscribed=!1},t.prototype._setStream=function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}},t.prototype._setAudioTrack=function(e){var t,r;(null===(r=null===(t=this.audioTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new Fx(e,Ww()),this.emit("ontrack",this.audioTrack))},t.prototype._setVideoTrack=function(e){var t,r;(null===(r=null===(t=this.videoTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new jx(e,Ww()),this.emit("ontrack",this.videoTrack))},t}(ND);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(Zx||(Zx={})),function(e){e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_MUTE_AUDIO="on_user_mute_audio",e.ON_USER_MUTE_VIDEO="on_user_mute_video",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result"}($x||($x={}));var iV=new CD("Room",1),oV=function(e){function t(t){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._roomConfig=t,r._mediaServerClient=new jL,r._addHandlerEventHandler(),r._isReconnecting=!1,r}return wp(t,e),Object.defineProperty(t.prototype,"hasScreenPublished",{get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasPublished",{get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._mediaServerClient.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){return this._remoteUsers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){return this._remoteStreams},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localStream",{get:function(){return this._localStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenStream",{get:function(){return this._localScreenStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomInfo",{get:function(){return this._roomInfo},enumerable:!1,configurable:!0}),t.prototype._addHandlerEventHandler=function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m=this;null===(e=this._mediaServerClient)||void 0===e||e.on(bU.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(bU.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(bU.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(bU.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(bU.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(bU.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(bU.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(bU.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(bU.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(bU.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(bU.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(bU.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(bU.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(TU.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(TU.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on("onRemoteStreamStats",(function(e){m.emit("onRemoteStreamStats",e)})),null===(v=this._mediaServerClient)||void 0===v||v.on("onLocalStreamStats",(function(e){m.emit("onLocalStreamStats",e)}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,r,n,i){return Pp(this,void 0,void 0,(function(){var o=this;return Mp(this,(function(a){return PU.setStats({rtc_app_id:e,room_id:t,user_id:n.userId}),iV.print("join()"),[2,new Promise((function(a,s){return Pp(o,void 0,void 0,(function(){var o;return Mp(this,(function(c){return this._joinResolveCallback=a,this._joinRejectCallback=s,this._controlMessage=i,this._roomInfo={appId:e,roomId:t,token:r,userInfo:n},o=qw(),DU.joinRoom(sU.BEGIN,o,!1,""),this._join((function(e){DU.joinRoom(sU.END,o,!0,e.message),a(e)}),(function(e){DU.joinRoom(sU.END,o,!1,e.message),s(e)})),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,r){var n;return void 0===r&&(r=!1),Pp(this,void 0,void 0,(function(){var i,o,a;return Mp(this,(function(s){switch(s.label){case 0:i=qw(),iV.print("_join()"),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback},r,this._controlMessage)];case 2:return o=s.sent(),this._mediaServerClient.roomAttributes=o.roomAttributes,this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e(null===(n=this._roomInfo)||void 0===n?void 0:n.userInfo),this._isReconnecting=!1,DU.rtcJoinRoom(0,"web","web",qw()-i),this._onJoinSucc(o,r),[3,4];case 3:return(a=s.sent()).code!==HN.OPERATION_CANCEL&&"function"==typeof t?[2,t(a)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,r){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(n){switch(n.label){case 0:return iV.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new rV,this._localScreenStream.isScreen=!0),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=r,this._localScreenStream.videoEncodeConfig=e,this._localScreenStream.hasPublished?[3,2]:[4,this._mediaServerClient.publish(this._localScreenStream)];case 1:return n.sent(),[3,4];case 2:return[4,this.updatePubScreenTrack()];case 3:n.sent(),n.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return iV.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),this._localScreenStream?[4,this._mediaServerClient.updatePubTrack(this._localScreenStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublishScreen=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return iV.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?[4,this._mediaServerClient.unpublish(this._localScreenStream)]:[3,2];case 1:e.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.controlMessage=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return iV.print("controlMessage","Invoke controlMessage"),this._controlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),"stopped"===e.action&&delete this._controlMessage,[2]}}))}))},t.prototype.updateUserAttributes=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return iV.print("updateUserAttributes","Invoke updateUserAttributes"),e.role&&this._roomInfo&&(this._roomInfo.userInfo.role=e.role),[4,this._mediaServerClient.updateUserAttributes(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.publish=function(e,t,r){return Pp(this,void 0,void 0,(function(){var n;return Mp(this,(function(i){switch(i.label){case 0:if(iV.print("publish","Invoke publish"),this._localStream||(this._localStream=new rV),this._localStream.videoTrack=t,this._localStream.audioTrack=r,this._localStream.videoEncodeConfig=e,this._localStream.hasPublished)return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._mediaServerClient.publish(this._localStream)];case 2:return i.sent(),this.emit($x.ON_PUBLISH_RESULT,{isScreen:!1,state:QD.PUBLISH_SUCC}),[3,4];case 3:throw n=i.sent(),this.emit($x.ON_PUBLISH_RESULT,{isScreen:!1,state:QD.PUBLISH_FAIL}),n;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:i.sent(),i.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return iV.print("updatePubTrack","Invoke updatePubTrack"),this._localStream?[4,this._mediaServerClient.updatePubTrack(this._localStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublish=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return iV.print("unpublish","Invoke unpublish"),this._localStream?[4,this._mediaServerClient.unpublish(this._localStream)]:[3,2];case 1:e.sent(),this._localStream.clean(),this._localStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.subscribe=function(e,t,r){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(n){switch(n.label){case 0:return iV.print("subscribe","remoteStream %o",e),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){var n,i;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(o){return iV.print("updateSubTrack","Invoke updateSubTrack"),e.subMediaType===t&&(null===(n=null==e?void 0:e.subConfig)||void 0===n?void 0:n.videoIndex)===(null==r?void 0:r.videoIndex)?[2,Promise.resolve(e)]:[2,null===(i=this._mediaServerClient)||void 0===i?void 0:i.updateSubTrack(e,t,r)]}))}))},t.prototype.unsubscribe=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:return iV.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.leave=function(){return Pp(this,void 0,void 0,(function(){var e,t;return Mp(this,(function(r){switch(r.label){case 0:iV.print("leave","Invoke leave"),e=qw(),r.label=1;case 1:return r.trys.push([1,3,4,5]),clearTimeout(this._reconnectTimer),[4,this._mediaServerClient.leave()];case 2:return r.sent(),DU.rtcLeaveRoom(0,"",qw()-e),[3,5];case 3:return(t=r.sent())instanceof Error&&DU.rtcLeaveRoom(-1,t.message,qw()-e),[3,5];case 4:return this.destroy(),[7];case 5:return[2]}}))}))},t.prototype.destroy=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:return iV.print("destroy","Invoke destroy"),this.connectionState!==LL.CONNECTED?[3,2]:[4,this.leave()];case 1:e.sent(),e.label=2;case 2:return this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map,this._remoteStreams=new Map,this._localStream=void 0,this._localScreenStream=void 0,this._removeHandlerEventHandler(),[2]}}))}))},t.prototype.updateToken=function(e){iV.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e)},t.prototype.muteLocalTrack=function(e,t){var r,n;return Pp(this,void 0,void 0,(function(){var i,o;return Mp(this,(function(a){switch(a.label){case 0:return this._localStream&&(null===(r=this._localStream)||void 0===r?void 0:r.hasPublished)?(i=t!==ZD.MUTE_STATE_OFF,(o=this._localStream.switchTrackEnableState(e,i))?[4,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updatePubTrack(this._localStream)]:[3,2]):[2,!1];case 1:a.sent(),a.label=2;case 2:return[2,o]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return Pp(this,void 0,void 0,(function(){var t,r,n,i,o,a,s=this;return Mp(this,(function(c){t=[];try{for(r=Up(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())i=n.value,Array.isArray(i)&&i.forEach((function(r){if(r.hasSubscribed){var n=null;switch(e){case tk.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===ik.AUDIO_ONLY?n=ik.NONE:r.subMediaType===ik.AUDIO_AND_VIDEO&&(n=ik.VIDEO_ONLY);break;case tk.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===ik.VIDEO_ONLY?n=ik.NONE:r.subMediaType===ik.AUDIO_AND_VIDEO&&(n=ik.AUDIO_ONLY);break;case tk.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==ik.NONE&&(n=ik.NONE)}if(null!==n){var i=s.updateSubTrack(r,n,r.subConfig);i&&t.push(i)}}}))}catch(e){o={error:e}}finally{try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return Pp(this,void 0,void 0,(function(){var t,r,n,i,o,a,s=this;return Mp(this,(function(c){t=[];try{for(r=Up(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())i=n.value,Array.isArray(i)&&i.forEach((function(r){if(r.hasSubscribed){var n=null;switch(e){case tk.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===ik.NONE?n=ik.AUDIO_ONLY:r.subMediaType===ik.VIDEO_ONLY&&(n=ik.AUDIO_AND_VIDEO);break;case tk.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===ik.NONE?n=ik.VIDEO_ONLY:r.subMediaType===ik.AUDIO_ONLY&&(n=ik.AUDIO_AND_VIDEO);break;case tk.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==ik.AUDIO_AND_VIDEO&&(n=ik.AUDIO_AND_VIDEO)}if(null!==n){var i=s.updateSubTrack(r,n,r.subConfig);i&&t.push(i)}}}))}catch(e){o={error:e}}finally{try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.sendUserMessage=function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)},t.prototype.sendRoomMessage=function(e,t){var r,n;return void 0===t&&(t=!1),Pp(this,void 0,void 0,(function(){var i,o;return Mp(this,(function(a){switch(a.label){case 0:return i={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:t,message:""},t?(o=i,[4,$w.ab2b64str(e)]):[3,2];case 1:return o.message=a.sent(),[3,3];case 2:i.message=e,a.label=3;case 3:return[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(i)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){iV.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new jL,this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var r,n,i,o,a,s=this;iV.print("JoinSuccess()");var c=[],u=[],d=[],l=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var r=s._remoteUsers.get(t.clientId);r?r._stillExist=!0:c.push(t)}}));try{for(var h=Up(this._remoteUsers.values()),f=h.next();!f.done;f=h.next()){var p=f.value;p._stillExist?delete p._stillExist:u.push({clientId:p.userId,leaveReason:"Left during disconnection"})}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}e.streams.forEach((function(e){var t=s._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):l.push(e)}));try{for(var _=Up(this._remoteStreams.values()),v=_.next();!v.done;v=_.next()){var m=v.value;Array.isArray(m)&&m.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:yU.clientDisconnected})}))}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=_.return)&&o.call(_)}finally{if(i)throw i.error}}setTimeout((function(){u.forEach((function(e){return s._onUserDisconnection(e)})),c.forEach((function(e){return s._onUserConnection(e)})),d.forEach((function(e){return s._onRemoveStream(e)})),l.forEach((function(e){return s._onAddStream(e)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,r=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));try{for(var n=Up(this._remoteStreams.values()),i=n.next();!i.done;i=n.next()){var o=i.value;Array.isArray(o)&&o.forEach((function(e){return Pp(r,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:if(!e.hasSubscribed)return[3,4];e.resetHasSubscribed(),r.label=1;case 1:return r.trys.push([1,3,,4]),iV.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType,e.subConfig)];case 2:return r.sent(),iV.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit($x.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=r.sent(),iV.print("failed resubscribe ".concat(e.userId," with ").concat(e.subMediaType,", error:").concat(t)),e.clean(),null==e||e.resetHasSubscribed(),[3,4];case 4:return[2]}}))}))}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},t.prototype._findRemoteStream=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.streamId===t})):null},t.prototype._findRemoteStreamByScreen=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.isScreen===t})):null},t.prototype._onAddStream=function(e,t){var r;if(void 0===t&&(t=!0),e.clientId!==(null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId)){var n=this._findRemoteStream(e.clientId,e.streamId);if(!n){n=new nV(e.clientId,e.streamId,e.screen,e.attributes),this._initStreamListeners(n);var i=this._remoteStreams.get(e.clientId);i?i.push(n):this._remoteStreams.set(e.clientId,[n])}return t&&this.safeEmit(bU.ON_ADD_STREAM,{stream:n}),!n.isScreen&&n.hasVideo&&this.safeEmit($x.ON_USER_START_VIDEO_CAPTURE,{userId:n.userId}),!n.isScreen&&n.hasAudio&&this.safeEmit($x.ON_USER_START_AUDIO_CAPTURE,{userId:n.userId}),n}},t.prototype._onUserConnection=function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,Dp(Dp({},r),{_stillExist:!0})),this.safeEmit(bU.USER_CONNECTION,{userInfo:r})}},t.prototype._onUserDisconnection=function(e){var t,r,n=this,i=e.clientId,o=e.leaveReason,a=this._remoteUsers.get(i);this._remoteUsers.delete(i);var s=this._remoteStreams.get(i);Array.isArray(s)&&s.length&&(s.forEach((function(e){n.safeEmit(bU.ON_REMOVE_STREAM,{stream:e,reason:"Client leave"})})),this._remoteStreams.delete(i)),"userDuplicateLogin"===e.tag&&i===(null===(r=null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo)||void 0===r?void 0:r.userId)&&(a={userId:i},o=e.tag),(null==a?void 0:a.userId)&&this.safeEmit(bU.USER_DISCONNECTION,{userInfo:{userId:null==a?void 0:a.userId},reason:o})},t.prototype._onRemoveStream=function(e){var t,r,n=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._remoteStreams.get(e.clientId);if(i){var o=i.find((function(t){return t.streamId==e.streamId}));o&&(null===(r=this._mediaServerClient)||void 0===r||r.handleRemoveStream(o,e).then((function(){if(!(null==o?void 0:o._workaround_1_)){var t=n._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),n._remoteStreams.set(e.clientId,t)}})),this.safeEmit(bU.ON_REMOVE_STREAM,{stream:o,reason:e.message}))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t=e.clientId,r=e.streamId,n=e.attributes,i=this._findRemoteStream(t,r);if(i){var o=i.attributes,a=Dp(Dp({},o),n);i.attributes=a,a.localaudio!==o.localaudio&&(a.localaudio?this.safeEmit($x.ON_USER_START_AUDIO_CAPTURE,{userId:t}):this.safeEmit($x.ON_USER_STOP_AUDIO_CAPTURE,{userId:t})),a.localvideo!==o.localvideo&&(a.localvideo?this.safeEmit($x.ON_USER_START_VIDEO_CAPTURE,{userId:t}):this.safeEmit($x.ON_USER_STOP_VIDEO_CAPTURE,{userId:t})),a.audiostream!==o.audiostream&&(a.audiostream?this.safeEmit($x.ON_USER_MUTE_AUDIO,{userInfo:{userId:t},muteState:ZD.MUTE_STATE_ON}):this.safeEmit($x.ON_USER_MUTE_AUDIO,{userInfo:{userId:t},muteState:ZD.MUTE_STATE_OFF})),a.videostream!==o.videostream&&(a.videostream?this.safeEmit($x.ON_USER_MUTE_VIDEO,{userInfo:{userId:t},muteState:ZD.MUTE_STATE_ON}):this.safeEmit($x.ON_USER_MUTE_VIDEO,{userInfo:{userId:t},muteState:ZD.MUTE_STATE_OFF}))}},t.prototype._onPushTrack=function(e){var t=this,r=e.clientId,n=e.streamId,i=this._findRemoteStream(r,n);i||(i=this._onAddStream(e,!1)),this._mediaServerClient.subscribe4pushTrack(i,e).then((function(){return t.safeEmit($x.SUBSCRIBE_PUSH_TRACK,{stream:i})})).catch((function(e){iV.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,r=e.clientId,n=e.streamId,i=e.message,o=this._findRemoteStream(r,n);o&&this._mediaServerClient.unsubscribe4removeTrack(o,i).then((function(){var e;if(o._workaround_1_){var i=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==n}));t._remoteStreams.set(r,i||[])}t.safeEmit($x.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){iV.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t=e.nodes,r=e.reason;this._destroyAndInitMediaServerClient(),Array.isArray(t)&&t.length?this._getAccessNode=t[0]:this._getAccessFeedback=r,DU.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(r)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,r=this;this._isReconnecting=!0,DU.rtcReconnect(1002,MM.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,UM.PEERCONNECTION);try{for(var n=Up(this._remoteStreams.values()),i=n.next();!i.done;i=n.next()){var o=i.value;Array.isArray(o)&&o.forEach((function(e){return e.clean()}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._join((function(){DU.rtcReconnected(LM.PEERCONNECTION_RECONNECTED,xM.PEERCONNECTION)}),(function(e){iV.print("Reconnecting error, will reconnect after 3s",e),r._reconnectTimer=setTimeout(r._reconnect.bind(r),3e3)}),!0)},t.prototype._handleAbnormalDisconnection=function(){iV.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=setTimeout(this._reconnect.bind(this),3e3)},t.prototype._onConnectionStateChange=function(e){var t;if(e.next===LL.DISCONNECTED)t=ak.CONNECTION_STATE_DISCONNECTED;else if(e.next===LL.CONNECTED)t=this._isReconnecting?ak.CONNECTION_STATE_RECONNECTED:ak.CONNECTION_STATE_CONNECTED;else{if(e.next!==LL.CONNECTING)return;t=this._isReconnecting?ak.CONNECTION_STATE_RECONNECTING:ak.CONNECTION_STATE_CONNECTING}this.safeEmit(TU.ON_CONNECTION_STATE_CHANGE,{state:t})},t.prototype._initStreamListeners=function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(r){var n;t.emit($x.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(n=t._roomInfo)||void 0===n?void 0:n.roomId,streamIndex:e.isScreen?nk.STREAM_INDEX_SCREEN:nk.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(bU.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){var t=e.msg;try{t=JSON.parse(t)}catch(e){}this.safeEmit(bU.USER_MESSAGE_RECEIVED,{userId:e.from,message:t})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(bU.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){var t,r=(null===(t=e.body)||void 0===t?void 0:t.error)||0;this.safeEmit(bU.POST_PROCESSING_MESSAGE,{code:r,message:["success","parameter error","subscription timeout","ffmpeg error","cdn error"][r]})},t}(ND),aV=function(e,t){return void 0===t&&(t={}),t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var r=Lp(t,2),n=r[0],i=r[1];e.setAttribute(n,i)})),e},sV=new CD("Player",0),cV=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],uV={playsinline:"","webkit-playsinline":""},dV={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},lV=function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var r="audio"===e?uV:dV;if("video"===e&&this.videoCache.length>0){if(n=this.videoCache.pop())return aV(n,{style:t,attributes:r}),n}else if("audio"===e&&this.audioCache.length>0){var n;if(n=this.audioCache.pop())return aV(n,{style:t,attributes:r}),n}return function(e,t){void 0===t&&(t={});var r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=Lp(e,2),n=t[0],i=t[1];r.setAttribute(n,i)})),r}(e,{style:t,attributes:r})},e.prototype.recycle=function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)},e}(),hV=new lV,fV=function(e){function t(t){var r=e.call(this)||this;r.emitVideoEvent=function(e){var t,n,i={type:"video",rawEvent:e,readyState:(null===(t=r._videoDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:e.type,currentTime:(null===(n=r._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:r.isScreen};r.emit("playback_event",i)},r._internalPlay=function(){var e;if(null===(e=r._videoDom)||void 0===e?void 0:e.paused){var t=r._videoDom.play();(null==t?void 0:t.then)&&t.catch((function(e){var t;DU.rtcError("video autoplay failed, userId: ".concat(r.userId),-1e3),r.emit("playback_event",{type:"video",rawEvent:e,readyState:r._videoDom.readyState||0,userId:r.userId,eventName:"autoplay-error",currentTime:(null===(t=r._videoDom)||void 0===t?void 0:t.currentTime)||0})}))}};var n=t.renderDom,i=t.userId;r.renderMode=void 0!==t.renderMode?t.renderMode:rk.RENDER_MODE_FIT;var o="string"==typeof n?document.getElementById(n):n;if(!o)throw new XN(HN.CANT_FIND_DOM,"can't find dom");return r._containerDom=o,r.userId=i,r.isScreen=!!t.isScreen,r._initVideo(),r}return wp(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=hV.getOrCreate("video",{width:"100%",height:"100%",background:"black"}),this._videoDom.id="".concat(this.userId,"_").concat(Ww()),this.renderMode===rk.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover"),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&cV.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._videoDom&&(cV.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(r){var n;if("timeupdate"===r.eventName){if(void 0===t.__cumulativeTime&&(t.__cumulativeTime=0),0===(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime))return;if(t._videoDom.currentTime>t.__cumulativeTime){var i=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),o=t._videoDom.currentTime-t.__cumulativeTime>.5;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:o,stallCount:o?1:0,stallDuration:i%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var r;return Pp(this,void 0,void 0,(function(){var n,i,o=this;return Mp(this,(function(a){return n=this._videoDom,sV.print("playVideo","play video track: ".concat(this.userId)),n&&n.srcObject instanceof MediaStream&&n.srcObject.getTrackById(null===(r=e.getTrack())||void 0===r?void 0:r.id)||(n||(this._initVideo(),n=this._videoDom),sV.print("playVideo","play video by dom: ".concat(null==n?void 0:n.id)),(i=new MediaStream).addTrack(e.getTrack()),n.srcObject=i,this._containerDom.appendChild(n),n.addEventListener("canplay",this._internalPlay),n.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return o._internalPlay()})),t&&this._recordFrame(t)),[2]}))}))},t.prototype.updateSrcObject=function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}},t.prototype.manuallyPlay=function(){if(sV.print("Invoke AudioPlayer.manuallyPlay"),!this._videoDom)throw new XN(HN.INVALID_PARAMS,"Player not found");var e=this._videoDom.play();return(null==e?void 0:e.then)?e:Promise.resolve(e)},t.prototype.mirror=function(e){sV.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;sV.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom),hV.recycle(this._videoDom),this._removeListeners(),delete this._videoDom),this._videoDom=void 0,this.__cumulativeTime=void 0},t.prototype.destroy=function(){this.stop(),e.prototype.removeAllListeners.call(this)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(vD.exports.EventEmitter),pV=function(e){function t(t,r){var n=e.call(this)||this;if(n.emitVideoEvent=function(e){var t,r,i={type:"audio",rawEvent:e,readyState:(null===(t=n._audioDom)||void 0===t?void 0:t.readyState)||0,userId:n.userId,eventName:e.type,currentTime:(null===(r=n._audioDom)||void 0===r?void 0:r.currentTime)||0};n.emit("playback_event",i)},n._internalPlay=function(){var e,t;if(xU("_internalPlay",{paused:null===(e=n._audioDom)||void 0===e?void 0:e.paused}),null===(t=n._audioDom)||void 0===t?void 0:t.paused)try{var r=n._audioDom.play();(null==r?void 0:r.then)&&r.catch((function(e){n._autoPlayError(e)})).then((function(){xU("_internalPlay successfully",{userId:n.userId})}))}catch(e){n._autoPlayError(e)}},r){var i=document.getElementById(r);if(!i)throw new XN(HN.CANT_FIND_DOM,"can't find dom");n._containerDom=i}else n._containerDom=document.body;return n.userId=t,n._initAudio(),n}return wp(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=hV.getOrCreate("audio",{display:"none"}),this._audioDom.id="".concat(this.userId,"_").concat(Ww()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&cV.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._audioDom&&(cV.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))},t.prototype.playAudio=function(e){var t;return Pp(this,void 0,void 0,(function(){var r,n,i=this;return Mp(this,(function(o){return sV.print("playAudio","play audio track: ".concat(this.userId)),(r=this._audioDom)&&r.srcObject instanceof MediaStream&&r.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)||(r||(this._initAudio(),r=this._audioDom),(n=new MediaStream).addTrack(e.getTrack()),r.srcObject=n,null==r||r.addEventListener("canplay",this._internalPlay),null==r||r.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return i._internalPlay()}))),[2]}))}))},t.prototype._autoPlayError=function(e){var t;DU.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:this._audioDom.readyState||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(t=this._audioDom)||void 0===t?void 0:t.currentTime)||0})},t.prototype.manuallyPlay=function(){if(sV.print("Invoke AudioPlayer.manuallyPlay"),!this._audioDom)throw new XN(HN.INVALID_PARAMS,"Player not found");var e=this._audioDom.play();return(null==e?void 0:e.then)?e:Promise.resolve(e)},t.prototype.setPlaybackDevice=function(e){return Pp(this,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:return sV.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,Ox.getAudioPlayback()];case 1:return t=r.sent(),t.map((function(e){return e.deviceId})).includes(e)&&this._audioDom&&this._audioDom.setSinkId?[4,this._audioDom.setSinkId(e)]:[2];case 2:return r.sent(),[2]}}))}))},t.prototype.stop=function(){var e=this._containerDom;sV.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom),hV.recycle(this._audioDom),this._removeListeners(),delete this._audioDom),this._audioDom=void 0},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){this.stop(),e.prototype.removeAllListeners.call(this)},t}(vD.exports.EventEmitter),_V="object"==("undefined"==typeof global?"undefined":uo(global))&&global&&global.Object===Object&&global,vV="object"==("undefined"==typeof self?"undefined":uo(self))&&self&&self.Object===Object&&self,mV=_V||vV||Function("return this")(),EV=mV.Symbol,SV=Object.prototype,gV=SV.hasOwnProperty,yV=SV.toString,bV=EV?EV.toStringTag:void 0;var TV=Object.prototype.toString;var IV=EV?EV.toStringTag:void 0;function RV(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":IV&&IV in Object(e)?function(e){var t=gV.call(e,bV),r=e[bV];try{e[bV]=void 0;var n=!0}catch(e){}var i=yV.call(e);return n&&(t?e[bV]=r:delete e[bV]),i}(e):function(e){return TV.call(e)}(e)}function AV(e){return null!=e&&"object"==uo(e)}var CV=Array.isArray;function OV(e){var t=uo(e);return null!=e&&("object"==t||"function"==t)}function NV(e){return e}function wV(e){if(!OV(e))return!1;var t=RV(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var DV=mV["__core-js_shared__"],kV=function(){var e=/[^.]+$/.exec(DV&&DV.keys&&DV.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var PV=Function.prototype.toString;var MV=/^\[object .+?Constructor\]$/,UV=Function.prototype,LV=Object.prototype,xV=UV.toString,VV=LV.hasOwnProperty,BV=RegExp("^"+xV.call(VV).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function jV(e){return!(!OV(e)||(t=e,kV&&kV in t))&&(wV(e)?BV:MV).test(function(e){if(null!=e){try{return PV.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function FV(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var GV=Date.now;var HV,zV,YV,KV=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return jV(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),XV=KV,WV=XV?function(e,t){return XV(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:NV,qV=(HV=WV,zV=0,YV=0,function(){var e=GV(),t=16-(e-YV);if(YV=e,t>0){if(++zV>=800)return arguments[0]}else zV=0;return HV.apply(void 0,arguments)}),JV=/^(?:0|[1-9]\d*)$/;function ZV(e,t){var r=uo(e);return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&JV.test(e))&&e>-1&&e%1==0&&e<t}function $V(e,t,r){"__proto__"==t&&XV?XV(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function QV(e,t){return e===t||e!=e&&t!=t}var eB=Object.prototype.hasOwnProperty;function tB(e,t,r){var n=e[t];eB.call(e,t)&&QV(n,r)&&(void 0!==r||t in e)||$V(e,t,r)}var rB=Math.max;function nB(e,t){return qV(function(e,t,r){return t=rB(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=rB(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),FV(e,this,s)}}(e,t,NV),e+"")}function iB(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function oB(e){return null!=e&&iB(e.length)&&!wV(e)}var aB=Object.prototype;function sB(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||aB)}function cB(e){return AV(e)&&"[object Arguments]"==RV(e)}var uB=Object.prototype,dB=uB.hasOwnProperty,lB=uB.propertyIsEnumerable,hB=cB(function(){return arguments}())?cB:function(e){return AV(e)&&dB.call(e,"callee")&&!lB.call(e,"callee")};var fB="object"==("undefined"==typeof exports?"undefined":uo(exports))&&exports&&!exports.nodeType&&exports,pB=fB&&"object"==("undefined"==typeof module?"undefined":uo(module))&&module&&!module.nodeType&&module,_B=pB&&pB.exports===fB?mV.Buffer:void 0,vB=(_B?_B.isBuffer:void 0)||function(){return!1},mB={};mB["[object Float32Array]"]=mB["[object Float64Array]"]=mB["[object Int8Array]"]=mB["[object Int16Array]"]=mB["[object Int32Array]"]=mB["[object Uint8Array]"]=mB["[object Uint8ClampedArray]"]=mB["[object Uint16Array]"]=mB["[object Uint32Array]"]=!0,mB["[object Arguments]"]=mB["[object Array]"]=mB["[object ArrayBuffer]"]=mB["[object Boolean]"]=mB["[object DataView]"]=mB["[object Date]"]=mB["[object Error]"]=mB["[object Function]"]=mB["[object Map]"]=mB["[object Number]"]=mB["[object Object]"]=mB["[object RegExp]"]=mB["[object Set]"]=mB["[object String]"]=mB["[object WeakMap]"]=!1;var EB="object"==("undefined"==typeof exports?"undefined":uo(exports))&&exports&&!exports.nodeType&&exports,SB=EB&&"object"==("undefined"==typeof module?"undefined":uo(module))&&module&&!module.nodeType&&module,gB=SB&&SB.exports===EB&&_V.process,yB=function(){try{var e=SB&&SB.require&&SB.require("util").types;return e||gB&&gB.binding&&gB.binding("util")}catch(e){}}(),bB=yB&&yB.isTypedArray,TB=bB?function(e){return function(t){return e(t)}}(bB):function(e){return AV(e)&&iB(e.length)&&!!mB[RV(e)]},IB=TB,RB=Object.prototype.hasOwnProperty;function AB(e,t){var r=CV(e),n=!r&&hB(e),i=!r&&!n&&vB(e),o=!r&&!n&&!i&&IB(e),a=r||n||i||o,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!RB.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ZV(u,c))||s.push(u);return s}var CB=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),OB=CB,NB=Object.prototype.hasOwnProperty;function wB(e){return oB(e)?AB(e):function(e){if(!sB(e))return OB(e);var t=[];for(var r in Object(e))NB.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var DB=Object.prototype.hasOwnProperty;function kB(e){if(!OV(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=sB(e),r=[];for(var n in e)("constructor"!=n||!t&&DB.call(e,n))&&r.push(n);return r}var PB,MB=(PB=function(e,t){!function(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),i?$V(r,s,c):tB(r,s,c)}}(t,function(e){return oB(e)?AB(e,!0):kB(e)}(t),e)},nB((function(e,t){var r=-1,n=t.length,i=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(i=PB.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!OV(r))return!1;var n=uo(t);return!!("number"==n?oB(r)&&ZV(t,r.length):"string"==n&&t in r)&&QV(r[t],e)}(t[0],t[1],o)&&(i=n<3?void 0:i,n=1),e=Object(e);++r<n;){var a=t[r];a&&PB(e,a,r,i)}return e}))),UB=MB;function LB(e,t){return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}function xB(e){return null==e?[]:LB(e,wB(e))}var VB=o,BB=Ze("iterator"),jB=!VB((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,n){t.delete("b"),r+=n+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[BB]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==r||"x"!==new URL("http://x",void 0).host})),FB=T,GB=/[^\0-\u007E]/,HB=/[.\u3002\uFF0E\uFF61]/g,zB="Overflow: input needs wider integers to process",YB=n.RangeError,KB=FB(HB.exec),XB=Math.floor,WB=String.fromCharCode,qB=FB("".charCodeAt),JB=FB([].join),ZB=FB([].push),$B=FB("".replace),QB=FB("".split),ej=FB("".toLowerCase),tj=function(e){return e+22+75*(e<26)},rj=function(e,t,r){var n=0;for(e=r?XB(e/700):e>>1,e+=XB(e/t);e>455;)e=XB(e/35),n+=36;return XB(n+36*e/(e+38))},nj=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=qB(e,r++);if(i>=55296&&i<=56319&&r<n){var o=qB(e,r++);56320==(64512&o)?ZB(t,((1023&i)<<10)+(1023&o)+65536):(ZB(t,i),r--)}else ZB(t,i)}return t}(e);var r,n,i=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&ZB(t,WB(n));var c=t.length,u=c;for(c&&ZB(t,"-");u<i;){var d=2147483647;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>XB((2147483647-a)/l))throw YB(zB);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>2147483647)throw YB(zB);if(n==o){for(var h=a,f=36;;){var p=f<=s?1:f>=s+26?26:f-s;if(h<p)break;var _=h-p,v=36-p;ZB(t,WB(tj(p+_%v))),h=XB(_/v),f+=36}ZB(t,WB(tj(h))),s=rj(a,l,u==c),a=0,u++}}a++,o++}return JB(t,"")},ij=Fn,oj=n,aj=Y,sj=d,cj=T,uj=jB,dj=Ht.exports,lj=Sc,hj=za,fj=Yh,pj=br,_j=Cc,vj=B,mj=Ue,Ej=Yn,Sj=ni,gj=Dt,yj=F,bj=va,Tj=Go,Ij=m,Rj=zc,Aj=xc,Cj=Cu,Oj=rT,Nj=Ze("iterator"),wj=pj.set,Dj=pj.getterFor("URLSearchParams"),kj=pj.getterFor("URLSearchParamsIterator"),Pj=aj("fetch"),Mj=aj("Request"),Uj=aj("Headers"),Lj=Mj&&Mj.prototype,xj=Uj&&Uj.prototype,Vj=oj.RegExp,Bj=oj.TypeError,jj=oj.decodeURIComponent,Fj=oj.encodeURIComponent,Gj=cj("".charAt),Hj=cj([].join),zj=cj([].push),Yj=cj("".replace),Kj=cj([].shift),Xj=cj([].splice),Wj=cj("".split),qj=cj("".slice),Jj=/\+/g,Zj=Array(4),$j=function(e){return Zj[e-1]||(Zj[e-1]=Vj("((?:%[\\da-f]{2}){"+e+"})","gi"))},Qj=function(e){try{return jj(e)}catch(t){return e}},eF=function(e){var t=Yj(e,Jj," "),r=4;try{return jj(t)}catch(e){for(;r;)t=Yj(t,$j(r--),Qj);return t}},tF=/[!'()~]|%20/g,rF={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},nF=function(e){return rF[e]},iF=function(e){return Yj(Fj(e),tF,nF)},oF=fj((function(e,t){wj(this,{type:"URLSearchParamsIterator",iterator:Rj(Dj(e).entries),kind:t})}),"Iterator",(function(){var e=kj(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),aF=function(e){this.entries=[],this.url=null,void 0!==e&&(yj(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===Gj(e,0)?qj(e,1):e:bj(e)))};aF.prototype={type:"URLSearchParams",bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=Aj(e);if(c)for(r=(t=Rj(e,c)).next;!(n=sj(r,t)).done;){if(o=(i=Rj(gj(n.value))).next,(a=sj(o,i)).done||(s=sj(o,i)).done||!sj(o,i).done)throw Bj("Expected sequence with length 2");zj(this.entries,{key:bj(a.value),value:bj(s.value)})}else for(var u in e)mj(e,u)&&zj(this.entries,{key:u,value:bj(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=Wj(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=Wj(t,"="),zj(this.entries,{key:eF(Kj(r)),value:eF(Hj(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],zj(r,iF(e.key)+"="+iF(e.value));return Hj(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var sF=function(){_j(this,cF);var e=arguments.length>0?arguments[0]:void 0;wj(this,new aF(e))},cF=sF.prototype;if(lj(cF,{append:function(e,t){Cj(arguments.length,2);var r=Dj(this);zj(r.entries,{key:bj(e),value:bj(t)}),r.updateURL()},delete:function(e){Cj(arguments.length,1);for(var t=Dj(this),r=t.entries,n=bj(e),i=0;i<r.length;)r[i].key===n?Xj(r,i,1):i++;t.updateURL()},get:function(e){Cj(arguments.length,1);for(var t=Dj(this).entries,r=bj(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){Cj(arguments.length,1);for(var t=Dj(this).entries,r=bj(e),n=[],i=0;i<t.length;i++)t[i].key===r&&zj(n,t[i].value);return n},has:function(e){Cj(arguments.length,1);for(var t=Dj(this).entries,r=bj(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){Cj(arguments.length,1);for(var r,n=Dj(this),i=n.entries,o=!1,a=bj(e),s=bj(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?Xj(i,c--,1):(o=!0,r.value=s));o||zj(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=Dj(this);Oj(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=Dj(this).entries,n=Ej(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new oF(this,"keys")},values:function(){return new oF(this,"values")},entries:function(){return new oF(this,"entries")}},{enumerable:!0}),dj(cF,Nj,cF.entries,{name:"entries"}),dj(cF,"toString",(function(){return Dj(this).serialize()}),{enumerable:!0}),hj(sF,"URLSearchParams"),ij({global:!0,forced:!uj},{URLSearchParams:sF}),!uj&&vj(Uj)){var uF=cj(xj.has),dF=cj(xj.set),lF=function(e){if(yj(e)){var t,r=e.body;if("URLSearchParams"===Sj(r))return t=e.headers?new Uj(e.headers):new Uj,uF(t,"content-type")||dF(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),Tj(e,{body:Ij(0,bj(r)),headers:Ij(0,t)})}return e};if(vj(Pj)&&ij({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Pj(e,arguments.length>1?lF(arguments[1]):{})}}),vj(Mj)){var hF=function(e){return _j(this,Lj),new Mj(e,arguments.length>1?lF(arguments[1]):{})};Lj.constructor=hF,hF.prototype=Lj,ij({global:!0,forced:!0},{Request:hF})}}var fF,pF={URLSearchParams:sF,getState:Dj},_F=Fn,vF=a,mF=jB,EF=n,SF=Yn,gF=T,yF=So.f,bF=Ht.exports,TF=Cc,IF=Ue,RF=ta,AF=kw,CF=Ca,OF=wf.codeAt,NF=function(e){var t,r,n=[],i=QB($B(ej(e),HB,"."),".");for(t=0;t<i.length;t++)r=i[t],ZB(n,KB(GB,r)?"xn--"+nj(r):r);return JB(n,".")},wF=va,DF=za,kF=Cu,PF=pF,MF=br,UF=MF.set,LF=MF.getterFor("URL"),xF=PF.URLSearchParams,VF=PF.getState,BF=EF.URL,jF=EF.TypeError,FF=EF.parseInt,GF=Math.floor,HF=Math.pow,zF=gF("".charAt),YF=gF(/./.exec),KF=gF([].join),XF=gF(1..toString),WF=gF([].pop),qF=gF([].push),JF=gF("".replace),ZF=gF([].shift),$F=gF("".split),QF=gF("".slice),eG=gF("".toLowerCase),tG=gF([].unshift),rG=/[a-z]/i,nG=/[\d+-.a-z]/i,iG=/\d/,oG=/^0x/i,aG=/^[0-7]+$/,sG=/^\d+$/,cG=/^[\da-f]+$/i,uG=/[\0\t\n\r #%/:<>?@[\\\]^|]/,dG=/[\0\t\n\r #/:<>?@[\\\]^|]/,lG=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,hG=/[\t\n\r]/g,fG=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)tG(t,e%256),e=GF(e/256);return KF(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r&&(t=n,r=i),t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=XF(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},pG={},_G=RF({},pG,{" ":1,'"':1,"<":1,">":1,"`":1}),vG=RF({},_G,{"#":1,"?":1,"{":1,"}":1}),mG=RF({},vG,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),EG=function(e,t){var r=OF(e,0);return r>32&&r<127&&!IF(t,e)?e:encodeURIComponent(e)},SG={ftp:21,file:null,http:80,https:443,ws:80,wss:443},gG=function(e,t){var r;return 2==e.length&&YF(rG,zF(e,0))&&(":"==(r=zF(e,1))||!t&&"|"==r)},yG=function(e){var t;return e.length>1&&gG(QF(e,0,2))&&(2==e.length||"/"===(t=zF(e,2))||"\\"===t||"?"===t||"#"===t)},bG=function(e){return"."===e||"%2e"===eG(e)},TG={},IG={},RG={},AG={},CG={},OG={},NG={},wG={},DG={},kG={},PG={},MG={},UG={},LG={},xG={},VG={},BG={},jG={},FG={},GG={},HG={},zG=function(e,t,r){var n,i,o,a=wF(e);if(t){if(i=this.parse(a))throw jF(i);this.searchParams=null}else{if(void 0!==r&&(n=new zG(r,!0)),i=this.parse(a,null,n))throw jF(i);(o=VF(new xF)).bindURL(this),this.searchParams=o}};zG.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||TG,d=0,l="",h=!1,f=!1,p=!1;for(e=wF(e),t||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,e=JF(e,lG,"")),e=JF(e,hG,""),n=AF(e);d<=n.length;){switch(i=n[d],u){case TG:if(!i||!YF(rG,i)){if(t)return"Invalid scheme";u=RG;continue}l+=eG(i),u=IG;break;case IG:if(i&&(YF(nG,i)||"+"==i||"-"==i||"."==i))l+=eG(i);else{if(":"!=i){if(t)return"Invalid scheme";l="",u=RG,d=0;continue}if(t&&(c.isSpecial()!=IF(SG,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&SG[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=LG:c.isSpecial()&&r&&r.scheme==c.scheme?u=AG:c.isSpecial()?u=wG:"/"==n[d+1]?(u=CG,d++):(c.cannotBeABaseURL=!0,qF(c.path,""),u=FG)}break;case RG:if(!r||r.cannotBeABaseURL&&"#"!=i)return"Invalid scheme";if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=CF(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=HG;break}u="file"==r.scheme?LG:OG;continue;case AG:if("/"!=i||"/"!=n[d+1]){u=OG;continue}u=DG,d++;break;case CG:if("/"==i){u=kG;break}u=jG;continue;case OG:if(c.scheme=r.scheme,i==fF)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=CF(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=NG;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=CF(r.path),c.query="",u=GG;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=CF(r.path),c.path.length--,u=jG;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=CF(r.path),c.query=r.query,c.fragment="",u=HG}break;case NG:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=jG;continue}u=kG}else u=DG;break;case wG:if(u=DG,"/"!=i||"/"!=zF(l,d+1))continue;d++;break;case DG:if("/"!=i&&"\\"!=i){u=kG;continue}break;case kG:if("@"==i){h&&(l="%40"+l),h=!0,o=AF(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||p){var m=EG(v,mG);p?c.password+=m:c.username+=m}else p=!0}l=""}else if(i==fF||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=AF(l).length+1,l="",u=PG}else l+=i;break;case PG:case MG:if(t&&"file"==c.scheme){u=VG;continue}if(":"!=i||f){if(i==fF||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return"Invalid host";if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=BG,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return"Invalid host";if(a=c.parseHost(l))return a;if(l="",u=UG,t==MG)return}break;case UG:if(!YF(iG,i)){if(i==fF||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var E=FF(l,10);if(E>65535)return"Invalid port";c.port=c.isSpecial()&&E===SG[c.scheme]?null:E,l=""}if(t)return;u=BG;continue}return"Invalid port"}l+=i;break;case LG:if(c.scheme="file","/"==i||"\\"==i)u=xG;else{if(!r||"file"!=r.scheme){u=jG;continue}if(i==fF)c.host=r.host,c.path=CF(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=CF(r.path),c.query="",u=GG;else{if("#"!=i){yG(KF(CF(n,d),""))||(c.host=r.host,c.path=CF(r.path),c.shortenPath()),u=jG;continue}c.host=r.host,c.path=CF(r.path),c.query=r.query,c.fragment="",u=HG}}break;case xG:if("/"==i||"\\"==i){u=VG;break}r&&"file"==r.scheme&&!yG(KF(CF(n,d),""))&&(gG(r.path[0],!0)?qF(c.path,r.path[0]):c.host=r.host),u=jG;continue;case VG:if(i==fF||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&gG(l))u=jG;else if(""==l){if(c.host="",t)return;u=BG}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=BG}continue}l+=i;break;case BG:if(c.isSpecial()){if(u=jG,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=fF&&(u=jG,"/"!=i))continue}else c.fragment="",u=HG;else c.query="",u=GG;break;case jG:if(i==fF||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=eG(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||qF(c.path,"")):bG(l)?"/"==i||"\\"==i&&c.isSpecial()||qF(c.path,""):("file"==c.scheme&&!c.path.length&&gG(l)&&(c.host&&(c.host=""),l=zF(l,0)+":"),qF(c.path,l)),l="","file"==c.scheme&&(i==fF||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)ZF(c.path);"?"==i?(c.query="",u=GG):"#"==i&&(c.fragment="",u=HG)}else l+=EG(i,vG);break;case FG:"?"==i?(c.query="",u=GG):"#"==i?(c.fragment="",u=HG):i!=fF&&(c.path[0]+=EG(i,pG));break;case GG:t||"#"!=i?i!=fF&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":EG(i,pG)):(c.fragment="",u=HG);break;case HG:i!=fF&&(c.fragment+=EG(i,_G))}d++}},parseHost:function(e){var t,r,n;if("["==zF(e,0)){if("]"!=zF(e,e.length-1))return"Invalid host";if(t=function(e){var t,r,n,i,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return zF(e,l)};if(":"==h()){if(":"!=zF(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&YF(cG,h());)t=16*t+FF(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!YF(iG,h()))return;for(;YF(iG,h());){if(o=FF(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!=n||u++}if(4!=n)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(QF(e,1,-1)),!t)return"Invalid host";this.host=t}else if(this.isSpecial()){if(e=NF(e),YF(uG,e))return"Invalid host";if(t=function(e){var t,r,n,i,o,a,s,c=$F(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(o=10,i.length>1&&"0"==zF(i,0)&&(o=YF(oG,i)?16:8,i=QF(i,8==o?1:2)),""===i)a=0;else{if(!YF(10==o?sG:8==o?aG:cG,i))return e;a=FF(i,o)}qF(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=HF(256,5-t))return null}else if(a>255)return null;for(s=WF(r),n=0;n<r.length;n++)s+=r[n]*HF(256,3-n);return s}(e),null===t)return"Invalid host";this.host=t}else{if(YF(dG,e))return"Invalid host";for(t="",r=AF(e),n=0;n<r.length;n++)t+=EG(r[n],pG);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return IF(SG,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&gG(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=fG(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+KF(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw jF(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new YG(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+fG(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(wF(e)+":",TG)},getUsername:function(){return this.username},setUsername:function(e){var t=AF(wF(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=EG(t[r],mG)}},getPassword:function(){return this.password},setPassword:function(e){var t=AF(wF(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=EG(t[r],mG)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?fG(e):fG(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,PG)},getHostname:function(){var e=this.host;return null===e?"":fG(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,MG)},getPort:function(){var e=this.port;return null===e?"":wF(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=wF(e))?this.port=null:this.parse(e,UG))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+KF(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,BG))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=wF(e))?this.query=null:("?"==zF(e,0)&&(e=QF(e,1)),this.query="",this.parse(e,GG)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=wF(e))?("#"==zF(e,0)&&(e=QF(e,1)),this.fragment="",this.parse(e,HG)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var YG=function(e){var t=TF(this,KG),r=kF(arguments.length,1)>1?arguments[1]:void 0,n=UF(t,new zG(e,!1,r));vF||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},KG=YG.prototype,XG=function(e,t){return{get:function(){return LF(this)[e]()},set:t&&function(e){return LF(this)[t](e)},configurable:!0,enumerable:!0}};if(vF&&yF(KG,{href:XG("serialize","setHref"),origin:XG("getOrigin"),protocol:XG("getProtocol","setProtocol"),username:XG("getUsername","setUsername"),password:XG("getPassword","setPassword"),host:XG("getHost","setHost"),hostname:XG("getHostname","setHostname"),port:XG("getPort","setPort"),pathname:XG("getPathname","setPathname"),search:XG("getSearch","setSearch"),searchParams:XG("getSearchParams"),hash:XG("getHash","setHash")}),bF(KG,"toJSON",(function(){return LF(this).serialize()}),{enumerable:!0}),bF(KG,"toString",(function(){return LF(this).serialize()}),{enumerable:!0}),BF){var WG=BF.createObjectURL,qG=BF.revokeObjectURL;WG&&bF(YG,"createObjectURL",SF(WG,BF)),qG&&bF(YG,"revokeObjectURL",SF(qG,BF))}DF(YG,"URL"),_F({global:!0,forced:!mF,sham:!vF},{URL:YG});var JG,ZG=function(){function e(e){this._sharedAudioContext=new AudioContext,this._audioDestination=this._sharedAudioContext.createMediaStreamDestination(),this._localGainNode=this._sharedAudioContext.createGain(),this._bufferGainNode=this._sharedAudioContext.createGain(),this.mixingMap=new Map,this.resourcesCache=new Map,this.volumeConfig=new Map,this.cachedBuffer=[],this._context=e,this._localGainNode.gain.value=1}return e.prototype.mixMediaStream=function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)},e.prototype.startAudioMixing=function(e,t,r){return Pp(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,f,p,_=this;return Mp(this,(function(v){switch(v.label){case 0:if(n=r.playCount,sD(i=r.type,"mixingType",xB(yL)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=Mx(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_STOPPED,error:zN.AUDIO_MIXING_ERROR_OK});try{s.gainNode.disconnect(this._audioDestination),s.audioSource.disconnect(s.gainNode)}catch(e){}}return(u=this.resourcesCache.get(e))&&u.filePath===t?(c=u.getAudioNode(),[3,3]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw _._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_FAILED,error:zN.AUDIO_MIXING_ERROR_START_FAILED}),new XN(HN.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:d=v.sent(),c=new Audio(URL.createObjectURL(new Blob([d]))),v.label=3;case 3:return c.crossOrigin="anonymous",n<=0?c.loop=!0:n>0&&(l=n,c.onended=function(){--l>0?c.play():_._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_FINISHED,error:zN.AUDIO_MIXING_ERROR_OK})}),[4,c.play()];case 4:if(v.sent(),h=this._sharedAudioContext.createMediaElementSource(c),f=this._sharedAudioContext.createGain(),p=this.volumeConfig.get(e),f.gain.value=p?p/100:1,h.connect(f).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:h,audioNode:c,gainNode:f,type:"file"}),i===yL.PUBLISH)try{f.disconnect(this._sharedAudioContext.destination)}catch(e){}else f.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],r.type),this._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_PLAYING,error:zN.AUDIO_MIXING_ERROR_OK}),[2]}}))}))},e.prototype.stopAudioMixing=function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_STOPPED,error:zN.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_PAUSED,error:zN.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())},e.prototype.resumeAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_PLAYING,error:zN.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n=this;return Mp(this,(function(i){switch(i.label){case 0:return this.stopAudioMixing(e),[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return n._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_PRELOADED,error:zN.AUDIO_MIXING_ERROR_OK}),t.arrayBuffer();throw n._context.emitMessage({mixId:e,state:bL.AUDIO_MIXING_STATE_FAILED,error:zN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new XN(HN.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(e){throw new XN(HN.LOAD_RESOURCES_FAILED,"Load resources failed",e)}))];case 1:return r=i.sent(),this.resourcesCache.set(e,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([r])))},filePath:t}),[2]}}))}))},e.prototype.unloadAudioMixing=function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)},e.prototype.getAudioMixingVolume=function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0},e.prototype.setAudioMixingVolume=function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var r=this.mixingMap.get(e);r&&(r.gainNode.gain.value=Number(t)/100)},e.prototype.getAudioMixingDuration=function(e){var t=this.mixingMap.get(e),r=this.mixingMap.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.audioNode.duration:0:0},e.prototype.getAudioMixingCurrentPosition=function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0},e.prototype.setAudioMixingPosition=function(e,t){var r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())},e.prototype.enableAudioMixingBuffer=function(e){sD(e,"type",xB(yL));var t=this._context.getLocalAudioTrack();if(t){var r=Mx(t.getTrack());if(r&&this.mixMediaStream(r),e===yL.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:bL.AUDIO_MIXING_STATE_PCM_ENABLED,error:zN.AUDIO_MIXING_ERROR_OK})}},e.prototype.disableAudioMixingBuffer=function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:bL.AUDIO_MIXING_STATE_PCM_DISABLED,error:zN.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;this._audioBufferSource&&this.cachedBuffer.push(e),this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode),this._audioBufferSource.start(),this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var r=t.cachedBuffer.shift();r&&t.pushAudioMixingBuffer(r)}}},e.prototype.stopAll=function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(e){}this.mixingMap.forEach((function(t,r){e.stopAudioMixing(r)}))},Object.defineProperty(e.prototype,"mixTrack",{get:function(){return this._audioDestination.stream.getAudioTracks()[0]},enumerable:!1,configurable:!0}),e.prototype.destroy=function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()},kp([UU(!1,"id","filePath","options")],e.prototype,"startAudioMixing",null),kp([UU(!1,"id")],e.prototype,"stopAudioMixing",null),kp([UU(!1,"id")],e.prototype,"pauseAudioMixing",null),kp([UU(!1,"id")],e.prototype,"resumeAudioMixing",null),kp([UU(!1,"id")],e.prototype,"preloadAudioMixing",null),kp([UU(!1,"id")],e.prototype,"unloadAudioMixing",null),kp([UU(!1,"id")],e.prototype,"getAudioMixingVolume",null),kp([UU(!1,"id","volume")],e.prototype,"setAudioMixingVolume",null),kp([UU(!1,"id")],e.prototype,"getAudioMixingDuration",null),kp([UU(!1,"id")],e.prototype,"getAudioMixingCurrentPosition",null),kp([UU(!1,"id","position")],e.prototype,"setAudioMixingPosition",null),kp([UU(!1,"type")],e.prototype,"enableAudioMixingBuffer",null),kp([UU()],e.prototype,"disableAudioMixingBuffer",null),kp([UU(!1,"buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(JG||(JG={}));var $G=new CD("RTMClient",1),QG=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r._dataChannelSignal=null,r._handler=null,r._dataChannelSignalState=LL.DISCONNECTED,r._loginSessionId=null,r._userId=null,r._token=null,r._isReconnecting=!1,r._reconnectTimer=null,r._loginResolveCallback=null,r._loginRejectCallback=null,r._iceConfigNode=null,r._wait_login_token=!1,r}return wp(t,e),t.prototype.login=function(e,t){var r=this;return new Promise((function(n,i){if($G.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new XN(HN.ALREADY_LOGIN,"Already logined");r._userId=t,r._token=e,MU.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():($G.print("login","init dataChannelSingling"),r._dataChannelSignalState=LL.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))},t.prototype.logout=function(){var e;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){if(!this._loginSessionId||!this._userId)throw new XN(HN.NOT_LOGIN,"login first");return null===(e=this._dataChannelSignal)||void 0===e||e.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:BU.C2RTM}).catch((function(){})),this._closeDataChannelSignaling(),this._clearState(),[2]}))}))},t.prototype.updateLoginToken=function(e){return Pp(this,void 0,void 0,(function(){var t=this;return Mp(this,(function(r){return this._token=e,[2,new Promise((function(e,r){t._wait_login_token?(t._loginResolveCallback=e,t._loginRejectCallback=r,t._login()):e()}))]}))}))},t.prototype.getPeerOnlineStatus=function(e){return Pp(this,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new XN(HN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:BU.C2RTM})];case 1:return[2,null==(t=r.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new XN(HN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:e,room:"",msg:t})];case 1:return r.sent(),[2]}}))}))},t.prototype.setServerParams=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new XN(HN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:e,url:t},{functionType:BU.C2RTM})];case 1:return r.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new XN(HN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:AU.BUSINESS_SERVER,msg:e})];case 1:return t.sent(),[2]}}))}))},t.prototype.destroy=function(){this._clearState(),this._closeDataChannelSignaling(),e.prototype.removeAllListeners.call(this)},t.prototype._login=function(){var e=this;if(this._userId){var t=Ww();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:$w.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now().toString(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:fk.VERSION,deviceId:KU.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:BU.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).catch((function(t){var r,n,i=t||{},o=i.code,a=i.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=HN.INVALID_PARAMS,n="Invalid userId"):(r=HN.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=HN.LOGIN_FAILED,n="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new XN(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){return Pp(this,void 0,void 0,(function(){var t,r,n,i,o,a=this;return Mp(this,(function(s){switch(s.label){case 0:if(t=new WU,r=this._iceConfigNode)return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,null==t?void 0:t.getAccessNode(this._appId,"",e,KU.getDeviceId(),"")];case 2:if(!(r=s.sent()))throw new Error;return[3,4];case 3:throw s.sent(),xU("rtm.login.getNodeFailed","",0,!0),new XN(HN.ICE_SERVER_WRONG,"get ICE config failed");case 4:xU("rtm.login.getNodeSuccess",r,0,!0),$G.print("_createDataChannelSignaling()","get node success",r),this._handler=new wL,this._handler.once("disconnect",(function(){$G.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),a._onDisconnect()})),s.label=5;case 5:return s.trys.push([5,7,,8]),[4,this._handler.connect(r)];case 6:return n=s.sent(),$G.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=LL.CONNECTED,[3,8];case 7:throw i=s.sent(),this._iceConfigNode=null,this._dataChannelSignalState=LL.DISCONNECTED,new XN(HN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",i);case 8:return o=new GU(n),$G.print("_createDataChannelSignaling()","send ping"),o.sendPingSignaling(),o.once("close",(function(){$G.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),a._onDisconnect()})),o.on(bU.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(bU.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(bU.USER_DISCONNECTION,(function(){a.emit("onUserDisconnection"),a._clearState()})),o.on(bU.NODE_CHANGE,(function(e){xU("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(a._iceConfigNode=e.nodes[0]),a._loginResolveCallback&&a._loginRejectCallback?a._login():a._reconnect()})),[2,o]}}))}))},t.prototype._closeDataChannelSignaling=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null},t.prototype._checkDataChannelSignal=function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==LL.CONNECTED)throw new XN(HN.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=LL.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._reconnect=function(){var e=this;!this._isReconnecting&&this._userId&&($G.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){$G.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){$G.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))},t.prototype._clearState=function(){this._userId=null,this._token=null,this._loginSessionId=null,null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)},t}(vD.exports.EventEmitter),eH=new CD("Engine",0),tH=function(e){function t(t){var r=e.call(this)||this;return r._visibility=!0,r._remoteVideoPlayer=new Map,r._remoteScreenPlayer=new Map,r._remoteAudioPlayer=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._videoStreamEncodeConfig=[{maxKbps:500}],r._screenStreamEncodeConfig=[{maxKbps:500}],r._pauseAllSubscribeState={audio:!1,video:!1},r._mirrorType=sk.MIRROR_TYPE_RENDER,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=yL.PLAYOUT_AND_PUBLISH),Pp(r,void 0,void 0,(function(){var r;return Mp(this,(function(n){switch(n.label){case 0:return eH.print("_updateMixAudioTrack()"),this._localAudioTrack?(e?(this._localAudioTrack.mixType=t,this._localAudioTrack.mixedAudioTrack=e):(delete this._localAudioTrack.mixType,delete this._localAudioTrack.mixedAudioTrack),(null===(r=this._room)||void 0===r?void 0:r.hasPublished)?[4,this._updatePublish()]:[3,2]):(e&&(this._tempMixingAudioTrack={track:e,type:t}),[2]);case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(rD.onAudioMixingStateChanged,e)},r._appId=t,r._pubLock=new PL("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new ZG({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage}),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=r,r._trackSourceType={video:XD.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:XD.VIDEO_SOURCE_TYPE_INTERNAL,audio:WD.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:WD.AUDIO_SOURCE_TYPE_INTERNAL},r._rtmClient=new QG(t),r._handleRTMClient(r._rtmClient),r}return wp(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t;eH.print("updateToken()","token: %s",e),aD(e,"token"),null===(t=this._room)||void 0===t||t.updateToken(e)},t.prototype.switchCamera=function(e){var t,r;return Pp(this,void 0,void 0,(function(){var n,i;return Mp(this,(function(o){switch(o.label){case 0:return eH.print("switchCamera()","deviceId: %s",e),aD(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((n=this._videoStreamConstraints).deviceId={exact:e},this._videoStreamConstraints=n,[4,Wx(n)]);case 1:return i=o.sent(),this._initLocalTrackEvents(i),this._localVideoTrack&&this._localVideoTrack.close(),this._localVideoTrack=i,this._videoPlayer&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(i),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},t.prototype.switchMicrophone=function(e){var t,r;return Pp(this,void 0,void 0,(function(){var n,i;return Mp(this,(function(o){switch(o.label){case 0:return eH.print("switchMicrophone()","deviceId: %s",e),aD(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((n=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=n,[4,qx(n)]);case 1:return i=o.sent(),this._initLocalTrackEvents(i),this._localAudioTrack&&this._localAudioTrack.close(),this._localAudioTrack=i,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){Ox.on(rD.onMediaDeviceStateChanged,this._onDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E,S,g,y,b,T=this;null===(e=this._room)||void 0===e||e.on(bU.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(bU.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(bU.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(bU.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._room)||void 0===i||i.on(bU.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(o=this._room)||void 0===o||o.on(bU.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(a=this._room)||void 0===a||a.on(bU.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(s=this._room)||void 0===s||s.on(bU.POST_PROCESSING_MESSAGE,this._onLiveTranscodingResult.bind(this)),null===(c=this._room)||void 0===c||c.on(TU.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(u=this._room)||void 0===u||u.on($x.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(d=this._room)||void 0===d||d.on($x.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(l=this._room)||void 0===l||l.on($x.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(h=this._room)||void 0===h||h.on($x.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(f=this._room)||void 0===f||f.on($x.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=T._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&T.safeEmit(rD.onAutoPublishResult,e)})),null===(p=this._room)||void 0===p||p.on("onRemoteStreamStats",(function(e){T.safeEmit(rD.onRemoteStreamStats,e)})),null===(_=this._room)||void 0===_||_.on("onLocalStreamStats",(function(e){T.safeEmit(rD.onLocalStreamStats,e)})),null===(v=this._room)||void 0===v||v.on($x.ON_USER_MUTE_AUDIO,this._onUserMuteAudio.bind(this)),null===(m=this._room)||void 0===m||m.on($x.ON_USER_MUTE_VIDEO,this._onUserMuteVideo.bind(this)),null===(E=this._room)||void 0===E||E.on($x.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;T.safeEmit(rD.onUserStartAudioCapture,{userId:t})})),null===(S=this._room)||void 0===S||S.on($x.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;T.safeEmit(rD.onUserStopAudioCapture,{userId:t})})),null===(g=this._room)||void 0===g||g.on($x.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;T.safeEmit(rD.onUserStartVideoCapture,{userId:t})})),null===(y=this._room)||void 0===y||y.on($x.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;T.safeEmit(rD.onUserStopVideoCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on($x.ON_SEI_MESSAGED_RECEIVED,(function(e){T.safeEmit(rD.onSEIMessageReceived,e)}))},t.prototype.safeEmit=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return _D(t)&&LU(t,tD(r)),e.prototype.safeEmit.apply(this,xp([t],Lp(r),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.joinRoom=function(e,t,r,n){return void 0===n&&(n={isAutoPublish:!1,isAutoSubscribeAudio:!1,isAutoSubscribeVideo:!1}),Pp(this,void 0,void 0,(function(){var i;return Mp(this,(function(o){switch(o.label){case 0:if(eH.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,r,n),lD(e)||aD(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9 \_\-\@]{1,128}$/.test(e))throw new XN(HN.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_")}(t),function(e){cD(e,"userInfo"),hD(e.userId),lD(e.extraInfo)||aD(e.extraInfo,"userInfo.extraInfo",1,200)}(r),function(e){cD(e,"roomConfig"),iD(e.isAutoPublish,"roomConfig.isAutoPublish"),iD(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),iD(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(n),!this._room||this._room.connectionState===LL.DISCONNECTED)return[3,1];throw new XN(HN.REPEAT_JOIN,"Already joined");case 1:return this._room=new oV(n),this._addHandlerEventHandler(),i=this._liveTranscodeConfig&&vk("started",this._liveTranscodeConfig),[4,this._room.join(this._appId,t,e,Dp(Dp({},r),{businessId:this._businessId,role:this._visibility?JG.NORMAL_USER:JG.SILENT_USER}),i)];case 2:return o.sent(),this._roomConfig=n,(this._localAudioTrack||this._localVideoTrack)&&n.isAutoPublish?[4,this._updatePublish()]:[3,4];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))},t.prototype.leaveRoom=function(){var e;eH.print("leaveRoom()"),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.leave().catch,this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.stop()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.stop()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.stop()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0},t.prototype.destroy=function(){var e,t,r;eH.print("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,null===(t=this._videoPlayer)||void 0===t||t.destroy(),null===(r=this._audioPlayer)||void 0===r||r.destroy(),this._videoPlayer=void 0,this._audioPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[{maxKbps:500}],this._screenStreamEncodeConfig=[{maxKbps:500}],this._pauseAllSubscribeState={audio:!1,video:!1},clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=void 0,this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.stop()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.stop()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.stop()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy()},t.prototype.publish=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){switch(e.label){case 0:if(eH.print("publish()"),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.PUBLISH_BEFORE_JOIN,"join first");return[4,this._updatePublish()];case 1:return e.sent(),[2]}}))}))},t.prototype.unpublish=function(){return Pp(this,void 0,void 0,(function(){var e,t;return Mp(this,(function(r){switch(r.label){case 0:if(eH.print("unpublish()"),!this._room)throw new XN(HN.UNPUBLISH_BEFORE_JOIN,"join first");return[4,this._pubLock.lock()];case 1:e=r.sent(),r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.unpublish()];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof XN?t:new XN(HN.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype.subscribeUserStream=function(e,t,r,n){var i,o,a,s;return void 0===r&&(r=nk.STREAM_INDEX_MAIN),void 0===n&&(n={videoIndex:0}),Pp(this,void 0,void 0,(function(){var c,u,d,l,h,f;return Mp(this,(function(p){switch(p.label){case 0:if(eH.print("subscribeStream()","userId: %o, mediaType: %o, streamType: %o, configure: %o",e,t,r,n),hD(e),sD(t,"mediaType",[ik.AUDIO_AND_VIDEO,ik.AUDIO_ONLY,ik.VIDEO_ONLY,ik.NONE]),sD(r,"streamType",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),oD(n.videoIndex,"config.videoIndex",0,2),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.SUBSCRIBE_BEFORE_JOIN,"join first");if(c=this._room.remoteStreams.get(e),d=r===nk.STREAM_INDEX_SCREEN,!(u=d?null==c?void 0:c.find((function(e){return e.isScreen})):null==c?void 0:c.find((function(e){return!e.isScreen}))))throw new XN(HN.STREAM_NOT_EXIST,"stream not exist");p.label=1;case 1:return p.trys.push([1,3,,4]),l=t,this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?t=ik.NONE:this._pauseAllSubscribeState.audio&&!this._pauseAllSubscribeState.video?t===ik.AUDIO_AND_VIDEO?t=ik.VIDEO_ONLY:t===ik.AUDIO_ONLY&&(t=ik.NONE):!this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video&&(t===ik.AUDIO_AND_VIDEO?t=ik.AUDIO_ONLY:t===ik.VIDEO_ONLY&&(t=ik.NONE)),t!==l&&eH.print("subscribeUserStream","due to pauseAllState change sub mediaType from ".concat(l," to ").concat(t)),[4,this._room.subscribe(u,t,n)];case 2:return p.sent(),t!==ik.AUDIO_AND_VIDEO&&t!==ik.AUDIO_ONLY||this._updateAudioPlayerState(u),t!==ik.AUDIO_AND_VIDEO&&t!==ik.VIDEO_ONLY||this._updateVideoPlayerState(u),((null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)||(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo))&&(u.audioTrack||u.videoTrack)&&(f={userId:e,isScreen:d,state:$D.SUBSCRIBE_SUCC},this.safeEmit(rD.onAutoSubscribeResult,f)),[3,4];case 3:throw h=p.sent(),((null===(a=this._roomConfig)||void 0===a?void 0:a.isAutoSubscribeAudio)||(null===(s=this._roomConfig)||void 0===s?void 0:s.isAutoSubscribeVideo))&&(f={userId:e,isScreen:d,state:$D.SUBSCRIBE_FAIL},this.safeEmit(rD.onAutoSubscribeResult,f)),h;case 4:return[2]}}))}))},t.prototype.unSubscribe=function(e,t){return Pp(this,void 0,void 0,(function(){var r,n;return Mp(this,(function(i){switch(i.label){case 0:if(eH.print("unSubscribe()","userId: %s, isScreen: %o",e,t),hD(e),iD(t,"isScreen"),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.SUBSCRIBE_BEFORE_JOIN,"join first");if(r=this._room.remoteStreams.get(e),!(n=t?null==r?void 0:r.find((function(e){return e.isScreen})):null==r?void 0:r.find((function(e){return!e.isScreen}))))throw new XN(HN.STREAM_NOT_EXIST,"stream not exist");return[4,this._room.unsubscribe(n)];case 1:return i.sent(),this._updateAudioPlayerState(n),this._updateVideoPlayerState(n),[2]}}))}))},t.prototype.startVideoCapture=function(e){return Pp(this,void 0,void 0,(function(){var t,r,n;return Mp(this,(function(i){switch(i.label){case 0:if(eH.print("startVideoCapture()","deviceId: %s",e),lD(e)||aD(e,"deviceId"),this._localVideoTrack)throw new XN(HN.REPEAT_CAPTURE,"Has already capture");return t=this._videoStreamConstraints,e&&(t.deviceId={exact:e},this._videoStreamConstraints=t),[4,Wx(t)];case 1:return r=i.sent(),this._initLocalTrackEvents(r),this._localVideoTrack=r,this._videoPlayer&&this._videoPlayer.playVideo(r),this._room?(n=this._room._roomConfig.isAutoPublish,this._room.hasPublished||n?[4,this._updatePublish()]:[3,3]):[2];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))},t.prototype.stopVideoCapture=function(){var e;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:if(eH.print("stopVideoCapture()"),this._trackSourceType.video===XD.VIDEO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");return this._videoPlayer&&this._videoPlayer.stop(),null===(e=this._localVideoTrack)||void 0===e||e.close(),this._localVideoTrack=void 0,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.startAudioCapture=function(e){return Pp(this,void 0,void 0,(function(){var t,r,n;return Mp(this,(function(i){switch(i.label){case 0:if(eH.print("startAudioCapture()","deviceId: $o",e),lD(e)||aD(e,"deviceId"),this._localAudioTrack)throw new XN(HN.REPEAT_CAPTURE,"Has already capture");return t=this._audioStreamConstraints,e&&(t.deviceId={exact:e},this._audioStreamConstraints=t),[4,qx(t)];case 1:return r=i.sent(),this._initLocalTrackEvents(r),this._localAudioTrack=r,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(n=this._room._roomConfig.isAutoPublish,this._room.hasPublished||n?[4,this._updatePublish()]:[3,3]):[2];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))},t.prototype.stopAudioCapture=function(){var e;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:if(eH.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===WD.AUDIO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.getAudioMixingManager=function(){return eH.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,r;return void 0===e&&(e={}),Pp(this,void 0,void 0,(function(){var n,i,o,a;return Mp(this,(function(s){switch(s.label){case 0:if(eH.print("startScreenCapture()","config: %o",e),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localScreenVideoTrack=void 0,n=e.enableAudio,i=void 0!==n&&n,this._trackSourceType.screenVideo===XD.VIDEO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===WD.AUDIO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,Jx(i)];case 1:return o=s.sent(),this._localScreenVideoTrack=new zx(o.getVideoTracks()[0],Ww()),(a=o.getAudioTracks()).length&&(this._localScreenAudioTrack=new Yx(a[0],Ww()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(r=this._screenPlayer)||void 0===r||r.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,r;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(n){return eH.print("stopScreenCapture()"),null===(e=this._screenPlayer)||void 0===e||e.stop(),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localScreenVideoTrack=void 0,null===(r=this._localScreenAudioTrack)||void 0===r||r.close(),this._localScreenAudioTrack=void 0,[2]}))}))},t.prototype.publishScreen=function(){return Pp(this,void 0,void 0,(function(){var e;return Mp(this,(function(t){switch(t.label){case 0:if(eH.print("publishScreen()"),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.PUBLISH_BEFORE_JOIN,"join first");if(!this._visibility)throw new XN(HN.NO_PUBLISH_PERMISSION,"no publish permission");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 2:return t.sent(),[3,4];case 3:throw(e=t.sent())instanceof XN?e:new XN(HN.UNEXPECTED_ERROR,"unexpected error",e);case 4:return[2]}}))}))},t.prototype.unpublishScreen=function(){return Pp(this,void 0,void 0,(function(){var e;return Mp(this,(function(t){switch(t.label){case 0:if(eH.print("unpublishScreen()"),!this._room)throw new XN(HN.UNPUBLISH_BEFORE_JOIN,"join first");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._room.unpublishScreen()];case 2:return t.sent(),[3,4];case 3:throw(e=t.sent())instanceof XN?e:new XN(HN.UNEXPECTED_ERROR,"unexpected error",e);case 4:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var r,n;eH.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),t&&t.renderDom?(fD(t),e==nk.STREAM_INDEX_MAIN?(this._videoPlayer=new fV(t),this._initPlayerEvents(this._videoPlayer),this._localVideoTrack&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.mirror(!!this._mirrorType)):(this._screenPlayer=new fV(Dp(Dp({},t),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&this._screenPlayer.playVideo(this._localScreenVideoTrack))):e==nk.STREAM_INDEX_MAIN?(null===(r=this._videoPlayer)||void 0===r||r.destroy(),delete this._videoPlayer):(null===(n=this._screenPlayer)||void 0===n||n.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return Pp(this,void 0,void 0,(function(){var r;return Mp(this,(function(n){switch(n.label){case 0:eH.print("startLiveTranscoding()","transcode: %o",e),aD(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.controlMessage(vk("started",this._liveTranscodeConfig))];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof XN?r:new XN(HN.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return Pp(this,void 0,void 0,(function(){var r;return Mp(this,(function(n){switch(n.label){case 0:if(eH.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=UB(this._liveTranscodeConfig,e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.controlMessage(vk("layoutChanged",this._liveTranscodeConfig))];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof XN?r:new XN(HN.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return Pp(this,void 0,void 0,(function(){var t;return Mp(this,(function(r){switch(r.label){case 0:if(eH.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,null===(e=this._room)||void 0===e?void 0:e.controlMessage({action:"stopped",type:"transcode"})];case 2:return r.sent(),[3,4];case 3:throw(t=r.sent())instanceof XN?t:new XN(HN.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){if(eH.print("setBusinessId()","businessId: %s",e),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9 \_\-\@]{1,128}$/.test(e))throw new XN(HN.INVALID_PARAMS,"The businessId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_")}(e),this._room)throw new XN(HN.ALREADY_IN_ROOM,"You should invoke setBusinessId before joinRoom");PU.setStats({rtc_business_id:e}),this._businessId=e},t.prototype.setUserVisibility=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){switch(t.label){case 0:if(eH.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==LL.CONNECTED)throw new XN(HN.NOT_CONNECTED_YET,"server not connected");return!e?[4,this._room.unpublish()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[4,this._room.updateUserAttributes({role:e?JG.NORMAL_USER:JG.SILENT_USER})];case 3:return t.sent(),this._visibility=e,[2]}}))}))},t.prototype._initPlayerEvents=function(e){var t=this;e.on("playback_event",(function(r){var n,i;switch(r.eventName){case"timeupdate":return;case"loadeddata":if("audio"===r.type)t.safeEmit(rD.onAudioFirstFrameDecoded,{userId:e.userId}),DU.firstRemoteAudioRender("",r.userId);else{var o={userId:e.userId,height:(null===(n=e.domElement)||void 0===n?void 0:n.videoHeight)||0,width:(null===(i=e.domElement)||void 0===i?void 0:i.videoWidth)||0};t.safeEmit(rD.onVideoFirstFrameDecoded,o),t.safeEmit(rD.onVideoFirstFrameRendered,o),DU.firstRemoteVideoRender("",r.userId)}break;case"autoplay-error":return void t.safeEmit(rD.onAutoplayFailed,r)}t.safeEmit(rD.onPlayerEvent,r)}))},t.prototype._initLocalTrackEvents=function(e){var t=this;e.on("track-ended",(function(e){var r=!1;e!==t._localScreenAudioTrack&&e!==t._localScreenVideoTrack||(r=!0),t.safeEmit(rD.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var r,n,i,o,a,s;if(eH.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),t.renderDom){fD(t);var c=t.userId;if(e==nk.STREAM_INDEX_MAIN){var u=new fV(t);this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(o=null===(i=this._room)||void 0===i?void 0:i.remoteStreams.get(c))||void 0===o?void 0:o.find((function(e){return!e.isScreen})))&&this._updateVideoPlayerState(d)}else{var d;u=new fV(Dp(Dp({},t),{isScreen:!0}));this._remoteScreenPlayer.set(c,u),this._initPlayerEvents(u),(d=null===(s=null===(a=this._room)||void 0===a?void 0:a.remoteStreams.get(c))||void 0===s?void 0:s.find((function(e){return e.isScreen})))&&this._updateVideoPlayerState(d)}}else e==nk.STREAM_INDEX_MAIN?(null===(r=this._videoPlayer)||void 0===r||r.destroy(),delete this._videoPlayer):(null===(n=this._screenPlayer)||void 0===n||n.destroy(),delete this._screenPlayer)},t.prototype.setLocalVideoMirrorType=function(e){eH.print("setLocalVideoMirrorType()","mirrorType: %o",e),sD(e,"mirrorType",[sk.MIRROR_TYPE_NONE,sk.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){var t;return Pp(this,void 0,void 0,(function(){var r;return Mp(this,(function(n){switch(n.label){case 0:return eH.print("setAudioPlaybackDevice()","deviceId: %s",e),aD(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(eH.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,Ox.getDeviceById(e)];case 1:if(!(r=n.sent()))throw new XN(HN.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),null===(t=this._audioPlayer)||void 0===t||t.setPlaybackDevice(e),this._audioPlaybackDeviceId=e,r&&this.safeEmit(rD.onAudioPlaybackDeviceChanged,r),DU.rtcAudioDevice(eU.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e){return Pp(this,void 0,void 0,(function(){var t,r;return Mp(this,(function(n){if(eH.print("play()","userId: %s",e),hD(e),t=this._remoteAudioPlayer.get(e),r=this._remoteVideoPlayer.get(e),t||(t=this._audioPlayer),r||(r=this._videoPlayer),!t&&!r)throw new XN(HN.INVALID_PARAMS,"Player not found");return t&&t.manuallyPlay(),r&&r.manuallyPlay(),[2]}))}))},t.prototype.muteLocalAudio=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){if(eH.print("muteLocalAudio()","muteState: %o",e),sD(e,"muteState",[ZD.MUTE_STATE_OFF,ZD.MUTE_STATE_ON]),!this._room)throw new XN(HN.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("audio",e)]}))}))},t.prototype.muteLocalVideo=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){if(eH.print("muteLocalVideo()","muteState: %o",e),sD(e,"muteState",[ZD.MUTE_STATE_OFF,ZD.MUTE_STATE_ON]),!this._room)throw new XN(HN.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("video",e)]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return Pp(this,void 0,void 0,(function(){var t,r=this;return Mp(this,(function(n){return eH.print("pauseAllSubscribedStream()","mediaType: %o",e),sD(e,"mediaType",[tk.RTC_PAUSE_RESUME_CONTROL_AUDIO,tk.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,tk.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?[2,Promise.resolve()]:(t=function(){e===tk.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!0:e===tk.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!0:e===tk.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO&&(r._pauseAllSubscribeState.audio=!0,r._pauseAllSubscribeState.video=!0)},this._room?[2,this._room.pauseAllSubscribedStream(e).then((function(){t()}))]:(t(),[2,Promise.resolve()]))}))}))},t.prototype.resumeAllSubscribedStream=function(e){return Pp(this,void 0,void 0,(function(){var t,r=this;return Mp(this,(function(n){return eH.print("resumeAllSubscribedStream()","mediaType: %o",e),sD(e,"mediaType",[tk.RTC_PAUSE_RESUME_CONTROL_AUDIO,tk.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,tk.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video?(t=function(){e===tk.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!1:e===tk.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!1:e===tk.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO&&(r._pauseAllSubscribeState.audio=!1,r._pauseAllSubscribeState.video=!1)},this._room?[2,this._room.resumeAllSubscribedStream(e).then((function(){var e,n;t(),null===(n=null===(e=r._room)||void 0===e?void 0:e.remoteStreams)||void 0===n||n.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r._updateAudioPlayerState(e),r._updateVideoPlayerState(e)}))}))}))]:(t(),[2,Promise.resolve()])):[2,Promise.resolve()]}))}))},t.prototype.sendUserMessage=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){if(hD(e),pD(t),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){if(hD(e),uD(t,"message"),pD(t),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendRoomMessage=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){if(pD(e),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e)]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){if(pD(e),!this._room||this._room.connectionState!==LL.CONNECTED)throw new XN(HN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e,!0)]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),Pp(this,void 0,void 0,(function(){var r;return Mp(this,(function(n){switch(n.label){case 0:return eH.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,dD(e),r=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=e,r&&(this._audioStreamConstraints.deviceId=r),this._localAudioTrack?(this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,[4,null===(t=this._localAudioTrack)||void 0===t?void 0:t.updateAudioCaptureConfig()]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),Pp(this,void 0,void 0,(function(){var r;return Mp(this,(function(n){switch(n.label){case 0:return eH.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,dD(e),r=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=e,r&&(this._videoStreamConstraints.deviceId=r),this._localVideoTrack?(this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,[4,null===(t=this._localVideoTrack)||void 0===t?void 0:t.updateVideoCaptureConfig()]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setVideoEncoderConfig=function(e,t){var r,n,i,o,a,s,c,u;return Pp(this,void 0,void 0,(function(){return Mp(this,(function(d){if(eH.print("setVideoEncoderConfig()","streamIndex: %o, descriptions: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),function(e,t){if(!Array.isArray(e))throw new XN(HN.INVALID_PARAMS,"Invalid ".concat(t,", should be array"))}(t,"descriptions"),t.length>3&&(t=t.slice(0,3)),t.sort((function(e,t){return t.maxKbps-e.maxKbps})),e===nk.STREAM_INDEX_MAIN){if(null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.hasPublished){if(1!==this._videoStreamEncodeConfig.length||1!==(null==t?void 0:t.length))throw new XN(HN.INVALID_PARAMS,"After publishing, only non simulcast streams can be modified");null===(o=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===o||o.updateVideoBitrate(t)}this._videoStreamEncodeConfig=t}else{if(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished){if(1!==this._screenStreamEncodeConfig.length||1!==(null==t?void 0:t.length))throw new XN(HN.INVALID_PARAMS,"After publishing, only non simulcast streams can be modified");null===(u=null===(c=this._room)||void 0===c?void 0:c.localScreenStream)||void 0===u||u.updateVideoBitrate([t[0]])}this._screenStreamEncodeConfig=t}return[2]}))}))},t.prototype.sendSEIMessage=function(e,t,r){var n,i,o,a,s,c;eH.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),oD(r,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array($w.str2ab(t)):t;if(t.length){var d;if(e===nk.STREAM_INDEX_MAIN){if(!(null===(i=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===i?void 0:i.hasPublished))return;d=null===(o=this._room)||void 0===o?void 0:o.localStream}else{if(!(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished))return;d=null===(c=this._room)||void 0===c?void 0:c.localScreenStream}if(u.byteLength>4096)eH.print("sei size must not bigger than 4KB");else{var l=Ww();d.seiList.push({content:u,uuid:l,repeatCount:r}),setTimeout((function(){if(d){var e=d.seiList.findIndex((function(e){return e.uuid===l}));e&&d.seiList.splice(e,1)}}),2e3)}}else eH.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;eH.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var r=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,n,i,o;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var n,i;if(0!==e.length){var o=null===(i=null===(n=e[0])||void 0===n?void 0:n.audioTrack)||void 0===i?void 0:i.getAudioLevel();r.push({userId:t,volume:o||0})}}));var a=null===(n=t._localAudioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:(null===(o=null===(i=t._room)||void 0===i?void 0:i.roomInfo)||void 0===o?void 0:o.userInfo.userId)||"local_user",volume:a||0}),t.safeEmit(rD.onAudioVolumeIndication,{speakers:r})}),e)},t.prototype.setVideoSourceType=function(e,t){var r,n,i,o,a;return Pp(this,void 0,void 0,(function(){var s,c;return Mp(this,(function(u){switch(u.label){case 0:return eH.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),sD(t,"VideoSourceType",[XD.VIDEO_SOURCE_TYPE_EXTERNAL,XD.VIDEO_SOURCE_TYPE_INTERNAL]),s=e===nk.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[s]===t?[3,4]:(this._trackSourceType[s]=t,eH.print("setVideoSourceType","set ".concat(s," source type to ").concat(t)),this._localVideoTrack&&e===nk.STREAM_INDEX_MAIN?(t===XD.VIDEO_SOURCE_TYPE_EXTERNAL&&this._localVideoTrack.close(),null===(r=this._videoPlayer)||void 0===r||r.stop(),this._localVideoTrack=void 0,c=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,(null===(i=this._room)||void 0===i?void 0:i.hasPublished)||c?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:u.sent(),u.label=2;case 2:return this._localScreenVideoTrack&&e===nk.STREAM_INDEX_SCREEN?(t===XD.VIDEO_SOURCE_TYPE_EXTERNAL&&this._localScreenVideoTrack.close(),null===(o=this._screenPlayer)||void 0===o||o.stop(),this._localScreenVideoTrack=void 0,(null===(a=this._room)||void 0===a?void 0:a.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:u.sent(),u.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var r,n,i,o,a;return Pp(this,void 0,void 0,(function(){var s;return Mp(this,(function(c){switch(c.label){case 0:if(eH.print("setExternalVideoTrack()","index: %o, track: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),e!==nk.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==XD.VIDEO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new Kx(t,Ww()),this._initLocalTrackEvents(this._localVideoTrack),null===(r=this._videoPlayer)||void 0===r||r.playVideo(this._localVideoTrack),s=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,(null===(i=this._room)||void 0===i?void 0:i.hasPublished)||s?[4,this._updatePublish()]:[3,2];case 1:c.sent(),c.label=2;case 2:if(e!==nk.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==XD.VIDEO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new Kx(t,Ww()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),(null===(a=this._room)||void 0===a?void 0:a.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:c.sent(),c.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var r,n,i;return Pp(this,void 0,void 0,(function(){var o,a;return Mp(this,(function(s){switch(s.label){case 0:return eH.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),sD(t,"audioSourceType",[WD.AUDIO_SOURCE_TYPE_EXTERNAL,WD.AUDIO_SOURCE_TYPE_INTERNAL]),o=e===nk.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[o]===t?[3,4]:(this._trackSourceType[o]=t,eH.print("setVideoSourceType","set ".concat(o," source type to ").concat(t)),this._localAudioTrack&&e===nk.STREAM_INDEX_MAIN?(this._trackSourceType.audio===WD.AUDIO_SOURCE_TYPE_EXTERNAL&&this._localAudioTrack.close(),this._localAudioTrack=void 0,a=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||a?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:s.sent(),s.label=2;case 2:return this._localScreenAudioTrack&&e===nk.STREAM_INDEX_SCREEN?(this._trackSourceType.audio===WD.AUDIO_SOURCE_TYPE_EXTERNAL&&this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0,(null===(i=this._room)||void 0===i?void 0:i.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:s.sent(),s.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var r,n,i;return Pp(this,void 0,void 0,(function(){var o;return Mp(this,(function(a){switch(a.label){case 0:if(eH.print("setExternalAudioTrack()","index: %o, track: %o",e,t),sD(e,"streamIndex",[nk.STREAM_INDEX_MAIN,nk.STREAM_INDEX_SCREEN]),e!==nk.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==WD.AUDIO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new Xx(t,Ww()),this._initLocalTrackEvents(this._localAudioTrack),o=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||o?[4,this._updatePublish()]:[3,2];case 1:a.sent(),a.label=2;case 2:if(e!==nk.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==WD.AUDIO_SOURCE_TYPE_EXTERNAL)throw new XN(HN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new Xx(t,Ww()),this._initLocalTrackEvents(this._localScreenAudioTrack),(null===(i=this._room)||void 0===i?void 0:i.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:a.sent(),a.label=4;case 4:return[2]}}))}))},t.prototype.login=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){return eH.print("login()","token: %o, userInfo: %o",e,t),lD(e)||aD(e,"token"),hD(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(e){return eH.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){return eH.print("updateLoginToken()","token: %o",e),lD(e)||aD(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){return eH.print("getPeerOnlineStatus()","userId: %o",e),hD(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){return hD(e),pD(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){return hD(e),uD(t,"message"),pD(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.setServerParams=function(e,t){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(r){return eH.print("setServerParams()","signature: %o, url: %0",e,t),aD(e,"signature"),aD(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){return aD(e,"message"),pD(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.sendServerBinaryMessage=function(e){return Pp(this,void 0,void 0,(function(){return Mp(this,(function(t){return uD(e,"message"),pD(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype._updatePublish=function(){return Pp(this,void 0,void 0,(function(){var e,t;return Mp(this,(function(r){switch(r.label){case 0:if(eH.print("_updatePublish()"),!this._visibility)throw new XN(HN.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(e=r.sent(),!this._room||this._room.connectionState!==LL.CONNECTED)return e(),[2];r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._localVideoTrack,this._localAudioTrack)];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof XN?t:new XN(HN.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype._updateScreenPublish=function(){return Pp(this,void 0,void 0,(function(){var e,t;return Mp(this,(function(r){switch(r.label){case 0:return eH.print("_updateScreenPublish()"),[4,this._pubLock.lock()];case 1:if(e=r.sent(),!this._room||this._room.connectionState!==LL.CONNECTED)return e(),[2];r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof XN?t:new XN(HN.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){eH.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen;if(t=n?this._remoteAudioPlayer.get("".concat(r,"_screen")):this._remoteAudioPlayer.get(r),e.audioTrack){if(!t){var i=n?"".concat(r,"_screen"):r;t=new pV(i),this._initPlayerEvents(t),this._remoteAudioPlayer.set(i,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}t.playAudio(e.audioTrack)}else null==t||t.stop()},t.prototype._updateVideoPlayerState=function(e){eH.print("_updateVideoPlayerState()");var t,r=e.userId;t=e.isScreen?this._remoteScreenPlayer.get(r):this._remoteVideoPlayer.get(r),e.videoTrack?t&&t.playVideo(e.videoTrack,e):null==t||t.stop()},t.prototype._onAddStream=function(e){var t,r,n,i,o=e.stream,a={userId:o.userId,isScreen:o.isScreen,hasVideo:o.hasVideo,hasAudio:o.hasAudio,videoStreamDescriptions:o.attributes.videoDescriptions};this.safeEmit(rD.onStreamAdd,{stream:a});var s=null;(null===(t=this._roomConfig)||void 0===t?void 0:t.isAutoSubscribeAudio)&&(s=ik.AUDIO_ONLY),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(s=ik.VIDEO_ONLY),(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeVideo)&&(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)&&(s=ik.AUDIO_AND_VIDEO),eH.print("_onAddStream","autoSubType: ".concat(s)),null===s||o.isScreen||this.subscribeUserStream(o.userId,s)},t.prototype._onRemoveStream=function(e){var t=e.stream,r={userId:t.userId,isScreen:t.isScreen,hasVideo:t.hasVideo,hasAudio:t.hasAudio,videoStreamDescriptions:[]},n=rH[e.reason]||ok.STREAM_REMOVE_REASON_OTHER;this.safeEmit(rD.onStreamRemove,{stream:r,reason:n}),this._stopRemotePlayer(t.userId,t.isScreen)},t.prototype._onUserConnection=function(e){this.safeEmit(rD.onUserJoined,e)},t.prototype._onUserDisconnection=function(e){var t,r,n,i;(null===(t=null==e?void 0:e.userInfo)||void 0===t?void 0:t.userId)===(null===(i=null===(n=null===(r=this._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.userInfo)||void 0===i?void 0:i.userId)?"userDuplicateLogin"===(null==e?void 0:e.reason)&&this.safeEmit(rD.onError,{errorCode:HN.DUPLICATE_LOGIN}):this.safeEmit(rD.onUserLeave,{userInfo:e.userInfo,reason:"userLeave"===e.reason?0:1})},t.prototype._onConnectionStateChange=function(e){this.safeEmit(rD.onConnectionStateChanged,e)},t.prototype._stopRemotePlayer=function(e,t){var r=t?"".concat(e,"_screen"):e,n=this._remoteAudioPlayer.get(r),i=this._remoteVideoPlayer.get(r);n&&n.stop(),i&&i.stop()},t.prototype._onResubscribe=function(e){e.stream&&(this._stopRemotePlayer(e.stream.userId,e.stream.isScreen),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))},t.prototype._onSubscribePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onRemovePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onVideoFirstFrameDecoded=function(e){this.safeEmit(rD.onVideoFirstFrameDecoded,e)},t.prototype._onDeviceStateChange=function(e){this.safeEmit(rD.onMediaDeviceStateChanged,e)},t.prototype._onUserMuteAudio=function(e){this.safeEmit(rD.onUserMuteAudio,e)},t.prototype._onUserMuteVideo=function(e){this.safeEmit(rD.onUserMuteVideo,e)},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(rD.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(rD.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this.safeEmit(rD.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(rD.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(rD.onLiveTranscodingResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t.safeEmit(rD.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t.safeEmit(rD.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(rD.onError,{errorCode:HN.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(rD.onError,{errorCode:HN.RTM_TOKEN_ERROR})}))},kp([UU()],t.prototype,"updateToken",null),kp([UU()],t.prototype,"switchCamera",null),kp([UU()],t.prototype,"switchMicrophone",null),kp([UU()],t.prototype,"joinRoom",null),kp([UU()],t.prototype,"leaveRoom",null),kp([UU()],t.prototype,"destroy",null),kp([UU()],t.prototype,"publish",null),kp([UU()],t.prototype,"unpublish",null),kp([UU()],t.prototype,"subscribeUserStream",null),kp([UU()],t.prototype,"unSubscribe",null),kp([UU()],t.prototype,"startVideoCapture",null),kp([UU()],t.prototype,"stopVideoCapture",null),kp([UU()],t.prototype,"startAudioCapture",null),kp([UU()],t.prototype,"stopAudioCapture",null),kp([UU()],t.prototype,"getAudioMixingManager",null),kp([UU()],t.prototype,"startScreenCapture",null),kp([UU()],t.prototype,"stopScreenCapture",null),kp([UU()],t.prototype,"publishScreen",null),kp([UU()],t.prototype,"unpublishScreen",null),kp([UU()],t.prototype,"setLocalVideoPlayer",null),kp([UU()],t.prototype,"startLiveTranscoding",null),kp([UU()],t.prototype,"updateLiveTranscoding",null),kp([UU()],t.prototype,"stopLiveTranscoding",null),kp([UU()],t.prototype,"setBusinessId",null),kp([UU()],t.prototype,"setUserVisibility",null),kp([UU()],t.prototype,"setRemoteVideoPlayer",null),kp([UU()],t.prototype,"setLocalVideoMirrorType",null),kp([UU()],t.prototype,"setAudioPlaybackDevice",null),kp([UU()],t.prototype,"play",null),kp([UU()],t.prototype,"muteLocalAudio",null),kp([UU()],t.prototype,"muteLocalVideo",null),kp([UU()],t.prototype,"pauseAllSubscribedStream",null),kp([UU()],t.prototype,"resumeAllSubscribedStream",null),kp([UU()],t.prototype,"sendUserMessage",null),kp([UU()],t.prototype,"sendUserBinaryMessage",null),kp([UU()],t.prototype,"sendRoomMessage",null),kp([UU()],t.prototype,"sendRoomBinaryMessage",null),kp([UU()],t.prototype,"setAudioCaptureConfig",null),kp([UU()],t.prototype,"setVideoCaptureConfig",null),kp([UU()],t.prototype,"setVideoEncoderConfig",null),kp([UU()],t.prototype,"sendSEIMessage",null),kp([UU()],t.prototype,"setAudioVolumeIndicationInterval",null),kp([UU()],t.prototype,"setVideoSourceType",null),kp([UU()],t.prototype,"setExternalVideoTrack",null),kp([UU()],t.prototype,"setAudioSourceType",null),kp([UU()],t.prototype,"setExternalAudioTrack",null),kp([UU(!0)],t.prototype,"login",null),kp([UU(!0)],t.prototype,"logout",null),kp([UU(!0)],t.prototype,"updateLoginToken",null),kp([UU(!0)],t.prototype,"getPeerOnlineStatus",null),kp([UU(!0)],t.prototype,"sendUserMessageOutsideRoom",null),kp([UU(!0)],t.prototype,"sendUserBinaryMessageOutsideRoom",null),kp([UU(!0)],t.prototype,"setServerParams",null),kp([UU(!0)],t.prototype,"sendServerMessage",null),kp([UU(!0)],t.prototype,"sendServerBinaryMessage",null),t}(ND),rH={"client unpublished":ok.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":ok.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":ok.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":ok.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":ok.STREAM_REMOVE_REASON_REPUBLISH},nH=new CD("VERTC",0),iH=function(e){return nH.print("createEngine","Invoke VERTC.createEngine"),aD(e,"appId"),[PU,MU].forEach((function(t){return t.setStats({rtc_app_id:e,rtc_sdk_version:lH(),product_line:NM.RTC,report_version:wM.W_5,os:DM.WEB,device_id:KU.getDeviceId(),user_agent:null===navigator||void 0===navigator?void 0:navigator.userAgent})})),DU.sdkInitEngine(Date.now(),aU.BEGIN),new tH(e)},oH=function(e){if(nH.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof tH))throw new XN(HN.INVALID_ENGINE,"Invalid engine object");e.destroy(),DU.sdkInitEngine(Date.now(),aU.END)},aH=function(){return Pp(void 0,void 0,void 0,(function(){return Mp(this,(function(e){return[2,Ox.getDevices()]}))}))},sH=function(e){return void 0===e&&(e={video:!0,audio:!0}),Pp(void 0,void 0,void 0,(function(){var t,r,n,i,o;return Mp(this,(function(a){switch(a.label){case 0:if(t=e.video,r=e.audio,n={video:!1,audio:!1},!t)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),i=n,[4,Ox.getVideoPermission()];case 2:return i.video=a.sent(),[3,4];case 3:return a.sent(),[3,4];case 4:if(!r)return[3,8];a.label=5;case 5:return a.trys.push([5,7,,8]),o=n,[4,Ox.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,n]}}))}))},cH=function(){return Pp(void 0,void 0,void 0,(function(){return Mp(this,(function(e){return[2,Ox.getMicrophones()]}))}))},uH=function(){return Pp(void 0,void 0,void 0,(function(){return Mp(this,(function(e){return[2,Ox.getCameras()]}))}))},dH=function(){return Pp(void 0,void 0,void 0,(function(){return Mp(this,(function(e){return[2,Ox.getAudioPlayback()]}))}))},lH=function(){return fk.VERSION},hH=new function(){this.getSdkVersion=lH,this.createEngine=iH,this.destroyEngine=oH,this.getDevices=aH,this.enableDevices=sH,this.getMicrophones=cH,this.getCameras=uH,this.getAudioPlayback=dH,this.getParameter=_k,this.setParameter=pk,this.isSupported=RL,this.events=rD,this.ErrorCode=HN,this.platform="BytePlus"};export{gL as AudioMixingDualMonoMode,yL as AudioMixingType,WD as AudioSourceType,qD as ChannelProfile,ak as ConnectionState,ck as LogChannel,ek as MirrorMode,sk as MirrorType,ZD as MuteState,tk as PauseResumeControlMediaType,QD as PublishState,nk as StreamIndex,ok as StreamRemoveReason,ik as SubscribeMediaType,JD as SubscribeMode,$D as SubscribeState,uk as USER_ONLINE_STATUS,rk as VideoRenderMode,XD as VideoSourceType,hH as default};
|