xgplayer-mp4 3.0.0-alpha.26 → 3.0.0-alpha.27
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/dist/index.min.js +1 -1
- package/es/mp4.js +3 -2
- package/es/mp4Plugin.js +7 -2
- package/es/version.js +2 -1
- package/package.json +9 -5
- package/karma.conf.js +0 -21
- package/lib/error.js +0 -105
- package/lib/index.js +0 -19
- package/lib/index.umd.js +0 -19
- package/lib/mp4.js +0 -949
- package/lib/mp4Plugin.js +0 -1297
- package/lib/util/download.js +0 -23
- package/lib/util/index.js +0 -95
- package/lib/util/logger.js +0 -61
- package/lib/util/proxy-promise.js +0 -52
- package/lib/util/timer.js +0 -59
- package/lib/version.js +0 -10
- package/lib/worker/index.js +0 -79
- package/lib/worker/transmuxerworker.js +0 -79
- package/test/buffer.spec.js +0 -8
- package/test/mp4.spec.js +0 -15
- package/test/util.spec.js +0 -54
- package/types/index.d.ts +0 -32
package/dist/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("xgplayer")):"function"==typeof define&&define.amd?define(["exports","xgplayer"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Mp4Plugin={},e.Player)}(this,(function(e,t){"use strict";var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=function(e){return e&&e.Math===Math&&e},i=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r&&r)||n("object"==typeof r&&r)||function(){return this}()||Function("return this")(),o={},a=function(e){try{return!!e()}catch(e){return!0}},s=!a((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),u=!a((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),c=u,l=Function.prototype.call,f=c?l.bind(l):function(){return l.apply(l,arguments)},d={},h={}.propertyIsEnumerable,p=Object.getOwnPropertyDescriptor,v=p&&!h.call({1:2},1);d.f=v?function(e){var t=p(this,e);return!!t&&t.enumerable}:h;var y,g,m=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},b=u,_=Function.prototype,w=_.call,k=b&&_.bind.bind(w,w),x=b?k:function(e){return function(){return w.apply(e,arguments)}},T=x,S=T({}.toString),E=T("".slice),O=function(e){return E(S(e),8,-1)},A=a,R=O,L=Object,P=x("".split),B=A((function(){return!L("z").propertyIsEnumerable(0)}))?function(e){return"String"===R(e)?P(e,""):L(e)}:L,I=function(e){return null==e},C=I,M=TypeError,D=function(e){if(C(e))throw new M("Can't call method on "+e);return e},j=B,U=D,N=function(e){return j(U(e))},F="object"==typeof document&&document.all,z=void 0===F&&void 0!==F?function(e){return"function"==typeof e||e===F}:function(e){return"function"==typeof e},V=z,H=function(e){return"object"==typeof e?null!==e:V(e)},G=i,q=z,K=function(e,t){return arguments.length<2?(r=G[e],q(r)?r:void 0):G[e]&&G[e][t];var r},W=x({}.isPrototypeOf),Y="undefined"!=typeof navigator&&String(navigator.userAgent)||"",J=i,X=Y,Q=J.process,Z=J.Deno,$=Q&&Q.versions||Z&&Z.version,ee=$&&$.v8;ee&&(g=(y=ee.split("."))[0]>0&&y[0]<4?1:+(y[0]+y[1])),!g&&X&&(!(y=X.match(/Edge\/(\d+)/))||y[1]>=74)&&(y=X.match(/Chrome\/(\d+)/))&&(g=+y[1]);var te=g,re=te,ne=a,ie=i.String,oe=!!Object.getOwnPropertySymbols&&!ne((function(){var e=Symbol("symbol detection");return!ie(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&re&&re<41})),ae=oe&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,se=K,ue=z,ce=W,le=Object,fe=ae?function(e){return"symbol"==typeof e}:function(e){var t=se("Symbol");return ue(t)&&ce(t.prototype,le(e))},de=String,he=function(e){try{return de(e)}catch(e){return"Object"}},pe=z,ve=he,ye=TypeError,ge=function(e){if(pe(e))return e;throw new ye(ve(e)+" is not a function")},me=ge,be=I,_e=function(e,t){var r=e[t];return be(r)?void 0:me(r)},we=f,ke=z,xe=H,Te=TypeError,Se={exports:{}},Ee=i,Oe=Object.defineProperty,Ae=function(e,t){try{Oe(Ee,e,{value:t,configurable:!0,writable:!0})}catch(r){Ee[e]=t}return t},Re=i,Le=Ae,Pe="__core-js_shared__",Be=Se.exports=Re[Pe]||Le(Pe,{});(Be.versions||(Be.versions=[])).push({version:"3.36.1",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.36.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Ie=Se.exports,Ce=function(e,t){return Ie[e]||(Ie[e]=t||{})},Me=D,De=Object,je=function(e){return De(Me(e))},Ue=je,Ne=x({}.hasOwnProperty),Fe=Object.hasOwn||function(e,t){return Ne(Ue(e),t)},ze=x,Ve=0,He=Math.random(),Ge=ze(1..toString),qe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ge(++Ve+He,36)},Ke=Ce,We=Fe,Ye=qe,Je=oe,Xe=ae,Qe=i.Symbol,Ze=Ke("wks"),$e=Xe?Qe.for||Qe:Qe&&Qe.withoutSetter||Ye,et=function(e){return We(Ze,e)||(Ze[e]=Je&&We(Qe,e)?Qe[e]:$e("Symbol."+e)),Ze[e]},tt=f,rt=H,nt=fe,it=_e,ot=function(e,t){var r,n;if("string"===t&&ke(r=e.toString)&&!xe(n=we(r,e)))return n;if(ke(r=e.valueOf)&&!xe(n=we(r,e)))return n;if("string"!==t&&ke(r=e.toString)&&!xe(n=we(r,e)))return n;throw new Te("Can't convert object to primitive value")},at=TypeError,st=et("toPrimitive"),ut=function(e,t){if(!rt(e)||nt(e))return e;var r,n=it(e,st);if(n){if(void 0===t&&(t="default"),r=tt(n,e,t),!rt(r)||nt(r))return r;throw new at("Can't convert object to primitive value")}return void 0===t&&(t="number"),ot(e,t)},ct=ut,lt=fe,ft=function(e){var t=ct(e,"string");return lt(t)?t:t+""},dt=H,ht=i.document,pt=dt(ht)&&dt(ht.createElement),vt=function(e){return pt?ht.createElement(e):{}},yt=vt,gt=!s&&!a((function(){return 7!==Object.defineProperty(yt("div"),"a",{get:function(){return 7}}).a})),mt=s,bt=f,_t=d,wt=m,kt=N,xt=ft,Tt=Fe,St=gt,Et=Object.getOwnPropertyDescriptor;o.f=mt?Et:function(e,t){if(e=kt(e),t=xt(t),St)try{return Et(e,t)}catch(e){}if(Tt(e,t))return wt(!bt(_t.f,e,t),e[t])};var Ot={},At=s&&a((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Rt=H,Lt=String,Pt=TypeError,Bt=function(e){if(Rt(e))return e;throw new Pt(Lt(e)+" is not an object")},It=s,Ct=gt,Mt=At,Dt=Bt,jt=ft,Ut=TypeError,Nt=Object.defineProperty,Ft=Object.getOwnPropertyDescriptor,zt="enumerable",Vt="configurable",Ht="writable";Ot.f=It?Mt?function(e,t,r){if(Dt(e),t=jt(t),Dt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Ht in r&&!r[Ht]){var n=Ft(e,t);n&&n[Ht]&&(e[t]=r.value,r={configurable:Vt in r?r[Vt]:n[Vt],enumerable:zt in r?r[zt]:n[zt],writable:!1})}return Nt(e,t,r)}:Nt:function(e,t,r){if(Dt(e),t=jt(t),Dt(r),Ct)try{return Nt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new Ut("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Gt=Ot,qt=m,Kt=s?function(e,t,r){return Gt.f(e,t,qt(1,r))}:function(e,t,r){return e[t]=r,e},Wt={exports:{}},Yt=s,Jt=Fe,Xt=Function.prototype,Qt=Yt&&Object.getOwnPropertyDescriptor,Zt=Jt(Xt,"name"),$t={EXISTS:Zt,PROPER:Zt&&"something"===function(){}.name,CONFIGURABLE:Zt&&(!Yt||Yt&&Qt(Xt,"name").configurable)},er=x,tr=z,rr=Se.exports,nr=er(Function.toString);tr(rr.inspectSource)||(rr.inspectSource=function(e){return nr(e)});var ir,or,ar,sr=rr.inspectSource,ur=z,cr=i.WeakMap,lr=ur(cr)&&/native code/.test(String(cr)),fr=qe,dr=Ce("keys"),hr=function(e){return dr[e]||(dr[e]=fr(e))},pr={},vr=lr,yr=i,gr=H,mr=Kt,br=Fe,_r=Se.exports,wr=hr,kr=pr,xr="Object already initialized",Tr=yr.TypeError,Sr=yr.WeakMap;if(vr||_r.state){var Er=_r.state||(_r.state=new Sr);Er.get=Er.get,Er.has=Er.has,Er.set=Er.set,ir=function(e,t){if(Er.has(e))throw new Tr(xr);return t.facade=e,Er.set(e,t),t},or=function(e){return Er.get(e)||{}},ar=function(e){return Er.has(e)}}else{var Or=wr("state");kr[Or]=!0,ir=function(e,t){if(br(e,Or))throw new Tr(xr);return t.facade=e,mr(e,Or,t),t},or=function(e){return br(e,Or)?e[Or]:{}},ar=function(e){return br(e,Or)}}var Ar={set:ir,get:or,has:ar,enforce:function(e){return ar(e)?or(e):ir(e,{})},getterFor:function(e){return function(t){var r;if(!gr(t)||(r=or(t)).type!==e)throw new Tr("Incompatible receiver, "+e+" required");return r}}},Rr=x,Lr=a,Pr=z,Br=Fe,Ir=s,Cr=$t.CONFIGURABLE,Mr=sr,Dr=Ar.enforce,jr=Ar.get,Ur=String,Nr=Object.defineProperty,Fr=Rr("".slice),zr=Rr("".replace),Vr=Rr([].join),Hr=Ir&&!Lr((function(){return 8!==Nr((function(){}),"length",{value:8}).length})),Gr=String(String).split("String"),qr=Wt.exports=function(e,t,r){"Symbol("===Fr(Ur(t),0,7)&&(t="["+zr(Ur(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!Br(e,"name")||Cr&&e.name!==t)&&(Ir?Nr(e,"name",{value:t,configurable:!0}):e.name=t),Hr&&r&&Br(r,"arity")&&e.length!==r.arity&&Nr(e,"length",{value:r.arity});try{r&&Br(r,"constructor")&&r.constructor?Ir&&Nr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=Dr(e);return Br(n,"source")||(n.source=Vr(Gr,"string"==typeof t?t:"")),e};Function.prototype.toString=qr((function(){return Pr(this)&&jr(this).source||Mr(this)}),"toString");var Kr=z,Wr=Ot,Yr=Wt.exports,Jr=Ae,Xr=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(Kr(r)&&Yr(r,o,n),n.global)i?e[t]=r:Jr(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(e){}i?e[t]=r:Wr.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Qr={},Zr=Math.ceil,$r=Math.floor,en=Math.trunc||function(e){var t=+e;return(t>0?$r:Zr)(t)},tn=en,rn=function(e){var t=+e;return t!=t||0===t?0:tn(t)},nn=rn,on=Math.max,an=Math.min,sn=function(e,t){var r=nn(e);return r<0?on(r+t,0):an(r,t)},un=rn,cn=Math.min,ln=function(e){var t=un(e);return t>0?cn(t,9007199254740991):0},fn=ln,dn=function(e){return fn(e.length)},hn=N,pn=sn,vn=dn,yn=function(e){return function(t,r,n){var i=hn(t),o=vn(i);if(0===o)return!e&&-1;var a,s=pn(n,o);if(e&&r!=r){for(;o>s;)if((a=i[s++])!=a)return!0}else for(;o>s;s++)if((e||s in i)&&i[s]===r)return e||s||0;return!e&&-1}},gn={includes:yn(!0),indexOf:yn(!1)},mn=Fe,bn=N,_n=gn.indexOf,wn=pr,kn=x([].push),xn=function(e,t){var r,n=bn(e),i=0,o=[];for(r in n)!mn(wn,r)&&mn(n,r)&&kn(o,r);for(;t.length>i;)mn(n,r=t[i++])&&(~_n(o,r)||kn(o,r));return o},Tn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Sn=xn,En=Tn.concat("length","prototype");Qr.f=Object.getOwnPropertyNames||function(e){return Sn(e,En)};var On={};On.f=Object.getOwnPropertySymbols;var An=K,Rn=Qr,Ln=On,Pn=Bt,Bn=x([].concat),In=An("Reflect","ownKeys")||function(e){var t=Rn.f(Pn(e)),r=Ln.f;return r?Bn(t,r(e)):t},Cn=Fe,Mn=In,Dn=o,jn=Ot,Un=function(e,t,r){for(var n=Mn(t),i=jn.f,o=Dn.f,a=0;a<n.length;a++){var s=n[a];Cn(e,s)||r&&Cn(r,s)||i(e,s,o(t,s))}},Nn=a,Fn=z,zn=/#|\.prototype\./,Vn=function(e,t){var r=Gn[Hn(e)];return r===Kn||r!==qn&&(Fn(t)?Nn(t):!!t)},Hn=Vn.normalize=function(e){return String(e).replace(zn,".").toLowerCase()},Gn=Vn.data={},qn=Vn.NATIVE="N",Kn=Vn.POLYFILL="P",Wn=Vn,Yn=i,Jn=o.f,Xn=Kt,Qn=Xr,Zn=Ae,$n=Un,ei=Wn,ti=function(e,t){var r,n,i,o,a,s=e.target,u=e.global,c=e.stat;if(r=u?Yn:c?Yn[s]||Zn(s,{}):Yn[s]&&Yn[s].prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(a=Jn(r,n))&&a.value:r[n],!ei(u?n:s+(c?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;$n(o,i)}(e.sham||i&&i.sham)&&Xn(o,"sham",!0),Qn(r,n,o,e)}},ri={};ri[et("toStringTag")]="z";var ni="[object z]"===String(ri),ii=ni,oi=z,ai=O,si=et("toStringTag"),ui=Object,ci="Arguments"===ai(function(){return arguments}()),li=ii?ai: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=ui(e),si))?r:ci?ai(t):"Object"===(n=ai(t))&&oi(t.callee)?"Arguments":n},fi=li,di=String,hi=function(e){if("Symbol"===fi(e))throw new TypeError("Cannot convert a Symbol value to a string");return di(e)},pi={},vi=xn,yi=Tn,gi=Object.keys||function(e){return vi(e,yi)},mi=s,bi=At,_i=Ot,wi=Bt,ki=N,xi=gi;pi.f=mi&&!bi?Object.defineProperties:function(e,t){wi(e);for(var r,n=ki(t),i=xi(t),o=i.length,a=0;o>a;)_i.f(e,r=i[a++],n[r]);return e};var Ti,Si=K("document","documentElement"),Ei=Bt,Oi=pi,Ai=Tn,Ri=pr,Li=Si,Pi=vt,Bi="prototype",Ii="script",Ci=hr("IE_PROTO"),Mi=function(){},Di=function(e){return"<"+Ii+">"+e+"</"+Ii+">"},ji=function(e){e.write(Di("")),e.close();var t=e.parentWindow.Object;return e=null,t},Ui=function(){try{Ti=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Ui="undefined"!=typeof document?document.domain&&Ti?ji(Ti):(t=Pi("iframe"),r="java"+Ii+":",t.style.display="none",Li.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(Di("document.F=Object")),e.close(),e.F):ji(Ti);for(var n=Ai.length;n--;)delete Ui[Bi][Ai[n]];return Ui()};Ri[Ci]=!0;var Ni=Object.create||function(e,t){var r;return null!==e?(Mi[Bi]=Ei(e),r=new Mi,Mi[Bi]=null,r[Ci]=e):r=Ui(),void 0===t?r:Oi.f(r,t)},Fi={},zi=x([].slice),Vi=O,Hi=N,Gi=Qr.f,qi=zi,Ki="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Fi.f=function(e){return Ki&&"Window"===Vi(e)?function(e){try{return Gi(e)}catch(e){return qi(Ki)}}(e):Gi(Hi(e))};var Wi=Wt.exports,Yi=Ot,Ji=function(e,t,r){return r.get&&Wi(r.get,t,{getter:!0}),r.set&&Wi(r.set,t,{setter:!0}),Yi.f(e,t,r)},Xi={},Qi=et;Xi.f=Qi;var Zi=i,$i=Zi,eo=Fe,to=Xi,ro=Ot.f,no=f,io=K,oo=et,ao=Xr,so=Ot.f,uo=Fe,co=et("toStringTag"),lo=function(e,t,r){e&&!r&&(e=e.prototype),e&&!uo(e,co)&&so(e,co,{configurable:!0,value:t})},fo=O,ho=x,po=function(e){if("Function"===fo(e))return ho(e)},vo=ge,yo=u,go=po(po.bind),mo=function(e,t){return vo(e),void 0===t?e:yo?go(e,t):function(){return e.apply(t,arguments)}},bo=O,_o=Array.isArray||function(e){return"Array"===bo(e)},wo=x,ko=a,xo=z,To=li,So=sr,Eo=function(){},Oo=K("Reflect","construct"),Ao=/^\s*(?:class|function)\b/,Ro=wo(Ao.exec),Lo=!Ao.test(Eo),Po=function(e){if(!xo(e))return!1;try{return Oo(Eo,[],e),!0}catch(e){return!1}},Bo=function(e){if(!xo(e))return!1;switch(To(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Lo||!!Ro(Ao,So(e))}catch(e){return!0}};Bo.sham=!0;var Io=!Oo||ko((function(){var e;return Po(Po.call)||!Po(Object)||!Po((function(){e=!0}))||e}))?Bo:Po,Co=_o,Mo=Io,Do=H,jo=et("species"),Uo=Array,No=function(e){var t;return Co(e)&&(t=e.constructor,(Mo(t)&&(t===Uo||Co(t.prototype))||Do(t)&&null===(t=t[jo]))&&(t=void 0)),void 0===t?Uo:t},Fo=function(e,t){return new(No(e))(0===t?0:t)},zo=mo,Vo=B,Ho=je,Go=dn,qo=Fo,Ko=x([].push),Wo=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(u,c,l,f){for(var d,h,p=Ho(u),v=Vo(p),y=Go(v),g=zo(c,l),m=0,b=f||qo,_=t?b(u,y):r||a?b(u,0):void 0;y>m;m++)if((s||m in v)&&(h=g(d=v[m],m,p),e))if(t)_[m]=h;else if(h)switch(e){case 3:return!0;case 5:return d;case 6:return m;case 2:Ko(_,d)}else switch(e){case 4:return!1;case 7:Ko(_,d)}return o?-1:n||i?i:_}},Yo={forEach:Wo(0),map:Wo(1),filter:Wo(2),some:Wo(3),every:Wo(4),find:Wo(5),findIndex:Wo(6),filterReject:Wo(7)},Jo=ti,Xo=i,Qo=f,Zo=x,$o=s,ea=oe,ta=a,ra=Fe,na=W,ia=Bt,oa=N,aa=ft,sa=hi,ua=m,ca=Ni,la=gi,fa=Qr,da=Fi,ha=On,pa=o,va=Ot,ya=pi,ga=d,ma=Xr,ba=Ji,_a=Ce,wa=pr,ka=qe,xa=et,Ta=Xi,Sa=function(e){var t=$i.Symbol||($i.Symbol={});eo(t,e)||ro(t,e,{value:to.f(e)})},Ea=function(){var e=io("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=oo("toPrimitive");t&&!t[n]&&ao(t,n,(function(e){return no(r,this)}),{arity:1})},Oa=lo,Aa=Ar,Ra=Yo.forEach,La=hr("hidden"),Pa="Symbol",Ba="prototype",Ia=Aa.set,Ca=Aa.getterFor(Pa),Ma=Object[Ba],Da=Xo.Symbol,ja=Da&&Da[Ba],Ua=Xo.RangeError,Na=Xo.TypeError,Fa=Xo.QObject,za=pa.f,Va=va.f,Ha=da.f,Ga=ga.f,qa=Zo([].push),Ka=_a("symbols"),Wa=_a("op-symbols"),Ya=_a("wks"),Ja=!Fa||!Fa[Ba]||!Fa[Ba].findChild,Xa=function(e,t,r){var n=za(Ma,t);n&&delete Ma[t],Va(e,t,r),n&&e!==Ma&&Va(Ma,t,n)},Qa=$o&&ta((function(){return 7!==ca(Va({},"a",{get:function(){return Va(this,"a",{value:7}).a}})).a}))?Xa:Va,Za=function(e,t){var r=Ka[e]=ca(ja);return Ia(r,{type:Pa,tag:e,description:t}),$o||(r.description=t),r},$a=function(e,t,r){e===Ma&&$a(Wa,t,r),ia(e);var n=aa(t);return ia(r),ra(Ka,n)?(r.enumerable?(ra(e,La)&&e[La][n]&&(e[La][n]=!1),r=ca(r,{enumerable:ua(0,!1)})):(ra(e,La)||Va(e,La,ua(1,ca(null))),e[La][n]=!0),Qa(e,n,r)):Va(e,n,r)},es=function(e,t){ia(e);var r=oa(t),n=la(r).concat(is(r));return Ra(n,(function(t){$o&&!Qo(ts,r,t)||$a(e,t,r[t])})),e},ts=function(e){var t=aa(e),r=Qo(Ga,this,t);return!(this===Ma&&ra(Ka,t)&&!ra(Wa,t))&&(!(r||!ra(this,t)||!ra(Ka,t)||ra(this,La)&&this[La][t])||r)},rs=function(e,t){var r=oa(e),n=aa(t);if(r!==Ma||!ra(Ka,n)||ra(Wa,n)){var i=za(r,n);return!i||!ra(Ka,n)||ra(r,La)&&r[La][n]||(i.enumerable=!0),i}},ns=function(e){var t=Ha(oa(e)),r=[];return Ra(t,(function(e){ra(Ka,e)||ra(wa,e)||qa(r,e)})),r},is=function(e){var t=e===Ma,r=Ha(t?Wa:oa(e)),n=[];return Ra(r,(function(e){!ra(Ka,e)||t&&!ra(Ma,e)||qa(n,Ka[e])})),n};ea||(Da=function(){if(na(ja,this))throw new Na("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?sa(arguments[0]):void 0,t=ka(e),r=function(e){var n=void 0===this?Xo:this;n===Ma&&Qo(r,Wa,e),ra(n,La)&&ra(n[La],t)&&(n[La][t]=!1);var i=ua(1,e);try{Qa(n,t,i)}catch(e){if(!(e instanceof Ua))throw e;Xa(n,t,i)}};return $o&&Ja&&Qa(Ma,t,{configurable:!0,set:r}),Za(t,e)},ma(ja=Da[Ba],"toString",(function(){return Ca(this).tag})),ma(Da,"withoutSetter",(function(e){return Za(ka(e),e)})),ga.f=ts,va.f=$a,ya.f=es,pa.f=rs,fa.f=da.f=ns,ha.f=is,Ta.f=function(e){return Za(xa(e),e)},$o&&(ba(ja,"description",{configurable:!0,get:function(){return Ca(this).description}}),ma(Ma,"propertyIsEnumerable",ts,{unsafe:!0}))),Jo({global:!0,constructor:!0,wrap:!0,forced:!ea,sham:!ea},{Symbol:Da}),Ra(la(Ya),(function(e){Sa(e)})),Jo({target:Pa,stat:!0,forced:!ea},{useSetter:function(){Ja=!0},useSimple:function(){Ja=!1}}),Jo({target:"Object",stat:!0,forced:!ea,sham:!$o},{create:function(e,t){return void 0===t?ca(e):es(ca(e),t)},defineProperty:$a,defineProperties:es,getOwnPropertyDescriptor:rs}),Jo({target:"Object",stat:!0,forced:!ea},{getOwnPropertyNames:ns}),Ea(),Oa(Da,Pa),wa[La]=!0;var os=oe&&!!Symbol.for&&!!Symbol.keyFor,as=ti,ss=K,us=Fe,cs=hi,ls=Ce,fs=os,ds=ls("string-to-symbol-registry"),hs=ls("symbol-to-string-registry");as({target:"Symbol",stat:!0,forced:!fs},{for:function(e){var t=cs(e);if(us(ds,t))return ds[t];var r=ss("Symbol")(t);return ds[t]=r,hs[r]=t,r}});var ps=ti,vs=Fe,ys=fe,gs=he,ms=os,bs=Ce("symbol-to-string-registry");ps({target:"Symbol",stat:!0,forced:!ms},{keyFor:function(e){if(!ys(e))throw new TypeError(gs(e)+" is not a symbol");if(vs(bs,e))return bs[e]}});var _s=u,ws=Function.prototype,ks=ws.apply,xs=ws.call,Ts="object"==typeof Reflect&&Reflect.apply||(_s?xs.bind(ks):function(){return xs.apply(ks,arguments)}),Ss=_o,Es=z,Os=O,As=hi,Rs=x([].push),Ls=ti,Ps=K,Bs=Ts,Is=f,Cs=x,Ms=a,Ds=z,js=fe,Us=zi,Ns=function(e){if(Es(e))return e;if(Ss(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?Rs(r,i):"number"!=typeof i&&"Number"!==Os(i)&&"String"!==Os(i)||Rs(r,As(i))}var o=r.length,a=!0;return function(e,t){if(a)return a=!1,t;if(Ss(this))return t;for(var n=0;n<o;n++)if(r[n]===e)return t}}},Fs=oe,zs=String,Vs=Ps("JSON","stringify"),Hs=Cs(/./.exec),Gs=Cs("".charAt),qs=Cs("".charCodeAt),Ks=Cs("".replace),Ws=Cs(1..toString),Ys=/[\uD800-\uDFFF]/g,Js=/^[\uD800-\uDBFF]$/,Xs=/^[\uDC00-\uDFFF]$/,Qs=!Fs||Ms((function(){var e=Ps("Symbol")("stringify detection");return"[null]"!==Vs([e])||"{}"!==Vs({a:e})||"{}"!==Vs(Object(e))})),Zs=Ms((function(){return'"\\udf06\\ud834"'!==Vs("\udf06\ud834")||'"\\udead"'!==Vs("\udead")})),$s=function(e,t){var r=Us(arguments),n=Ns(t);if(Ds(n)||void 0!==e&&!js(e))return r[1]=function(e,t){if(Ds(n)&&(t=Is(n,this,zs(e),t)),!js(t))return t},Bs(Vs,null,r)},eu=function(e,t,r){var n=Gs(r,t-1),i=Gs(r,t+1);return Hs(Js,e)&&!Hs(Xs,i)||Hs(Xs,e)&&!Hs(Js,n)?"\\u"+Ws(qs(e,0),16):e};Vs&&Ls({target:"JSON",stat:!0,arity:3,forced:Qs||Zs},{stringify:function(e,t,r){var n=Us(arguments),i=Bs(Qs?$s:Vs,null,n);return Zs&&"string"==typeof i?Ks(i,Ys,eu):i}});var tu=On,ru=je;ti({target:"Object",stat:!0,forced:!oe||a((function(){tu.f(1)}))},{getOwnPropertySymbols:function(e){var t=tu.f;return t?t(ru(e)):[]}});var nu=a,iu=te,ou=et("species"),au=function(e){return iu>=51||!nu((function(){var t=[];return(t.constructor={})[ou]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},su=Yo.filter;ti({target:"Array",proto:!0,forced:!au("filter")},{filter:function(e){return su(this,e,arguments.length>1?arguments[1]:void 0)}});var uu=ti,cu=a,lu=N,fu=o.f,du=s;uu({target:"Object",stat:!0,forced:!du||cu((function(){fu(1)})),sham:!du},{getOwnPropertyDescriptor:function(e,t){return fu(lu(e),t)}});var hu=s,pu=Ot,vu=m,yu=function(e,t,r){hu?pu.f(e,t,vu(0,r)):e[t]=r},gu=In,mu=N,bu=o,_u=yu;ti({target:"Object",stat:!0,sham:!s},{getOwnPropertyDescriptors:function(e){for(var t,r,n=mu(e),i=bu.f,o=gu(n),a={},s=0;o.length>s;)void 0!==(r=i(n,t=o[s++]))&&_u(a,t,r);return a}});var wu=x,ku=ge,xu=H,Tu=Fe,Su=zi,Eu=u,Ou=Function,Au=wu([].concat),Ru=wu([].join),Lu={},Pu=Eu?Ou.bind:function(e){var t=ku(this),r=t.prototype,n=Su(arguments,1),i=function(){var r=Au(n,Su(arguments));return this instanceof i?function(e,t,r){if(!Tu(Lu,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";Lu[t]=Ou("C,a","return new C("+Ru(n,",")+")")}return Lu[t](e,r)}(t,r.length,r):t.apply(e,r)};return xu(r)&&(i.prototype=r),i},Bu=Io,Iu=he,Cu=TypeError,Mu=function(e){if(Bu(e))return e;throw new Cu(Iu(e)+" is not a constructor")},Du=ti,ju=Ts,Uu=Pu,Nu=Mu,Fu=Bt,zu=H,Vu=Ni,Hu=a,Gu=K("Reflect","construct"),qu=Object.prototype,Ku=[].push,Wu=Hu((function(){function e(){}return!(Gu((function(){}),[],e)instanceof e)})),Yu=!Hu((function(){Gu((function(){}))})),Ju=Wu||Yu;function Xu(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function Qu(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Xu(o,n,i,a,s,"next",e)}function s(e){Xu(o,n,i,a,s,"throw",e)}a(void 0)}))}}function Zu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $u(e){return $u="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},$u(e)}function ec(e){var t=function(e,t){if("object"!=$u(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=$u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==$u(t)?t:t+""}function tc(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ec(n.key),n)}}function rc(e,t,r){return t&&tc(e.prototype,t),r&&tc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function nc(e,t){if(t&&("object"===$u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function ic(e){return ic=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ic(e)}function oc(e,t){return oc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},oc(e,t)}function ac(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&oc(e,t)}function sc(e,t,r){return(t=ec(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Du({target:"Reflect",stat:!0,forced:Ju,sham:Ju},{construct:function(e,t){Nu(e),Fu(t);var r=arguments.length<3?e:Nu(arguments[2]);if(Yu&&!Wu)return Gu(e,t,r);if(e===r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return ju(Ku,n,t),new(ju(Uu,e,n))}var i=r.prototype,o=Vu(zu(i)?i:qu),a=ju(e,o,t);return zu(a)?a:o}});var uc=TypeError,cc=function(e){if(e>9007199254740991)throw uc("Maximum allowed index exceeded");return e},lc=ti,fc=a,dc=_o,hc=H,pc=je,vc=dn,yc=cc,gc=yu,mc=Fo,bc=au,_c=te,wc=et("isConcatSpreadable"),kc=_c>=51||!fc((function(){var e=[];return e[wc]=!1,e.concat()[0]!==e})),xc=function(e){if(!hc(e))return!1;var t=e[wc];return void 0!==t?!!t:dc(e)};lc({target:"Array",proto:!0,arity:1,forced:!kc||!bc("concat")},{concat:function(e){var t,r,n,i,o,a=pc(this),s=mc(a,0),u=0;for(t=-1,n=arguments.length;t<n;t++)if(xc(o=-1===t?a:arguments[t]))for(i=vc(o),yc(u+i),r=0;r<i;r++,u++)r in o&&gc(s,u,o[r]);else yc(u+1),gc(s,u++,o);return s.length=u,s}});var Tc=s,Sc=_o,Ec=TypeError,Oc=Object.getOwnPropertyDescriptor,Ac=Tc&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}(),Rc=he,Lc=TypeError,Pc=function(e,t){if(!delete e[t])throw new Lc("Cannot delete property "+Rc(t)+" of "+Rc(e))},Bc=ti,Ic=je,Cc=sn,Mc=rn,Dc=dn,jc=Ac?function(e,t){if(Sc(e)&&!Oc(e,"length").writable)throw new Ec("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},Uc=cc,Nc=Fo,Fc=yu,zc=Pc,Vc=au("splice"),Hc=Math.max,Gc=Math.min;Bc({target:"Array",proto:!0,forced:!Vc},{splice:function(e,t){var r,n,i,o,a,s,u=Ic(this),c=Dc(u),l=Cc(e,c),f=arguments.length;for(0===f?r=n=0:1===f?(r=0,n=c-l):(r=f-2,n=Gc(Hc(Mc(t),0),c-l)),Uc(c+r-n),i=Nc(u,n),o=0;o<n;o++)(a=l+o)in u&&Fc(i,o,u[a]);if(i.length=n,r<n){for(o=l;o<c-n;o++)s=o+r,(a=o+n)in u?u[s]=u[a]:zc(u,s);for(o=c;o>c-n+r;o--)zc(u,o-1)}else if(r>n)for(o=c-n;o>l;o--)s=o+r-1,(a=o+n-1)in u?u[s]=u[a]:zc(u,s);for(o=0;o<r;o++)u[o+l]=arguments[o+2];return jc(u,c-n+r),i}});var qc=s,Kc=$t.EXISTS,Wc=x,Yc=Ji,Jc=Function.prototype,Xc=Wc(Jc.toString),Qc=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Zc=Wc(Qc.exec);qc&&!Kc&&Yc(Jc,"name",{configurable:!0,get:function(){try{return Zc(Qc,Xc(this))[1]}catch(e){return""}}});var $c=x,el=ge,tl=H,rl=function(e){return tl(e)||null===e},nl=String,il=TypeError,ol=function(e,t,r){try{return $c(el(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},al=H,sl=D,ul=function(e){if(rl(e))return e;throw new il("Can't set "+nl(e)+" as a prototype")},cl=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=ol(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return sl(r),ul(n),al(r)?(t?e(r,n):r.__proto__=n,r):r}}():void 0),ll=z,fl=H,dl=cl,hl=function(e,t,r){var n,i;return dl&&ll(n=t.constructor)&&n!==r&&fl(i=n.prototype)&&i!==r.prototype&&dl(e,i),e},pl=x(1..valueOf),vl=D,yl=hi,gl="\t\n\v\f\r \u2028\u2029\ufeff",ml=x("".replace),bl=RegExp("^["+gl+"]+"),_l=RegExp("(^|[^"+gl+"])["+gl+"]+$"),wl=function(e){return function(t){var r=yl(vl(t));return 1&e&&(r=ml(r,bl,"")),2&e&&(r=ml(r,_l,"$1")),r}},kl={start:wl(1),end:wl(2),trim:wl(3)},xl=ti,Tl=s,Sl=i,El=Zi,Ol=x,Al=Wn,Rl=Fe,Ll=hl,Pl=W,Bl=fe,Il=ut,Cl=a,Ml=Qr.f,Dl=o.f,jl=Ot.f,Ul=pl,Nl=kl.trim,Fl="Number",zl=Sl[Fl];El[Fl];var Vl=zl.prototype,Hl=Sl.TypeError,Gl=Ol("".slice),ql=Ol("".charCodeAt),Kl=function(e){var t,r,n,i,o,a,s,u,c=Il(e,"number");if(Bl(c))throw new Hl("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=Nl(c),43===(t=ql(c,0))||45===t){if(88===(r=ql(c,2))||120===r)return NaN}else if(48===t){switch(ql(c,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+c}for(a=(o=Gl(c,2)).length,s=0;s<a;s++)if((u=ql(o,s))<48||u>i)return NaN;return parseInt(o,n)}return+c},Wl=Al(Fl,!zl(" 0o1")||!zl("0b1")||zl("+0x1")),Yl=function(e){var t,r=arguments.length<1?0:zl(function(e){var t=Il(e,"number");return"bigint"==typeof t?t:Kl(t)}(e));return Pl(Vl,t=this)&&Cl((function(){Ul(t)}))?Ll(Object(r),this,Yl):r};Yl.prototype=Vl,Wl&&(Vl.constructor=Yl),xl({global:!0,constructor:!0,wrap:!0,forced:Wl},{Number:Yl});Wl&&function(e,t){for(var r,n=Tl?Ml(t):"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(","),i=0;n.length>i;i++)Rl(t,r=n[i])&&!Rl(e,r)&&jl(e,r,Dl(t,r))}(El[Fl],zl);var Jl=s,Xl=x,Ql=f,Zl=a,$l=gi,ef=On,tf=d,rf=je,nf=B,of=Object.assign,af=Object.defineProperty,sf=Xl([].concat),uf=!of||Zl((function(){if(Jl&&1!==of({b:1},of(af({},"a",{enumerable:!0,get:function(){af(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol("assign detection"),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!==of({},e)[r]||$l(of({},t)).join("")!==n}))?function(e,t){for(var r=rf(e),n=arguments.length,i=1,o=ef.f,a=tf.f;n>i;)for(var s,u=nf(arguments[i++]),c=o?sf($l(u),o(u)):$l(u),l=c.length,f=0;l>f;)s=c[f++],Jl&&!Ql(a,u,s)||(r[s]=u[s]);return r}:of,cf=uf;ti({target:"Object",stat:!0,arity:2,forced:Object.assign!==cf},{assign:cf});var lf=je,ff=gi;ti({target:"Object",stat:!0,forced:a((function(){ff(1)}))},{keys:function(e){return ff(lf(e))}});var df=li,hf=ni?{}.toString:function(){return"[object "+df(this)+"]"};ni||Xr(Object.prototype,"toString",hf,{unsafe:!0});var pf,vf,yf,gf,mf="process"===O(i.process),bf=K,_f=Ji,wf=s,kf=et("species"),xf=function(e){var t=bf(e);wf&&t&&!t[kf]&&_f(t,kf,{configurable:!0,get:function(){return this}})},Tf=W,Sf=TypeError,Ef=function(e,t){if(Tf(t,e))return e;throw new Sf("Incorrect invocation")},Of=Bt,Af=Mu,Rf=I,Lf=et("species"),Pf=function(e,t){var r,n=Of(e).constructor;return void 0===n||Rf(r=Of(n)[Lf])?t:Af(r)},Bf=TypeError,If=/(?:ipad|iphone|ipod).*applewebkit/i.test(Y),Cf=i,Mf=Ts,Df=mo,jf=z,Uf=Fe,Nf=a,Ff=Si,zf=zi,Vf=vt,Hf=function(e,t){if(e<t)throw new Bf("Not enough arguments");return e},Gf=If,qf=mf,Kf=Cf.setImmediate,Wf=Cf.clearImmediate,Yf=Cf.process,Jf=Cf.Dispatch,Xf=Cf.Function,Qf=Cf.MessageChannel,Zf=Cf.String,$f=0,ed={},td="onreadystatechange";Nf((function(){pf=Cf.location}));var rd=function(e){if(Uf(ed,e)){var t=ed[e];delete ed[e],t()}},nd=function(e){return function(){rd(e)}},id=function(e){rd(e.data)},od=function(e){Cf.postMessage(Zf(e),pf.protocol+"//"+pf.host)};Kf&&Wf||(Kf=function(e){Hf(arguments.length,1);var t=jf(e)?e:Xf(e),r=zf(arguments,1);return ed[++$f]=function(){Mf(t,void 0,r)},vf($f),$f},Wf=function(e){delete ed[e]},qf?vf=function(e){Yf.nextTick(nd(e))}:Jf&&Jf.now?vf=function(e){Jf.now(nd(e))}:Qf&&!Gf?(gf=(yf=new Qf).port2,yf.port1.onmessage=id,vf=Df(gf.postMessage,gf)):Cf.addEventListener&&jf(Cf.postMessage)&&!Cf.importScripts&&pf&&"file:"!==pf.protocol&&!Nf(od)?(vf=od,Cf.addEventListener("message",id,!1)):vf=td in Vf("script")?function(e){Ff.appendChild(Vf("script"))[td]=function(){Ff.removeChild(this),rd(e)}}:function(e){setTimeout(nd(e),0)});var ad={set:Kf,clear:Wf},sd=i,ud=s,cd=Object.getOwnPropertyDescriptor,ld=function(){this.head=null,this.tail=null};ld.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var fd,dd,hd,pd,vd,yd=ld,gd=/ipad|iphone|ipod/i.test(Y)&&"undefined"!=typeof Pebble,md=/web0s(?!.*chrome)/i.test(Y),bd=i,_d=function(e){if(!ud)return sd[e];var t=cd(sd,e);return t&&t.value},wd=mo,kd=ad.set,xd=yd,Td=If,Sd=gd,Ed=md,Od=mf,Ad=bd.MutationObserver||bd.WebKitMutationObserver,Rd=bd.document,Ld=bd.process,Pd=bd.Promise,Bd=_d("queueMicrotask");if(!Bd){var Id=new xd,Cd=function(){var e,t;for(Od&&(e=Ld.domain)&&e.exit();t=Id.get();)try{t()}catch(e){throw Id.head&&fd(),e}e&&e.enter()};Td||Od||Ed||!Ad||!Rd?!Sd&&Pd&&Pd.resolve?((pd=Pd.resolve(void 0)).constructor=Pd,vd=wd(pd.then,pd),fd=function(){vd(Cd)}):Od?fd=function(){Ld.nextTick(Cd)}:(kd=wd(kd,bd),fd=function(){kd(Cd)}):(dd=!0,hd=Rd.createTextNode(""),new Ad(Cd).observe(hd,{characterData:!0}),fd=function(){hd.data=dd=!dd}),Bd=function(e){Id.head||fd(),Id.add(e)}}var Md=Bd,Dd=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},jd=i.Promise,Ud="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Nd=!Ud&&!mf&&"object"==typeof window&&"object"==typeof document,Fd=i,zd=jd,Vd=z,Hd=Wn,Gd=sr,qd=et,Kd=Nd,Wd=Ud,Yd=te;zd&&zd.prototype;var Jd=qd("species"),Xd=!1,Qd=Vd(Fd.PromiseRejectionEvent),Zd=Hd("Promise",(function(){var e=Gd(zd),t=e!==String(zd);if(!t&&66===Yd)return!0;if(!Yd||Yd<51||!/native code/.test(e)){var r=new zd((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Jd]=n,!(Xd=r.then((function(){}))instanceof n))return!0}return!t&&(Kd||Wd)&&!Qd})),$d={CONSTRUCTOR:Zd,REJECTION_EVENT:Qd,SUBCLASSING:Xd},eh={},th=ge,rh=TypeError,nh=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw new rh("Bad Promise constructor");t=e,r=n})),this.resolve=th(t),this.reject=th(r)};eh.f=function(e){return new nh(e)};var ih,oh,ah,sh=ti,uh=mf,ch=i,lh=f,fh=Xr,dh=cl,hh=lo,ph=xf,vh=ge,yh=z,gh=H,mh=Ef,bh=Pf,_h=ad.set,wh=Md,kh=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}},xh=Dd,Th=yd,Sh=Ar,Eh=jd,Oh=eh,Ah="Promise",Rh=$d.CONSTRUCTOR,Lh=$d.REJECTION_EVENT,Ph=$d.SUBCLASSING,Bh=Sh.getterFor(Ah),Ih=Sh.set,Ch=Eh&&Eh.prototype,Mh=Eh,Dh=Ch,jh=ch.TypeError,Uh=ch.document,Nh=ch.process,Fh=Oh.f,zh=Fh,Vh=!!(Uh&&Uh.createEvent&&ch.dispatchEvent),Hh="unhandledrejection",Gh=function(e){var t;return!(!gh(e)||!yh(t=e.then))&&t},qh=function(e,t){var r,n,i,o=t.value,a=1===t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{s?(a||(2===t.rejection&&Xh(t),t.rejection=1),!0===s?r=o:(l&&l.enter(),r=s(o),l&&(l.exit(),i=!0)),r===e.promise?c(new jh("Promise-chain cycle")):(n=Gh(r))?lh(n,r,u,c):u(r)):c(o)}catch(e){l&&!i&&l.exit(),c(e)}},Kh=function(e,t){e.notified||(e.notified=!0,wh((function(){for(var r,n=e.reactions;r=n.get();)qh(r,e);e.notified=!1,t&&!e.rejection&&Yh(e)})))},Wh=function(e,t,r){var n,i;Vh?((n=Uh.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),ch.dispatchEvent(n)):n={promise:t,reason:r},!Lh&&(i=ch["on"+e])?i(n):e===Hh&&kh("Unhandled promise rejection",r)},Yh=function(e){lh(_h,ch,(function(){var t,r=e.facade,n=e.value;if(Jh(e)&&(t=xh((function(){uh?Nh.emit("unhandledRejection",n,r):Wh(Hh,r,n)})),e.rejection=uh||Jh(e)?2:1,t.error))throw t.value}))},Jh=function(e){return 1!==e.rejection&&!e.parent},Xh=function(e){lh(_h,ch,(function(){var t=e.facade;uh?Nh.emit("rejectionHandled",t):Wh("rejectionhandled",t,e.value)}))},Qh=function(e,t,r){return function(n){e(t,n,r)}},Zh=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Kh(e,!0))},$h=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw new jh("Promise can't be resolved itself");var n=Gh(t);n?wh((function(){var r={done:!1};try{lh(n,t,Qh($h,r,e),Qh(Zh,r,e))}catch(t){Zh(r,t,e)}})):(e.value=t,e.state=1,Kh(e,!1))}catch(t){Zh({done:!1},t,e)}}};if(Rh&&(Dh=(Mh=function(e){mh(this,Dh),vh(e),lh(ih,this);var t=Bh(this);try{e(Qh($h,t),Qh(Zh,t))}catch(e){Zh(t,e)}}).prototype,(ih=function(e){Ih(this,{type:Ah,done:!1,notified:!1,parent:!1,reactions:new Th,rejection:!1,state:0,value:void 0})}).prototype=fh(Dh,"then",(function(e,t){var r=Bh(this),n=Fh(bh(this,Mh));return r.parent=!0,n.ok=!yh(e)||e,n.fail=yh(t)&&t,n.domain=uh?Nh.domain:void 0,0===r.state?r.reactions.add(n):wh((function(){qh(n,r)})),n.promise})),oh=function(){var e=new ih,t=Bh(e);this.promise=e,this.resolve=Qh($h,t),this.reject=Qh(Zh,t)},Oh.f=Fh=function(e){return e===Mh||undefined===e?new oh(e):zh(e)},yh(Eh)&&Ch!==Object.prototype)){ah=Ch.then,Ph||fh(Ch,"then",(function(e,t){var r=this;return new Mh((function(e,t){lh(ah,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete Ch.constructor}catch(e){}dh&&dh(Ch,Dh)}sh({global:!0,constructor:!0,wrap:!0,forced:Rh},{Promise:Mh}),hh(Mh,Ah,!1),ph(Ah);var ep={},tp=ep,rp=et("iterator"),np=Array.prototype,ip=function(e){return void 0!==e&&(tp.Array===e||np[rp]===e)},op=li,ap=_e,sp=I,up=ep,cp=et("iterator"),lp=function(e){if(!sp(e))return ap(e,cp)||ap(e,"@@iterator")||up[op(e)]},fp=f,dp=ge,hp=Bt,pp=he,vp=lp,yp=TypeError,gp=function(e,t){var r=arguments.length<2?vp(e):t;if(dp(r))return hp(fp(r,e));throw new yp(pp(e)+" is not iterable")},mp=f,bp=Bt,_p=_e,wp=mo,kp=f,xp=Bt,Tp=he,Sp=ip,Ep=dn,Op=W,Ap=gp,Rp=lp,Lp=function(e,t,r){var n,i;bp(e);try{if(!(n=_p(e,"return"))){if("throw"===t)throw r;return r}n=mp(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return bp(n),r},Pp=TypeError,Bp=function(e,t){this.stopped=e,this.result=t},Ip=Bp.prototype,Cp=function(e,t,r){var n,i,o,a,s,u,c,l=r&&r.that,f=!(!r||!r.AS_ENTRIES),d=!(!r||!r.IS_RECORD),h=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),v=wp(t,l),y=function(e){return n&&Lp(n,"normal",e),new Bp(!0,e)},g=function(e){return f?(xp(e),p?v(e[0],e[1],y):v(e[0],e[1])):p?v(e,y):v(e)};if(d)n=e.iterator;else if(h)n=e;else{if(!(i=Rp(e)))throw new Pp(Tp(e)+" is not iterable");if(Sp(i)){for(o=0,a=Ep(e);a>o;o++)if((s=g(e[o]))&&Op(Ip,s))return s;return new Bp(!1)}n=Ap(e,i)}for(u=d?e.next:n.next;!(c=kp(u,n)).done;){try{s=g(c.value)}catch(e){Lp(n,"throw",e)}if("object"==typeof s&&s&&Op(Ip,s))return s}return new Bp(!1)},Mp=et("iterator"),Dp=!1;try{var jp=0,Up={next:function(){return{done:!!jp++}},return:function(){Dp=!0}};Up[Mp]=function(){return this},Array.from(Up,(function(){throw 2}))}catch(e){}var Np=function(e,t){try{if(!t&&!Dp)return!1}catch(e){return!1}var r=!1;try{var n={};n[Mp]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},Fp=jd,zp=$d.CONSTRUCTOR||!Np((function(e){Fp.all(e).then(void 0,(function(){}))})),Vp=f,Hp=ge,Gp=eh,qp=Dd,Kp=Cp;ti({target:"Promise",stat:!0,forced:zp},{all:function(e){var t=this,r=Gp.f(t),n=r.resolve,i=r.reject,o=qp((function(){var r=Hp(t.resolve),o=[],a=0,s=1;Kp(e,(function(e){var u=a++,c=!1;s++,Vp(r,t,e).then((function(e){c||(c=!0,o[u]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var Wp=ti,Yp=$d.CONSTRUCTOR,Jp=jd,Xp=K,Qp=z,Zp=Xr,$p=Jp&&Jp.prototype;if(Wp({target:"Promise",proto:!0,forced:Yp,real:!0},{catch:function(e){return this.then(void 0,e)}}),Qp(Jp)){var ev=Xp("Promise").prototype.catch;$p.catch!==ev&&Zp($p,"catch",ev,{unsafe:!0})}var tv=f,rv=ge,nv=eh,iv=Dd,ov=Cp;ti({target:"Promise",stat:!0,forced:zp},{race:function(e){var t=this,r=nv.f(t),n=r.reject,i=iv((function(){var i=rv(t.resolve);ov(e,(function(e){tv(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var av=eh;ti({target:"Promise",stat:!0,forced:$d.CONSTRUCTOR},{reject:function(e){var t=av.f(this);return(0,t.reject)(e),t.promise}});var sv=Bt,uv=H,cv=eh,lv=function(e,t){if(sv(e),uv(t)&&t.constructor===e)return t;var r=cv.f(e);return(0,r.resolve)(t),r.promise},fv=ti,dv=$d.CONSTRUCTOR,hv=lv;K("Promise"),fv({target:"Promise",stat:!0,forced:dv},{resolve:function(e){return hv(this,e)}});var pv=ti,vv=jd,yv=a,gv=K,mv=z,bv=Pf,_v=lv,wv=Xr,kv=vv&&vv.prototype;if(pv({target:"Promise",proto:!0,real:!0,forced:!!vv&&yv((function(){kv.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=bv(this,gv("Promise")),r=mv(e);return this.then(r?function(r){return _v(t,e()).then((function(){return r}))}:e,r?function(r){return _v(t,e()).then((function(){throw r}))}:e)}}),mv(vv)){var xv=gv("Promise").prototype.finally;kv.finally!==xv&&wv(kv,"finally",xv,{unsafe:!0})}var Tv,Sv,Ev=Bt,Ov=a,Av=i.RegExp,Rv=Ov((function(){var e=Av("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),Lv=Rv||Ov((function(){return!Av("a","y").sticky})),Pv={BROKEN_CARET:Rv||Ov((function(){var e=Av("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:Lv,UNSUPPORTED_Y:Rv},Bv=a,Iv=i.RegExp,Cv=Bv((function(){var e=Iv(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)})),Mv=a,Dv=i.RegExp,jv=Mv((function(){var e=Dv("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Uv=f,Nv=x,Fv=hi,zv=function(){var e=Ev(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},Vv=Pv,Hv=Ni,Gv=Ar.get,qv=Cv,Kv=jv,Wv=Ce("native-string-replace",String.prototype.replace),Yv=RegExp.prototype.exec,Jv=Yv,Xv=Nv("".charAt),Qv=Nv("".indexOf),Zv=Nv("".replace),$v=Nv("".slice),ey=(Sv=/b*/g,Uv(Yv,Tv=/a/,"a"),Uv(Yv,Sv,"a"),0!==Tv.lastIndex||0!==Sv.lastIndex),ty=Vv.BROKEN_CARET,ry=void 0!==/()??/.exec("")[1];(ey||ry||ty||qv||Kv)&&(Jv=function(e){var t,r,n,i,o,a,s,u=this,c=Gv(u),l=Fv(e),f=c.raw;if(f)return f.lastIndex=u.lastIndex,t=Uv(Jv,f,l),u.lastIndex=f.lastIndex,t;var d=c.groups,h=ty&&u.sticky,p=Uv(zv,u),v=u.source,y=0,g=l;if(h&&(p=Zv(p,"y",""),-1===Qv(p,"g")&&(p+="g"),g=$v(l,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==Xv(l,u.lastIndex-1))&&(v="(?: "+v+")",g=" "+g,y++),r=new RegExp("^(?:"+v+")",p)),ry&&(r=new RegExp("^"+v+"$(?!\\s)",p)),ey&&(n=u.lastIndex),i=Uv(Yv,h?r:u,g),h?i?(i.input=$v(i.input,y),i[0]=$v(i[0],y),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:ey&&i&&(u.lastIndex=u.global?i.index+i[0].length:n),ry&&i&&i.length>1&&Uv(Wv,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&d)for(i.groups=a=Hv(null),o=0;o<d.length;o++)a[(s=d[o])[0]]=i[s[1]];return i});ti({target:"RegExp",proto:!0,forced:/./.exec!==Jv},{exec:Jv});var ny=vt("span").classList,iy=ny&&ny.constructor&&ny.constructor.prototype,oy=iy===Object.prototype?void 0:iy,ay=a,sy=function(e,t){var r=[][e];return!!r&&ay((function(){r.call(null,t||function(){return 1},1)}))},uy=Yo.forEach,cy=sy("forEach")?[].forEach:function(e){return uy(this,e,arguments.length>1?arguments[1]:void 0)},ly=i,fy={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},dy=oy,hy=cy,py=Kt,vy=function(e){if(e&&e.forEach!==hy)try{py(e,"forEach",hy)}catch(t){e.forEach=hy}};for(var yy in fy)fy[yy]&&vy(ly[yy]&&ly[yy].prototype);vy(dy);var gy={exports:{}},my={exports:{}};!function(e){function t(r){return e.exports=t="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},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(my),function(e){var t=my.exports.default;function r(){e.exports=r=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var n,i={},o=Object.prototype,a=o.hasOwnProperty,s=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function d(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(n){d=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=t&&t.prototype instanceof _?t:_,o=Object.create(i.prototype),a=new I(n||[]);return s(o,"_invoke",{value:R(e,r,a)}),o}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}i.wrap=h;var v="suspendedStart",y="suspendedYield",g="executing",m="completed",b={};function _(){}function w(){}function k(){}var x={};d(x,c,(function(){return this}));var T=Object.getPrototypeOf,S=T&&T(T(C([])));S&&S!==o&&a.call(S,c)&&(x=S);var E=k.prototype=_.prototype=Object.create(x);function O(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,r){function n(i,o,s,u){var c=p(e[i],e,o);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==t(f)&&a.call(f,"__await")?r.resolve(f.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):r.resolve(f).then((function(e){l.value=e,s(l)}),(function(e){return n("throw",e,s,u)}))}u(c.arg)}var i;s(this,"_invoke",{value:function(e,t){function o(){return new r((function(r,i){n(e,t,r,i)}))}return i=i?i.then(o,o):o()}})}function R(e,t,r){var i=v;return function(o,a){if(i===g)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:n,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var u=L(s,r);if(u){if(u===b)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===v)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=g;var c=p(e,t,r);if("normal"===c.type){if(i=r.done?m:y,c.arg===b)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function L(e,t){var r=t.method,i=e.iterator[r];if(i===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=n,L(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),b;var o=p(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,b;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,b):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,b)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function B(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function t(){for(;++i<e.length;)if(a.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=n,t.done=!0,t};return o.next=o}}throw new TypeError(t(e)+" is not iterable")}return w.prototype=k,s(E,"constructor",{value:k,configurable:!0}),s(k,"constructor",{value:w,configurable:!0}),w.displayName=d(k,f,"GeneratorFunction"),i.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},i.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,d(e,f,"GeneratorFunction")),e.prototype=Object.create(E),e},i.awrap=function(e){return{__await:e}},O(A.prototype),d(A.prototype,l,(function(){return this})),i.AsyncIterator=A,i.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var a=new A(h(e,t,r,n),o);return i.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},O(E),d(E,f,"Generator"),d(E,c,(function(){return this})),d(E,"toString",(function(){return"[object Generator]"})),i.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},i.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(B),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return s.type="throw",s.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=a.call(o,"catchLoc"),c=a.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,b):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),b},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),B(r),b}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;B(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:C(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),b}},i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(gy);var by=gy.exports(),_y=by;try{regeneratorRuntime=by}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=by:Function("r","regeneratorRuntime = r")(by)}var wy=et,ky=Ni,xy=Ot.f,Ty=wy("unscopables"),Sy=Array.prototype;void 0===Sy[Ty]&&xy(Sy,Ty,{configurable:!0,value:ky(null)});var Ey=function(e){Sy[Ty][e]=!0},Oy=ti,Ay=Yo.find,Ry=Ey,Ly="find",Py=!0;Ly in[]&&Array(1)[Ly]((function(){Py=!1})),Oy({target:"Array",proto:!0,forced:Py},{find:function(e){return Ay(this,e,arguments.length>1?arguments[1]:void 0)}}),Ry(Ly);var By,Iy,Cy,My=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Dy=Fe,jy=z,Uy=je,Ny=My,Fy=hr("IE_PROTO"),zy=Object,Vy=zy.prototype,Hy=Ny?zy.getPrototypeOf:function(e){var t=Uy(e);if(Dy(t,Fy))return t[Fy];var r=t.constructor;return jy(r)&&t instanceof r?r.prototype:t instanceof zy?Vy:null},Gy=a,qy=z,Ky=H,Wy=Hy,Yy=Xr,Jy=et("iterator"),Xy=!1;[].keys&&("next"in(Cy=[].keys())?(Iy=Wy(Wy(Cy)))!==Object.prototype&&(By=Iy):Xy=!0);var Qy=!Ky(By)||Gy((function(){var e={};return By[Jy].call(e)!==e}));Qy&&(By={}),qy(By[Jy])||Yy(By,Jy,(function(){return this}));var Zy={IteratorPrototype:By,BUGGY_SAFARI_ITERATORS:Xy},$y=Zy.IteratorPrototype,eg=Ni,tg=m,rg=lo,ng=ep,ig=function(){return this},og=ti,ag=f,sg=z,ug=function(e,t,r,n){var i=t+" Iterator";return e.prototype=eg($y,{next:tg(+!n,r)}),rg(e,i,!1),ng[i]=ig,e},cg=Hy,lg=cl,fg=lo,dg=Kt,hg=Xr,pg=ep,vg=$t.PROPER,yg=$t.CONFIGURABLE,gg=Zy.IteratorPrototype,mg=Zy.BUGGY_SAFARI_ITERATORS,bg=et("iterator"),_g="keys",wg="values",kg="entries",xg=function(){return this},Tg=N,Sg=Ey,Eg=ep,Og=Ar,Ag=Ot.f,Rg=function(e,t,r,n,i,o,a){ug(r,t,n);var s,u,c,l=function(e){if(e===i&&v)return v;if(!mg&&e&&e in h)return h[e];switch(e){case _g:case wg:case kg:return function(){return new r(this,e)}}return function(){return new r(this)}},f=t+" Iterator",d=!1,h=e.prototype,p=h[bg]||h["@@iterator"]||i&&h[i],v=!mg&&p||l(i),y="Array"===t&&h.entries||p;if(y&&(s=cg(y.call(new e)))!==Object.prototype&&s.next&&(cg(s)!==gg&&(lg?lg(s,gg):sg(s[bg])||hg(s,bg,xg)),fg(s,f,!0)),vg&&i===wg&&p&&p.name!==wg&&(yg?dg(h,"name",wg):(d=!0,v=function(){return ag(p,this)})),i)if(u={values:l(wg),keys:o?v:l(_g),entries:l(kg)},a)for(c in u)(mg||d||!(c in h))&&hg(h,c,u[c]);else og({target:t,proto:!0,forced:mg||d},u);return h[bg]!==v&&hg(h,bg,v,{name:i}),pg[t]=v,u},Lg=function(e,t){return{value:e,done:t}},Pg=s,Bg="Array Iterator",Ig=Og.set,Cg=Og.getterFor(Bg),Mg=Rg(Array,"Array",(function(e,t){Ig(this,{type:Bg,target:Tg(e),index:0,kind:t})}),(function(){var e=Cg(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=void 0,Lg(void 0,!0);switch(e.kind){case"keys":return Lg(r,!1);case"values":return Lg(t[r],!1)}return Lg([r,t[r]],!1)}),"values"),Dg=Eg.Arguments=Eg.Array;if(Sg("keys"),Sg("values"),Sg("entries"),Pg&&"values"!==Dg.name)try{Ag(Dg,"name",{value:"values"})}catch(e){}var jg=Yo.map;ti({target:"Array",proto:!0,forced:!au("map")},{map:function(e){return jg(this,e,arguments.length>1?arguments[1]:void 0)}});var Ug=ti,Ng=_o,Fg=Io,zg=H,Vg=sn,Hg=dn,Gg=N,qg=yu,Kg=et,Wg=zi,Yg=au("slice"),Jg=Kg("species"),Xg=Array,Qg=Math.max;Ug({target:"Array",proto:!0,forced:!Yg},{slice:function(e,t){var r,n,i,o=Gg(this),a=Hg(o),s=Vg(e,a),u=Vg(void 0===t?a:t,a);if(Ng(o)&&(r=o.constructor,(Fg(r)&&(r===Xg||Ng(r.prototype))||zg(r)&&null===(r=r[Jg]))&&(r=void 0),r===Xg||void 0===r))return Wg(o,s,u);for(n=new(void 0===r?Xg:r)(Qg(u-s,0)),i=0;s<u;s++,i++)s in o&&qg(n,i,o[s]);return n.length=i,n}});var Zg,$g,em,tm={exports:{}},rm="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,nm=rm,im=s,om=i,am=z,sm=H,um=Fe,cm=li,lm=he,fm=Kt,dm=Xr,hm=Ji,pm=W,vm=Hy,ym=cl,gm=et,mm=qe,bm=Ar.enforce,_m=Ar.get,wm=om.Int8Array,km=wm&&wm.prototype,xm=om.Uint8ClampedArray,Tm=xm&&xm.prototype,Sm=wm&&vm(wm),Em=km&&vm(km),Om=Object.prototype,Am=om.TypeError,Rm=gm("toStringTag"),Lm=mm("TYPED_ARRAY_TAG"),Pm="TypedArrayConstructor",Bm=nm&&!!ym&&"Opera"!==cm(om.opera),Im=!1,Cm={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Mm={BigInt64Array:8,BigUint64Array:8},Dm=function(e){var t=vm(e);if(sm(t)){var r=_m(t);return r&&um(r,Pm)?r[Pm]:Dm(t)}},jm=function(e){if(!sm(e))return!1;var t=cm(e);return um(Cm,t)||um(Mm,t)};for(Zg in Cm)(em=($g=om[Zg])&&$g.prototype)?bm(em)[Pm]=$g:Bm=!1;for(Zg in Mm)(em=($g=om[Zg])&&$g.prototype)&&(bm(em)[Pm]=$g);if((!Bm||!am(Sm)||Sm===Function.prototype)&&(Sm=function(){throw new Am("Incorrect invocation")},Bm))for(Zg in Cm)om[Zg]&&ym(om[Zg],Sm);if((!Bm||!Em||Em===Om)&&(Em=Sm.prototype,Bm))for(Zg in Cm)om[Zg]&&ym(om[Zg].prototype,Em);if(Bm&&vm(Tm)!==Em&&ym(Tm,Em),im&&!um(Em,Rm))for(Zg in Im=!0,hm(Em,Rm,{configurable:!0,get:function(){return sm(this)?this[Lm]:void 0}}),Cm)om[Zg]&&fm(om[Zg],Lm,Zg);var Um={NATIVE_ARRAY_BUFFER_VIEWS:Bm,TYPED_ARRAY_TAG:Im&&Lm,aTypedArray:function(e){if(jm(e))return e;throw new Am("Target is not a typed array")},aTypedArrayConstructor:function(e){if(am(e)&&(!ym||pm(Sm,e)))return e;throw new Am(lm(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(im){if(r)for(var i in Cm){var o=om[i];if(o&&um(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}Em[e]&&!r||dm(Em,e,r?t:Bm&&km[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(im){if(ym){if(r)for(n in Cm)if((i=om[n])&&um(i,e))try{delete i[e]}catch(e){}if(Sm[e]&&!r)return;try{return dm(Sm,e,r?t:Bm&&Sm[e]||t)}catch(e){}}for(n in Cm)!(i=om[n])||i[e]&&!r||dm(i,e,t)}},getTypedArrayConstructor:Dm,isView:function(e){if(!sm(e))return!1;var t=cm(e);return"DataView"===t||um(Cm,t)||um(Mm,t)},isTypedArray:jm,TypedArray:Sm,TypedArrayPrototype:Em},Nm=i,Fm=a,zm=Np,Vm=Um.NATIVE_ARRAY_BUFFER_VIEWS,Hm=Nm.ArrayBuffer,Gm=Nm.Int8Array,qm=!Vm||!Fm((function(){Gm(1)}))||!Fm((function(){new Gm(-1)}))||!zm((function(e){new Gm,new Gm(null),new Gm(1.5),new Gm(e)}),!0)||Fm((function(){return 1!==new Gm(new Hm(2),1,void 0).length})),Km=Xr,Wm=rn,Ym=ln,Jm=RangeError,Xm=function(e){if(void 0===e)return 0;var t=Wm(e),r=Ym(t);if(t!==r)throw new Jm("Wrong length or index");return r},Qm=Math.sign||function(e){var t=+e;return 0===t||t!=t?t:t<0?-1:1},Zm=Qm,$m=Math.abs,eb=2220446049250313e-31,tb=1/eb,rb=function(e,t,r,n){var i=+e,o=$m(i),a=Zm(i);if(o<n)return a*function(e){return e+tb-tb}(o/n/t)*n*t;var s=(1+t/eb)*o,u=s-(s-o);return u>r||u!=u?a*(1/0):a*u},nb=Math.fround||function(e){return rb(e,1.1920928955078125e-7,34028234663852886e22,11754943508222875e-54)},ib=Array,ob=Math.abs,ab=Math.pow,sb=Math.floor,ub=Math.log,cb=Math.LN2,lb={pack:function(e,t,r){var n,i,o,a=ib(r),s=8*r-t-1,u=(1<<s)-1,c=u>>1,l=23===t?ab(2,-24)-ab(2,-77):0,f=e<0||0===e&&1/e<0?1:0,d=0;for((e=ob(e))!=e||e===1/0?(i=e!=e?1:0,n=u):(n=sb(ub(e)/cb),e*(o=ab(2,-n))<1&&(n--,o*=2),(e+=n+c>=1?l/o:l*ab(2,1-c))*o>=2&&(n++,o/=2),n+c>=u?(i=0,n=u):n+c>=1?(i=(e*o-1)*ab(2,t),n+=c):(i=e*ab(2,c-1)*ab(2,t),n=0));t>=8;)a[d++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[d++]=255&n,n/=256,s-=8;return a[--d]|=128*f,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,u=n-1,c=e[u--],l=127&c;for(c>>=7;s>0;)l=256*l+e[u--],s-=8;for(r=l&(1<<-s)-1,l>>=-s,s+=t;s>0;)r=256*r+e[u--],s-=8;if(0===l)l=1-a;else{if(l===o)return r?NaN:c?-1/0:1/0;r+=ab(2,t),l-=a}return(c?-1:1)*r*ab(2,l-t)}},fb=je,db=sn,hb=dn,pb=function(e){for(var t=fb(this),r=hb(t),n=arguments.length,i=db(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:db(o,r);a>i;)t[i++]=e;return t},vb=i,yb=x,gb=s,mb=rm,bb=Kt,_b=Ji,wb=function(e,t,r){for(var n in t)Km(e,n,t[n],r);return e},kb=a,xb=Ef,Tb=rn,Sb=ln,Eb=Xm,Ob=nb,Ab=lb,Rb=Hy,Lb=cl,Pb=pb,Bb=zi,Ib=hl,Cb=Un,Mb=lo,Db=Ar,jb=$t.PROPER,Ub=$t.CONFIGURABLE,Nb="ArrayBuffer",Fb="DataView",zb="prototype",Vb="Wrong index",Hb=Db.getterFor(Nb),Gb=Db.getterFor(Fb),qb=Db.set,Kb=vb[Nb],Wb=Kb,Yb=Wb&&Wb[zb],Jb=vb[Fb],Xb=Jb&&Jb[zb],Qb=Object.prototype,Zb=vb.Array,$b=vb.RangeError,e_=yb(Pb),t_=yb([].reverse),r_=Ab.pack,n_=Ab.unpack,i_=function(e){return[255&e]},o_=function(e){return[255&e,e>>8&255]},a_=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},s_=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},u_=function(e){return r_(Ob(e),23,4)},c_=function(e){return r_(e,52,8)},l_=function(e,t,r){_b(e[zb],t,{configurable:!0,get:function(){return r(this)[t]}})},f_=function(e,t,r,n){var i=Gb(e),o=Eb(r),a=!!n;if(o+t>i.byteLength)throw new $b(Vb);var s=i.bytes,u=o+i.byteOffset,c=Bb(s,u,u+t);return a?c:t_(c)},d_=function(e,t,r,n,i,o){var a=Gb(e),s=Eb(r),u=n(+i),c=!!o;if(s+t>a.byteLength)throw new $b(Vb);for(var l=a.bytes,f=s+a.byteOffset,d=0;d<t;d++)l[f+d]=u[c?d:t-d-1]};if(mb){var h_=jb&&Kb.name!==Nb;kb((function(){Kb(1)}))&&kb((function(){new Kb(-1)}))&&!kb((function(){return new Kb,new Kb(1.5),new Kb(NaN),1!==Kb.length||h_&&!Ub}))?h_&&Ub&&bb(Kb,"name",Nb):((Wb=function(e){return xb(this,Yb),Ib(new Kb(Eb(e)),this,Wb)})[zb]=Yb,Yb.constructor=Wb,Cb(Wb,Kb)),Lb&&Rb(Xb)!==Qb&&Lb(Xb,Qb);var p_=new Jb(new Wb(2)),v_=yb(Xb.setInt8);p_.setInt8(0,2147483648),p_.setInt8(1,2147483649),!p_.getInt8(0)&&p_.getInt8(1)||wb(Xb,{setInt8:function(e,t){v_(this,e,t<<24>>24)},setUint8:function(e,t){v_(this,e,t<<24>>24)}},{unsafe:!0})}else Yb=(Wb=function(e){xb(this,Yb);var t=Eb(e);qb(this,{type:Nb,bytes:e_(Zb(t),0),byteLength:t}),gb||(this.byteLength=t,this.detached=!1)})[zb],Xb=(Jb=function(e,t,r){xb(this,Xb),xb(e,Yb);var n=Hb(e),i=n.byteLength,o=Tb(t);if(o<0||o>i)throw new $b("Wrong offset");if(o+(r=void 0===r?i-o:Sb(r))>i)throw new $b("Wrong length");qb(this,{type:Fb,buffer:e,byteLength:r,byteOffset:o,bytes:n.bytes}),gb||(this.buffer=e,this.byteLength=r,this.byteOffset=o)})[zb],gb&&(l_(Wb,"byteLength",Hb),l_(Jb,"buffer",Gb),l_(Jb,"byteLength",Gb),l_(Jb,"byteOffset",Gb)),wb(Xb,{getInt8:function(e){return f_(this,1,e)[0]<<24>>24},getUint8:function(e){return f_(this,1,e)[0]},getInt16:function(e){var t=f_(this,2,e,arguments.length>1&&arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=f_(this,2,e,arguments.length>1&&arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return s_(f_(this,4,e,arguments.length>1&&arguments[1]))},getUint32:function(e){return s_(f_(this,4,e,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(e){return n_(f_(this,4,e,arguments.length>1&&arguments[1]),23)},getFloat64:function(e){return n_(f_(this,8,e,arguments.length>1&&arguments[1]),52)},setInt8:function(e,t){d_(this,1,e,i_,t)},setUint8:function(e,t){d_(this,1,e,i_,t)},setInt16:function(e,t){d_(this,2,e,o_,t,arguments.length>2&&arguments[2])},setUint16:function(e,t){d_(this,2,e,o_,t,arguments.length>2&&arguments[2])},setInt32:function(e,t){d_(this,4,e,a_,t,arguments.length>2&&arguments[2])},setUint32:function(e,t){d_(this,4,e,a_,t,arguments.length>2&&arguments[2])},setFloat32:function(e,t){d_(this,4,e,u_,t,arguments.length>2&&arguments[2])},setFloat64:function(e,t){d_(this,8,e,c_,t,arguments.length>2&&arguments[2])}});Mb(Wb,Nb),Mb(Jb,Fb);var y_={ArrayBuffer:Wb,DataView:Jb},g_=H,m_=Math.floor,b_=Number.isInteger||function(e){return!g_(e)&&isFinite(e)&&m_(e)===e},__=rn,w_=RangeError,k_=function(e){var t=__(e);if(t<0)throw new w_("The argument can't be less than 0");return t},x_=RangeError,T_=function(e,t){var r=k_(e);if(r%t)throw new x_("Wrong offset");return r},S_=Math.round,E_=li,O_=ut,A_=TypeError,R_=function(e){var t=O_(e,"number");if("number"==typeof t)throw new A_("Can't convert number to bigint");return BigInt(t)},L_=mo,P_=f,B_=Mu,I_=je,C_=dn,M_=gp,D_=lp,j_=ip,U_=function(e){var t=E_(e);return"BigInt64Array"===t||"BigUint64Array"===t},N_=Um.aTypedArrayConstructor,F_=R_,z_=dn,V_=function(e,t,r){for(var n=0,i=arguments.length>2?r:z_(t),o=new e(i);i>n;)o[n]=t[n++];return o},H_=ti,G_=i,q_=f,K_=s,W_=qm,Y_=Um,J_=y_,X_=Ef,Q_=m,Z_=Kt,$_=b_,ew=ln,tw=Xm,rw=T_,nw=function(e){var t=S_(e);return t<0?0:t>255?255:255&t},iw=ft,ow=Fe,aw=li,sw=H,uw=fe,cw=Ni,lw=W,fw=cl,dw=Qr.f,hw=function(e){var t,r,n,i,o,a,s,u,c=B_(this),l=I_(e),f=arguments.length,d=f>1?arguments[1]:void 0,h=void 0!==d,p=D_(l);if(p&&!j_(p))for(u=(s=M_(l,p)).next,l=[];!(a=P_(u,s)).done;)l.push(a.value);for(h&&f>2&&(d=L_(d,arguments[2])),r=C_(l),n=new(N_(c))(r),i=U_(n),t=0;r>t;t++)o=h?d(l[t],t):l[t],n[t]=i?F_(o):+o;return n},pw=Yo.forEach,vw=xf,yw=Ji,gw=Ot,mw=o,bw=V_,_w=hl,ww=Ar.get,kw=Ar.set,xw=Ar.enforce,Tw=gw.f,Sw=mw.f,Ew=G_.RangeError,Ow=J_.ArrayBuffer,Aw=Ow.prototype,Rw=J_.DataView,Lw=Y_.NATIVE_ARRAY_BUFFER_VIEWS,Pw=Y_.TYPED_ARRAY_TAG,Bw=Y_.TypedArray,Iw=Y_.TypedArrayPrototype,Cw=Y_.isTypedArray,Mw="BYTES_PER_ELEMENT",Dw="Wrong length",jw=function(e,t){yw(e,t,{configurable:!0,get:function(){return ww(this)[t]}})},Uw=function(e){var t;return lw(Aw,e)||"ArrayBuffer"===(t=aw(e))||"SharedArrayBuffer"===t},Nw=function(e,t){return Cw(e)&&!uw(t)&&t in e&&$_(+t)&&t>=0},Fw=function(e,t){return t=iw(t),Nw(e,t)?Q_(2,e[t]):Sw(e,t)},zw=function(e,t,r){return t=iw(t),!(Nw(e,t)&&sw(r)&&ow(r,"value"))||ow(r,"get")||ow(r,"set")||r.configurable||ow(r,"writable")&&!r.writable||ow(r,"enumerable")&&!r.enumerable?Tw(e,t,r):(e[t]=r.value,e)};K_?(Lw||(mw.f=Fw,gw.f=zw,jw(Iw,"buffer"),jw(Iw,"byteOffset"),jw(Iw,"byteLength"),jw(Iw,"length")),H_({target:"Object",stat:!0,forced:!Lw},{getOwnPropertyDescriptor:Fw,defineProperty:zw}),tm.exports=function(e,t,r){var n=e.match(/\d+/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=G_[i],u=s,c=u&&u.prototype,l={},f=function(e,t){Tw(e,t,{get:function(){return function(e,t){var r=ww(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=ww(e);o.view[a](t*n+o.byteOffset,r?nw(i):i,!0)}(this,t,e)},enumerable:!0})};Lw?W_&&(u=t((function(e,t,r,i){return X_(e,c),_w(sw(t)?Uw(t)?void 0!==i?new s(t,rw(r,n),i):void 0!==r?new s(t,rw(r,n)):new s(t):Cw(t)?bw(u,t):q_(hw,u,t):new s(tw(t)),e,u)})),fw&&fw(u,Bw),pw(dw(s),(function(e){e in u||Z_(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,r,i){X_(e,c);var o,a,s,l=0,d=0;if(sw(t)){if(!Uw(t))return Cw(t)?bw(u,t):q_(hw,u,t);o=t,d=rw(r,n);var h=t.byteLength;if(void 0===i){if(h%n)throw new Ew(Dw);if((a=h-d)<0)throw new Ew(Dw)}else if((a=ew(i)*n)+d>h)throw new Ew(Dw);s=a/n}else s=tw(t),o=new Ow(a=s*n);for(kw(e,{buffer:o,byteOffset:d,byteLength:a,length:s,view:new Rw(o)});l<s;)f(e,l++)})),fw&&fw(u,Bw),c=u.prototype=cw(Iw)),c.constructor!==u&&Z_(c,"constructor",u),xw(c).TypedArrayConstructor=u,Pw&&Z_(c,Pw,i);var d=u!==s;l[i]=u,H_({global:!0,constructor:!0,forced:d,sham:!Lw},l),Mw in u||Z_(u,Mw,n),Mw in c||Z_(c,Mw,n),vw(i)}):tm.exports=function(){},(0,tm.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var Vw=je,Hw=sn,Gw=dn,qw=Pc,Kw=Math.min,Ww=[].copyWithin||function(e,t){var r=Vw(this),n=Gw(r),i=Hw(e,n),o=Hw(t,n),a=arguments.length>2?arguments[2]:void 0,s=Kw((void 0===a?n:Hw(a,n))-o,n-i),u=1;for(o<i&&i<o+s&&(u=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:qw(r,i),i+=u,o+=u;return r},Yw=Um,Jw=x(Ww),Xw=Yw.aTypedArray;(0,Yw.exportTypedArrayMethod)("copyWithin",(function(e,t){return Jw(Xw(this),e,t,arguments.length>2?arguments[2]:void 0)}));var Qw=Yo.every,Zw=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("every",(function(e){return Qw(Zw(this),e,arguments.length>1?arguments[1]:void 0)}));var $w=pb,ek=R_,tk=li,rk=f,nk=a,ik=Um.aTypedArray,ok=Um.exportTypedArrayMethod,ak=x("".slice);ok("fill",(function(e){var t=arguments.length;ik(this);var r="Big"===ak(tk(this),0,3)?ek(e):+e;return rk($w,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),nk((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e})));var sk=Pf,uk=Um.aTypedArrayConstructor,ck=Um.getTypedArrayConstructor,lk=function(e){return uk(sk(e,ck(e)))},fk=V_,dk=lk,hk=Yo.filter,pk=function(e,t){return fk(dk(e),t)},vk=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("filter",(function(e){var t=hk(vk(this),e,arguments.length>1?arguments[1]:void 0);return pk(this,t)}));var yk=Yo.find,gk=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("find",(function(e){return yk(gk(this),e,arguments.length>1?arguments[1]:void 0)}));var mk=Yo.findIndex,bk=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("findIndex",(function(e){return mk(bk(this),e,arguments.length>1?arguments[1]:void 0)}));var _k=Yo.forEach,wk=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("forEach",(function(e){_k(wk(this),e,arguments.length>1?arguments[1]:void 0)}));var kk=gn.includes,xk=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("includes",(function(e){return kk(xk(this),e,arguments.length>1?arguments[1]:void 0)}));var Tk=gn.indexOf,Sk=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("indexOf",(function(e){return Tk(Sk(this),e,arguments.length>1?arguments[1]:void 0)}));var Ek=i,Ok=a,Ak=x,Rk=Um,Lk=Mg,Pk=et("iterator"),Bk=Ek.Uint8Array,Ik=Ak(Lk.values),Ck=Ak(Lk.keys),Mk=Ak(Lk.entries),Dk=Rk.aTypedArray,jk=Rk.exportTypedArrayMethod,Uk=Bk&&Bk.prototype,Nk=!Ok((function(){Uk[Pk].call([1])})),Fk=!!Uk&&Uk.values&&Uk[Pk]===Uk.values&&"values"===Uk.values.name,zk=function(){return Ik(Dk(this))};jk("entries",(function(){return Mk(Dk(this))}),Nk),jk("keys",(function(){return Ck(Dk(this))}),Nk),jk("values",zk,Nk||!Fk,{name:"values"}),jk(Pk,zk,Nk||!Fk,{name:"values"});var Vk=Um.aTypedArray,Hk=Um.exportTypedArrayMethod,Gk=x([].join);Hk("join",(function(e){return Gk(Vk(this),e)}));var qk=Ts,Kk=N,Wk=rn,Yk=dn,Jk=sy,Xk=Math.min,Qk=[].lastIndexOf,Zk=!!Qk&&1/[1].lastIndexOf(1,-0)<0,$k=Jk("lastIndexOf"),ex=Zk||!$k?function(e){if(Zk)return qk(Qk,this,arguments)||0;var t=Kk(this),r=Yk(t);if(0===r)return-1;var n=r-1;for(arguments.length>1&&(n=Xk(n,Wk(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:Qk,tx=Ts,rx=ex,nx=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return tx(rx,nx(this),t>1?[e,arguments[1]]:[e])}));var ix=Yo.map,ox=lk,ax=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("map",(function(e){return ix(ax(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(ox(e))(t)}))}));var sx=ge,ux=je,cx=B,lx=dn,fx=TypeError,dx="Reduce of empty array with no initial value",hx=function(e){return function(t,r,n,i){var o=ux(t),a=cx(o),s=lx(o);if(sx(r),0===s&&n<2)throw new fx(dx);var u=e?s-1:0,c=e?-1:1;if(n<2)for(;;){if(u in a){i=a[u],u+=c;break}if(u+=c,e?u<0:s<=u)throw new fx(dx)}for(;e?u>=0:s>u;u+=c)u in a&&(i=r(i,a[u],u,o));return i}},px={left:hx(!1),right:hx(!0)},vx=px.left,yx=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return vx(yx(this),e,t,t>1?arguments[1]:void 0)}));var gx=px.right,mx=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return gx(mx(this),e,t,t>1?arguments[1]:void 0)}));var bx=Um.aTypedArray,_x=Um.exportTypedArrayMethod,wx=Math.floor;_x("reverse",(function(){for(var e,t=this,r=bx(t).length,n=wx(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var kx=i,xx=f,Tx=Um,Sx=dn,Ex=T_,Ox=je,Ax=a,Rx=kx.RangeError,Lx=kx.Int8Array,Px=Lx&&Lx.prototype,Bx=Px&&Px.set,Ix=Tx.aTypedArray,Cx=Tx.exportTypedArrayMethod,Mx=!Ax((function(){var e=new Uint8ClampedArray(2);return xx(Bx,e,{length:1,0:3},1),3!==e[1]})),Dx=Mx&&Tx.NATIVE_ARRAY_BUFFER_VIEWS&&Ax((function(){var e=new Lx(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));Cx("set",(function(e){Ix(this);var t=Ex(arguments.length>1?arguments[1]:void 0,1),r=Ox(e);if(Mx)return xx(Bx,this,r,t);var n=this.length,i=Sx(r),o=0;if(i+t>n)throw new Rx("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!Mx||Dx);var jx=lk,Ux=zi,Nx=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("slice",(function(e,t){for(var r=Ux(Nx(this),e,t),n=jx(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),a((function(){new Int8Array(1).slice()})));var Fx=Yo.some,zx=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("some",(function(e){return Fx(zx(this),e,arguments.length>1?arguments[1]:void 0)}));var Vx=zi,Hx=Math.floor,Gx=function(e,t){var r=e.length;if(r<8)for(var n,i,o=1;o<r;){for(i=o,n=e[o];i&&t(e[i-1],n)>0;)e[i]=e[--i];i!==o++&&(e[i]=n)}else for(var a=Hx(r/2),s=Gx(Vx(e,0,a),t),u=Gx(Vx(e,a),t),c=s.length,l=u.length,f=0,d=0;f<c||d<l;)e[f+d]=f<c&&d<l?t(s[f],u[d])<=0?s[f++]:u[d++]:f<c?s[f++]:u[d++];return e},qx=Gx,Kx=Y.match(/firefox\/(\d+)/i),Wx=!!Kx&&+Kx[1],Yx=/MSIE|Trident/.test(Y),Jx=Y.match(/AppleWebKit\/(\d+)\./),Xx=!!Jx&&+Jx[1],Qx=po,Zx=a,$x=ge,eT=qx,tT=Wx,rT=Yx,nT=te,iT=Xx,oT=Um.aTypedArray,aT=Um.exportTypedArrayMethod,sT=i.Uint16Array,uT=sT&&Qx(sT.prototype.sort),cT=!(!uT||Zx((function(){uT(new sT(2),null)}))&&Zx((function(){uT(new sT(2),{})}))),lT=!!uT&&!Zx((function(){if(nT)return nT<74;if(tT)return tT<67;if(rT)return!0;if(iT)return iT<602;var e,t,r=new sT(516),n=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(uT(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));aT("sort",(function(e){return void 0!==e&&$x(e),lT?uT(this,e):eT(oT(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))}),!lT||cT);var fT=ln,dT=sn,hT=lk,pT=Um.aTypedArray;(0,Um.exportTypedArrayMethod)("subarray",(function(e,t){var r=pT(this),n=r.length,i=dT(e,n);return new(hT(r))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,fT((void 0===t?n:dT(t,n))-i))}));var vT=Ts,yT=Um,gT=a,mT=zi,bT=i.Int8Array,_T=yT.aTypedArray,wT=yT.exportTypedArrayMethod,kT=[].toLocaleString,xT=!!bT&&gT((function(){kT.call(new bT(1))}));wT("toLocaleString",(function(){return vT(kT,xT?mT(_T(this)):_T(this),mT(arguments))}),gT((function(){return[1,2].toLocaleString()!==new bT([1,2]).toLocaleString()}))||!gT((function(){bT.prototype.toLocaleString.call([1,2])})));var TT=Um.exportTypedArrayMethod,ST=a,ET=x,OT=i.Uint8Array,AT=OT&&OT.prototype||{},RT=[].toString,LT=ET([].join);ST((function(){RT.call({})}))&&(RT=function(){return LT(this)});var PT=AT.toString!==RT;TT("toString",RT,PT);var BT={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),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=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 u,c,l=this._events[s],f=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,i),!0;case 5:return l.fn.call(l.context,t,n,i,o),!0;case 6:return l.fn.call(l.context,t,n,i,o,a),!0}for(c=1,u=new Array(f-1);c<f;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var d,h=l.length;for(c=0;c<h;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),f){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,i);break;default:if(!u)for(d=1,u=new Array(f-1);d<f;d++)u[d-1]=arguments[d];l[c].fn.apply(l[c].context,u)}}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 u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==t||i&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c: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}(BT);var IT,CT=BT.exports,MT={};Object.defineProperty(MT,"__esModule",{value:!0}),MT.default=function(e){for(var t=0,r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,c=n[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){t+=u.value.length}}catch(e){a=!0,s=e}finally{try{!o&&c.return&&c.return()}finally{if(a)throw s}}var l=new e(t),f=0,d=!0,h=!1,p=void 0;try{for(var v,y=n[Symbol.iterator]();!(d=(v=y.next()).done);d=!0){var g=v.value;l.set(g,f),f+=g.length}}catch(e){h=!0,p=e}finally{try{!d&&y.return&&y.return()}finally{if(h)throw p}}return l};var DT=((IT=MT)&&IT.__esModule?IT:{default:IT}).default;function jT(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function UT(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,qT(n.key),n)}}function NT(e,t,r){return t&&UT(e.prototype,t),r&&UT(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function FT(e,t,r){return(t=qT(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zT(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||HT(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function VT(e){return function(e){if(Array.isArray(e))return GT(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||HT(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function HT(e,t){if(e){if("string"==typeof e)return GT(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?GT(e,t):void 0}}function GT(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function qT(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var KT="video",WT="audio",YT="metadata",JT="avc",XT="hevc",QT="vvcC",ZT="aac",$T="g7110a",eS="g7110m",tS=function(){function e(){jT(this,e),FT(this,"id",1),FT(this,"type",KT),FT(this,"codecType",JT),FT(this,"pid",-1),FT(this,"hvcC",void 0),FT(this,"codec",""),FT(this,"timescale",0),FT(this,"formatTimescale",0),FT(this,"sequenceNumber",0),FT(this,"baseMediaDecodeTime",0),FT(this,"baseDts",0),FT(this,"duration",0),FT(this,"warnings",[]),FT(this,"samples",[]),FT(this,"pps",[]),FT(this,"sps",[]),FT(this,"vps",[]),FT(this,"fpsNum",0),FT(this,"fpsDen",0),FT(this,"sarRatio",[]),FT(this,"width",0),FT(this,"height",0),FT(this,"nalUnitSize",4),FT(this,"present",!1),FT(this,"isVideoEncryption",!1),FT(this,"isAudioEncryption",!1),FT(this,"isVideo",!0),FT(this,"kid",null),FT(this,"pssh",null),FT(this,"ext",void 0)}return NT(e,[{key:"reset",value:function(){this.sequenceNumber=this.width=this.height=this.fpsDen=this.fpsNum=this.duration=this.baseMediaDecodeTime=this.timescale=0,this.codec="",this.present=!1,this.pid=-1,this.pps=[],this.sps=[],this.vps=[],this.sarRatio=[],this.samples=[],this.warnings=[],this.hvcC=null}},{key:"exist",value:function(){return!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}]),e}(),rS=function(){function e(){jT(this,e),FT(this,"id",2),FT(this,"type",WT),FT(this,"codecType",ZT),FT(this,"pid",-1),FT(this,"codec",""),FT(this,"sequenceNumber",0),FT(this,"sampleDuration",0),FT(this,"timescale",0),FT(this,"formatTimescale",0),FT(this,"baseMediaDecodeTime",0),FT(this,"duration",0),FT(this,"warnings",[]),FT(this,"samples",[]),FT(this,"baseDts",0),FT(this,"sampleSize",16),FT(this,"sampleRate",0),FT(this,"channelCount",0),FT(this,"objectType",0),FT(this,"sampleRateIndex",0),FT(this,"config",[]),FT(this,"present",!1),FT(this,"isVideoEncryption",!1),FT(this,"isAudioEncryption",!1),FT(this,"kid",null),FT(this,"ext",void 0)}return NT(e,[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!!(this.sampleRate&&this.channelCount&&this.codec&&this.codecType===ZT)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}}]),e}(),nS=function(){function e(t,r,n){jT(this,e),FT(this,"flag",{}),FT(this,"keyframe",!1),FT(this,"gopId",0),FT(this,"duration",0),FT(this,"size",0),FT(this,"units",[]),FT(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=r,n&&(this.units=n)}return NT(e,[{key:"cts",get:function(){return this.pts-this.dts}},{key:"setToKeyframe",value:function(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}]),e}(),iS=NT((function e(t,r,n,i){jT(this,e),FT(this,"duration",1024),FT(this,"flag",{dependsOn:2,isNonSyncSample:0}),FT(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=r,this.size=r.byteLength,this.sampleOffset=i,n&&(this.duration=n)})),oS=function(){function e(){jT(this,e),FT(this,"id",3),FT(this,"type",YT),FT(this,"timescale",0),FT(this,"flvScriptSamples",[]),FT(this,"seiSamples",[])}return NT(e,[{key:"exist",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length||!this.timescale)}},{key:"reset",value:function(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length)}}]),e}(),aS="undefined"!=typeof window,sS=aS&&navigator.userAgent.toLocaleLowerCase();aS&&/^((?!chrome|android).)*safari/.test(sS);var uS=aS&&sS.includes("firefox"),cS=aS&&sS.includes("android"),lS=function(){function e(){jT(this,e)}return NT(e,null,[{key:"getRateIndexByRate",value:function(t){return e.FREQ.indexOf(t)}},{key:"parseADTS",value:function(t,r){for(var n=t.length,i=0;i+2<n&&(255!==t[i]||240!=(246&t[i+1]));)i++;if(!(i>=n)){var o=i,a=[],s=(60&t[i+2])>>>2,u=e.FREQ[s];if(!u)throw new Error("Invalid sampling index: ".concat(s));for(var c,l,f=1+((192&t[i+2])>>>6),d=(1&t[i+2])<<2|(192&t[i+3])>>>6,h=e._getConfig(s,d,f),p=h.config,v=h.codec,y=0,g=e.getFrameDuration(u);i+7<n;)if(255===t[i]&&240==(246&t[i+1])){if(n-i<(l=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5))break;c=2*(1&~t[i+1]),a.push({pts:r+y*g,data:t.subarray(i+7+c,i+l)}),y++,i+=l}else i++;return{skip:o,remaining:i>=n?void 0:t.subarray(i),frames:a,samplingFrequencyIndex:s,sampleRate:u,objectType:f,channelCount:d,codec:v,config:p,originCodec:"mp4a.40.".concat(f)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var r=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,o=e.FREQ[n];if(o){var a=e._getConfig(n,i,r);return{samplingFrequencyIndex:n,sampleRate:o,objectType:r,channelCount:i,config:a.config,codec:a.codec,originCodec:"mp4a.40.".concat(r)}}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,r){var n,i,o=[];return uS?e>=6?(n=5,i=e-3):(n=2,i=e):cS?(n=2,i=e):(n=2===r||5===r?r:5,i=e,e>=6?i=e-3:1===t&&(n=2,i=e)),o[0]=n<<3,o[0]|=(14&e)>>1,o[1]=(1&e)<<7,o[1]|=t<<3,5===n&&(o[1]|=(14&i)>>1,o[2]=(1&i)<<7,o[2]|=8,o[3]=0),{config:o,codec:"mp4a.40.".concat(n)}}},{key:"getSilentFrame",value:function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}]),e}();function fS(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t=t.filter(Boolean);var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}FT(lS,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var dS=Math.pow(2,32);function hS(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function pS(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function vS(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return pS(e,t)*dS+pS(e,t+4)}function yS(e){var t="";if(e.forEach((function(e){t+=function(e){return("0"+Number(e).toString(16)).slice(-2).toUpperCase()}(e)})),t.length<=32)for(var r=32-t.length,n=0;n<r;n++)t+="0";return t}function gS(e){if(!Array.isArray(e)){for(var t=[],r="",n=0;n<e.length;n++)n%2&&(r=e[n-1]+e[n],t.push(parseInt(r,16)),r="");return t}return e.map((function(e){return parseInt(e,16)}))}var mS=function(){function e(t){if(jT(this,e),FT(this,"_bytesAvailable",void 0),FT(this,"_bitsAvailable",0),FT(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return NT(e,[{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw new Error("No bytes available");var r=new Uint8Array(4);r.set(this._data.subarray(e,e+t)),this._word=new DataView(r.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"bitsPos",value:function(){return 8*this._bytesAvailable-this._bitsAvailable}},{key:"bitsLeft",value:function(){return 8*this._data.length-this.bitsPos()}},{key:"byteAligned",value:function(){return 0===this.bitsPos()||this.bitsPos()%8==0}},{key:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{e-=this._bitsAvailable;var t=Math.floor(e/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw new Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),r=this._word>>>32-t;return this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),(t=e-t)>0&&this._bitsAvailable?r<<t|this.readBits(t):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this._bitsAvailable;++e)if(this._word&2147483648>>>e)return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,r=8,n=0;n<e;n++)0!==r&&(r=(t+this.readEG()+256)%256),t=0===r?t:r}}]),e}(),bS=function(){function e(t){jT(this,e),this._buffer=t,this._offset=0,this._heldBits=0,this._numHeldBits=0}return NT(e,[{key:"readUint8",value:function(){return this._buffer[this._offset++]}},{key:"readUint16",value:function(){return this._buffer[this._offset++]<<8|this._buffer[this._offset++]}},{key:"readUint32",value:function(){return this._buffer[this._offset++]<<24|this._buffer[this._offset++]<<16|this._buffer[this._offset++]<<8|this._buffer[this._offset++]}},{key:"readUint8Array",value:function(e){var t=this._buffer.slice(this._offset,this._offset+e);return this._offset+=e,t}},{key:"streamRead1Bytes",value:function(){this._heldBits=this.readUint8(),this._numHeldBits=8}},{key:"streamRead2Bytes",value:function(){this._heldBits=this.readUint16(),this._numHeldBits=16}},{key:"extractBits",value:function(e){var t=this._heldBits>>this._numHeldBits-e&(1<<e)-1;return this._numHeldBits-=e,t}}]),e}(),_S=function(){function e(){jT(this,e)}return NT(e,null,[{key:"parseVVCDecoderConfigurationRecord",value:function(t){var r=new bS(t),n=r.readUint8();r.streamRead1Bytes(),r.extractBits(5);var i,o,a,s,u,c,l,f,d=r.extractBits(2)+1,h=r.extractBits(1),p={};h&&(r.streamRead2Bytes(),s=r.extractBits(2),u=r.extractBits(3),o=r.extractBits(3),a=r.extractBits(2),r.extractBits(6),p=e.parseVVCPTLRecord(r,o),i=r.readUint16(),c=r.readUint16(),l=r.readUint16(),f=r.readUint16());for(var v=r.readUint8(),y=[],g=[],m=[],b=null,_=0;_<v;_++){r.streamRead1Bytes(),r.extractBits(1),r.extractBits(2);var w=r.extractBits(5),k=1;13!==w&&12!==w&&(k=r.readUint16());for(var x=0;x<k;x++){var T=r.readUint16();switch(w){case 14:y.push(r.readUint8Array(T));break;case 15:var S=r.readUint8Array(T);b||(b=e.parseSPS(e.removeEPB(S))),g.push(S);break;case 16:m.push(r.readUint8Array(T))}}}return{data:t,configurationVersion:n,codec:"bvc2.1.6.L93.B0",nalUnitSize:d,ptlPresentFlag:h,olsIdx:i,numSublayers:o,constantFrameRate:a,chromaFormatIdc:s,bitDepthLumaMinus8:u,ptlRecord:p,width:c,height:l,sampleRate:f,numOfArrays:v,vps:y,sps:g,pps:m,spsParsed:b}}},{key:"parseVVCPTLRecord",value:function(e,t){e.streamRead2Bytes(),e.extractBits(2);var r=e.extractBits(6),n=e.extractBits(7),i=e.extractBits(1),o=e.readUint8();e.streamRead1Bytes();var a=e.extractBits(1),s=e.extractBits(1),u=new Uint8Array(r);if(r){for(var c=0;c<r-1;c++){var l=e.extractBits(6);e.streamRead1Bytes();var f=e.extractBits(2);u[c]=l<<2|f}u[r-1]=e.extractBits(6)}else e.extractBits(6);var d=[];if(t>1){e.streamRead1Bytes();for(var h=0,p=t-2;p>=0;--p){h|=e.extractBits(1)<<p}for(var v=t;v<=8&&t>1;++v)e.extractBits(1);for(var y=t-2;y>=0;--y)h&1<<y&&(d[y]=e.readUint8())}var g=e.readUint8(),m=[];if(g)for(var b=0;b<g;b++)m.push(e.readUint32());return{generalProfileIdc:n,generalTierFlag:i,generalLevelIdc:o,ptlFrameOnlyConstraintFlag:a,ptlMultilayerEnabledFlag:s,generalConstraintInfo:u,subLayerLevelIdc:d,generalSubProfileIdc:m,ptlNumSubProfiles:g,numBytesConstraintInfo:r}}},{key:"getAvccNals",value:function(e){for(var t=[];e.position<e.length-4;){var r=e.dataview.getInt32(e.dataview.position);if(!(e.length-e.position>=r))break;var n=e.buffer.slice(e.position,e.position+4);e.skip(4);var i=new Uint8Array(e.buffer.slice(e.position,e.position+r));e.skip(r),t.push({header:n,body:i})}return t}},{key:"analyseNal",value:function(e){var t=(248&e.body[1])>>3;switch(e.type=t,t){case 23:case 24:break;case 7:case 8:e.key=!0;break;case 14:e.vps=!0;break;case 15:e.sps=!0;break;case 16:e.pps=!0;break;case 17:e.aps=!0}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,r=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(!r.length)return e;var i=t-r.length,o=new Uint8Array(i),a=0;for(n=0;n<i;a++,n++)a===r[0]&&(a++,r.shift()),o[n]=e[a];return o}},{key:"parseVps",value:function(){}},{key:"parseSPS",value:function(t){var r=new mS(t);r.readUByte(),r.readUByte(),r.skipBits(4);var n=r.readBits(4),i=r.readBits(3),o=r.readBits(2),a=420;o<=3&&(a=[0,420,422,444][o]),r.readBits(2),r.readBits(1);var s=e._parseProfileTierLevel(r,1,i);return r.readBits(1),r.readBits(1)&&r.readBits(1),{width:r.readUEG(),height:r.readUEG(),spsMaxSubLayerMinus1:i,spsVideoParameterSetId:n,chromaFormatIdc:o,chromaFormat:a,ptlInfo:s}}},{key:"_parseProfileTierLevel",value:function(t,r,n){var i,o=t.readBits(7),a=t.readBits(1),s=t.readBits(8),u=t.readBits(1),c=t.readBits(1);r&&(i=e._parseGeneralConstraintsInfo(t));for(var l=n-1,f=[],d=[],h=[],p=l;p>=0;--p)f[p]=t.readBits(1);for(;!t.byteAligned();)t.readBits(1);for(var v=l;v>=0;--v)f[v]&&(d[v]=t.readUByte());if(r)for(var y=t.readUByte(),g=0;g<y;g++)h[g]=t.readBits(32);return{generalProfileIdc:o,generalTierFlag:a,generalLevelIdc:s,ptlFrameOnlyConstraintFlag:u,ptlMultilayerEnabledFlag:c,ptlSublayerLevelPresentFlags:f,ptlSublayerLevelIdcs:d,ptlSubProfileIdcs:h,gciInfo:i}}},{key:"_parseGeneralConstraintsInfo",value:function(e){var t=e.readBits(1);if(t){e.skipBits(71);var r=e.readBits(8);r&&e.skipBits(r)}var n=8-e.bitsPos()%8;return e.skipBits(n),{gciPresentFlag:t}}}]),e}(),wS=function(){function e(){jT(this,e)}return NT(e,null,[{key:"findBox",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[];if(!t)return i;for(var o=0,a="",s=0;t.length>7;){if(o=pS(t),a=String.fromCharCode.apply(null,t.subarray(4,8)),s=8,1===o?(o=vS(t,8),s+=8):o||(o=t.length),!r[0]||a===r[0]){var u=t.subarray(0,o);if(!(r.length<2))return e.findBox(u.subarray(s),r.slice(1),n+s);i.push({start:n,size:o,headerSize:s,type:a,data:u})}n+=o,t=t.subarray(o)}return i}},{key:"tfhd",value:function(e){return SS(e,!0,(function(e,t){e.trackId=pS(t);var r=4,n=1&e.flags,i=2&e.flags,o=8&e.flags,a=16&e.flags,s=32&e.flags;n&&(r+=4,e.baseDataOffset=pS(t,r),r+=4),i&&(e.sampleDescriptionIndex=pS(t,r),r+=4),o&&(e.defaultSampleDuration=pS(t,r),r+=4),a&&(e.defaultSampleSize=pS(t,r),r+=4),s&&(e.defaultSampleFlags=pS(t,r))}))}},{key:"sidx",value:function(e){return SS(e,!0,(function(e,t){var r=0;e.reference_ID=pS(t,r),r+=4,e.timescale=pS(t,r),r+=4,0===e.version?(e.earliest_presentation_time=pS(t,r),r+=4,e.first_offset=pS(t,r),r+=4):(e.earliest_presentation_time=vS(t,r),r+=8,e.first_offset=vS(t,r),r+=8),r+=2,e.references=[];var n=hS(t,r);r+=2;for(var i=0;i<n;i++){var o={};e.references.push(o);var a=pS(t,r);r+=4,o.reference_type=a>>31&1,o.referenced_size=2147483647&a,o.subsegment_duration=pS(t,r),a=pS(t,r+=4),r+=4,o.starts_with_SAP=a>>31&1,o.SAP_type=a>>28&7,o.SAP_delta_time=268435455&a}}))}},{key:"moov",value:function(t){return SS(t,!1,(function(t,r,n){t.mvhd=e.mvhd(e.findBox(r,["mvhd"],n)[0]),t.trak=e.findBox(r,["trak"],n).map((function(t){return e.trak(t)})),t.pssh=e.pssh(e.findBox(r,["pssh"],n)[0])}))}},{key:"mvhd",value:function(e){return SS(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=pS(t,16),e.duration=vS(t,20),r+=28):(e.timescale=pS(t,8),e.duration=pS(t,12),r+=16),e.nextTrackId=pS(t,r+76)}))}},{key:"trak",value:function(t){return SS(t,!1,(function(t,r,n){t.tkhd=e.tkhd(e.findBox(r,["tkhd"],n)[0]),t.mdia=e.mdia(e.findBox(r,["mdia"],n)[0]),t.edts=e.edts(e.findBox(r,["edts"],n)[0])}))}},{key:"tkhd",value:function(e){return SS(e,!0,(function(e,t){var r=0;1===e.version?(e.trackId=pS(t,16),e.duration=vS(t,24),r+=32):(e.trackId=pS(t,8),e.duration=pS(t,16),r+=20),e.width=pS(t,r+52),e.height=pS(t,r+56)}))}},{key:"mdia",value:function(t){return SS(t,!1,(function(t,r,n){t.mdhd=e.mdhd(e.findBox(r,["mdhd"],n)[0]),t.hdlr=e.hdlr(e.findBox(r,["hdlr"],n)[0]),t.minf=e.minf(e.findBox(r,["minf"],n)[0])}))}},{key:"edts",value:function(t){return SS(t,!1,(function(t,r,n){t.elst=e.elst(e.findBox(r,["elst"],n)[0])}))}},{key:"elst",value:function(e){return SS(e,!0,(function(e,t,r){e.entries=[],e.entriesData=t;var n=0,i=pS(t,n);n+=4;for(var o=0;o<i;o++){var a={};e.entries.push(a),1===e.version?(a.segment_duration=vS(t,n),n+=8,a.media_time=vS(t,n),n+=8):(a.segment_duration=pS(t,n),n+=4,a.media_time=pS(t,n),n+=4),a.media_rate_integer=hS(t,n),n+=2,a.media_rate_fraction=hS(t,r),n+=2}}))}},{key:"mdhd",value:function(e){return SS(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=pS(t,16),e.duration=vS(t,20),r+=28):(e.timescale=pS(t,8),e.duration=pS(t,12),r+=16);var n=hS(t,r);e.language=String.fromCharCode(96+(n>>10&31),96+(n>>5&31),96+(31&n))}))}},{key:"hdlr",value:function(e){return SS(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return SS(t,!1,(function(t,r,n){t.vmhd=e.vmhd(e.findBox(r,["vmhd"],n)[0]),t.smhd=e.smhd(e.findBox(r,["smhd"],n)[0]),t.stbl=e.stbl(e.findBox(r,["stbl"],n)[0])}))}},{key:"vmhd",value:function(e){return SS(e,!0,(function(e,t){e.graphicsmode=hS(t),e.opcolor=[hS(t,2),hS(t,4),hS(t,6)]}))}},{key:"smhd",value:function(e){return SS(e,!0,(function(e,t){e.balance=hS(t)}))}},{key:"stbl",value:function(t){return SS(t,!1,(function(t,r,n){var i,o,a;t.stsd=e.stsd(e.findBox(r,["stsd"],n)[0]),t.stts=e.stts(e.findBox(r,["stts"],n)[0]),t.ctts=e.ctts(e.findBox(r,["ctts"],n)[0]),t.stsc=e.stsc(e.findBox(r,["stsc"],n)[0]),t.stsz=e.stsz(e.findBox(r,["stsz"],n)[0]),t.stco=e.stco(e.findBox(r,["stco"],n)[0]),t.stco||(t.co64=e.co64(e.findBox(r,["co64"],n)[0]),t.stco=t.co64);var s=null===(i=t.stsd.entries[0])||void 0===i||null===(o=i.sinf)||void 0===o||null===(a=o.schi)||void 0===a?void 0:a.tenc.default_IV_size;t.stss=e.stss(e.findBox(r,["stss"],n)[0]),t.senc=e.senc(e.findBox(r,["senc"],n)[0],s)}))}},{key:"senc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return SS(e,!0,(function(e,r){var n=0,i=pS(r,n);n+=4,e.samples=[];for(var o=0;o<i;o++){for(var a={InitializationVector:[]},s=0;s<t;s++)a.InitializationVector[s]=r[n+s];if(n+=t,2&e.flags){a.subsamples=[];var u=hS(r,n);n+=2;for(var c=0;c<u;c++){var l={};l.BytesOfClearData=hS(r,n),n+=2,l.BytesOfProtectedData=pS(r,n),n+=4,a.subsamples.push(l)}}e.samples.push(a)}}))}},{key:"pssh",value:function(e){return SS(e,!0,(function(e,t){for(var r=[],n=[],i=0,o=0;o<16;o++)n.push(ES(t[i+o]));if(i+=16,e.version>0){var a=pS(t,i);i+=4;for(var s=0;s<(""+a).length;s++)for(var u=0;u<16;u++){var c=t[i];i+=1,r.push(ES(c))}}var l=pS(t,i);e.data_size=l,i+=4,e.kid=r,e.system_id=n,e.buffer=t}))}},{key:"bvc2",value:function(t){return SS(t,!1,(function(t,r,n){var i=xS(t,r),o=r.subarray(i);n+=i,t.vvcC=e.bv2C(e.findBox(o,["bv2C"],n)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],n)[0])}))}},{key:"bv2C",value:function(e){return SS(e,!1,(function(e,t,r){var n=_S.parseVVCDecoderConfigurationRecord(t);for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}))}},{key:"stsd",value:function(t){return SS(t,!0,(function(t,r,n){t.entryCount=pS(r),t.entries=e.findBox(r.subarray(4),[],n+4).map((function(t){switch(t.type){case"avc1":case"avc2":case"avc3":case"avc4":return e.avc1(t);case"hvc1":case"hev1":return e.hvc1(t);case"bvc2":return e.bvc2(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return SS(t,!1,(function(t,r,n){t.channelCount=hS(r,16),t.samplesize=hS(r,18),t.sampleRate=pS(r,24)/65536,r=r.subarray(28),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.esds=e.esds(e.findBox(r,["esds"],n)[0])}));case"encv":return SS(t,!1,(function(t,r,n){t.width=hS(r,24),t.height=hS(r,26),t.horizresolution=pS(r,28),t.vertresolution=pS(r,32),r=r.subarray(78),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.avcC=e.avcC(e.findBox(r,["avcC"],n)[0]),t.hvcC=e.hvcC(e.findBox(r,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(r,["pasp"],n)[0])}))}})).filter(Boolean)}))}},{key:"tenc",value:function(e){return SS(e,!1,(function(e,t){var r=6;e.default_IsEncrypted=t[r],r+=1,e.default_IV_size=t[r],r+=1,e.default_KID=[];for(var n=0;n<16;n++)e.default_KID.push(ES(t[r])),r+=1}))}},{key:"schi",value:function(t){return SS(t,!1,(function(t,r,n){t.tenc=e.tenc(e.findBox(r,["tenc"],n)[0])}))}},{key:"sinf",value:function(t){return SS(t,!1,(function(t,r,n){t.schi=e.schi(e.findBox(r,["schi"],n)[0]),t.frma=e.frma(e.findBox(r,["frma"],n)[0])}))}},{key:"frma",value:function(e){return SS(e,!1,(function(e,t){e.data_format="";for(var r=0;r<4;r++)e.data_format+=String.fromCharCode(t[r])}))}},{key:"avc1",value:function(t){return SS(t,!1,(function(t,r,n){var i=xS(t,r),o=r.subarray(i);n+=i,t.avcC=e.avcC(e.findBox(o,["avcC"],n)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],n)[0])}))}},{key:"avcC",value:function(e){return SS(e,!1,(function(e,t){e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=function(e){for(var t,r="avc1.",n=0;n<3;n++)(t=e[n].toString(16)).length<2&&(t="0".concat(t)),r+=t;return r}([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];for(var r=6,n=0;n<e.spsLength;n++){var i=hS(t,r);r+=2,e.sps.push(t.subarray(r,r+i)),r+=i}e.ppsLength=t[r],r+=1,e.pps=[];for(var o=0;o<e.ppsLength;o++){var a=hS(t,r);r+=2,e.pps.push(t.subarray(r,r+=a)),r+=a}}))}},{key:"hvc1",value:function(t){return SS(t,!1,(function(t,r,n){var i=xS(t,r),o=r.subarray(i);n+=i,t.hvcC=e.hvcC(e.findBox(o,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],n)[0])}))}},{key:"hvcC",value:function(e){return SS(e,!1,(function(t,r){t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=r[0];var n=r[1];t.generalProfileSpace=n>>6,t.generalTierFlag=(32&n)>>5,t.generalProfileIdc=31&n,t.generalProfileCompatibility=pS(r,2),t.generalConstraintIndicatorFlags=r.subarray(6,12),t.generalLevelIdc=r[12],t.avgFrameRate=hS(r,19),t.numOfArrays=r[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,o=0,a=0,s=0,u=0;u<t.numOfArrays;u++){o=63&r[i],a=hS(r,i+1),i+=3;for(var c,l=[],f=0;f<a;f++)s=hS(r,i),i+=2,l.push(r.subarray(i,i+s)),i+=s;if(32===o)(c=t.vps).push.apply(c,l);else if(33===o){var d;(d=t.sps).push.apply(d,l)}else if(34===o){var h;(h=t.pps).push.apply(h,l)}}}))}},{key:"pasp",value:function(e){return SS(e,!1,(function(e,t){e.hSpacing=pS(t),e.vSpacing=pS(t,4)}))}},{key:"mp4a",value:function(t){return SS(t,!1,(function(t,r,n){var i=TS(t,r);t.esds=e.esds(e.findBox(r.subarray(i),["esds"],n+i)[0])}))}},{key:"esds",value:function(e){return SS(e,!0,(function(e,t){e.codec="mp4a.";for(var r=0,n=0,i=0,o=0;t.length;){for(o=t[r=0],n=t[r+1],r+=2;128&n;)i=(127&n)<<7,n=t[r],r+=1;if(i+=127&n,3===o)t=t.subarray(r+3);else{if(4!==o){if(5===o){var a=e.config=t.subarray(r,r+i),s=(248&a[0])>>3;return 31===s&&a.length>=2&&(s=32+((7&a[0])<<3)+((224&a[1])>>5)),e.objectType=s,e.codec+=s.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[r].toString(16)+".").padStart(3,"0"),t=t.subarray(r+13)}}}))}},{key:"alaw",value:function(e){return SS(e,!1,(function(e,t){TS(e,t)}))}},{key:"stts",value:function(e){return SS(e,!0,(function(e,t){for(var r=pS(t),n=[],i=4,o=0;o<r;o++)n.push({count:pS(t,i),delta:pS(t,i+4)}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"ctts",value:function(e){return SS(e,!0,(function(e,t){var r=pS(t),n=[],i=4;if(1===e.version)for(var o=0;o<r;o++)n.push({count:pS(t,i),offset:pS(t,i+4)}),i+=8;else for(var a=0;a<r;a++)n.push({count:pS(t,i),offset:-(1+~pS(t,i+4))}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stsc",value:function(e){return SS(e,!0,(function(e,t){for(var r=pS(t),n=[],i=4,o=0;o<r;o++)n.push({firstChunk:pS(t,i),samplesPerChunk:pS(t,i+4),sampleDescriptionIndex:pS(t,i+8)}),i+=12;e.entryCount=r,e.entries=n}))}},{key:"stsz",value:function(e){return SS(e,!0,(function(e,t){var r=pS(t),n=pS(t,4),i=[];if(!r)for(var o=8,a=0;a<n;a++)i.push(pS(t,o)),o+=4;e.sampleSize=r,e.sampleCount=n,e.entrySizes=i}))}},{key:"stco",value:function(e){return SS(e,!0,(function(e,t){for(var r=pS(t),n=[],i=4,o=0;o<r;o++)n.push(pS(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"co64",value:function(e){return SS(e,!0,(function(e,t){for(var r=pS(t),n=[],i=4,o=0;o<r;o++)n.push(vS(t,i)),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stss",value:function(e){return SS(e,!0,(function(e,t){for(var r=pS(t),n=[],i=4,o=0;o<r;o++)n.push(pS(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"moof",value:function(t){return SS(t,!1,(function(t,r,n){t.mfhd=e.mfhd(e.findBox(r,["mfhd"],n)[0]),t.traf=e.findBox(r,["traf"],n).map((function(t){return e.traf(t)}))}))}},{key:"mfhd",value:function(e){return SS(e,!0,(function(e,t){e.sequenceNumber=pS(t)}))}},{key:"traf",value:function(t){return SS(t,!1,(function(t,r,n){t.tfhd=e.tfhd(e.findBox(r,["tfhd"],n)[0]),t.tfdt=e.tfdt(e.findBox(r,["tfdt"],n)[0]),t.trun=e.trun(e.findBox(r,["trun"],n)[0])}))}},{key:"trun",value:function(e){return SS(e,!0,(function(e,t){var r=e.version,n=e.flags,i=t.length,o=e.sampleCount=pS(t),a=4;if(i>a&&1&n&&(e.dataOffset=-(1+~pS(t,a)),a+=4),i>a&&4&n&&(e.firstSampleFlags=pS(t,a),a+=4),e.samples=[],i>a)for(var s,u=0;u<o;u++)s={},256&n&&(s.duration=pS(t,a),a+=4),512&n&&(s.size=pS(t,a),a+=4),1024&n&&(s.flags=pS(t,a),a+=4),2048&n&&(s.cts=r?-(1+~pS(t,a+4)):pS(t,a),a+=4),e.samples.push(s)}))}},{key:"tfdt",value:function(e){return SS(e,!0,(function(e,t){1===e.version?e.baseMediaDecodeTime=vS(t):e.baseMediaDecodeTime=pS(t)}))}},{key:"probe",value:function(t){return!!e.findBox(t,["ftyp"])}},{key:"parseSampleFlags",value:function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}},{key:"moovToTrack",value:function(e,t,r){var n,i,o=e.trak;if(o&&o.length){var a=o.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),s=o.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(a&&t){var u,c,l,f,d,h,p,v,y=t,g=null===(u=a.tkhd)||void 0===u?void 0:u.trackId;null!=g&&(y.id=a.tkhd.trackId),y.tkhdDuration=a.tkhd.duration,y.mvhdDurtion=e.mvhd.duration,y.mvhdTimecale=e.mvhd.timescale,y.timescale=y.formatTimescale=a.mdia.mdhd.timescale,y.duration=a.mdia.mdhd.duration||y.mvhdDurtion/y.mvhdTimecale*y.timescale,null!==(c=a.edts)&&void 0!==c&&c.elst&&(y.editList=a.edts.elst);var m,b,_,w,k,x,T,S,E=a.mdia.minf.stbl.stsd.entries[0];if(y.width=E.width,y.height=E.height,E.pasp&&(y.sarRatio=[E.pasp.hSpacing,E.pasp.vSpacing]),E.hvcC)y.codecType=XT,y.codec=E.hvcC.codec,y.vps=E.hvcC.vps,y.sps=E.hvcC.sps,y.pps=E.hvcC.pps,y.hvcC=E.hvcC.data;else if(E.avcC)y.codec=E.avcC.codec,y.sps=E.avcC.sps,y.pps=E.avcC.pps;else{if(!E.vvcC)throw new Error("unknown video stsd entry");y.codecType=QT,y.codec=E.vvcC.codec,y.sps=E.vvcC.sps,y.pps=E.vvcC.pps,y.vps=E.vvcC.vps,y.vvcC=E.vvcC.data}if(y.present=!0,y.ext={},y.ext.stss=null===(l=a.mdia)||void 0===l||null===(f=l.minf)||void 0===f||null===(d=f.stbl)||void 0===d?void 0:d.stss,y.ext.ctts=null===(h=a.mdia)||void 0===h||null===(p=h.minf)||void 0===p||null===(v=p.stbl)||void 0===v?void 0:v.ctts,E&&"encv"===E.type)y.isVideoEncryption=!0,E.default_KID=null===(m=E.sinf)||void 0===m||null===(b=m.schi)||void 0===b?void 0:b.tenc.default_KID,E.default_IsEncrypted=null===(_=E.sinf)||void 0===_||null===(w=_.schi)||void 0===w?void 0:w.tenc.default_IsEncrypted,E.default_IV_size=null===(k=E.sinf)||void 0===k||null===(x=k.schi)||void 0===x?void 0:x.tenc.default_IV_size,y.videoSenc=a.mdia.minf.stbl.senc&&a.mdia.minf.stbl.senc.samples,E.data_format=null===(T=E.sinf)||void 0===T||null===(S=T.frma)||void 0===S?void 0:S.data_format,y.useEME=e.useEME,y.kidValue=e.kidValue,y.pssh=e.pssh,y.encv=E}if(s&&r){var O,A,R,L,P,B,I,C,M,D,j=r,U=null===(O=s.tkhd)||void 0===O?void 0:O.trackId;null!=U&&(j.id=s.tkhd.trackId),j.tkhdDuration=s.tkhd.duration,j.mvhdDurtion=e.mvhd.duration,j.mvhdTimecale=e.mvhd.timescale,j.timescale=j.formatTimescale=s.mdia.mdhd.timescale,j.duration=s.mdia.mdhd.duration||j.mvhdDurtion/j.mvhdTimecale*j.timescale,null!==(A=s.edts)&&void 0!==A&&A.elst&&(j.editList=s.edts.elst);var N,F,z,V,H,G,q,K,W=s.mdia.minf.stbl.stsd.entries[0];switch(j.sampleSize=W.sampleSize,j.sampleRate=W.sampleRate,j.channelCount=W.channelCount,j.present=!0,W.type){case"alaw":j.codecType=j.codec=$T,j.sampleRate=8e3;break;case"ulaw":j.codecType=j.codec=eS,j.sampleRate=8e3;break;default:j.sampleDuration=lS.getFrameDuration(j.sampleRate,j.timescale),j.sampleRateIndex=lS.getRateIndexByRate(j.sampleRate),j.objectType=(null===(n=W.esds)||void 0===n?void 0:n.objectType)||2,W.esds&&(j.config=Array.from(W.esds.config)),j.codec=(null===(i=W.esds)||void 0===i?void 0:i.codec)||"mp4a.40.2"}if(j.sampleDuration=lS.getFrameDuration(j.sampleRate,j.timescale),j.objectType=(null===(R=W.esds)||void 0===R?void 0:R.objectType)||2,W.esds&&(W.esds.config?j.config=Array.from(W.esds.config):console.warn("esds config is null")),j.codec=(null===(L=W.esds)||void 0===L?void 0:L.codec)||"mp4a.40.2",j.sampleRateIndex=lS.getRateIndexByRate(j.sampleRate),j.ext={},j.ext.stss=null===(P=s.mdia)||void 0===P||null===(B=P.minf)||void 0===B||null===(I=B.stbl)||void 0===I?void 0:I.stss,j.ext.ctts=null===(C=s.mdia)||void 0===C||null===(M=C.minf)||void 0===M||null===(D=M.stbl)||void 0===D?void 0:D.ctts,j.present=!0,W&&"enca"===W.type)j.isAudioEncryption=!0,W.data_format=null===(N=W.sinf)||void 0===N||null===(F=N.frma)||void 0===F?void 0:F.data_format,W.default_KID=null===(z=W.sinf)||void 0===z||null===(V=z.schi)||void 0===V?void 0:V.tenc.default_KID,W.default_IsEncrypted=null===(H=W.sinf)||void 0===H||null===(G=H.schi)||void 0===G?void 0:G.tenc.default_IsEncrypted,W.default_IV_size=null===(q=W.sinf)||void 0===q||null===(K=q.schi)||void 0===K?void 0:K.tenc.default_IV_size,j.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,j.useEME=e.useEME,j.kidValue=e.kidValue,j.enca=W}if(r&&(r.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!r&&r.isAudioEncryption),null!=t&&t.encv||null!=r&&r.enca){var Y,J,X=null==t||null===(Y=t.encv)||void 0===Y?void 0:Y.default_KID,Q=null==r||null===(J=r.enca)||void 0===J?void 0:J.default_KID,Z=X||Q?(X||Q).join(""):null;t&&(t.kid=Z),r&&(r.kid=Z)}return t&&(t.flags=3841),r&&(r.flags=1793),{videoTrack:t,audioTrack:r}}}},{key:"evaluateDefaultDuration",value:function(e,t,r){var n,i=null==t||null===(n=t.samples)||void 0===n?void 0:n.length;return i?1024*i/t.timescale*e.timescale/r:1024}},{key:"moofToSamples",value:function(t,r,n){var i={};return t.mfhd&&(r&&(r.sequenceNumber=t.mfhd.sequenceNumber),n&&(n.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach((function(t){var o=t.tfhd,a=t.tfdt,s=t.trun;if(o&&s){a&&(r&&r.id===o.trackId&&(r.baseMediaDecodeTime=a.baseMediaDecodeTime),n&&n.id===o.trackId&&(n.baseMediaDecodeTime=a.baseMediaDecodeTime));var u=o.defaultSampleSize||0,c=o.defaultSampleDuration||e.evaluateDefaultDuration(r,n,s.samples.length||s.sampleCount),l=s.dataOffset||0,f=0,d=-1;if(!s.samples.length&&s.sampleCount){i[o.trackId]=[];for(var h=0;h<s.sampleCount;h++)i[o.trackId].push({offset:l,dts:f,duration:c,size:u}),f+=c,l+=u}else i[o.trackId]=s.samples.map((function(e,t){return(e={offset:l,dts:f,pts:f+(e.cts||0),duration:e.duration||c,size:e.size||u,gopId:d,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(d++,e.gopId=d),f+=e.duration,l+=e.size,e}))}})),i}},{key:"moovToSamples",value:function(e){var t=e.trak;if(t&&t.length){var r=t.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),n=t.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(r||n){var i,o;if(r){var a,s,u=null===(a=r.mdia)||void 0===a||null===(s=a.minf)||void 0===s?void 0:s.stbl;if(!u)return;var c=u.stts,l=u.stsc,f=u.stsz,d=u.stco,h=u.stss,p=u.ctts;if(!(c&&l&&f&&d&&h))return;i=kS(c,l,f,d,p,h)}if(n){var v,y,g,m=null===(v=n.mdia)||void 0===v||null===(y=v.minf)||void 0===y?void 0:y.stbl;if(!m)return;var b=null===(g=n.mdia.mdhd)||void 0===g?void 0:g.timescale,_=m.stts,w=m.stsc,k=m.stsz,x=m.stco;if(!(b&&_&&w&&k&&x))return;o=kS(_,w,k,x)}return{videoSamples:i,audioSamples:o}}}}}]),e}();function kS(e,t,r,n,i,o){var a,s,u,c=[],l=null==i?void 0:i.entries,f=t.entries,d=n.entries,h=r.entrySizes,p=null==o?void 0:o.entries;p&&(a={},p.forEach((function(e){a[e-1]=!0}))),l&&(s=[],l.forEach((function(e){for(var t=e.count,r=e.offset,n=0;n<t;n++)s.push(r)})));var v=-1,y=0,g=0,m=0,b=0,_=0,w=f[0].samplesPerChunk,k=f[1]?f[1].firstChunk-1:1/0;return e.entries.forEach((function(e){for(var t=e.count,n=e.delta,i=0;i<t;i++)u={dts:y,duration:n,size:h[g]||r.sampleSize,offset:d[m]+_,index:g},p&&(u.keyframe=a[g],u.keyframe&&v++,u.gopId=v),s&&g<s.length&&(u.pts=u.dts+s[g]),c.push(u),y+=n,++g<w?_+=u.size:(m++,_=0,m>=k&&(b++,k=f[b+1]?f[b+1].firstChunk-1:1/0),w+=f[b].samplesPerChunk)})),c}function xS(e,t){return e.dataReferenceIndex=hS(t,6),e.width=hS(t,24),e.height=hS(t,26),e.horizresolution=pS(t,28),e.vertresolution=pS(t,32),e.frameCount=hS(t,40),e.depth=hS(t,74),78}function TS(e,t){return e.dataReferenceIndex=hS(t,6),e.channelCount=hS(t,16),e.sampleSize=hS(t,18),e.sampleRate=pS(t,24)/65536,28}function SS(e,t,r){if(e){if(e.size!==e.data.length)throw new Error("box ".concat(e.type," size !== data.length"));var n={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(n.version=e.data[e.headerSize],n.flags=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),n.headerSize+=4),r(n,e.data.subarray(n.headerSize),n.start+n.headerSize),n}}var ES=function(){for(var e=[],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.forEach((function(t){e.push(function(e,t,r){for(var n=String(r),i=0|t,o=Math.ceil(i/n.length),a=[],s=String(e);o--;)a.push(n);return a.join("").substring(0,i-s.length)+s}(Number(t).toString(16),2,0))})),e[0]};var OS=function(){function e(){jT(this,e),this.buffer=new Uint8Array(0)}return NT(e,[{key:"write",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach((function(t){t?e.buffer=function(e){for(var t=0,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];n.forEach((function(e){t+=e.length}));var o=new e(t),a=0;return n.forEach((function(e){o.set(e,a),a+=e.length})),o}(Uint8Array,e.buffer,t):window.console.warn(t)}))}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]),e}(),AS=Math.pow(2,32)-1,RS=function(){function e(){jT(this,e)}return NT(e,null,[{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=8+(r=r.filter(Boolean)).reduce((function(e,t){return e+t.byteLength}),0),o=new Uint8Array(i);o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=255&i,o.set(e,4);var a=8;return r.forEach((function(e){o.set(e,a),a+=e.byteLength})),o}},{key:"FullBox",value:function(t,r,n){for(var i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return e.box.apply(e,[t,new Uint8Array([r,n>>16&255,n>>8&255,255&n])].concat(o))}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===KT&&e.codecType===XT}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return fS(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var r=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],gS(t.kid),[0,0,0,0]));return e.box(e.types.pssh,r)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var r=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(VT(t.map((function(t){return e.trak(t)}))),[r]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(VT(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,t>>24&255,t>>16&255,t>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,i>>8&255,255&i,0,0]))}},{key:"edts",value:function(t){return e.box(e.types.edts,e.elst(t))}},{key:"elst",value:function(t){t.entries;var r=t.entriesData,n=t.version;return e.FullBox(e.types.elst,n,0,r)}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===KT?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){var r=[];return t&&t.ext&&t.ext.stss&&r.push(e.stss(t.ext.stss.entries)),e.box(e.types.stbl,e.stsd(t),e.STTS,r[0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var r;return r="audio"===t.type?t.useEME&&t.enca?e.enca(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):e.avc1hev1vvc1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),r)}},{key:"enca",value:function(t){var r=t.enca.channelCount,n=t.enca.sampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,n>>8&255,255&n,0,0]),o=e.esds(t.config),a=e.sinf(t.enca);return e.box(e.types.enca,i,o,a)}},{key:"encv",value:function(t){var r,n,i=t.sps.length>0?t.sps[0]:[],o=t.pps.length>0?t.pps[0]:[],a=t.width,s=t.height,u=t.sarRatio[0],c=t.sarRatio[1],l=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,a>>8&255,255&a,s>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),f=new Uint8Array((r=(n=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,255&i.length]).concat.apply(n,VT(i)).concat([1,o.length>>>8&255,255&o.length])).concat.apply(r,VT(o))),d=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),h=e.sinf(t.encv),p=new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c]);return e.box(e.types.encv,l,e.box(e.types.avcC,f),e.box(e.types.btrt,d),h,e.box(e.types.pasp,p))}},{key:"schi",value:function(t){var r=new Uint8Array([]),n=e.tenc(t);return e.box(e.types.schi,r,n)}},{key:"tenc",value:function(t){var r=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(gS(t.default_KID)));return e.box(e.types.tenc,r)}},{key:"sinf",value:function(t){var r=new Uint8Array([]),n=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),o=e.schi(t);return e.box(e.types.sinf,r,e.box(e.types.frma,n),e.box(e.types.schm,i),o)}},{key:"avc1hev1vvc1",value:function(t){var r,n;t.codecType===XT?(r=e.hvcC(t),n=e.types.hvc1):t.codecType===QT?(r=e.vvcC(t),n=e.types.bvc2):(r=e.avcC(t),n=e.types.avc1);var i=[new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),r];return t.codecType===XT?i.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&i.push(e.pasp(t.sarRatio)),e.box.apply(e,[n].concat(i))}},{key:"avcC",value:function(t){var r,n,i,o=[],a=[];return t.sps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,VT(e))})),t.pps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,VT(e))})),e.box(e.types.avcC,new Uint8Array((r=(n=[1,o[3],o[4],o[5],255,224|t.sps.length]).concat.apply(n,o).concat([t.pps.length])).concat.apply(r,a)))}},{key:"vvcC",value:function(t){var r=t.vvcC;return e.box(e.types.bv2C,new Uint8Array(r))}},{key:"hvcC",value:function(t){var r=t.hvcC;if(r instanceof ArrayBuffer||r instanceof Uint8Array)return r;var n,i=t.vps,o=t.sps,a=t.pps;if(r){var s=r.generalProfileCompatibilityFlags,u=r.generalConstraintIndicatorFlags,c=(i.length&&1)+(o.length&&1)+(a.length&&1);n=[1,r.generalProfileSpace<<6|r.generalTierFlag<<5|r.generalProfileIdc,s>>>24,s>>>16,s>>>8,s,u[0],u[1],u[2],u[3],u[4],u[5],r.generalLevelIdc,240,0,252,252|r.chromaFormatIdc,248|r.bitDepthLumaMinus8,248|r.bitDepthChromaMinus8,0,0,r.numTemporalLayers<<3|r.temporalIdNested<<2|3,c];var l=function(e){var t;n.push(e.length>>8,e.length),(t=n).push.apply(t,VT(e))};i.length&&(n.push(160,0,i.length),i.forEach(l)),o.length&&(n.push(161,0,o.length),o.forEach(l)),a.length&&(n.push(162,0,a.length),a.forEach(l))}else n=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(n))}},{key:"pasp",value:function(t){var r=zT(t,2),n=r[0],i=r[1];return e.box(e.types.pasp,new Uint8Array([n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var r=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+r,0,0,0,4,15+r,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([r]).concat(t).concat([6,1,2])))}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(VT(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(VT(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var r=e.tfhd(t.id),n=e.tfdt(t,t.baseMediaDecodeTime),i=0;if(t.isVideo&&t.videoSenc&&t.videoSenc.forEach((function(e){i+=8,e.subsamples&&e.subsamples.length&&(i+=2,i+=6*e.subsamples.length)})),t.videoSencLength=i,t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(t.isVideo){var o=e.saiz(t),a=e.saio(t),s=e.trun1(t),u=e.senc(t);return e.box(e.types.traf,r,n,o,a,s,u)}if(t.isAudioEncryption){var c=e.sbgp(),l=e.saiz(t),f=e.saio(t),d=e.senc(t),h=e.trun1(t);return e.box(e.types.traf,r,n,c,l,f,d,h)}var p=e.sbgp(),v=e.trun1(t);return e.box(e.types.traf,r,n,p,v)}if(t.isVideo){var y=e.trun1(t);return e.box(e.types.traf,r,n,y)}var g=e.sbgp(),m=e.saiz(t),b=e.saio(t),_=e.senc(t),w=e.trun1(t);return e.box(e.types.traf,r,n,g,m,b,_,w)}var k=e.sdtp(t);return e.box(e.types.traf,r,n,k,e.trun(t.samples,k.byteLength+76))}},{key:"sdtp",value:function(t){var r=new OS;return t.samples.forEach((function(e){r.write(new Uint8Array(t.isVideo?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),r.buffer)}},{key:"trun1",value:function(t){var r=new OS,n=OS.writeUint32(t.samples.length),i=null;if(t.isVideo){var o=t.videoSencLength;i=OS.writeUint32(16*t.samples.length+o+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=OS.writeUint32(16*t.samples.length+92))}else{var a=12*t.samples.length+124;t.isAudioEncryption&&(a=12*t.samples.length+8*t.audioSenc.length+177),i=OS.writeUint32(a)}return t.samples.forEach((function(e){r.write(OS.writeUint32(e.duration)),r.write(OS.writeUint32(e.size)),r.write(OS.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&r.write(OS.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),n,i,r.buffer)}},{key:"senc",value:function(t){var r=new OS,n=t.samples.length,i=t.isVideo?16:8,o=t.isVideo?2:0,a=[],s=0;return t.isVideo?(a=t.videoSenc,s=t.videoSencLength):a=t.audioSenc,s=s||i*n,r.write(OS.writeUint32(16+s),e.types.senc,this.extension(0,o)),r.write(OS.writeUint32(n)),a.forEach((function(e){for(var t=0;t<e.InitializationVector.length;t++)r.write(new Uint8Array([e.InitializationVector[t]]));e.subsamples&&e.subsamples.length&&(r.write(OS.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){r.write(OS.writeUint16(e.BytesOfClearData)),r.write(OS.writeUint32(e.BytesOfProtectedData))})))})),r.buffer}},{key:"saio",value:function(t){var r=12*t.samples.length+141;!t.isVideo&&t.isAudioEncryption&&(r=149);var n=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saio,n)}},{key:"saiz",value:function(t){var r=t.samples.length,n=new Uint8Array([0,0,0,0,16,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saiz,n)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t,r){var n=Math.floor(r/(AS+1)),i=Math.floor(r%(AS+1));return t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)?e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])):e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"trun",value:function(t,r){var n=t.length,i=12+16*n;r+=8+i;var o=new Uint8Array(i);o.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0);for(var a=0;a<n;a++){var s=t[a],u=s.duration,c=s.size,l=s.flag,f=void 0===l?{}:l,d=s.cts,h=void 0===d?0:d;o.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,c>>>24&255,c>>>16&255,c>>>8&255,255&c,f.isLeading<<2|(null===f.dependsOn||void 0===f.dependsOn?1:f.dependsOn),f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|(null===f.isNonSyncSample||void 0===f.isNonSyncSample?1:f.isNonSyncSample),61440&f.degradationPriority,15&f.degradationPriority,h>>>24&255,h>>>16&255,h>>>8&255,255&h],12+16*a)}return e.box(e.types.trun,o)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(VT(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===KT?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var r=t.ext,n=[e.stsd(t),e.stts(r.stts),e.stsc(r.stsc),e.stsz(r.stsz),e.stco(r.stco)];return r.stss.length&&n.push(e.stss(r.stss)),r.ctts.length&&n.push(e.ctts(r.ctts)),e.box.apply(e,[e.types.stbl].concat(n))}},{key:"stts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.stts,fS(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsc",value:function(t){var r=t.length,n=new Uint8Array(12*r),i=0;return t.forEach((function(e){var t=e.firstChunk,r=e.samplesPerChunk,o=e.sampleDescIndex;n.set([t>>24,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,o>>24,o>>16&255,o>>8&255,255&o],i),i+=12})),e.box(e.types.stsc,fS(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsz",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stsz,fS(new Uint8Array([0,0,0,0,0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stco",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stco,fS(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stss",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stss,fS(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"ctts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.ctts,fS(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var r=t.timescale,n=t.samples[0].duration,i=n*t.samples.length,o=t.samples[0].sampleOffset*n,a=8;t.samples.forEach((function(e){a+=e.size}));var s=0;if(t.isVideo){var u,c=0;t.videoSenc&&(u=t.videoSenc),t.isVideo&&u.forEach((function(e){c+=8,e.subsamples&&e.subsamples.length&&(c+=2,c+=6*e.subsamples.length)})),t.videoSencLength=c,s=a+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=a+16*t.samples.length+84)}else s=a+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=a+169+12*t.samples.length+8*t.audioSenc.length);var l=new Uint8Array([0,0,0,0,0,0,0,255&t.id,r>>24&255,r>>16&255,r>>8&255,255&r,o>>24&255,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,1,0,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,144,0,0,0]);return e.box(e.types.sidx,l)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();FT(RS,"types",["avc1","avcC","hvc1","hvcC","dinf","dref","edts","elst","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp","bvc2","bv2C"].reduce((function(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),FT(RS,"HDLR_TYPES",{video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])}),FT(RS,"FTYPAVC1",RS.box(RS.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),FT(RS,"FTYPHEV1",RS.box(RS.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),FT(RS,"DINF",RS.box(RS.types.dinf,RS.box(RS.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),FT(RS,"VMHD",RS.box(RS.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),FT(RS,"SMHD",RS.box(RS.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),FT(RS,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),FT(RS,"STTS",RS.box(RS.types.stts,RS.StblTable)),FT(RS,"STSC",RS.box(RS.types.stsc,RS.StblTable)),FT(RS,"STSZ",RS.box(RS.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),FT(RS,"STCO",RS.box(RS.types.stco,RS.StblTable));var LS=function(){function e(t,r){jT(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=r}return NT(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).debug.apply(t,[this._prefix].concat(n))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).log.apply(t,[this._prefix].concat(n))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(n))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).error.apply(t,[this._prefix].concat(n))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();FT(LS,"disabled",!0);var PS=function(){function e(t,r,n){jT(this,e),this.videoTrack=t,this.audioTrack=r;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new LS("FMP4Remuxer",!n||!n.openLog||!n.openLog)}return NT(e,[{key:"remux",value:function(){var e,t,r,n,i,o=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),f=[];return o&&(a&&a.initMerge?(c&&f.push(this.videoTrack),l&&f.push(this.audioTrack),r=RS.initSegment(f)):(c&&(e=RS.initSegment([this.videoTrack])),l&&(t=RS.initSegment([this.audioTrack])))),c&&s.hasSample()&&(n=this._remuxVideo()),l&&u.hasSample()&&(i=this._remuxAudio()),s.samples=[],u.samples=[],{initSegment:r,videoInitSegment:e,audioInitSegment:t,videoSegment:n,audioSegment:i}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,r=0;t.forEach((function(e){r+=e.units.reduce((function(e,t){return e+t.byteLength}),0),r+=4*e.units.length}));for(var n,i=new Uint8Array(r),o=new DataView(i.buffer),a=function(e,r){r=t[s];var a=0;r.units.forEach((function(t){o.setUint32(e,t.byteLength),e+=4,i.set(t,e),e+=t.byteLength,a+=4+t.byteLength})),r.size=a,c=e,n=r},s=0,u=t.length,c=0;s<u;s++)a(c,n);var l=RS.mdat(i);return fS(RS.moof([e]),l)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,t=new Uint8Array(e.samples.reduce((function(e,t){return e+t.size}),0));e.samples.reduce((function(e,r){return t.set(r.data,e),e+r.size}),0);var r=RS.mdat(t);return fS(RS.moof([e]),r)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}();class BS{static create(...e){return new this(...e)}mixIn(e){return Object.assign(this,e)}clone(){const e=new this.constructor;return Object.assign(e,this),e}}class IS extends BS{constructor(e=[],t=4*e.length){super();let r=e;if(r instanceof ArrayBuffer&&(r=new Uint8Array(r)),(r instanceof Int8Array||r instanceof Uint8ClampedArray||r instanceof Int16Array||r instanceof Uint16Array||r instanceof Int32Array||r instanceof Uint32Array||r instanceof Float32Array||r instanceof Float64Array)&&(r=new Uint8Array(r.buffer,r.byteOffset,r.byteLength)),r instanceof Uint8Array){const e=r.byteLength,t=[];for(let n=0;n<e;n+=1)t[n>>>2]|=r[n]<<24-n%4*8;this.words=t,this.sigBytes=e}else this.words=e,this.sigBytes=t}static random(e){const t=[],r=e=>{let t=e,r=987654321;const n=4294967295;return()=>{r=36969*(65535&r)+(r>>16)&n,t=18e3*(65535&t)+(t>>16)&n;let e=(r<<16)+t&n;return e/=4294967296,e+=.5,e*(Math.random()>.5?1:-1)}};for(let n,i=0;i<e;i+=4){const e=r(4294967296*(n||Math.random()));n=987654071*e(),t.push(4294967296*e()|0)}return new IS(t,e)}toString(e=CS){return e.stringify(this)}concat(e){const t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(let e=0;e<i;e+=1){const i=r[e>>>2]>>>24-e%4*8&255;t[n+e>>>2]|=i<<24-(n+e)%4*8}else for(let e=0;e<i;e+=4)t[n+e>>>2]=r[e>>>2];return this.sigBytes+=i,this}clamp(){const{words:e,sigBytes:t}=this;e[t>>>2]&=4294967295<<32-t%4*8,e.length=Math.ceil(t/4)}clone(){const e=super.clone.call(this);return e.words=this.words.slice(0),e}}const CS={stringify(e){const{words:t,sigBytes:r}=e,n=[];for(let e=0;e<r;e+=1){const r=t[e>>>2]>>>24-e%4*8&255;n.push((r>>>4).toString(16)),n.push((15&r).toString(16))}return n.join("")},parse(e){const t=e.length,r=[];for(let n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new IS(r,t/2)}},MS={stringify(e){const{words:t,sigBytes:r}=e,n=[];for(let e=0;e<r;e+=1){const r=t[e>>>2]>>>24-e%4*8&255;n.push(String.fromCharCode(r))}return n.join("")},parse(e){const t=e.length,r=[];for(let n=0;n<t;n+=1)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new IS(r,t)}},DS={stringify(e){try{return decodeURIComponent(escape(MS.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:e=>MS.parse(unescape(encodeURIComponent(e)))};class jS extends BS{constructor(){super(),this._minBufferSize=0}reset(){this._data=new IS,this._nDataBytes=0}_append(e){let t=e;"string"==typeof t&&(t=DS.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes}_process(e){let t;const{_data:r,blockSize:n}=this,i=r.words,o=r.sigBytes;let a=o/(4*n);a=e?Math.ceil(a):Math.max((0|a)-this._minBufferSize,0);const s=a*n,u=Math.min(4*s,o);if(s){for(let e=0;e<s;e+=n)this._doProcessBlock(i,e);t=i.splice(0,s),r.sigBytes-=u}return new IS(t,u)}clone(){const e=super.clone.call(this);return e._data=this._data.clone(),e}}class US extends jS{constructor(e){super(),this.blockSize=16,this.cfg=Object.assign(new BS,e),this.reset()}static _createHelper(e){return(t,r)=>new e(r).finalize(t)}static _createHmacHelper(e){return(t,r)=>new NS(e,r).finalize(t)}reset(){super.reset.call(this),this._doReset()}update(e){return this._append(e),this._process(),this}finalize(e){e&&this._append(e);return this._doFinalize()}}class NS extends BS{constructor(e,t){super();const r=new e;this._hasher=r;let n=t;"string"==typeof n&&(n=DS.parse(n));const i=r.blockSize,o=4*i;n.sigBytes>o&&(n=r.finalize(t)),n.clamp();const a=n.clone();this._oKey=a;const s=n.clone();this._iKey=s;const u=a.words,c=s.words;for(let e=0;e<i;e+=1)u[e]^=1549556828,c[e]^=909522486;a.sigBytes=o,s.sigBytes=o,this.reset()}reset(){const e=this._hasher;e.reset(),e.update(this._iKey)}update(e){return this._hasher.update(e),this}finalize(e){const t=this._hasher,r=t.finalize(e);t.reset();return t.finalize(this._oKey.clone().concat(r))}}const FS={stringify(e){const{words:t,sigBytes:r}=e,n=this._map;e.clamp();const i=[];for(let e=0;e<r;e+=3){const o=(t[e>>>2]>>>24-e%4*8&255)<<16|(t[e+1>>>2]>>>24-(e+1)%4*8&255)<<8|t[e+2>>>2]>>>24-(e+2)%4*8&255;for(let t=0;t<4&&e+.75*t<r;t+=1)i.push(n.charAt(o>>>6*(3-t)&63))}const o=n.charAt(64);if(o)for(;i.length%4;)i.push(o);return i.join("")},parse(e){let t=e.length;const r=this._map;let n=this._reverseMap;if(!n){this._reverseMap=[],n=this._reverseMap;for(let e=0;e<r.length;e+=1)n[r.charCodeAt(e)]=e}const i=r.charAt(64);if(i){const r=e.indexOf(i);-1!==r&&(t=r)}return((e,t,r)=>{const n=[];let i=0;for(let o=0;o<t;o+=1)if(o%4){const t=r[e.charCodeAt(o-1)]<<o%4*2|r[e.charCodeAt(o)]>>>6-o%4*2;n[i>>>2]|=t<<24-i%4*8,i+=1}return IS.create(n,i)})(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},zS=[];for(let e=0;e<64;e+=1)zS[e]=4294967296*Math.abs(Math.sin(e+1))|0;const VS=(e,t,r,n,i,o,a)=>{const s=e+(t&r|~t&n)+i+a;return(s<<o|s>>>32-o)+t},HS=(e,t,r,n,i,o,a)=>{const s=e+(t&n|r&~n)+i+a;return(s<<o|s>>>32-o)+t},GS=(e,t,r,n,i,o,a)=>{const s=e+(t^r^n)+i+a;return(s<<o|s>>>32-o)+t},qS=(e,t,r,n,i,o,a)=>{const s=e+(r^(t|~n))+i+a;return(s<<o|s>>>32-o)+t};class KS extends US{_doReset(){this._hash=new IS([1732584193,4023233417,2562383102,271733878])}_doProcessBlock(e,t){const r=e;for(let n=0;n<16;n+=1){const i=t+n,o=e[i];r[i]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}const n=this._hash.words,i=r[t+0],o=r[t+1],a=r[t+2],s=r[t+3],u=r[t+4],c=r[t+5],l=r[t+6],f=r[t+7],d=r[t+8],h=r[t+9],p=r[t+10],v=r[t+11],y=r[t+12],g=r[t+13],m=r[t+14],b=r[t+15];let _=n[0],w=n[1],k=n[2],x=n[3];_=VS(_,w,k,x,i,7,zS[0]),x=VS(x,_,w,k,o,12,zS[1]),k=VS(k,x,_,w,a,17,zS[2]),w=VS(w,k,x,_,s,22,zS[3]),_=VS(_,w,k,x,u,7,zS[4]),x=VS(x,_,w,k,c,12,zS[5]),k=VS(k,x,_,w,l,17,zS[6]),w=VS(w,k,x,_,f,22,zS[7]),_=VS(_,w,k,x,d,7,zS[8]),x=VS(x,_,w,k,h,12,zS[9]),k=VS(k,x,_,w,p,17,zS[10]),w=VS(w,k,x,_,v,22,zS[11]),_=VS(_,w,k,x,y,7,zS[12]),x=VS(x,_,w,k,g,12,zS[13]),k=VS(k,x,_,w,m,17,zS[14]),w=VS(w,k,x,_,b,22,zS[15]),_=HS(_,w,k,x,o,5,zS[16]),x=HS(x,_,w,k,l,9,zS[17]),k=HS(k,x,_,w,v,14,zS[18]),w=HS(w,k,x,_,i,20,zS[19]),_=HS(_,w,k,x,c,5,zS[20]),x=HS(x,_,w,k,p,9,zS[21]),k=HS(k,x,_,w,b,14,zS[22]),w=HS(w,k,x,_,u,20,zS[23]),_=HS(_,w,k,x,h,5,zS[24]),x=HS(x,_,w,k,m,9,zS[25]),k=HS(k,x,_,w,s,14,zS[26]),w=HS(w,k,x,_,d,20,zS[27]),_=HS(_,w,k,x,g,5,zS[28]),x=HS(x,_,w,k,a,9,zS[29]),k=HS(k,x,_,w,f,14,zS[30]),w=HS(w,k,x,_,y,20,zS[31]),_=GS(_,w,k,x,c,4,zS[32]),x=GS(x,_,w,k,d,11,zS[33]),k=GS(k,x,_,w,v,16,zS[34]),w=GS(w,k,x,_,m,23,zS[35]),_=GS(_,w,k,x,o,4,zS[36]),x=GS(x,_,w,k,u,11,zS[37]),k=GS(k,x,_,w,f,16,zS[38]),w=GS(w,k,x,_,p,23,zS[39]),_=GS(_,w,k,x,g,4,zS[40]),x=GS(x,_,w,k,i,11,zS[41]),k=GS(k,x,_,w,s,16,zS[42]),w=GS(w,k,x,_,l,23,zS[43]),_=GS(_,w,k,x,h,4,zS[44]),x=GS(x,_,w,k,y,11,zS[45]),k=GS(k,x,_,w,b,16,zS[46]),w=GS(w,k,x,_,a,23,zS[47]),_=qS(_,w,k,x,i,6,zS[48]),x=qS(x,_,w,k,f,10,zS[49]),k=qS(k,x,_,w,m,15,zS[50]),w=qS(w,k,x,_,c,21,zS[51]),_=qS(_,w,k,x,y,6,zS[52]),x=qS(x,_,w,k,s,10,zS[53]),k=qS(k,x,_,w,p,15,zS[54]),w=qS(w,k,x,_,o,21,zS[55]),_=qS(_,w,k,x,d,6,zS[56]),x=qS(x,_,w,k,b,10,zS[57]),k=qS(k,x,_,w,l,15,zS[58]),w=qS(w,k,x,_,g,21,zS[59]),_=qS(_,w,k,x,u,6,zS[60]),x=qS(x,_,w,k,v,10,zS[61]),k=qS(k,x,_,w,a,15,zS[62]),w=qS(w,k,x,_,h,21,zS[63]),n[0]=n[0]+_|0,n[1]=n[1]+w|0,n[2]=n[2]+k|0,n[3]=n[3]+x|0}_doFinalize(){const e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32;const i=Math.floor(r/4294967296),o=r;t[15+(n+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t[14+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),e.sigBytes=4*(t.length+1),this._process();const a=this._hash,s=a.words;for(let e=0;e<4;e+=1){const t=s[e];s[e]=16711935&(t<<8|t>>>24)|4278255360&(t<<24|t>>>8)}return a}clone(){const e=super.clone.call(this);return e._hash=this._hash.clone(),e}}class WS extends BS{constructor(e){super(),this.cfg=Object.assign(new BS,{keySize:4,hasher:KS,iterations:1},e)}compute(e,t){let r;const{cfg:n}=this,i=n.hasher.create(),o=IS.create(),a=o.words,{keySize:s,iterations:u}=n;for(;a.length<s;){r&&i.update(r),r=i.update(e).finalize(t),i.reset();for(let e=1;e<u;e+=1)r=i.finalize(r),i.reset();o.concat(r)}return o.sigBytes=4*s,o}}class YS extends jS{constructor(e,t,r){super(),this.cfg=Object.assign(new BS,r),this._xformMode=e,this._key=t,this.reset()}static createEncryptor(e,t){return this.create(this._ENC_XFORM_MODE,e,t)}static createDecryptor(e,t){return this.create(this._DEC_XFORM_MODE,e,t)}static _createHelper(e){const t=e=>"string"==typeof e?iE:rE;return{encrypt:(r,n,i)=>t(n).encrypt(e,r,n,i),decrypt:(r,n,i)=>t(n).decrypt(e,r,n,i)}}reset(){super.reset.call(this),this._doReset()}process(e){return this._append(e),this._process()}finalize(e){e&&this._append(e);return this._doFinalize()}}YS._ENC_XFORM_MODE=1,YS._DEC_XFORM_MODE=2,YS.keySize=4,YS.ivSize=4;class JS extends BS{constructor(e,t){super(),this._cipher=e,this._iv=t}static createEncryptor(e,t){return this.Encryptor.create(e,t)}static createDecryptor(e,t){return this.Decryptor.create(e,t)}}function XS(e,t,r){const n=e;let i;const o=this._iv;o?(i=o,this._iv=void 0):i=this._prevBlock;for(let e=0;e<r;e+=1)n[t+e]^=i[e]}class QS extends JS{}QS.Encryptor=class extends QS{processBlock(e,t){const r=this._cipher,{blockSize:n}=r;XS.call(this,e,t,n),r.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}},QS.Decryptor=class extends QS{processBlock(e,t){const r=this._cipher,{blockSize:n}=r,i=e.slice(t,t+n);r.decryptBlock(e,t),XS.call(this,e,t,n),this._prevBlock=i}};const ZS={pad(e,t){const r=4*t,n=r-e.sigBytes%r,i=n<<24|n<<16|n<<8|n,o=[];for(let e=0;e<n;e+=4)o.push(i);const a=IS.create(o,n);e.concat(a)},unpad(e){const t=e,r=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=r}};class $S extends YS{constructor(e,t,r){super(e,t,Object.assign({mode:QS,padding:ZS},r)),this.blockSize=4}reset(){let e;super.reset.call(this);const{cfg:t}=this,{iv:r,mode:n}=t;this._xformMode===this.constructor._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e}_doProcessBlock(e,t){this._mode.processBlock(e,t)}_doFinalize(){let e;const{padding:t}=this.cfg;return this._xformMode===this.constructor._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e}}class eE extends BS{constructor(e){super(),this.mixIn(e)}toString(e){return(e||this.formatter).stringify(this)}}const tE={stringify(e){let t;const{ciphertext:r,salt:n}=e;return t=n?IS.create([1398893684,1701076831]).concat(n).concat(r):r,t.toString(FS)},parse(e){let t;const r=FS.parse(e),n=r.words;return 1398893684===n[0]&&1701076831===n[1]&&(t=IS.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),eE.create({ciphertext:r,salt:t})}};class rE extends BS{static encrypt(e,t,r,n){const i=Object.assign(new BS,this.cfg,n),o=e.createEncryptor(r,i),a=o.finalize(t),s=o.cfg;return eE.create({ciphertext:a,key:r,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:o.blockSize,formatter:i.format})}static decrypt(e,t,r,n){let i=t;const o=Object.assign(new BS,this.cfg,n);i=this._parse(i,o.format);return e.createDecryptor(r,o).finalize(i.ciphertext)}static _parse(e,t){return"string"==typeof e?t.parse(e,this):e}}rE.cfg=Object.assign(new BS,{format:tE});const nE={execute(e,t,r,n){let i=n;i||(i=IS.random(8));const o=WS.create({keySize:t+r}).compute(e,i),a=IS.create(o.words.slice(t),4*r);return o.sigBytes=4*t,eE.create({key:o,iv:a,salt:i})}};class iE extends rE{static encrypt(e,t,r,n){const i=Object.assign(new BS,this.cfg,n),o=i.kdf.execute(r,e.keySize,e.ivSize);i.iv=o.iv;const a=rE.encrypt.call(this,e,t,o.key,i);return a.mixIn(o),a}static decrypt(e,t,r,n){let i=t;const o=Object.assign(new BS,this.cfg,n);i=this._parse(i,o.format);const a=o.kdf.execute(r,e.keySize,e.ivSize,i.salt);o.iv=a.iv;return rE.decrypt.call(this,e,i,a.key,o)}}iE.cfg=Object.assign(rE.cfg,{kdf:nE});const oE=[],aE=[],sE=[],uE=[],cE=[],lE=[],fE=[],dE=[],hE=[],pE=[],vE=[];for(let e=0;e<256;e+=1)vE[e]=e<128?e<<1:e<<1^283;let yE=0,gE=0;for(let e=0;e<256;e+=1){let e=gE^gE<<1^gE<<2^gE<<3^gE<<4;e=e>>>8^255&e^99,oE[yE]=e,aE[e]=yE;const t=vE[yE],r=vE[t],n=vE[r];let i=257*vE[e]^16843008*e;sE[yE]=i<<24|i>>>8,uE[yE]=i<<16|i>>>16,cE[yE]=i<<8|i>>>24,lE[yE]=i,i=16843009*n^65537*r^257*t^16843008*yE,fE[e]=i<<24|i>>>8,dE[e]=i<<16|i>>>16,hE[e]=i<<8|i>>>24,pE[e]=i,yE?(yE=t^vE[vE[vE[n^t]]],gE^=vE[vE[gE]]):(gE=1,yE=gE)}const mE=[0,1,2,4,8,16,32,64,128,27,54];class bE extends $S{_doReset(){let e;if(this._nRounds&&this._keyPriorReset===this._key)return;this._keyPriorReset=this._key;const t=this._keyPriorReset,r=t.words,n=t.sigBytes/4;this._nRounds=n+6;const i=4*(this._nRounds+1);this._keySchedule=[];const o=this._keySchedule;for(let t=0;t<i;t+=1)t<n?o[t]=r[t]:(e=o[t-1],t%n?n>6&&t%n==4&&(e=oE[e>>>24]<<24|oE[e>>>16&255]<<16|oE[e>>>8&255]<<8|oE[255&e]):(e=e<<8|e>>>24,e=oE[e>>>24]<<24|oE[e>>>16&255]<<16|oE[e>>>8&255]<<8|oE[255&e],e^=mE[t/n|0]<<24),o[t]=o[t-n]^e);this._invKeySchedule=[];const a=this._invKeySchedule;for(let t=0;t<i;t+=1){const r=i-t;e=t%4?o[r]:o[r-4],a[t]=t<4||r<=4?e:fE[oE[e>>>24]]^dE[oE[e>>>16&255]]^hE[oE[e>>>8&255]]^pE[oE[255&e]]}}encryptBlock(e,t){this._doCryptBlock(e,t,this._keySchedule,sE,uE,cE,lE,oE)}decryptBlock(e,t){const r=e;let n=r[t+1];r[t+1]=r[t+3],r[t+3]=n,this._doCryptBlock(r,t,this._invKeySchedule,fE,dE,hE,pE,aE),n=r[t+1],r[t+1]=r[t+3],r[t+3]=n}_doCryptBlock(e,t,r,n,i,o,a,s){const u=e,c=this._nRounds;let l=u[t]^r[0],f=u[t+1]^r[1],d=u[t+2]^r[2],h=u[t+3]^r[3],p=4;for(let e=1;e<c;e+=1){const e=n[l>>>24]^i[f>>>16&255]^o[d>>>8&255]^a[255&h]^r[p];p+=1;const t=n[f>>>24]^i[d>>>16&255]^o[h>>>8&255]^a[255&l]^r[p];p+=1;const s=n[d>>>24]^i[h>>>16&255]^o[l>>>8&255]^a[255&f]^r[p];p+=1;const u=n[h>>>24]^i[l>>>16&255]^o[f>>>8&255]^a[255&d]^r[p];p+=1,l=e,f=t,d=s,h=u}const v=(s[l>>>24]<<24|s[f>>>16&255]<<16|s[d>>>8&255]<<8|s[255&h])^r[p];p+=1;const y=(s[f>>>24]<<24|s[d>>>16&255]<<16|s[h>>>8&255]<<8|s[255&l])^r[p];p+=1;const g=(s[d>>>24]<<24|s[h>>>16&255]<<16|s[l>>>8&255]<<8|s[255&f])^r[p];p+=1;const m=(s[h>>>24]<<24|s[l>>>16&255]<<16|s[f>>>8&255]<<8|s[255&d])^r[p];p+=1,u[t]=v,u[t+1]=y,u[t+2]=g,u[t+3]=m}}bE.keySize=8;const _E=$S._createHelper(bE);class wE extends JS{}wE.Encryptor=class extends wE{processBlock(e,t){const r=e,n=this._cipher,{blockSize:i}=n,o=this._iv;let a=this._counter;o&&(this._counter=o.slice(0),a=this._counter,this._iv=void 0);const s=a.slice(0);n.encryptBlock(s,0),a[i-1]=a[i-1]+1|0;for(let e=0;e<i;e+=1)r[t+e]^=s[e]}},wE.Decryptor=wE.Encryptor;const kE={pad(){},unpad(){}};var xE={decryptWordArray:function(e,t,r){var n=CS.parse(t),i=CS.parse(yS(r)),o=IS.create(new Uint8Array(e)),a=_E.decrypt(eE.create({ciphertext:o}),n,{iv:i,mode:wE,padding:kE});return xE.wordArrayToUint8Array(a)},wordArrayToUint8Array:function(e){for(var t=e.sigBytes,r=e.words,n=new Uint8Array(t),i=0,o=0;i!==t;){var a=r[o++];if(n[i++]=(4278190080&a)>>>24,i===t)break;if(n[i++]=(16711680&a)>>>16,i===t)break;if(n[i++]=(65280&a)>>>8,i===t)break;n[i++]=255&a}return n},decoderAESCTRData:function(e,t,r){if(e.videoSenc){var n=e.kidValue,i=e.videoSenc;e.samples.forEach((function(t,o){var a=i[o],s=t.data,u=[],c=[],l=a.InitializationVector;if(a.subsamples&&a.subsamples.length)a.subsamples.forEach((function(e){var t=e.BytesOfClearData+e.BytesOfProtectedData,r=s.slice(0,t);u.push(r.slice(0,e.BytesOfClearData)),c.push(r.slice(e.BytesOfClearData)),s=s.slice(t)}));else{var f=t.size;u.push(s.slice(0,0)),c.push(s.slice(0,f)),s=s.slice(f)}var d=new OS;d.write.apply(d,c);var h=r?r(d.buffer,n,l):xE.decryptWordArray(d.buffer,n,l),p=new OS;u.forEach((function(e,t){var r=c[t].length,n=h.slice(0,r);p.write(e),p.write(n),h=h.slice(r)})),e.samples[o].data=p.buffer}))}if(t.audioSenc){var o=t.kidValue,a=t.audioSenc;t.samples.forEach((function(e,n){var i=a[n],s=r?r(e.data,o,i.InitializationVector):xE.decryptWordArray(e.data,o,i.InitializationVector);t.samples[n].data=s}))}}},TE=function(){function e(t,r,n,i){var o=this;jT(this,e),FT(this,"_videoSamples",[]),FT(this,"_audioSamples",[]),FT(this,"_lastRemainBuffer",[]),FT(this,"_lastRemainBufferStartPos",0),this.videoTrack=new tS,this.audioTrack=new rS,this.metadataTrack=n||new oS,this.log=new LS("MP4Demuxer",!i||!i.openLog||!i.openLog),t&&t.forEach((function(e){var t;(t=o._videoSamples).push.apply(t,VT(e.frames))})),r&&r.forEach((function(e){var t;(t=o._audioSamples).push.apply(t,VT(e.frames))}))}return NT(e,[{key:"parseSamples",value:function(e){if(!e)throw new Error("moov is required");if(this.videoTrack.codec||this.audioTrack.codec||(wS.moovToTrack(e,this.videoTrack,this.audioTrack),this.videoSenc=this.videoTrack.videoSenc,this.audioSenc=this.audioTrack.audioSenc),!this._audioSamples.length&&!this._videoSamples.length){var t=wS.moovToSamples(e);if(!t)throw new Error("cannot parse samples from moov box");this._videoSamples=t.videoSamples||[],this._audioSamples=t.audioSamples||[]}}},{key:"demux",value:function(e,t,r,n,i){this.parseSamples(i);var o,a,s,u=this.videoTrack,c=this.audioTrack;if(u.samples=[],c.samples=[],r){for(var l,f=0,d=r[0],h=r[1];d<=h;d++){if(!(o=this._videoSamples[d]))throw new Error("cannot found video frame #".concat(d));s=o.offset-t,a=e.subarray(s,s+o.size),(l=new nS(o.pts||o.dts,o.dts)).duration=o.duration,l.gopId=o.gopId,o.keyframe&&l.setToKeyframe();for(var p=0,v=a.length-1;p<v;)f=pS(a,p),p+=4,l.units.push(a.subarray(p,p+f)),p+=f;u.samples.push(l)}u.baseMediaDecodeTime=u.samples[0].dts}if(n){for(var y=n[0],g=n[1];y<=g;y++){if(!(o=this._audioSamples[y]))throw new Error("cannot found video frame #".concat(y));s=o.offset-t,a=e.subarray(s,s+o.size),c.samples.push(new iS(o.dts,a,o.duration))}c.baseMediaDecodeTime=c.samples[0].dts}return{videoTrack:u,audioTrack:c,metadataTrack:this.metadataTrack}}},{key:"demuxPart",value:function(e,t,r,n,i,o,a,s){if(this.parseSamples(i),this.videoTrack.useEME=o,this.audioTrack.useEME=o,this._lastRemainBuffer&&this._lastRemainBuffer.byteLength>0&&t>this._lastRemainBufferStartPos&&t<=this._lastRemainBufferStartPos+this._lastRemainBuffer.byteLength)for(var u=0;u<20;)try{var c=this._lastRemainBuffer.subarray(0,t-this._lastRemainBufferStartPos),l=new Uint8Array(e.byteLength+c.byteLength);l.set(c,0),l.set(new Uint8Array(e),c.byteLength),e=l,t-=c.byteLength,this._lastRemainBuffer=null,this._lastRemainBufferStartPos=0;break}catch(e){if(!(u<20))throw new Error("new Uint8Array error:,"+e.errorMessage);u++}var f,d,h,p=this.videoTrack,v=this.audioTrack;p.samples=[],v.samples=[],p.videoSenc=null,v.audioSenc=null;var y=0,g=0;if(this._videoSamples.length>0&&r.length>0){for(var m,b=e.byteLength+t,_=r[0];_<=r[1];_++){if(!(f=this._videoSamples[_]))throw new Error("cannot found video frame #".concat(_));f.offset>=t&&f.offset+f.size<=b&&(y=(h=f.offset-t)+f.size,d=e.subarray(h,y),(m=new nS(f.pts||f.dts,f.dts)).duration=f.duration,m.gopId=f.gopId,m.sampleOffset=f.index,f.keyframe&&m.setToKeyframe(),m.data=d,m.size=f.size,p.samples.push(m))}p.samples.length>0&&(p.gopId=p.samples[0].gopId,p.baseMediaDecodeTime=p.samples[0].dts,p.startPts=p.samples[0].pts/p.timescale,p.endPts=p.samples[p.samples.length-1].pts/p.timescale,this.videoSenc&&(p.videoSenc=this.videoSenc.slice(p.samples[0].sampleOffset,p.samples[0].sampleOffset+p.samples.length),p.kidValue=a))}if(this._audioSamples.length>0&&n.length>0){for(var w=n[0];w<=n[1];w++){if(!(f=this._audioSamples[w]))throw new Error("cannot found video frame #".concat(w));f.offset>=t&&f.offset+f.size<=e.byteLength+t&&(g=(h=f.offset-t)+f.size,d=e.subarray(h,g),v.samples.push(new iS(f.dts,d,f.duration,f.index)))}v.samples.length>0&&(v.gopId=v.samples[0].gopId||p.gopId,v.baseMediaDecodeTime=v.samples[0].dts,v.startPts=v.samples[0].pts/v.timescale,v.endPts=v.samples[v.samples.length-1].pts/v.timescale,this.audioSenc&&(v.audioSenc=this.audioSenc.slice(v.samples[0].sampleOffset,v.samples[0].sampleOffset+v.samples.length),v.kidValue=a))}this.decoderData(p,v,s);for(var k=0,x=0;x<p.samples.length;x++)for(var T=0,S=p.samples[x].data,E=S.length-1;T<E;)k=pS(S,T),T+=4,p.samples[x].units.push(S.subarray(T,T+k)),T+=k;return this._lastRemainBuffer=e.subarray(Math.max(y,g)),this._lastRemainBuffer.byteLength>0?this._lastRemainBufferStartPos=t+e.byteLength-this._lastRemainBuffer.byteLength:this._lastRemainBufferStartPos=0,{videoTrack:p,audioTrack:v,metadataTrack:this.metadataTrack}}},{key:"reset",value:function(){this._videoSamples=[],this._audioSamples=[],this._lastRemainBuffer=null,this._lastRemainBufferStartPos=0,this.videoTrack.reset(),this.audioTrack.reset(),this.metadataTrack.reset()}},{key:"decoderData",value:function(e,t,r){e.useEME||t.useEME||xE.decoderAESCTRData(e,t,r)}}],[{key:"probe",value:function(e){return wS.probe(e)}}]),e}(),SE="3.0.0-alpha.26";function EE(){EE=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var o=t&&t.prototype instanceof d?t:d,a=Object.create(o.prototype),s=new S(i||[]);return n(a,"_invoke",{value:w(e,r,s)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function d(){}function h(){}function p(){}var v={};u(v,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==t&&r.call(g,o)&&(v=g);var m=p.prototype=d.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,o,a,s){var u=l(e[n],e,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function w(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=k(a,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function k(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function E(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=p,n(m,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:h,configurable:!0}),h.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,a,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new _(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(m),u(m,s,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=E,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function OE(e){return(OE="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})(e)}function AE(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function RE(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){AE(o,n,i,a,s,"next",e)}function s(e){AE(o,n,i,a,s,"throw",e)}a(void 0)}))}}function LE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function PE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,FE(n.key),n)}}function BE(e,t,r){return t&&PE(e.prototype,t),r&&PE(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function IE(e,t,r){return(t=FE(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function CE(e){return(CE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ME(e,t){return(ME=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function DE(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function jE(e,t,r){return(jE=DE()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&ME(i,r.prototype),i}).apply(null,arguments)}function UE(e){var t="function"==typeof Map?new Map:void 0;return UE=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return jE(e,arguments,CE(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ME(n,e)},UE(e)}function NE(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function FE(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function zE(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.used=!1,r.resolve=function(){return r.used=!0,e.apply(void 0,arguments)},r.reject=function(){return r.used=!0,t.apply(void 0,arguments)},r}function VE(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}var HE,GE=function(){function e(){LE(this,e)}return BE(e,null,[{key:"start",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0):0}},{key:"end",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(e){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var r=[],n=0,i=e.length;n<i;n++){var o=r.length;if(o&&t){var a=r[o-1],s=a[1];if(e.start(n)-s<=t){var u=e.end(n);u>s&&(a[1]=u)}else r.push([e.start(n),e.end(n)])}else r.push([e.start(n),e.end(n)])}return r}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce((function(e,t){return e+(t[1]-t[0])}),0):0}},{key:"info",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var i=0,o=0,a=0,s=0,u=0,c=0,l=0,f=e.buffers(t,n),d=0,h=f.length;d<h;d++){var p=f[d];if(r+n>=p[0]&&r<=p[1])i=p[0],o=p[1],a=d;else{if(r+n<p[0]){s=p[0],u=p[1];break}r+n>p[1]&&(c=p[0],l=p[1])}}return{start:i,end:o,index:a,buffers:f,nextStart:s,nextEnd:u,prevStart:c,prevEnd:l,currentTime:r,behind:r-i,remaining:o?o-r:0,length:e.totalLength&&e.totalLength(f)}}}]),e}(),qE={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",NETWORK_FORBIDDEN:"network_forbidden",NETWORK_NOTFOUND:"network_notfound",NETWROK_RANGE_NOT_SATISFIABLE:"network_range_not_satisfiable",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",RUNTIME:"runtime",SUB_TYPES:{FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",OPTION:"OPTION",DASH:"DASH",LICENSE:"LICENSE",CUSTOM_LICENSE:"CUSTOM_LICENSE",MSE_HIJACK:"MSE_HIJACK",EME_HIJACK:"EME_HIJACK",SIDX:"SIDX",NO_CANPLAY_ERROR:"NO_CANPLAY_ERROR",BUFFERBREAK_ERROR:"BUFFERBREAK_ERROR",WAITING_TIMEOUT_ERROR:"WAITING_TIMEOUT_ERROR",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_CODEC_NOT_SUPPORTED:"MEDIA_ERR_CODEC_NOT_SUPPORTED",MEDIA_ERR_URL_EMPTY:"MEDIA_ERR_URL_EMPTY"}},KE=(IE(HE={},qE.MANIFEST,{HLS:1100,DASH:1200}),IE(HE,qE.NETWORK,2100),IE(HE,qE.NETWORK_TIMEOUT,2101),IE(HE,qE.NETWORK_FORBIDDEN,2103),IE(HE,qE.NETWORK_NOTFOUND,2104),IE(HE,qE.NETWROK_RANGE_NOT_SATISFIABLE,2116),IE(HE,qE.DEMUX,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),IE(HE,qE.REMUX,{FMP4:4100,MP4:4200}),IE(HE,qE.MEDIA,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,EME_HIJACK:5301}),IE(HE,qE.DRM,{LICENSE:7100,CUSTOM_LICENSE:7200}),IE(HE,qE.OTHER,8e3),IE(HE,qE.RUNTIME,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003}),HE),WE=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ME(e,t)}(i,e);var t,r,n=(t=i,r=DE(),function(){var e,n=CE(t);if(r){var i=CE(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return NE(this,e)});function i(e,t,r,o,a){var s;return LE(this,i),(s=n.call(this,a||(null==r?void 0:r.message))).errorType=e===qE.NETWORK_TIMEOUT?qE.NETWORK:e,s.originError=r,s.ext=o,s.errorCode=KE[e][t]||KE[e],s.errorMessage=s.message,s.errorCode||(s.errorType=qE.OTHER,s.errorCode=KE[s.errorType]),s}return BE(i,null,[{key:"create",value:function(e,t,r,n,o){return e instanceof i?e:(e instanceof Error&&(r=e,e=""),e||(e=qE.OTHER),new i(e,t,r,n,o))}},{key:"network",value:function(e){var t;return new i(null!=e&&e.isTimeout?qE.NETWORK_TIMEOUT:qE.NETWORK,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}]),i}(UE(Error)),YE="undefined"!=typeof window,JE={DEBUG:1,LOG:2,WARN:3,ERROR:4},XE=["Boolean","Number","String","Undefined","Null","Date","Object"],QE=function(){function e(t,r){LE(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),this.logCacheLevel=(null==r?void 0:r.logCacheLevel)||3,this.logMaxSize=(null==r?void 0:r.logMaxSize)||204800,this.logSize=0,this.logTextArray=[]}return BE(e,[{key:"debug",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[JE.DEBUG].concat(n)),e.disabled||(t=console).debug.apply(t,[this._prefix,ZE()].concat(n))}},{key:"log",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[JE.LOG].concat(n)),e.disabled||(t=console).log.apply(t,[this._prefix,ZE()].concat(n))}},{key:"warn",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[JE.WARN].concat(n)),e.disabled||(t=console).warn.apply(t,[this._prefix,ZE()].concat(n))}},{key:"error",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[JE.ERROR].concat(n)),e.disabled||(t=console).error.apply(t,[this._prefix,ZE()].concat(n))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var o=n.map((function(e){return eO(e)}));t=this._prefix+ZE()+JSON.stringify(o)}catch(e){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var a=this.logTextArray.shift();this.logSize-=a.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function ZE(){return(new Date).toLocaleString()}function $E(e){if("object"!==OE(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function eO(e,t,r){r||(r=1),t||(t=2);var n={};if(!e||"object"!==OE(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!XE.includes(i))return i;if(!(r>t)){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r===t?n[o]=$E(e[o]):"object"===OE(e[o])?n[o]=eO(e[o],t,r+1):n[o]=e[o]);return n}}IE(QE,"disabled",!0);var tO=function(){try{return YE?window.MediaSource:null}catch(e){}}(),rO="appendBuffer",nO="removeBuffer",iO="updateDuration",oO=function(){function e(t,r){var n=this;LE(this,e),IE(this,"media",null),IE(this,"mediaSource",null),IE(this,"_openPromise",zE()),IE(this,"_queue",Object.create(null)),IE(this,"_sourceBuffer",Object.create(null)),IE(this,"_mseFullFlag",{}),IE(this,"_st",0),IE(this,"_opst",0),IE(this,"_logger",null),IE(this,"_config",null),IE(this,"_url",null),IE(this,"_onSBUpdateEnd",(function(e){var t=n._queue[e];if(t){var r=t[0];if((null==r?void 0:r.opName)!==iO&&t.shift(),r){var i=VE()-n._opst;n._logger.debug("UpdateEnd",r.opName,i,r.context),r.promise.resolve({name:r.opName,context:r.context,costtime:i}),n._startQueue(e)}}})),IE(this,"_onSBUpdateError",(function(e,t){var r=n._queue[e];if(r){var i=r[0];i&&(n._logger.error("UpdateError",e,i.opName,i.context),i.promise.reject(new WE(qE.MEDIA,qE.SUB_TYPES.MSE_APPEND_BUFFER,t)))}})),this._config=Object.assign(e.getDefaultConfig(),r),t&&this.bindMedia(t),this._logger=new QE("MSE"),this._config.openLog&&QE.enable()}var t,r,n;return BE(e,[{key:"isOpened",get:function(){var e;return"open"===(null===(e=this.mediaSource)||void 0===e?void 0:e.readyState)}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"isFull",value:function(t){return t?this._mseFullFlag[t]:this._mseFullFlag[e.VIDEO]}},{key:"updateDuration",value:function(e){var t=this,r=this.mediaSource&&this.mediaSource.duration>e;if(this.mediaSource&&this.mediaSource.duration>e){var n=0;if(Object.keys(this._sourceBuffer).forEach((function(e){try{n=Math.max(t.bufferEnd(e)||0,n)}catch(e){}})),e<n)return Promise.resolve()}return this._enqueueBlockingOp((function(){t.isEnded?t._logger.debug("[debug mse] setDuration ended"):t.mediaSource&&(t.mediaSource.duration=e,t._logger.debug("[debug mse] setDuration"))}),iO,{isReduceDuration:r})}},{key:"open",value:function(){var e=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var t=this.mediaSource;t.addEventListener("sourceopen",(function r(){var n=VE()-e._st;e._logger.debug("MSE OPEN",n),t.removeEventListener("sourceopen",r),e._openPromise.resolve({costtime:n})})),this._openPromise=zE()}return this._openPromise}},{key:"bindMedia",value:(n=RE(EE().mark((function e(t){var r,n,i=this;return EE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mediaSource&&!this.media){e.next=3;break}return e.next=3,this.unbindMedia();case 3:if(t&&tO){e.next=5;break}throw new Error("Param media or MediaSource does not exist");case 5:return this.media=t,r=this.mediaSource=new tO,this._st=VE(),n=function e(){var n=VE()-i._st;i._logger.debug("MSE OPEN"),r.removeEventListener("sourceopen",e),URL.revokeObjectURL(t.src),i._openPromise.resolve({costtime:n})},r.addEventListener("sourceopen",n),this._url=URL.createObjectURL(r),t.src=this._url,e.abrupt("return",this._openPromise);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"unbindMedia",value:(r=RE(EE().mark((function e(){var t,r,n,i=this;return EE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),t=this.mediaSource){if(Object.keys(this._queue).forEach((function(e){var t=i._queue[e];t&&t.forEach((function(e){var t,r;return null===(t=e.promise)||void 0===t||null===(r=t.resolve)||void 0===r?void 0:r.call(t)}))})),r=!!this.media&&this.media.readyState>=1,n="open"===t.readyState,r&&n)try{t.endOfStream()}catch(e){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(i._sourceBuffer[e])}catch(e){}}))}if(this.media){this.media.removeAttribute("src");try{this.media.load()}catch(e){}this.media=null}this.mediaSource=null,this._openPromise=zE(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var r;try{r=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(e){throw new WE(qE.MEDIA,qE.SUB_TYPES.MSE_ADD_SB,e)}r.mimeType=t,r.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),r.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var r=this,n=this._sourceBuffer[e];return this.mediaSource&&n&&n.mimeType!==t?"function"!=typeof n.changeType?Promise.reject():this._enqueueOp(e,(function(){n.changeType(t),n.mimeType=t,r._onSBUpdateEnd(e)}),"changeType",{mimeType:t}):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,r){var n=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(function(){var i;n.mediaSource&&!n.media.error&&(n._logger.debug("MSE APPEND START",r),n._opst=VE(),null===(i=n._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),rO,r):Promise.resolve()}},{key:"remove",value:function(e,t,r,n){var i=this,o=!1;return this._mseFullFlag[e]&&(o=!0),this._enqueueOp(e,(function(){if(i.mediaSource&&!i.media.error){var o=i._sourceBuffer[e];t>=r||!o?i._onSBUpdateEnd(e):(i._opst=VE(),i._logger.debug("MSE REMOVE START",e,t,r,n),o.remove(t,r))}}),nO,n,o)}},{key:"clearBuffer",value:function(e,t){var r,n=this;return Object.keys(this._sourceBuffer).forEach((function(i){r=n._enqueueOp(i,(function(){if(n.mediaSource&&!n.media.error){var r=n._sourceBuffer[i];n._logger.debug("MSE clearBuffer START",i,e,t),r.remove(e,t)}}),nO)})),r||Promise.resolve()}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach((function(r){e=t._enqueueOp(r,(function(){if(t.mediaSource&&!t.media.error){var e=t._sourceBuffer[r];t._logger.debug("MSE clearAllBuffer START",r),e.remove(0,GE.end(GE.get(e)))}}))})),e}},{key:"clearOpQueues",value:function(e,t){var r;this._logger.debug("MSE clearOpQueue START");var n=this._queue[e];if(t&&n)this._queue[e]=[];else if(n&&n[e]&&!(n.length<5)){var i=[];n.forEach((function(e){e.context&&e.context.isinit&&i.push(e)})),this._queue[e]=n.slice(0,2),i.length>0&&(r=this._queue[e]).push.apply(r,i)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((function(){var r=t.mediaSource;r&&"open"===r.readyState&&(t._logger.debug("MSE endOfStream START"),e?r.endOfStream(e):r.endOfStream())}),"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var r=this.mediaSource;e<0||t<e||null==r||!r.setLiveSeekableRange||"open"!==r.readyState||r.setLiveSeekableRange(e,t)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return GE.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return GE.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return GE.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,r,n,i){var o=this;if(!this.mediaSource)return Promise.resolve();var a=this._queue[e]=this._queue[e]||[],s={exec:t,promise:zE(),opName:r,context:n};return i?(a.splice(0,0,s),this._mseFullFlag[e]=!1,this._startQueue(e)):a.push(s),this.isOpened||this.isEnded?1===a.length&&this._startQueue(e):this._openPromise.then((function(){1===a.length&&o._startQueue(e)})),s.promise}},{key:"_enqueueBlockingOp",value:(t=RE(EE().mark((function e(t,r,n){var i,o,a=this;return EE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:if((i=Object.keys(this._sourceBuffer)).length){e.next=5;break}return e.abrupt("return",t());case 5:return o=[],i.forEach((function(e){var t=a._queue[e],i=zE();o.push(i),t.push({exec:function(){i.resolve()},promise:i,opName:r,context:n}),1===t.length&&a._startQueue(e)})),e.abrupt("return",Promise.all(o).then((function(){try{return t()}finally{i.forEach((function(e){var t=a._queue[e],r=a._sourceBuffer[e];null==t||t.shift(),r&&r.updating||a._startQueue(e)}))}})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})},{key:"_startQueue",value:function(e){var t=this._queue[e];if(t){var r=t[0];if(r&&!this._mseFullFlag[e])try{r.exec()}catch(n){n&&n.message&&n.message.indexOf("SourceBuffer is full")>=0?(this._mseFullFlag[e]=!0,this._logger.error("[MSE error], context,",r.context," ,name,",r.opName,",err,SourceBuffer is full"),r.promise.reject(new WE(qE.MEDIA,qE.SUB_TYPES.MSE_FULL,n))):(this._logger.error(n),r.promise.reject(new WE(qE.MEDIA,qE.SUB_TYPES.MSE_OTHER,n)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,r){var n=this;return this._enqueueOp(e,(function(){t<0&&(t+=.001),n._sourceBuffer[e].timestampOffset=t,n._onSBUpdateEnd(e)}),"setTimeoffset",r)}},{key:"abort",value:function(e,t){var r=this;return this.isOpened?this._enqueueOp(e,(function(){r._sourceBuffer[e].abort(),r._onSBUpdateEnd(e)}),"abort",t):Promise.resolve()}}],[{key:"getDefaultConfig",value:function(){return{openLog:!1}}},{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(!tO)return!1;try{return tO.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}}}]),e}();IE(oO,"VIDEO","video"),IE(oO,"AUDIO","audio");var aO={416:KE[qE.NETWROK_RANGE_NOT_SATISFIABLE],403:KE[qE.NETWORK_FORBIDDEN],404:KE[qE.NETWORK_NOTFOUND],timeout:KE[qE.NETWORK_TIMEOUT],"4xx":"".concat(KE[qE.NETWORK],"4XX"),"5xx":"".concat(KE[qE.NETWORK],"5XX"),networkError:KE[qE.NETWORK],contentError:"".concat(KE[qE.NETWORK],"contentError"),mse:KE[qE.MEDIA][qE.SUB_TYPES.MSE_OTHER],mseOpen:KE[qE.MEDIA][qE.SUB_TYPES.MSE_ADD_SB],mseAppend:KE[qE.MEDIA][qE.SUB_TYPES.MSE_APPEND_BUFFER],mse_hijack:KE[qE.MEDIA][qE.SUB_TYPES.MSE_HIJACK],eme_hijack:KE[qE.MEDIA][qE.SUB_TYPES.EME_HIJACK],metaError:KE[qE.DEMUX][qE.SUB_TYPES.MP4],muxError:KE[qE.REMUX][qE.SUB_TYPES.FMP4],other:KE[qE.OTHER],waitTimeout:KE[qE.RUNTIME][qE.SUB_TYPES.BUFFERBREAK_ERROR],waitTimeoutWithHidden:KE[qE.RUNTIME][qE.SUB_TYPES.WAITING_TIMEOUT_ERROR],drm:KE[qE.DRM][qE.SUB_TYPES.LICENSE]},sO=qE;var uO=rc((function e(t,r,n){Zu(this,e);var i=0,o=0;n&&n.range&&n.range.length>1&&(i=n.range[0],o=n.range[1]);var a=function(e){return aO[e]||e}(r);return{errorCode:a,errorType:t,errorMessage:(null==n?void 0:n.httpText)||(null==n?void 0:n.message),url:null==n?void 0:n.url,httpCode:r,version:SE,rangeStart:i,rangeEnd:o,ext:n,mediaError:{code:a,message:(null==n?void 0:n.httpText)||(null==n?void 0:n.message)}}})),cO=rc((function e(t,r,n){return Zu(this,e),{errorCode:r,errorType:t,version:SE,errorMessage:n.msg,ext:n,mediaError:{code:r,message:n.msg}}})),lO={};lO.nowTime=function(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}},lO.concatData=function(e,t){var r=[],n=0;e&&r.push(e),t&&r.push(t),r.every((function(e){return e&&(n+=e.byteLength),!0}));var i=new Uint8Array(n),o=0;return r.every((function(e){return e&&(i.set(e,o),o+=e.byteLength),!0})),i};var fO="content-range";function dO(e){var t=fO;if(e&&e.get&&e.get(t)){var r=e.get(t).split("/");if(2===(null==r?void 0:r.length))return r[1]}return null}function hO(e){try{e&&e.src&&(e.removeAttribute("src"),e.load())}catch(e){}}function pO(e,t){var r=e.media||e.video;e._detachSourceEvents(r),t instanceof Array?e._attachSourceEvents(r,t):t?r.src=t:r.removeAttribute("src")}var vO=lO;function yO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function gO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?yO(Object(r),!0).forEach((function(t){TO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function mO(){mO=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var o=t&&t.prototype instanceof d?t:d,a=Object.create(o.prototype),s=new S(i||[]);return n(a,"_invoke",{value:w(e,r,s)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function d(){}function h(){}function p(){}var v={};u(v,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==t&&r.call(g,o)&&(v=g);var m=p.prototype=d.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,o,a,s){var u=l(e[n],e,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function w(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=k(a,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function k(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function E(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=p,n(m,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:h,configurable:!0}),h.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,a,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new _(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(m),u(m,s,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=E,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function bO(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function _O(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){bO(o,n,i,a,s,"next",e)}function s(e){bO(o,n,i,a,s,"throw",e)}a(void 0)}))}}function wO(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,CO(n.key),n)}}function xO(e,t,r){return t&&kO(e.prototype,t),r&&kO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function TO(e,t,r){return(t=CO(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SO(e){return(SO=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function EO(e,t){return(EO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function OO(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function AO(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function RO(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=SO(e);if(t){var i=SO(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return AO(e)}(this,r)}}function LO(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||BO(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function PO(e){return function(e){if(Array.isArray(e))return IO(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||BO(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function BO(e,t){if(e){if("string"==typeof e)return IO(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?IO(e,t):void 0}}function IO(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function CO(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function MO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function DO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?MO(Object(r),!0).forEach((function(t){GO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):MO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function jO(){jO=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var o=t&&t.prototype instanceof d?t:d,a=Object.create(o.prototype),s=new S(i||[]);return n(a,"_invoke",{value:w(e,r,s)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function d(){}function h(){}function p(){}var v={};u(v,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==t&&r.call(g,o)&&(v=g);var m=p.prototype=d.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,o,a,s){var u=l(e[n],e,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function w(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=k(a,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function k(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function E(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=p,n(m,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:h,configurable:!0}),h.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,a,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new _(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(m),u(m,s,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=E,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}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})(e)}function NO(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function FO(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){NO(o,n,i,a,s,"next",e)}function s(e){NO(o,n,i,a,s,"throw",e)}a(void 0)}))}}function zO(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,nA(n.key),n)}}function HO(e,t,r){return t&&VO(e.prototype,t),r&&VO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function GO(e,t,r){return(t=nA(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qO(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&WO(e,t)}function KO(e){return(KO=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function WO(e,t){return(WO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function YO(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function JO(e,t,r){return(JO=YO()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&WO(i,r.prototype),i}).apply(null,arguments)}function XO(e){var t="function"==typeof Map?new Map:void 0;return XO=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return JO(e,arguments,KO(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),WO(n,e)},XO(e)}function QO(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function ZO(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $O(e){var t=YO();return function(){var r,n=KO(e);if(t){var i=KO(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ZO(e)}(this,r)}}function eA(){return eA="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=KO(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},eA.apply(this,arguments)}function tA(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function rA(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return tA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?tA(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function nA(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var iA={DEBUG:1,LOG:2,WARN:3,ERROR:4},oA=["Boolean","Number","String","Undefined","Null","Date","Object"],aA=function(){function e(t,r){zO(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),this.logCacheLevel=(null==r?void 0:r.logCacheLevel)||3,this.logMaxSize=(null==r?void 0:r.logMaxSize)||204800,this.logSize=0,this.logTextArray=[]}return HO(e,[{key:"debug",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[iA.DEBUG].concat(n)),e.disabled||(t=console).debug.apply(t,[this._prefix,sA()].concat(n))}},{key:"log",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[iA.LOG].concat(n)),e.disabled||(t=console).log.apply(t,[this._prefix,sA()].concat(n))}},{key:"warn",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[iA.WARN].concat(n)),e.disabled||(t=console).warn.apply(t,[this._prefix,sA()].concat(n))}},{key:"error",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[iA.ERROR].concat(n)),e.disabled||(t=console).error.apply(t,[this._prefix,sA()].concat(n))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var o=n.map((function(e){return cA(e)}));t=this._prefix+sA()+JSON.stringify(o)}catch(e){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var a=this.logTextArray.shift();this.logSize-=a.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function sA(){return(new Date).toLocaleString()}function uA(e){if("object"!==UO(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function cA(e,t,r){r||(r=1),t||(t=2);var n={};if(!e||"object"!==UO(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!oA.includes(i))return i;if(!(r>t)){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r===t?n[o]=uA(e[o]):"object"===UO(e[o])?n[o]=cA(e[o],t,r+1):n[o]=e[o]);return n}}GO(aA,"disabled",!0);var lA="fetch",fA="xhr",dA="arraybuffer",hA="text",pA="json",vA=function(e){qO(r,e);var t=$O(r);function r(e,n,i,o){var a;return zO(this,r),GO(ZO(a=t.call(this,o)),"retryCount",0),GO(ZO(a),"isTimeout",!1),GO(ZO(a),"loaderType",lA),GO(ZO(a),"startTime",0),GO(ZO(a),"endTime",0),GO(ZO(a),"options",{}),a.url=e,a.request=n,a.response=i,a}return HO(r)}(XO(Error)),yA=Object.prototype.toString;function gA(e){if("[object Object]"!==yA.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function mA(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function bA(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function _A(e,t){if(e){if(!t)return e;var r,n=Object.keys(t).map((function(e){if(null!=(r=t[e]))return Array.isArray(r)?e+="[]":r=[r],r.map((function(t){var r;return r=t,"[object Date]"===yA.call(r)?t=t.toISOString():function(e){return null!==e&&"object"===UO(e)}(t)&&(t=JSON.stringify(t)),"".concat(bA(e),"=").concat(bA(t))})).join("&")})).filter(Boolean).join("&");if(n){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}}function wA(e,t,r,n,i,o,a,s,u,c,l){return i=null!=i?parseFloat(i):null,n=parseInt(n||"0",10),Number.isNaN(n)&&(n=0),{data:e,done:t,options:{range:u,vid:c,index:s,contentLength:n,age:i,startTime:o,firstByteTime:a,endTime:Date.now(),priOptions:l},response:r}}function kA(e,t){return Math.round(8*e*1e3/t/1024)}var xA="real_time_speed",TA=2097152,SA=function(e){qO(n,e);var t,r=$O(n);function n(){var e;return zO(this,n),GO(ZO(e=r.call(this)),"_abortController",null),GO(ZO(e),"_timeoutTimer",null),GO(ZO(e),"_reader",null),GO(ZO(e),"_response",null),GO(ZO(e),"_aborted",!1),GO(ZO(e),"_index",-1),GO(ZO(e),"_range",null),GO(ZO(e),"_receivedLength",0),GO(ZO(e),"_running",!1),GO(ZO(e),"_logger",null),GO(ZO(e),"_vid",""),GO(ZO(e),"_onProcessMinLen",0),GO(ZO(e),"_onCancel",null),GO(ZO(e),"_priOptions",null),e}return HO(n,[{key:"load",value:function(e){var t,r=this,n=e.url,i=e.vid,o=e.timeout,a=e.responseType,s=e.onProgress,u=e.index,c=e.onTimeout,l=e.onCancel,f=e.range,d=e.transformResponse,h=e.request,p=e.params,v=e.logger,y=e.method,g=e.headers,m=e.body,b=e.mode,_=e.credentials,w=e.cache,k=e.redirect,x=e.referrer,T=e.referrerPolicy,S=e.onProcessMinLen,E=e.priOptions;this._logger=v,this._aborted=!1,this._onProcessMinLen=S,this._onCancel=l,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=u,this._range=f||[0,0],this._vid=i||n,this._priOptions=E||{};var O={method:y,headers:g,body:m,mode:b,credentials:_,cache:w,redirect:k,referrer:x,referrerPolicy:T,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},A=!1;clearTimeout(this._timeoutTimer),n=_A(n,p);var R=mA(f);R&&(g=h?h.headers:O.headers=O.headers||(Headers?new Headers:{}),Headers&&g instanceof Headers?g.append("Range",R):g.Range=R),o&&(this._timeoutTimer=setTimeout((function(){if(A=!0,r.cancel(),c){var e=new vA(n,O,null,"timeout");e.isTimeout=!0,c(e,{index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions})}}),o));var L=Date.now();return this._logger.debug("[fetch load start], index,",u,",range,",f),new Promise((function(e,t){fetch(h||n,h?void 0:O).then(function(){var i=FO(jO().mark((function i(o){var c,l,h,p;return jO().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(r._timeoutTimer),r._response=o,!r._aborted&&r._running){i.next=4;break}return i.abrupt("return");case 4:if(d&&(o=d(o,n)||o),o.ok){i.next=7;break}throw new vA(n,O,o,"bad network response");case 7:if(c=Date.now(),a!==hA){i.next=15;break}return i.next=11,o.text();case 11:l=i.sent,r._running=!1,i.next=37;break;case 15:if(a!==pA){i.next=22;break}return i.next=18,o.json();case 18:l=i.sent,r._running=!1,i.next=37;break;case 22:if(!s){i.next=29;break}return r.resolve=e,r.reject=t,r._loadChunk(o,s,L,c),i.abrupt("return");case 29:return i.next=31,o.arrayBuffer();case 31:l=i.sent,l=new Uint8Array(l),r._running=!1,h=Date.now()-L,p=kA(l.byteLength,h),r.emit(xA,{speed:p,len:l.byteLength,time:h,vid:r._vid,index:r._index,range:r._range,priOptions:r._priOptions});case 37:r._logger.debug("[fetch load end], index,",u,",range,",f),e(wA(l,!0,o,o.headers.get("Content-Length"),o.headers.get("age"),L,c,u,f,r._vid,r._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){var i;clearTimeout(r._timeoutTimer),r._running=!1,r._aborted&&!A||((e=e instanceof vA?e:new vA(n,O,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=L,e.endTime=Date.now(),e.isTimeout=A,e.options={index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions},t(e))}))}))}},{key:"cancel",value:(t=FO(jO().mark((function e(){return jO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,r,n){var i=this;if(!e.body||!e.body.getReader){this._running=!1;var o=new vA(e.url,"",e,"onProgress of bad response.body.getReader");return o.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(o)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(TA),this._writeIdx=0);var a,s,u,c=this._reader=e.body.getReader(),l=function(){var o=FO(jO().mark((function o(){var f,d,h,p,v,y,g,m;return jO().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return s=Date.now(),o.prev=1,o.next=4,c.read();case 4:a=o.sent,u=Date.now(),o.next=13;break;case 8:return o.prev=8,o.t0=o.catch(1),u=Date.now(),i._aborted||(i._running=!1,o.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(o.t0)),o.abrupt("return");case 13:if(d=(null===(f=i._range)||void 0===f?void 0:f.length)>0?i._range[0]:0,h=d+i._receivedLength,!i._aborted){o.next=19;break}return i._running=!1,t(void 0,!1,{range:[h,h],vid:i._vid,index:i._index,startTime:s,endTime:u,st:r,firstByteTime:n,priOptions:i._priOptions},e),o.abrupt("return");case 19:p=a.value?a.value.byteLength:0,i._receivedLength+=p,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",h,", end,",d+i._receivedLength,", done,",a.done),i._onProcessMinLen>0?i._writeIdx+p>=i._onProcessMinLen||a.done?((v=new Uint8Array(i._writeIdx+p)).set(i._cache.slice(0,i._writeIdx),0),p>0&&v.set(a.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",a.done,",len,",v.byteLength,", writeIdx,",i._writeIdx)):p>0&&i._writeIdx+p<TA?(i._cache.set(a.value,i._writeIdx),i._writeIdx+=p,i._logger.debug("【fetchLoader,onProgress cache】,len,",p,", writeIdx,",i._writeIdx)):p>0&&(y=new Uint8Array(i._writeIdx+p+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+p+2048,", datalen,",p,", writeIdx,",i._writeIdx),y.set(i._cache.slice(0,i._writeIdx),0),p>0&&y.set(a.value,i._writeIdx),i._writeIdx+=p,delete i._cache,i._cache=y,i._logger.debug("【fetchLoader,onProgress extra end】,len,",p,", writeIdx,",i._writeIdx)):v=a.value,(v&&v.byteLength>0||a.done)&&t(v,a.done,{range:[i._range[0]+i._receivedLength-(v?v.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:s,endTime:u,st:r,firstByteTime:n,priOptions:i._priOptions},e),a.done?(g=Date.now()-r,m=kA(i._receivedLength,g),i.emit(xA,{speed:m,len:i._receivedLength,time:g,vid:i._vid,index:i._index,range:i._range,priOptions:i._priOptions}),i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",a.done),i.resolve(wA(a,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),r,n,i._index,i._range,i._vid,i._priOptions))):l();case 25:case"end":return o.stop()}}),o,null,[[1,8]])})));return function(){return o.apply(this,arguments)}}();l()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),n}(CT);var EA=function(e){qO(r,e);var t=$O(r);function r(){var e;return zO(this,r),GO(ZO(e=t.call(this)),"_xhr",null),GO(ZO(e),"_aborted",!1),GO(ZO(e),"_timeoutTimer",null),GO(ZO(e),"_range",null),GO(ZO(e),"_receivedLength",0),GO(ZO(e),"_url",null),GO(ZO(e),"_onProgress",null),GO(ZO(e),"_index",-1),GO(ZO(e),"_headers",null),GO(ZO(e),"_currentChunkSizeKB",384),GO(ZO(e),"_timeout",null),GO(ZO(e),"_xhr",null),GO(ZO(e),"_withCredentials",null),GO(ZO(e),"_startTime",-1),GO(ZO(e),"_loadCompleteResolve",null),GO(ZO(e),"_loadCompleteReject",null),GO(ZO(e),"_runing",!1),GO(ZO(e),"_logger",!1),GO(ZO(e),"_vid",""),GO(ZO(e),"_responseType",void 0),GO(ZO(e),"_credentials",void 0),GO(ZO(e),"_method",void 0),GO(ZO(e),"_transformResponse",void 0),GO(ZO(e),"_firstRtt",void 0),GO(ZO(e),"_onCancel",null),GO(ZO(e),"_priOptions",null),e}return HO(r,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=_A(e.url,e.params);var r=Date.now();return new Promise((function(e,r){t._loadCompleteResolve=e,t._loadCompleteReject=r,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof vA?e:new vA(t._url,t._request)).startTime=r,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===dA&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,r=this._range[0]+this._receivedLength,n=this._range[1];t<this._range[1]-r&&(n=r+t),e=[r,n],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var r=this._xhr=new XMLHttpRequest;r.open(this._method||"GET",this._url,!0),r.responseType=this._responseType,this._timeout&&(r.timeout=this._timeout),r.withCredentials=this._withCredentials,r.onload=this._onLoad.bind(this),r.onreadystatechange=this._onReadyStatechange.bind(this),r.onerror=function(e){var r,n,i;t._running=!1;var o=new vA(t._url,t._request,null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.response,"xhr.onerror.status:"+(null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},r.ontimeout=function(e){t.cancel();var r=new vA(t._url,t._request,{status:408},"timeout");t._onTimeout&&(r.isTimeout=!0,t._onTimeout(r,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),r.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(r)};var n=this._headers||{},i=mA(e);i&&(n.Range=i),n&&Object.keys(n).forEach((function(e){r.setRequestHeader(e,n[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),r.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t,r=e.target.status;if(r<200||r>299){var n=new vA(this._url,null,DO(DO({},e.target.response),{},{status:r}),"bad response,status:"+r);return n.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(n)}var i,o=null,a=!1,s=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===dA){var u,c=new Uint8Array(e.target.response);if(i=s+this._receivedLength,c&&c.byteLength>0){this._receivedLength+=c.byteLength;var l=Date.now()-this._startTime,f=kA(this._receivedLength,l);this.emit(xA,{speed:f,len:this._receivedLength,time:l,vid:this._vid,index:this._index,range:[i,s+this._receivedLength],priOptions:this._priOptions})}o=c,a=!((null===(u=this._range)||void 0===u?void 0:u.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",i,"end ",s+this._receivedLength,",dataLen,",c?c.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",a)}else a=!0,o=e.target.response;var d={ok:r>=200&&r<300,status:r,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(d=this._transformResponse(d,this._url)||d),this._onProgress&&this._onProgress(o,a,{index:this._index,vid:this._vid,range:[i,s+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},d),a?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(wA(this._onProgress?null:o,a,d,d.headers["content-length"],d.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,eA(KO(r.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,r={},n=rA(e.getAllResponseHeaders().trim().split("\r\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value.split(": ");r[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(e){n.e(e)}finally{n.f()}return r}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),r}(CT),OA=["retry","retryDelay","onRetryError","transformError"],AA=function(){function e(t,r){zO(this,e),this.promise=function(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.used=!1,r.resolve=function(){return r.used=!0,e.apply(void 0,arguments)},r.reject=function(){return r.used=!0,t.apply(void 0,arguments)},r}(),this.alive=!!r.onProgress,!r.logger&&(r.logger=new aA("Loader")),this._loaderType=t,this._loader=t===lA&&window.fetch?new SA:new EA,this._config=r,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=r.retryCheckFunc,this._logger=r.logger}var t;return HO(e,[{key:"exec",value:function(){var e=this,t=this._config,r=t.retry,n=t.retryDelay,i=t.onRetryError,o=t.transformError,a=QO(t,OA),s=function(){var t=FO(jO().mark((function t(){var u,c,l;return jO().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(a);case 3:u=t.sent,e.promise.resolve(u),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,o&&(c=o(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,{index:a.index,vid:a.vid,range:a.range,priOptions:a.priOptions}),e._retryCount++,l=!0,e._retryCheckFunc&&(l=e._retryCheckFunc(t.t0)),!(l&&e._retryCount<=r)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",a.range),e._retryTimer=setTimeout(s,n),t.abrupt("return");case 26:e.promise.reject(c);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return s(),this.promise}},{key:"cancel",value:(t=FO(jO().mark((function e(){return jO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e}();function RA(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if((t=t.filter(Boolean)).length<2)return t[0];var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}function LA(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var PA=function(e){qO(n,e);var t,r=$O(n);function n(e){var t;return zO(this,n),GO(ZO(t=r.call(this,e)),"type",lA),GO(ZO(t),"_queue",[]),GO(ZO(t),"_alive",[]),GO(ZO(t),"_currentTask",null),GO(ZO(t),"_finnalUrl",""),GO(ZO(t),"_config",void 0),t._config=function(e){return DO({loaderType:lA,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:hA,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e)}(e),t._config.loaderType!==fA&&SA.isSupported()||(t.type=fA),t.log=e.logger,t}return HO(n,[{key:"isFetch",value:function(){return this.type===lA}},{key:"load",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?r=e:r.url=e||r.url||this._config.url,(r=Object.assign({},this._config,r)).params&&(r.params=Object.assign({},r.params)),r.headers&&gA(r.headers)&&(r.headers=Object.assign({},r.headers)),r.body&&gA(r.body)&&(r.body=Object.assign({},r.body)),r.transformRequest&&(r=r.transformRequest(r)||r),r.logger=this.log;var n=new AA(this.type,r);return n.loader.on(xA,(function(e){t.emit(xA,e)})),this._queue.push(n),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),n.promise}},{key:"cancel",value:(t=FO(jO().mark((function e(){var t;return jO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,LA();case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,r;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(r=e._alive)||void 0===r?void 0:r.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return SA.isSupported()}}]),n}(CT);function BA(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function IA(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,DA(n.key),n)}}function CA(e,t,r){return t&&IA(e.prototype,t),r&&IA(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function MA(e,t,r){return(t=DA(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function DA(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var jA="hevc",UA="vvcC",NA="g7110a",FA="g7110m",zA="undefined"!=typeof window,VA=zA&&navigator.userAgent.toLocaleLowerCase();zA&&/^((?!chrome|android).)*safari/.test(VA);var HA=zA&&VA.includes("firefox"),GA=zA&&VA.includes("android"),qA=function(){function e(){BA(this,e)}return CA(e,null,[{key:"getRateIndexByRate",value:function(t){return e.FREQ.indexOf(t)}},{key:"parseADTS",value:function(t,r){for(var n=t.length,i=0;i+2<n&&(255!==t[i]||240!=(246&t[i+1]));)i++;if(!(i>=n)){var o=i,a=[],s=(60&t[i+2])>>>2,u=e.FREQ[s];if(!u)throw new Error("Invalid sampling index: ".concat(s));for(var c,l,f=1+((192&t[i+2])>>>6),d=(1&t[i+2])<<2|(192&t[i+3])>>>6,h=e._getConfig(s,d,f),p=h.config,v=h.codec,y=0,g=e.getFrameDuration(u);i+7<n;)if(255===t[i]&&240==(246&t[i+1])){if(n-i<(l=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5))break;c=2*(1&~t[i+1]),a.push({pts:r+y*g,data:t.subarray(i+7+c,i+l)}),y++,i+=l}else i++;return{skip:o,remaining:i>=n?void 0:t.subarray(i),frames:a,samplingFrequencyIndex:s,sampleRate:u,objectType:f,channelCount:d,codec:v,config:p,originCodec:"mp4a.40.".concat(f)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var r=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,o=e.FREQ[n];if(o){var a=e._getConfig(n,i,r);return{samplingFrequencyIndex:n,sampleRate:o,objectType:r,channelCount:i,config:a.config,codec:a.codec,originCodec:"mp4a.40.".concat(r)}}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,r){var n,i,o=[];return HA?e>=6?(n=5,i=e-3):(n=2,i=e):GA?(n=2,i=e):(n=2===r||5===r?r:5,i=e,e>=6?i=e-3:1===t&&(n=2,i=e)),o[0]=n<<3,o[0]|=(14&e)>>1,o[1]=(1&e)<<7,o[1]|=t<<3,5===n&&(o[1]|=(14&i)>>1,o[2]=(1&i)<<7,o[2]|=8,o[3]=0),{config:o,codec:"mp4a.40.".concat(n)}}},{key:"getSilentFrame",value:function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}]),e}();MA(qA,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var KA=Math.pow(2,32);function WA(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function YA(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function JA(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt32(t)}function XA(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return YA(e,t)*KA+YA(e,t+4)}function QA(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=new DataView(e.buffer,e.byteOffset,e.byteLength);return r.getUint32(t)<<32|r.getUint32(t+4)}var ZA=function(){function e(t){if(BA(this,e),MA(this,"_bytesAvailable",void 0),MA(this,"_bitsAvailable",0),MA(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return CA(e,[{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw new Error("No bytes available");var r=new Uint8Array(4);r.set(this._data.subarray(e,e+t)),this._word=new DataView(r.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"bitsPos",value:function(){return 8*this._bytesAvailable-this._bitsAvailable}},{key:"bitsLeft",value:function(){return 8*this._data.length-this.bitsPos()}},{key:"byteAligned",value:function(){return 0===this.bitsPos()||this.bitsPos()%8==0}},{key:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{e-=this._bitsAvailable;var t=Math.floor(e/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw new Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),r=this._word>>>32-t;return this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),(t=e-t)>0&&this._bitsAvailable?r<<t|this.readBits(t):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this._bitsAvailable;++e)if(this._word&2147483648>>>e)return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,r=8,n=0;n<e;n++)0!==r&&(r=(t+this.readEG()+256)%256),t=0===r?t:r}}]),e}(),$A=function(){function e(t){BA(this,e),this._buffer=t,this._offset=0,this._heldBits=0,this._numHeldBits=0}return CA(e,[{key:"readUint8",value:function(){return this._buffer[this._offset++]}},{key:"readUint16",value:function(){return this._buffer[this._offset++]<<8|this._buffer[this._offset++]}},{key:"readUint32",value:function(){return this._buffer[this._offset++]<<24|this._buffer[this._offset++]<<16|this._buffer[this._offset++]<<8|this._buffer[this._offset++]}},{key:"readUint8Array",value:function(e){var t=this._buffer.slice(this._offset,this._offset+e);return this._offset+=e,t}},{key:"streamRead1Bytes",value:function(){this._heldBits=this.readUint8(),this._numHeldBits=8}},{key:"streamRead2Bytes",value:function(){this._heldBits=this.readUint16(),this._numHeldBits=16}},{key:"extractBits",value:function(e){var t=this._heldBits>>this._numHeldBits-e&(1<<e)-1;return this._numHeldBits-=e,t}}]),e}(),eR=function(){function e(){BA(this,e)}return CA(e,null,[{key:"parseVVCDecoderConfigurationRecord",value:function(t){var r=new $A(t),n=r.readUint8();r.streamRead1Bytes(),r.extractBits(5);var i,o,a,s,u,c,l,f,d=r.extractBits(2)+1,h=r.extractBits(1),p={};h&&(r.streamRead2Bytes(),s=r.extractBits(2),u=r.extractBits(3),o=r.extractBits(3),a=r.extractBits(2),r.extractBits(6),p=e.parseVVCPTLRecord(r,o),i=r.readUint16(),c=r.readUint16(),l=r.readUint16(),f=r.readUint16());for(var v=r.readUint8(),y=[],g=[],m=[],b=null,_=0;_<v;_++){r.streamRead1Bytes(),r.extractBits(1),r.extractBits(2);var w=r.extractBits(5),k=1;13!==w&&12!==w&&(k=r.readUint16());for(var x=0;x<k;x++){var T=r.readUint16();switch(w){case 14:y.push(r.readUint8Array(T));break;case 15:var S=r.readUint8Array(T);b||(b=e.parseSPS(e.removeEPB(S))),g.push(S);break;case 16:m.push(r.readUint8Array(T))}}}return{data:t,configurationVersion:n,codec:"bvc2.1.6.L93.B0",nalUnitSize:d,ptlPresentFlag:h,olsIdx:i,numSublayers:o,constantFrameRate:a,chromaFormatIdc:s,bitDepthLumaMinus8:u,ptlRecord:p,width:c,height:l,sampleRate:f,numOfArrays:v,vps:y,sps:g,pps:m,spsParsed:b}}},{key:"parseVVCPTLRecord",value:function(e,t){e.streamRead2Bytes(),e.extractBits(2);var r=e.extractBits(6),n=e.extractBits(7),i=e.extractBits(1),o=e.readUint8();e.streamRead1Bytes();var a=e.extractBits(1),s=e.extractBits(1),u=new Uint8Array(r);if(r){for(var c=0;c<r-1;c++){var l=e.extractBits(6);e.streamRead1Bytes();var f=e.extractBits(2);u[c]=l<<2|f}u[r-1]=e.extractBits(6)}else e.extractBits(6);var d=[];if(t>1){e.streamRead1Bytes();for(var h=0,p=t-2;p>=0;--p){h|=e.extractBits(1)<<p}for(var v=t;v<=8&&t>1;++v)e.extractBits(1);for(var y=t-2;y>=0;--y)h&1<<y&&(d[y]=e.readUint8())}var g=e.readUint8(),m=[];if(g)for(var b=0;b<g;b++)m.push(e.readUint32());return{generalProfileIdc:n,generalTierFlag:i,generalLevelIdc:o,ptlFrameOnlyConstraintFlag:a,ptlMultilayerEnabledFlag:s,generalConstraintInfo:u,subLayerLevelIdc:d,generalSubProfileIdc:m,ptlNumSubProfiles:g,numBytesConstraintInfo:r}}},{key:"getAvccNals",value:function(e){for(var t=[];e.position<e.length-4;){var r=e.dataview.getInt32(e.dataview.position);if(!(e.length-e.position>=r))break;var n=e.buffer.slice(e.position,e.position+4);e.skip(4);var i=new Uint8Array(e.buffer.slice(e.position,e.position+r));e.skip(r),t.push({header:n,body:i})}return t}},{key:"analyseNal",value:function(e){var t=(248&e.body[1])>>3;switch(e.type=t,t){case 23:case 24:break;case 7:case 8:e.key=!0;break;case 14:e.vps=!0;break;case 15:e.sps=!0;break;case 16:e.pps=!0;break;case 17:e.aps=!0}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,r=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(!r.length)return e;var i=t-r.length,o=new Uint8Array(i),a=0;for(n=0;n<i;a++,n++)a===r[0]&&(a++,r.shift()),o[n]=e[a];return o}},{key:"parseVps",value:function(){}},{key:"parseSPS",value:function(t){var r=new ZA(t);r.readUByte(),r.readUByte(),r.skipBits(4);var n=r.readBits(4),i=r.readBits(3),o=r.readBits(2),a=420;o<=3&&(a=[0,420,422,444][o]),r.readBits(2),r.readBits(1);var s=e._parseProfileTierLevel(r,1,i);return r.readBits(1),r.readBits(1)&&r.readBits(1),{width:r.readUEG(),height:r.readUEG(),spsMaxSubLayerMinus1:i,spsVideoParameterSetId:n,chromaFormatIdc:o,chromaFormat:a,ptlInfo:s}}},{key:"_parseProfileTierLevel",value:function(t,r,n){var i,o=t.readBits(7),a=t.readBits(1),s=t.readBits(8),u=t.readBits(1),c=t.readBits(1);r&&(i=e._parseGeneralConstraintsInfo(t));for(var l=n-1,f=[],d=[],h=[],p=l;p>=0;--p)f[p]=t.readBits(1);for(;!t.byteAligned();)t.readBits(1);for(var v=l;v>=0;--v)f[v]&&(d[v]=t.readUByte());if(r)for(var y=t.readUByte(),g=0;g<y;g++)h[g]=t.readBits(32);return{generalProfileIdc:o,generalTierFlag:a,generalLevelIdc:s,ptlFrameOnlyConstraintFlag:u,ptlMultilayerEnabledFlag:c,ptlSublayerLevelPresentFlags:f,ptlSublayerLevelIdcs:d,ptlSubProfileIdcs:h,gciInfo:i}}},{key:"_parseGeneralConstraintsInfo",value:function(e){var t=e.readBits(1);if(t){e.skipBits(71);var r=e.readBits(8);r&&e.skipBits(r)}var n=8-e.bitsPos()%8;return e.skipBits(n),{gciPresentFlag:t}}}]),e}(),tR=function(){function e(){BA(this,e)}return CA(e,null,[{key:"findBox",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[];if(!t)return i;for(var o=0,a="",s=0;t.length>7;){if(o=YA(t),a=String.fromCharCode.apply(null,t.subarray(4,8)),s=8,1===o?(o=XA(t,8),s+=8):o||(o=t.length),!r[0]||a===r[0]){var u=t.subarray(0,o);if(!(r.length<2))return e.findBox(u.subarray(s),r.slice(1),n+s);i.push({start:n,size:o,headerSize:s,type:a,data:u})}n+=o,t=t.subarray(o)}return i}},{key:"tfhd",value:function(e){return oR(e,!0,(function(e,t){e.trackId=YA(t);var r=4,n=1&e.flags,i=2&e.flags,o=8&e.flags,a=16&e.flags,s=32&e.flags;n&&(r+=4,e.baseDataOffset=YA(t,r),r+=4),i&&(e.sampleDescriptionIndex=YA(t,r),r+=4),o&&(e.defaultSampleDuration=YA(t,r),r+=4),a&&(e.defaultSampleSize=YA(t,r),r+=4),s&&(e.defaultSampleFlags=YA(t,r))}))}},{key:"sidx",value:function(e){return oR(e,!0,(function(e,t){var r=0;e.reference_ID=YA(t,r),r+=4,e.timescale=YA(t,r),r+=4,0===e.version?(e.earliest_presentation_time=YA(t,r),r+=4,e.first_offset=YA(t,r),r+=4):(e.earliest_presentation_time=XA(t,r),r+=8,e.first_offset=XA(t,r),r+=8),r+=2,e.references=[];var n=WA(t,r);r+=2;for(var i=0;i<n;i++){var o={};e.references.push(o);var a=YA(t,r);r+=4,o.reference_type=a>>31&1,o.referenced_size=2147483647&a,o.subsegment_duration=YA(t,r),a=YA(t,r+=4),r+=4,o.starts_with_SAP=a>>31&1,o.SAP_type=a>>28&7,o.SAP_delta_time=268435455&a}}))}},{key:"moov",value:function(t){return oR(t,!1,(function(t,r,n){t.mvhd=e.mvhd(e.findBox(r,["mvhd"],n)[0]),t.trak=e.findBox(r,["trak"],n).map((function(t){return e.trak(t)})),t.pssh=e.pssh(e.findBox(r,["pssh"],n)[0])}))}},{key:"mvhd",value:function(e){return oR(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=YA(t,16),e.duration=XA(t,20),r+=28):(e.timescale=YA(t,8),e.duration=YA(t,12),r+=16),e.nextTrackId=YA(t,r+76)}))}},{key:"trak",value:function(t){return oR(t,!1,(function(t,r,n){t.tkhd=e.tkhd(e.findBox(r,["tkhd"],n)[0]),t.mdia=e.mdia(e.findBox(r,["mdia"],n)[0]),t.edts=e.edts(e.findBox(r,["edts"],n)[0])}))}},{key:"tkhd",value:function(e){return oR(e,!0,(function(e,t){var r=0;1===e.version?(e.trackId=YA(t,16),e.duration=XA(t,24),r+=32):(e.trackId=YA(t,8),e.duration=YA(t,16),r+=20),e.width=YA(t,r+52),e.height=YA(t,r+56)}))}},{key:"mdia",value:function(t){return oR(t,!1,(function(t,r,n){t.mdhd=e.mdhd(e.findBox(r,["mdhd"],n)[0]),t.hdlr=e.hdlr(e.findBox(r,["hdlr"],n)[0]),t.minf=e.minf(e.findBox(r,["minf"],n)[0])}))}},{key:"edts",value:function(t){return oR(t,!1,(function(t,r,n){t.elst=e.elst(e.findBox(r,["elst"],n)[0])}))}},{key:"elst",value:function(e){return oR(e,!0,(function(e,t,r){e.entries=[],e.entriesData=t;var n=0,i=YA(t,n);n+=4;for(var o=0;o<i;o++){var a={};e.entries.push(a),1===e.version?(a.segment_duration=XA(t,n),n+=8,a.media_time=QA(t,n),n+=8):(a.segment_duration=YA(t,n),n+=4,a.media_time=JA(t,n),n+=4),a.media_rate_integer=WA(t,n),n+=2,a.media_rate_fraction=WA(t,r),n+=2}}))}},{key:"mdhd",value:function(e){return oR(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=YA(t,16),e.duration=XA(t,20),r+=28):(e.timescale=YA(t,8),e.duration=YA(t,12),r+=16);var n=WA(t,r);e.language=String.fromCharCode(96+(n>>10&31),96+(n>>5&31),96+(31&n))}))}},{key:"hdlr",value:function(e){return oR(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return oR(t,!1,(function(t,r,n){t.vmhd=e.vmhd(e.findBox(r,["vmhd"],n)[0]),t.smhd=e.smhd(e.findBox(r,["smhd"],n)[0]),t.stbl=e.stbl(e.findBox(r,["stbl"],n)[0])}))}},{key:"vmhd",value:function(e){return oR(e,!0,(function(e,t){e.graphicsmode=WA(t),e.opcolor=[WA(t,2),WA(t,4),WA(t,6)]}))}},{key:"smhd",value:function(e){return oR(e,!0,(function(e,t){e.balance=WA(t)}))}},{key:"stbl",value:function(t){return oR(t,!1,(function(t,r,n){var i,o,a;t.stsd=e.stsd(e.findBox(r,["stsd"],n)[0]),t.stts=e.stts(e.findBox(r,["stts"],n)[0]),t.ctts=e.ctts(e.findBox(r,["ctts"],n)[0]),t.stsc=e.stsc(e.findBox(r,["stsc"],n)[0]),t.stsz=e.stsz(e.findBox(r,["stsz"],n)[0]),t.stco=e.stco(e.findBox(r,["stco"],n)[0]),t.stco||(t.co64=e.co64(e.findBox(r,["co64"],n)[0]),t.stco=t.co64);var s=null===(i=t.stsd.entries[0])||void 0===i||null===(o=i.sinf)||void 0===o||null===(a=o.schi)||void 0===a?void 0:a.tenc.default_IV_size;t.stss=e.stss(e.findBox(r,["stss"],n)[0]),t.senc=e.senc(e.findBox(r,["senc"],n)[0],s)}))}},{key:"senc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return oR(e,!0,(function(e,r){var n=0,i=YA(r,n);n+=4,e.samples=[];for(var o=0;o<i;o++){for(var a={InitializationVector:[]},s=0;s<t;s++)a.InitializationVector[s]=r[n+s];if(n+=t,2&e.flags){a.subsamples=[];var u=WA(r,n);n+=2;for(var c=0;c<u;c++){var l={};l.BytesOfClearData=WA(r,n),n+=2,l.BytesOfProtectedData=YA(r,n),n+=4,a.subsamples.push(l)}}e.samples.push(a)}}))}},{key:"pssh",value:function(e){return oR(e,!0,(function(e,t){for(var r=[],n=[],i=0,o=0;o<16;o++)n.push(aR(t[i+o]));if(i+=16,e.version>0){var a=YA(t,i);i+=4;for(var s=0;s<(""+a).length;s++)for(var u=0;u<16;u++){var c=t[i];i+=1,r.push(aR(c))}}var l=YA(t,i);e.data_size=l,i+=4,e.kid=r,e.system_id=n,e.buffer=t}))}},{key:"bvc2",value:function(t){return oR(t,!1,(function(t,r,n){var i=nR(t,r),o=r.subarray(i);n+=i,t.vvcC=e.bv2C(e.findBox(o,["bv2C"],n)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],n)[0])}))}},{key:"bv2C",value:function(e){return oR(e,!1,(function(e,t,r){var n=eR.parseVVCDecoderConfigurationRecord(t);for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}))}},{key:"stsd",value:function(t){return oR(t,!0,(function(t,r,n){t.entryCount=YA(r),t.entries=e.findBox(r.subarray(4),[],n+4).map((function(t){switch(t.type){case"avc1":case"avc2":case"avc3":case"avc4":return e.avc1(t);case"hvc1":case"hev1":return e.hvc1(t);case"bvc2":return e.bvc2(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return oR(t,!1,(function(t,r,n){t.channelCount=WA(r,16),t.samplesize=WA(r,18),t.sampleRate=YA(r,24)/65536,r=r.subarray(28),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.esds=e.esds(e.findBox(r,["esds"],n)[0])}));case"encv":return oR(t,!1,(function(t,r,n){t.width=WA(r,24),t.height=WA(r,26),t.horizresolution=YA(r,28),t.vertresolution=YA(r,32),r=r.subarray(78),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.avcC=e.avcC(e.findBox(r,["avcC"],n)[0]),t.hvcC=e.hvcC(e.findBox(r,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(r,["pasp"],n)[0])}))}})).filter(Boolean)}))}},{key:"tenc",value:function(e){return oR(e,!1,(function(e,t){var r=6;e.default_IsEncrypted=t[r],r+=1,e.default_IV_size=t[r],r+=1,e.default_KID=[];for(var n=0;n<16;n++)e.default_KID.push(aR(t[r])),r+=1}))}},{key:"schi",value:function(t){return oR(t,!1,(function(t,r,n){t.tenc=e.tenc(e.findBox(r,["tenc"],n)[0])}))}},{key:"sinf",value:function(t){return oR(t,!1,(function(t,r,n){t.schi=e.schi(e.findBox(r,["schi"],n)[0]),t.frma=e.frma(e.findBox(r,["frma"],n)[0])}))}},{key:"frma",value:function(e){return oR(e,!1,(function(e,t){e.data_format="";for(var r=0;r<4;r++)e.data_format+=String.fromCharCode(t[r])}))}},{key:"avc1",value:function(t){return oR(t,!1,(function(t,r,n){var i=nR(t,r),o=r.subarray(i);n+=i,t.avcC=e.avcC(e.findBox(o,["avcC"],n)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],n)[0])}))}},{key:"avcC",value:function(e){return oR(e,!1,(function(e,t){e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=function(e){for(var t,r="avc1.",n=0;n<3;n++)(t=e[n].toString(16)).length<2&&(t="0".concat(t)),r+=t;return r}([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];for(var r=6,n=0;n<e.spsLength;n++){var i=WA(t,r);r+=2,e.sps.push(t.subarray(r,r+i)),r+=i}e.ppsLength=t[r],r+=1,e.pps=[];for(var o=0;o<e.ppsLength;o++){var a=WA(t,r);r+=2,e.pps.push(t.subarray(r,r+=a)),r+=a}}))}},{key:"hvc1",value:function(t){return oR(t,!1,(function(t,r,n){var i=nR(t,r),o=r.subarray(i);n+=i,t.hvcC=e.hvcC(e.findBox(o,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],n)[0])}))}},{key:"hvcC",value:function(e){return oR(e,!1,(function(t,r){t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=r[0];var n=r[1];t.generalProfileSpace=n>>6,t.generalTierFlag=(32&n)>>5,t.generalProfileIdc=31&n,t.generalProfileCompatibility=YA(r,2),t.generalConstraintIndicatorFlags=r.subarray(6,12),t.generalLevelIdc=r[12],t.avgFrameRate=WA(r,19),t.numOfArrays=r[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,o=0,a=0,s=0,u=0;u<t.numOfArrays;u++){o=63&r[i],a=WA(r,i+1),i+=3;for(var c,l=[],f=0;f<a;f++)s=WA(r,i),i+=2,l.push(r.subarray(i,i+s)),i+=s;if(32===o)(c=t.vps).push.apply(c,l);else if(33===o){var d;(d=t.sps).push.apply(d,l)}else if(34===o){var h;(h=t.pps).push.apply(h,l)}}}))}},{key:"pasp",value:function(e){return oR(e,!1,(function(e,t){e.hSpacing=YA(t),e.vSpacing=YA(t,4)}))}},{key:"mp4a",value:function(t){return oR(t,!1,(function(t,r,n){var i=iR(t,r);t.esds=e.esds(e.findBox(r.subarray(i),["esds"],n+i)[0])}))}},{key:"esds",value:function(e){return oR(e,!0,(function(e,t){e.codec="mp4a.";for(var r=0,n=0,i=0,o=0;t.length;){for(o=t[r=0],n=t[r+1],r+=2;128&n;)i=(127&n)<<7,n=t[r],r+=1;if(i+=127&n,3===o)t=t.subarray(r+3);else{if(4!==o){if(5===o){var a=e.config=t.subarray(r,r+i),s=(248&a[0])>>3;return 31===s&&a.length>=2&&(s=32+((7&a[0])<<3)+((224&a[1])>>5)),e.objectType=s,e.codec+=s.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[r].toString(16)+".").padStart(3,"0"),t=t.subarray(r+13)}}}))}},{key:"alaw",value:function(e){return oR(e,!1,(function(e,t){iR(e,t)}))}},{key:"stts",value:function(e){return oR(e,!0,(function(e,t){for(var r=YA(t),n=[],i=4,o=0;o<r;o++)n.push({count:YA(t,i),delta:YA(t,i+4)}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"ctts",value:function(e){return oR(e,!0,(function(e,t){var r=YA(t),n=[],i=4;if(1===e.version)for(var o=0;o<r;o++)n.push({count:YA(t,i),offset:YA(t,i+4)}),i+=8;else for(var a=0;a<r;a++)n.push({count:YA(t,i),offset:-(1+~YA(t,i+4))}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stsc",value:function(e){return oR(e,!0,(function(e,t){for(var r=YA(t),n=[],i=4,o=0;o<r;o++)n.push({firstChunk:YA(t,i),samplesPerChunk:YA(t,i+4),sampleDescriptionIndex:YA(t,i+8)}),i+=12;e.entryCount=r,e.entries=n}))}},{key:"stsz",value:function(e){return oR(e,!0,(function(e,t){var r=YA(t),n=YA(t,4),i=[];if(!r)for(var o=8,a=0;a<n;a++)i.push(YA(t,o)),o+=4;e.sampleSize=r,e.sampleCount=n,e.entrySizes=i}))}},{key:"stco",value:function(e){return oR(e,!0,(function(e,t){for(var r=YA(t),n=[],i=4,o=0;o<r;o++)n.push(YA(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"co64",value:function(e){return oR(e,!0,(function(e,t){for(var r=YA(t),n=[],i=4,o=0;o<r;o++)n.push(XA(t,i)),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stss",value:function(e){return oR(e,!0,(function(e,t){for(var r=YA(t),n=[],i=4,o=0;o<r;o++)n.push(YA(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"moof",value:function(t){return oR(t,!1,(function(t,r,n){t.mfhd=e.mfhd(e.findBox(r,["mfhd"],n)[0]),t.traf=e.findBox(r,["traf"],n).map((function(t){return e.traf(t)}))}))}},{key:"mfhd",value:function(e){return oR(e,!0,(function(e,t){e.sequenceNumber=YA(t)}))}},{key:"traf",value:function(t){return oR(t,!1,(function(t,r,n){t.tfhd=e.tfhd(e.findBox(r,["tfhd"],n)[0]),t.tfdt=e.tfdt(e.findBox(r,["tfdt"],n)[0]),t.trun=e.trun(e.findBox(r,["trun"],n)[0])}))}},{key:"trun",value:function(e){return oR(e,!0,(function(e,t){var r=e.version,n=e.flags,i=t.length,o=e.sampleCount=YA(t),a=4;if(i>a&&1&n&&(e.dataOffset=-(1+~YA(t,a)),a+=4),i>a&&4&n&&(e.firstSampleFlags=YA(t,a),a+=4),e.samples=[],i>a)for(var s,u=0;u<o;u++)s={},256&n&&(s.duration=YA(t,a),a+=4),512&n&&(s.size=YA(t,a),a+=4),1024&n&&(s.flags=YA(t,a),a+=4),2048&n&&(s.cts=r?-(1+~YA(t,a+4)):YA(t,a),a+=4),e.samples.push(s)}))}},{key:"tfdt",value:function(e){return oR(e,!0,(function(e,t){1===e.version?e.baseMediaDecodeTime=XA(t):e.baseMediaDecodeTime=YA(t)}))}},{key:"probe",value:function(t){return!!e.findBox(t,["ftyp"])}},{key:"parseSampleFlags",value:function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}},{key:"moovToTrack",value:function(e,t,r){var n,i,o=e.trak;if(o&&o.length){var a=o.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),s=o.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(a&&t){var u,c,l,f,d,h,p,v,y=t,g=null===(u=a.tkhd)||void 0===u?void 0:u.trackId;null!=g&&(y.id=a.tkhd.trackId),y.tkhdDuration=a.tkhd.duration,y.mvhdDurtion=e.mvhd.duration,y.mvhdTimecale=e.mvhd.timescale,y.timescale=y.formatTimescale=a.mdia.mdhd.timescale,y.duration=a.mdia.mdhd.duration||y.mvhdDurtion/y.mvhdTimecale*y.timescale,null!==(c=a.edts)&&void 0!==c&&c.elst&&(y.editList=a.edts.elst,y.editListApplied=a.editListApplied);var m,b,_,w,k,x,T,S,E=a.mdia.minf.stbl.stsd.entries[0];if(y.width=E.width,y.height=E.height,E.pasp&&(y.sarRatio=[E.pasp.hSpacing,E.pasp.vSpacing]),E.hvcC)y.codecType=jA,y.codec=E.hvcC.codec,y.vps=E.hvcC.vps,y.sps=E.hvcC.sps,y.pps=E.hvcC.pps,y.hvcC=E.hvcC.data;else if(E.avcC)y.codec=E.avcC.codec,y.sps=E.avcC.sps,y.pps=E.avcC.pps;else{if(!E.vvcC)throw new Error("unknown video stsd entry");y.codecType=UA,y.codec=E.vvcC.codec,y.sps=E.vvcC.sps,y.pps=E.vvcC.pps,y.vps=E.vvcC.vps,y.vvcC=E.vvcC.data}if(y.present=!0,y.ext={},y.ext.stss=null===(l=a.mdia)||void 0===l||null===(f=l.minf)||void 0===f||null===(d=f.stbl)||void 0===d?void 0:d.stss,y.ext.ctts=null===(h=a.mdia)||void 0===h||null===(p=h.minf)||void 0===p||null===(v=p.stbl)||void 0===v?void 0:v.ctts,E&&"encv"===E.type)y.isVideoEncryption=!0,E.default_KID=null===(m=E.sinf)||void 0===m||null===(b=m.schi)||void 0===b?void 0:b.tenc.default_KID,E.default_IsEncrypted=null===(_=E.sinf)||void 0===_||null===(w=_.schi)||void 0===w?void 0:w.tenc.default_IsEncrypted,E.default_IV_size=null===(k=E.sinf)||void 0===k||null===(x=k.schi)||void 0===x?void 0:x.tenc.default_IV_size,y.videoSenc=a.mdia.minf.stbl.senc&&a.mdia.minf.stbl.senc.samples,E.data_format=null===(T=E.sinf)||void 0===T||null===(S=T.frma)||void 0===S?void 0:S.data_format,y.useEME=e.useEME,y.kidValue=e.kidValue,y.pssh=e.pssh,y.encv=E}if(s&&r){var O,A,R,L,P,B,I,C,M,D,j=r,U=null===(O=s.tkhd)||void 0===O?void 0:O.trackId;null!=U&&(j.id=s.tkhd.trackId),j.tkhdDuration=s.tkhd.duration,j.mvhdDurtion=e.mvhd.duration,j.mvhdTimecale=e.mvhd.timescale,j.timescale=j.formatTimescale=s.mdia.mdhd.timescale,j.duration=s.mdia.mdhd.duration||j.mvhdDurtion/j.mvhdTimecale*j.timescale,null!==(A=s.edts)&&void 0!==A&&A.elst&&(j.editList=s.edts.elst,j.editListApplied=s.editListApplied);var N,F,z,V,H,G,q,K,W=s.mdia.minf.stbl.stsd.entries[0];switch(j.sampleSize=W.sampleSize,j.sampleRate=W.sampleRate,j.channelCount=W.channelCount,j.present=!0,W.type){case"alaw":j.codecType=j.codec=NA,j.sampleRate=8e3;break;case"ulaw":j.codecType=j.codec=FA,j.sampleRate=8e3;break;default:j.sampleDuration=qA.getFrameDuration(j.sampleRate,j.timescale),j.sampleRateIndex=qA.getRateIndexByRate(j.sampleRate),j.objectType=(null===(n=W.esds)||void 0===n?void 0:n.objectType)||2,W.esds&&(j.config=Array.from(W.esds.config)),j.codec=(null===(i=W.esds)||void 0===i?void 0:i.codec)||"mp4a.40.2"}if(j.sampleDuration=qA.getFrameDuration(j.sampleRate,j.timescale),j.objectType=(null===(R=W.esds)||void 0===R?void 0:R.objectType)||2,W.esds&&(W.esds.config?j.config=Array.from(W.esds.config):console.warn("esds config is null")),j.codec=(null===(L=W.esds)||void 0===L?void 0:L.codec)||"mp4a.40.2",j.sampleRateIndex=qA.getRateIndexByRate(j.sampleRate),j.ext={},j.ext.stss=null===(P=s.mdia)||void 0===P||null===(B=P.minf)||void 0===B||null===(I=B.stbl)||void 0===I?void 0:I.stss,j.ext.ctts=null===(C=s.mdia)||void 0===C||null===(M=C.minf)||void 0===M||null===(D=M.stbl)||void 0===D?void 0:D.ctts,j.present=!0,W&&"enca"===W.type)j.isAudioEncryption=!0,W.data_format=null===(N=W.sinf)||void 0===N||null===(F=N.frma)||void 0===F?void 0:F.data_format,W.default_KID=null===(z=W.sinf)||void 0===z||null===(V=z.schi)||void 0===V?void 0:V.tenc.default_KID,W.default_IsEncrypted=null===(H=W.sinf)||void 0===H||null===(G=H.schi)||void 0===G?void 0:G.tenc.default_IsEncrypted,W.default_IV_size=null===(q=W.sinf)||void 0===q||null===(K=q.schi)||void 0===K?void 0:K.tenc.default_IV_size,j.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,j.useEME=e.useEME,j.kidValue=e.kidValue,j.enca=W}if(r&&(r.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!r&&r.isAudioEncryption),null!=t&&t.encv||null!=r&&r.enca){var Y,J,X=null==t||null===(Y=t.encv)||void 0===Y?void 0:Y.default_KID,Q=null==r||null===(J=r.enca)||void 0===J?void 0:J.default_KID,Z=X||Q?(X||Q).join(""):null;t&&(t.kid=Z),r&&(r.kid=Z)}return t&&(t.flags=3841),r&&(r.flags=1793),{videoTrack:t,audioTrack:r}}}},{key:"evaluateDefaultDuration",value:function(e,t,r){var n,i=null==t||null===(n=t.samples)||void 0===n?void 0:n.length;return i?1024*i/t.timescale*e.timescale/r:1024}},{key:"moofToSamples",value:function(t,r,n){var i={};return t.mfhd&&(r&&(r.sequenceNumber=t.mfhd.sequenceNumber),n&&(n.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach((function(t){var o=t.tfhd,a=t.tfdt,s=t.trun;if(o&&s){a&&(r&&r.id===o.trackId&&(r.baseMediaDecodeTime=a.baseMediaDecodeTime),n&&n.id===o.trackId&&(n.baseMediaDecodeTime=a.baseMediaDecodeTime));var u=o.defaultSampleSize||0,c=o.defaultSampleDuration||e.evaluateDefaultDuration(r,n,s.samples.length||s.sampleCount),l=s.dataOffset||0,f=0,d=-1;if(!s.samples.length&&s.sampleCount){i[o.trackId]=[];for(var h=0;h<s.sampleCount;h++)i[o.trackId].push({offset:l,dts:f,duration:c,size:u}),f+=c,l+=u}else i[o.trackId]=s.samples.map((function(e,t){return(e={offset:l,dts:f,pts:f+(e.cts||0),duration:e.duration||c,size:e.size||u,gopId:d,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(d++,e.gopId=d),f+=e.duration,l+=e.size,e}))}})),i}},{key:"moovToSamples",value:function(e){var t=e.trak;if(t&&t.length){var r=t.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),n=t.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(r||n){var i,o;if(r){var a,s,u=null===(a=r.mdia)||void 0===a||null===(s=a.minf)||void 0===s?void 0:s.stbl;if(!u)return;var c=u.stts,l=u.stsc,f=u.stsz,d=u.stco,h=u.stss,p=u.ctts;if(!(c&&l&&f&&d&&h))return;i=rR(c,l,f,d,p,h)}if(n){var v,y,g,m=null===(v=n.mdia)||void 0===v||null===(y=v.minf)||void 0===y?void 0:y.stbl;if(!m)return;var b=null===(g=n.mdia.mdhd)||void 0===g?void 0:g.timescale,_=m.stts,w=m.stsc,k=m.stsz,x=m.stco;if(!(b&&_&&w&&k&&x))return;o=rR(_,w,k,x)}return{videoSamples:i,audioSamples:o}}}}}]),e}();function rR(e,t,r,n,i,o){var a,s,u,c=[],l=null==i?void 0:i.entries,f=t.entries,d=n.entries,h=r.entrySizes,p=null==o?void 0:o.entries;p&&(a={},p.forEach((function(e){a[e-1]=!0}))),l&&(s=[],l.forEach((function(e){for(var t=e.count,r=e.offset,n=0;n<t;n++)s.push(r)})));var v=-1,y=0,g=0,m=0,b=0,_=0,w=f[0].samplesPerChunk,k=f[1]?f[1].firstChunk-1:1/0;return e.entries.forEach((function(e){for(var t=e.count,n=e.delta,i=0;i<t;i++)u={dts:y,duration:n,size:h[g]||r.sampleSize,offset:d[m]+_,index:g},p&&(u.keyframe=a[g],u.keyframe&&v++,u.gopId=v),s&&g<s.length&&(u.pts=u.dts+s[g]),c.push(u),y+=n,++g<w?_+=u.size:(m++,_=0,m>=k&&(b++,k=f[b+1]?f[b+1].firstChunk-1:1/0),w+=f[b].samplesPerChunk)})),c}function nR(e,t){return e.dataReferenceIndex=WA(t,6),e.width=WA(t,24),e.height=WA(t,26),e.horizresolution=YA(t,28),e.vertresolution=YA(t,32),e.frameCount=WA(t,40),e.depth=WA(t,74),78}function iR(e,t){return e.dataReferenceIndex=WA(t,6),e.channelCount=WA(t,16),e.sampleSize=WA(t,18),e.sampleRate=YA(t,24)/65536,28}function oR(e,t,r){if(e){if(e.size!==e.data.length)throw new Error("box ".concat(e.type," size !== data.length"));var n={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(n.version=e.data[e.headerSize],n.flags=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),n.headerSize+=4),r(n,e.data.subarray(n.headerSize),n.start+n.headerSize),n}}var aR=function(){for(var e=[],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.forEach((function(t){e.push(function(e,t,r){for(var n=String(r),i=0|t,o=Math.ceil(i/n.length),a=[],s=String(e);o--;)a.push(n);return a.join("").substring(0,i-s.length)+s}(Number(t).toString(16),2,0))})),e[0]};var sR=xO((function e(t,r){wO(this,e),this.type="file",this.message=t,this.data=r})),uR=function(){function e(){wO(this,e),TO(this,"_data",Object.create(null))}return xO(e,[{key:"set",value:function(e,t){this._data[e]=t}},{key:"get",value:function(e){return this._data[e]}},{key:"clear",value:function(){this._data=Object.create(null)}}]),e}();function cR(e,t){var r=t.segmentDuration,n=e.trak;if(n&&n.length){var i=n.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),o=n.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(i||o){var a,s=[],u=[];return i&&(a=(s=lR("video",i,r,t)).map((function(e){return e.duration}))),o&&(u=lR("audio",o,r,t,a,s)),{videoSegments:s,audioSegments:u}}}}function lR(e,t,r,n){var i,o,a,s,u,c,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],f=arguments.length>5?arguments[5]:void 0,d=n.fixEditListOffset,h=n.fixEditListOffsetThreshold,p=n.audioGroupingStrategy,v=null===(i=t.mdia)||void 0===i||null===(o=i.minf)||void 0===o?void 0:o.stbl;if(!v)return[];var y=null===(a=t.mdia.mdhd)||void 0===a?void 0:a.timescale,g=v.stts,m=v.stsc,b=v.stsz,_=v.stco,w=v.stss,k=v.ctts;if(!(y&&g&&m&&b&&_&&("video"!==e||w)))return[];var x=0,T=null===(s=t.edts)||void 0===s||null===(u=s.elst)||void 0===u?void 0:u.entries;if(d&&function(){var e=!0,t=navigator.userAgent||"";if(/Chrome/gi.test(t)&&!/Edge\//gi.test(t)){var r=t.match(/Chrome\/(\d+)/i),n=r?parseInt(r[1],10):0;e=!!n&&n>=75}return e}()&&Array.isArray(T)&&T.length>0){var S=T[0].media_time;S>0&&S<(h?h*y:5*y)&&(x=S)}var E,O,A,R,L=[],P=[],B=[],I=[],C=[],M=m.entries,D=_.entries,j=b.entrySizes,U=null==w?void 0:w.entries,N=null==k?void 0:k.entries;N&&(E=[],N.forEach((function(e){for(var t=e.count,r=e.offset,n=0;n<t;n++)E.push(r)}))),U&&(O={},U.forEach((function(e){O[e-1]=!0})));var F=0,z=0,V=0,H=0,G=M.length>0?M[0].samplesPerChunk:0,q=M.length>1&&M[1]?M[1].firstChunk-1:1/0,K=0,W=-1,Y=!1;(null===(c=E)||void 0===c?void 0:c.length)>0&&x>0&&(K-=x,Y=!0),t.editListApplied=Y,g.entries.forEach((function(e){var t=e.count,r=e.delta;R=r;for(var n=0;n<t;n++){if(A={dts:K,duration:R,size:j[F]||b.sampleSize,offset:D[z]+H,index:F},U&&(A.keyframe=O[F],A.keyframe?(W++,P.push([A]),B.push(A.duration)):(P[P.length-1].push(A),B[P.length-1]+=A.duration),A.gopId=W),E&&F<E.length&&(A.pts=K+E[F]),0===x&&0===F&&(A.pts=0),void 0===A.pts&&(A.pts=A.dts),A.keyframe?I.push(A.pts):A.pts<I[P.length-1]&&(I[P.length-1]=A.pts),A.keyframe)C.push(A.index);else if(P.length>0&&void 0!==C[P.length-1]){var i,o=null===(i=L[C[P.length-1]])||void 0===i?void 0:i.pts;void 0!==o&&A.pts>o&&(C[P.length-1]=A.index)}L.push(A),K+=r,++F<G?H+=A.size:(z++,H=0,z>=q&&(V++,q=M[V+1]?M[V+1].firstChunk-1:1/0),G+=M[V].samplesPerChunk)}}));var J=L.length;if(!J||w&&!L[0].keyframe)return[];var X,Q=[],Z=[],$=0,ee=0,te=0,re=0,ne=function(e,t,r){(X=Z[Z.length-1],te=I[t],re=L[C[r]],0===Q.length)&&(e=(re.pts+re.duration-te)/y);Q.push({index:Q.length,startTime:te/y,endTime:(re.pts+re.duration)/y,duration:e,range:[Z[0].offset,X.offset+X.size-1],frames:Z}),1!==p&&($=0),Z=[]},ie=0;if(w)for(var oe=r*y,ae=0,se=P.length;ae<se;ae++){var ue;$+=B[ae],(ue=Z).push.apply(ue,PO(P[ae])),ae+1<se?(0===ae||$>oe)&&(ne($/y,ie,ae),ie=ae+1):(ne($/y,ie,ae),ie=ae+1)}else{I=[],C=[];var ce=l[0]||r;if(1===p)for(var le,fe=0;fe<J;fe++){var de=L[fe],he=L[fe+1],pe=fe===J-1;Z.push(de),$+=de.duration;var ve=le||$/y;le=(he?$+he.duration:0)/y,(pe||(f[Q.length]?le>f[Q.length].endTime:le-Z[0].pts/y>=ce))&&(I.push(Z[0].pts),C.push(Z[Z.length-1].index),ne(ve,Q.length,Q.length),ce=l[Q.length]||r)}else for(var ye,ge=0;ge<J;ge++){var me=L[ge],be=L[ge+1],_e=ge===J-1;Z.push(me),$+=me.duration;var we=ye||$/y;ye=(be?$+be.duration:0)/y,(_e||ye+ee>=ce)&&(ee+=2===p?$/y-ce:ye-ce,I.push(Z[0].pts),C.push(Z[Z.length-1].index),ne(we,Q.length,Q.length),ce=l[Q.length]||r)}}return Q}function fR(e){var t="",r="",n=0,i=0,o=0,a=0,s=0,u=0,c=0;e.mvhd&&(s=e.mvhd.duration/e.mvhd.timescale);var l=e.trak;if(l){var f,d,h,p,v,y,g,m,b,_,w,k,x,T,S,E,O,A=l.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),R=l.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),L=null;if(A)if(L=null===(d=A.mdia)||void 0===d||null===(h=d.minf)||void 0===h||null===(p=h.stbl)||void 0===p?void 0:p.stsd.entries[0])if(n=L.width,i=L.height,u=null===(v=A.mdia)||void 0===v||null===(y=v.mdhd)||void 0===y?void 0:y.timescale,t=null===(g=L.avcC||L.hvcC||L.vvcC)||void 0===g?void 0:g.codec,"encv"===L.type)f=null===(m=L.sinf)||void 0===m||null===(b=m.schi)||void 0===b?void 0:b.tenc.default_KID;if(R)if(L=null===(_=R.mdia)||void 0===_||null===(w=_.minf)||void 0===w||null===(k=w.stbl)||void 0===k?void 0:k.stsd.entries[0])if(o=L.channelCount,a=L.sampleRate,r=null===(x=L.esds)||void 0===x?void 0:x.codec,c=null===(T=R.mdia)||void 0===T||null===(S=T.mdhd)||void 0===S?void 0:S.timescale,"enca"===L.type)f=f||(null===(E=L.sinf)||void 0===E||null===(O=E.schi)||void 0===O?void 0:O.tenc.default_KID);return{kid:f?f.join(""):null,videoCodec:t,audioCodec:r,width:n,height:i,videoTimescale:u,audioChannelCount:o,audioSampleRate:a,duration:s,audioTimescale:c,moov:e}}}function dR(e){return"number"==typeof e&&!Number.isNaN(e)}function hR(e){if(!e)return!1;var t=e.audioSegments,r=e.videoSegments,n=!r||0===r.length,i=!t||0===t.length;return!n||!i}var pR=["vid","cache"],vR=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&EO(e,t)}(h,e);var t,r,n,i,o,a,s,u,c,l,f,d=RO(h);function h(e){var t,r;wO(this,h),TO(AO(t=d.call(this)),"vid",""),TO(AO(t),"url",""),TO(AO(t),"meta",{}),TO(AO(t),"downloadInfo",[]),TO(AO(t),"videoSegments",[]),TO(AO(t),"audioSegments",[]),TO(AO(t),"cache",null),TO(AO(t),"_currentSegmentIndex",-1),TO(AO(t),"_currentLoadingSegmentIndex",-1),TO(AO(t),"buffer",void 0),TO(AO(t),"_error",void 0),TO(AO(t),"_transformError",(function(e){return e})),t._config=("boolean"!=typeof(r=e).fixEditListOffset&&delete r.fixEditListOffset,gO({vid:"",moovEnd:8e4,segmentDuration:2,maxDownloadInfoSize:30,responseType:"arraybuffer",fixEditListOffset:!0,cache:null},r));var n=t._config,i=n.vid,o=n.cache,a=OO(n,pR);return t.cache=o||new uR,t.vid=i||a.url,t.url=a.url,a.transformError=t._transformError,t.logger=new aA("MP4Loader_"+t.vid),e.openLog&&aA.enable(),a.logger=t.logger,t._loader=new PA(a),t._loader.on(xA,(function(e){t.emit(xA,e)})),t}return xO(h,[{key:"isMetaLoaded",get:function(){return this.videoSegments.length||this.audioSegments.length}},{key:"setCurrentSegment",value:function(e){dR(e)&&(this._currentSegmentIndex=e)}},{key:"isLastSegment",value:function(e){var t,r;return!!dR(e)&&e>=((null===(t=this.videoSegments[this.videoSegments.length-1])||void 0===t?void 0:t.index)||(null===(r=this.audioSegments[this.audioSegments.length-1])||void 0===r?void 0:r.index)||0)}},{key:"isSegmentLoading",value:function(e){return e===this._currentLoadingSegmentIndex}},{key:"changeUrl",value:(f=_O(mO().mark((function e(t){var r,n,i,o=arguments;return mO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:t,n=o.length>2?o[2]:void 0,i=o.length>3?o[3]:void 0,e.next=5,this.reset(i);case 5:t&&(this.url=t),r&&(this.vid=r),n&&(this._config.moovEnd=n);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"getOrLoadMeta",value:(l=_O(mO().mark((function e(t){return mO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMetaLoaded){e.next=3;break}return e.next=3,this.loadMeta(t);case 3:return e.abrupt("return",this.meta);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"loadMetaProcess",value:(c=_O(mO().mark((function e(t,r,n,i){var o,a,s,u,c=this;return mO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=LO(r,2),a=o[0],s=o[1],this._error=!1,this.logger.debug("[loadMetaProcess start], range,",[a,s]),u=function(){var e=_O(mO().mark((function e(r,o,u,l){var f,d,h,p,v,y,g,m;return mO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c.meta&&null!=u&&u.range&&u.range.length>0&&u.range[1]>=s&&(o=!0,c.logger.debug("[loadMetaProcess],data done,setstate true,[",a,s,"]")),o&&null!=u&&u.range&&u.range.length>0&&u.range[1]<s&&(o=!1,c.logger.debug("[loadMetaProcess],data not done,setstate false,[",a,s,"]")),c.logger.debug("[loadMetaProcess],task,[",a,s,"], range,",u.range,",dataLen,",r?r.byteLength:void 0,", state,",o,",err,",c._error),!c._error&&r&&r.byteLength>0&&n(r,o,u,null,l),!c.meta.moov&&!c._error){e.next=6;break}return e.abrupt("return");case 6:if(!(r&&r.byteLength>0)){e.next=44;break}if(c.buffer=RA(c.buffer,r),f=tR.findBox(c.buffer,["moov"])[0]){e.next=23;break}if(d=tR.findBox(c.buffer,["mdat"])[0],!o){e.next=23;break}if(d){e.next=18;break}return c._error=!0,n(null,o,u,new sR("cannot find moov or mdat box"),l),e.abrupt("return");case 18:return h=d.start+d.size,e.next=21,c.loadData([h,""],t,i);case 21:(p=e.sent)&&(f=tR.findBox(p.data,["moov"])[0]);case 23:if(!(f&&o&&f.size>f.data.length)){e.next=27;break}return c.logger.debug("[loadMetaProcess],moov not all, range,",u.range[1],",dataLen,",c.buffer.byteLength,", state,",o),e.next=27,c.loadMetaProcess(t,[u.range[1],f.start+f.size-1],n);case 27:if(!(f&&f.size<=f.data.length)||c.meta.moov){e.next=44;break}if(v=tR.moov(f)){e.next=33;break}return c._error=!0,n(null,o,u,new sR("cannot parse moov box"),l),e.abrupt("return");case 33:if(hR(y=cR(v,c._config))){e.next=38;break}return c._error=!0,n(null,o,u,new sR("cannot parse segments"),l),e.abrupt("return");case 38:c.meta=fR(v),g=y.videoSegments,m=y.audioSegments,c.videoSegments=g,c.audioSegments=m,c.logger.debug("[loadMetaProcess] moov ok"),n(void 0,o,{meta:{meta:c.meta,videoSegments:g,audioSegments:m}},null,l);case 44:case"end":return e.stop()}}),e)})));return function(t,r,n,i){return e.apply(this,arguments)}}(),e.next=6,this.loadData([a,s||this._config.moovEnd],t,gO({onProgress:u},i));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return c.apply(this,arguments)})},{key:"loadMeta",value:(u=_O(mO().mark((function e(t,r,n){var i,o,a,s,u,c,l,f,d;return mO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=[],this.logger.debug("[loadMeta start]"),e.next=4,this.loadData([0,r||this._config.moovEnd],t,n);case 4:if(o=e.sent){e.next=7;break}return e.abrupt("return");case 7:if(i.push(o),a=tR.findBox(o.data,["moov"])[0]){e.next=23;break}if(s=tR.findBox(o.data,["mdat"])[0]){e.next=13;break}throw new sR("cannot find moov or mdat box",o.data);case 13:return u=s.start+s.size,e.next=16,this.loadData([u],t,n);case 16:if(o=e.sent){e.next=19;break}return e.abrupt("return");case 19:if(i.push(o),a=tR.findBox(o.data,["moov"],u)[0]){e.next=23;break}throw new sR("cannot find moov box",o.data);case 23:if(!(a.size>a.data.length)){e.next=31;break}return e.next=26,this.loadData([o.data.length,a.start+a.size-1],t,n);case 26:if(o=e.sent){e.next=29;break}return e.abrupt("return");case 29:i.push(o),a.data=RA(a.data,o.data);case 31:if(c=tR.moov(a)){e.next=34;break}throw new sR("cannot parse moov box",a.data);case 34:if(hR(l=cR(c,this._config))){e.next=37;break}throw new sR("cannot parse segments",a.data);case 37:return this.meta=fR(c),f=l.videoSegments,d=l.audioSegments,this.videoSegments=f,this.audioSegments=d,this.logger.debug("[load moov end!!!!!]"),e.abrupt("return",{meta:this.meta,videoSegments:f,audioSegments:d,responses:i});case 43:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"loadCacheMeta",value:function(e,t){var r=cR(e.moov,this._config),n=r.videoSegments,i=r.audioSegments;this.videoSegments=n,this.audioSegments=i,this._currentSegmentIndex=t,this.meta=e}},{key:"getSegmentByTime",value:function(e){var t,r;return this.videoSegments.length?(t=this.videoSegments.find((function(t){return t.startTime<=e&&t.endTime>e})),t&&(r=this.audioSegments[t.index])):r=this.audioSegments.find((function(t){return t.startTime<=e&&t.endTime>e})),{video:t,audio:r}}},{key:"loadSegmentByTime",value:(s=_O(mO().mark((function e(t,r){var n,i,o,a,s,u=arguments;return mO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(u.length>2&&void 0!==u[2])||u[2],i=u.length>3&&void 0!==u[3]?u[3]:{},this.isMetaLoaded){e.next=5;break}return e.next=5,this.loadMeta(r);case 5:return o=this.getSegmentByTime(t),a=o.video,s=o.audio,e.abrupt("return",this._loadSegment(a,s,r,n,i));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"loadNextSegment",value:(a=_O(mO().mark((function e(t){var r,n,i,o,a=arguments;return mO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(a.length>1&&void 0!==a[1])||a[1],n=a.length>2&&void 0!==a[2]?a[2]:{},this.isMetaLoaded){e.next=5;break}return e.next=5,this.loadMeta();case 5:return i=this.videoSegments[this._currentSegmentIndex+1],o=this.audioSegments[this._currentSegmentIndex+1],e.abrupt("return",this._loadSegment(i,o,t,r,n));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"preload",value:(o=_O(mO().mark((function e(t){var r,n,i,o,a,s,u,c=this;return mO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMetaLoaded){e.next=3;break}return e.next=3,this.loadMeta(!0);case 3:if(t&&!(t<0)){e.next=5;break}return e.abrupt("return");case 5:if(r=this.getSegmentByTime(t),n=r.video,i=r.audio,o=Math.max((null==n?void 0:n.index)||0,(null==i?void 0:i.index)||0)){e.next=9;break}return e.abrupt("return");case 9:return a=this.videoSegments.slice(0,o),s=this.audioSegments.slice(0,o),u=function(){var e=_O(mO().mark((function e(t){return mO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t>o)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,c._loadSegment(a[t],s[t],!0,!1);case 4:return e.next=6,u(t+1);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e.next=14,u(0);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"cancel",value:function(){return this._loader.cancel()}},{key:"reset",value:(i=_O(mO().mark((function e(){var t=arguments;return mO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length>0&&void 0!==t[0]&&t[0]){e.next=5;break}return this.logger.debug("[MP4loader reset func call loader.cancel]"),e.next=5,this._loader.cancel();case 5:this.vid=this.url="",this.meta={},this.downloadInfo=[],this.videoSegments=[],this.audioSegments=[],this._currentSegmentIndex=-1,this._currentLoadingSegmentIndex=-1;case 12:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"destroy",value:(n=_O(mO().mark((function e(){return mO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.reset();case 2:this.cache.clear();case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"_loadSegment",value:(r=_O(mO().mark((function e(t,r,n,i,o){var a,s;return mO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t||r){e.next=2;break}return e.abrupt("return");case 2:return a=(null==t?void 0:t.index)||(null==r?void 0:r.index)||0,this._currentLoadingSegmentIndex=a,e.prev=4,e.next=7,this.loadData([Math.min((null==t?void 0:t.range[0])||1/0,(null==r?void 0:r.range[0])||1/0),Math.max((null==t?void 0:t.range[1])||0,(null==r?void 0:r.range[1])||0)],n,o);case 7:s=e.sent;case 8:return e.prev=8,this._currentLoadingSegmentIndex=-1,e.finish(8);case 11:if(s){e.next=13;break}return e.abrupt("return");case 13:return i&&(this._currentSegmentIndex=a),s.video=t,s.audio=r,e.abrupt("return",s);case 17:case"end":return e.stop()}}),e,this,[[4,,8,11]])}))),function(e,t,n,i,o){return r.apply(this,arguments)})},{key:"loadData",value:(t=_O(mO().mark((function e(t,r,n){var i,o,a,s;return mO().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._getCacheKey(t),e.next=3,this.cache.get(i);case 3:if(o=e.sent){e.next=11;break}return s=n&&n.url?n.url:this.url,e.next=8,this._loader.load(s,gO({range:t,vid:this.vid},n));case 8:a=e.sent,e.next=12;break;case 11:a={data:o,state:!0,options:{fromCache:!0,range:t,vid:this.vid}};case 12:if(a){e.next=14;break}return e.abrupt("return");case 14:return o||(a.data&&this.downloadInfo.push({startTime:a.startTime,endTime:a.endTime,size:a.data.byteLength,range:t}),this.downloadInfo&&this.downloadInfo.length>this._config.maxDownloadInfoSize&&(this.downloadInfo=this.downloadInfo.slice(-this._config.maxDownloadInfoSize))),e.abrupt("return",a);case 17:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})},{key:"_getCacheKey",value:function(e){return(this.vid||this.url)+":"+e}}]),h}(CT),yR=function(){try{return"undefined"!=typeof localStorage&&"setItem"in window.localStorage&&!!window.localStorage.setItem}catch(e){return!1}}()&&!function(){var e="_localstorage_support_test";try{return window.localStorage.setItem(e,!0),window.localStorage.removeItem(e),!1}catch(e){return!0}}(),gR=mR();function mR(){if(yR)try{return!!window.localStorage.getItem("playerlog")}catch(e){return!1}return!1}function bR(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];gR&&console.log&&(t=console).log.apply(t,["[logger]",vO.nowTime(),e].concat(n))}function _R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function wR(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_R(Object(r),!0).forEach((function(t){sc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_R(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function kR(e,t,r){return t=ic(t),nc(e,xR()?Reflect.construct(t,r||[],ic(e).constructor):t.apply(e,r))}function xR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(xR=function(){return!!e})()}!function(){if(yR)try{return!!window.localStorage.getItem("playertestlog")}catch(e){return!1}}();var TR="error",SR="metaReady",ER="moov_request_Progress",OR="update_load_fragmentIdx",AR=function(e){function t(e,r){var n;return Zu(this,t),sc(n=kR(this,t),"onprogressDataArrive",function(){var e=Qu(_y.mark((function e(t,r,i){var o;return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t&&t.byteLength>0&&((o=n.timeRange[i.index].range)&&i.range[1]>=o[1]&&!r&&(r=!0),n.log("[mp4.loadFragment onprogressDataArrive ] receive data, >>> index,",i.index,",range,",JSON.stringify(i.range),", dataLen,",t.byteLength),n._mux(t,i.range[0],i.index,r)),r&&(n.timeRange[i.index].downloaded=!0,n.bufferLoadedPos=-1,n.log("[FragLoadDowned],fragmentIdx,",i.index,",rangeEnd,",i.range[1]));case 2:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}()),n.url=e,n.options=t.getDefaultConfig(),Object.keys(r).map((function(e){void 0!==r[e]&&null!==r[e]&&(n.options[e]=r[e])})),n.timeRange=[],n.CHUNK_SIZE=n.options.chunkSize,n.bufferLoaded=new Uint8Array(0),n.bufferLoadedPos=0,n.meta=null,n.videoTrak=null,n.audioTrak=null,n.canDownload=!0,n._loadSuccessCallBack=null,n._isPending=!1,n._metaLoading=!1,n.MP4Loader=new vR(wR(wR({segmentDuration:n.options.segmentDuration,url:e,vid:r.vid,retry:n.options.retryCount,retryDelay:n.options.retryDelay,timeout:n.options.timeout},r.reqOptions),{},{openLog:mR()})),n.MP4Demuxer=null,n.FMP4Remuxer=null,n._needInitSegment=!0,n._switchBitRate=!1,n.enableWorker=n.options.enableWorker,n.enableWorker||(n.MP4Demuxer=null,n.FMP4Remuxer=null),n.seekTime=-1,n.changeBitRateTime=-1,n}return ac(t,e),rc(t,[{key:"changeBitRate",value:(f=Qu(_y.mark((function e(t){return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.url=t.url,e.next=3,this.MP4Loader.changeUrl(this.url,this.options.vid+Date.now(),this.CHUNK_SIZE);case 3:this._switchBitRate=!0,this.log("[switchBitrate] changeUrl, bitRate,",this.url);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"log",value:function(e){for(var t=this.options,r=t&&t.vid?"[MP4] ".concat(t.vid," ").concat(e):"[MP4] ".concat(e),n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];bR.apply(void 0,[r].concat(i))}},{key:"errorHandler",value:(l=Qu(_y.mark((function e(t,r){var n,i,o,a;return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.response,i=t.message,o=this.options?this.options.vid:"",a=null,this._isPending=!0,n?(a=new uO("network",n.status,{httpText:n.httpText,message:i,url:n.url}),this.emit(TR,a)):(console.error("[MP4] [".concat(o,"] errorHandler,"),t),a=t,this.emit(TR,a));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"init",value:(c=Qu(_y.mark((function e(){return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.url){e.next=3;break}return e.next=3,this.MP4Loader.changeUrl(this.url,this.options.vid+Date.now(),this.CHUNK_SIZE);case 3:return e.next=5,this.getMetaInfo();case 5:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"getTimeRange",value:function(){for(var e=[],t=null,r=0;this.videoTrak&&r<this.videoTrak.length;r++)t={startTime:this.videoTrak[r].startTime,endTime:this.videoTrak[r].endTime,downloaded:!1,isLoading:!1},e.push(t);if(this.audioTrak&&this.audioTrak.length>e.length)for(var n=e.length;n<this.audioTrak.length;n++)t={startTime:Math.max(this.audioTrak[n].startTime,t?t.endTime:0),endTime:Math.max(this.audioTrak[n].endTime,t?t.endTime:0),downloaded:!1,isLoading:!1},e.push(t);return e}},{key:"getMetaInfo",value:(u=Qu(_y.mark((function e(){var t,r,n,i=this,o=arguments;return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=!(o.length>0&&void 0!==o[0])||o[0],e.prev=1,this._metaLoading=!0,this.log("getMetaInfo start"),this.bufferLoaded=new Uint8Array(0),r=0,n=function(){var e=Qu(_y.mark((function e(n,o,a,s,u){var c,l,f;return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=Number(dO(u.headers)),i.log("getMetaInfo onProgressHandle, dataLen,",n?n.byteLength:-1,", state,",o,",range,",JSON.stringify(a.range)),!s){e.next=5;break}return i.emit(TR,s),e.abrupt("return");case 5:n&&a.range[0]===r&&(i.bufferLoaded=DT(Uint8Array,i.bufferLoaded,new Uint8Array(n)),r+=n.byteLength),a.meta&&!i.meta&&(l=a.meta,i.videoTrak=l.videoSegments,i.audioTrak=l.audioSegments,i.timeRange=i.getTimeRange(),i.meta=wR(wR({},l.meta),{},{ext:{videoTrak:i.videoTrak,audioTrak:i.audioTrak}}),l.bufferLoaded=i.bufferLoaded,i.log("meta reach"),t&&i.emit(SR,i.meta)),i.meta&&o&&(i.log("[getMetaInfo req end]"),i._metaLoading=!1),i.meta&&(n||o)&&(i.log("emit moov_req_progress"),i.emit(ER)),f=(null==a?void 0:a.range)||[],c>0&&!i.meta&&f&&f.length>1&&f[1]>=c&&(i.log("getMetaInfo_error_nometa"),i.emit(TR,{message:"getMetaInfo_error_nometa"}));case 11:case"end":return e.stop()}}),e)})));return function(t,r,n,i,o){return e.apply(this,arguments)}}(),e.next=9,this.MP4Loader.loadMetaProcess(this.MP4Loader.cache,[0,this.CHUNK_SIZE],n);case 9:e.next=15;break;case 11:e.prev=11,e.t0=e.catch(1),console.error("[MP4] trigger errorHandler getMetaInfo",null===e.t0||void 0===e.t0?void 0:e.t0.message),this.loadError(e.t0,"getMetaInfo");case 15:case"end":return e.stop()}}),e,this,[[1,11]])}))),function(){return u.apply(this,arguments)})},{key:"getFragmentIdx",value:function(e){var t,r;if(this.videoTrak.length){if(t=this.videoTrak.find((function(t){return t.startTime<=e&&t.endTime>e})),r=this.audioTrak.find((function(t){return t.startTime<=e&&t.endTime>e})),t&&r)return Math.min(t.index,r.index);if(t||r)return t?t.index:r.index;var n=Number.MAX_VALUE;return this.videoTrak&&this.videoTrak.length>0&&(n=this.videoTrak.length-1),this.audioTrak&&this.audioTrak.length>0&&(n=Math.min(this.audioTrak.length-1,n)),n}return r=this.audioTrak.find((function(t){return t.startTime<=e&&t.endTime>e})),r?r.index:0}},{key:"_checkHasMeta",value:(s=Qu(_y.mark((function e(){var t;return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.log(" loadMeta start"),this._metaLoading=!0,e.prev=2,e.next=5,this.MP4Loader.loadMeta(this.MP4Loader.cache,Math.round(this.CHUNK_SIZE/2));case 5:return t=e.sent,this._metaLoading=!1,this.videoTrak=t.videoSegments,this.audioTrak=t.audioSegments,this.meta=wR(wR({},t.meta),{},{ext:{videoTrak:this.videoTrak,audioTrak:this.audioTrak}}),this.timeRange=this.getTimeRange(),this.bufferLoaded=new Uint8Array(0),t.bufferLoaded=this.bufferLoaded,e.abrupt("return",!0);case 16:return e.prev=16,e.t0=e.catch(2),this._metaLoading=!1,this.emit(TR,e.t0),console.error(e.t0),e.abrupt("return",!1);case 22:case"end":return e.stop()}}),e,this,[[2,16]])}))),function(){return s.apply(this,arguments)})},{key:"resetFragmentLoadState",value:function(e){for(var t=0;t<this.timeRange.length;t++)t<e?(this.timeRange[t].downloaded=!0,this.timeRange[t].isLoading=!0):(this.timeRange[t].downloaded=!1,this.timeRange[t].isLoading=!1)}},{key:"getFragRange",value:function(e){var t,r,n,i,o=null;this.videoTrak&&(o=e<this.videoTrak.length?this.videoTrak[e]:this.videoTrak[this.videoTrak.length-1]);var a=null;this.audioTrak&&(a=e<this.audioTrak.length?this.audioTrak[e]:this.audioTrak[this.audioTrak.length-1]);var s=0,u=0;this.videoTrak&&e>=this.videoTrak.length-1&&(s=-1),this.audioTrak&&e>=this.audioTrak.length-1&&(u=-1);var c=[Math.min((null===(t=o)||void 0===t?void 0:t.range[0])||1/0,(null===(r=a)||void 0===r?void 0:r.range[0])||1/0),Math.max((null===(n=o)||void 0===n?void 0:n.range[1])+s||0,(null===(i=a)||void 0===i?void 0:i.range[1])+u||0)];return e<this.timeRange.length&&(this.timeRange[e].range=c),c}},{key:"load",value:(a=Qu(_y.mark((function e(t,r){var n,i,o;return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loadSuccessCallBack=r,!this._switchBitRate||this._metaLoading){e.next=12;break}return this.log("[switchBitrate], switch bitRate start load, time,",t>=this.videoTrak.length?this.audioTrak[t].startTime:this.videoTrak[t].startTime,", fragIndex,",t),e.next=5,this._checkHasMeta();case 5:n=e.sent,this.changeBitRateTime>0&&(this.timeRange[t].startTime<=this.changeBitRateTime&&this.changeBitRateTime<this.timeRange[t].endTime?this.log("[switchBitrate], not need update load fragIndex",t,",stTime,",this.changeBitRateTime):(t=this.getFragmentIdx(this.changeBitRateTime),this.log("[switchBitrate], need update load fragIndex",t,",stTime,",this.changeBitRateTime,",newBitrateTimeRange,",this.timeRange[t].startTime,"-",this.timeRange[t].endTime),this.emit(OR,t)),this.seekTime=this.changeBitRateTime,this.changeBitRateTime=-1),this.resetFragmentLoadState(t),this.log("[switchBitrate], reset timerange state,",t),this._needInitSegment=!0,this.resetTansmuxer(),n&&(this._switchBitRate=!1);case 12:if(!this._switchBitRate||!this._metaLoading){e.next=14;break}return e.abrupt("return");case 14:i=this.getFragRange(t),this.log("loadFragment,",t,",range,",JSON.stringify(i)),this.seekTime>0?(o=this.getSubRange(t,this.seekTime,i),this.loadFragment(t,o),this.seekTime=-1):this.loadFragment(t,i);case 17:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"getSubRange",value:function(e,t,r){var n=r[0],i=r[0],o=1,a=!1;if(this.log(">>>>>getSubRange time,",t,JSON.stringify(r)),this.videoTrak){var s=e<this.videoTrak.length?this.videoTrak[e]:this.videoTrak[this.videoTrak.length-1],u=s.frames.filter(RR),c=this.meta.videoTimescale,l=u[0].startTime/c;this.log(">>>>>getSubRange video, startTime,",s.startTime,",endTime,",s.endTime);for(var f=0;f<u.length;f++)this.log(">>>>>getSubRange video keyFrameList, startTime,",u[f].startTime/c,",range,",u[f].offset);for(;o<u.length;o++){var d=u[o].startTime/c;if(l<=t&&t<d&&r[0]<u[o-1].offset){n=u[o-1].offset,a=!0,this.log(">>>>>getSubRange video end, startTime,",l,",endTime,",d,",startRange,",n,", keyFrameIndex,",o-1);break}l=d}!a&&l<=t&&t<s.endTime+.8&&(n=u[o-1].offset,this.log(">>>>>getSubRange video last, startTime,",l,",endTime,",s.endTime,",startRange,",n))}if(o=1,this.audioTrak){var h=e<this.audioTrak.length?this.audioTrak[e]:this.audioTrak[this.audioTrak.length-1],p=h.frames,v=this.meta.audioTimescale;o=Math.floor((t*v-p[0].startTime)/h.frames[0].duration);for(var y=(o=Math.min(p.length-1,o))>0?p[o-1].startTime/v:p[0].startTime/v;o>=0&&o<p.length;)if(o>0&&y>t)y=p[o-=1].startTime/v;else{var g=(p[o].startTime+p[o].duration)/v;if(y<=t&&t<g&&r[0]<p[o].offset){i=p[o].offset,a=!0,this.log(">>>>>getSubRange audio end, startTime,",y,",endTime,",g,",startRange,",i,", index,",o);break}y=g,o++}}var m=[Math.min(i,n),r[1]];return this.log(">>>>>getSubRange finalRange ",JSON.stringify(m),",oldRange,",JSON.stringify(r)),m}},{key:"_mux",value:function(e,t,r,n){var i=this.getSamplesRange(r,"video"),o=this.getSamplesRange(r,"audio"),a=[t,t+e.byteLength];try{this.MP4Demuxer||(this.MP4Demuxer=new TE(this.videoTrak,this.audioTrak,null,{openLog:mR()}));var s,u=this.MP4Demuxer.demuxPart(e,t,i,o,this.meta.moov,this.useEME,this.kidValue);this.FMP4Remuxer||this.checkCodecH265()&&!this.options.supportHevc||(this.FMP4Remuxer=new PS(this.MP4Demuxer.videoTrack,this.MP4Demuxer.audioTrack,{openLog:mR()})),this.log("[mux], videoTimeRange,",u.videoTrack?[u.videoTrack.startPts,u.videoTrack.endPts]:null,",audioTimeRange,",u.audioTrack?[u.audioTrack.startPts,u.audioTrack.endPts]:null);var c=[Math.min(u.videoTrack.startPts,u.audioTrack.startPts),Math.max(u.videoTrack.endPts,u.audioTrack.endPts)];if(this.FMP4Remuxer){var l=this.FMP4Remuxer.remux(this._needInitSegment,{initMerge:!0,range:a});l.initSegment&&(this._needInitSegment=!1),s={buffer:vO.concatData(l.audioSegment,l.videoSegment),range:a,state:n,context:{range:a,fragIndex:r,timeRange:c},initSeg:l.initSegment}}else s={videoTrack:u.videoTrack,audioTrack:u.audioTrack,buffer:null,range:a,state:n,context:{range:a,fragIndex:r,timeRange:c}};this._loadSuccessCallBack&&this._loadSuccessCallBack(s)}catch(n){console.error("mux err:",n);var f=new cO(sO.remux,aO.muxError,{msg:JSON.stringify(n)});this.errorHandler(f,"mux",{fragIndex:r,range:[t,t+e.byteLength]})}}},{key:"getSamplesRange",value:function(e,t){var r=[];switch(t){case"video":if(this.videoTrak&&e<this.videoTrak.length){var n=this.videoTrak[e].frames;r.push(n[0].index),r.push(n[n.length-1].index)}break;case"audio":if(this.audioTrak&&e<this.audioTrak.length){var i=this.audioTrak[e].frames;r.push(i[0].index),r.push(i[i.length-1].index)}break;default:console.warn("[getSamplesRange] type ",t," is invalid")}return r}},{key:"loadFragment",value:(o=Qu(_y.mark((function e(t,r){var n,i,o,a;return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this._isPending||r.length>0&&0===r[0]&&0===r[1]||this.timeRange[t].isLoading)){e.next=2;break}return e.abrupt("return");case 2:if(this.log("[MP4.loadFragment] ,fragIndex,",t,",range ",r,",len ,",r[1]-r[0],", bufferLoaded_Len,",this.bufferLoaded.byteLength),!(r.length>=2&&r[1]&&r[1]>0&&r[1]<=this.bufferLoaded.byteLength)){e.next=13;break}this.timeRange[t].isLoading=!0,n=Math.max(r[0],this.bufferLoadedPos),i=new Uint8Array(this.bufferLoaded.slice(n,r[1])),this.log("[mp4.loadFragment] has all data: ",n,r[1]),this.timeRange[t].downloaded=!0,this.bufferLoadedPos=-1,this._mux(i,n,t,!0),e.next=34;break;case 13:if(!(r.length>=2&&r[0]&&r[0]<=this.bufferLoaded.byteLength)){e.next=29;break}if(this.timeRange[t].isLoading){e.next=27;break}if(o=Math.max(r[0],this.bufferLoadedPos),!((a=new Uint8Array(this.bufferLoaded.slice(o,r[1]))).byteLength>0)){e.next=22;break}return this.bufferLoadedPos=o+a.byteLength,this.log("[mp4.loadFragment] has part data: ",o,o+a.byteLength),this._mux(a,o,t,r[1]<=this.bufferLoadedPos),e.abrupt("return");case 22:if(this._metaLoading||this.timeRange[t].isLoading){e.next=27;break}return this.log("[mp4.loadFragment] ready to load part data >>> ",this.bufferLoaded.byteLength,r[1]),this.timeRange[t].isLoading=!0,e.next=27,this.startLoad([this.bufferLoaded.byteLength,r[1]],t);case 27:e.next=34;break;case 29:if(this._metaLoading&&!(r[0]>=this.CHUNK_SIZE)||this.timeRange[t].isLoading){e.next=34;break}return this.timeRange[t].isLoading=!0,this.log("[mp4.loadFragment],ready to load all data ,segmentIdx, ",t,",range >>> ",JSON.stringify(r)),e.next=34,this.startLoad(r,t);case 34:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"startLoad",value:(i=Qu(_y.mark((function e(t,r){return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.MP4Loader.loadData(t,this.MP4Loader.cache,{index:r,onProgress:this.onprogressDataArrive,onProcessMinLen:this.options.onProcessMinLen,url:this.url});case 3:e.next=10;break;case 5:e.prev=5,e.t0=e.catch(0),console.error("[MP4] trigger errorHandler startLoad",t,r,null===e.t0||void 0===e.t0?void 0:e.t0.message),this.timeRange[r].isLoading=!1,this.loadError(e.t0,"startLoad",{range:t,fragIndex:r});case 10:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(e,t){return i.apply(this,arguments)})},{key:"loadError",value:function(e,t,r){var n;!e.response&&(e.response={}),e.isTimeout?e.response.status="timeout":null!=e&&null!==(n=e.response)&&void 0!==n&&n.status||(e.response.status="networkError"),this.errorHandler(e,t,r)}},{key:"cancelLoading",value:(n=Qu(_y.mark((function e(){return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.MP4Loader;case 2:if(e.t0=e.sent,!e.t0){e.next=5;break}this.MP4Loader.cancel();case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"update",value:(r=Qu(_y.mark((function e(t){return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.url=t,this.MP4Loader&&this.MP4Loader.changeUrl(t),this.MP4Loader&&this.MP4Loader.changeUrl(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"restart",value:function(){this._isPending=!1,this.meta||this.init()}},{key:"checkCodecH265",value:function(){return this.meta&&(this.meta.videoCodec.indexOf("hvc1")>-1||this.meta.videoCodec.indexOf("hev1")>-1)}},{key:"destroy",value:function(){this.hasDestroyed||(this.resetTansmuxer(),this._isPending=!1,this._metaLoading=!1,this.bufferLoadedPos=0,this.bufferLoaded=new Uint8Array(0),this.MP4Loader&&(this.MP4Loader.cancel(),this.MP4Loader.destroy()),this.hasDestroyed=!0)}},{key:"resetTansmuxer",value:function(){this.MP4Demuxer&&this.MP4Demuxer.reset(),this.MP4Demuxer=null,this.FMP4Remuxer&&this.FMP4Remuxer.reset(),this.FMP4Remuxer=null}}],[{key:"getDefaultConfig",value:function(){return{segmentDuration:5,onProcessMinLen:1024,chunkSize:8e5,retryCount:3,retryDelay:1e3,timeout:3e3,enableWorker:!1,playerId:"",vid:"",ext:{}}}}]);var r,n,i,o,a,s,u,c,l,f}(CT);function RR(e){if(e.keyframe)return e}var LR=function(){return rc((function e(t){Zu(this,e),this.onTick_=t,this.cancelPending_=null}),[{key:"tickAfter",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.stop();var n=!0,i=null;this.cancelPending_=function(){window.clearTimeout(i),n=!1};return i=window.setTimeout((function(){n&&(t.onTick_(),r&&r())}),1e3*e),this}},{key:"tickEvery",value:function(e){var t=this;this.tickAfter(e,(function(){t.tickEvery(e)}))}},{key:"stop",value:function(){this.cancelPending_&&(this.cancelPending_(),this.cancelPending_=null)}}])}(),PR=function(){return rc((function e(){var t,r;Zu(this,e);var n=new Promise((function(e,n){t=e,r=n}));return n.resolve=function(e){t(e),n.state="fulfilled"},n.reject=function(e){r(e),n.state="rejected",n.isBreak="DESTROYED"===e},n.state="pending",n}),[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}])}();function BR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function IR(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?BR(Object(r),!0).forEach((function(t){sc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):BR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function CR(e,t,r){return t=ic(t),nc(e,MR()?Reflect.construct(t,r||[],ic(e).constructor):t.apply(e,r))}function MR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(MR=function(){return!!e})()}var DR=null,jR=null,UR=null,NR=null,FR=function(e){function r(e){var n;return Zu(this,r),sc(n=CR(this,r,[e]),"_onMp4DataCallBack",(function(){n._isMseInit&&n._onTimeUpdate()})),sc(n,"_onMp4MetaReady",(function(e){var r=n.config,i=n.mp4.checkCodecH265();try{if(i&&!n.config.supportHevc){var o="browser not support HEVC",a=new t.Errors(n.player,{errorType:"runtime",errorTypeCode:sO.runtime,errorCode:aO.h265Error,errorMessage:o,vid:r.vid,mediaError:{code:aO.h265Error,message:o}});n._errorHandler(a)}else n._initMse(e),n._initPromise.resolve()}catch(e){var s=new t.Errors(n.player,{errorType:"runtime",errorTypeCode:sO.runtime,errorCode:aO.mse,errorMessage:null==e?void 0:e.message,vid:r.vid,mediaError:{code:aO.other1,message:null==e?void 0:e.message}});return void n._errorHandler(s)}n._loadData()})),sc(n,"_onMp4Error",(function(e){var t=n.playerConfig.vid;console.error("[Index] _onMp4Error",t,e),n._errorHandler(e)})),sc(n,"_loadDataSuccess",(function(e){if(!n.isDestroy&&n.mse){n.log("[loadFragment] _loadDataSuccess ",JSON.stringify(e.context.range),",dataLen,",e.buffer?e.buffer.byteLength:0,e.state);try{e.initSeg&&(n._appendInitSeg(e.initSeg),(!e.buffer||e.buffer.byteLength<1)&&(n.log("no data, must load data"),n._onTimeUpdate()));var r=e.buffer,i=e.state,o=e.context;if(n.mse&&i&&(!r||r.byteLength<=0)&&o.fragIndex===n.mp4.timeRange.length-1){var a=n.player.buffered;a&&a.length>0&&(n.bufferEndTime=a.end(a.length-1)),n._isEnded(),n.log("loaded ended !!!==>>>",JSON.stringify(o.range),", fragIndex,",o.fragIndex,", bufferEndTime,",n.bufferEndTime,",meta_duration,",n.mp4.meta.duration)}if(n.mse&&i&&o.fragIndex===n.mp4.timeRange.length-1&&(!r||r.byteLength<=0)){var s=n.player.buffered;s&&s.length>0&&(n.bufferEndTime=s.end(s.length-1)),n._isEnded(),n.log("load ended !!!==>>>",n.playerConfig.vid,JSON.stringify(o.range),", fragIndex,",o.fragIndex,", bufferEndTime,",n.bufferEndTime,",meta_duration,",n.mp4.meta.duration)}r&&n.mse&&r&&r.byteLength>0&&n._appendBuffer(oO.VIDEO,r,o,i)}catch(e){n.log("appendBuffer error",e);var u=new t.Errors(n.player,{errorType:"runtime",errorTypeCode:sO.runtime,errorCode:aO.mse,vid:n.player.config.vid,errorMessage:e.message,mediaError:{code:aO.mse,message:e.message}});n._errorHandler(u)}null!=e&&e.state&&n._onTimeUpdate()}})),sc(n,"_onWaiting",(function(){var e=n,t=e.player,r=e.config;clearTimeout(n._waitInBufferTimer),n._waitInBufferTimer=null;var i=t.currentTime,o=t.bufferedPoint;o.end>0&&o.end-t.currentTime>=2&&n._waitAdjustTimeCnt<r.waitJampBufferMaxCnt&&(n._waitInBufferTimer=setTimeout((function(){n._waitAdjustTimeCnt++,t.currentTime=t.currentTime+.5,n.log("[waitInBufferTimeout], waitAdjustTimeCnt,",n._waitAdjustTimeCnt,",curtime,",i,vO.nowTime())}),r.waitingInBufferTimeOut))})),sc(n,"_onSeeking",Qu(_y.mark((function e(){var t,r,i,o,a,s,u,c,l,f;return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=n).player,i=t.mp4,o=r.currentTime,n.log("[seekTime], curTime,",o,",buffer,",r.buffered2.bufferedList),i&&i.meta){e.next=5;break}return e.abrupt("return");case 5:if(n.endofstream=!1,i.bufferLoadedPos=-1,i._metaLoading=!1,a=r.bufferedPoint,s=!1,u=0,!(a.end>0)){e.next=25;break}if(s=!0,!(i.meta.duration-a.end<.5)){e.next=17;break}return n._startProgress(),n.log("[seeking in buffered range], buffer end,",a.end,", duration,",i.meta.duration),e.abrupt("return");case 17:if(u=i.getFragmentIdx(a.end),n._curLoadSegmentIdx!==u){e.next=22;break}return n._startProgress(),n.log("[seeking in buffered range], seek fragIndex is current load segmentIdx",u),e.abrupt("return");case 22:i.seekTime=a.end,u<0&&(u=n._curLoadSegmentIdx),n.log("[seeking in buffered range], seekTime ",o,",bufferRange,",a.start,"-",a.end,", fragIndex,",u);case 25:return s||(i.seekTime=o,(u=i.getFragmentIdx(o))<0&&(u=n._curLoadSegmentIdx),n.log("[seekTime out buffer range], curTime,",o,", Idx,",u),(c=n.mse)&&c.isFull()&&(l=r.buffered2.bufferedList,f=l[l.length-1],c.clearOpQueues(oO.VIDEO),n._checkRemoveSourceBuffer([f.start,f.end],r.currentTime,!0,!0))),e.next=28,i.cancelLoading();case 28:i.resetFragmentLoadState(u),n._curLoadSegmentIdx=u,n._onTimeUpdate(),n._startProgress(),n._isEnded();case 33:case"end":return e.stop()}}),e)})))),sc(n,"changeDefineCanPlay",(function(e,r,i,o){var a=n.player;a.ended?a.currentTime=0:(n.log("[oldChangeDefinition],this._changeDefState,",n._changeDefState),a.currentTime=n._changeDefState?n._changeDefState.currentTime:e,(n._changeDefState?n._changeDefState.paused:r)?a.pause():a.play(),n._changeDefState=null,a.emit(t.Events.AFTER_DEFINITION_CHANGE,{from:i,to:o}))})),sc(n,"changeDefinition",function(){var e=Qu(_y.mark((function e(r,i){var o,a,s,u,c,l,f,d,h,p,v,y;return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=(o=n).player,s=o.config,u=o.mp4,i||(i=a.curDefinition),n._MSEError=!1,c=a.definitionList,l=null,f=0;case 6:if(!(f<c.length)){e.next=14;break}if((d=c[f].definition)!==r.definition&&d!==Number(r.definition)){e.next=11;break}return l=c[f],e.abrupt("break",14);case 11:f++,e.next=6;break;case 14:if(l){e.next=17;break}return console.error("there is no definition for ",r),e.abrupt("return");case 17:if(!s.witchBitRateWay){e.next=20;break}return n.oldChangeDefinition(l,i),e.abrupt("return");case 20:if(!n.useVideoLoad){e.next=23;break}return UR.call(n.player,l,i),e.abrupt("return");case 23:if(a.emit(t.Events.DEFINITION_CHANGE,{from:i,to:l}),h=a.currentTime,(p=u.getFragmentIdx(h))<0&&(p=n._curLoadSegmentIdx),n.log("switchBitrate:point,fragIndex,",p,",startTime,",u.timeRange[p].startTime,",currentTime,",a.currentTime),!u){e.next=33;break}return n.mp4.changeBitRateTime=h,e.next=32,u.cancelLoading();case 32:u._metaLoading&&(u._metaLoading=!1);case 33:return n._removeBuffeEndTime=u.timeRange[p].startTime,n._isChangeDefinition=!0,(v=a.getBufferedRange(a.buffered))[1]>0&&v[1]-a.currentTime>5&&(n.mse.clearOpQueues(oO.VIDEO),n.mse.remove(oO.VIDEO,a.currentTime+5,v[1])),n.log("switchBitrate: resetFragmentLoadState,",p),u.resetFragmentLoadState(p),n._curLoadSegmentIdx=p,n._handlerUrl(l.url),a.config.url=l.url,y=IR(IR({},l),{},{url:n.config._mainURL}),e.next=45,n.mp4.changeBitRate(y);case 45:n._onTimeUpdate(),a.emit("RESOLUTION_UPDATE",y);case 47:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),sc(n,"_replayHook",(function(){var e;return null===(e=n.player)||void 0===e||e.play(),!1})),sc(n,"_retryHook",(function(){return n.beforePlayerInit(),!1})),sc(n,"_errorMiddleware",(function(e,t){var r=(e||{}).error,i=(n.player||{}).video;r&&r.message&&r.message.indexOf("CHUNK_DEMUXER_ERROR_APPEND_FAILED")>-1||i&&!n.useVideoLoad&&function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))}(i)?n._errorHandler(r):t(e.eventName,null==e?void 0:e.error)})),n.compatibleConfig(n.playerConfig),n.mp4=null,n.mse=null,n._waitAdjustTimeCnt=0,n._lastCheckTime=vO.nowTime(),n._removeBuffeEndTime=0,n._pendingPromises=[],n}return ac(r,e),rc(r,[{key:"compatibleConfig",value:function(e){for(var t=Object.keys(e),r=null,n=0;n<t.length;n++){var i=t[n].toLowerCase();if("mp4player"===i||"m4aplayer"===i){r=e[t[n]];break}}r&&(this.config=IR(IR({},this.config),r));var o=this.config,a=o.reqOptions,s=o.headers;!s||a&&a.headers||(this.config.reqOptions=IR(IR({},a),{},{headers:s}))}},{key:"afterCreate",value:function(){var e=this;window.__mp4player=this;try{t.BasePlugin.defineGetterOrSetter(this.player,{__url:{get:function(){try{return e.mse?e.mse.url:e.config.url}catch(e){return null}}}})}catch(e){}this._proxyPlayer()}},{key:"attachEvents",value:function(){this.off(t.Events.SEEKING,this._onSeeking),this.on(t.Events.SEEKING,this._onSeeking),this.on(t.Events.WAITING,this._onWaiting),this.off(t.Events.URL_CHANGE,this.switchURL),this.on(t.Events.URL_CHANGE,this.switchURL)}},{key:"detachEvents",value:function(){this.off(t.Events.SEEKING,this._onSeeking),this.off(t.Events.WAITING,this._onWaiting),this.off(t.Events.URL_CHANGE,this.switchURL)}},{key:"_proxyPlayer",value:function(){var e=this;"function"==typeof this.player.playNext&&(DR=this.player.playNext),this.player.playNext=function(){e.playNext.apply(e,arguments)},jR=this.player._startInit,NR=this.player.switchURL,UR=this.player.changeDefinition,this.player._startInit=this._playerStartInit.bind(this),this.player.switchURL=this.switchURL.bind(this),this.player.changeDefinition=this.changeDefinition.bind(this),this.player.useHooks("replay",this._replayHook),this.player.useHooks("retry",this._retryHook),this.player.setEventsMiddleware({error:this._errorMiddleware})}},{key:"_playerStartInit",value:function(e){var r=this,n=this.config,i=this.playerConfig;void 0===n.supportHevc&&null!==t.Sniffer&&void 0!==t.Sniffer&&t.Sniffer.isHevcSupported&&t.Sniffer.isHevcSupported()&&(n.supportHevc=!0),this._handlerUrl(i.url);var o=this.initMp4();this._initPromise=o,this._addPendingPromise(this._initPromise),this.mse&&"String"===t.Util.typeOf(e)&&/^blob/.test(e)&&e!==this.mse.url&&(e=i.url),o.then((function(){r.mse&&(e=r.mse.url),r.attachEvents(),r._startProgress()})).catch((function(n){var i=!!r._initPromise&&r._initPromise.isBreak;if(!r.isDestroy&&!i){var o=n;o.errorCode||((o=new t.Errors(r.player,{errorType:sO.RUNTIME,errorCode:(null==n?void 0:n.errorCode)||aO.other,vid:r.playerConfig.vid,errorMessage:(null==n?void 0:n.errorMessage)||(null==n?void 0:n.message),mediaError:{code:(null==n?void 0:n.httpCode)||aO.other,message:(null==n?void 0:n.errorMessage)||(null==n?void 0:n.message),errorType:null==n?void 0:n.errorType}})).url=e),r.useVideoLoad=!0,r.player.vtype="MP4_1",r.player.emit("playCatch",r.player.vtype,o)}})).finally((function(){if(r._initPromise){var t=r._initPromise.isBreak;t||(r._initPromise&&r._removePendingPromise(r._initPromise),r._initPromise=null,!r.isDestroy&&!t&&jR.call(r.player,e))}}))}},{key:"initMp4",value:function(){var e=this,t=this.player,r=this.config;t.config.vid||(t.config.vid=Date.now());var n=new PR;this.mp4&&(this.mp4.off(SR,this._onMp4MetaReady),this.mp4.off(TR,this._onMp4Error),this.mp4.off(ER,this._onMp4DataCallBack),this.mp4.destroy(),this.mp4=null);var i=r._mainURL;return this.mp4=new AR(i,IR(IR({},this.config),{},{vid:t.config.vid})),this.mp4.on(SR,this._onMp4MetaReady),this.mp4.on(TR,this._onMp4Error),this.mp4.on(ER,this._onMp4DataCallBack),this.mp4.on(OR,(function(t){e._curLoadSegmentIdx=t,e.log("[update curLoadSegmentIdx]",t)})),this.mp4.init(),n}},{key:"_handlerUrl",value:function(e){var r,n=this.config,i=this.playerConfig,o=[];if("String"===t.Util.typeOf(e))r=e,i.backupURL&&o.push(i.backupURL);else if("Array"===t.Util.typeOf(e)&&e.length>0&&(r=e[0].src,e.length>1))for(var a=1;a<e.length;a++)o.push(e[a].src);if(!r&&0===o.length)return!1;n._mainURL=r,n._backupURL=o}},{key:"setConfig",value:function(e){this.config=Object.assign(this.config,e)}},{key:"playNext",value:function(e){var t=this.player;this._defInited=!1,t.resetState(),t._currentTime=0,t._duration=0,t.isPlaying=!1,this._MSEError=!1,t.pause(),this._reset(),t.setConfig(e),this.log("[Index] playNext",e),t.play(),this.emit("playnext")}},{key:"checkDegrade",value:function(e){return!this.config.closeDowngrade||"networkError"===e.httpCode}},{key:"_errorHandler",value:function(e){var t,r=this.player,n=this.config,i=this.playerConfig;if(r&&!this.useVideoLoad){var o=n._backupURL;if(o&&o.length>0){var a=o[0];return this.mp4.update(a),this.mp4.restart(),void o.splice(0,1)}!e.url&&null!==(t=this.mp4)&&void 0!==t&&t.url&&(e.url=this.mp4.url);var s=r.paused;if(console.error("final error !!!!, ",n.vid,e),this.player.vtype="MP4_2",this.player.emit("playCatch",this.player.vtype,e),this.checkDegrade(e)){this._initPromise&&this._removeAndRejectInitPromise(e),this._reset();var u=this.mp4?this.mp4.url:i.url;this._startDegradedPlayback(e,s,u)}else{this.player.pause(),this._reset();var c=r.currentTime;this.destroyMSE(),r.currentTime=c,this.emit("error",e)}}}},{key:"_startDegradedPlayback",value:function(e,t,r){var n=this,i=this.player,o=this.playerConfig;this.useVideoLoad=!0,this.destroyMSE(),this._currentTime=i._currentTime,this.__onmetadataHandle=function(){n._currentTime&&(i.currentTime=n._currentTime),t?n.player.pause():n.player.play(),(i.media||i.video).removeEventListener("loadedmetadata",n.__onmetadataHandle),n.__onmetadataHandle=null};var a=i.media||i.video;a.addEventListener("loadedmetadata",this.__onmetadataHandle),hO(a),o.url=r,pO(i,r)}},{key:"_addPendingPromise",value:function(e){this._pendingPromises.push(e)}},{key:"_removePendingPromise",value:function(e){var t=this._pendingPromises.indexOf(e);t>-1&&this._pendingPromises.splice(t,1)}},{key:"_cancelPendingPromises",value:function(){this._pendingPromises.length>0&&this._pendingPromises.forEach((function(e){e.reject("DESTROYED")})),this._pendingPromises=[]}},{key:"_removeAndRejectInitPromise",value:function(e){this._initPromise&&(this._removePendingPromise(this._initPromise),this._initPromise.reject(e))}},{key:"_initMse",value:(o=Qu(_y.mark((function e(t){var r,n,i,o,a,s=this;return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mse){e.next=4;break}return e.next=3,this.mse.unbindMedia();case 3:this.mse=null;case 4:r=this.mp4&&this.mp4.checkCodecH265(),n=!!t.videoCodec,i=!!t.audioCodec,o=n&&i?r?'video/mp4; codecs="hev1.1.6.L93.B0, mp4a.40.5"':'video/mp4; codecs="avc1.64001E, mp4a.40.5"':n?r?'video/mp4; codecs="hev1.1.6.L93.B0"':'video/mp4; codecs="avc1.64001E"':'video/mp4; codecs="mp4a.40.5"',a=sc({},oO.VIDEO,{mimeType:"video/mp4",codec:o}),this.mse=new oO,this.mse.bindMedia(this.player.video).then((function(){var e=Object.keys(a);try{for(var t=0;t<e.length;t++){var r=e[t];s.mse.createSource(r,a[r].codec)}}catch(e){console.error("MSE error: ",e),s._errorHandler(e)}s._isMseInit=!0,s._onTimeUpdate()}));case 12:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"destroyMSE",value:(i=Qu(_y.mark((function e(){var t;return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this.mse)||void 0===t?void 0:t.unbindMedia();case 2:this.mse=null;case 3:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"_onTimeUpdate",value:function(){var e=this,t=this.mse,r=this.mp4,n=this.player,i=this.config;if(r){var o=r.timeRange,a=n.getBufferedRange(n.buffered2);if(t&&r&&r.canDownload){vO.nowTime()-this._lastCheckTime>1e3&&(this._lastCheckTime=vO.nowTime(),this._loadStuckCheck(),this._checkRemoveSourceBuffer(a,n.currentTime));var s=n.paused?n.currentTime+i.minBufferLength:n.currentTime+i.maxBufferLength;a[1]-s<0&&o.every((function(t,r){return!!t.downloaded||(!e._isChangeDefinition&&t.endTime-t.startTime>1&&e._isInBuffer(t)?(t.downloaded=!0,t.isLoading=!0,e.log("onTimeUpdate, ".concat(r," download segment, has buffer"),t.startTime,t.endTime),!0):void(t.startTime-n.currentTime<i.maxBufferLength&&(e._curLoadSegmentIdx=r,e.log("[onTimeUpdate],load index==>>>, ",r,",IdxTimeRange, ",t.startTime,"-",t.endTime,",buffEnd, ",a[1],",playCurTime,",n.currentTime,", bufferLen,",a[1]-n.currentTime,",bufferRangeList,",e.player.buffered2?e.player.buffered2.bufferedList:null),e._loadData())))})),this._isEnded()}this.checkRemoveOldBitrateBuffer()}}},{key:"checkRemoveOldBitrateBuffer",value:function(){var e=this.mse,t=this.player;e&&this._removeBuffeEndTime>0&&t.currentTime>this._removeBuffeEndTime+1&&(this.log("remove old bitrate buffer",this._removeBuffeEndTime),e.remove(oO.VIDEO,0,this._removeBuffeEndTime-1),this._removeBuffeEndTime=0)}},{key:"_isInBuffer",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=!1,n=this.player.video.buffered,i=0;i<n.length;i++){var o=n.start(i)-t,a=n.end(i)+t;if(o<=e.startTime&&e.endTime<=a){r=!0;break}}return r}},{key:"_loadData",value:(n=Qu(_y.mark((function e(){return _y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mp4&&this._isMseInit){e.next=3;break}return this.log("loadData, player.mp4 null",this._isMseInit),e.abrupt("return");case 3:return e.prev=3,e.next=6,this.mp4.load(this._curLoadSegmentIdx,this._loadDataSuccess);case 6:e.next=12;break;case 8:e.prev=8,e.t0=e.catch(3),console.error("[Index] _loadData error",this.playerConfig.vid,e.t0),this._errorHandler(e.t0);case 12:case"end":return e.stop()}}),e,this,[[3,8]])}))),function(){return n.apply(this,arguments)})},{key:"_appendInitSeg",value:function(e){var t=this;this.mp4&&this.mse&&this.mse.append(oO.VIDEO,e,{vid:this.playerConfig.vid,range:null,dataLen:e.byteLength,isinit:!0}).then((function(e){t.log("appendInitSeg end ==>>>",e.context?e.context:null,", costTime,",e.costtime)}))}},{key:"_appendBuffer",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,o=this.mse,a=this.config;o.append(e,t,{vid:a.vid,fragIndex:n.fragIndex,range:n.range,dataLen:t.byteLength,state:i}).then((function(e){if(e&&(r.log("player appendBuffer end ==>>>",e.context?e.context:null,", costTime,",e.costtime,", opt,",e.name,",bufferRange,",r.player.getBufferedRange()),r.mse&&n.state&&n.fragIndex===r.mp4.timeRange.length-1)){var t=r.player.buffered;t&&t.length>0&&(r.bufferEndTime=t.end(t.length-1)),r._isEnded(),r.log("loaded ended !!!==>>>",n.range,", fragIndex,",n.fragIndex,", bufferEndTime,",r.bufferEndTime,",meta_duration,",r.mp4.meta.duration)}})).catch((function(e){if(console.log("[MSE error]",e),e&&null!=o&&o.isFull()){var t=r.player.getBufferedRange(r.player.buffered2);r._checkRemoveSourceBuffer(t,r.player.currentTime,!0)}}))}},{key:"_checkRemoveSourceBuffer",value:function(e,t,r){var n=this,i=this.mse,o=this.mp4,a=this.player;if(i&&o&&a&&(r&&(clearTimeout(this._removeBufferTimer),this._removeBufferTimer=null),e||(e=a.getBufferedRange(a.buffered2)),t||(t=a.currentTime),!(!r&&vO.nowTime()-this._checkRemoveBufferLastTime<=this.config.removeBufferLen||this.endofstream)&&(this._checkRemoveBufferLastTime=vO.nowTime(),e&&e[0]>=0&&(t-e[0]>this.config.removeBufferLen||i.isFull())))){var s=e[1],u=o.getFragmentIdx(s);if(u>=0&&o.timeRange[u].startTime<t){var c=Math.floor(Math.min(o.timeRange[u].startTime,e[1]));e[0]<c?(this.log("[checkremoveSourceBuffer], remove range==>>>",e[0],c),i.remove(oO.VIDEO,e[0],c)):i.isFull()&&!this._removeBufferTimer&&(this._removeBufferTimer=setTimeout((function(){n._checkRemoveSourceBuffer(null,null,!0)}),1e4))}}}},{key:"_isEnded",value:function(){var e=this.player,t=this.mp4,r=e.bufferedPoint,n=r?r.end:0;return!this.endofstream&&this.mse&&t.meta.duration-e.currentTime<.5&&(this.log("[check player isEnded],deal mse.endOfStream, currentTime,",e.currentTime,", bufferend,",n,", duration,",t.meta.duration),this.endofstream=!0,this.mse.endOfStream()),!!(t&&t.meta&&t.meta.duration-e.currentTime<.5)&&(this._stopProgress(),this.log("[check player isEnded],stopProgress and endOfStream,currentTime, ",e.currentTime,", bufferend,",n,", duration,",t.meta.duration),this.mse&&this.mse.endOfStream(),!0)}},{key:"switchURL",value:function(e){if(this.useVideoLoad){var t=this.player,r=t.currentTime;pO(t,e),t.once("canplay",(function(){t.currentTime=r})),t.play()}else this.changeDefinition(e)}},{key:"oldChangeDefinition",value:function(e,t){var r=this,n=this.config,i=this.player;this.log("[oldChangeDefinition],currentTime,",i.currentTime,",from,",t,",to,",e);var o=i.currentTime,a=i.paused;this._changeDefState||(this._changeDefState={currentTime:o,paused:a},this.log("[oldChangeDefinition],currentTime,",i.currentTime,",pause,",a)),i.config.url=e.url,n.focusUserDefinition=!0,i.currentTime=0,i.pause(),this._reset(),this._isMseInit=!1,this._changeDefineCanPlay&&i.off("canplay",this._changeDefineCanPlay),this._changeDefineCanPlay=function(){r.changeDefineCanPlay(o,a,t,e),r._changeDefineCanPlay=null},i.once("canplay",this._changeDefineCanPlay),this.player.video.load(),this.initMp4()}},{key:"_loadStuckCheck",value:function(){var e=this,r=this.config,n=this.player,i=this.playerConfig;r.disableBufferBreakCheck||(n.currentTime-(this._lastCurrentTime||0)>.1||n.paused?1!==this._bufferBreakFlag&&2!==this._bufferBreakFlag||(this.log("视频没有卡死,重置卡死标记"),this._bufferBreakFlag=0,clearTimeout(this._bufferBreakTimer),this._bufferBreakFlag=null):this._bufferBreakFlag||(this._bufferBreakFlag=1,this.log("卡死计时开始! 持续".concat(r.waitingTimeOut,"毫秒则确认卡死")),this._bufferBreakTimer=setTimeout((function(){e.isDestroy||(1===e._bufferBreakFlag&&(e._bufferBreakFlag=2,e.log("确认卡死!!!"),e._errorHandler(new t.Errors(e.player,{errorType:"runtime",errorTypeCode:sO.runtime,errorCode:aO.waitTimeout,errorMessage:"wait_timeout",vid:i.vid}))),e._bufferBreakTimer=null)}),r.waitingTimeOut)),this._lastCurrentTime=n.currentTime)}},{key:"isDestroy",get:function(){return!this.player}},{key:"_stopProgress",value:function(){this._hasStartProgress=!1,this._requestTimer&&(this._requestTimer.stop(),this._requestTimer=null),this._bufferBreakTimer&&(clearTimeout(this._bufferBreakTimer),this._bufferBreakTimer=null,this._bufferBreakFlag=void 0)}},{key:"_startProgress",value:function(){var e=this;this._hasStartProgress||(this._stopProgress(),this._requestTimer=new LR((function(){e._requestTimer&&e._onTimeUpdate()})),this._requestTimer.tickEvery(this.config.tickInSeconds),this._hasStartProgress=!0)}},{key:"log",value:function(e){for(var t=this.playerConfig,r=t&&t.vid?"[Index]".concat(t.vid," ").concat(e):"[Index] ".concat(e),n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];bR.apply(void 0,[r].concat(i))}},{key:"_reset",value:function(){this._isMseInit=!1,this.endofstream=!1,this._curLoadSegmentIdx=0,this._removeBuffeEndTime=0,this._isChangeDefinition=!1,this._stopProgress(),this.mp4&&(this.mp4.off(SR,this._onMp4MetaReady),this.mp4.off(TR,this._onMp4Error),this.mp4.off(ER,this._onMp4DataCallBack),this.mp4.destroy(),this.mp4=null),this.mse&&(this.mse.unbindMedia(),this.mse=null),hO(this.player.video)}},{key:"destroy",value:function(){var e=this.player;e.removeHooks("replay",this._replayHook),e.removeHooks("retry",this._retryHook),e.removeEventsMiddleware({error:this._errorMiddleware}),this.detachEvents(),this._reset(),this.player.playNext=DR,this.player._startInit=jR,this.player.changeDefinition=UR,this.player.switchURL=NR,this._bufferBreakTimer&&clearInterval(this._bufferBreakTimer),this._removeBufferTimer&&(clearTimeout(this._removeBufferTimer),this._removeBufferTimer=null),this._waitInBufferTimer&&(clearTimeout(this._waitInBufferTimer),this._waitInBufferTimer=null)}}],[{key:"pluginName",get:function(){return"mp4Plugin"}},{key:"defaultConfig",get:function(){return{maxBufferLength:40,minBufferLength:5,disableBufferBreakCheck:!1,waitingTimeOut:15e3,waitingInBufferTimeOut:5e3,waitJampBufferMaxCnt:3,tickInSeconds:.1,reqOptions:null,closeDowngrade:!1}}},{key:"version",get:function(){return"3.0.0-alpha.26"}}]);var n,i,o}(t.BasePlugin);e.M4aPlayer=FR,e.default=FR,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("xgplayer")):"function"==typeof define&&define.amd?define(["exports","xgplayer"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Mp4Plugin={},e.Player)}(this,(function(e,t){"use strict";var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=function(e){return e&&e.Math===Math&&e},i=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r&&r)||n("object"==typeof r&&r)||function(){return this}()||Function("return this")(),o={},a=function(e){try{return!!e()}catch(e){return!0}},s=!a((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),u=!a((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),c=u,f=Function.prototype.call,l=c?f.bind(f):function(){return f.apply(f,arguments)},d={},h={}.propertyIsEnumerable,p=Object.getOwnPropertyDescriptor,v=p&&!h.call({1:2},1);d.f=v?function(e){var t=p(this,e);return!!t&&t.enumerable}:h;var g,m,y=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},b=u,_=Function.prototype,w=_.call,T=b&&_.bind.bind(w,w),x=b?T:function(e){return function(){return w.apply(e,arguments)}},k=x,S=k({}.toString),E=k("".slice),O=function(e){return E(S(e),8,-1)},R=a,P=O,L=Object,A=x("".split),I=R((function(){return!L("z").propertyIsEnumerable(0)}))?function(e){return"String"===P(e)?A(e,""):L(e)}:L,M=function(e){return null==e},C=M,D=TypeError,j=function(e){if(C(e))throw new D("Can't call method on "+e);return e},B=I,U=j,N=function(e){return B(U(e))},F="object"==typeof document&&document.all,z=void 0===F&&void 0!==F?function(e){return"function"==typeof e||e===F}:function(e){return"function"==typeof e},V=z,H=function(e){return"object"==typeof e?null!==e:V(e)},q=i,G=z,K=function(e,t){return arguments.length<2?(r=q[e],G(r)?r:void 0):q[e]&&q[e][t];var r},W=x({}.isPrototypeOf),Y="undefined"!=typeof navigator&&String(navigator.userAgent)||"",J=i,X=Y,Q=J.process,$=J.Deno,Z=Q&&Q.versions||$&&$.version,ee=Z&&Z.v8;ee&&(m=(g=ee.split("."))[0]>0&&g[0]<4?1:+(g[0]+g[1])),!m&&X&&(!(g=X.match(/Edge\/(\d+)/))||g[1]>=74)&&(g=X.match(/Chrome\/(\d+)/))&&(m=+g[1]);var te=m,re=te,ne=a,ie=i.String,oe=!!Object.getOwnPropertySymbols&&!ne((function(){var e=Symbol("symbol detection");return!ie(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&re&&re<41})),ae=oe&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,se=K,ue=z,ce=W,fe=Object,le=ae?function(e){return"symbol"==typeof e}:function(e){var t=se("Symbol");return ue(t)&&ce(t.prototype,fe(e))},de=String,he=function(e){try{return de(e)}catch(e){return"Object"}},pe=z,ve=he,ge=TypeError,me=function(e){if(pe(e))return e;throw new ge(ve(e)+" is not a function")},ye=me,be=M,_e=function(e,t){var r=e[t];return be(r)?void 0:ye(r)},we=l,Te=z,xe=H,ke=TypeError,Se={exports:{}},Ee=i,Oe=Object.defineProperty,Re=function(e,t){try{Oe(Ee,e,{value:t,configurable:!0,writable:!0})}catch(r){Ee[e]=t}return t},Pe=i,Le=Re,Ae="__core-js_shared__",Ie=Se.exports=Pe[Ae]||Le(Ae,{});(Ie.versions||(Ie.versions=[])).push({version:"3.37.0",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.37.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Me=Se.exports,Ce=function(e,t){return Me[e]||(Me[e]=t||{})},De=j,je=Object,Be=function(e){return je(De(e))},Ue=Be,Ne=x({}.hasOwnProperty),Fe=Object.hasOwn||function(e,t){return Ne(Ue(e),t)},ze=x,Ve=0,He=Math.random(),qe=ze(1..toString),Ge=function(e){return"Symbol("+(void 0===e?"":e)+")_"+qe(++Ve+He,36)},Ke=Ce,We=Fe,Ye=Ge,Je=oe,Xe=ae,Qe=i.Symbol,$e=Ke("wks"),Ze=Xe?Qe.for||Qe:Qe&&Qe.withoutSetter||Ye,et=function(e){return We($e,e)||($e[e]=Je&&We(Qe,e)?Qe[e]:Ze("Symbol."+e)),$e[e]},tt=l,rt=H,nt=le,it=_e,ot=function(e,t){var r,n;if("string"===t&&Te(r=e.toString)&&!xe(n=we(r,e)))return n;if(Te(r=e.valueOf)&&!xe(n=we(r,e)))return n;if("string"!==t&&Te(r=e.toString)&&!xe(n=we(r,e)))return n;throw new ke("Can't convert object to primitive value")},at=TypeError,st=et("toPrimitive"),ut=function(e,t){if(!rt(e)||nt(e))return e;var r,n=it(e,st);if(n){if(void 0===t&&(t="default"),r=tt(n,e,t),!rt(r)||nt(r))return r;throw new at("Can't convert object to primitive value")}return void 0===t&&(t="number"),ot(e,t)},ct=ut,ft=le,lt=function(e){var t=ct(e,"string");return ft(t)?t:t+""},dt=H,ht=i.document,pt=dt(ht)&&dt(ht.createElement),vt=function(e){return pt?ht.createElement(e):{}},gt=vt,mt=!s&&!a((function(){return 7!==Object.defineProperty(gt("div"),"a",{get:function(){return 7}}).a})),yt=s,bt=l,_t=d,wt=y,Tt=N,xt=lt,kt=Fe,St=mt,Et=Object.getOwnPropertyDescriptor;o.f=yt?Et:function(e,t){if(e=Tt(e),t=xt(t),St)try{return Et(e,t)}catch(e){}if(kt(e,t))return wt(!bt(_t.f,e,t),e[t])};var Ot={},Rt=s&&a((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Pt=H,Lt=String,At=TypeError,It=function(e){if(Pt(e))return e;throw new At(Lt(e)+" is not an object")},Mt=s,Ct=mt,Dt=Rt,jt=It,Bt=lt,Ut=TypeError,Nt=Object.defineProperty,Ft=Object.getOwnPropertyDescriptor,zt="enumerable",Vt="configurable",Ht="writable";Ot.f=Mt?Dt?function(e,t,r){if(jt(e),t=Bt(t),jt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Ht in r&&!r[Ht]){var n=Ft(e,t);n&&n[Ht]&&(e[t]=r.value,r={configurable:Vt in r?r[Vt]:n[Vt],enumerable:zt in r?r[zt]:n[zt],writable:!1})}return Nt(e,t,r)}:Nt:function(e,t,r){if(jt(e),t=Bt(t),jt(r),Ct)try{return Nt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new Ut("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var qt=Ot,Gt=y,Kt=s?function(e,t,r){return qt.f(e,t,Gt(1,r))}:function(e,t,r){return e[t]=r,e},Wt={exports:{}},Yt=s,Jt=Fe,Xt=Function.prototype,Qt=Yt&&Object.getOwnPropertyDescriptor,$t=Jt(Xt,"name"),Zt={EXISTS:$t,PROPER:$t&&"something"===function(){}.name,CONFIGURABLE:$t&&(!Yt||Yt&&Qt(Xt,"name").configurable)},er=x,tr=z,rr=Se.exports,nr=er(Function.toString);tr(rr.inspectSource)||(rr.inspectSource=function(e){return nr(e)});var ir,or,ar,sr=rr.inspectSource,ur=z,cr=i.WeakMap,fr=ur(cr)&&/native code/.test(String(cr)),lr=Ge,dr=Ce("keys"),hr=function(e){return dr[e]||(dr[e]=lr(e))},pr={},vr=fr,gr=i,mr=H,yr=Kt,br=Fe,_r=Se.exports,wr=hr,Tr=pr,xr="Object already initialized",kr=gr.TypeError,Sr=gr.WeakMap;if(vr||_r.state){var Er=_r.state||(_r.state=new Sr);Er.get=Er.get,Er.has=Er.has,Er.set=Er.set,ir=function(e,t){if(Er.has(e))throw new kr(xr);return t.facade=e,Er.set(e,t),t},or=function(e){return Er.get(e)||{}},ar=function(e){return Er.has(e)}}else{var Or=wr("state");Tr[Or]=!0,ir=function(e,t){if(br(e,Or))throw new kr(xr);return t.facade=e,yr(e,Or,t),t},or=function(e){return br(e,Or)?e[Or]:{}},ar=function(e){return br(e,Or)}}var Rr={set:ir,get:or,has:ar,enforce:function(e){return ar(e)?or(e):ir(e,{})},getterFor:function(e){return function(t){var r;if(!mr(t)||(r=or(t)).type!==e)throw new kr("Incompatible receiver, "+e+" required");return r}}},Pr=x,Lr=a,Ar=z,Ir=Fe,Mr=s,Cr=Zt.CONFIGURABLE,Dr=sr,jr=Rr.enforce,Br=Rr.get,Ur=String,Nr=Object.defineProperty,Fr=Pr("".slice),zr=Pr("".replace),Vr=Pr([].join),Hr=Mr&&!Lr((function(){return 8!==Nr((function(){}),"length",{value:8}).length})),qr=String(String).split("String"),Gr=Wt.exports=function(e,t,r){"Symbol("===Fr(Ur(t),0,7)&&(t="["+zr(Ur(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!Ir(e,"name")||Cr&&e.name!==t)&&(Mr?Nr(e,"name",{value:t,configurable:!0}):e.name=t),Hr&&r&&Ir(r,"arity")&&e.length!==r.arity&&Nr(e,"length",{value:r.arity});try{r&&Ir(r,"constructor")&&r.constructor?Mr&&Nr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=jr(e);return Ir(n,"source")||(n.source=Vr(qr,"string"==typeof t?t:"")),e};Function.prototype.toString=Gr((function(){return Ar(this)&&Br(this).source||Dr(this)}),"toString");var Kr=z,Wr=Ot,Yr=Wt.exports,Jr=Re,Xr=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(Kr(r)&&Yr(r,o,n),n.global)i?e[t]=r:Jr(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(e){}i?e[t]=r:Wr.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Qr={},$r=Math.ceil,Zr=Math.floor,en=Math.trunc||function(e){var t=+e;return(t>0?Zr:$r)(t)},tn=function(e){var t=+e;return t!=t||0===t?0:en(t)},rn=tn,nn=Math.max,on=Math.min,an=function(e,t){var r=rn(e);return r<0?nn(r+t,0):on(r,t)},sn=tn,un=Math.min,cn=function(e){var t=sn(e);return t>0?un(t,9007199254740991):0},fn=cn,ln=function(e){return fn(e.length)},dn=N,hn=an,pn=ln,vn=function(e){return function(t,r,n){var i=dn(t),o=pn(i);if(0===o)return!e&&-1;var a,s=hn(n,o);if(e&&r!=r){for(;o>s;)if((a=i[s++])!=a)return!0}else for(;o>s;s++)if((e||s in i)&&i[s]===r)return e||s||0;return!e&&-1}},gn={includes:vn(!0),indexOf:vn(!1)},mn=Fe,yn=N,bn=gn.indexOf,_n=pr,wn=x([].push),Tn=function(e,t){var r,n=yn(e),i=0,o=[];for(r in n)!mn(_n,r)&&mn(n,r)&&wn(o,r);for(;t.length>i;)mn(n,r=t[i++])&&(~bn(o,r)||wn(o,r));return o},xn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],kn=Tn,Sn=xn.concat("length","prototype");Qr.f=Object.getOwnPropertyNames||function(e){return kn(e,Sn)};var En={};En.f=Object.getOwnPropertySymbols;var On=K,Rn=Qr,Pn=En,Ln=It,An=x([].concat),In=On("Reflect","ownKeys")||function(e){var t=Rn.f(Ln(e)),r=Pn.f;return r?An(t,r(e)):t},Mn=Fe,Cn=In,Dn=o,jn=Ot,Bn=function(e,t,r){for(var n=Cn(t),i=jn.f,o=Dn.f,a=0;a<n.length;a++){var s=n[a];Mn(e,s)||r&&Mn(r,s)||i(e,s,o(t,s))}},Un=a,Nn=z,Fn=/#|\.prototype\./,zn=function(e,t){var r=Hn[Vn(e)];return r===Gn||r!==qn&&(Nn(t)?Un(t):!!t)},Vn=zn.normalize=function(e){return String(e).replace(Fn,".").toLowerCase()},Hn=zn.data={},qn=zn.NATIVE="N",Gn=zn.POLYFILL="P",Kn=zn,Wn=i,Yn=o.f,Jn=Kt,Xn=Xr,Qn=Re,$n=Bn,Zn=Kn,ei=function(e,t){var r,n,i,o,a,s=e.target,u=e.global,c=e.stat;if(r=u?Wn:c?Wn[s]||Qn(s,{}):Wn[s]&&Wn[s].prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(a=Yn(r,n))&&a.value:r[n],!Zn(u?n:s+(c?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;$n(o,i)}(e.sham||i&&i.sham)&&Jn(o,"sham",!0),Xn(r,n,o,e)}},ti={};ti[et("toStringTag")]="z";var ri="[object z]"===String(ti),ni=ri,ii=z,oi=O,ai=et("toStringTag"),si=Object,ui="Arguments"===oi(function(){return arguments}()),ci=ni?oi: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=si(e),ai))?r:ui?oi(t):"Object"===(n=oi(t))&&ii(t.callee)?"Arguments":n},fi=ci,li=String,di=function(e){if("Symbol"===fi(e))throw new TypeError("Cannot convert a Symbol value to a string");return li(e)},hi={},pi=Tn,vi=xn,gi=Object.keys||function(e){return pi(e,vi)},mi=s,yi=Rt,bi=Ot,_i=It,wi=N,Ti=gi;hi.f=mi&&!yi?Object.defineProperties:function(e,t){_i(e);for(var r,n=wi(t),i=Ti(t),o=i.length,a=0;o>a;)bi.f(e,r=i[a++],n[r]);return e};var xi,ki=K("document","documentElement"),Si=It,Ei=hi,Oi=xn,Ri=pr,Pi=ki,Li=vt,Ai="prototype",Ii="script",Mi=hr("IE_PROTO"),Ci=function(){},Di=function(e){return"<"+Ii+">"+e+"</"+Ii+">"},ji=function(e){e.write(Di("")),e.close();var t=e.parentWindow.Object;return e=null,t},Bi=function(){try{xi=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Bi="undefined"!=typeof document?document.domain&&xi?ji(xi):(t=Li("iframe"),r="java"+Ii+":",t.style.display="none",Pi.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(Di("document.F=Object")),e.close(),e.F):ji(xi);for(var n=Oi.length;n--;)delete Bi[Ai][Oi[n]];return Bi()};Ri[Mi]=!0;var Ui=Object.create||function(e,t){var r;return null!==e?(Ci[Ai]=Si(e),r=new Ci,Ci[Ai]=null,r[Mi]=e):r=Bi(),void 0===t?r:Ei.f(r,t)},Ni={},Fi=x([].slice),zi=O,Vi=N,Hi=Qr.f,qi=Fi,Gi="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Ni.f=function(e){return Gi&&"Window"===zi(e)?function(e){try{return Hi(e)}catch(e){return qi(Gi)}}(e):Hi(Vi(e))};var Ki=Wt.exports,Wi=Ot,Yi=function(e,t,r){return r.get&&Ki(r.get,t,{getter:!0}),r.set&&Ki(r.set,t,{setter:!0}),Wi.f(e,t,r)},Ji={},Xi=et;Ji.f=Xi;var Qi=i,$i=Qi,Zi=Fe,eo=Ji,to=Ot.f,ro=l,no=K,io=et,oo=Xr,ao=Ot.f,so=Fe,uo=et("toStringTag"),co=function(e,t,r){e&&!r&&(e=e.prototype),e&&!so(e,uo)&&ao(e,uo,{configurable:!0,value:t})},fo=O,lo=x,ho=function(e){if("Function"===fo(e))return lo(e)},po=me,vo=u,go=ho(ho.bind),mo=function(e,t){return po(e),void 0===t?e:vo?go(e,t):function(){return e.apply(t,arguments)}},yo=O,bo=Array.isArray||function(e){return"Array"===yo(e)},_o=x,wo=a,To=z,xo=ci,ko=sr,So=function(){},Eo=K("Reflect","construct"),Oo=/^\s*(?:class|function)\b/,Ro=_o(Oo.exec),Po=!Oo.test(So),Lo=function(e){if(!To(e))return!1;try{return Eo(So,[],e),!0}catch(e){return!1}},Ao=function(e){if(!To(e))return!1;switch(xo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Po||!!Ro(Oo,ko(e))}catch(e){return!0}};Ao.sham=!0;var Io=!Eo||wo((function(){var e;return Lo(Lo.call)||!Lo(Object)||!Lo((function(){e=!0}))||e}))?Ao:Lo,Mo=bo,Co=Io,Do=H,jo=et("species"),Bo=Array,Uo=function(e){var t;return Mo(e)&&(t=e.constructor,(Co(t)&&(t===Bo||Mo(t.prototype))||Do(t)&&null===(t=t[jo]))&&(t=void 0)),void 0===t?Bo:t},No=function(e,t){return new(Uo(e))(0===t?0:t)},Fo=mo,zo=I,Vo=Be,Ho=ln,qo=No,Go=x([].push),Ko=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(u,c,f,l){for(var d,h,p=Vo(u),v=zo(p),g=Ho(v),m=Fo(c,f),y=0,b=l||qo,_=t?b(u,g):r||a?b(u,0):void 0;g>y;y++)if((s||y in v)&&(h=m(d=v[y],y,p),e))if(t)_[y]=h;else if(h)switch(e){case 3:return!0;case 5:return d;case 6:return y;case 2:Go(_,d)}else switch(e){case 4:return!1;case 7:Go(_,d)}return o?-1:n||i?i:_}},Wo={forEach:Ko(0),map:Ko(1),filter:Ko(2),some:Ko(3),every:Ko(4),find:Ko(5),findIndex:Ko(6),filterReject:Ko(7)},Yo=ei,Jo=i,Xo=l,Qo=x,$o=s,Zo=oe,ea=a,ta=Fe,ra=W,na=It,ia=N,oa=lt,aa=di,sa=y,ua=Ui,ca=gi,fa=Qr,la=Ni,da=En,ha=o,pa=Ot,va=hi,ga=d,ma=Xr,ya=Yi,ba=Ce,_a=pr,wa=Ge,Ta=et,xa=Ji,ka=function(e){var t=$i.Symbol||($i.Symbol={});Zi(t,e)||to(t,e,{value:eo.f(e)})},Sa=function(){var e=no("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=io("toPrimitive");t&&!t[n]&&oo(t,n,(function(e){return ro(r,this)}),{arity:1})},Ea=co,Oa=Rr,Ra=Wo.forEach,Pa=hr("hidden"),La="Symbol",Aa="prototype",Ia=Oa.set,Ma=Oa.getterFor(La),Ca=Object[Aa],Da=Jo.Symbol,ja=Da&&Da[Aa],Ba=Jo.RangeError,Ua=Jo.TypeError,Na=Jo.QObject,Fa=ha.f,za=pa.f,Va=la.f,Ha=ga.f,qa=Qo([].push),Ga=ba("symbols"),Ka=ba("op-symbols"),Wa=ba("wks"),Ya=!Na||!Na[Aa]||!Na[Aa].findChild,Ja=function(e,t,r){var n=Fa(Ca,t);n&&delete Ca[t],za(e,t,r),n&&e!==Ca&&za(Ca,t,n)},Xa=$o&&ea((function(){return 7!==ua(za({},"a",{get:function(){return za(this,"a",{value:7}).a}})).a}))?Ja:za,Qa=function(e,t){var r=Ga[e]=ua(ja);return Ia(r,{type:La,tag:e,description:t}),$o||(r.description=t),r},$a=function(e,t,r){e===Ca&&$a(Ka,t,r),na(e);var n=oa(t);return na(r),ta(Ga,n)?(r.enumerable?(ta(e,Pa)&&e[Pa][n]&&(e[Pa][n]=!1),r=ua(r,{enumerable:sa(0,!1)})):(ta(e,Pa)||za(e,Pa,sa(1,ua(null))),e[Pa][n]=!0),Xa(e,n,r)):za(e,n,r)},Za=function(e,t){na(e);var r=ia(t),n=ca(r).concat(ns(r));return Ra(n,(function(t){$o&&!Xo(es,r,t)||$a(e,t,r[t])})),e},es=function(e){var t=oa(e),r=Xo(Ha,this,t);return!(this===Ca&&ta(Ga,t)&&!ta(Ka,t))&&(!(r||!ta(this,t)||!ta(Ga,t)||ta(this,Pa)&&this[Pa][t])||r)},ts=function(e,t){var r=ia(e),n=oa(t);if(r!==Ca||!ta(Ga,n)||ta(Ka,n)){var i=Fa(r,n);return!i||!ta(Ga,n)||ta(r,Pa)&&r[Pa][n]||(i.enumerable=!0),i}},rs=function(e){var t=Va(ia(e)),r=[];return Ra(t,(function(e){ta(Ga,e)||ta(_a,e)||qa(r,e)})),r},ns=function(e){var t=e===Ca,r=Va(t?Ka:ia(e)),n=[];return Ra(r,(function(e){!ta(Ga,e)||t&&!ta(Ca,e)||qa(n,Ga[e])})),n};Zo||(Da=function(){if(ra(ja,this))throw new Ua("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?aa(arguments[0]):void 0,t=wa(e),r=function(e){var n=void 0===this?Jo:this;n===Ca&&Xo(r,Ka,e),ta(n,Pa)&&ta(n[Pa],t)&&(n[Pa][t]=!1);var i=sa(1,e);try{Xa(n,t,i)}catch(e){if(!(e instanceof Ba))throw e;Ja(n,t,i)}};return $o&&Ya&&Xa(Ca,t,{configurable:!0,set:r}),Qa(t,e)},ma(ja=Da[Aa],"toString",(function(){return Ma(this).tag})),ma(Da,"withoutSetter",(function(e){return Qa(wa(e),e)})),ga.f=es,pa.f=$a,va.f=Za,ha.f=ts,fa.f=la.f=rs,da.f=ns,xa.f=function(e){return Qa(Ta(e),e)},$o&&(ya(ja,"description",{configurable:!0,get:function(){return Ma(this).description}}),ma(Ca,"propertyIsEnumerable",es,{unsafe:!0}))),Yo({global:!0,constructor:!0,wrap:!0,forced:!Zo,sham:!Zo},{Symbol:Da}),Ra(ca(Wa),(function(e){ka(e)})),Yo({target:La,stat:!0,forced:!Zo},{useSetter:function(){Ya=!0},useSimple:function(){Ya=!1}}),Yo({target:"Object",stat:!0,forced:!Zo,sham:!$o},{create:function(e,t){return void 0===t?ua(e):Za(ua(e),t)},defineProperty:$a,defineProperties:Za,getOwnPropertyDescriptor:ts}),Yo({target:"Object",stat:!0,forced:!Zo},{getOwnPropertyNames:rs}),Sa(),Ea(Da,La),_a[Pa]=!0;var is=oe&&!!Symbol.for&&!!Symbol.keyFor,os=ei,as=K,ss=Fe,us=di,cs=Ce,fs=is,ls=cs("string-to-symbol-registry"),ds=cs("symbol-to-string-registry");os({target:"Symbol",stat:!0,forced:!fs},{for:function(e){var t=us(e);if(ss(ls,t))return ls[t];var r=as("Symbol")(t);return ls[t]=r,ds[r]=t,r}});var hs=ei,ps=Fe,vs=le,gs=he,ms=is,ys=Ce("symbol-to-string-registry");hs({target:"Symbol",stat:!0,forced:!ms},{keyFor:function(e){if(!vs(e))throw new TypeError(gs(e)+" is not a symbol");if(ps(ys,e))return ys[e]}});var bs=u,_s=Function.prototype,ws=_s.apply,Ts=_s.call,xs="object"==typeof Reflect&&Reflect.apply||(bs?Ts.bind(ws):function(){return Ts.apply(ws,arguments)}),ks=bo,Ss=z,Es=O,Os=di,Rs=x([].push),Ps=ei,Ls=K,As=xs,Is=l,Ms=x,Cs=a,Ds=z,js=le,Bs=Fi,Us=function(e){if(Ss(e))return e;if(ks(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?Rs(r,i):"number"!=typeof i&&"Number"!==Es(i)&&"String"!==Es(i)||Rs(r,Os(i))}var o=r.length,a=!0;return function(e,t){if(a)return a=!1,t;if(ks(this))return t;for(var n=0;n<o;n++)if(r[n]===e)return t}}},Ns=oe,Fs=String,zs=Ls("JSON","stringify"),Vs=Ms(/./.exec),Hs=Ms("".charAt),qs=Ms("".charCodeAt),Gs=Ms("".replace),Ks=Ms(1..toString),Ws=/[\uD800-\uDFFF]/g,Ys=/^[\uD800-\uDBFF]$/,Js=/^[\uDC00-\uDFFF]$/,Xs=!Ns||Cs((function(){var e=Ls("Symbol")("stringify detection");return"[null]"!==zs([e])||"{}"!==zs({a:e})||"{}"!==zs(Object(e))})),Qs=Cs((function(){return'"\\udf06\\ud834"'!==zs("\udf06\ud834")||'"\\udead"'!==zs("\udead")})),$s=function(e,t){var r=Bs(arguments),n=Us(t);if(Ds(n)||void 0!==e&&!js(e))return r[1]=function(e,t){if(Ds(n)&&(t=Is(n,this,Fs(e),t)),!js(t))return t},As(zs,null,r)},Zs=function(e,t,r){var n=Hs(r,t-1),i=Hs(r,t+1);return Vs(Ys,e)&&!Vs(Js,i)||Vs(Js,e)&&!Vs(Ys,n)?"\\u"+Ks(qs(e,0),16):e};zs&&Ps({target:"JSON",stat:!0,arity:3,forced:Xs||Qs},{stringify:function(e,t,r){var n=Bs(arguments),i=As(Xs?$s:zs,null,n);return Qs&&"string"==typeof i?Gs(i,Ws,Zs):i}});var eu=En,tu=Be;ei({target:"Object",stat:!0,forced:!oe||a((function(){eu.f(1)}))},{getOwnPropertySymbols:function(e){var t=eu.f;return t?t(tu(e)):[]}});var ru=a,nu=te,iu=et("species"),ou=function(e){return nu>=51||!ru((function(){var t=[];return(t.constructor={})[iu]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},au=Wo.filter;ei({target:"Array",proto:!0,forced:!ou("filter")},{filter:function(e){return au(this,e,arguments.length>1?arguments[1]:void 0)}});var su=ei,uu=a,cu=N,fu=o.f,lu=s;su({target:"Object",stat:!0,forced:!lu||uu((function(){fu(1)})),sham:!lu},{getOwnPropertyDescriptor:function(e,t){return fu(cu(e),t)}});var du=s,hu=Ot,pu=y,vu=function(e,t,r){du?hu.f(e,t,pu(0,r)):e[t]=r},gu=In,mu=N,yu=o,bu=vu;ei({target:"Object",stat:!0,sham:!s},{getOwnPropertyDescriptors:function(e){for(var t,r,n=mu(e),i=yu.f,o=gu(n),a={},s=0;o.length>s;)void 0!==(r=i(n,t=o[s++]))&&bu(a,t,r);return a}});var _u=x,wu=me,Tu=H,xu=Fe,ku=Fi,Su=u,Eu=Function,Ou=_u([].concat),Ru=_u([].join),Pu={},Lu=Su?Eu.bind:function(e){var t=wu(this),r=t.prototype,n=ku(arguments,1),i=function(){var r=Ou(n,ku(arguments));return this instanceof i?function(e,t,r){if(!xu(Pu,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";Pu[t]=Eu("C,a","return new C("+Ru(n,",")+")")}return Pu[t](e,r)}(t,r.length,r):t.apply(e,r)};return Tu(r)&&(i.prototype=r),i},Au=Io,Iu=he,Mu=TypeError,Cu=function(e){if(Au(e))return e;throw new Mu(Iu(e)+" is not a constructor")},Du=ei,ju=xs,Bu=Lu,Uu=Cu,Nu=It,Fu=H,zu=Ui,Vu=a,Hu=K("Reflect","construct"),qu=Object.prototype,Gu=[].push,Ku=Vu((function(){function e(){}return!(Hu((function(){}),[],e)instanceof e)})),Wu=!Vu((function(){Hu((function(){}))})),Yu=Ku||Wu;function Ju(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function Xu(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Ju(o,n,i,a,s,"next",e)}function s(e){Ju(o,n,i,a,s,"throw",e)}a(void 0)}))}}function Qu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $u(e){return $u="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},$u(e)}function Zu(e){var t=function(e,t){if("object"!=$u(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=$u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==$u(t)?t:t+""}function ec(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Zu(n.key),n)}}function tc(e,t,r){return t&&ec(e.prototype,t),r&&ec(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function rc(e,t){if(t&&("object"===$u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function nc(e){return nc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},nc(e)}function ic(e,t){return ic=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ic(e,t)}function oc(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ic(e,t)}function ac(e,t,r){return(t=Zu(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Du({target:"Reflect",stat:!0,forced:Yu,sham:Yu},{construct:function(e,t){Uu(e),Nu(t);var r=arguments.length<3?e:Uu(arguments[2]);if(Wu&&!Ku)return Hu(e,t,r);if(e===r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return ju(Gu,n,t),new(ju(Bu,e,n))}var i=r.prototype,o=zu(Fu(i)?i:qu),a=ju(e,o,t);return Fu(a)?a:o}});var sc=TypeError,uc=function(e){if(e>9007199254740991)throw sc("Maximum allowed index exceeded");return e},cc=ei,fc=a,lc=bo,dc=H,hc=Be,pc=ln,vc=uc,gc=vu,mc=No,yc=ou,bc=te,_c=et("isConcatSpreadable"),wc=bc>=51||!fc((function(){var e=[];return e[_c]=!1,e.concat()[0]!==e})),Tc=function(e){if(!dc(e))return!1;var t=e[_c];return void 0!==t?!!t:lc(e)};cc({target:"Array",proto:!0,arity:1,forced:!wc||!yc("concat")},{concat:function(e){var t,r,n,i,o,a=hc(this),s=mc(a,0),u=0;for(t=-1,n=arguments.length;t<n;t++)if(Tc(o=-1===t?a:arguments[t]))for(i=pc(o),vc(u+i),r=0;r<i;r++,u++)r in o&&gc(s,u,o[r]);else vc(u+1),gc(s,u++,o);return s.length=u,s}});var xc=s,kc=bo,Sc=TypeError,Ec=Object.getOwnPropertyDescriptor,Oc=xc&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}(),Rc=he,Pc=TypeError,Lc=function(e,t){if(!delete e[t])throw new Pc("Cannot delete property "+Rc(t)+" of "+Rc(e))},Ac=ei,Ic=Be,Mc=an,Cc=tn,Dc=ln,jc=Oc?function(e,t){if(kc(e)&&!Ec(e,"length").writable)throw new Sc("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},Bc=uc,Uc=No,Nc=vu,Fc=Lc,zc=ou("splice"),Vc=Math.max,Hc=Math.min;Ac({target:"Array",proto:!0,forced:!zc},{splice:function(e,t){var r,n,i,o,a,s,u=Ic(this),c=Dc(u),f=Mc(e,c),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=c-f):(r=l-2,n=Hc(Vc(Cc(t),0),c-f)),Bc(c+r-n),i=Uc(u,n),o=0;o<n;o++)(a=f+o)in u&&Nc(i,o,u[a]);if(i.length=n,r<n){for(o=f;o<c-n;o++)s=o+r,(a=o+n)in u?u[s]=u[a]:Fc(u,s);for(o=c;o>c-n+r;o--)Fc(u,o-1)}else if(r>n)for(o=c-n;o>f;o--)s=o+r-1,(a=o+n-1)in u?u[s]=u[a]:Fc(u,s);for(o=0;o<r;o++)u[o+f]=arguments[o+2];return jc(u,c-n+r),i}});var qc=s,Gc=Zt.EXISTS,Kc=x,Wc=Yi,Yc=Function.prototype,Jc=Kc(Yc.toString),Xc=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Qc=Kc(Xc.exec);qc&&!Gc&&Wc(Yc,"name",{configurable:!0,get:function(){try{return Qc(Xc,Jc(this))[1]}catch(e){return""}}});var $c=x,Zc=me,ef=H,tf=function(e){return ef(e)||null===e},rf=String,nf=TypeError,of=function(e,t,r){try{return $c(Zc(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},af=H,sf=j,uf=function(e){if(tf(e))return e;throw new nf("Can't set "+rf(e)+" as a prototype")},cf=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=of(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return sf(r),uf(n),af(r)?(t?e(r,n):r.__proto__=n,r):r}}():void 0),ff=z,lf=H,df=cf,hf=function(e,t,r){var n,i;return df&&ff(n=t.constructor)&&n!==r&&lf(i=n.prototype)&&i!==r.prototype&&df(e,i),e},pf=x(1..valueOf),vf=j,gf=di,mf="\t\n\v\f\r \u2028\u2029\ufeff",yf=x("".replace),bf=RegExp("^["+mf+"]+"),_f=RegExp("(^|[^"+mf+"])["+mf+"]+$"),wf=function(e){return function(t){var r=gf(vf(t));return 1&e&&(r=yf(r,bf,"")),2&e&&(r=yf(r,_f,"$1")),r}},Tf={start:wf(1),end:wf(2),trim:wf(3)},xf=ei,kf=s,Sf=i,Ef=Qi,Of=x,Rf=Kn,Pf=Fe,Lf=hf,Af=W,If=le,Mf=ut,Cf=a,Df=Qr.f,jf=o.f,Bf=Ot.f,Uf=pf,Nf=Tf.trim,Ff="Number",zf=Sf[Ff];Ef[Ff];var Vf=zf.prototype,Hf=Sf.TypeError,qf=Of("".slice),Gf=Of("".charCodeAt),Kf=function(e){var t,r,n,i,o,a,s,u,c=Mf(e,"number");if(If(c))throw new Hf("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=Nf(c),43===(t=Gf(c,0))||45===t){if(88===(r=Gf(c,2))||120===r)return NaN}else if(48===t){switch(Gf(c,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+c}for(a=(o=qf(c,2)).length,s=0;s<a;s++)if((u=Gf(o,s))<48||u>i)return NaN;return parseInt(o,n)}return+c},Wf=Rf(Ff,!zf(" 0o1")||!zf("0b1")||zf("+0x1")),Yf=function(e){var t,r=arguments.length<1?0:zf(function(e){var t=Mf(e,"number");return"bigint"==typeof t?t:Kf(t)}(e));return Af(Vf,t=this)&&Cf((function(){Uf(t)}))?Lf(Object(r),this,Yf):r};Yf.prototype=Vf,Wf&&(Vf.constructor=Yf),xf({global:!0,constructor:!0,wrap:!0,forced:Wf},{Number:Yf});Wf&&function(e,t){for(var r,n=kf?Df(t):"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(","),i=0;n.length>i;i++)Pf(t,r=n[i])&&!Pf(e,r)&&Bf(e,r,jf(t,r))}(Ef[Ff],zf);var Jf=s,Xf=x,Qf=l,$f=a,Zf=gi,el=En,tl=d,rl=Be,nl=I,il=Object.assign,ol=Object.defineProperty,al=Xf([].concat),sl=!il||$f((function(){if(Jf&&1!==il({b:1},il(ol({},"a",{enumerable:!0,get:function(){ol(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol("assign detection"),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!==il({},e)[r]||Zf(il({},t)).join("")!==n}))?function(e,t){for(var r=rl(e),n=arguments.length,i=1,o=el.f,a=tl.f;n>i;)for(var s,u=nl(arguments[i++]),c=o?al(Zf(u),o(u)):Zf(u),f=c.length,l=0;f>l;)s=c[l++],Jf&&!Qf(a,u,s)||(r[s]=u[s]);return r}:il,ul=sl;ei({target:"Object",stat:!0,arity:2,forced:Object.assign!==ul},{assign:ul});var cl=Be,fl=gi;ei({target:"Object",stat:!0,forced:a((function(){fl(1)}))},{keys:function(e){return fl(cl(e))}});var ll=ci,dl=ri?{}.toString:function(){return"[object "+ll(this)+"]"};ri||Xr(Object.prototype,"toString",dl,{unsafe:!0});var hl,pl,vl,gl,ml="process"===O(i.process),yl=K,bl=Yi,_l=s,wl=et("species"),Tl=function(e){var t=yl(e);_l&&t&&!t[wl]&&bl(t,wl,{configurable:!0,get:function(){return this}})},xl=W,kl=TypeError,Sl=function(e,t){if(xl(t,e))return e;throw new kl("Incorrect invocation")},El=It,Ol=Cu,Rl=M,Pl=et("species"),Ll=function(e,t){var r,n=El(e).constructor;return void 0===n||Rl(r=El(n)[Pl])?t:Ol(r)},Al=TypeError,Il=/(?:ipad|iphone|ipod).*applewebkit/i.test(Y),Ml=i,Cl=xs,Dl=mo,jl=z,Bl=Fe,Ul=a,Nl=ki,Fl=Fi,zl=vt,Vl=function(e,t){if(e<t)throw new Al("Not enough arguments");return e},Hl=Il,ql=ml,Gl=Ml.setImmediate,Kl=Ml.clearImmediate,Wl=Ml.process,Yl=Ml.Dispatch,Jl=Ml.Function,Xl=Ml.MessageChannel,Ql=Ml.String,$l=0,Zl={},ed="onreadystatechange";Ul((function(){hl=Ml.location}));var td=function(e){if(Bl(Zl,e)){var t=Zl[e];delete Zl[e],t()}},rd=function(e){return function(){td(e)}},nd=function(e){td(e.data)},id=function(e){Ml.postMessage(Ql(e),hl.protocol+"//"+hl.host)};Gl&&Kl||(Gl=function(e){Vl(arguments.length,1);var t=jl(e)?e:Jl(e),r=Fl(arguments,1);return Zl[++$l]=function(){Cl(t,void 0,r)},pl($l),$l},Kl=function(e){delete Zl[e]},ql?pl=function(e){Wl.nextTick(rd(e))}:Yl&&Yl.now?pl=function(e){Yl.now(rd(e))}:Xl&&!Hl?(gl=(vl=new Xl).port2,vl.port1.onmessage=nd,pl=Dl(gl.postMessage,gl)):Ml.addEventListener&&jl(Ml.postMessage)&&!Ml.importScripts&&hl&&"file:"!==hl.protocol&&!Ul(id)?(pl=id,Ml.addEventListener("message",nd,!1)):pl=ed in zl("script")?function(e){Nl.appendChild(zl("script"))[ed]=function(){Nl.removeChild(this),td(e)}}:function(e){setTimeout(rd(e),0)});var od={set:Gl,clear:Kl},ad=i,sd=s,ud=Object.getOwnPropertyDescriptor,cd=function(){this.head=null,this.tail=null};cd.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var fd,ld,dd,hd,pd,vd=cd,gd=/ipad|iphone|ipod/i.test(Y)&&"undefined"!=typeof Pebble,md=/web0s(?!.*chrome)/i.test(Y),yd=i,bd=function(e){if(!sd)return ad[e];var t=ud(ad,e);return t&&t.value},_d=mo,wd=od.set,Td=vd,xd=Il,kd=gd,Sd=md,Ed=ml,Od=yd.MutationObserver||yd.WebKitMutationObserver,Rd=yd.document,Pd=yd.process,Ld=yd.Promise,Ad=bd("queueMicrotask");if(!Ad){var Id=new Td,Md=function(){var e,t;for(Ed&&(e=Pd.domain)&&e.exit();t=Id.get();)try{t()}catch(e){throw Id.head&&fd(),e}e&&e.enter()};xd||Ed||Sd||!Od||!Rd?!kd&&Ld&&Ld.resolve?((hd=Ld.resolve(void 0)).constructor=Ld,pd=_d(hd.then,hd),fd=function(){pd(Md)}):Ed?fd=function(){Pd.nextTick(Md)}:(wd=_d(wd,yd),fd=function(){wd(Md)}):(ld=!0,dd=Rd.createTextNode(""),new Od(Md).observe(dd,{characterData:!0}),fd=function(){dd.data=ld=!ld}),Ad=function(e){Id.head||fd(),Id.add(e)}}var Cd=Ad,Dd=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},jd=i.Promise,Bd="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Ud=!Bd&&!ml&&"object"==typeof window&&"object"==typeof document,Nd=i,Fd=jd,zd=z,Vd=Kn,Hd=sr,qd=et,Gd=Ud,Kd=Bd,Wd=te;Fd&&Fd.prototype;var Yd=qd("species"),Jd=!1,Xd=zd(Nd.PromiseRejectionEvent),Qd=Vd("Promise",(function(){var e=Hd(Fd),t=e!==String(Fd);if(!t&&66===Wd)return!0;if(!Wd||Wd<51||!/native code/.test(e)){var r=new Fd((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Yd]=n,!(Jd=r.then((function(){}))instanceof n))return!0}return!t&&(Gd||Kd)&&!Xd})),$d={CONSTRUCTOR:Qd,REJECTION_EVENT:Xd,SUBCLASSING:Jd},Zd={},eh=me,th=TypeError,rh=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw new th("Bad Promise constructor");t=e,r=n})),this.resolve=eh(t),this.reject=eh(r)};Zd.f=function(e){return new rh(e)};var nh,ih,oh,ah=ei,sh=ml,uh=i,ch=l,fh=Xr,lh=cf,dh=co,hh=Tl,ph=me,vh=z,gh=H,mh=Sl,yh=Ll,bh=od.set,_h=Cd,wh=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}},Th=Dd,xh=vd,kh=Rr,Sh=jd,Eh=Zd,Oh="Promise",Rh=$d.CONSTRUCTOR,Ph=$d.REJECTION_EVENT,Lh=$d.SUBCLASSING,Ah=kh.getterFor(Oh),Ih=kh.set,Mh=Sh&&Sh.prototype,Ch=Sh,Dh=Mh,jh=uh.TypeError,Bh=uh.document,Uh=uh.process,Nh=Eh.f,Fh=Nh,zh=!!(Bh&&Bh.createEvent&&uh.dispatchEvent),Vh="unhandledrejection",Hh=function(e){var t;return!(!gh(e)||!vh(t=e.then))&&t},qh=function(e,t){var r,n,i,o=t.value,a=1===t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,f=e.domain;try{s?(a||(2===t.rejection&&Jh(t),t.rejection=1),!0===s?r=o:(f&&f.enter(),r=s(o),f&&(f.exit(),i=!0)),r===e.promise?c(new jh("Promise-chain cycle")):(n=Hh(r))?ch(n,r,u,c):u(r)):c(o)}catch(e){f&&!i&&f.exit(),c(e)}},Gh=function(e,t){e.notified||(e.notified=!0,_h((function(){for(var r,n=e.reactions;r=n.get();)qh(r,e);e.notified=!1,t&&!e.rejection&&Wh(e)})))},Kh=function(e,t,r){var n,i;zh?((n=Bh.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),uh.dispatchEvent(n)):n={promise:t,reason:r},!Ph&&(i=uh["on"+e])?i(n):e===Vh&&wh("Unhandled promise rejection",r)},Wh=function(e){ch(bh,uh,(function(){var t,r=e.facade,n=e.value;if(Yh(e)&&(t=Th((function(){sh?Uh.emit("unhandledRejection",n,r):Kh(Vh,r,n)})),e.rejection=sh||Yh(e)?2:1,t.error))throw t.value}))},Yh=function(e){return 1!==e.rejection&&!e.parent},Jh=function(e){ch(bh,uh,(function(){var t=e.facade;sh?Uh.emit("rejectionHandled",t):Kh("rejectionhandled",t,e.value)}))},Xh=function(e,t,r){return function(n){e(t,n,r)}},Qh=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Gh(e,!0))},$h=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw new jh("Promise can't be resolved itself");var n=Hh(t);n?_h((function(){var r={done:!1};try{ch(n,t,Xh($h,r,e),Xh(Qh,r,e))}catch(t){Qh(r,t,e)}})):(e.value=t,e.state=1,Gh(e,!1))}catch(t){Qh({done:!1},t,e)}}};if(Rh&&(Dh=(Ch=function(e){mh(this,Dh),ph(e),ch(nh,this);var t=Ah(this);try{e(Xh($h,t),Xh(Qh,t))}catch(e){Qh(t,e)}}).prototype,(nh=function(e){Ih(this,{type:Oh,done:!1,notified:!1,parent:!1,reactions:new xh,rejection:!1,state:0,value:void 0})}).prototype=fh(Dh,"then",(function(e,t){var r=Ah(this),n=Nh(yh(this,Ch));return r.parent=!0,n.ok=!vh(e)||e,n.fail=vh(t)&&t,n.domain=sh?Uh.domain:void 0,0===r.state?r.reactions.add(n):_h((function(){qh(n,r)})),n.promise})),ih=function(){var e=new nh,t=Ah(e);this.promise=e,this.resolve=Xh($h,t),this.reject=Xh(Qh,t)},Eh.f=Nh=function(e){return e===Ch||undefined===e?new ih(e):Fh(e)},vh(Sh)&&Mh!==Object.prototype)){oh=Mh.then,Lh||fh(Mh,"then",(function(e,t){var r=this;return new Ch((function(e,t){ch(oh,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete Mh.constructor}catch(e){}lh&&lh(Mh,Dh)}ah({global:!0,constructor:!0,wrap:!0,forced:Rh},{Promise:Ch}),dh(Ch,Oh,!1),hh(Oh);var Zh={},ep=Zh,tp=et("iterator"),rp=Array.prototype,np=function(e){return void 0!==e&&(ep.Array===e||rp[tp]===e)},ip=ci,op=_e,ap=M,sp=Zh,up=et("iterator"),cp=function(e){if(!ap(e))return op(e,up)||op(e,"@@iterator")||sp[ip(e)]},fp=l,lp=me,dp=It,hp=he,pp=cp,vp=TypeError,gp=function(e,t){var r=arguments.length<2?pp(e):t;if(lp(r))return dp(fp(r,e));throw new vp(hp(e)+" is not iterable")},mp=l,yp=It,bp=_e,_p=mo,wp=l,Tp=It,xp=he,kp=np,Sp=ln,Ep=W,Op=gp,Rp=cp,Pp=function(e,t,r){var n,i;yp(e);try{if(!(n=bp(e,"return"))){if("throw"===t)throw r;return r}n=mp(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return yp(n),r},Lp=TypeError,Ap=function(e,t){this.stopped=e,this.result=t},Ip=Ap.prototype,Mp=function(e,t,r){var n,i,o,a,s,u,c,f=r&&r.that,l=!(!r||!r.AS_ENTRIES),d=!(!r||!r.IS_RECORD),h=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),v=_p(t,f),g=function(e){return n&&Pp(n,"normal",e),new Ap(!0,e)},m=function(e){return l?(Tp(e),p?v(e[0],e[1],g):v(e[0],e[1])):p?v(e,g):v(e)};if(d)n=e.iterator;else if(h)n=e;else{if(!(i=Rp(e)))throw new Lp(xp(e)+" is not iterable");if(kp(i)){for(o=0,a=Sp(e);a>o;o++)if((s=m(e[o]))&&Ep(Ip,s))return s;return new Ap(!1)}n=Op(e,i)}for(u=d?e.next:n.next;!(c=wp(u,n)).done;){try{s=m(c.value)}catch(e){Pp(n,"throw",e)}if("object"==typeof s&&s&&Ep(Ip,s))return s}return new Ap(!1)},Cp=et("iterator"),Dp=!1;try{var jp=0,Bp={next:function(){return{done:!!jp++}},return:function(){Dp=!0}};Bp[Cp]=function(){return this},Array.from(Bp,(function(){throw 2}))}catch(e){}var Up=function(e,t){try{if(!t&&!Dp)return!1}catch(e){return!1}var r=!1;try{var n={};n[Cp]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},Np=jd,Fp=$d.CONSTRUCTOR||!Up((function(e){Np.all(e).then(void 0,(function(){}))})),zp=l,Vp=me,Hp=Zd,qp=Dd,Gp=Mp;ei({target:"Promise",stat:!0,forced:Fp},{all:function(e){var t=this,r=Hp.f(t),n=r.resolve,i=r.reject,o=qp((function(){var r=Vp(t.resolve),o=[],a=0,s=1;Gp(e,(function(e){var u=a++,c=!1;s++,zp(r,t,e).then((function(e){c||(c=!0,o[u]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var Kp=ei,Wp=$d.CONSTRUCTOR,Yp=jd,Jp=K,Xp=z,Qp=Xr,$p=Yp&&Yp.prototype;if(Kp({target:"Promise",proto:!0,forced:Wp,real:!0},{catch:function(e){return this.then(void 0,e)}}),Xp(Yp)){var Zp=Jp("Promise").prototype.catch;$p.catch!==Zp&&Qp($p,"catch",Zp,{unsafe:!0})}var ev=l,tv=me,rv=Zd,nv=Dd,iv=Mp;ei({target:"Promise",stat:!0,forced:Fp},{race:function(e){var t=this,r=rv.f(t),n=r.reject,i=nv((function(){var i=tv(t.resolve);iv(e,(function(e){ev(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var ov=Zd;ei({target:"Promise",stat:!0,forced:$d.CONSTRUCTOR},{reject:function(e){var t=ov.f(this);return(0,t.reject)(e),t.promise}});var av=It,sv=H,uv=Zd,cv=function(e,t){if(av(e),sv(t)&&t.constructor===e)return t;var r=uv.f(e);return(0,r.resolve)(t),r.promise},fv=ei,lv=$d.CONSTRUCTOR,dv=cv;K("Promise"),fv({target:"Promise",stat:!0,forced:lv},{resolve:function(e){return dv(this,e)}});var hv=ei,pv=jd,vv=a,gv=K,mv=z,yv=Ll,bv=cv,_v=Xr,wv=pv&&pv.prototype;if(hv({target:"Promise",proto:!0,real:!0,forced:!!pv&&vv((function(){wv.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=yv(this,gv("Promise")),r=mv(e);return this.then(r?function(r){return bv(t,e()).then((function(){return r}))}:e,r?function(r){return bv(t,e()).then((function(){throw r}))}:e)}}),mv(pv)){var Tv=gv("Promise").prototype.finally;wv.finally!==Tv&&_v(wv,"finally",Tv,{unsafe:!0})}var xv,kv,Sv=It,Ev=a,Ov=i.RegExp,Rv=Ev((function(){var e=Ov("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),Pv=Rv||Ev((function(){return!Ov("a","y").sticky})),Lv={BROKEN_CARET:Rv||Ev((function(){var e=Ov("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:Pv,UNSUPPORTED_Y:Rv},Av=a,Iv=i.RegExp,Mv=Av((function(){var e=Iv(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)})),Cv=a,Dv=i.RegExp,jv=Cv((function(){var e=Dv("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Bv=l,Uv=x,Nv=di,Fv=function(){var e=Sv(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},zv=Lv,Vv=Ui,Hv=Rr.get,qv=Mv,Gv=jv,Kv=Ce("native-string-replace",String.prototype.replace),Wv=RegExp.prototype.exec,Yv=Wv,Jv=Uv("".charAt),Xv=Uv("".indexOf),Qv=Uv("".replace),$v=Uv("".slice),Zv=(kv=/b*/g,Bv(Wv,xv=/a/,"a"),Bv(Wv,kv,"a"),0!==xv.lastIndex||0!==kv.lastIndex),eg=zv.BROKEN_CARET,tg=void 0!==/()??/.exec("")[1];(Zv||tg||eg||qv||Gv)&&(Yv=function(e){var t,r,n,i,o,a,s,u=this,c=Hv(u),f=Nv(e),l=c.raw;if(l)return l.lastIndex=u.lastIndex,t=Bv(Yv,l,f),u.lastIndex=l.lastIndex,t;var d=c.groups,h=eg&&u.sticky,p=Bv(Fv,u),v=u.source,g=0,m=f;if(h&&(p=Qv(p,"y",""),-1===Xv(p,"g")&&(p+="g"),m=$v(f,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==Jv(f,u.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,g++),r=new RegExp("^(?:"+v+")",p)),tg&&(r=new RegExp("^"+v+"$(?!\\s)",p)),Zv&&(n=u.lastIndex),i=Bv(Wv,h?r:u,m),h?i?(i.input=$v(i.input,g),i[0]=$v(i[0],g),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:Zv&&i&&(u.lastIndex=u.global?i.index+i[0].length:n),tg&&i&&i.length>1&&Bv(Kv,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&d)for(i.groups=a=Vv(null),o=0;o<d.length;o++)a[(s=d[o])[0]]=i[s[1]];return i});ei({target:"RegExp",proto:!0,forced:/./.exec!==Yv},{exec:Yv});var rg=vt("span").classList,ng=rg&&rg.constructor&&rg.constructor.prototype,ig=ng===Object.prototype?void 0:ng,og=a,ag=function(e,t){var r=[][e];return!!r&&og((function(){r.call(null,t||function(){return 1},1)}))},sg=Wo.forEach,ug=ag("forEach")?[].forEach:function(e){return sg(this,e,arguments.length>1?arguments[1]:void 0)},cg=i,fg={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},lg=ig,dg=ug,hg=Kt,pg=function(e){if(e&&e.forEach!==dg)try{hg(e,"forEach",dg)}catch(t){e.forEach=dg}};for(var vg in fg)fg[vg]&&pg(cg[vg]&&cg[vg].prototype);pg(lg);var gg={exports:{}},mg={exports:{}};!function(e){function t(r){return e.exports=t="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},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(mg),function(e){var t=mg.exports.default;function r(){e.exports=r=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var n,i={},o=Object.prototype,a=o.hasOwnProperty,s=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",f=u.asyncIterator||"@@asyncIterator",l=u.toStringTag||"@@toStringTag";function d(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(n){d=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=t&&t.prototype instanceof _?t:_,o=Object.create(i.prototype),a=new M(n||[]);return s(o,"_invoke",{value:P(e,r,a)}),o}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}i.wrap=h;var v="suspendedStart",g="suspendedYield",m="executing",y="completed",b={};function _(){}function w(){}function T(){}var x={};d(x,c,(function(){return this}));var k=Object.getPrototypeOf,S=k&&k(k(C([])));S&&S!==o&&a.call(S,c)&&(x=S);var E=T.prototype=_.prototype=Object.create(x);function O(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function R(e,r){function n(i,o,s,u){var c=p(e[i],e,o);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==t(l)&&a.call(l,"__await")?r.resolve(l.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):r.resolve(l).then((function(e){f.value=e,s(f)}),(function(e){return n("throw",e,s,u)}))}u(c.arg)}var i;s(this,"_invoke",{value:function(e,t){function o(){return new r((function(r,i){n(e,t,r,i)}))}return i=i?i.then(o,o):o()}})}function P(e,t,r){var i=v;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===y){if("throw"===o)throw a;return{value:n,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var u=L(s,r);if(u){if(u===b)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===v)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var c=p(e,t,r);if("normal"===c.type){if(i=r.done?y:g,c.arg===b)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=y,r.method="throw",r.arg=c.arg)}}}function L(e,t){var r=t.method,i=e.iterator[r];if(i===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=n,L(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),b;var o=p(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,b;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,b):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,b)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function t(){for(;++i<e.length;)if(a.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=n,t.done=!0,t};return o.next=o}}throw new TypeError(t(e)+" is not iterable")}return w.prototype=T,s(E,"constructor",{value:T,configurable:!0}),s(T,"constructor",{value:w,configurable:!0}),w.displayName=d(T,l,"GeneratorFunction"),i.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},i.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,T):(e.__proto__=T,d(e,l,"GeneratorFunction")),e.prototype=Object.create(E),e},i.awrap=function(e){return{__await:e}},O(R.prototype),d(R.prototype,f,(function(){return this})),i.AsyncIterator=R,i.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var a=new R(h(e,t,r,n),o);return i.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},O(E),d(E,l,"Generator"),d(E,c,(function(){return this})),d(E,"toString",(function(){return"[object Generator]"})),i.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},i.values=C,M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return s.type="throw",s.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=a.call(o,"catchLoc"),c=a.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,b):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),b},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),b}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:C(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),b}},i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(gg);var yg=gg.exports(),bg=yg;try{regeneratorRuntime=yg}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=yg:Function("r","regeneratorRuntime = r")(yg)}var _g=et,wg=Ui,Tg=Ot.f,xg=_g("unscopables"),kg=Array.prototype;void 0===kg[xg]&&Tg(kg,xg,{configurable:!0,value:wg(null)});var Sg=function(e){kg[xg][e]=!0},Eg=ei,Og=Wo.find,Rg=Sg,Pg="find",Lg=!0;Pg in[]&&Array(1)[Pg]((function(){Lg=!1})),Eg({target:"Array",proto:!0,forced:Lg},{find:function(e){return Og(this,e,arguments.length>1?arguments[1]:void 0)}}),Rg(Pg);var Ag,Ig,Mg,Cg=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Dg=Fe,jg=z,Bg=Be,Ug=Cg,Ng=hr("IE_PROTO"),Fg=Object,zg=Fg.prototype,Vg=Ug?Fg.getPrototypeOf:function(e){var t=Bg(e);if(Dg(t,Ng))return t[Ng];var r=t.constructor;return jg(r)&&t instanceof r?r.prototype:t instanceof Fg?zg:null},Hg=a,qg=z,Gg=H,Kg=Vg,Wg=Xr,Yg=et("iterator"),Jg=!1;[].keys&&("next"in(Mg=[].keys())?(Ig=Kg(Kg(Mg)))!==Object.prototype&&(Ag=Ig):Jg=!0);var Xg=!Gg(Ag)||Hg((function(){var e={};return Ag[Yg].call(e)!==e}));Xg&&(Ag={}),qg(Ag[Yg])||Wg(Ag,Yg,(function(){return this}));var Qg={IteratorPrototype:Ag,BUGGY_SAFARI_ITERATORS:Jg},$g=Qg.IteratorPrototype,Zg=Ui,em=y,tm=co,rm=Zh,nm=function(){return this},im=ei,om=l,am=z,sm=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Zg($g,{next:em(+!n,r)}),tm(e,i,!1),rm[i]=nm,e},um=Vg,cm=cf,fm=co,lm=Kt,dm=Xr,hm=Zh,pm=Zt.PROPER,vm=Zt.CONFIGURABLE,gm=Qg.IteratorPrototype,mm=Qg.BUGGY_SAFARI_ITERATORS,ym=et("iterator"),bm="keys",_m="values",wm="entries",Tm=function(){return this},xm=N,km=Sg,Sm=Zh,Em=Rr,Om=Ot.f,Rm=function(e,t,r,n,i,o,a){sm(r,t,n);var s,u,c,f=function(e){if(e===i&&v)return v;if(!mm&&e&&e in h)return h[e];switch(e){case bm:case _m:case wm:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",d=!1,h=e.prototype,p=h[ym]||h["@@iterator"]||i&&h[i],v=!mm&&p||f(i),g="Array"===t&&h.entries||p;if(g&&(s=um(g.call(new e)))!==Object.prototype&&s.next&&(um(s)!==gm&&(cm?cm(s,gm):am(s[ym])||dm(s,ym,Tm)),fm(s,l,!0)),pm&&i===_m&&p&&p.name!==_m&&(vm?lm(h,"name",_m):(d=!0,v=function(){return om(p,this)})),i)if(u={values:f(_m),keys:o?v:f(bm),entries:f(wm)},a)for(c in u)(mm||d||!(c in h))&&dm(h,c,u[c]);else im({target:t,proto:!0,forced:mm||d},u);return h[ym]!==v&&dm(h,ym,v,{name:i}),hm[t]=v,u},Pm=function(e,t){return{value:e,done:t}},Lm=s,Am="Array Iterator",Im=Em.set,Mm=Em.getterFor(Am),Cm=Rm(Array,"Array",(function(e,t){Im(this,{type:Am,target:xm(e),index:0,kind:t})}),(function(){var e=Mm(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=void 0,Pm(void 0,!0);switch(e.kind){case"keys":return Pm(r,!1);case"values":return Pm(t[r],!1)}return Pm([r,t[r]],!1)}),"values"),Dm=Sm.Arguments=Sm.Array;if(km("keys"),km("values"),km("entries"),Lm&&"values"!==Dm.name)try{Om(Dm,"name",{value:"values"})}catch(e){}var jm=Wo.map;ei({target:"Array",proto:!0,forced:!ou("map")},{map:function(e){return jm(this,e,arguments.length>1?arguments[1]:void 0)}});var Bm=ei,Um=bo,Nm=Io,Fm=H,zm=an,Vm=ln,Hm=N,qm=vu,Gm=et,Km=Fi,Wm=ou("slice"),Ym=Gm("species"),Jm=Array,Xm=Math.max;Bm({target:"Array",proto:!0,forced:!Wm},{slice:function(e,t){var r,n,i,o=Hm(this),a=Vm(o),s=zm(e,a),u=zm(void 0===t?a:t,a);if(Um(o)&&(r=o.constructor,(Nm(r)&&(r===Jm||Um(r.prototype))||Fm(r)&&null===(r=r[Ym]))&&(r=void 0),r===Jm||void 0===r))return Km(o,s,u);for(n=new(void 0===r?Jm:r)(Xm(u-s,0)),i=0;s<u;s++,i++)s in o&&qm(n,i,o[s]);return n.length=i,n}});var Qm,$m,Zm,ey={exports:{}},ty="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,ry=ty,ny=s,iy=i,oy=z,ay=H,sy=Fe,uy=ci,cy=he,fy=Kt,ly=Xr,dy=Yi,hy=W,py=Vg,vy=cf,gy=et,my=Ge,yy=Rr.enforce,by=Rr.get,_y=iy.Int8Array,wy=_y&&_y.prototype,Ty=iy.Uint8ClampedArray,xy=Ty&&Ty.prototype,ky=_y&&py(_y),Sy=wy&&py(wy),Ey=Object.prototype,Oy=iy.TypeError,Ry=gy("toStringTag"),Py=my("TYPED_ARRAY_TAG"),Ly="TypedArrayConstructor",Ay=ry&&!!vy&&"Opera"!==uy(iy.opera),Iy=!1,My={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Cy={BigInt64Array:8,BigUint64Array:8},Dy=function(e){var t=py(e);if(ay(t)){var r=by(t);return r&&sy(r,Ly)?r[Ly]:Dy(t)}},jy=function(e){if(!ay(e))return!1;var t=uy(e);return sy(My,t)||sy(Cy,t)};for(Qm in My)(Zm=($m=iy[Qm])&&$m.prototype)?yy(Zm)[Ly]=$m:Ay=!1;for(Qm in Cy)(Zm=($m=iy[Qm])&&$m.prototype)&&(yy(Zm)[Ly]=$m);if((!Ay||!oy(ky)||ky===Function.prototype)&&(ky=function(){throw new Oy("Incorrect invocation")},Ay))for(Qm in My)iy[Qm]&&vy(iy[Qm],ky);if((!Ay||!Sy||Sy===Ey)&&(Sy=ky.prototype,Ay))for(Qm in My)iy[Qm]&&vy(iy[Qm].prototype,Sy);if(Ay&&py(xy)!==Sy&&vy(xy,Sy),ny&&!sy(Sy,Ry))for(Qm in Iy=!0,dy(Sy,Ry,{configurable:!0,get:function(){return ay(this)?this[Py]:void 0}}),My)iy[Qm]&&fy(iy[Qm],Py,Qm);var By={NATIVE_ARRAY_BUFFER_VIEWS:Ay,TYPED_ARRAY_TAG:Iy&&Py,aTypedArray:function(e){if(jy(e))return e;throw new Oy("Target is not a typed array")},aTypedArrayConstructor:function(e){if(oy(e)&&(!vy||hy(ky,e)))return e;throw new Oy(cy(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(ny){if(r)for(var i in My){var o=iy[i];if(o&&sy(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}Sy[e]&&!r||ly(Sy,e,r?t:Ay&&wy[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(ny){if(vy){if(r)for(n in My)if((i=iy[n])&&sy(i,e))try{delete i[e]}catch(e){}if(ky[e]&&!r)return;try{return ly(ky,e,r?t:Ay&&ky[e]||t)}catch(e){}}for(n in My)!(i=iy[n])||i[e]&&!r||ly(i,e,t)}},getTypedArrayConstructor:Dy,isView:function(e){if(!ay(e))return!1;var t=uy(e);return"DataView"===t||sy(My,t)||sy(Cy,t)},isTypedArray:jy,TypedArray:ky,TypedArrayPrototype:Sy},Uy=i,Ny=a,Fy=Up,zy=By.NATIVE_ARRAY_BUFFER_VIEWS,Vy=Uy.ArrayBuffer,Hy=Uy.Int8Array,qy=!zy||!Ny((function(){Hy(1)}))||!Ny((function(){new Hy(-1)}))||!Fy((function(e){new Hy,new Hy(null),new Hy(1.5),new Hy(e)}),!0)||Ny((function(){return 1!==new Hy(new Vy(2),1,void 0).length})),Gy=Xr,Ky=tn,Wy=cn,Yy=RangeError,Jy=function(e){if(void 0===e)return 0;var t=Ky(e),r=Wy(t);if(t!==r)throw new Yy("Wrong length or index");return r},Xy=Math.sign||function(e){var t=+e;return 0===t||t!=t?t:t<0?-1:1},Qy=Math.abs,$y=2220446049250313e-31,Zy=1/$y,eb=function(e,t,r,n){var i=+e,o=Qy(i),a=Xy(i);if(o<n)return a*function(e){return e+Zy-Zy}(o/n/t)*n*t;var s=(1+t/$y)*o,u=s-(s-o);return u>r||u!=u?a*(1/0):a*u},tb=Math.fround||function(e){return eb(e,1.1920928955078125e-7,34028234663852886e22,11754943508222875e-54)},rb=Array,nb=Math.abs,ib=Math.pow,ob=Math.floor,ab=Math.log,sb=Math.LN2,ub={pack:function(e,t,r){var n,i,o,a=rb(r),s=8*r-t-1,u=(1<<s)-1,c=u>>1,f=23===t?ib(2,-24)-ib(2,-77):0,l=e<0||0===e&&1/e<0?1:0,d=0;for((e=nb(e))!=e||e===1/0?(i=e!=e?1:0,n=u):(n=ob(ab(e)/sb),e*(o=ib(2,-n))<1&&(n--,o*=2),(e+=n+c>=1?f/o:f*ib(2,1-c))*o>=2&&(n++,o/=2),n+c>=u?(i=0,n=u):n+c>=1?(i=(e*o-1)*ib(2,t),n+=c):(i=e*ib(2,c-1)*ib(2,t),n=0));t>=8;)a[d++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[d++]=255&n,n/=256,s-=8;return a[--d]|=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,u=n-1,c=e[u--],f=127&c;for(c>>=7;s>0;)f=256*f+e[u--],s-=8;for(r=f&(1<<-s)-1,f>>=-s,s+=t;s>0;)r=256*r+e[u--],s-=8;if(0===f)f=1-a;else{if(f===o)return r?NaN:c?-1/0:1/0;r+=ib(2,t),f-=a}return(c?-1:1)*r*ib(2,f-t)}},cb=Be,fb=an,lb=ln,db=function(e){for(var t=cb(this),r=lb(t),n=arguments.length,i=fb(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:fb(o,r);a>i;)t[i++]=e;return t},hb=i,pb=x,vb=s,gb=ty,mb=Kt,yb=Yi,bb=function(e,t,r){for(var n in t)Gy(e,n,t[n],r);return e},_b=a,wb=Sl,Tb=tn,xb=cn,kb=Jy,Sb=tb,Eb=ub,Ob=Vg,Rb=cf,Pb=db,Lb=Fi,Ab=hf,Ib=Bn,Mb=co,Cb=Rr,Db=Zt.PROPER,jb=Zt.CONFIGURABLE,Bb="ArrayBuffer",Ub="DataView",Nb="prototype",Fb="Wrong index",zb=Cb.getterFor(Bb),Vb=Cb.getterFor(Ub),Hb=Cb.set,qb=hb[Bb],Gb=qb,Kb=Gb&&Gb[Nb],Wb=hb[Ub],Yb=Wb&&Wb[Nb],Jb=Object.prototype,Xb=hb.Array,Qb=hb.RangeError,$b=pb(Pb),Zb=pb([].reverse),e_=Eb.pack,t_=Eb.unpack,r_=function(e){return[255&e]},n_=function(e){return[255&e,e>>8&255]},i_=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},o_=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},a_=function(e){return e_(Sb(e),23,4)},s_=function(e){return e_(e,52,8)},u_=function(e,t,r){yb(e[Nb],t,{configurable:!0,get:function(){return r(this)[t]}})},c_=function(e,t,r,n){var i=Vb(e),o=kb(r),a=!!n;if(o+t>i.byteLength)throw new Qb(Fb);var s=i.bytes,u=o+i.byteOffset,c=Lb(s,u,u+t);return a?c:Zb(c)},f_=function(e,t,r,n,i,o){var a=Vb(e),s=kb(r),u=n(+i),c=!!o;if(s+t>a.byteLength)throw new Qb(Fb);for(var f=a.bytes,l=s+a.byteOffset,d=0;d<t;d++)f[l+d]=u[c?d:t-d-1]};if(gb){var l_=Db&&qb.name!==Bb;_b((function(){qb(1)}))&&_b((function(){new qb(-1)}))&&!_b((function(){return new qb,new qb(1.5),new qb(NaN),1!==qb.length||l_&&!jb}))?l_&&jb&&mb(qb,"name",Bb):((Gb=function(e){return wb(this,Kb),Ab(new qb(kb(e)),this,Gb)})[Nb]=Kb,Kb.constructor=Gb,Ib(Gb,qb)),Rb&&Ob(Yb)!==Jb&&Rb(Yb,Jb);var d_=new Wb(new Gb(2)),h_=pb(Yb.setInt8);d_.setInt8(0,2147483648),d_.setInt8(1,2147483649),!d_.getInt8(0)&&d_.getInt8(1)||bb(Yb,{setInt8:function(e,t){h_(this,e,t<<24>>24)},setUint8:function(e,t){h_(this,e,t<<24>>24)}},{unsafe:!0})}else Kb=(Gb=function(e){wb(this,Kb);var t=kb(e);Hb(this,{type:Bb,bytes:$b(Xb(t),0),byteLength:t}),vb||(this.byteLength=t,this.detached=!1)})[Nb],Yb=(Wb=function(e,t,r){wb(this,Yb),wb(e,Kb);var n=zb(e),i=n.byteLength,o=Tb(t);if(o<0||o>i)throw new Qb("Wrong offset");if(o+(r=void 0===r?i-o:xb(r))>i)throw new Qb("Wrong length");Hb(this,{type:Ub,buffer:e,byteLength:r,byteOffset:o,bytes:n.bytes}),vb||(this.buffer=e,this.byteLength=r,this.byteOffset=o)})[Nb],vb&&(u_(Gb,"byteLength",zb),u_(Wb,"buffer",Vb),u_(Wb,"byteLength",Vb),u_(Wb,"byteOffset",Vb)),bb(Yb,{getInt8:function(e){return c_(this,1,e)[0]<<24>>24},getUint8:function(e){return c_(this,1,e)[0]},getInt16:function(e){var t=c_(this,2,e,arguments.length>1&&arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=c_(this,2,e,arguments.length>1&&arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return o_(c_(this,4,e,arguments.length>1&&arguments[1]))},getUint32:function(e){return o_(c_(this,4,e,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(e){return t_(c_(this,4,e,arguments.length>1&&arguments[1]),23)},getFloat64:function(e){return t_(c_(this,8,e,arguments.length>1&&arguments[1]),52)},setInt8:function(e,t){f_(this,1,e,r_,t)},setUint8:function(e,t){f_(this,1,e,r_,t)},setInt16:function(e,t){f_(this,2,e,n_,t,arguments.length>2&&arguments[2])},setUint16:function(e,t){f_(this,2,e,n_,t,arguments.length>2&&arguments[2])},setInt32:function(e,t){f_(this,4,e,i_,t,arguments.length>2&&arguments[2])},setUint32:function(e,t){f_(this,4,e,i_,t,arguments.length>2&&arguments[2])},setFloat32:function(e,t){f_(this,4,e,a_,t,arguments.length>2&&arguments[2])},setFloat64:function(e,t){f_(this,8,e,s_,t,arguments.length>2&&arguments[2])}});Mb(Gb,Bb),Mb(Wb,Ub);var p_={ArrayBuffer:Gb,DataView:Wb},v_=H,g_=Math.floor,m_=Number.isInteger||function(e){return!v_(e)&&isFinite(e)&&g_(e)===e},y_=tn,b_=RangeError,__=function(e){var t=y_(e);if(t<0)throw new b_("The argument can't be less than 0");return t},w_=RangeError,T_=function(e,t){var r=__(e);if(r%t)throw new w_("Wrong offset");return r},x_=Math.round,k_=ci,S_=ut,E_=TypeError,O_=function(e){var t=S_(e,"number");if("number"==typeof t)throw new E_("Can't convert number to bigint");return BigInt(t)},R_=mo,P_=l,L_=Cu,A_=Be,I_=ln,M_=gp,C_=cp,D_=np,j_=function(e){var t=k_(e);return"BigInt64Array"===t||"BigUint64Array"===t},B_=By.aTypedArrayConstructor,U_=O_,N_=ln,F_=function(e,t,r){for(var n=0,i=arguments.length>2?r:N_(t),o=new e(i);i>n;)o[n]=t[n++];return o},z_=ei,V_=i,H_=l,q_=s,G_=qy,K_=By,W_=p_,Y_=Sl,J_=y,X_=Kt,Q_=m_,$_=cn,Z_=Jy,ew=T_,tw=function(e){var t=x_(e);return t<0?0:t>255?255:255&t},rw=lt,nw=Fe,iw=ci,ow=H,aw=le,sw=Ui,uw=W,cw=cf,fw=Qr.f,lw=function(e){var t,r,n,i,o,a,s,u,c=L_(this),f=A_(e),l=arguments.length,d=l>1?arguments[1]:void 0,h=void 0!==d,p=C_(f);if(p&&!D_(p))for(u=(s=M_(f,p)).next,f=[];!(a=P_(u,s)).done;)f.push(a.value);for(h&&l>2&&(d=R_(d,arguments[2])),r=I_(f),n=new(B_(c))(r),i=j_(n),t=0;r>t;t++)o=h?d(f[t],t):f[t],n[t]=i?U_(o):+o;return n},dw=Wo.forEach,hw=Tl,pw=Yi,vw=Ot,gw=o,mw=F_,yw=hf,bw=Rr.get,_w=Rr.set,ww=Rr.enforce,Tw=vw.f,xw=gw.f,kw=V_.RangeError,Sw=W_.ArrayBuffer,Ew=Sw.prototype,Ow=W_.DataView,Rw=K_.NATIVE_ARRAY_BUFFER_VIEWS,Pw=K_.TYPED_ARRAY_TAG,Lw=K_.TypedArray,Aw=K_.TypedArrayPrototype,Iw=K_.isTypedArray,Mw="BYTES_PER_ELEMENT",Cw="Wrong length",Dw=function(e,t){pw(e,t,{configurable:!0,get:function(){return bw(this)[t]}})},jw=function(e){var t;return uw(Ew,e)||"ArrayBuffer"===(t=iw(e))||"SharedArrayBuffer"===t},Bw=function(e,t){return Iw(e)&&!aw(t)&&t in e&&Q_(+t)&&t>=0},Uw=function(e,t){return t=rw(t),Bw(e,t)?J_(2,e[t]):xw(e,t)},Nw=function(e,t,r){return t=rw(t),!(Bw(e,t)&&ow(r)&&nw(r,"value"))||nw(r,"get")||nw(r,"set")||r.configurable||nw(r,"writable")&&!r.writable||nw(r,"enumerable")&&!r.enumerable?Tw(e,t,r):(e[t]=r.value,e)};q_?(Rw||(gw.f=Uw,vw.f=Nw,Dw(Aw,"buffer"),Dw(Aw,"byteOffset"),Dw(Aw,"byteLength"),Dw(Aw,"length")),z_({target:"Object",stat:!0,forced:!Rw},{getOwnPropertyDescriptor:Uw,defineProperty:Nw}),ey.exports=function(e,t,r){var n=e.match(/\d+/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=V_[i],u=s,c=u&&u.prototype,f={},l=function(e,t){Tw(e,t,{get:function(){return function(e,t){var r=bw(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=bw(e);o.view[a](t*n+o.byteOffset,r?tw(i):i,!0)}(this,t,e)},enumerable:!0})};Rw?G_&&(u=t((function(e,t,r,i){return Y_(e,c),yw(ow(t)?jw(t)?void 0!==i?new s(t,ew(r,n),i):void 0!==r?new s(t,ew(r,n)):new s(t):Iw(t)?mw(u,t):H_(lw,u,t):new s(Z_(t)),e,u)})),cw&&cw(u,Lw),dw(fw(s),(function(e){e in u||X_(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,r,i){Y_(e,c);var o,a,s,f=0,d=0;if(ow(t)){if(!jw(t))return Iw(t)?mw(u,t):H_(lw,u,t);o=t,d=ew(r,n);var h=t.byteLength;if(void 0===i){if(h%n)throw new kw(Cw);if((a=h-d)<0)throw new kw(Cw)}else if((a=$_(i)*n)+d>h)throw new kw(Cw);s=a/n}else s=Z_(t),o=new Sw(a=s*n);for(_w(e,{buffer:o,byteOffset:d,byteLength:a,length:s,view:new Ow(o)});f<s;)l(e,f++)})),cw&&cw(u,Lw),c=u.prototype=sw(Aw)),c.constructor!==u&&X_(c,"constructor",u),ww(c).TypedArrayConstructor=u,Pw&&X_(c,Pw,i);var d=u!==s;f[i]=u,z_({global:!0,constructor:!0,forced:d,sham:!Rw},f),Mw in u||X_(u,Mw,n),Mw in c||X_(c,Mw,n),hw(i)}):ey.exports=function(){},(0,ey.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var Fw=Be,zw=an,Vw=ln,Hw=Lc,qw=Math.min,Gw=[].copyWithin||function(e,t){var r=Fw(this),n=Vw(r),i=zw(e,n),o=zw(t,n),a=arguments.length>2?arguments[2]:void 0,s=qw((void 0===a?n:zw(a,n))-o,n-i),u=1;for(o<i&&i<o+s&&(u=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:Hw(r,i),i+=u,o+=u;return r},Kw=By,Ww=x(Gw),Yw=Kw.aTypedArray;(0,Kw.exportTypedArrayMethod)("copyWithin",(function(e,t){return Ww(Yw(this),e,t,arguments.length>2?arguments[2]:void 0)}));var Jw=Wo.every,Xw=By.aTypedArray;(0,By.exportTypedArrayMethod)("every",(function(e){return Jw(Xw(this),e,arguments.length>1?arguments[1]:void 0)}));var Qw=db,$w=O_,Zw=ci,eT=l,tT=a,rT=By.aTypedArray,nT=By.exportTypedArrayMethod,iT=x("".slice);nT("fill",(function(e){var t=arguments.length;rT(this);var r="Big"===iT(Zw(this),0,3)?$w(e):+e;return eT(Qw,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),tT((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e})));var oT=Ll,aT=By.aTypedArrayConstructor,sT=By.getTypedArrayConstructor,uT=function(e){return aT(oT(e,sT(e)))},cT=F_,fT=uT,lT=Wo.filter,dT=function(e,t){return cT(fT(e),t)},hT=By.aTypedArray;(0,By.exportTypedArrayMethod)("filter",(function(e){var t=lT(hT(this),e,arguments.length>1?arguments[1]:void 0);return dT(this,t)}));var pT=Wo.find,vT=By.aTypedArray;(0,By.exportTypedArrayMethod)("find",(function(e){return pT(vT(this),e,arguments.length>1?arguments[1]:void 0)}));var gT=Wo.findIndex,mT=By.aTypedArray;(0,By.exportTypedArrayMethod)("findIndex",(function(e){return gT(mT(this),e,arguments.length>1?arguments[1]:void 0)}));var yT=Wo.forEach,bT=By.aTypedArray;(0,By.exportTypedArrayMethod)("forEach",(function(e){yT(bT(this),e,arguments.length>1?arguments[1]:void 0)}));var _T=gn.includes,wT=By.aTypedArray;(0,By.exportTypedArrayMethod)("includes",(function(e){return _T(wT(this),e,arguments.length>1?arguments[1]:void 0)}));var TT=gn.indexOf,xT=By.aTypedArray;(0,By.exportTypedArrayMethod)("indexOf",(function(e){return TT(xT(this),e,arguments.length>1?arguments[1]:void 0)}));var kT=i,ST=a,ET=x,OT=By,RT=Cm,PT=et("iterator"),LT=kT.Uint8Array,AT=ET(RT.values),IT=ET(RT.keys),MT=ET(RT.entries),CT=OT.aTypedArray,DT=OT.exportTypedArrayMethod,jT=LT&<.prototype,BT=!ST((function(){jT[PT].call([1])})),UT=!!jT&&jT.values&&jT[PT]===jT.values&&"values"===jT.values.name,NT=function(){return AT(CT(this))};DT("entries",(function(){return MT(CT(this))}),BT),DT("keys",(function(){return IT(CT(this))}),BT),DT("values",NT,BT||!UT,{name:"values"}),DT(PT,NT,BT||!UT,{name:"values"});var FT=By.aTypedArray,zT=By.exportTypedArrayMethod,VT=x([].join);zT("join",(function(e){return VT(FT(this),e)}));var HT=xs,qT=N,GT=tn,KT=ln,WT=ag,YT=Math.min,JT=[].lastIndexOf,XT=!!JT&&1/[1].lastIndexOf(1,-0)<0,QT=WT("lastIndexOf"),$T=XT||!QT?function(e){if(XT)return HT(JT,this,arguments)||0;var t=qT(this),r=KT(t);if(0===r)return-1;var n=r-1;for(arguments.length>1&&(n=YT(n,GT(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:JT,ZT=xs,ex=$T,tx=By.aTypedArray;(0,By.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return ZT(ex,tx(this),t>1?[e,arguments[1]]:[e])}));var rx=Wo.map,nx=uT,ix=By.aTypedArray;(0,By.exportTypedArrayMethod)("map",(function(e){return rx(ix(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(nx(e))(t)}))}));var ox=me,ax=Be,sx=I,ux=ln,cx=TypeError,fx="Reduce of empty array with no initial value",lx=function(e){return function(t,r,n,i){var o=ax(t),a=sx(o),s=ux(o);if(ox(r),0===s&&n<2)throw new cx(fx);var u=e?s-1:0,c=e?-1:1;if(n<2)for(;;){if(u in a){i=a[u],u+=c;break}if(u+=c,e?u<0:s<=u)throw new cx(fx)}for(;e?u>=0:s>u;u+=c)u in a&&(i=r(i,a[u],u,o));return i}},dx={left:lx(!1),right:lx(!0)},hx=dx.left,px=By.aTypedArray;(0,By.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return hx(px(this),e,t,t>1?arguments[1]:void 0)}));var vx=dx.right,gx=By.aTypedArray;(0,By.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return vx(gx(this),e,t,t>1?arguments[1]:void 0)}));var mx=By.aTypedArray,yx=By.exportTypedArrayMethod,bx=Math.floor;yx("reverse",(function(){for(var e,t=this,r=mx(t).length,n=bx(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var _x=i,wx=l,Tx=By,xx=ln,kx=T_,Sx=Be,Ex=a,Ox=_x.RangeError,Rx=_x.Int8Array,Px=Rx&&Rx.prototype,Lx=Px&&Px.set,Ax=Tx.aTypedArray,Ix=Tx.exportTypedArrayMethod,Mx=!Ex((function(){var e=new Uint8ClampedArray(2);return wx(Lx,e,{length:1,0:3},1),3!==e[1]})),Cx=Mx&&Tx.NATIVE_ARRAY_BUFFER_VIEWS&&Ex((function(){var e=new Rx(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));Ix("set",(function(e){Ax(this);var t=kx(arguments.length>1?arguments[1]:void 0,1),r=Sx(e);if(Mx)return wx(Lx,this,r,t);var n=this.length,i=xx(r),o=0;if(i+t>n)throw new Ox("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!Mx||Cx);var Dx=uT,jx=Fi,Bx=By.aTypedArray;(0,By.exportTypedArrayMethod)("slice",(function(e,t){for(var r=jx(Bx(this),e,t),n=Dx(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),a((function(){new Int8Array(1).slice()})));var Ux=Wo.some,Nx=By.aTypedArray;(0,By.exportTypedArrayMethod)("some",(function(e){return Ux(Nx(this),e,arguments.length>1?arguments[1]:void 0)}));var Fx=Fi,zx=Math.floor,Vx=function(e,t){var r=e.length;if(r<8)for(var n,i,o=1;o<r;){for(i=o,n=e[o];i&&t(e[i-1],n)>0;)e[i]=e[--i];i!==o++&&(e[i]=n)}else for(var a=zx(r/2),s=Vx(Fx(e,0,a),t),u=Vx(Fx(e,a),t),c=s.length,f=u.length,l=0,d=0;l<c||d<f;)e[l+d]=l<c&&d<f?t(s[l],u[d])<=0?s[l++]:u[d++]:l<c?s[l++]:u[d++];return e},Hx=Vx,qx=Y.match(/firefox\/(\d+)/i),Gx=!!qx&&+qx[1],Kx=/MSIE|Trident/.test(Y),Wx=Y.match(/AppleWebKit\/(\d+)\./),Yx=!!Wx&&+Wx[1],Jx=ho,Xx=a,Qx=me,$x=Hx,Zx=Gx,ek=Kx,tk=te,rk=Yx,nk=By.aTypedArray,ik=By.exportTypedArrayMethod,ok=i.Uint16Array,ak=ok&&Jx(ok.prototype.sort),sk=!(!ak||Xx((function(){ak(new ok(2),null)}))&&Xx((function(){ak(new ok(2),{})}))),uk=!!ak&&!Xx((function(){if(tk)return tk<74;if(Zx)return Zx<67;if(ek)return!0;if(rk)return rk<602;var e,t,r=new ok(516),n=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(ak(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));ik("sort",(function(e){return void 0!==e&&Qx(e),uk?ak(this,e):$x(nk(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))}),!uk||sk);var ck=cn,fk=an,lk=uT,dk=By.aTypedArray;(0,By.exportTypedArrayMethod)("subarray",(function(e,t){var r=dk(this),n=r.length,i=fk(e,n);return new(lk(r))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,ck((void 0===t?n:fk(t,n))-i))}));var hk=xs,pk=By,vk=a,gk=Fi,mk=i.Int8Array,yk=pk.aTypedArray,bk=pk.exportTypedArrayMethod,_k=[].toLocaleString,wk=!!mk&&vk((function(){_k.call(new mk(1))}));bk("toLocaleString",(function(){return hk(_k,wk?gk(yk(this)):yk(this),gk(arguments))}),vk((function(){return[1,2].toLocaleString()!==new mk([1,2]).toLocaleString()}))||!vk((function(){mk.prototype.toLocaleString.call([1,2])})));var Tk=By.exportTypedArrayMethod,xk=a,kk=x,Sk=i.Uint8Array,Ek=Sk&&Sk.prototype||{},Ok=[].toString,Rk=kk([].join);xk((function(){Ok.call({})}))&&(Ok=function(){return Rk(this)});var Pk=Ek.toString!==Ok;Tk("toString",Ok,Pk);var Lk={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),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=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 u,c,f=this._events[s],l=arguments.length;if(f.fn){switch(f.once&&this.removeListener(e,f.fn,void 0,!0),l){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,t),!0;case 3:return f.fn.call(f.context,t,n),!0;case 4:return f.fn.call(f.context,t,n,i),!0;case 5:return f.fn.call(f.context,t,n,i,o),!0;case 6:return f.fn.call(f.context,t,n,i,o,a),!0}for(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];f.fn.apply(f.context,u)}else{var d,h=f.length;for(c=0;c<h;c++)switch(f[c].once&&this.removeListener(e,f[c].fn,void 0,!0),l){case 1:f[c].fn.call(f[c].context);break;case 2:f[c].fn.call(f[c].context,t);break;case 3:f[c].fn.call(f[c].context,t,n);break;case 4:f[c].fn.call(f[c].context,t,n,i);break;default:if(!u)for(d=1,u=new Array(l-1);d<l;d++)u[d-1]=arguments[d];f[c].fn.apply(f[c].context,u)}}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 u=0,c=[],f=s.length;u<f;u++)(s[u].fn!==t||i&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c: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}(Lk);var Ak,Ik=Lk.exports,Mk={};Object.defineProperty(Mk,"__esModule",{value:!0}),Mk.default=function(e){for(var t=0,r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,c=n[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){t+=u.value.length}}catch(e){a=!0,s=e}finally{try{!o&&c.return&&c.return()}finally{if(a)throw s}}var f=new e(t),l=0,d=!0,h=!1,p=void 0;try{for(var v,g=n[Symbol.iterator]();!(d=(v=g.next()).done);d=!0){var m=v.value;f.set(m,l),l+=m.length}}catch(e){h=!0,p=e}finally{try{!d&&g.return&&g.return()}finally{if(h)throw p}}return f};var Ck=((Ak=Mk)&&Ak.__esModule?Ak:{default:Ak}).default;function Dk(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jk(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Hk(n.key),n)}}function Bk(e,t,r){return t&&jk(e.prototype,t),r&&jk(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Uk(e,t,r){return(t=Hk(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nk(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||zk(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fk(e){return function(e){if(Array.isArray(e))return Vk(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||zk(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zk(e,t){if(e){if("string"==typeof e)return Vk(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Vk(e,t):void 0}}function Vk(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Hk(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var qk="video",Gk="audio",Kk="metadata",Wk="avc",Yk="hevc",Jk="aac",Xk="g7110a",Qk="g7110m",$k=function(){function e(){Dk(this,e),Uk(this,"id",1),Uk(this,"type",qk),Uk(this,"codecType",Wk),Uk(this,"pid",-1),Uk(this,"hvcC",void 0),Uk(this,"codec",""),Uk(this,"timescale",0),Uk(this,"formatTimescale",0),Uk(this,"sequenceNumber",0),Uk(this,"baseMediaDecodeTime",0),Uk(this,"baseDts",0),Uk(this,"duration",0),Uk(this,"warnings",[]),Uk(this,"samples",[]),Uk(this,"pps",[]),Uk(this,"sps",[]),Uk(this,"vps",[]),Uk(this,"fpsNum",0),Uk(this,"fpsDen",0),Uk(this,"sarRatio",[]),Uk(this,"width",0),Uk(this,"height",0),Uk(this,"nalUnitSize",4),Uk(this,"present",!1),Uk(this,"isVideoEncryption",!1),Uk(this,"isAudioEncryption",!1),Uk(this,"isVideo",!0),Uk(this,"kid",null),Uk(this,"pssh",null),Uk(this,"ext",void 0)}return Bk(e,[{key:"reset",value:function(){this.sequenceNumber=this.width=this.height=this.fpsDen=this.fpsNum=this.duration=this.baseMediaDecodeTime=this.timescale=0,this.codec="",this.present=!1,this.pid=-1,this.pps=[],this.sps=[],this.vps=[],this.sarRatio=[],this.samples=[],this.warnings=[],this.hvcC=null}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}},{key:"exist",value:function(){return!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}]),e}(),Zk=function(){function e(){Dk(this,e),Uk(this,"id",2),Uk(this,"type",Gk),Uk(this,"codecType",Jk),Uk(this,"pid",-1),Uk(this,"codec",""),Uk(this,"sequenceNumber",0),Uk(this,"sampleDuration",0),Uk(this,"timescale",0),Uk(this,"formatTimescale",0),Uk(this,"baseMediaDecodeTime",0),Uk(this,"duration",0),Uk(this,"warnings",[]),Uk(this,"samples",[]),Uk(this,"baseDts",0),Uk(this,"sampleSize",16),Uk(this,"sampleRate",0),Uk(this,"channelCount",0),Uk(this,"objectType",0),Uk(this,"sampleRateIndex",0),Uk(this,"config",[]),Uk(this,"present",!1),Uk(this,"isVideoEncryption",!1),Uk(this,"isAudioEncryption",!1),Uk(this,"kid",null),Uk(this,"ext",void 0)}return Bk(e,[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!!(this.sampleRate&&this.channelCount&&this.codec&&this.codecType===Jk)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}}]),e}(),eS=function(){function e(t,r,n){Dk(this,e),Uk(this,"flag",{}),Uk(this,"keyframe",!1),Uk(this,"gopId",0),Uk(this,"duration",0),Uk(this,"size",0),Uk(this,"units",[]),Uk(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=r,n&&(this.units=n)}return Bk(e,[{key:"cts",get:function(){return this.pts-this.dts}},{key:"setToKeyframe",value:function(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}]),e}(),tS=Bk((function e(t,r,n,i){Dk(this,e),Uk(this,"duration",1024),Uk(this,"flag",{dependsOn:2,isNonSyncSample:0}),Uk(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=r,this.size=r.byteLength,this.sampleOffset=i,n&&(this.duration=n)})),rS=function(){function e(){Dk(this,e),Uk(this,"id",3),Uk(this,"type",Kk),Uk(this,"timescale",0),Uk(this,"flvScriptSamples",[]),Uk(this,"seiSamples",[])}return Bk(e,[{key:"exist",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length||!this.timescale)}},{key:"reset",value:function(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length)}}]),e}(),nS="undefined"!=typeof window,iS=nS&&navigator.userAgent.toLocaleLowerCase();nS&&/^((?!chrome|android).)*safari/.test(iS);var oS=nS&&iS.includes("firefox"),aS=nS&&iS.includes("android"),sS=function(){function e(){Dk(this,e)}return Bk(e,null,[{key:"getRateIndexByRate",value:function(t){return e.FREQ.indexOf(t)}},{key:"parseADTS",value:function(t,r){for(var n=t.length,i=0;i+2<n&&(255!==t[i]||240!=(246&t[i+1]));)i++;if(!(i>=n)){var o=i,a=[],s=(60&t[i+2])>>>2,u=e.FREQ[s];if(!u)throw new Error("Invalid sampling index: ".concat(s));for(var c,f,l=1+((192&t[i+2])>>>6),d=(1&t[i+2])<<2|(192&t[i+3])>>>6,h=e._getConfig(s,d,l),p=h.config,v=h.codec,g=0,m=e.getFrameDuration(u);i+7<n;)if(255===t[i]&&240==(246&t[i+1])){if(n-i<(f=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5))break;c=2*(1&~t[i+1]),a.push({pts:r+g*m,data:t.subarray(i+7+c,i+f)}),g++,i+=f}else i++;return{skip:o,remaining:i>=n?void 0:t.subarray(i),frames:a,samplingFrequencyIndex:s,sampleRate:u,objectType:l,channelCount:d,codec:v,config:p,originCodec:"mp4a.40.".concat(l)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var r=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,o=e.FREQ[n];if(o){var a=e._getConfig(n,i,r);return{samplingFrequencyIndex:n,sampleRate:o,objectType:r,channelCount:i,config:a.config,codec:a.codec,originCodec:"mp4a.40.".concat(r)}}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,r){var n,i,o=[];return oS?e>=6?(n=5,i=e-3):(n=2,i=e):aS?(n=2,i=e):(n=2===r||5===r?r:5,i=e,e>=6?i=e-3:1===t&&(n=2,i=e)),o[0]=n<<3,o[0]|=(14&e)>>1,o[1]=(1&e)<<7,o[1]|=t<<3,5===n&&(o[1]|=(14&i)>>1,o[2]=(1&i)<<7,o[2]|=8,o[3]=0),{config:o,codec:"mp4a.40.".concat(n)}}},{key:"getSilentFrame",value:function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}]),e}();function uS(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t=t.filter(Boolean);var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}Uk(sS,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var cS=Math.pow(2,32);function fS(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function lS(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function dS(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return lS(e,t)*cS+lS(e,t+4)}function hS(e){if(!Array.isArray(e)){for(var t=[],r="",n=0;n<e.length;n++)n%2&&(r=e[n-1]+e[n],t.push(parseInt(r,16)),r="");return t}return e.map((function(e){return parseInt(e,16)}))}var pS=function(){function e(){Dk(this,e)}return Bk(e,null,[{key:"findBox",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[];if(!t)return i;for(var o=0,a="",s=0;t.length>7;){if(o=lS(t),a=String.fromCharCode.apply(null,t.subarray(4,8)),s=8,1===o?(o=dS(t,8),s+=8):o||(o=t.length),!r[0]||a===r[0]){var u=t.subarray(0,o);if(!(r.length<2))return e.findBox(u.subarray(s),r.slice(1),n+s);i.push({start:n,size:o,headerSize:s,type:a,data:u})}n+=o,t=t.subarray(o)}return i}},{key:"tfhd",value:function(e){return yS(e,!0,(function(e,t){e.trackId=lS(t);var r=4,n=1&e.flags,i=2&e.flags,o=8&e.flags,a=16&e.flags,s=32&e.flags;n&&(r+=4,e.baseDataOffset=lS(t,r),r+=4),i&&(e.sampleDescriptionIndex=lS(t,r),r+=4),o&&(e.defaultSampleDuration=lS(t,r),r+=4),a&&(e.defaultSampleSize=lS(t,r),r+=4),s&&(e.defaultSampleFlags=lS(t,r))}))}},{key:"sidx",value:function(e){return yS(e,!0,(function(e,t){var r=0;e.reference_ID=lS(t,r),r+=4,e.timescale=lS(t,r),r+=4,0===e.version?(e.earliest_presentation_time=lS(t,r),r+=4,e.first_offset=lS(t,r),r+=4):(e.earliest_presentation_time=dS(t,r),r+=8,e.first_offset=dS(t,r),r+=8),r+=2,e.references=[];var n=fS(t,r);r+=2;for(var i=0;i<n;i++){var o={};e.references.push(o);var a=lS(t,r);r+=4,o.reference_type=a>>31&1,o.referenced_size=2147483647&a,o.subsegment_duration=lS(t,r),a=lS(t,r+=4),r+=4,o.starts_with_SAP=a>>31&1,o.SAP_type=a>>28&7,o.SAP_delta_time=268435455&a}}))}},{key:"moov",value:function(t){return yS(t,!1,(function(t,r,n){t.mvhd=e.mvhd(e.findBox(r,["mvhd"],n)[0]),t.trak=e.findBox(r,["trak"],n).map((function(t){return e.trak(t)})),t.pssh=e.pssh(e.findBox(r,["pssh"],n)[0])}))}},{key:"mvhd",value:function(e){return yS(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=lS(t,16),e.duration=dS(t,20),r+=28):(e.timescale=lS(t,8),e.duration=lS(t,12),r+=16),e.nextTrackId=lS(t,r+76)}))}},{key:"trak",value:function(t){return yS(t,!1,(function(t,r,n){t.tkhd=e.tkhd(e.findBox(r,["tkhd"],n)[0]),t.mdia=e.mdia(e.findBox(r,["mdia"],n)[0])}))}},{key:"tkhd",value:function(e){return yS(e,!0,(function(e,t){var r=0;1===e.version?(e.trackId=lS(t,16),e.duration=dS(t,24),r+=32):(e.trackId=lS(t,8),e.duration=lS(t,16),r+=20),e.width=lS(t,r+52),e.height=lS(t,r+56)}))}},{key:"mdia",value:function(t){return yS(t,!1,(function(t,r,n){t.mdhd=e.mdhd(e.findBox(r,["mdhd"],n)[0]),t.hdlr=e.hdlr(e.findBox(r,["hdlr"],n)[0]),t.minf=e.minf(e.findBox(r,["minf"],n)[0])}))}},{key:"mdhd",value:function(e){return yS(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=lS(t,16),e.duration=dS(t,20),r+=28):(e.timescale=lS(t,8),e.duration=lS(t,12),r+=16);var n=fS(t,r);e.language=String.fromCharCode(96+(n>>10&31),96+(n>>5&31),96+(31&n))}))}},{key:"hdlr",value:function(e){return yS(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return yS(t,!1,(function(t,r,n){t.vmhd=e.vmhd(e.findBox(r,["vmhd"],n)[0]),t.smhd=e.smhd(e.findBox(r,["smhd"],n)[0]),t.stbl=e.stbl(e.findBox(r,["stbl"],n)[0])}))}},{key:"vmhd",value:function(e){return yS(e,!0,(function(e,t){e.graphicsmode=fS(t),e.opcolor=[fS(t,2),fS(t,4),fS(t,6)]}))}},{key:"smhd",value:function(e){return yS(e,!0,(function(e,t){e.balance=fS(t)}))}},{key:"stbl",value:function(t){return yS(t,!1,(function(t,r,n){var i,o,a;t.stsd=e.stsd(e.findBox(r,["stsd"],n)[0]),t.stts=e.stts(e.findBox(r,["stts"],n)[0]),t.ctts=e.ctts(e.findBox(r,["ctts"],n)[0]),t.stsc=e.stsc(e.findBox(r,["stsc"],n)[0]),t.stsz=e.stsz(e.findBox(r,["stsz"],n)[0]),t.stco=e.stco(e.findBox(r,["stco"],n)[0]),t.stco||(t.co64=e.co64(e.findBox(r,["co64"],n)[0]),t.stco=t.co64);var s=null===(i=t.stsd.entries[0])||void 0===i||null===(o=i.sinf)||void 0===o||null===(a=o.schi)||void 0===a?void 0:a.tenc.default_IV_size;t.stss=e.stss(e.findBox(r,["stss"],n)[0]),t.senc=e.senc(e.findBox(r,["senc"],n)[0],s)}))}},{key:"senc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return yS(e,!0,(function(e,r){var n=0,i=lS(r,n);n+=4,e.samples=[];for(var o=0;o<i;o++){for(var a={InitializationVector:[]},s=0;s<t;s++)a.InitializationVector[s]=r[n+s];if(n+=t,2&e.flags){a.subsamples=[];var u=fS(r,n);n+=2;for(var c=0;c<u;c++){var f={};f.BytesOfClearData=fS(r,n),n+=2,f.BytesOfProtectedData=lS(r,n),n+=4,a.subsamples.push(f)}}e.samples.push(a)}}))}},{key:"pssh",value:function(e){return yS(e,!0,(function(e,t){for(var r=[],n=[],i=0,o=0;o<16;o++)n.push(bS(t[i+o]));if(i+=16,e.version>0){var a=lS(t,i);i+=4;for(var s=0;s<(""+a).length;s++)for(var u=0;u<16;u++){var c=t[i];i+=1,r.push(bS(c))}}var f=lS(t,i);e.data_size=f,i+=4,e.kid=r,e.system_id=n,e.buffer=t}))}},{key:"stsd",value:function(t){return yS(t,!0,(function(t,r,n){t.entryCount=lS(r),t.entries=e.findBox(r.subarray(4),[],n+4).map((function(t){switch(t.type){case"avc1":case"avc2":case"avc3":case"avc4":return e.avc1(t);case"hvc1":case"hev1":return e.hvc1(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return yS(t,!1,(function(t,r,n){t.channelCount=fS(r,16),t.samplesize=fS(r,18),t.sampleRate=lS(r,24)/65536,r=r.subarray(28),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.esds=e.esds(e.findBox(r,["esds"],n)[0])}));case"encv":return yS(t,!1,(function(t,r,n){t.width=fS(r,24),t.height=fS(r,26),t.horizresolution=lS(r,28),t.vertresolution=lS(r,32),r=r.subarray(78),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.avcC=e.avcC(e.findBox(r,["avcC"],n)[0]),t.hvcC=e.hvcC(e.findBox(r,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(r,["pasp"],n)[0])}))}})).filter(Boolean)}))}},{key:"tenc",value:function(e){return yS(e,!1,(function(e,t){var r=6;e.default_IsEncrypted=t[r],r+=1,e.default_IV_size=t[r],r+=1,e.default_KID=[];for(var n=0;n<16;n++)e.default_KID.push(bS(t[r])),r+=1}))}},{key:"schi",value:function(t){return yS(t,!1,(function(t,r,n){t.tenc=e.tenc(e.findBox(r,["tenc"],n)[0])}))}},{key:"sinf",value:function(t){return yS(t,!1,(function(t,r,n){t.schi=e.schi(e.findBox(r,["schi"],n)[0]),t.frma=e.frma(e.findBox(r,["frma"],n)[0])}))}},{key:"frma",value:function(e){return yS(e,!1,(function(e,t){e.data_format="";for(var r=0;r<4;r++)e.data_format+=String.fromCharCode(t[r])}))}},{key:"avc1",value:function(t){return yS(t,!1,(function(t,r,n){var i=gS(t,r),o=r.subarray(i);n+=i,t.avcC=e.avcC(e.findBox(o,["avcC"],n)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],n)[0])}))}},{key:"avcC",value:function(e){return yS(e,!1,(function(t,r){t.data=e.data,t.configurationVersion=r[0],t.AVCProfileIndication=r[1],t.profileCompatibility=r[2],t.AVCLevelIndication=r[3],t.codec=function(e){for(var t,r="avc1.",n=0;n<3;n++)(t=e[n].toString(16)).length<2&&(t="0".concat(t)),r+=t;return r}([r[1],r[2],r[3]]),t.lengthSizeMinusOne=3&r[4],t.spsLength=31&r[5],t.sps=[];for(var n=6,i=0;i<t.spsLength;i++){var o=fS(r,n);n+=2,t.sps.push(r.subarray(n,n+o)),n+=o}t.ppsLength=r[n],n+=1,t.pps=[];for(var a=0;a<t.ppsLength;a++){var s=fS(r,n);n+=2,t.pps.push(r.subarray(n,n+=s)),n+=s}}))}},{key:"hvc1",value:function(t){return yS(t,!1,(function(t,r,n){var i=gS(t,r),o=r.subarray(i);n+=i,t.hvcC=e.hvcC(e.findBox(o,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],n)[0])}))}},{key:"hvcC",value:function(e){return yS(e,!1,(function(t,r){t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=r[0];var n=r[1];t.generalProfileSpace=n>>6,t.generalTierFlag=(32&n)>>5,t.generalProfileIdc=31&n,t.generalProfileCompatibility=lS(r,2),t.generalConstraintIndicatorFlags=r.subarray(6,12),t.generalLevelIdc=r[12],t.avgFrameRate=fS(r,19),t.numOfArrays=r[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,o=0,a=0,s=0,u=0;u<t.numOfArrays;u++){o=63&r[i],a=fS(r,i+1),i+=3;for(var c,f=[],l=0;l<a;l++)s=fS(r,i),i+=2,f.push(r.subarray(i,i+s)),i+=s;if(32===o)(c=t.vps).push.apply(c,f);else if(33===o){var d;(d=t.sps).push.apply(d,f)}else if(34===o){var h;(h=t.pps).push.apply(h,f)}}}))}},{key:"pasp",value:function(e){return yS(e,!1,(function(e,t){e.hSpacing=lS(t),e.vSpacing=lS(t,4)}))}},{key:"mp4a",value:function(t){return yS(t,!1,(function(t,r,n){var i=mS(t,r);t.esds=e.esds(e.findBox(r.subarray(i),["esds"],n+i)[0])}))}},{key:"esds",value:function(e){return yS(e,!0,(function(e,t){e.codec="mp4a.";for(var r=0,n=0,i=0,o=0;t.length;){for(o=t[r=0],n=t[r+1],r+=2;128&n;)i=(127&n)<<7,n=t[r],r+=1;if(i+=127&n,3===o)t=t.subarray(r+3);else{if(4!==o){if(5===o){var a=e.config=t.subarray(r,r+i),s=(248&a[0])>>3;return 31===s&&a.length>=2&&(s=32+((7&a[0])<<3)+((224&a[1])>>5)),e.objectType=s,e.codec+=s.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[r].toString(16)+".").padStart(3,"0"),t=t.subarray(r+13)}}}))}},{key:"alaw",value:function(e){return yS(e,!1,(function(e,t){mS(e,t)}))}},{key:"stts",value:function(e){return yS(e,!0,(function(e,t){for(var r=lS(t),n=[],i=4,o=0;o<r;o++)n.push({count:lS(t,i),delta:lS(t,i+4)}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"ctts",value:function(e){return yS(e,!0,(function(e,t){var r=lS(t),n=[],i=4;if(1===e.version)for(var o=0;o<r;o++)n.push({count:lS(t,i),offset:lS(t,i+4)}),i+=8;else for(var a=0;a<r;a++)n.push({count:lS(t,i),offset:-(1+~lS(t,i+4))}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stsc",value:function(e){return yS(e,!0,(function(e,t){for(var r=lS(t),n=[],i=4,o=0;o<r;o++)n.push({firstChunk:lS(t,i),samplesPerChunk:lS(t,i+4),sampleDescriptionIndex:lS(t,i+8)}),i+=12;e.entryCount=r,e.entries=n}))}},{key:"stsz",value:function(e){return yS(e,!0,(function(e,t){var r=lS(t),n=lS(t,4),i=[];if(!r)for(var o=8,a=0;a<n;a++)i.push(lS(t,o)),o+=4;e.sampleSize=r,e.sampleCount=n,e.entrySizes=i}))}},{key:"stco",value:function(e){return yS(e,!0,(function(e,t){for(var r=lS(t),n=[],i=4,o=0;o<r;o++)n.push(lS(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"co64",value:function(e){return yS(e,!0,(function(e,t){for(var r=lS(t),n=[],i=4,o=0;o<r;o++)n.push(dS(t,i)),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stss",value:function(e){return yS(e,!0,(function(e,t){for(var r=lS(t),n=[],i=4,o=0;o<r;o++)n.push(lS(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"moof",value:function(t){return yS(t,!1,(function(t,r,n){t.mfhd=e.mfhd(e.findBox(r,["mfhd"],n)[0]),t.traf=e.findBox(r,["traf"],n).map((function(t){return e.traf(t)}))}))}},{key:"mfhd",value:function(e){return yS(e,!0,(function(e,t){e.sequenceNumber=lS(t)}))}},{key:"traf",value:function(t){return yS(t,!1,(function(t,r,n){t.tfhd=e.tfhd(e.findBox(r,["tfhd"],n)[0]),t.tfdt=e.tfdt(e.findBox(r,["tfdt"],n)[0]),t.trun=e.trun(e.findBox(r,["trun"],n)[0])}))}},{key:"trun",value:function(e){return yS(e,!0,(function(e,t){var r=e.version,n=e.flags,i=t.length,o=e.sampleCount=lS(t),a=4;if(i>a&&1&n&&(e.dataOffset=-(1+~lS(t,a)),a+=4),i>a&&4&n&&(e.firstSampleFlags=lS(t,a),a+=4),e.samples=[],i>a)for(var s,u=0;u<o;u++)s={},256&n&&(s.duration=lS(t,a),a+=4),512&n&&(s.size=lS(t,a),a+=4),1024&n&&(s.flags=lS(t,a),a+=4),2048&n&&(s.cts=r?-(1+~lS(t,a+4)):lS(t,a),a+=4),e.samples.push(s)}))}},{key:"tfdt",value:function(e){return yS(e,!0,(function(e,t){1===e.version?e.baseMediaDecodeTime=dS(t):e.baseMediaDecodeTime=lS(t)}))}},{key:"probe",value:function(t){return!!e.findBox(t,["ftyp"])}},{key:"parseSampleFlags",value:function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}},{key:"moovToTrack",value:function(e,t,r){var n,i,o=e.trak;if(o&&o.length){var a=o.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),s=o.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(a&&t){var u,c,f,l,d,h,p,v=t,g=null===(u=a.tkhd)||void 0===u?void 0:u.trackId;null!=g&&(v.id=a.tkhd.trackId),v.tkhdDuration=a.tkhd.duration,v.mvhdDurtion=e.mvhd.duration,v.mvhdTimecale=e.mvhd.timescale,v.timescale=v.formatTimescale=a.mdia.mdhd.timescale,v.duration=a.mdia.mdhd.duration||v.mvhdDurtion/v.mvhdTimecale*v.timescale;var m,y,b,_,w,T,x,k,S=a.mdia.minf.stbl.stsd.entries[0];if(v.width=S.width,v.height=S.height,S.pasp&&(v.sarRatio=[S.pasp.hSpacing,S.pasp.vSpacing]),S.hvcC)v.codecType=Yk,v.codec=S.hvcC.codec,v.vps=S.hvcC.vps,v.sps=S.hvcC.sps,v.pps=S.hvcC.pps,v.hvcC=S.hvcC.data;else{if(!S.avcC)throw new Error("unknown video stsd entry");v.codec=S.avcC.codec,v.sps=S.avcC.sps,v.pps=S.avcC.pps}if(v.present=!0,v.ext={},v.ext.stss=null===(c=a.mdia)||void 0===c||null===(f=c.minf)||void 0===f||null===(l=f.stbl)||void 0===l?void 0:l.stss,v.ext.ctts=null===(d=a.mdia)||void 0===d||null===(h=d.minf)||void 0===h||null===(p=h.stbl)||void 0===p?void 0:p.ctts,S&&"encv"===S.type)v.isVideoEncryption=!0,S.default_KID=null===(m=S.sinf)||void 0===m||null===(y=m.schi)||void 0===y?void 0:y.tenc.default_KID,S.default_IsEncrypted=null===(b=S.sinf)||void 0===b||null===(_=b.schi)||void 0===_?void 0:_.tenc.default_IsEncrypted,S.default_IV_size=null===(w=S.sinf)||void 0===w||null===(T=w.schi)||void 0===T?void 0:T.tenc.default_IV_size,v.videoSenc=a.mdia.minf.stbl.senc&&a.mdia.minf.stbl.senc.samples,S.data_format=null===(x=S.sinf)||void 0===x||null===(k=x.frma)||void 0===k?void 0:k.data_format,v.useEME=e.useEME,v.kidValue=e.kidValue,v.pssh=e.pssh,v.encv=S}if(s&&r){var E,O,R,P,L,A,I,M,C,D=r,j=null===(E=s.tkhd)||void 0===E?void 0:E.trackId;null!=j&&(D.id=s.tkhd.trackId),D.tkhdDuration=s.tkhd.duration,D.mvhdDurtion=e.mvhd.duration,D.mvhdTimecale=e.mvhd.timescale,D.timescale=D.formatTimescale=s.mdia.mdhd.timescale,D.duration=s.mdia.mdhd.duration||D.mvhdDurtion/D.mvhdTimecale*D.timescale;var B,U,N,F,z,V,H,q,G=s.mdia.minf.stbl.stsd.entries[0];switch(D.sampleSize=G.sampleSize,D.sampleRate=G.sampleRate,D.channelCount=G.channelCount,D.present=!0,G.type){case"alaw":D.codecType=D.codec=Xk,D.sampleRate=8e3;break;case"ulaw":D.codecType=D.codec=Qk,D.sampleRate=8e3;break;default:D.sampleDuration=sS.getFrameDuration(D.sampleRate,D.timescale),D.sampleRateIndex=sS.getRateIndexByRate(D.sampleRate),D.objectType=(null===(n=G.esds)||void 0===n?void 0:n.objectType)||2,G.esds&&(D.config=Array.from(G.esds.config)),D.codec=(null===(i=G.esds)||void 0===i?void 0:i.codec)||"mp4a.40.2"}if(D.sampleDuration=sS.getFrameDuration(D.sampleRate,D.timescale),D.objectType=(null===(O=G.esds)||void 0===O?void 0:O.objectType)||2,G.esds&&(G.esds.config?D.config=Array.from(G.esds.config):console.warn("esds config is null")),D.codec=(null===(R=G.esds)||void 0===R?void 0:R.codec)||"mp4a.40.2",D.sampleRateIndex=sS.getRateIndexByRate(D.sampleRate),D.ext={},D.ext.stss=null===(P=s.mdia)||void 0===P||null===(L=P.minf)||void 0===L||null===(A=L.stbl)||void 0===A?void 0:A.stss,D.ext.ctts=null===(I=s.mdia)||void 0===I||null===(M=I.minf)||void 0===M||null===(C=M.stbl)||void 0===C?void 0:C.ctts,D.present=!0,G&&"enca"===G.type)D.isAudioEncryption=!0,G.data_format=null===(B=G.sinf)||void 0===B||null===(U=B.frma)||void 0===U?void 0:U.data_format,G.default_KID=null===(N=G.sinf)||void 0===N||null===(F=N.schi)||void 0===F?void 0:F.tenc.default_KID,G.default_IsEncrypted=null===(z=G.sinf)||void 0===z||null===(V=z.schi)||void 0===V?void 0:V.tenc.default_IsEncrypted,G.default_IV_size=null===(H=G.sinf)||void 0===H||null===(q=H.schi)||void 0===q?void 0:q.tenc.default_IV_size,D.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,D.useEME=e.useEME,D.kidValue=e.kidValue,D.enca=G}if(r&&(r.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!r&&r.isAudioEncryption),null!=t&&t.encv||null!=r&&r.enca){var K,W,Y=null==t||null===(K=t.encv)||void 0===K?void 0:K.default_KID,J=null==r||null===(W=r.enca)||void 0===W?void 0:W.default_KID,X=Y||J?(Y||J).join(""):null;t&&(t.kid=X),r&&(r.kid=X)}return t&&(t.flags=3841),r&&(r.flags=1793),{videoTrack:t,audioTrack:r}}}},{key:"evaluateDefaultDuration",value:function(e,t,r){var n,i=null==t||null===(n=t.samples)||void 0===n?void 0:n.length;return i?1024*i/t.timescale*e.timescale/r:1024}},{key:"moofToSamples",value:function(t,r,n){var i={};return t.mfhd&&(r&&(r.sequenceNumber=t.mfhd.sequenceNumber),n&&(n.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach((function(t){var o=t.tfhd,a=t.tfdt,s=t.trun;if(o&&s){a&&(r&&r.id===o.trackId&&(r.baseMediaDecodeTime=a.baseMediaDecodeTime),n&&n.id===o.trackId&&(n.baseMediaDecodeTime=a.baseMediaDecodeTime));var u=o.defaultSampleSize||0,c=o.defaultSampleDuration||e.evaluateDefaultDuration(r,n,s.samples.length||s.sampleCount),f=s.dataOffset||0,l=0,d=-1;if(!s.samples.length&&s.sampleCount){i[o.trackId]=[];for(var h=0;h<s.sampleCount;h++)i[o.trackId].push({offset:f,dts:l,duration:c,size:u}),l+=c,f+=u}else i[o.trackId]=s.samples.map((function(e,t){return(e={offset:f,dts:l,pts:l+(e.cts||0),duration:e.duration||c,size:e.size||u,gopId:d,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(d++,e.gopId=d),l+=e.duration,f+=e.size,e}))}})),i}},{key:"moovToSamples",value:function(e){var t=e.trak;if(t&&t.length){var r=t.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),n=t.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(r||n){var i,o;if(r){var a,s,u=null===(a=r.mdia)||void 0===a||null===(s=a.minf)||void 0===s?void 0:s.stbl;if(!u)return;var c=u.stts,f=u.stsc,l=u.stsz,d=u.stco,h=u.stss,p=u.ctts;if(!(c&&f&&l&&d&&h))return;i=vS(c,f,l,d,p,h)}if(n){var v,g,m,y=null===(v=n.mdia)||void 0===v||null===(g=v.minf)||void 0===g?void 0:g.stbl;if(!y)return;var b=null===(m=n.mdia.mdhd)||void 0===m?void 0:m.timescale,_=y.stts,w=y.stsc,T=y.stsz,x=y.stco;if(!(b&&_&&w&&T&&x))return;o=vS(_,w,T,x)}return{videoSamples:i,audioSamples:o}}}}}]),e}();function vS(e,t,r,n,i,o){var a,s,u,c=[],f=null==i?void 0:i.entries,l=t.entries,d=n.entries,h=r.entrySizes,p=null==o?void 0:o.entries;p&&(a={},p.forEach((function(e){a[e-1]=!0}))),f&&(s=[],f.forEach((function(e){for(var t=e.count,r=e.offset,n=0;n<t;n++)s.push(r)})));var v=-1,g=0,m=0,y=0,b=0,_=0,w=l[0].samplesPerChunk,T=l[1]?l[1].firstChunk-1:1/0;return e.entries.forEach((function(e){for(var t=e.count,n=e.delta,i=0;i<t;i++)u={dts:g,duration:n,size:h[m]||r.sampleSize,offset:d[y]+_,index:m},p&&(u.keyframe=a[m],u.keyframe&&v++,u.gopId=v),s&&m<s.length&&(u.pts=u.dts+s[m]),c.push(u),g+=n,++m<w?_+=u.size:(y++,_=0,y>=T&&(b++,T=l[b+1]?l[b+1].firstChunk-1:1/0),w+=l[b].samplesPerChunk)})),c}function gS(e,t){return e.dataReferenceIndex=fS(t,6),e.width=fS(t,24),e.height=fS(t,26),e.horizresolution=lS(t,28),e.vertresolution=lS(t,32),e.frameCount=fS(t,40),e.depth=fS(t,74),78}function mS(e,t){return e.dataReferenceIndex=fS(t,6),e.channelCount=fS(t,16),e.sampleSize=fS(t,18),e.sampleRate=lS(t,24)/65536,28}function yS(e,t,r){if(e){if(e.size!==e.data.length)throw new Error("box ".concat(e.type," size !== data.length"));var n={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(n.version=e.data[e.headerSize],n.flags=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),n.headerSize+=4),r(n,e.data.subarray(n.headerSize),n.start+n.headerSize),n}}var bS=function(){for(var e=[],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.forEach((function(t){e.push(function(e,t,r){for(var n=String(r),i=0|t,o=Math.ceil(i/n.length),a=[],s=String(e);o--;)a.push(n);return a.join("").substring(0,i-s.length)+s}(Number(t).toString(16),2,0))})),e[0]};var _S=function(){function e(){Dk(this,e),this.buffer=new Uint8Array(0)}return Bk(e,[{key:"write",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach((function(t){t?e.buffer=function(e){for(var t=0,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];n.forEach((function(e){t+=e.length}));var o=new e(t),a=0;return n.forEach((function(e){o.set(e,a),a+=e.length})),o}(Uint8Array,e.buffer,t):window.console.warn(t)}))}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]),e}(),wS=Math.pow(2,32)-1,TS=function(){function e(){Dk(this,e)}return Bk(e,null,[{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=8+(r=r.filter(Boolean)).reduce((function(e,t){return e+t.byteLength}),0),o=new Uint8Array(i);o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=255&i,o.set(e,4);var a=8;return r.forEach((function(e){o.set(e,a),a+=e.byteLength})),o}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===qk&&e.codecType===Yk}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return uS(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var r=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],hS(t.kid),[0,0,0,0]));return e.box(e.types.pssh,r)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var r=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(Fk(t.map((function(t){return e.trak(t)}))),[r]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(Fk(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,t>>24&255,t>>16&255,t>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,i>>8&255,255&i,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===qk?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){var r=[];return t&&t.ext&&t.ext.stss&&r.push(e.stss(t.ext.stss.entries)),e.box(e.types.stbl,e.stsd(t),e.STTS,r[0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var r;return r="audio"===t.type?t.useEME&&t.enca?e.enca(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):e.avc1hev1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),r)}},{key:"enca",value:function(t){var r=t.enca.channelCount,n=t.enca.sampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,n>>8&255,255&n,0,0]),o=e.esds(t.config),a=e.sinf(t.enca);return e.box(e.types.enca,i,o,a)}},{key:"encv",value:function(t){var r,n,i=t.sps.length>0?t.sps[0]:[],o=t.pps.length>0?t.pps[0]:[],a=t.width,s=t.height,u=t.sarRatio[0],c=t.sarRatio[1],f=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,a>>8&255,255&a,s>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l=new Uint8Array((r=(n=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,255&i.length]).concat.apply(n,Fk(i)).concat([1,o.length>>>8&255,255&o.length])).concat.apply(r,Fk(o))),d=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),h=e.sinf(t.encv),p=new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c]);return e.box(e.types.encv,f,e.box(e.types.avcC,l),e.box(e.types.btrt,d),h,e.box(e.types.pasp,p))}},{key:"schi",value:function(t){var r=new Uint8Array([]),n=e.tenc(t);return e.box(e.types.schi,r,n)}},{key:"tenc",value:function(t){var r=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(hS(t.default_KID)));return e.box(e.types.tenc,r)}},{key:"sinf",value:function(t){var r=new Uint8Array([]),n=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),o=e.schi(t);return e.box(e.types.sinf,r,e.box(e.types.frma,n),e.box(e.types.schm,i),o)}},{key:"avc1hev1",value:function(t){var r=t.codecType===Yk,n=r?e.types.hvc1:e.types.avc1,i=r?e.hvcC(t):e.avcC(t),o=[new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),i];return r?o.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&o.push(e.pasp(t.sarRatio)),e.box.apply(e,[n].concat(o))}},{key:"avcC",value:function(t){var r,n,i,o=[],a=[];return t.sps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,Fk(e))})),t.pps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,Fk(e))})),e.box(e.types.avcC,new Uint8Array((r=(n=[1,o[3],o[4],o[5],255,224|t.sps.length]).concat.apply(n,o).concat([t.pps.length])).concat.apply(r,a)))}},{key:"hvcC",value:function(t){var r=t.hvcC;if(r instanceof ArrayBuffer||r instanceof Uint8Array)return r;var n,i=t.vps,o=t.sps,a=t.pps;if(r){var s=r.generalProfileCompatibilityFlags,u=r.generalConstraintIndicatorFlags,c=(i.length&&1)+(o.length&&1)+(a.length&&1);n=[1,r.generalProfileSpace<<6|r.generalTierFlag<<5|r.generalProfileIdc,s>>>24,s>>>16,s>>>8,s,u[0],u[1],u[2],u[3],u[4],u[5],r.generalLevelIdc,240,0,252,252|r.chromaFormatIdc,248|r.bitDepthLumaMinus8,248|r.bitDepthChromaMinus8,0,0,r.numTemporalLayers<<3|r.temporalIdNested<<2|3,c];var f=function(e){var t;n.push(e.length>>8,e.length),(t=n).push.apply(t,Fk(e))};i.length&&(n.push(160,0,i.length),i.forEach(f)),o.length&&(n.push(161,0,o.length),o.forEach(f)),a.length&&(n.push(162,0,a.length),a.forEach(f))}else n=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(n))}},{key:"pasp",value:function(t){var r=Nk(t,2),n=r[0],i=r[1];return e.box(e.types.pasp,new Uint8Array([n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var r=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+r,0,0,0,4,15+r,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([r]).concat(t).concat([6,1,2])))}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(Fk(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(Fk(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var r=e.tfhd(t.id),n=e.tfdt(t,t.baseMediaDecodeTime),i=0;if(t.isVideo&&t.videoSenc&&t.videoSenc.forEach((function(e){i+=8,e.subsamples&&e.subsamples.length&&(i+=2,i+=6*e.subsamples.length)})),t.videoSencLength=i,t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(t.isVideo){var o=e.saiz(t),a=e.saio(t),s=e.trun1(t),u=e.senc(t);return e.box(e.types.traf,r,n,o,a,s,u)}if(t.isAudioEncryption){var c=e.sbgp(),f=e.saiz(t),l=e.saio(t),d=e.senc(t),h=e.trun1(t);return e.box(e.types.traf,r,n,c,f,l,d,h)}var p=e.sbgp(),v=e.trun1(t);return e.box(e.types.traf,r,n,p,v)}if(t.isVideo){var g=e.trun1(t);return e.box(e.types.traf,r,n,g)}var m=e.sbgp(),y=e.saiz(t),b=e.saio(t),_=e.senc(t),w=e.trun1(t);return e.box(e.types.traf,r,n,m,y,b,_,w)}var T=e.sdtp(t);return e.box(e.types.traf,r,n,T,e.trun(t.samples,T.byteLength+76))}},{key:"sdtp",value:function(t){var r=new _S;return t.samples.forEach((function(e){r.write(new Uint8Array(t.isVideo?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),r.buffer)}},{key:"trun1",value:function(t){var r=new _S,n=_S.writeUint32(t.samples.length),i=null;if(t.isVideo){var o=t.videoSencLength;i=_S.writeUint32(16*t.samples.length+o+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=_S.writeUint32(16*t.samples.length+92))}else{var a=12*t.samples.length+124;t.isAudioEncryption&&(a=12*t.samples.length+8*t.audioSenc.length+177),i=_S.writeUint32(a)}return t.samples.forEach((function(e){r.write(_S.writeUint32(e.duration)),r.write(_S.writeUint32(e.size)),r.write(_S.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&r.write(_S.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),n,i,r.buffer)}},{key:"senc",value:function(t){var r=new _S,n=t.samples.length,i=t.isVideo?16:8,o=t.isVideo?2:0,a=[],s=0;return t.isVideo?(a=t.videoSenc,s=t.videoSencLength):a=t.audioSenc,s=s||i*n,r.write(_S.writeUint32(16+s),e.types.senc,this.extension(0,o)),r.write(_S.writeUint32(n)),a.forEach((function(e){for(var t=0;t<e.InitializationVector.length;t++)r.write(new Uint8Array([e.InitializationVector[t]]));e.subsamples&&e.subsamples.length&&(r.write(_S.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){r.write(_S.writeUint16(e.BytesOfClearData)),r.write(_S.writeUint32(e.BytesOfProtectedData))})))})),r.buffer}},{key:"saio",value:function(t){var r=12*t.samples.length+141;!t.isVideo&&t.isAudioEncryption&&(r=149);var n=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saio,n)}},{key:"saiz",value:function(t){var r=t.samples.length,n=new Uint8Array([0,0,0,0,16,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saiz,n)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t,r){var n=Math.floor(r/(wS+1)),i=Math.floor(r%(wS+1));return t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)?e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])):e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"trun",value:function(t,r){var n=t.length,i=12+16*n;r+=8+i;var o=new Uint8Array(i);o.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0);for(var a=0;a<n;a++){var s=t[a],u=s.duration,c=s.size,f=s.flag,l=void 0===f?{}:f,d=s.cts,h=void 0===d?0:d;o.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,c>>>24&255,c>>>16&255,c>>>8&255,255&c,l.isLeading<<2|(null===l.dependsOn||void 0===l.dependsOn?1:l.dependsOn),l.isDependedOn<<6|l.hasRedundancy<<4|l.paddingValue<<1|(null===l.isNonSyncSample||void 0===l.isNonSyncSample?1:l.isNonSyncSample),61440&l.degradationPriority,15&l.degradationPriority,h>>>24&255,h>>>16&255,h>>>8&255,255&h],12+16*a)}return e.box(e.types.trun,o)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(Fk(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===qk?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var r=t.ext,n=[e.stsd(t),e.stts(r.stts),e.stsc(r.stsc),e.stsz(r.stsz),e.stco(r.stco)];return r.stss.length&&n.push(e.stss(r.stss)),r.ctts.length&&n.push(e.ctts(r.ctts)),e.box.apply(e,[e.types.stbl].concat(n))}},{key:"stts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.stts,uS(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsc",value:function(t){var r=t.length,n=new Uint8Array(12*r),i=0;return t.forEach((function(e){var t=e.firstChunk,r=e.samplesPerChunk,o=e.sampleDescIndex;n.set([t>>24,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,o>>24,o>>16&255,o>>8&255,255&o],i),i+=12})),e.box(e.types.stsc,uS(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsz",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stsz,uS(new Uint8Array([0,0,0,0,0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stco",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stco,uS(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stss",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stss,uS(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"ctts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.ctts,uS(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var r=t.timescale,n=t.samples[0].duration,i=n*t.samples.length,o=t.samples[0].sampleOffset*n,a=8;t.samples.forEach((function(e){a+=e.size}));var s=0;if(t.isVideo){var u,c=0;t.videoSenc&&(u=t.videoSenc),t.isVideo&&u.forEach((function(e){c+=8,e.subsamples&&e.subsamples.length&&(c+=2,c+=6*e.subsamples.length)})),t.videoSencLength=c,s=a+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=a+16*t.samples.length+84)}else s=a+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=a+169+12*t.samples.length+8*t.audioSenc.length);var f=new Uint8Array([0,0,0,0,0,0,0,255&t.id,r>>24&255,r>>16&255,r>>8&255,255&r,o>>24&255,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,1,0,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,144,0,0,0]);return e.box(e.types.sidx,f)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();Uk(TS,"types",["avc1","avcC","hvc1","hvcC","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp"].reduce((function(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),Uk(TS,"HDLR_TYPES",{video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])}),Uk(TS,"FTYPAVC1",TS.box(TS.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),Uk(TS,"FTYPHEV1",TS.box(TS.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),Uk(TS,"DINF",TS.box(TS.types.dinf,TS.box(TS.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),Uk(TS,"VMHD",TS.box(TS.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),Uk(TS,"SMHD",TS.box(TS.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),Uk(TS,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),Uk(TS,"STTS",TS.box(TS.types.stts,TS.StblTable)),Uk(TS,"STSC",TS.box(TS.types.stsc,TS.StblTable)),Uk(TS,"STSZ",TS.box(TS.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),Uk(TS,"STCO",TS.box(TS.types.stco,TS.StblTable));var xS=function(){function e(t,r){Dk(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=r}return Bk(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).debug.apply(t,[this._prefix].concat(n))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).log.apply(t,[this._prefix].concat(n))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(n))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).error.apply(t,[this._prefix].concat(n))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();Uk(xS,"disabled",!0);var kS=function(){function e(t,r,n){Dk(this,e),this.videoTrack=t,this.audioTrack=r;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new xS("FMP4Remuxer",!n||!n.openLog||!n.openLog)}return Bk(e,[{key:"remux",value:function(){var e,t,r,n,i,o=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),f=u.exist(),l=[];return o&&(a&&a.initMerge?(c&&l.push(this.videoTrack),f&&l.push(this.audioTrack),r=TS.initSegment(l)):(c&&(e=TS.initSegment([this.videoTrack])),f&&(t=TS.initSegment([this.audioTrack])))),c&&s.hasSample()&&(n=this._remuxVideo()),f&&u.hasSample()&&(i=this._remuxAudio()),s.samples=[],u.samples=[],{initSegment:r,videoInitSegment:e,audioInitSegment:t,videoSegment:n,audioSegment:i}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,r=0;t.forEach((function(e){r+=e.units.reduce((function(e,t){return e+t.byteLength}),0),r+=4*e.units.length}));for(var n,i=new Uint8Array(r),o=new DataView(i.buffer),a=function(e,r){r=t[s];var a=0;r.units.forEach((function(t){o.setUint32(e,t.byteLength),e+=4,i.set(t,e),e+=t.byteLength,a+=4+t.byteLength})),r.size=a,c=e,n=r},s=0,u=t.length,c=0;s<u;s++)a(c,n);var f=TS.mdat(i);return uS(TS.moof([e]),f)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,t=new Uint8Array(e.samples.reduce((function(e,t){return e+t.size}),0));e.samples.reduce((function(e,r){return t.set(r.data,e),e+r.size}),0);var r=TS.mdat(t);return uS(TS.moof([e]),r)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}(),SS=function(){function e(t,r,n,i){var o=this;Dk(this,e),Uk(this,"_videoSamples",[]),Uk(this,"_audioSamples",[]),Uk(this,"_lastRemainBuffer",[]),Uk(this,"_lastRemainBufferStartPos",0),this.videoTrack=new $k,this.audioTrack=new Zk,this.metadataTrack=n||new rS,this.log=new xS("MP4Demuxer",!i||!i.openLog||!i.openLog),t&&t.forEach((function(e){var t;(t=o._videoSamples).push.apply(t,Fk(e.frames))})),r&&r.forEach((function(e){var t;(t=o._audioSamples).push.apply(t,Fk(e.frames))}))}return Bk(e,[{key:"parseSamples",value:function(e){if(!e)throw new Error("moov is required");if(this.videoTrack.codec||this.audioTrack.codec||(pS.moovToTrack(e,this.videoTrack,this.audioTrack),this.videoSenc=this.videoTrack.videoSenc,this.audioSenc=this.audioTrack.audioSenc),!this._audioSamples.length&&!this._videoSamples.length){var t=pS.moovToSamples(e);if(!t)throw new Error("cannot parse samples from moov box");this._videoSamples=t.videoSamples||[],this._audioSamples=t.audioSamples||[]}}},{key:"demux",value:function(e,t,r,n,i){this.parseSamples(i);var o,a,s,u=this.videoTrack,c=this.audioTrack;if(u.samples=[],c.samples=[],r){for(var f,l=0,d=r[0],h=r[1];d<=h;d++){if(!(o=this._videoSamples[d]))throw new Error("cannot found video frame #".concat(d));s=o.offset-t,a=e.subarray(s,s+o.size),(f=new eS(o.pts||o.dts,o.dts)).duration=o.duration,f.gopId=o.gopId,o.keyframe&&f.setToKeyframe();for(var p=0,v=a.length-1;p<v;)l=lS(a,p),p+=4,f.units.push(a.subarray(p,p+l)),p+=l;u.samples.push(f)}u.baseMediaDecodeTime=u.samples[0].dts}if(n){for(var g=n[0],m=n[1];g<=m;g++){if(!(o=this._audioSamples[g]))throw new Error("cannot found video frame #".concat(g));s=o.offset-t,a=e.subarray(s,s+o.size),c.samples.push(new tS(o.dts,a,o.duration))}c.baseMediaDecodeTime=c.samples[0].dts}return{videoTrack:u,audioTrack:c,metadataTrack:this.metadataTrack}}},{key:"demuxPart",value:function(e,t,r,n,i,o,a,s){if(this.parseSamples(i),this.videoTrack.useEME=o,this.audioTrack.useEME=o,this._lastRemainBuffer&&this._lastRemainBuffer.byteLength>0&&t>this._lastRemainBufferStartPos&&t<=this._lastRemainBufferStartPos+this._lastRemainBuffer.byteLength)for(var u=0;u<20;)try{var c=this._lastRemainBuffer.subarray(0,t-this._lastRemainBufferStartPos),f=new Uint8Array(e.byteLength+c.byteLength);f.set(c,0),f.set(new Uint8Array(e),c.byteLength),e=f,t-=c.byteLength,this._lastRemainBuffer=null,this._lastRemainBufferStartPos=0;break}catch(e){if(!(u<20))throw new Error("new Uint8Array error:,"+e.errorMessage);u++}var l,d,h,p=this.videoTrack,v=this.audioTrack;p.samples=[],v.samples=[],p.videoSenc=null,v.audioSenc=null;var g=0,m=0;if(this._videoSamples.length>0&&r.length>0){for(var y,b=e.byteLength+t,_=r[0];_<=r[1];_++){if(!(l=this._videoSamples[_]))throw new Error("cannot found video frame #".concat(_));l.offset>=t&&l.offset+l.size<=b&&(g=(h=l.offset-t)+l.size,d=e.subarray(h,g),(y=new eS(l.pts||l.dts,l.dts)).duration=l.duration,y.gopId=l.gopId,y.sampleOffset=l.index,l.keyframe&&y.setToKeyframe(),y.data=d,y.size=l.size,p.samples.push(y))}p.samples.length>0&&(p.gopId=p.samples[0].gopId,p.baseMediaDecodeTime=p.samples[0].dts,p.startPts=p.samples[0].pts/p.timescale,p.endPts=p.samples[p.samples.length-1].pts/p.timescale,this.videoSenc&&(p.videoSenc=this.videoSenc.slice(p.samples[0].sampleOffset,p.samples[0].sampleOffset+p.samples.length),p.kidValue=a))}if(this._audioSamples.length>0&&n.length>0){for(var w=n[0];w<=n[1];w++){if(!(l=this._audioSamples[w]))throw new Error("cannot found video frame #".concat(w));l.offset>=t&&l.offset+l.size<=e.byteLength+t&&(m=(h=l.offset-t)+l.size,d=e.subarray(h,m),v.samples.push(new tS(l.dts,d,l.duration,l.index)))}v.samples.length>0&&(v.gopId=v.samples[0].gopId||p.gopId,v.baseMediaDecodeTime=v.samples[0].dts,v.startPts=v.samples[0].pts/v.timescale,v.endPts=v.samples[v.samples.length-1].pts/v.timescale,this.audioSenc&&(v.audioSenc=this.audioSenc.slice(v.samples[0].sampleOffset,v.samples[0].sampleOffset+v.samples.length),v.kidValue=a))}this.decoderData(p,v,s);for(var T=0,x=0;x<p.samples.length;x++)for(var k=0,S=p.samples[x].data,E=S.length-1;k<E;)T=lS(S,k),k+=4,p.samples[x].units.push(S.subarray(k,k+T)),k+=T;return this._lastRemainBuffer=e.subarray(Math.max(g,m)),this._lastRemainBuffer.byteLength>0?this._lastRemainBufferStartPos=t+e.byteLength-this._lastRemainBuffer.byteLength:this._lastRemainBufferStartPos=0,{videoTrack:p,audioTrack:v,metadataTrack:this.metadataTrack}}},{key:"reset",value:function(){this._videoSamples=[],this._audioSamples=[],this._lastRemainBuffer=null,this._lastRemainBufferStartPos=0,this.videoTrack.reset(),this.audioTrack.reset(),this.metadataTrack.reset()}},{key:"decoderData",value:function(e,t,r){!e.useEME&&t.useEME}}],[{key:"probe",value:function(e){return pS.probe(e)}}]),e}(),ES=JSON.parse('"3.0.0-alpha.27"');function OS(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function RS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?OS(Object(r),!0).forEach((function(t){jS(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):OS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function PS(){PS=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var o=t&&t.prototype instanceof d?t:d,a=Object.create(o.prototype),s=new S(i||[]);return n(a,"_invoke",{value:w(e,r,s)}),a}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l={};function d(){}function h(){}function p(){}var v={};u(v,o,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(E([])));m&&m!==t&&r.call(m,o)&&(v=m);var y=p.prototype=d.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,o,a,s){var u=f(e[n],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(l).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function w(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=T(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var i=f(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,l;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function E(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=p,n(y,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:h,configurable:!0}),h.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,a,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new _(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(y),u(y,s,"Generator"),u(y,o,(function(){return this})),u(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=E,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;k(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function LS(e){return(LS="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})(e)}function AS(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function IS(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){AS(o,n,i,a,s,"next",e)}function s(e){AS(o,n,i,a,s,"throw",e)}a(void 0)}))}}function MS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function CS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,JS(n.key),n)}}function DS(e,t,r){return t&&CS(e.prototype,t),r&&CS(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function jS(e,t,r){return(t=JS(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function BS(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&NS(e,t)}function US(e){return(US=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function NS(e,t){return(NS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function FS(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function zS(e,t,r){return(zS=FS()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&NS(i,r.prototype),i}).apply(null,arguments)}function VS(e){var t="function"==typeof Map?new Map:void 0;return VS=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return zS(e,arguments,US(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),NS(n,e)},VS(e)}function HS(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function qS(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function GS(e){var t=FS();return function(){var r,n=US(e);if(t){var i=US(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return qS(e)}(this,r)}}function KS(){return KS="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=US(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},KS.apply(this,arguments)}function WS(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function YS(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return WS(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?WS(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function JS(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var XS,QS=function(){function e(){MS(this,e)}return DS(e,null,[{key:"start",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0):0}},{key:"end",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(e){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var r=[],n=0,i=e.length;n<i;n++){var o=r.length;if(o&&t){var a=r[o-1],s=a[1];if(e.start(n)-s<=t){var u=e.end(n);u>s&&(a[1]=u)}else r.push([e.start(n),e.end(n)])}else r.push([e.start(n),e.end(n)])}return r}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce((function(e,t){return e+(t[1]-t[0])}),0):0}},{key:"info",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var i=0,o=0,a=0,s=0,u=0,c=0,f=0,l=e.buffers(t,n),d=0,h=l.length;d<h;d++){var p=l[d];if(r+n>=p[0]&&r<=p[1])i=p[0],o=p[1],a=d;else{if(r+n<p[0]){s=p[0],u=p[1];break}r+n>p[1]&&(c=p[0],f=p[1])}}return{start:i,end:o,index:a,buffers:l,nextStart:s,nextEnd:u,prevStart:c,prevEnd:f,currentTime:r,behind:r-i,remaining:o?o-r:0,length:e.totalLength&&e.totalLength(l)}}}]),e}(),$S="undefined"!=typeof window,ZS={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",NETWORK_FORBIDDEN:"network_forbidden",NETWORK_NOTFOUND:"network_notfound",NETWROK_RANGE_NOT_SATISFIABLE:"network_range_not_satisfiable",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",RUNTIME:"runtime",SUB_TYPES:{FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",OPTION:"OPTION",DASH:"DASH",LICENSE:"LICENSE",CUSTOM_LICENSE:"CUSTOM_LICENSE",MSE_HIJACK:"MSE_HIJACK",EME_HIJACK:"EME_HIJACK",SIDX:"SIDX",NO_CANPLAY_ERROR:"NO_CANPLAY_ERROR",BUFFERBREAK_ERROR:"BUFFERBREAK_ERROR",WAITING_TIMEOUT_ERROR:"WAITING_TIMEOUT_ERROR",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_CODEC_NOT_SUPPORTED:"MEDIA_ERR_CODEC_NOT_SUPPORTED",MEDIA_ERR_URL_EMPTY:"MEDIA_ERR_URL_EMPTY"}},eE=(jS(XS={},ZS.MANIFEST,{HLS:1100,DASH:1200}),jS(XS,ZS.NETWORK,2100),jS(XS,ZS.NETWORK_TIMEOUT,2101),jS(XS,ZS.NETWORK_FORBIDDEN,2103),jS(XS,ZS.NETWORK_NOTFOUND,2104),jS(XS,ZS.NETWROK_RANGE_NOT_SATISFIABLE,2116),jS(XS,ZS.DEMUX,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),jS(XS,ZS.REMUX,{FMP4:4100,MP4:4200}),jS(XS,ZS.MEDIA,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,EME_HIJACK:5301}),jS(XS,ZS.DRM,{LICENSE:7100,CUSTOM_LICENSE:7200}),jS(XS,ZS.OTHER,8e3),jS(XS,ZS.RUNTIME,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003}),XS),tE=function(e){BS(r,e);var t=GS(r);function r(e,n,i,o,a){var s;return MS(this,r),(s=t.call(this,a||(null==i?void 0:i.message))).errorType=e===ZS.NETWORK_TIMEOUT?ZS.NETWORK:e,s.originError=i,s.ext=o,s.errorCode=eE[e][n]||eE[e],s.errorMessage=s.message,s.errorCode||(s.errorType=ZS.OTHER,s.errorCode=eE[s.errorType]),s}return DS(r,null,[{key:"create",value:function(e,t,n,i,o){return e instanceof r?e:(e instanceof Error&&(n=e,e=""),e||(e=ZS.OTHER),new r(e,t,n,i,o))}},{key:"network",value:function(e){var t;return new r(null!=e&&e.isTimeout?ZS.NETWORK_TIMEOUT:ZS.NETWORK,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}]),r}(VS(Error)),rE={DEBUG:1,LOG:2,WARN:3,ERROR:4},nE=["Boolean","Number","String","Undefined","Null","Date","Object"],iE=function(){function e(t,r){MS(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),this.logCacheLevel=(null==r?void 0:r.logCacheLevel)||3,this.logMaxSize=(null==r?void 0:r.logMaxSize)||204800,this.logSize=0,this.logTextArray=[]}return DS(e,[{key:"debug",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[rE.DEBUG].concat(n)),e.disabled||(t=console).debug.apply(t,[this._prefix,oE()].concat(n))}},{key:"log",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[rE.LOG].concat(n)),e.disabled||(t=console).log.apply(t,[this._prefix,oE()].concat(n))}},{key:"warn",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[rE.WARN].concat(n)),e.disabled||(t=console).warn.apply(t,[this._prefix,oE()].concat(n))}},{key:"error",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[rE.ERROR].concat(n)),e.disabled||(t=console).error.apply(t,[this._prefix,oE()].concat(n))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var o=n.map((function(e){return sE(e)}));t=this._prefix+oE()+JSON.stringify(o)}catch(e){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var a=this.logTextArray.shift();this.logSize-=a.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function oE(){return(new Date).toLocaleString()}function aE(e){if("object"!==LS(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function sE(e,t,r){r||(r=1),t||(t=2);var n={};if(!e||"object"!==LS(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!nE.includes(i))return i;if(!(r>t)){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r===t?n[o]=aE(e[o]):"object"===LS(e[o])?n[o]=sE(e[o],t,r+1):n[o]=e[o]);return n}}function uE(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.used=!1,r.resolve=function(){return r.used=!0,e.apply(void 0,arguments)},r.reject=function(){return r.used=!0,t.apply(void 0,arguments)},r}function cE(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}jS(iE,"disabled",!0);var fE=function(e){try{return JSON.stringify(e)}catch(e){return""}};function lE(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];try{return $S?e&&"undefined"!=typeof ManagedMediaSource?ManagedMediaSource:window.MediaSource:null}catch(e){}}function dE(e){return/ManagedMediaSource/gi.test(Object.prototype.toString.call(e))}var hE="appendBuffer",pE="removeBuffer",vE="updateDuration",gE=function(){function e(t,r){var n=this;MS(this,e),jS(this,"media",null),jS(this,"mediaSource",null),jS(this,"_openPromise",uE()),jS(this,"_queue",Object.create(null)),jS(this,"_sourceBuffer",Object.create(null)),jS(this,"_mseFullFlag",{}),jS(this,"_st",0),jS(this,"_opst",0),jS(this,"_logger",null),jS(this,"_config",null),jS(this,"_url",null),jS(this,"_onStartStreaming",(function(){n._logger.debug("startstreaming")})),jS(this,"_onEndStreaming",(function(){n._logger.debug("endstreaming")})),jS(this,"_onSBUpdateEnd",(function(e){var t=n._queue[e];if(t){var r=t[0];if((null==r?void 0:r.opName)!==vE&&t.shift(),r){var i,o=cE()-n._opst;n._logger.debug("UpdateEnd(".concat(e,"/").concat(r.opName,")"),fE(function(e){var t=[];if(e instanceof TimeRanges)for(var r=0;r<e.length;r++)t.push({start:e.start(r),end:e.end(r)});return t}(null===(i=n._sourceBuffer[e])||void 0===i?void 0:i.buffered)),o,r.context),r.promise.resolve({name:r.opName,context:r.context,costtime:o}),n._startQueue(e)}}})),jS(this,"_onSBUpdateError",(function(e,t){var r=n._queue[e];if(r){var i=r[0];i&&(n._logger.error("UpdateError",e,i.opName,i.context),i.promise.reject(new tE(ZS.MEDIA,ZS.SUB_TYPES.MSE_APPEND_BUFFER,t)))}})),this._config=Object.assign(e.getDefaultConfig(),r),t&&this.bindMedia(t),this._logger=new iE("MSE"),this._config.openLog&&iE.enable()}var t,r,n;return DS(e,[{key:"isOpened",get:function(){var e;return"open"===(null===(e=this.mediaSource)||void 0===e?void 0:e.readyState)}},{key:"hasOpTasks",get:function(){var e=this,t=!1;return Object.keys(this._queue).forEach((function(r){var n=e._queue[r];Array.isArray(n)&&(t||(t=n.length>0))})),t}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"streaming",get:function(){return!dE(this.mediaSource)||this.mediaSource.streaming}},{key:"isFull",value:function(t){return t?this._mseFullFlag[t]:this._mseFullFlag[e.VIDEO]}},{key:"updateDuration",value:function(e){var t=this,r=this.mediaSource&&this.mediaSource.duration>e;if(this.mediaSource&&this.mediaSource.duration>e){var n=0;if(Object.keys(this._sourceBuffer).forEach((function(e){try{n=Math.max(t.bufferEnd(e)||0,n)}catch(e){}})),e<n)return Promise.resolve()}return this._enqueueBlockingOp((function(){t.isEnded?t._logger.debug("setDuration but ended"):t.mediaSource&&(t.mediaSource.duration=e,t._logger.debug("setDuration",e))}),vE,{isReduceDuration:r})}},{key:"open",value:function(){var e=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var t=this.mediaSource;t.addEventListener("sourceopen",(function r(){var n=cE()-e._st;e._logger.debug("sourceopen",n),t.removeEventListener("sourceopen",r),e._openPromise.resolve({costtime:n})})),this._openPromise=uE()}return this._openPromise}},{key:"bindMedia",value:(n=IS(PS().mark((function e(t){var r,n,i,o,a=this;return PS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mediaSource&&!this.media){e.next=3;break}return e.next=3,this.unbindMedia();case 3:if(r=lE(this._config.preferMMS),t&&r){e.next=6;break}throw new Error("Param media or MediaSource does not exist");case 6:return this.media=t,n=this.mediaSource=new r,i=dE(n),this._st=cE(),o=function e(){var r=cE()-a._st;a._logger.debug("sourceopen"),n.removeEventListener("sourceopen",e),URL.revokeObjectURL(t.src),a._openPromise.resolve({costtime:r})},n.addEventListener("sourceopen",o),i&&(n.addEventListener("startstreaming",this._onStartStreaming),n.addEventListener("endstreaming",this._onEndStreaming)),this._url=URL.createObjectURL(n),t.src=this._url,t.disableRemotePlayback=i,e.abrupt("return",this._openPromise);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"unbindMedia",value:(r=IS(PS().mark((function e(){var t,r,n,i=this;return PS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),t=this.mediaSource){if(Object.keys(this._queue).forEach((function(e){var t=i._queue[e];t&&t.forEach((function(e){var t,r;return null===(t=e.promise)||void 0===t||null===(r=t.resolve)||void 0===r?void 0:r.call(t)}))})),r=!!this.media&&this.media.readyState>=1,n="open"===t.readyState,r&&n)try{t.endOfStream()}catch(e){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(i._sourceBuffer[e])}catch(e){}})),dE(t)&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming))}if(this.media){this.media.disableRemotePlayback=!1,this.media.removeAttribute("src");try{this.media.load()}catch(e){}this.media=null}this.mediaSource=null,this._openPromise=uE(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var r;try{r=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(e){throw new tE(ZS.MEDIA,ZS.SUB_TYPES.MSE_ADD_SB,e)}r.mimeType=t,r.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),r.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var r=this,n=this._sourceBuffer[e];return this.mediaSource&&n&&n.mimeType!==t?"function"!=typeof n.changeType?Promise.reject():this._enqueueOp(e,(function(){n.changeType(t),n.mimeType=t,r._onSBUpdateEnd(e)}),"changeType",{mimeType:t}):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,r){var n=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(function(){var i;n.mediaSource&&!n.media.error&&(n._logger.debug("MSE APPEND START",r),n._opst=cE(),null===(i=n._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),hE,r):Promise.resolve()}},{key:"remove",value:function(e,t,r,n){var i=this,o=!1;return this._mseFullFlag[e]&&(o=!0),this._enqueueOp(e,(function(){if(i.mediaSource&&!i.media.error){var o=i._sourceBuffer[e];t>=r||!o?i._onSBUpdateEnd(e):(i._opst=cE(),i._logger.debug("MSE REMOVE START",e,t,r,n),o.remove(t,r))}}),pE,n,o)}},{key:"clearBuffer",value:function(e,t){var r,n=this;return Object.keys(this._sourceBuffer).forEach((function(i){r=n.remove(i,e,t)})),r||Promise.resolve()}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach((function(r){var n=t._sourceBuffer[r];e=t.remove(r,0,QS.end(QS.get(n)))})),e}},{key:"clearOpQueues",value:function(e,t){var r;this._logger.debug("MSE clearOpQueue START");var n=this._queue[e];if(t&&n)this._queue[e]=[];else if(n&&n[e]&&!(n.length<5)){var i=[];n.forEach((function(e){e.context&&e.context.isinit&&i.push(e)})),this._queue[e]=n.slice(0,2),i.length>0&&(r=this._queue[e]).push.apply(r,i)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((function(){var r=t.mediaSource;r&&"open"===r.readyState&&(t._logger.debug("MSE endOfStream START"),e?r.endOfStream(e):r.endOfStream())}),"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var r=this.mediaSource;e<0||t<e||null==r||!r.setLiveSeekableRange||"open"!==r.readyState||r.setLiveSeekableRange(e,t)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return QS.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return QS.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return QS.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,r,n,i){var o=this;if(!this.mediaSource)return Promise.resolve();var a=this._queue[e]=this._queue[e]||[],s={exec:t,promise:uE(),opName:r,context:n};return i?(a.splice(0,0,s),this._mseFullFlag[e]=!1,this._startQueue(e)):a.push(s),this.isOpened||this.isEnded?1===a.length&&this._startQueue(e):this._openPromise.then((function(){1===a.length&&o._startQueue(e)})),s.promise}},{key:"_enqueueBlockingOp",value:(t=IS(PS().mark((function e(t,r,n){var i,o,a=this;return PS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:if((i=Object.keys(this._sourceBuffer)).length){e.next=5;break}return e.abrupt("return",t());case 5:return o=[],i.forEach((function(e){var t=a._queue[e],i=uE();o.push(i),t.push({exec:function(){i.resolve()},promise:i,opName:r,context:n}),1===t.length&&a._startQueue(e)})),e.abrupt("return",Promise.all(o).then((function(){try{return t()}finally{i.forEach((function(e){var t=a._queue[e],r=a._sourceBuffer[e];null==t||t.shift(),r&&r.updating||a._startQueue(e)}))}})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})},{key:"_startQueue",value:function(e){var t=this._queue[e];if(t){var r=t[0];if(r&&!this._mseFullFlag[e])try{r.exec()}catch(n){n&&n.message&&n.message.indexOf("SourceBuffer is full")>=0?(this._mseFullFlag[e]=!0,this._logger.error("[MSE error], context,",r.context," ,name,",r.opName,",err,SourceBuffer is full"),r.promise.reject(new tE(ZS.MEDIA,ZS.SUB_TYPES.MSE_FULL,n))):(this._logger.error(n),r.promise.reject(new tE(ZS.MEDIA,ZS.SUB_TYPES.MSE_OTHER,n)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,r){var n=this;return this._enqueueOp(e,(function(){t<0&&(t+=.001),n._sourceBuffer[e].timestampOffset=t,n._onSBUpdateEnd(e)}),"setTimeoffset",r)}},{key:"abort",value:function(e,t){var r=this;return this.isOpened?this._enqueueOp(e,(function(){r._sourceBuffer[e].abort(),r._onSBUpdateEnd(e)}),"abort",t):Promise.resolve()}}],[{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"',t=lE();if(!t)return!1;try{return t.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}}},{key:"isMMSOnly",value:function(){return"undefined"!=typeof ManagedMediaSource&&"undefined"==typeof MediaSource}},{key:"getDefaultConfig",value:function(){return{openLog:!1,preferMMS:!1}}}]),e}();jS(gE,"VIDEO","video"),jS(gE,"AUDIO","audio");var mE="fetch",yE="xhr",bE="arraybuffer",_E="text",wE="json",TE=function(e){BS(r,e);var t=GS(r);function r(e,n,i,o){var a;return MS(this,r),jS(qS(a=t.call(this,o)),"retryCount",0),jS(qS(a),"isTimeout",!1),jS(qS(a),"loaderType",mE),jS(qS(a),"startTime",0),jS(qS(a),"endTime",0),jS(qS(a),"options",{}),a.url=e,a.request=n,a.response=i,a}return DS(r)}(VS(Error)),xE=Object.prototype.toString;function kE(e){if("[object Object]"!==xE.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function SE(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function EE(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function OE(e,t){if(e){if(!t)return e;var r,n=Object.keys(t).map((function(e){if(null!=(r=t[e]))return Array.isArray(r)?e+="[]":r=[r],r.map((function(t){var r;return r=t,"[object Date]"===xE.call(r)?t=t.toISOString():function(e){return null!==e&&"object"===LS(e)}(t)&&(t=JSON.stringify(t)),"".concat(EE(e),"=").concat(EE(t))})).join("&")})).filter(Boolean).join("&");if(n){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}}function RE(e,t,r,n,i,o,a,s,u,c,f){return i=null!=i?parseFloat(i):null,n=parseInt(n||"0",10),Number.isNaN(n)&&(n=0),{data:e,done:t,options:{range:u,vid:c,index:s,contentLength:n,age:i,startTime:o,firstByteTime:a,endTime:Date.now(),priOptions:f},response:r}}function PE(e,t){return Math.round(8*e*1e3/t/1024)}var LE="real_time_speed",AE=2097152,IE=function(e){BS(n,e);var t,r=GS(n);function n(){var e;return MS(this,n),jS(qS(e=r.call(this)),"_abortController",null),jS(qS(e),"_timeoutTimer",null),jS(qS(e),"_reader",null),jS(qS(e),"_response",null),jS(qS(e),"_aborted",!1),jS(qS(e),"_index",-1),jS(qS(e),"_range",null),jS(qS(e),"_receivedLength",0),jS(qS(e),"_running",!1),jS(qS(e),"_logger",null),jS(qS(e),"_vid",""),jS(qS(e),"_onProcessMinLen",0),jS(qS(e),"_onCancel",null),jS(qS(e),"_priOptions",null),e}return DS(n,[{key:"load",value:function(e){var t,r=this,n=e.url,i=e.vid,o=e.timeout,a=e.responseType,s=e.onProgress,u=e.index,c=e.onTimeout,f=e.onCancel,l=e.range,d=e.transformResponse,h=e.request,p=e.params,v=e.logger,g=e.method,m=e.headers,y=e.body,b=e.mode,_=e.credentials,w=e.cache,T=e.redirect,x=e.referrer,k=e.referrerPolicy,S=e.onProcessMinLen,E=e.priOptions;this._logger=v,this._aborted=!1,this._onProcessMinLen=S,this._onCancel=f,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=u,this._range=l||[0,0],this._vid=i||n,this._priOptions=E||{};var O={method:g,headers:m,body:y,mode:b,credentials:_,cache:w,redirect:T,referrer:x,referrerPolicy:k,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},R=!1;clearTimeout(this._timeoutTimer),n=OE(n,p);var P=SE(l);P&&(m=h?h.headers:O.headers=O.headers||(Headers?new Headers:{}),Headers&&m instanceof Headers?m.append("Range",P):m.Range=P),o&&(this._timeoutTimer=setTimeout((function(){if(R=!0,r.cancel(),c){var e=new TE(n,O,null,"timeout");e.isTimeout=!0,c(e,{index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions})}}),o));var L=Date.now();return this._logger.debug("[fetch load start], index,",u,",range,",l),new Promise((function(e,t){fetch(h||n,h?void 0:O).then(function(){var i=IS(PS().mark((function i(o){var c,f,h,p;return PS().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(r._timeoutTimer),r._response=o,!r._aborted&&r._running){i.next=4;break}return i.abrupt("return");case 4:if(d&&(o=d(o,n)||o),o.ok){i.next=7;break}throw new TE(n,O,o,"bad network response");case 7:if(c=Date.now(),a!==_E){i.next=15;break}return i.next=11,o.text();case 11:f=i.sent,r._running=!1,i.next=37;break;case 15:if(a!==wE){i.next=22;break}return i.next=18,o.json();case 18:f=i.sent,r._running=!1,i.next=37;break;case 22:if(!s){i.next=29;break}return r.resolve=e,r.reject=t,r._loadChunk(o,s,L,c),i.abrupt("return");case 29:return i.next=31,o.arrayBuffer();case 31:f=i.sent,f=new Uint8Array(f),r._running=!1,h=Date.now()-L,p=PE(f.byteLength,h),r.emit(LE,{speed:p,len:f.byteLength,time:h,vid:r._vid,index:r._index,range:r._range,priOptions:r._priOptions});case 37:r._logger.debug("[fetch load end], index,",u,",range,",l),e(RE(f,!0,o,o.headers.get("Content-Length"),o.headers.get("age"),L,c,u,l,r._vid,r._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){var i;clearTimeout(r._timeoutTimer),r._running=!1,r._aborted&&!R||((e=e instanceof TE?e:new TE(n,O,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=L,e.endTime=Date.now(),e.isTimeout=R,e.options={index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions},t(e))}))}))}},{key:"cancel",value:(t=IS(PS().mark((function e(){return PS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,r,n){var i=this;if(!e.body||!e.body.getReader){this._running=!1;var o=new TE(e.url,"",e,"onProgress of bad response.body.getReader");return o.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(o)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(AE),this._writeIdx=0);var a,s,u,c=this._reader=e.body.getReader(),f=function(){var o=IS(PS().mark((function o(){var l,d,h,p,v,g,m,y;return PS().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return s=Date.now(),o.prev=1,o.next=4,c.read();case 4:a=o.sent,u=Date.now(),o.next=13;break;case 8:return o.prev=8,o.t0=o.catch(1),u=Date.now(),i._aborted||(i._running=!1,o.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(o.t0)),o.abrupt("return");case 13:if(d=(null===(l=i._range)||void 0===l?void 0:l.length)>0?i._range[0]:0,h=d+i._receivedLength,!i._aborted){o.next=19;break}return i._running=!1,t(void 0,!1,{range:[h,h],vid:i._vid,index:i._index,startTime:s,endTime:u,st:r,firstByteTime:n,priOptions:i._priOptions},e),o.abrupt("return");case 19:p=a.value?a.value.byteLength:0,i._receivedLength+=p,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",h,", end,",d+i._receivedLength,", done,",a.done),i._onProcessMinLen>0?i._writeIdx+p>=i._onProcessMinLen||a.done?((v=new Uint8Array(i._writeIdx+p)).set(i._cache.slice(0,i._writeIdx),0),p>0&&v.set(a.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",a.done,",len,",v.byteLength,", writeIdx,",i._writeIdx)):p>0&&i._writeIdx+p<AE?(i._cache.set(a.value,i._writeIdx),i._writeIdx+=p,i._logger.debug("【fetchLoader,onProgress cache】,len,",p,", writeIdx,",i._writeIdx)):p>0&&(g=new Uint8Array(i._writeIdx+p+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+p+2048,", datalen,",p,", writeIdx,",i._writeIdx),g.set(i._cache.slice(0,i._writeIdx),0),p>0&&g.set(a.value,i._writeIdx),i._writeIdx+=p,delete i._cache,i._cache=g,i._logger.debug("【fetchLoader,onProgress extra end】,len,",p,", writeIdx,",i._writeIdx)):v=a.value,(v&&v.byteLength>0||a.done)&&t(v,a.done,{range:[i._range[0]+i._receivedLength-(v?v.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:s,endTime:u,st:r,firstByteTime:n,priOptions:i._priOptions},e),a.done?(m=Date.now()-r,y=PE(i._receivedLength,m),i.emit(LE,{speed:y,len:i._receivedLength,time:m,vid:i._vid,index:i._index,range:i._range,priOptions:i._priOptions}),i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",a.done),i.resolve(RE(a,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),r,n,i._index,i._range,i._vid,i._priOptions))):f();case 25:case"end":return o.stop()}}),o,null,[[1,8]])})));return function(){return o.apply(this,arguments)}}();f()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),n}(Ik);var ME=function(e){BS(r,e);var t=GS(r);function r(){var e;return MS(this,r),jS(qS(e=t.call(this)),"_xhr",null),jS(qS(e),"_aborted",!1),jS(qS(e),"_timeoutTimer",null),jS(qS(e),"_range",null),jS(qS(e),"_receivedLength",0),jS(qS(e),"_url",null),jS(qS(e),"_onProgress",null),jS(qS(e),"_index",-1),jS(qS(e),"_headers",null),jS(qS(e),"_currentChunkSizeKB",384),jS(qS(e),"_timeout",null),jS(qS(e),"_xhr",null),jS(qS(e),"_withCredentials",null),jS(qS(e),"_startTime",-1),jS(qS(e),"_loadCompleteResolve",null),jS(qS(e),"_loadCompleteReject",null),jS(qS(e),"_runing",!1),jS(qS(e),"_logger",!1),jS(qS(e),"_vid",""),jS(qS(e),"_responseType",void 0),jS(qS(e),"_credentials",void 0),jS(qS(e),"_method",void 0),jS(qS(e),"_transformResponse",void 0),jS(qS(e),"_firstRtt",void 0),jS(qS(e),"_onCancel",null),jS(qS(e),"_priOptions",null),e}return DS(r,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=OE(e.url,e.params);var r=Date.now();return new Promise((function(e,r){t._loadCompleteResolve=e,t._loadCompleteReject=r,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof TE?e:new TE(t._url,t._request)).startTime=r,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===bE&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,r=this._range[0]+this._receivedLength,n=this._range[1];t<this._range[1]-r&&(n=r+t),e=[r,n],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var r=this._xhr=new XMLHttpRequest;r.open(this._method||"GET",this._url,!0),r.responseType=this._responseType,this._timeout&&(r.timeout=this._timeout),r.withCredentials=this._withCredentials,r.onload=this._onLoad.bind(this),r.onreadystatechange=this._onReadyStatechange.bind(this),r.onerror=function(e){var r,n,i;t._running=!1;var o=new TE(t._url,t._request,null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.response,"xhr.onerror.status:"+(null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},r.ontimeout=function(e){t.cancel();var r=new TE(t._url,t._request,{status:408},"timeout");t._onTimeout&&(r.isTimeout=!0,t._onTimeout(r,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),r.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(r)};var n=this._headers||{},i=SE(e);i&&(n.Range=i),n&&Object.keys(n).forEach((function(e){r.setRequestHeader(e,n[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),r.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t,r=e.target.status;if(r<200||r>299){var n=new TE(this._url,null,RS(RS({},e.target.response),{},{status:r}),"bad response,status:"+r);return n.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(n)}var i,o=null,a=!1,s=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===bE){var u,c=new Uint8Array(e.target.response);if(i=s+this._receivedLength,c&&c.byteLength>0){this._receivedLength+=c.byteLength;var f=Date.now()-this._startTime,l=PE(this._receivedLength,f);this.emit(LE,{speed:l,len:this._receivedLength,time:f,vid:this._vid,index:this._index,range:[i,s+this._receivedLength],priOptions:this._priOptions})}o=c,a=!((null===(u=this._range)||void 0===u?void 0:u.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",i,"end ",s+this._receivedLength,",dataLen,",c?c.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",a)}else a=!0,o=e.target.response;var d={ok:r>=200&&r<300,status:r,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(d=this._transformResponse(d,this._url)||d),this._onProgress&&this._onProgress(o,a,{index:this._index,vid:this._vid,range:[i,s+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},d),a?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(RE(this._onProgress?null:o,a,d,d.headers["content-length"],d.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,KS(US(r.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,r={},n=YS(e.getAllResponseHeaders().trim().split("\r\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value.split(": ");r[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(e){n.e(e)}finally{n.f()}return r}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),r}(Ik),CE=["retry","retryDelay","onRetryError","transformError"],DE=function(){function e(t,r){MS(this,e),this.promise=uE(),this.alive=!!r.onProgress,!r.logger&&(r.logger=new iE("Loader")),this._loaderType=t,this._loader=t===mE&&"undefined"!=typeof fetch?new IE:new ME,this._config=r,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=r.retryCheckFunc,this._logger=r.logger}var t;return DS(e,[{key:"exec",value:function(){var e=this,t=this._config,r=t.retry,n=t.retryDelay,i=t.onRetryError,o=t.transformError,a=HS(t,CE),s=function(){var t=IS(PS().mark((function t(){var u,c,f;return PS().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(a);case 3:u=t.sent,e.promise.resolve(u),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,o&&(c=o(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,{index:a.index,vid:a.vid,range:a.range,priOptions:a.priOptions}),e._retryCount++,f=!0,e._retryCheckFunc&&(f=e._retryCheckFunc(t.t0)),!(f&&e._retryCount<=r)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",a.range),e._retryTimer=setTimeout(s,n),t.abrupt("return");case 26:e.promise.reject(c);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return s(),this.promise}},{key:"cancel",value:(t=IS(PS().mark((function e(){return PS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e}();function jE(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if((t=t.filter(Boolean)).length<2)return t[0];var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}function BE(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var UE=function(e){BS(n,e);var t,r=GS(n);function n(e){var t;return MS(this,n),jS(qS(t=r.call(this,e)),"type",mE),jS(qS(t),"_queue",[]),jS(qS(t),"_alive",[]),jS(qS(t),"_currentTask",null),jS(qS(t),"_finnalUrl",""),jS(qS(t),"_config",void 0),t._config=function(e){return RS({loaderType:mE,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:_E,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e)}(e),t._config.loaderType!==yE&&IE.isSupported()||(t.type=yE),t.log=e.logger,t}return DS(n,[{key:"isFetch",value:function(){return this.type===mE}},{key:"load",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?r=e:r.url=e||r.url||this._config.url,(r=Object.assign({},this._config,r)).params&&(r.params=Object.assign({},r.params)),r.headers&&kE(r.headers)&&(r.headers=Object.assign({},r.headers)),r.body&&kE(r.body)&&(r.body=Object.assign({},r.body)),r.transformRequest&&(r=r.transformRequest(r)||r),r.logger=this.log;var n=new DE(this.type,r);return n.loader.on(LE,(function(e){t.emit(LE,e)})),this._queue.push(n),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),n.promise}},{key:"cancel",value:(t=IS(PS().mark((function e(){var t;return PS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,BE();case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,r;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(r=e._alive)||void 0===r?void 0:r.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return IE.isSupported()}}]),n}(Ik),NE={416:eE[ZS.NETWROK_RANGE_NOT_SATISFIABLE],403:eE[ZS.NETWORK_FORBIDDEN],404:eE[ZS.NETWORK_NOTFOUND],timeout:eE[ZS.NETWORK_TIMEOUT],"4xx":"".concat(eE[ZS.NETWORK],"4XX"),"5xx":"".concat(eE[ZS.NETWORK],"5XX"),networkError:eE[ZS.NETWORK],contentError:"".concat(eE[ZS.NETWORK],"contentError"),mse:eE[ZS.MEDIA][ZS.SUB_TYPES.MSE_OTHER],mseOpen:eE[ZS.MEDIA][ZS.SUB_TYPES.MSE_ADD_SB],mseAppend:eE[ZS.MEDIA][ZS.SUB_TYPES.MSE_APPEND_BUFFER],mse_hijack:eE[ZS.MEDIA][ZS.SUB_TYPES.MSE_HIJACK],eme_hijack:eE[ZS.MEDIA][ZS.SUB_TYPES.EME_HIJACK],metaError:eE[ZS.DEMUX][ZS.SUB_TYPES.MP4],muxError:eE[ZS.REMUX][ZS.SUB_TYPES.FMP4],other:eE[ZS.OTHER],waitTimeout:eE[ZS.RUNTIME][ZS.SUB_TYPES.BUFFERBREAK_ERROR],waitTimeoutWithHidden:eE[ZS.RUNTIME][ZS.SUB_TYPES.WAITING_TIMEOUT_ERROR],drm:eE[ZS.DRM][ZS.SUB_TYPES.LICENSE]},FE=ZS;var zE=tc((function e(t,r,n){Qu(this,e);var i=0,o=0;n&&n.range&&n.range.length>1&&(i=n.range[0],o=n.range[1]);var a=function(e){return NE[e]||e}(r);return{errorCode:a,errorType:t,errorMessage:(null==n?void 0:n.httpText)||(null==n?void 0:n.message),url:null==n?void 0:n.url,httpCode:r,version:ES,rangeStart:i,rangeEnd:o,ext:n,mediaError:{code:a,message:(null==n?void 0:n.httpText)||(null==n?void 0:n.message)}}})),VE=tc((function e(t,r,n){return Qu(this,e),{errorCode:r,errorType:t,version:ES,errorMessage:n.msg,ext:n,mediaError:{code:r,message:n.msg}}})),HE={};HE.nowTime=function(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}},HE.concatData=function(e,t){var r=[],n=0;e&&r.push(e),t&&r.push(t),r.every((function(e){return e&&(n+=e.byteLength),!0}));var i=new Uint8Array(n),o=0;return r.every((function(e){return e&&(i.set(e,o),o+=e.byteLength),!0})),i};var qE="content-range";function GE(e){var t=qE;if(e&&e.get&&e.get(t)){var r=e.get(t).split("/");if(2===(null==r?void 0:r.length))return r[1]}return null}function KE(e){try{e&&e.src&&(e.removeAttribute("src"),e.load())}catch(e){}}function WE(e,t){var r=e.media||e.video;e._detachSourceEvents(r),t instanceof Array?e._attachSourceEvents(r,t):t?r.src=t:r.removeAttribute("src")}var YE=HE;function JE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function XE(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?JE(Object(r),!0).forEach((function(t){nO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):JE(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function QE(){QE=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var o=t&&t.prototype instanceof d?t:d,a=Object.create(o.prototype),s=new S(i||[]);return n(a,"_invoke",{value:w(e,r,s)}),a}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l={};function d(){}function h(){}function p(){}var v={};u(v,o,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(E([])));m&&m!==t&&r.call(m,o)&&(v=m);var y=p.prototype=d.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,o,a,s){var u=f(e[n],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(l).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function w(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=T(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var i=f(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,l;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function E(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=p,n(y,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:h,configurable:!0}),h.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,a,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new _(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(y),u(y,s,"Generator"),u(y,o,(function(){return this})),u(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=E,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;k(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function $E(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function ZE(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){$E(o,n,i,a,s,"next",e)}function s(e){$E(o,n,i,a,s,"throw",e)}a(void 0)}))}}function eO(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,hO(n.key),n)}}function rO(e,t,r){return t&&tO(e.prototype,t),r&&tO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function nO(e,t,r){return(t=hO(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function iO(e){return(iO=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function oO(e,t){return(oO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function aO(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function sO(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uO(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=iO(e);if(t){var i=iO(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return sO(e)}(this,r)}}function cO(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||lO(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fO(e){return function(e){if(Array.isArray(e))return dO(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||lO(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lO(e,t){if(e){if("string"==typeof e)return dO(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?dO(e,t):void 0}}function dO(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function hO(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var pO=rO((function e(t,r){eO(this,e),this.type="file",this.message=t,this.data=r})),vO=function(){function e(){eO(this,e),nO(this,"_data",Object.create(null))}return rO(e,[{key:"set",value:function(e,t){this._data[e]=t}},{key:"get",value:function(e){return this._data[e]}},{key:"clear",value:function(){this._data=Object.create(null)}}]),e}();function gO(e,t){var r=e.trak;if(r&&r.length){var n=r.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),i=r.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(n||i){var o,a=[],s=[];if(n){var u,c,f,l=null===(u=n.mdia)||void 0===u||null===(c=u.minf)||void 0===c?void 0:c.stbl;if(!l)return;var d=null===(f=n.mdia.mdhd)||void 0===f?void 0:f.timescale,h=l.stts,p=l.stsc,v=l.stsz,g=l.stco,m=l.stss,y=l.ctts;if(!(d&&h&&p&&v&&g&&m))return;o=(a=mO(t,d,h,p,v,g,m,y)).map((function(e){return e.duration}))}if(i){var b,_,w,T=null===(b=i.mdia)||void 0===b||null===(_=b.minf)||void 0===_?void 0:_.stbl;if(!T)return;var x=null===(w=i.mdia.mdhd)||void 0===w?void 0:w.timescale,k=T.stts,S=T.stsc,E=T.stsz,O=T.stco;if(!(x&&k&&S&&E&&O))return;s=mO(t,x,k,S,E,O,null,null,o)}return{videoSegments:a,audioSegments:s}}}}function mO(e,t,r,n,i,o,a,s,u){var c,f,l,d,h=[],p=[],v=[],g=n.entries,m=o.entries,y=i.entrySizes,b=null==a?void 0:a.entries,_=null==s?void 0:s.entries;_&&(c=[],_.forEach((function(e){for(var t=e.count,r=e.offset,n=0;n<t;n++)c.push(r)}))),b&&(f={},b.forEach((function(e){f[e-1]=!0})));var w=0,T=0,x=0,k=0,S=0,E=g[0].samplesPerChunk,O=g[1]?g[1].firstChunk-1:1/0,R=0,P=-1;r.entries.forEach((function(e){var t=e.count,r=e.delta;d=r;for(var n=0;n<t;n++)l={dts:R,startTime:w,duration:d,size:y[T]||i.sampleSize,offset:m[x]+S,index:T},b&&(l.keyframe=f[T],l.keyframe?(P++,p.push([l]),v.push(l.duration)):(p[p.length-1].push(l),v[p.length-1]+=l.duration),l.gopId=P),c&&T<c.length&&(l.pts=R+c[T]),0===T&&(l.pts=0),h.push(l),w+=d,R+=r,++T<E?S+=l.size:(x++,S=0,x>=O&&(k++,O=g[k+1]?g[k+1].firstChunk-1:1/0),E+=g[k].samplesPerChunk)}));var L=h.length;if(L&&(!a||h[0].keyframe)){var A,I=[],M=[],C=0,D=0,j=function(e){var r;A=M[M.length-1],I.push({index:I.length,startTime:(null===(r=I[I.length-1])||void 0===r?void 0:r.endTime)||M[0].startTime/t,endTime:(A.startTime+A.duration)/t,duration:e,range:[M[0].offset,A.offset+A.size],frames:M}),C=0,M=[]};if(a)for(var B=e*t,U=0,N=p.length;U<N;U++){var F;C+=v[U],(F=M).push.apply(F,fO(p[U])),U+1<N?(0===U||C>B)&&j(C/t):j(C/t)}else for(var z=(u=u||[])[0]||e,V=0;V<L;V++){M.push(h[V]);var H=(C+=h[V].duration)/t;(V+1>=L||H+D>=z)&&(D+=H-z,j(H),z=u[I.length]||e)}return I}}function yO(e){var t="",r="",n=0,i=0,o=0,a=0,s=0,u=0,c=0;e.mvhd&&(s=e.mvhd.duration/e.mvhd.timescale);var f=e.trak;if(f){var l,d,h,p,v,g,m,y,b,_,w,T,x,k,S,E,O,R=f.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),P=f.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),L=null;if(R)if(L=null===(d=R.mdia)||void 0===d||null===(h=d.minf)||void 0===h||null===(p=h.stbl)||void 0===p?void 0:p.stsd.entries[0])if(n=L.width,i=L.height,u=null===(v=R.mdia)||void 0===v||null===(g=v.mdhd)||void 0===g?void 0:g.timescale,t=null===(m=L.avcC||L.hvcC)||void 0===m?void 0:m.codec,"encv"===L.type)l=null===(y=L.sinf)||void 0===y||null===(b=y.schi)||void 0===b?void 0:b.tenc.default_KID;if(P)if(L=null===(_=P.mdia)||void 0===_||null===(w=_.minf)||void 0===w||null===(T=w.stbl)||void 0===T?void 0:T.stsd.entries[0])if(o=L.channelCount,a=L.sampleRate,r=null===(x=L.esds)||void 0===x?void 0:x.codec,c=null===(k=P.mdia)||void 0===k||null===(S=k.mdhd)||void 0===S?void 0:S.timescale,"enca"===L.type)l=l||(null===(E=L.sinf)||void 0===E||null===(O=E.schi)||void 0===O?void 0:O.tenc.default_KID);return{kid:l?l.join(""):null,videoCodec:t,audioCodec:r,width:n,height:i,videoTimescale:u,audioChannelCount:o,audioSampleRate:a,duration:s,audioTimescale:c,moov:e}}}function bO(e){return"number"==typeof e&&!Number.isNaN(e)}var _O=["vid","cache"],wO=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&oO(e,t)}(h,e);var t,r,n,i,o,a,s,u,c,f,l,d=uO(h);function h(e){var t;eO(this,h),nO(sO(t=d.call(this)),"vid",""),nO(sO(t),"url",""),nO(sO(t),"meta",{}),nO(sO(t),"downloadInfo",[]),nO(sO(t),"videoSegments",[]),nO(sO(t),"audioSegments",[]),nO(sO(t),"cache",null),nO(sO(t),"_currentSegmentIndex",-1),nO(sO(t),"_currentLoadingSegmentIndex",-1),nO(sO(t),"buffer",void 0),nO(sO(t),"_error",void 0),nO(sO(t),"_transformError",(function(e){return e})),t._config=XE({vid:"",moovEnd:8e4,segmentDuration:2,maxDownloadInfoSize:30,responseType:"arraybuffer",cache:null},e);var r=t._config,n=r.vid,i=r.cache,o=aO(r,_O);return t.cache=i||new vO,t.vid=n||o.url,t.url=o.url,o.transformError=t._transformError,t.logger=new iE("MP4Loader_"+t.vid),e.openLog&&iE.enable(),o.logger=t.logger,t._loader=new UE(o),t._loader.on(LE,(function(e){t.emit(LE,e)})),t}return rO(h,[{key:"isMetaLoaded",get:function(){return this.videoSegments.length||this.audioSegments.length}},{key:"setCurrentSegment",value:function(e){bO(e)&&(this._currentSegmentIndex=e)}},{key:"isLastSegment",value:function(e){var t,r;return!!bO(e)&&e>=((null===(t=this.videoSegments[this.videoSegments.length-1])||void 0===t?void 0:t.index)||(null===(r=this.audioSegments[this.audioSegments.length-1])||void 0===r?void 0:r.index)||0)}},{key:"isSegmentLoading",value:function(e){return e===this._currentLoadingSegmentIndex}},{key:"changeUrl",value:(l=ZE(QE().mark((function e(t){var r,n,i,o=arguments;return QE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:t,n=o.length>2?o[2]:void 0,i=o.length>3?o[3]:void 0,e.next=5,this.reset(i);case 5:t&&(this.url=t),r&&(this.vid=r),n&&(this._config.moovEnd=n);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"getOrLoadMeta",value:(f=ZE(QE().mark((function e(t){return QE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMetaLoaded){e.next=3;break}return e.next=3,this.loadMeta(t);case 3:return e.abrupt("return",this.meta);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"loadMetaProcess",value:(c=ZE(QE().mark((function e(t,r,n,i){var o,a,s,u,c=this;return QE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=cO(r,2),a=o[0],s=o[1],this._error=!1,this.logger.debug("[loadMetaProcess start], range,",[a,s]),u=function(){var e=ZE(QE().mark((function e(r,o,u){var f,l,d,h,p,v,g,m;return QE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c.meta&&null!=u&&u.range&&u.range.length>0&&u.range[1]>=s&&(o=!0,c.logger.debug("[loadMetaProcess],data done,setstate true,[",a,s,"]")),o&&null!=u&&u.range&&u.range.length>0&&u.range[1]<s&&(o=!1,c.logger.debug("[loadMetaProcess],data not done,setstate false,[",a,s,"]")),c.logger.debug("[loadMetaProcess],task,[",a,s,"], range,",u.range,",dataLen,",r?r.byteLength:void 0,", state,",o,",err,",c._error),!c._error&&r&&r.byteLength>0&&n(r,o,u),!c.meta.moov&&!c._error){e.next=6;break}return e.abrupt("return");case 6:if(!(r&&r.byteLength>0)){e.next=44;break}if(c.buffer=jE(c.buffer,r),f=pS.findBox(c.buffer,["moov"])[0]){e.next=23;break}if(l=pS.findBox(c.buffer,["mdat"])[0],!o){e.next=23;break}if(l){e.next=18;break}return c._error=!0,n(null,o,u,{err:"cannot find moov or mdat box"}),e.abrupt("return");case 18:return d=l.start+l.size,e.next=21,c.loadData([d,""],t,i);case 21:(h=e.sent)&&(f=pS.findBox(h.data,["moov"])[0]);case 23:if(!(f&&o&&f.size>f.data.length)){e.next=27;break}return c.logger.debug("[loadMetaProcess],moov not all, range,",u.range[1],",dataLen,",c.buffer.byteLength,", state,",o),e.next=27,c.loadMetaProcess(t,[u.range[1],f.start+f.size-1],n);case 27:if(!(f&&f.size<=f.data.length)||c.meta.moov){e.next=44;break}if(p=pS.moov(f)){e.next=33;break}return c._error=!0,n(null,o,u,{err:"cannot parse moov box"}),e.abrupt("return");case 33:if(v=gO(p,c._config.segmentDuration)){e.next=38;break}return c._error=!0,n(null,o,u,{err:"cannot parse segments"}),e.abrupt("return");case 38:c.meta=yO(p),g=v.videoSegments,m=v.audioSegments,c.videoSegments=g,c.audioSegments=m,c.logger.debug("[loadMetaProcess] moov ok"),n(void 0,o,{meta:{meta:c.meta,videoSegments:g,audioSegments:m}});case 44:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),e.next=6,this.loadData([a,s||this._config.moovEnd],t,XE({onProgress:u},i));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return c.apply(this,arguments)})},{key:"loadMeta",value:(u=ZE(QE().mark((function e(t,r,n){var i,o,a,s,u,c,f,l,d;return QE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=[],this.logger.debug("[loadMeta start]"),e.next=4,this.loadData([0,r||this._config.moovEnd],t,n);case 4:if(o=e.sent){e.next=7;break}return e.abrupt("return");case 7:if(i.push(o),a=pS.findBox(o.data,["moov"])[0]){e.next=23;break}if(s=pS.findBox(o.data,["mdat"])[0]){e.next=13;break}throw new pO("cannot find moov or mdat box",o.data);case 13:return u=s.start+s.size,e.next=16,this.loadData([u],t,n);case 16:if(o=e.sent){e.next=19;break}return e.abrupt("return");case 19:if(i.push(o),a=pS.findBox(o.data,["moov"],u)[0]){e.next=23;break}throw new pO("cannot find moov box",o.data);case 23:if(!(a.size>a.data.length)){e.next=31;break}return e.next=26,this.loadData([o.data.length,a.start+a.size-1],t,n);case 26:if(o=e.sent){e.next=29;break}return e.abrupt("return");case 29:i.push(o),a.data=jE(a.data,o.data);case 31:if(c=pS.moov(a)){e.next=34;break}throw new pO("cannot parse moov box",a.data);case 34:if(f=gO(c,this._config.segmentDuration)){e.next=37;break}throw new pO("cannot parse segments",a.data);case 37:return this.meta=yO(c),l=f.videoSegments,d=f.audioSegments,this.videoSegments=l,this.audioSegments=d,this.logger.debug("[load moov end!!!!!]"),e.abrupt("return",{meta:this.meta,videoSegments:l,audioSegments:d,responses:i});case 43:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"loadCacheMeta",value:function(e,t){var r=gO(e.moov,this._config.segmentDuration),n=r.videoSegments,i=r.audioSegments;this.videoSegments=n,this.audioSegments=i,this._currentSegmentIndex=t,this.meta=e}},{key:"getSegmentByTime",value:function(e){var t,r;return this.videoSegments.length?(t=this.videoSegments.find((function(t){return t.startTime<=e&&t.endTime>e})))&&(r=this.audioSegments[t.index]):r=this.audioSegments.find((function(t){return t.startTime<=e&&t.endTime>e})),{video:t,audio:r}}},{key:"loadSegmentByTime",value:(s=ZE(QE().mark((function e(t,r){var n,i,o,a,s,u=arguments;return QE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(u.length>2&&void 0!==u[2])||u[2],i=u.length>3&&void 0!==u[3]?u[3]:{},this.isMetaLoaded){e.next=5;break}return e.next=5,this.loadMeta(r);case 5:return o=this.getSegmentByTime(t),a=o.video,s=o.audio,e.abrupt("return",this._loadSegment(a,s,r,n,i));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"loadNextSegment",value:(a=ZE(QE().mark((function e(t){var r,n,i,o,a=arguments;return QE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(a.length>1&&void 0!==a[1])||a[1],n=a.length>2&&void 0!==a[2]?a[2]:{},this.isMetaLoaded){e.next=5;break}return e.next=5,this.loadMeta();case 5:return i=this.videoSegments[this._currentSegmentIndex+1],o=this.audioSegments[this._currentSegmentIndex+1],e.abrupt("return",this._loadSegment(i,o,t,r,n));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"preload",value:(o=ZE(QE().mark((function e(t){var r,n,i,o,a,s,u,c=this;return QE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMetaLoaded){e.next=3;break}return e.next=3,this.loadMeta(!0);case 3:if(t&&!(t<0)){e.next=5;break}return e.abrupt("return");case 5:if(r=this.getSegmentByTime(t),n=r.video,i=r.audio,o=Math.max((null==n?void 0:n.index)||0,(null==i?void 0:i.index)||0)){e.next=9;break}return e.abrupt("return");case 9:return a=this.videoSegments.slice(0,o),s=this.audioSegments.slice(0,o),u=function(){var e=ZE(QE().mark((function e(t){return QE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t>o)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,c._loadSegment(a[t],s[t],!0,!1);case 4:return e.next=6,u(t+1);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e.next=14,u(0);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"cancel",value:function(){return this._loader.cancel()}},{key:"reset",value:(i=ZE(QE().mark((function e(){var t=arguments;return QE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length>0&&void 0!==t[0]&&t[0]){e.next=5;break}return this.logger.debug("[MP4loader reset func call loader.cancel]"),e.next=5,this._loader.cancel();case 5:this.vid=this.url="",this.meta={},this.downloadInfo=[],this.videoSegments=[],this.audioSegments=[],this._currentSegmentIndex=-1,this._currentLoadingSegmentIndex=-1;case 12:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"destroy",value:(n=ZE(QE().mark((function e(){return QE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.reset();case 2:this.cache.clear();case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"_loadSegment",value:(r=ZE(QE().mark((function e(t,r,n,i,o){var a,s;return QE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t||r){e.next=2;break}return e.abrupt("return");case 2:return a=(null==t?void 0:t.index)||(null==r?void 0:r.index)||0,this._currentLoadingSegmentIndex=a,e.prev=4,e.next=7,this.loadData([Math.min((null==t?void 0:t.range[0])||1/0,(null==r?void 0:r.range[0])||1/0),Math.max((null==t?void 0:t.range[1])||0,(null==r?void 0:r.range[1])||0)],n,o);case 7:s=e.sent;case 8:return e.prev=8,this._currentLoadingSegmentIndex=-1,e.finish(8);case 11:if(s){e.next=13;break}return e.abrupt("return");case 13:return i&&(this._currentSegmentIndex=a),s.video=t,s.audio=r,e.abrupt("return",s);case 17:case"end":return e.stop()}}),e,this,[[4,,8,11]])}))),function(e,t,n,i,o){return r.apply(this,arguments)})},{key:"loadData",value:(t=ZE(QE().mark((function e(t,r,n){var i,o,a,s;return QE().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._getCacheKey(t),e.next=3,this.cache.get(i);case 3:if(o=e.sent){e.next=11;break}return s=n&&n.url?n.url:this.url,e.next=8,this._loader.load(s,XE({range:t,vid:this.vid},n));case 8:a=e.sent,e.next=12;break;case 11:a={data:o,state:!0,options:{fromCache:!0,range:t,vid:this.vid}};case 12:if(a){e.next=14;break}return e.abrupt("return");case 14:return o||(a.data&&this.downloadInfo.push({startTime:a.startTime,endTime:a.endTime,size:a.data.byteLength,range:t}),this.downloadInfo&&this.downloadInfo.length>this._config.maxDownloadInfoSize&&(this.downloadInfo=this.downloadInfo.slice(-this._config.maxDownloadInfoSize))),e.abrupt("return",a);case 17:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})},{key:"_getCacheKey",value:function(e){return(this.vid||this.url)+":"+e}}]),h}(Ik),TO=function(){try{return"undefined"!=typeof localStorage&&"setItem"in window.localStorage&&!!window.localStorage.setItem}catch(e){return!1}}()&&!function(){var e="_localstorage_support_test";try{return window.localStorage.setItem(e,!0),window.localStorage.removeItem(e),!1}catch(e){return!0}}(),xO=kO();function kO(){if(TO)try{return!!window.localStorage.getItem("playerlog")}catch(e){return!1}return!1}function SO(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];xO&&console.log&&(t=console).log.apply(t,["[logger]",YE.nowTime(),e].concat(n))}function EO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function OO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?EO(Object(r),!0).forEach((function(t){ac(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function RO(e,t,r){return t=nc(t),rc(e,PO()?Reflect.construct(t,r||[],nc(e).constructor):t.apply(e,r))}function PO(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(PO=function(){return!!e})()}!function(){if(TO)try{return!!window.localStorage.getItem("playertestlog")}catch(e){return!1}}();var LO="error",AO="metaReady",IO="moov_request_Progress",MO="update_load_fragmentIdx",CO=function(e){function t(e,r){var n;return Qu(this,t),ac(n=RO(this,t),"onprogressDataArrive",function(){var e=Xu(bg.mark((function e(t,r,i){var o;return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t&&t.byteLength>0&&((o=n.timeRange[i.index].range)&&i.range[1]>=o[1]&&!r&&(r=!0),n.log("[mp4.loadFragment onprogressDataArrive ] receive data, >>> index,",i.index,",range,",JSON.stringify(i.range),", dataLen,",t.byteLength),n._mux(t,i.range[0],i.index,r)),r&&(n.timeRange[i.index].downloaded=!0,n.bufferLoadedPos=-1,n.log("[FragLoadDowned],fragmentIdx,",i.index,",rangeEnd,",i.range[1]));case 2:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}()),n.url=e,n.options=t.getDefaultConfig(),Object.keys(r).map((function(e){void 0!==r[e]&&null!==r[e]&&(n.options[e]=r[e])})),n.timeRange=[],n.CHUNK_SIZE=n.options.chunkSize,n.bufferLoaded=new Uint8Array(0),n.bufferLoadedPos=0,n.meta=null,n.videoTrak=null,n.audioTrak=null,n.canDownload=!0,n._loadSuccessCallBack=null,n._isPending=!1,n._metaLoading=!1,n.MP4Loader=new wO(OO(OO({segmentDuration:n.options.segmentDuration,url:e,vid:r.vid,retry:n.options.retryCount,retryDelay:n.options.retryDelay,timeout:n.options.timeout},r.reqOptions),{},{openLog:kO()})),n.MP4Demuxer=null,n.FMP4Remuxer=null,n._needInitSegment=!0,n._switchBitRate=!1,n.enableWorker=n.options.enableWorker,n.enableWorker||(n.MP4Demuxer=null,n.FMP4Remuxer=null),n.seekTime=-1,n.changeBitRateTime=-1,n}return oc(t,e),tc(t,[{key:"changeBitRate",value:(l=Xu(bg.mark((function e(t){return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.url=t.url,e.next=3,this.MP4Loader.changeUrl(this.url,this.options.vid+Date.now(),this.CHUNK_SIZE);case 3:this._switchBitRate=!0,this.log("[switchBitrate] changeUrl, bitRate,",this.url);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"log",value:function(e){for(var t=this.options,r=t&&t.vid?"[MP4] ".concat(t.vid," ").concat(e):"[MP4] ".concat(e),n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];SO.apply(void 0,[r].concat(i))}},{key:"errorHandler",value:(f=Xu(bg.mark((function e(t,r){var n,i,o,a;return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.response,i=t.message,o=this.options?this.options.vid:"",a=null,this._isPending=!0,n?(a=new zE("network",n.status,{httpText:n.httpText,message:i,url:n.url}),this.emit(LO,a)):(console.error("[MP4] [".concat(o,"] errorHandler,"),t),a=t,this.emit(LO,a));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"init",value:(c=Xu(bg.mark((function e(){return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.url){e.next=3;break}return e.next=3,this.MP4Loader.changeUrl(this.url,this.options.vid+Date.now(),this.CHUNK_SIZE);case 3:return e.next=5,this.getMetaInfo();case 5:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"getTimeRange",value:function(){for(var e=[],t=null,r=0;this.videoTrak&&r<this.videoTrak.length;r++)t={startTime:this.videoTrak[r].startTime,endTime:this.videoTrak[r].endTime,downloaded:!1,isLoading:!1},e.push(t);if(this.audioTrak&&this.audioTrak.length>e.length)for(var n=e.length;n<this.audioTrak.length;n++)t={startTime:Math.max(this.audioTrak[n].startTime,t?t.endTime:0),endTime:Math.max(this.audioTrak[n].endTime,t?t.endTime:0),downloaded:!1,isLoading:!1},e.push(t);return e}},{key:"getMetaInfo",value:(u=Xu(bg.mark((function e(){var t,r,n,i=this,o=arguments;return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=!(o.length>0&&void 0!==o[0])||o[0],e.prev=1,this._metaLoading=!0,this.log("getMetaInfo start"),this.bufferLoaded=new Uint8Array(0),r=0,n=function(){var e=Xu(bg.mark((function e(n,o,a,s,u){var c,f,l;return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=u?Number(GE(u.headers)):0,i.log("getMetaInfo onProgressHandle, dataLen,",n?n.byteLength:-1,", state,",o,",range,",JSON.stringify(a.range)),!s){e.next=5;break}return i.emit(LO,s),e.abrupt("return");case 5:n&&a.range[0]===r&&(i.bufferLoaded=Ck(Uint8Array,i.bufferLoaded,new Uint8Array(n)),r+=n.byteLength),a.meta&&!i.meta&&(f=a.meta,i.videoTrak=f.videoSegments,i.audioTrak=f.audioSegments,i.timeRange=i.getTimeRange(),i.meta=OO(OO({},f.meta),{},{ext:{videoTrak:i.videoTrak,audioTrak:i.audioTrak}}),f.bufferLoaded=i.bufferLoaded,i.log("meta reach"),t&&i.emit(AO,i.meta)),i.meta&&o&&(i.log("[getMetaInfo req end]"),i._metaLoading=!1),i.meta&&(n||o)&&(i.log("emit moov_req_progress"),i.emit(IO)),l=(null==a?void 0:a.range)||[],c>0&&!i.meta&&l&&l.length>1&&l[1]>=c&&(i.log("getMetaInfo_error_nometa"),i.emit(LO,{message:"getMetaInfo_error_nometa"}));case 11:case"end":return e.stop()}}),e)})));return function(t,r,n,i,o){return e.apply(this,arguments)}}(),e.next=9,this.MP4Loader.loadMetaProcess(this.MP4Loader.cache,[0,this.CHUNK_SIZE],n);case 9:e.next=15;break;case 11:e.prev=11,e.t0=e.catch(1),console.error("[MP4] trigger errorHandler getMetaInfo",null===e.t0||void 0===e.t0?void 0:e.t0.message),this.loadError(e.t0,"getMetaInfo");case 15:case"end":return e.stop()}}),e,this,[[1,11]])}))),function(){return u.apply(this,arguments)})},{key:"getFragmentIdx",value:function(e){var t,r;if(this.videoTrak.length){if(t=this.videoTrak.find((function(t){return t.startTime<=e&&t.endTime>e})),r=this.audioTrak.find((function(t){return t.startTime<=e&&t.endTime>e})),t&&r)return Math.min(t.index,r.index);if(t||r)return t?t.index:r.index;var n=Number.MAX_VALUE;return this.videoTrak&&this.videoTrak.length>0&&(n=this.videoTrak.length-1),this.audioTrak&&this.audioTrak.length>0&&(n=Math.min(this.audioTrak.length-1,n)),n}return(r=this.audioTrak.find((function(t){return t.startTime<=e&&t.endTime>e})))?r.index:0}},{key:"_checkHasMeta",value:(s=Xu(bg.mark((function e(){var t;return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.log(" loadMeta start"),this._metaLoading=!0,e.prev=2,e.next=5,this.MP4Loader.loadMeta(this.MP4Loader.cache,Math.round(this.CHUNK_SIZE/2));case 5:return t=e.sent,this._metaLoading=!1,this.videoTrak=t.videoSegments,this.audioTrak=t.audioSegments,this.meta=OO(OO({},t.meta),{},{ext:{videoTrak:this.videoTrak,audioTrak:this.audioTrak}}),this.timeRange=this.getTimeRange(),this.bufferLoaded=new Uint8Array(0),t.bufferLoaded=this.bufferLoaded,e.abrupt("return",!0);case 16:return e.prev=16,e.t0=e.catch(2),console.error(e.t0),this._metaLoading=!1,this.emit(LO,e.t0),console.error(e.t0),e.abrupt("return",!1);case 23:case"end":return e.stop()}}),e,this,[[2,16]])}))),function(){return s.apply(this,arguments)})},{key:"resetFragmentLoadState",value:function(e){for(var t=0;t<this.timeRange.length;t++)t<e?(this.timeRange[t].downloaded=!0,this.timeRange[t].isLoading=!0):(this.timeRange[t].downloaded=!1,this.timeRange[t].isLoading=!1)}},{key:"getFragRange",value:function(e){var t,r,n,i,o=null;this.videoTrak&&(o=e<this.videoTrak.length?this.videoTrak[e]:this.videoTrak[this.videoTrak.length-1]);var a=null;this.audioTrak&&(a=e<this.audioTrak.length?this.audioTrak[e]:this.audioTrak[this.audioTrak.length-1]);var s=0,u=0;this.videoTrak&&e>=this.videoTrak.length-1&&(s=-1),this.audioTrak&&e>=this.audioTrak.length-1&&(u=-1);var c=[Math.min((null===(t=o)||void 0===t?void 0:t.range[0])||1/0,(null===(r=a)||void 0===r?void 0:r.range[0])||1/0),Math.max((null===(n=o)||void 0===n?void 0:n.range[1])+s||0,(null===(i=a)||void 0===i?void 0:i.range[1])+u||0)];return e<this.timeRange.length&&(this.timeRange[e].range=c),c}},{key:"load",value:(a=Xu(bg.mark((function e(t,r){var n,i,o;return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loadSuccessCallBack=r,!this._switchBitRate||this._metaLoading){e.next=12;break}return this.log("[switchBitrate], switch bitRate start load, time,",t>=this.videoTrak.length?this.audioTrak[t].startTime:this.videoTrak[t].startTime,", fragIndex,",t),e.next=5,this._checkHasMeta();case 5:n=e.sent,this.changeBitRateTime>0&&(this.timeRange[t].startTime<=this.changeBitRateTime&&this.changeBitRateTime<this.timeRange[t].endTime?this.log("[switchBitrate], not need update load fragIndex",t,",stTime,",this.changeBitRateTime):(t=this.getFragmentIdx(this.changeBitRateTime),this.log("[switchBitrate], need update load fragIndex",t,",stTime,",this.changeBitRateTime,",newBitrateTimeRange,",this.timeRange[t].startTime,"-",this.timeRange[t].endTime),this.emit(MO,t)),this.seekTime=this.changeBitRateTime,this.changeBitRateTime=-1),this.resetFragmentLoadState(t),this.log("[switchBitrate], reset timerange state,",t),this._needInitSegment=!0,this.resetTansmuxer(),n&&(this._switchBitRate=!1);case 12:if(!this._switchBitRate||!this._metaLoading){e.next=14;break}return e.abrupt("return");case 14:i=this.getFragRange(t),this.log("loadFragment,",t,",range,",JSON.stringify(i)),this.seekTime>0?(o=this.getSubRange(t,this.seekTime,i),this.loadFragment(t,o),this.seekTime=-1):this.loadFragment(t,i);case 17:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"getSubRange",value:function(e,t,r){var n=r[0],i=r[0],o=1,a=!1;if(this.log(">>>>>getSubRange time,",t,JSON.stringify(r)),this.videoTrak){var s=e<this.videoTrak.length?this.videoTrak[e]:this.videoTrak[this.videoTrak.length-1],u=s.frames.filter(DO),c=this.meta.videoTimescale,f=u[0].startTime/c;this.log(">>>>>getSubRange video, startTime,",s.startTime,",endTime,",s.endTime);for(var l=0;l<u.length;l++)this.log(">>>>>getSubRange video keyFrameList, startTime,",u[l].startTime/c,",range,",u[l].offset);for(;o<u.length;o++){var d=u[o].startTime/c;if(f<=t&&t<d&&r[0]<u[o-1].offset){n=u[o-1].offset,a=!0,this.log(">>>>>getSubRange video end, startTime,",f,",endTime,",d,",startRange,",n,", keyFrameIndex,",o-1);break}f=d}!a&&f<=t&&t<s.endTime+.8&&(n=u[o-1].offset,this.log(">>>>>getSubRange video last, startTime,",f,",endTime,",s.endTime,",startRange,",n))}if(o=1,this.audioTrak){var h=e<this.audioTrak.length?this.audioTrak[e]:this.audioTrak[this.audioTrak.length-1],p=h.frames,v=this.meta.audioTimescale;o=Math.floor((t*v-p[0].startTime)/h.frames[0].duration);for(var g=(o=Math.min(p.length-1,o))>0?p[o-1].startTime/v:p[0].startTime/v;o>=0&&o<p.length;)if(o>0&&g>t)g=p[o-=1].startTime/v;else{var m=(p[o].startTime+p[o].duration)/v;if(g<=t&&t<m&&r[0]<p[o].offset){i=p[o].offset,a=!0,this.log(">>>>>getSubRange audio end, startTime,",g,",endTime,",m,",startRange,",i,", index,",o);break}g=m,o++}}var y=[Math.min(i,n),r[1]];return this.log(">>>>>getSubRange finalRange ",JSON.stringify(y),",oldRange,",JSON.stringify(r)),y}},{key:"_mux",value:function(e,t,r,n){var i=this.getSamplesRange(r,"video"),o=this.getSamplesRange(r,"audio"),a=[t,t+e.byteLength];try{this.MP4Demuxer||(this.MP4Demuxer=new SS(this.videoTrak,this.audioTrak,null,{openLog:kO()}));var s,u=this.MP4Demuxer.demuxPart(e,t,i,o,this.meta.moov,this.useEME,this.kidValue);this.FMP4Remuxer||this.checkCodecH265()&&!this.options.supportHevc||(this.FMP4Remuxer=new kS(this.MP4Demuxer.videoTrack,this.MP4Demuxer.audioTrack,{openLog:kO()})),this.log("[mux], videoTimeRange,",u.videoTrack?[u.videoTrack.startPts,u.videoTrack.endPts]:null,",audioTimeRange,",u.audioTrack?[u.audioTrack.startPts,u.audioTrack.endPts]:null);var c=[Math.min(u.videoTrack.startPts,u.audioTrack.startPts),Math.max(u.videoTrack.endPts,u.audioTrack.endPts)];if(this.FMP4Remuxer){var f=this.FMP4Remuxer.remux(this._needInitSegment,{initMerge:!0,range:a});f.initSegment&&(this._needInitSegment=!1),s={buffer:YE.concatData(f.audioSegment,f.videoSegment),range:a,state:n,context:{range:a,fragIndex:r,timeRange:c},initSeg:f.initSegment}}else s={videoTrack:u.videoTrack,audioTrack:u.audioTrack,buffer:null,range:a,state:n,context:{range:a,fragIndex:r,timeRange:c}};this._loadSuccessCallBack&&this._loadSuccessCallBack(s)}catch(n){console.error("mux err:",n);var l=new VE(FE.remux,NE.muxError,{msg:JSON.stringify(n)});this.errorHandler(l,"mux",{fragIndex:r,range:[t,t+e.byteLength]})}}},{key:"getSamplesRange",value:function(e,t){var r=[];switch(t){case"video":if(this.videoTrak&&e<this.videoTrak.length){var n=this.videoTrak[e].frames;r.push(n[0].index),r.push(n[n.length-1].index)}break;case"audio":if(this.audioTrak&&e<this.audioTrak.length){var i=this.audioTrak[e].frames;r.push(i[0].index),r.push(i[i.length-1].index)}break;default:console.warn("[getSamplesRange] type ",t," is invalid")}return r}},{key:"loadFragment",value:(o=Xu(bg.mark((function e(t,r){var n,i,o,a;return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this._isPending||r.length>0&&0===r[0]&&0===r[1]||this.timeRange[t].isLoading)){e.next=2;break}return e.abrupt("return");case 2:if(this.log("[MP4.loadFragment] ,fragIndex,",t,",range ",r,",len ,",r[1]-r[0],", bufferLoaded_Len,",this.bufferLoaded.byteLength),!(r.length>=2&&r[1]&&r[1]>0&&r[1]<=this.bufferLoaded.byteLength)){e.next=13;break}this.timeRange[t].isLoading=!0,n=Math.max(r[0],this.bufferLoadedPos),i=new Uint8Array(this.bufferLoaded.slice(n,r[1])),this.log("[mp4.loadFragment] has all data: ",n,r[1]),this.timeRange[t].downloaded=!0,this.bufferLoadedPos=-1,this._mux(i,n,t,!0),e.next=34;break;case 13:if(!(r.length>=2&&r[0]&&r[0]<=this.bufferLoaded.byteLength)){e.next=29;break}if(this.timeRange[t].isLoading){e.next=27;break}if(o=Math.max(r[0],this.bufferLoadedPos),!((a=new Uint8Array(this.bufferLoaded.slice(o,r[1]))).byteLength>0)){e.next=22;break}return this.bufferLoadedPos=o+a.byteLength,this.log("[mp4.loadFragment] has part data: ",o,o+a.byteLength),this._mux(a,o,t,r[1]<=this.bufferLoadedPos),e.abrupt("return");case 22:if(this._metaLoading||this.timeRange[t].isLoading){e.next=27;break}return this.log("[mp4.loadFragment] ready to load part data >>> ",this.bufferLoaded.byteLength,r[1]),this.timeRange[t].isLoading=!0,e.next=27,this.startLoad([this.bufferLoaded.byteLength,r[1]],t);case 27:e.next=34;break;case 29:if(this._metaLoading&&!(r[0]>=this.CHUNK_SIZE)||this.timeRange[t].isLoading){e.next=34;break}return this.timeRange[t].isLoading=!0,this.log("[mp4.loadFragment],ready to load all data ,segmentIdx, ",t,",range >>> ",JSON.stringify(r)),e.next=34,this.startLoad(r,t);case 34:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"startLoad",value:(i=Xu(bg.mark((function e(t,r){return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.MP4Loader.loadData(t,this.MP4Loader.cache,{index:r,onProgress:this.onprogressDataArrive,onProcessMinLen:this.options.onProcessMinLen,url:this.url});case 3:e.next=10;break;case 5:e.prev=5,e.t0=e.catch(0),console.error("[MP4] trigger errorHandler startLoad",t,r,null===e.t0||void 0===e.t0?void 0:e.t0.message),this.timeRange[r].isLoading=!1,this.loadError(e.t0,"startLoad",{range:t,fragIndex:r});case 10:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(e,t){return i.apply(this,arguments)})},{key:"loadError",value:function(e,t,r){var n;!e.response&&(e.response={}),e.isTimeout?e.response.status="timeout":null!=e&&null!==(n=e.response)&&void 0!==n&&n.status||(e.response.status="networkError"),this.errorHandler(e,t,r)}},{key:"cancelLoading",value:(n=Xu(bg.mark((function e(){return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.MP4Loader;case 2:if(e.t0=e.sent,!e.t0){e.next=5;break}this.MP4Loader.cancel();case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"update",value:(r=Xu(bg.mark((function e(t){return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.url=t,this.MP4Loader&&this.MP4Loader.changeUrl(t),this.MP4Loader&&this.MP4Loader.changeUrl(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"restart",value:function(){this._isPending=!1,this.meta||this.init()}},{key:"checkCodecH265",value:function(){return this.meta&&(this.meta.videoCodec.indexOf("hvc1")>-1||this.meta.videoCodec.indexOf("hev1")>-1)}},{key:"destroy",value:function(){this.hasDestroyed||(this.resetTansmuxer(),this._isPending=!1,this._metaLoading=!1,this.bufferLoadedPos=0,this.bufferLoaded=new Uint8Array(0),this.MP4Loader&&(this.MP4Loader.cancel(),this.MP4Loader.destroy()),this.hasDestroyed=!0)}},{key:"resetTansmuxer",value:function(){this.MP4Demuxer&&this.MP4Demuxer.reset(),this.MP4Demuxer=null,this.FMP4Remuxer&&this.FMP4Remuxer.reset(),this.FMP4Remuxer=null}}],[{key:"getDefaultConfig",value:function(){return{segmentDuration:5,onProcessMinLen:1024,chunkSize:8e5,retryCount:3,retryDelay:1e3,timeout:3e3,enableWorker:!1,playerId:"",vid:"",ext:{}}}}]);var r,n,i,o,a,s,u,c,f,l}(Ik);function DO(e){if(e.keyframe)return e}var jO=function(){return tc((function e(t){Qu(this,e),this.onTick_=t,this.cancelPending_=null}),[{key:"tickAfter",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.stop();var n=!0,i=null;this.cancelPending_=function(){window.clearTimeout(i),n=!1};return i=window.setTimeout((function(){n&&(t.onTick_(),r&&r())}),1e3*e),this}},{key:"tickEvery",value:function(e){var t=this;this.tickAfter(e,(function(){t.tickEvery(e)}))}},{key:"stop",value:function(){this.cancelPending_&&(this.cancelPending_(),this.cancelPending_=null)}}])}(),BO=function(){return tc((function e(){var t,r;Qu(this,e);var n=new Promise((function(e,n){t=e,r=n}));return n.resolve=function(e){t(e),n.state="fulfilled"},n.reject=function(e){r(e),n.state="rejected",n.isBreak="DESTROYED"===e},n.state="pending",n}),[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}])}();function UO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function NO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?UO(Object(r),!0).forEach((function(t){ac(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function FO(e,t,r){return t=nc(t),rc(e,zO()?Reflect.construct(t,r||[],nc(e).constructor):t.apply(e,r))}function zO(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(zO=function(){return!!e})()}var VO=null,HO=null,qO=null,GO=null,KO=function(e){function r(e){var n;return Qu(this,r),ac(n=FO(this,r,[e]),"_onMp4DataCallBack",(function(){n._isMseInit&&n._onTimeUpdate()})),ac(n,"_onMp4MetaReady",(function(e){var r=n.config,i=n.mp4.checkCodecH265();try{if(i&&!n.config.supportHevc){var o="browser not support HEVC",a=new t.Errors(n.player,{errorType:"runtime",errorTypeCode:FE.runtime,errorCode:NE.h265Error,errorMessage:o,vid:r.vid,mediaError:{code:NE.h265Error,message:o}});n._errorHandler(a)}else n._initMse(e),n._initPromise.resolve()}catch(e){console.error(e);var s=new t.Errors(n.player,{errorType:"runtime",errorTypeCode:FE.runtime,errorCode:NE.mse,errorMessage:null==e?void 0:e.message,vid:r.vid,mediaError:{code:NE.other1,message:null==e?void 0:e.message}});return void n._errorHandler(s)}n._loadData()})),ac(n,"_onMp4Error",(function(e){var t=n.playerConfig.vid;console.error("[Index] _onMp4Error",t,e),n._errorHandler(e)})),ac(n,"_loadDataSuccess",(function(e){if(!n.isDestroy&&n.mse){n.log("[loadFragment] _loadDataSuccess ",JSON.stringify(e.context.range),",dataLen,",e.buffer?e.buffer.byteLength:0,e.state);try{e.initSeg&&(n._appendInitSeg(e.initSeg),(!e.buffer||e.buffer.byteLength<1)&&(n.log("no data, must load data"),n._onTimeUpdate()));var r=e.buffer,i=e.state,o=e.context;if(n.mse&&i&&(!r||r.byteLength<=0)&&o.fragIndex===n.mp4.timeRange.length-1){var a=n.player.buffered;a&&a.length>0&&(n.bufferEndTime=a.end(a.length-1)),n._isEnded(),n.log("loaded ended !!!==>>>",JSON.stringify(o.range),", fragIndex,",o.fragIndex,", bufferEndTime,",n.bufferEndTime,",meta_duration,",n.mp4.meta.duration)}if(n.mse&&i&&o.fragIndex===n.mp4.timeRange.length-1&&(!r||r.byteLength<=0)){var s=n.player.buffered;s&&s.length>0&&(n.bufferEndTime=s.end(s.length-1)),n._isEnded(),n.log("load ended !!!==>>>",n.playerConfig.vid,JSON.stringify(o.range),", fragIndex,",o.fragIndex,", bufferEndTime,",n.bufferEndTime,",meta_duration,",n.mp4.meta.duration)}r&&n.mse&&r&&r.byteLength>0&&n._appendBuffer(gE.VIDEO,r,o,i)}catch(e){console.error("appendBuffer error: ",e),n.log("appendBuffer error",e);var u=new t.Errors(n.player,{errorType:"runtime",errorTypeCode:FE.runtime,errorCode:NE.mse,vid:n.player.config.vid,errorMessage:e.message,mediaError:{code:NE.mse,message:e.message}});n._errorHandler(u)}null!=e&&e.state&&n._onTimeUpdate()}})),ac(n,"_onWaiting",(function(){var e=n,t=e.player,r=e.config;clearTimeout(n._waitInBufferTimer),n._waitInBufferTimer=null;var i=t.currentTime,o=t.bufferedPoint;o.end>0&&o.end-t.currentTime>=2&&n._waitAdjustTimeCnt<r.waitJampBufferMaxCnt&&(n._waitInBufferTimer=setTimeout((function(){n._waitAdjustTimeCnt++,t.currentTime=t.currentTime+.5,n.log("[waitInBufferTimeout], waitAdjustTimeCnt,",n._waitAdjustTimeCnt,",curtime,",i,YE.nowTime())}),r.waitingInBufferTimeOut))})),ac(n,"_onSeeking",Xu(bg.mark((function e(){var t,r,i,o,a,s,u,c,f,l;return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(t=n).player,i=t.mp4,o=r.currentTime,n.log("[seekTime], curTime,",o,",buffer,",r.buffered2.bufferedList),i&&i.meta){e.next=5;break}return e.abrupt("return");case 5:if(n.endofstream=!1,i.bufferLoadedPos=-1,i._metaLoading=!1,a=r.bufferedPoint,s=!1,u=0,!(a.end>0)){e.next=25;break}if(s=!0,!(i.meta.duration-a.end<.5)){e.next=17;break}return n._startProgress(),n.log("[seeking in buffered range], buffer end,",a.end,", duration,",i.meta.duration),e.abrupt("return");case 17:if(u=i.getFragmentIdx(a.end),n._curLoadSegmentIdx!==u){e.next=22;break}return n._startProgress(),n.log("[seeking in buffered range], seek fragIndex is current load segmentIdx",u),e.abrupt("return");case 22:i.seekTime=a.end,u<0&&(u=n._curLoadSegmentIdx),n.log("[seeking in buffered range], seekTime ",o,",bufferRange,",a.start,"-",a.end,", fragIndex,",u);case 25:return s||(i.seekTime=o,(u=i.getFragmentIdx(o))<0&&(u=n._curLoadSegmentIdx),n.log("[seekTime out buffer range], curTime,",o,", Idx,",u),(c=n.mse)&&c.isFull()&&(f=r.buffered2.bufferedList,l=f[f.length-1],c.clearOpQueues(gE.VIDEO),n._checkRemoveSourceBuffer([l.start,l.end],r.currentTime,!0,!0))),e.next=28,i.cancelLoading();case 28:i.resetFragmentLoadState(u),n._curLoadSegmentIdx=u,n._onTimeUpdate(),n._startProgress(),n._isEnded();case 33:case"end":return e.stop()}}),e)})))),ac(n,"changeDefineCanPlay",(function(e,r,i,o){var a=n.player;a.ended?a.currentTime=0:(n.log("[oldChangeDefinition],this._changeDefState,",n._changeDefState),a.currentTime=n._changeDefState?n._changeDefState.currentTime:e,(n._changeDefState?n._changeDefState.paused:r)?a.pause():a.play(),n._changeDefState=null,a.emit(t.Events.AFTER_DEFINITION_CHANGE,{from:i,to:o}))})),ac(n,"changeDefinition",function(){var e=Xu(bg.mark((function e(r,i){var o,a,s,u,c,f,l,d,h,p,v,g;return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=(o=n).player,s=o.config,u=o.mp4,i||(i=a.curDefinition),n._MSEError=!1,c=a.definitionList,f=null,l=0;case 6:if(!(l<c.length)){e.next=14;break}if((d=c[l].definition)!==r.definition&&d!==Number(r.definition)){e.next=11;break}return f=c[l],e.abrupt("break",14);case 11:l++,e.next=6;break;case 14:if(f){e.next=17;break}return console.error("there is no definition for ",r),e.abrupt("return");case 17:if(!s.witchBitRateWay){e.next=20;break}return n.oldChangeDefinition(f,i),e.abrupt("return");case 20:if(!n.useVideoLoad){e.next=23;break}return qO.call(n.player,f,i),e.abrupt("return");case 23:if(a.emit(t.Events.DEFINITION_CHANGE,{from:i,to:f}),h=a.currentTime,(p=u.getFragmentIdx(h))<0&&(p=n._curLoadSegmentIdx),n.log("switchBitrate:point,fragIndex,",p,",startTime,",u.timeRange[p].startTime,",currentTime,",a.currentTime),!u){e.next=33;break}return n.mp4.changeBitRateTime=h,e.next=32,u.cancelLoading();case 32:u._metaLoading&&(u._metaLoading=!1);case 33:return n._removeBuffeEndTime=u.timeRange[p].startTime,n._isChangeDefinition=!0,(v=a.getBufferedRange(a.buffered))[1]>0&&v[1]-a.currentTime>5&&(n.mse.clearOpQueues(gE.VIDEO),n.mse.remove(gE.VIDEO,a.currentTime+5,v[1])),n.log("switchBitrate: resetFragmentLoadState,",p),u.resetFragmentLoadState(p),n._curLoadSegmentIdx=p,n._handlerUrl(f.url),a.config.url=f.url,g=NO(NO({},f),{},{url:n.config._mainURL}),e.next=45,n.mp4.changeBitRate(g);case 45:n._onTimeUpdate(),a.emit("RESOLUTION_UPDATE",g);case 47:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),ac(n,"_replayHook",(function(){var e;return null===(e=n.player)||void 0===e||e.play(),!1})),ac(n,"_retryHook",(function(){return n.beforePlayerInit(),!1})),ac(n,"_errorMiddleware",(function(e,t){var r=(e||{}).error,i=(n.player||{}).video;r&&r.message&&r.message.indexOf("CHUNK_DEMUXER_ERROR_APPEND_FAILED")>-1||i&&!n.useVideoLoad&&function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))}(i)?n._errorHandler(r):t(e.eventName,null==e?void 0:e.error)})),n.compatibleConfig(n.playerConfig),n.mp4=null,n.mse=null,n._waitAdjustTimeCnt=0,n._lastCheckTime=YE.nowTime(),n._removeBuffeEndTime=0,n._pendingPromises=[],n}return oc(r,e),tc(r,[{key:"compatibleConfig",value:function(e){for(var t=Object.keys(e),r=null,n=0;n<t.length;n++){var i=t[n].toLowerCase();if("mp4player"===i||"m4aplayer"===i){r=e[t[n]];break}}r&&(this.config=NO(NO({},this.config),r));var o=this.config,a=o.reqOptions,s=o.headers;!s||a&&a.headers||(this.config.reqOptions=NO(NO({},a),{},{headers:s}))}},{key:"afterCreate",value:function(){var e=this;window.__mp4player=this;try{t.BasePlugin.defineGetterOrSetter(this.player,{__url:{get:function(){try{return e.mse?e.mse.url:e.config.url}catch(e){return console.error(e),null}}}})}catch(e){console.error(e)}this._proxyPlayer()}},{key:"attachEvents",value:function(){this.off(t.Events.SEEKING,this._onSeeking),this.on(t.Events.SEEKING,this._onSeeking),this.on(t.Events.WAITING,this._onWaiting),this.off(t.Events.URL_CHANGE,this.switchURL),this.on(t.Events.URL_CHANGE,this.switchURL)}},{key:"detachEvents",value:function(){this.off(t.Events.SEEKING,this._onSeeking),this.off(t.Events.WAITING,this._onWaiting),this.off(t.Events.URL_CHANGE,this.switchURL)}},{key:"_proxyPlayer",value:function(){var e=this;"function"==typeof this.player.playNext&&(VO=this.player.playNext),this.player.playNext=function(){e.playNext.apply(e,arguments)},HO=this.player._startInit,GO=this.player.switchURL,qO=this.player.changeDefinition,this.player._startInit=this._playerStartInit.bind(this),this.player.switchURL=this.switchURL.bind(this),this.player.changeDefinition=this.changeDefinition.bind(this),this.player.useHooks("replay",this._replayHook),this.player.useHooks("retry",this._retryHook),this.player.setEventsMiddleware({error:this._errorMiddleware})}},{key:"_playerStartInit",value:function(e){var r=this,n=this.config,i=this.playerConfig;void 0===n.supportHevc&&null!==t.Sniffer&&void 0!==t.Sniffer&&t.Sniffer.isHevcSupported&&t.Sniffer.isHevcSupported()&&(n.supportHevc=!0),this._handlerUrl(i.url);var o=this.initMp4();this._initPromise=o,this._addPendingPromise(this._initPromise),this.mse&&"String"===t.Util.typeOf(e)&&/^blob/.test(e)&&e!==this.mse.url&&(e=i.url),o.then((function(){r.mse&&(e=r.mse.url),r.attachEvents(),r._startProgress()})).catch((function(n){console.error(n);var i=!!r._initPromise&&r._initPromise.isBreak;if(!r.isDestroy&&!i){var o=n;o.errorCode||((o=new t.Errors(r.player,{errorType:FE.RUNTIME,errorCode:(null==n?void 0:n.errorCode)||NE.other,vid:r.playerConfig.vid,errorMessage:(null==n?void 0:n.errorMessage)||(null==n?void 0:n.message),mediaError:{code:(null==n?void 0:n.httpCode)||NE.other,message:(null==n?void 0:n.errorMessage)||(null==n?void 0:n.message),errorType:null==n?void 0:n.errorType}})).url=e),r.useVideoLoad=!0,r.player.vtype="MP4_1",r.player.emit("playCatch",r.player.vtype,o)}})).finally((function(){if(r._initPromise){var t=r._initPromise.isBreak;t||(r._initPromise&&r._removePendingPromise(r._initPromise),r._initPromise=null,!r.isDestroy&&!t&&HO.call(r.player,e))}}))}},{key:"initMp4",value:function(){var e=this,t=this.player,r=this.config;t.config.vid||(t.config.vid=Date.now());var n=new BO;this.mp4&&(this.mp4.off(AO,this._onMp4MetaReady),this.mp4.off(LO,this._onMp4Error),this.mp4.off(IO,this._onMp4DataCallBack),this.mp4.destroy(),this.mp4=null);var i=r._mainURL;return this.mp4=new CO(i,NO(NO({},this.config),{},{vid:t.config.vid})),this.mp4.on(AO,this._onMp4MetaReady),this.mp4.on(LO,this._onMp4Error),this.mp4.on(IO,this._onMp4DataCallBack),this.mp4.on(MO,(function(t){e._curLoadSegmentIdx=t,e.log("[update curLoadSegmentIdx]",t)})),this.mp4.init(),n}},{key:"_handlerUrl",value:function(e){var r,n=this.config,i=this.playerConfig,o=[];if("String"===t.Util.typeOf(e))r=e,i.backupURL&&o.push(i.backupURL);else if("Array"===t.Util.typeOf(e)&&e.length>0&&(r=e[0].src,e.length>1))for(var a=1;a<e.length;a++)o.push(e[a].src);if(!r&&0===o.length)return!1;n._mainURL=r,n._backupURL=o}},{key:"setConfig",value:function(e){this.config=Object.assign(this.config,e)}},{key:"playNext",value:function(e){var t=this.player;this._defInited=!1,t.resetState(),t._currentTime=0,t._duration=0,t.isPlaying=!1,this._MSEError=!1,t.pause(),this._reset(),t.setConfig(e),this.log("[Index] playNext",e),t.play(),this.emit("playnext")}},{key:"checkDegrade",value:function(e){return!this.config.closeDowngrade||"networkError"===e.httpCode}},{key:"_errorHandler",value:function(e){var t,r,n=this.player,i=this.config,o=this.playerConfig;if(n&&!this.useVideoLoad){var a=i._backupURL;if(a&&a.length>0){var s=a[0];return this.mp4.update(s),this.mp4.restart(),void a.splice(0,1)}!e.url&&null!==(t=this.mp4)&&void 0!==t&&t.url&&(e.url=this.mp4.url);var u=n.paused;if(console.error("final error !!!!, ",i.vid,e,null===(r=this.player.video)||void 0===r?void 0:r.error),this.player.vtype="MP4_2",this.player.emit("playCatch",this.player.vtype,e),this.checkDegrade(e)){this._initPromise&&this._removeAndRejectInitPromise(e),this._reset();var c=this.mp4?this.mp4.url:o.url;this._startDegradedPlayback(e,u,c)}else{this.player.pause(),this._reset();var f=n.currentTime;this.destroyMSE(),n.currentTime=f,this.emit("error",e)}}}},{key:"_startDegradedPlayback",value:function(e,t,r){var n=this,i=this.player,o=this.playerConfig;this.useVideoLoad=!0,this.destroyMSE(),this._currentTime=i._currentTime,this.__onmetadataHandle=function(){n._currentTime&&(i.currentTime=n._currentTime),t?n.player.pause():n.player.play(),(i.media||i.video).removeEventListener("loadedmetadata",n.__onmetadataHandle),n.__onmetadataHandle=null};var a=i.media||i.video;a.addEventListener("loadedmetadata",this.__onmetadataHandle),KE(a),o.url=r,WE(i,r)}},{key:"_addPendingPromise",value:function(e){this._pendingPromises.push(e)}},{key:"_removePendingPromise",value:function(e){var t=this._pendingPromises.indexOf(e);t>-1&&this._pendingPromises.splice(t,1)}},{key:"_cancelPendingPromises",value:function(){this._pendingPromises.length>0&&this._pendingPromises.forEach((function(e){e.reject("DESTROYED")})),this._pendingPromises=[]}},{key:"_removeAndRejectInitPromise",value:function(e){this._initPromise&&(this._removePendingPromise(this._initPromise),this._initPromise.reject(e))}},{key:"_initMse",value:(o=Xu(bg.mark((function e(t){var r,n,i,o,a,s=this;return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mse){e.next=4;break}return e.next=3,this.mse.unbindMedia();case 3:this.mse=null;case 4:r=this.mp4&&this.mp4.checkCodecH265(),n=!!t.videoCodec,i=!!t.audioCodec,o=n&&i?r?'video/mp4; codecs="hev1.1.6.L93.B0, mp4a.40.5"':'video/mp4; codecs="avc1.64001E, mp4a.40.5"':n?r?'video/mp4; codecs="hev1.1.6.L93.B0"':'video/mp4; codecs="avc1.64001E"':'video/mp4; codecs="mp4a.40.5"',a=ac({},gE.VIDEO,{mimeType:"video/mp4",codec:o}),this.mse=new gE,this.mse.bindMedia(this.player.video).then((function(){var e=Object.keys(a);try{for(var t=0;t<e.length;t++){var r=e[t];s.mse.createSource(r,a[r].codec)}}catch(e){console.error("MSE error: ",e),s._errorHandler(e)}s._isMseInit=!0,s._onTimeUpdate()}));case 12:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"destroyMSE",value:(i=Xu(bg.mark((function e(){var t;return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this.mse)||void 0===t?void 0:t.unbindMedia();case 2:this.mse=null;case 3:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"_onTimeUpdate",value:function(){var e=this,t=this.mse,r=this.mp4,n=this.player,i=this.config;if(r){var o=r.timeRange,a=n.getBufferedRange(n.buffered2);if(t&&r&&r.canDownload){YE.nowTime()-this._lastCheckTime>1e3&&(this._lastCheckTime=YE.nowTime(),this._loadStuckCheck(),this._checkRemoveSourceBuffer(a,n.currentTime));var s=n.paused?n.currentTime+i.minBufferLength:n.currentTime+i.maxBufferLength;a[1]-s<0&&o.every((function(t,r){return!!t.downloaded||(!e._isChangeDefinition&&t.endTime-t.startTime>1&&e._isInBuffer(t)?(t.downloaded=!0,t.isLoading=!0,e.log("onTimeUpdate, ".concat(r," download segment, has buffer"),t.startTime,t.endTime),!0):void(t.startTime-n.currentTime<i.maxBufferLength&&(e._curLoadSegmentIdx=r,e.log("[onTimeUpdate],load index==>>>, ",r,",IdxTimeRange, ",t.startTime,"-",t.endTime,",buffEnd, ",a[1],",playCurTime,",n.currentTime,", bufferLen,",a[1]-n.currentTime,",bufferRangeList,",e.player.buffered2?e.player.buffered2.bufferedList:null),e._loadData())))})),this._isEnded()}this.checkRemoveOldBitrateBuffer()}}},{key:"checkRemoveOldBitrateBuffer",value:function(){var e=this.mse,t=this.player;e&&this._removeBuffeEndTime>0&&t.currentTime>this._removeBuffeEndTime+1&&(this.log("remove old bitrate buffer",this._removeBuffeEndTime),e.remove(gE.VIDEO,0,this._removeBuffeEndTime-1),this._removeBuffeEndTime=0)}},{key:"_isInBuffer",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=!1,n=this.player.video.buffered,i=0;i<n.length;i++){var o=n.start(i)-t,a=n.end(i)+t;if(o<=e.startTime&&e.endTime<=a){r=!0;break}}return r}},{key:"_loadData",value:(n=Xu(bg.mark((function e(){return bg.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mp4&&this._isMseInit){e.next=3;break}return this.log("loadData, player.mp4 null",this._isMseInit),e.abrupt("return");case 3:return e.prev=3,e.next=6,this.mp4.load(this._curLoadSegmentIdx,this._loadDataSuccess);case 6:e.next=12;break;case 8:e.prev=8,e.t0=e.catch(3),console.error("[Index] _loadData error",this.playerConfig.vid,e.t0),this._errorHandler(e.t0);case 12:case"end":return e.stop()}}),e,this,[[3,8]])}))),function(){return n.apply(this,arguments)})},{key:"_appendInitSeg",value:function(e){var t=this;this.mp4&&this.mse&&this.mse.append(gE.VIDEO,e,{vid:this.playerConfig.vid,range:null,dataLen:e.byteLength,isinit:!0}).then((function(e){t.log("appendInitSeg end ==>>>",e.context?e.context:null,", costTime,",e.costtime)}))}},{key:"_appendBuffer",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,o=this.mse,a=this.config;o.append(e,t,{vid:a.vid,fragIndex:n.fragIndex,range:n.range,dataLen:t.byteLength,state:i}).then((function(e){if(e&&(r.log("player appendBuffer end ==>>>",e.context?e.context:null,", costTime,",e.costtime,", opt,",e.name,",bufferRange,",r.player.getBufferedRange()),r.mse&&n.state&&n.fragIndex===r.mp4.timeRange.length-1)){var t=r.player.buffered;t&&t.length>0&&(r.bufferEndTime=t.end(t.length-1)),r._isEnded(),r.log("loaded ended !!!==>>>",n.range,", fragIndex,",n.fragIndex,", bufferEndTime,",r.bufferEndTime,",meta_duration,",r.mp4.meta.duration)}})).catch((function(e){if(console.log("[MSE error]",e),e&&null!=o&&o.isFull()){var t=r.player.getBufferedRange(r.player.buffered2);r._checkRemoveSourceBuffer(t,r.player.currentTime,!0)}}))}},{key:"_checkRemoveSourceBuffer",value:function(e,t,r){var n=this,i=this.mse,o=this.mp4,a=this.player;if(i&&o&&a&&(r&&(clearTimeout(this._removeBufferTimer),this._removeBufferTimer=null),e||(e=a.getBufferedRange(a.buffered2)),t||(t=a.currentTime),!(!r&&YE.nowTime()-this._checkRemoveBufferLastTime<=this.config.removeBufferLen||this.endofstream)&&(this._checkRemoveBufferLastTime=YE.nowTime(),e&&e[0]>=0&&(t-e[0]>this.config.removeBufferLen||i.isFull())))){var s=e[1],u=o.getFragmentIdx(s);if(u>=0&&o.timeRange[u].startTime<t){var c=Math.floor(Math.min(o.timeRange[u].startTime,e[1]));e[0]<c?(this.log("[checkremoveSourceBuffer], remove range==>>>",e[0],c),i.remove(gE.VIDEO,e[0],c)):i.isFull()&&!this._removeBufferTimer&&(this._removeBufferTimer=setTimeout((function(){n._checkRemoveSourceBuffer(null,null,!0)}),1e4))}}}},{key:"_isEnded",value:function(){var e=this.player,t=this.mp4,r=e.bufferedPoint,n=r?r.end:0;return!this.endofstream&&this.mse&&t.meta.duration-e.currentTime<.5&&(this.log("[check player isEnded],deal mse.endOfStream, currentTime,",e.currentTime,", bufferend,",n,", duration,",t.meta.duration),this.endofstream=!0,this.mse.endOfStream()),!!(t&&t.meta&&t.meta.duration-e.currentTime<.5)&&(this._stopProgress(),this.log("[check player isEnded],stopProgress and endOfStream,currentTime, ",e.currentTime,", bufferend,",n,", duration,",t.meta.duration),this.mse&&this.mse.endOfStream(),!0)}},{key:"switchURL",value:function(e){if(this.useVideoLoad){var t=this.player,r=t.currentTime;WE(t,e),t.once("canplay",(function(){t.currentTime=r})),t.play()}else this.changeDefinition(e)}},{key:"oldChangeDefinition",value:function(e,t){var r=this,n=this.config,i=this.player;this.log("[oldChangeDefinition],currentTime,",i.currentTime,",from,",t,",to,",e);var o=i.currentTime,a=i.paused;this._changeDefState||(this._changeDefState={currentTime:o,paused:a},this.log("[oldChangeDefinition],currentTime,",i.currentTime,",pause,",a)),i.config.url=e.url,n.focusUserDefinition=!0,i.currentTime=0,i.pause(),this._reset(),this._isMseInit=!1,this._changeDefineCanPlay&&i.off("canplay",this._changeDefineCanPlay),this._changeDefineCanPlay=function(){r.changeDefineCanPlay(o,a,t,e),r._changeDefineCanPlay=null},i.once("canplay",this._changeDefineCanPlay),this.player.video.load(),this.initMp4()}},{key:"_loadStuckCheck",value:function(){var e=this,r=this.config,n=this.player,i=this.playerConfig;r.disableBufferBreakCheck||(n.currentTime-(this._lastCurrentTime||0)>.1||n.paused?1!==this._bufferBreakFlag&&2!==this._bufferBreakFlag||(this.log("视频没有卡死,重置卡死标记"),this._bufferBreakFlag=0,clearTimeout(this._bufferBreakTimer),this._bufferBreakFlag=null):this._bufferBreakFlag||(this._bufferBreakFlag=1,this.log("卡死计时开始! 持续".concat(r.waitingTimeOut,"毫秒则确认卡死")),this._bufferBreakTimer=setTimeout((function(){e.isDestroy||(1===e._bufferBreakFlag&&(e._bufferBreakFlag=2,e.log("确认卡死!!!"),e._errorHandler(new t.Errors(e.player,{errorType:"runtime",errorTypeCode:FE.runtime,errorCode:NE.waitTimeout,errorMessage:"wait_timeout",vid:i.vid}))),e._bufferBreakTimer=null)}),r.waitingTimeOut)),this._lastCurrentTime=n.currentTime)}},{key:"isDestroy",get:function(){return!this.player}},{key:"_stopProgress",value:function(){this._hasStartProgress=!1,this._requestTimer&&(this._requestTimer.stop(),this._requestTimer=null),this._bufferBreakTimer&&(clearTimeout(this._bufferBreakTimer),this._bufferBreakTimer=null,this._bufferBreakFlag=void 0)}},{key:"_startProgress",value:function(){var e=this;this._hasStartProgress||(this._stopProgress(),this._requestTimer=new jO((function(){e._requestTimer&&e._onTimeUpdate()})),this._requestTimer.tickEvery(this.config.tickInSeconds),this._hasStartProgress=!0)}},{key:"log",value:function(e){for(var t=this.playerConfig,r=t&&t.vid?"[Index]".concat(t.vid," ").concat(e):"[Index] ".concat(e),n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];SO.apply(void 0,[r].concat(i))}},{key:"_reset",value:function(){this._isMseInit=!1,this.endofstream=!1,this._curLoadSegmentIdx=0,this._removeBuffeEndTime=0,this._isChangeDefinition=!1,this._stopProgress(),this.mp4&&(this.mp4.off(AO,this._onMp4MetaReady),this.mp4.off(LO,this._onMp4Error),this.mp4.off(IO,this._onMp4DataCallBack),this.mp4.destroy(),this.mp4=null),this.mse&&(this.mse.unbindMedia(),this.mse=null),KE(this.player.video)}},{key:"destroy",value:function(){var e=this.player;e.removeHooks("replay",this._replayHook),e.removeHooks("retry",this._retryHook),e.removeEventsMiddleware({error:this._errorMiddleware}),this.detachEvents(),this._reset(),this.player.playNext=VO,this.player._startInit=HO,this.player.changeDefinition=qO,this.player.switchURL=GO,this._bufferBreakTimer&&clearInterval(this._bufferBreakTimer),this._removeBufferTimer&&(clearTimeout(this._removeBufferTimer),this._removeBufferTimer=null),this._waitInBufferTimer&&(clearTimeout(this._waitInBufferTimer),this._waitInBufferTimer=null)}}],[{key:"pluginName",get:function(){return"mp4Plugin"}},{key:"defaultConfig",get:function(){return{maxBufferLength:40,minBufferLength:5,disableBufferBreakCheck:!1,waitingTimeOut:15e3,waitingInBufferTimeOut:5e3,waitJampBufferMaxCnt:3,tickInSeconds:.1,reqOptions:null,closeDowngrade:!1}}},{key:"version",get:function(){return"3.0.0-alpha.27"}}]);var n,i,o}(t.BasePlugin);e.M4aPlayer=KO,e.default=KO,Object.defineProperty(e,"__esModule",{value:!0})}));
|