Socket
Socket
Sign inDemoInstall

xgplayer-streaming-shared

Package Overview
Dependencies
Maintainers
5
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xgplayer-streaming-shared - npm Package Compare versions

Comparing version 3.0.0-alpha.5-16 to 3.0.0-alpha.5-17

2

dist/index.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).XGPlayerStreamingShared=t()}(this,(function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(e){return e&&e.Math==Math&&e},n=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||Function("return this")(),i={},o=function(e){try{return!!e()}catch(t){return!0}},s=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),a=!o((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),u=a,c=Function.prototype.call,h=u?c.bind(c):function(){return c.apply(c,arguments)},l={},d={}.propertyIsEnumerable,f=Object.getOwnPropertyDescriptor,_=f&&!d.call({1:2},1);l.f=_?function(e){var t=f(this,e);return!!t&&t.enumerable}:d;var p,g,y=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},m=a,b=Function.prototype,T=b.bind,S=b.call,v=m&&T.bind(S,S),E=m?function(e){return e&&v(e)}:function(e){return e&&function(){return S.apply(e,arguments)}},O=E,R=O({}.toString),w=O("".slice),A=function(e){return w(R(e),8,-1)},P=o,C=A,L=Object,D=E("".split),j=P((function(){return!L("z").propertyIsEnumerable(0)}))?function(e){return"String"==C(e)?D(e,""):L(e)}:L,k=function(e){return null==e},B=k,x=TypeError,M=function(e){if(B(e))throw x("Can't call method on "+e);return e},I=j,F=M,U=function(e){return I(F(e))},N=function(e){return"function"==typeof e},q=N,H="object"==typeof document&&document.all,z=void 0===H&&void 0!==H?function(e){return"object"==typeof e?null!==e:q(e)||e===H}:function(e){return"object"==typeof e?null!==e:q(e)},V=n,G=N,K=function(e){return G(e)?e:void 0},W=function(e,t){return arguments.length<2?K(V[e]):V[e]&&V[e][t]},X=E({}.isPrototypeOf),Y=n,Q=W("navigator","userAgent")||"",$=Y.process,J=Y.Deno,Z=$&&$.versions||J&&J.version,ee=Z&&Z.v8;ee&&(g=(p=ee.split("."))[0]>0&&p[0]<4?1:+(p[0]+p[1])),!g&&Q&&(!(p=Q.match(/Edge\/(\d+)/))||p[1]>=74)&&(p=Q.match(/Chrome\/(\d+)/))&&(g=+p[1]);var te=g,re=o,ne=!!Object.getOwnPropertySymbols&&!re((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&te&&te<41})),ie=ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,oe=W,se=N,ae=X,ue=Object,ce=ie?function(e){return"symbol"==typeof e}:function(e){var t=oe("Symbol");return se(t)&&ae(t.prototype,ue(e))},he=String,le=function(e){try{return he(e)}catch(t){return"Object"}},de=N,fe=le,_e=TypeError,pe=function(e){if(de(e))return e;throw _e(fe(e)+" is not a function")},ge=pe,ye=k,me=h,be=N,Te=z,Se=TypeError,ve={exports:{}},Ee=n,Oe=Object.defineProperty,Re=function(e,t){try{Oe(Ee,e,{value:t,configurable:!0,writable:!0})}catch(r){Ee[e]=t}return t},we=Re,Ae="__core-js_shared__",Pe=n[Ae]||we(Ae,{}),Ce=Pe;(ve.exports=function(e,t){return Ce[e]||(Ce[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.25.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.25.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Le=M,De=Object,je=function(e){return De(Le(e))},ke=je,Be=E({}.hasOwnProperty),xe=Object.hasOwn||function(e,t){return Be(ke(e),t)},Me=E,Ie=0,Fe=Math.random(),Ue=Me(1..toString),Ne=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ue(++Ie+Fe,36)},qe=n,He=ve.exports,ze=xe,Ve=Ne,Ge=ne,Ke=ie,We=He("wks"),Xe=qe.Symbol,Ye=Xe&&Xe.for,Qe=Ke?Xe:Xe&&Xe.withoutSetter||Ve,$e=function(e){if(!ze(We,e)||!Ge&&"string"!=typeof We[e]){var t="Symbol."+e;Ge&&ze(Xe,e)?We[e]=Xe[e]:We[e]=Ke&&Ye?Ye(t):Qe(t)}return We[e]},Je=h,Ze=z,et=ce,tt=function(e,t){var r=e[t];return ye(r)?void 0:ge(r)},rt=function(e,t){var r,n;if("string"===t&&be(r=e.toString)&&!Te(n=me(r,e)))return n;if(be(r=e.valueOf)&&!Te(n=me(r,e)))return n;if("string"!==t&&be(r=e.toString)&&!Te(n=me(r,e)))return n;throw Se("Can't convert object to primitive value")},nt=TypeError,it=$e("toPrimitive"),ot=function(e,t){if(!Ze(e)||et(e))return e;var r,n=tt(e,it);if(n){if(void 0===t&&(t="default"),r=Je(n,e,t),!Ze(r)||et(r))return r;throw nt("Can't convert object to primitive value")}return void 0===t&&(t="number"),rt(e,t)},st=ce,at=function(e){var t=ot(e,"string");return st(t)?t:t+""},ut=z,ct=n.document,ht=ut(ct)&&ut(ct.createElement),lt=function(e){return ht?ct.createElement(e):{}},dt=!s&&!o((function(){return 7!=Object.defineProperty(lt("div"),"a",{get:function(){return 7}}).a})),ft=s,_t=h,pt=l,gt=y,yt=U,mt=at,bt=xe,Tt=dt,St=Object.getOwnPropertyDescriptor;i.f=ft?St:function(e,t){if(e=yt(e),t=mt(t),Tt)try{return St(e,t)}catch(r){}if(bt(e,t))return gt(!_t(pt.f,e,t),e[t])};var vt={},Et=s&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ot=z,Rt=String,wt=TypeError,At=function(e){if(Ot(e))return e;throw wt(Rt(e)+" is not an object")},Pt=s,Ct=dt,Lt=Et,Dt=At,jt=at,kt=TypeError,Bt=Object.defineProperty,xt=Object.getOwnPropertyDescriptor,Mt="enumerable",It="configurable",Ft="writable";vt.f=Pt?Lt?function(e,t,r){if(Dt(e),t=jt(t),Dt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Ft in r&&!r.writable){var n=xt(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:It in r?r.configurable:n.configurable,enumerable:Mt in r?r.enumerable:n.enumerable,writable:!1})}return Bt(e,t,r)}:Bt:function(e,t,r){if(Dt(e),t=jt(t),Dt(r),Ct)try{return Bt(e,t,r)}catch(n){}if("get"in r||"set"in r)throw kt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Ut=vt,Nt=y,qt=s?function(e,t,r){return Ut.f(e,t,Nt(1,r))}:function(e,t,r){return e[t]=r,e},Ht={exports:{}},zt=s,Vt=xe,Gt=Function.prototype,Kt=zt&&Object.getOwnPropertyDescriptor,Wt=Vt(Gt,"name"),Xt={EXISTS:Wt,PROPER:Wt&&"something"===function(){}.name,CONFIGURABLE:Wt&&(!zt||zt&&Kt(Gt,"name").configurable)},Yt=N,Qt=Pe,$t=E(Function.toString);Yt(Qt.inspectSource)||(Qt.inspectSource=function(e){return $t(e)});var Jt,Zt,er,tr=Qt.inspectSource,rr=N,nr=n.WeakMap,ir=rr(nr)&&/native code/.test(String(nr)),or=ve.exports,sr=Ne,ar=or("keys"),ur=function(e){return ar[e]||(ar[e]=sr(e))},cr={},hr=ir,lr=n,dr=E,fr=z,_r=qt,pr=xe,gr=Pe,yr=ur,mr=cr,br="Object already initialized",Tr=lr.TypeError,Sr=lr.WeakMap;if(hr||gr.state){var vr=gr.state||(gr.state=new Sr),Er=dr(vr.get),Or=dr(vr.has),Rr=dr(vr.set);Jt=function(e,t){if(Or(vr,e))throw Tr(br);return t.facade=e,Rr(vr,e,t),t},Zt=function(e){return Er(vr,e)||{}},er=function(e){return Or(vr,e)}}else{var wr=yr("state");mr[wr]=!0,Jt=function(e,t){if(pr(e,wr))throw Tr(br);return t.facade=e,_r(e,wr,t),t},Zt=function(e){return pr(e,wr)?e[wr]:{}},er=function(e){return pr(e,wr)}}var Ar={set:Jt,get:Zt,has:er,enforce:function(e){return er(e)?Zt(e):Jt(e,{})},getterFor:function(e){return function(t){var r;if(!fr(t)||(r=Zt(t)).type!==e)throw Tr("Incompatible receiver, "+e+" required");return r}}},Pr=o,Cr=N,Lr=xe,Dr=s,jr=Xt.CONFIGURABLE,kr=tr,Br=Ar.enforce,xr=Ar.get,Mr=Object.defineProperty,Ir=Dr&&!Pr((function(){return 8!==Mr((function(){}),"length",{value:8}).length})),Fr=String(String).split("String"),Ur=Ht.exports=function(e,t,r){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!Lr(e,"name")||jr&&e.name!==t)&&(Dr?Mr(e,"name",{value:t,configurable:!0}):e.name=t),Ir&&r&&Lr(r,"arity")&&e.length!==r.arity&&Mr(e,"length",{value:r.arity});try{r&&Lr(r,"constructor")&&r.constructor?Dr&&Mr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(i){}var n=Br(e);return Lr(n,"source")||(n.source=Fr.join("string"==typeof t?t:"")),e};Function.prototype.toString=Ur((function(){return Cr(this)&&xr(this).source||kr(this)}),"toString");var Nr=N,qr=vt,Hr=Ht.exports,zr=Re,Vr=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(Nr(r)&&Hr(r,o,n),n.global)i?e[t]=r:zr(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(s){}i?e[t]=r:qr.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Gr={},Kr=Math.ceil,Wr=Math.floor,Xr=Math.trunc||function(e){var t=+e;return(t>0?Wr:Kr)(t)},Yr=function(e){var t=+e;return t!=t||0===t?0:Xr(t)},Qr=Yr,$r=Math.max,Jr=Math.min,Zr=Yr,en=Math.min,tn=function(e){return e>0?en(Zr(e),9007199254740991):0},rn=function(e){return tn(e.length)},nn=U,on=function(e,t){var r=Qr(e);return r<0?$r(r+t,0):Jr(r,t)},sn=rn,an=function(e){return function(t,r,n){var i,o=nn(t),s=sn(o),a=on(n,s);if(e&&r!=r){for(;s>a;)if((i=o[a++])!=i)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},un={includes:an(!0),indexOf:an(!1)},cn=xe,hn=U,ln=un.indexOf,dn=cr,fn=E([].push),_n=function(e,t){var r,n=hn(e),i=0,o=[];for(r in n)!cn(dn,r)&&cn(n,r)&&fn(o,r);for(;t.length>i;)cn(n,r=t[i++])&&(~ln(o,r)||fn(o,r));return o},pn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"].concat("length","prototype");Gr.f=Object.getOwnPropertyNames||function(e){return _n(e,pn)};var gn={};gn.f=Object.getOwnPropertySymbols;var yn=W,mn=Gr,bn=gn,Tn=At,Sn=E([].concat),vn=yn("Reflect","ownKeys")||function(e){var t=mn.f(Tn(e)),r=bn.f;return r?Sn(t,r(e)):t},En=xe,On=vn,Rn=i,wn=vt,An=function(e,t,r){for(var n=On(t),i=wn.f,o=Rn.f,s=0;s<n.length;s++){var a=n[s];En(e,a)||r&&En(r,a)||i(e,a,o(t,a))}},Pn=o,Cn=N,Ln=/#|\.prototype\./,Dn=function(e,t){var r=kn[jn(e)];return r==xn||r!=Bn&&(Cn(t)?Pn(t):!!t)},jn=Dn.normalize=function(e){return String(e).replace(Ln,".").toLowerCase()},kn=Dn.data={},Bn=Dn.NATIVE="N",xn=Dn.POLYFILL="P",Mn=Dn,In=n,Fn=i.f,Un=qt,Nn=Vr,qn=Re,Hn=An,zn=Mn,Vn=a,Gn=Function.prototype,Kn=Gn.apply,Wn=Gn.call,Xn="object"==typeof Reflect&&Reflect.apply||(Vn?Wn.bind(Kn):function(){return Wn.apply(Kn,arguments)}),Yn=N,Qn=String,$n=TypeError,Jn=E,Zn=At,ei=function(e){if("object"==typeof e||Yn(e))return e;throw $n("Can't set "+Qn(e)+" as a prototype")},ti=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Jn(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return Zn(r),ei(n),t?e(r,n):r.__proto__=n,r}}():void 0),ri=vt.f,ni=N,ii=z,oi=ti,si={};si[$e("toStringTag")]="z";var ai="[object z]"===String(si),ui=N,ci=A,hi=$e("toStringTag"),li=Object,di="Arguments"==ci(function(){return arguments}()),fi=ai?ci: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(r){}}(t=li(e),hi))?r:di?ci(t):"Object"==(n=ci(t))&&ui(t.callee)?"Arguments":n},_i=fi,pi=String,gi=function(e){if("Symbol"===_i(e))throw TypeError("Cannot convert a Symbol value to a string");return pi(e)},yi=z,mi=qt,bi=Error,Ti=E("".replace),Si=String(bi("zxcasd").stack),vi=/\n\s*at [^:]*:[^\n]*/,Ei=vi.test(Si),Oi=y,Ri=!o((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Oi(1,7)),7!==e.stack)})),wi=W,Ai=xe,Pi=qt,Ci=X,Li=ti,Di=An,ji=function(e,t,r){r in e||ri(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},ki=function(e,t,r){var n,i;return oi&&ni(n=t.constructor)&&n!==r&&ii(i=n.prototype)&&i!==r.prototype&&oi(e,i),e},Bi=function(e,t){return void 0===e?arguments.length<2?"":t:gi(e)},xi=function(e,t){yi(t)&&"cause"in t&&mi(e,"cause",t.cause)},Mi=function(e,t){if(Ei&&"string"==typeof e&&!bi.prepareStackTrace)for(;t--;)e=Ti(e,vi,"");return e},Ii=Ri,Fi=s,Ui=function(e,t){var r,n,i,o,s,a=e.target,u=e.global,c=e.stat;if(r=u?In:c?In[a]||qn(a,{}):(In[a]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(s=Fn(r,n))&&s.value:r[n],!zn(u?n:a+(c?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;Hn(o,i)}(e.sham||i&&i.sham)&&Un(o,"sham",!0),Nn(r,n,o,e)}},Ni=Xn,qi=function(e,t,r,n){var i="stackTraceLimit",o=n?2:1,s=e.split("."),a=s[s.length-1],u=wi.apply(null,s);if(u){var c=u.prototype;if(Ai(c,"cause")&&delete c.cause,!r)return u;var h=wi("Error"),l=t((function(e,t){var r=Bi(n?t:e,void 0),i=n?new u(e):new u;return void 0!==r&&Pi(i,"message",r),Ii&&Pi(i,"stack",Mi(i.stack,2)),this&&Ci(c,this)&&ki(i,this,l),arguments.length>o&&xi(i,arguments[o]),i}));l.prototype=c,"Error"!==a?Li?Li(l,h):Di(l,h,{name:!0}):Fi&&i in u&&(ji(l,u,i),ji(l,u,"prepareStackTrace")),Di(l,u);try{c.name!==a&&Pi(c,"name",a),c.constructor=l}catch(d){}return l}},Hi="WebAssembly",zi=n.WebAssembly,Vi=7!==Error("e",{cause:7}).cause,Gi=function(e,t){var r={};r[e]=qi(e,t,Vi),Ui({global:!0,constructor:!0,arity:1,forced:Vi},r)},Ki=function(e,t){if(zi&&zi[e]){var r={};r[e]=qi("WebAssembly."+e,t,Vi),Ui({target:Hi,stat:!0,constructor:!0,arity:1,forced:Vi},r)}};function Wi(){let e,t;const r=new Promise(((r,n)=>{e=r,t=n}));return r.used=!1,r.resolve=(...t)=>(r.used=!0,e(...t)),r.reject=(...e)=>(r.used=!0,t(...e)),r}Gi("Error",(function(e){return function(t){return Ni(e,this,arguments)}})),Gi("EvalError",(function(e){return function(t){return Ni(e,this,arguments)}})),Gi("RangeError",(function(e){return function(t){return Ni(e,this,arguments)}})),Gi("ReferenceError",(function(e){return function(t){return Ni(e,this,arguments)}})),Gi("SyntaxError",(function(e){return function(t){return Ni(e,this,arguments)}})),Gi("TypeError",(function(e){return function(t){return Ni(e,this,arguments)}})),Gi("URIError",(function(e){return function(t){return Ni(e,this,arguments)}})),Ki("CompileError",(function(e){return function(t){return Ni(e,this,arguments)}})),Ki("LinkError",(function(e){return function(t){return Ni(e,this,arguments)}})),Ki("RuntimeError",(function(e){return function(t){return Ni(e,this,arguments)}}));class Xi{static start(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}static end(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}static get(e){if(e)try{return e.buffered}catch(t){}}static buffers(e,t){if(!e||!e.length)return[];const r=[];for(let n=0,i=e.length;n<i;n++){const i=r.length;if(i&&t){const o=r[i-1],s=o[1];if(e.start(n)-s<=t){const t=e.end(n);t>s&&(o[1]=t)}else r.push([e.start(n),e.end(n)])}else r.push([e.start(n),e.end(n)])}return r}static length(e){return e&&e.length?e.reduce(((e,t)=>e+(t[1]-t[0])),0):0}static info(e,t=0,r=0){if(!e||!e.length)return{start:0,end:0,buffers:[]};let n=0,i=0,o=0,s=0,a=0,u=0,c=0;const h=Xi.buffers(e,r);for(let l=0,d=h.length;l<d;l++){const e=h[l];if(t+r>=e[0]&&t<e[1])n=e[0],i=e[1],o=l;else{if(t+r<e[0]){s=e[0],a=e[1];break}t+r>e[1]&&(u=e[0],c=e[1])}}return{start:n,end:i,index:o,buffers:h,nextStart:s,nextEnd:a,prevStart:u,prevEnd:c,currentTime:t,behind:t-n,remaining:i?i-t:0,length:Xi.length&&Xi.length(h)}}}var Yi=Object.freeze(Object.defineProperty({__proto__:null,Buffer:Xi},Symbol.toStringTag,{value:"Module"}));const Qi={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",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",OPTION:"OPTION"}},$i={[Qi.MANIFEST]:{HLS:1100},[Qi.NETWORK]:2100,[Qi.NETWORK_TIMEOUT]:2101,[Qi.DEMUX]:{FLV:3100,HLS:3200,MP4:3300,FMP4:3400},[Qi.REMUX]:{FMP4:4100,MP4:4200},[Qi.MEDIA]:{MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202},[Qi.OTHER]:8e3};class Ji extends Error{constructor(e,t,r,n,i){super(i||(null==r?void 0:r.message)),this.errorType=e===Qi.NETWORK_TIMEOUT?Qi.NETWORK:e,this.originError=r,this.ext=n,this.errorCode=$i[e][t]||$i[e],this.errorMessage=this.message,this.errorCode||(this.errorType=Qi.OTHER,this.errorCode=$i[this.errorType])}static create(e,t,r,n,i){return e instanceof Ji?e:(e instanceof Error&&(r=e,e=""),e||(e=Qi.OTHER),new Ji(e,t,r,n,i))}static network(e){var t;return new Ji((null==e?void 0:e.isTimeout)?Qi.NETWORK_TIMEOUT:Qi.NETWORK,e,null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==(t=null==e?void 0:e.response)?void 0:t.status})}}var Zi=Object.freeze(Object.defineProperty({__proto__:null,ERR:Qi,ERR_CODE:$i,StreamingError:Ji},Symbol.toStringTag,{value:"Module"}));const eo="undefined"!=typeof window;const to=function(){try{return eo?window.MediaSource:null}catch(e){}}();class ro extends Error{constructor(e,t){super(t||e),this.type=e,this.msg=t}}class no{constructor(t){e(this,"media",null),e(this,"mediaSource",null),e(this,"_openPromise",Wi()),e(this,"_queue",Object.create(null)),e(this,"_sourceBuffer",Object.create(null)),e(this,"_onSBUpdateEnd",(e=>{const t=this._queue[e];if(t){const r=t.shift();r&&(r.promise.resolve(),this._startQueue(e))}})),e(this,"_onSBUpdateError",((e,t)=>{const r=this._queue[e];if(r){const e=r[0];e&&e.promise.reject(new Ji(Qi.MEDIA,Qi.SUB_TYPES.MSE_APPEND_BUFFER,t))}})),t&&this.bindMedia(t)}get isOpened(){var e;return"open"===(null==(e=this.mediaSource)?void 0:e.readyState)}get duration(){var e;return(null==(e=this.mediaSource)?void 0:e.duration)||-1}updateDuration(e){return this._enqueueBlockingOp((()=>{this.mediaSource&&(this.mediaSource.duration=e)}))}open(){if(this._openPromise.used&&!this.isOpened&&this.mediaSource){const e=this.mediaSource,t=()=>{e.removeEventListener("sourceopen",t),this._openPromise.resolve()};e.addEventListener("sourceopen",t),this._openPromise=Wi()}return this._openPromise}async bindMedia(e){if((this.mediaSource||this.media)&&await this.unbindMedia(),!e||!to)throw new Error("Param media or MediaSource does not exist");this.media=e;const t=this.mediaSource=new to;e.src=URL.createObjectURL(t);const r=()=>{t.removeEventListener("sourceopen",r),URL.revokeObjectURL(e.src),this._openPromise.resolve()};return t.addEventListener("sourceopen",r),this._openPromise}async unbindMedia(){this._openPromise.used||this._openPromise.resolve();const e=this.mediaSource;if(e){Object.keys(this._queue).forEach((e=>{const t=this._queue[e];t&&t.forEach((e=>e.promise.resolve))}));const r=!!this.media&&this.media.readyState>=1,n="open"===e.readyState;if(r&&n)try{e.endOfStream()}catch(t){}Object.keys(this._sourceBuffer).forEach((r=>{try{e.removeSourceBuffer(this._sourceBuffer[r])}catch(t){}}))}if(this.media){this.media.removeAttribute("src");try{this.media.load()}catch(t){}this.media=null}this.mediaSource=null,this._openPromise=Wi(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null)}createSource(e,t){if(this._sourceBuffer[e]||!this.mediaSource)return;let r;try{r=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(n){throw new Ji(Qi.MEDIA,Qi.SUB_TYPES.MSE_ADD_SB,n)}r.mimeType=t,r.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),r.addEventListener("error",this._onSBUpdateError.bind(this,e))}changeType(e,t){const r=this._sourceBuffer[e];return this.mediaSource&&r&&r.mimeType!==t&&"function"==typeof r.changeType?this._enqueueOp((()=>{r.changeType(t)})):Promise.resolve()}createOrChangeSource(e,t){return this.createSource(e,t),this.changeType(e,t)}append(e,t){return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(()=>{var r;this.mediaSource&&(null==(r=this._sourceBuffer[e])||r.appendBuffer(t))})):Promise.resolve()}remove(e,t,r){return 1===Object.keys(this._sourceBuffer).length?Promise.resolve():this._enqueueOp(e,(()=>{if(!this.mediaSource)return;const n=this._sourceBuffer[e];t>=r||!n?this._onSBUpdateEnd(e):n.remove(t,r)}))}clearBuffer(e,t){let r;return Object.keys(this._sourceBuffer).forEach((n=>{r=this._enqueueOp(n,(()=>{if(!this.mediaSource)return;this._sourceBuffer[n].remove(e,t)}))})),r}clearAllBuffer(){let e;return Object.keys(this._sourceBuffer).forEach((t=>{e=this._enqueueOp(t,(()=>{if(!this.mediaSource)return;const e=this._sourceBuffer[t];e.remove(0,Xi.end(Xi.get(e)))}))})),e}endOfStream(e){return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((()=>{const t=this.mediaSource;t&&"open"===t.readyState&&(e?t.endOfStream(e):t.endOfStream())})):Promise.resolve()}setLiveSeekableRange(e,t){const r=this.mediaSource;e<0||t<e||!(null==r?void 0:r.setLiveSeekableRange)||"open"!==r.readyState||r.setLiveSeekableRange(e,t)}buffered(e){return Xi.get(this._sourceBuffer[e])}bufferStart(e){return Xi.start(this.buffered(e))}bufferEnd(e){return Xi.end(this.buffered(e))}_enqueueOp(e,t){if(!this.mediaSource)return Promise.resolve();const r=this._queue[e]=this._queue[e]||[],n={exec:t,promise:Wi()};return r.push(n),1===r.length&&this._startQueue(e),n.promise}async _enqueueBlockingOp(e){if(!this.mediaSource)return Promise.resolve();const t=Object.keys(this._sourceBuffer);if(!t.length)return e();const r=[];return t.forEach((e=>{const t=this._queue[e],n=Wi();r.push(n),t.push({exec:()=>n.resolve(),promise:n}),1===t.length&&this._startQueue(e)})),Promise.all(r).then((()=>{try{return e()}finally{t.forEach((e=>{const t=this._queue[e],r=this._sourceBuffer[e];null==t||t.shift(),r&&r.updating||this._startQueue(e)}))}}))}_startQueue(e){const t=this._queue[e];if(t){const n=t[0];if(n)try{n.exec()}catch(r){n.promise.reject(new Ji(Qi.MEDIA,Qi.SUB_TYPES.MSE_OTHER,r)),t.shift(),this._startQueue(e)}}}static isSupported(e='video/mp4; codecs="avc1.42E01E,mp4a.40.2"'){if(!to)return!1;try{return to.isTypeSupported(e)}catch(t){return!1}}}e(no,"VIDEO","video"),e(no,"AUDIO","audio");var io,oo,so,ao=Object.freeze(Object.defineProperty({__proto__:null,MSEErrorType:{UPDATE_ERROR:"updateError"},MSEError:ro,MSE:no},Symbol.toStringTag,{value:"Module"})),uo="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,co=!o((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),ho=xe,lo=N,fo=je,_o=co,po=ur("IE_PROTO"),go=Object,yo=go.prototype,mo=_o?go.getPrototypeOf:function(e){var t=fo(e);if(ho(t,po))return t[po];var r=t.constructor;return lo(r)&&t instanceof r?r.prototype:t instanceof go?yo:null},bo=uo,To=s,So=n,vo=N,Eo=z,Oo=xe,Ro=fi,wo=le,Ao=qt,Po=Vr,Co=vt.f,Lo=X,Do=mo,jo=ti,ko=$e,Bo=Ne,xo=Ar.enforce,Mo=Ar.get,Io=So.Int8Array,Fo=Io&&Io.prototype,Uo=So.Uint8ClampedArray,No=Uo&&Uo.prototype,qo=Io&&Do(Io),Ho=Fo&&Do(Fo),zo=Object.prototype,Vo=So.TypeError,Go=ko("toStringTag"),Ko=Bo("TYPED_ARRAY_TAG"),Wo="TypedArrayConstructor",Xo=bo&&!!jo&&"Opera"!==Ro(So.opera),Yo=!1,Qo={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},$o={BigInt64Array:8,BigUint64Array:8},Jo=function(e){var t=Do(e);if(Eo(t)){var r=Mo(t);return r&&Oo(r,Wo)?r.TypedArrayConstructor:Jo(t)}},Zo=function(e){if(!Eo(e))return!1;var t=Ro(e);return Oo(Qo,t)||Oo($o,t)};for(io in Qo)(so=(oo=So[io])&&oo.prototype)?xo(so).TypedArrayConstructor=oo:Xo=!1;for(io in $o)(so=(oo=So[io])&&oo.prototype)&&(xo(so).TypedArrayConstructor=oo);if((!Xo||!vo(qo)||qo===Function.prototype)&&(qo=function(){throw Vo("Incorrect invocation")},Xo))for(io in Qo)So[io]&&jo(So[io],qo);if((!Xo||!Ho||Ho===zo)&&(Ho=qo.prototype,Xo))for(io in Qo)So[io]&&jo(So[io].prototype,Ho);if(Xo&&Do(No)!==Ho&&jo(No,Ho),To&&!Oo(Ho,Go))for(io in Yo=!0,Co(Ho,Go,{get:function(){return Eo(this)?this[Ko]:void 0}}),Qo)So[io]&&Ao(So[io],Ko,io);var es={NATIVE_ARRAY_BUFFER_VIEWS:Xo,TYPED_ARRAY_TAG:Yo&&Ko,aTypedArray:function(e){if(Zo(e))return e;throw Vo("Target is not a typed array")},aTypedArrayConstructor:function(e){if(vo(e)&&(!jo||Lo(qo,e)))return e;throw Vo(wo(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(To){if(r)for(var i in Qo){var o=So[i];if(o&&Oo(o.prototype,e))try{delete o.prototype[e]}catch(s){try{o.prototype[e]=t}catch(a){}}}Ho[e]&&!r||Po(Ho,e,r?t:Xo&&Fo[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(To){if(jo){if(r)for(n in Qo)if((i=So[n])&&Oo(i,e))try{delete i[e]}catch(o){}if(qo[e]&&!r)return;try{return Po(qo,e,r?t:Xo&&qo[e]||t)}catch(o){}}for(n in Qo)!(i=So[n])||i[e]&&!r||Po(i,e,t)}},getTypedArrayConstructor:Jo,isView:function(e){if(!Eo(e))return!1;var t=Ro(e);return"DataView"===t||Oo(Qo,t)||Oo($o,t)},isTypedArray:Zo,TypedArray:qo,TypedArrayPrototype:Ho},ts=rn,rs=Yr,ns=es.aTypedArray;(0,es.exportTypedArrayMethod)("at",(function(e){var t=ns(this),r=ts(t),n=rs(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var is=pe,os=a,ss=E(E.bind),as=function(e,t){return is(e),void 0===t?e:os?ss(e,t):function(){return e.apply(t,arguments)}},us=j,cs=je,hs=rn,ls=function(e){var t=1==e;return function(r,n,i){for(var o,s=cs(r),a=us(s),u=as(n,i),c=hs(a);c-- >0;)if(u(o=a[c],c,s))switch(e){case 0:return o;case 1:return c}return t?-1:void 0}},ds={findLast:ls(0),findLastIndex:ls(1)},fs=ds.findLast,_s=es.aTypedArray;(0,es.exportTypedArrayMethod)("findLast",(function(e){return fs(_s(this),e,arguments.length>1?arguments[1]:void 0)}));var ps=ds.findLastIndex,gs=es.aTypedArray;(0,es.exportTypedArrayMethod)("findLastIndex",(function(e){return ps(gs(this),e,arguments.length>1?arguments[1]:void 0)}));const ys={FETCH:"fetch",XHR:"xhr"},ms={ARRAY_BUFFER:"arraybuffer",TEXT:"text",JSON:"json"};class bs extends Error{constructor(t,r,n,i){super(i),e(this,"retryCount",0),e(this,"isTimeout",!1),e(this,"loaderType",ys.FETCH),e(this,"startTime",0),e(this,"endTime",0),this.url=t,this.request=r,this.response=n}}const Ts=Object.prototype.toString;function Ss(e){if("[object Object]"!==Ts.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function vs(e){if(!e||null==e[0]||0===e[0]&&null==e[1])return;let t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}function Es(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Os(e,t){if(!e)return;if(!t)return e;let r;const n=Object.keys(t).map((e=>{if(r=t[e],null!=r)return Array.isArray(r)?e+="[]":r=[r],r.map((t=>{var r;return r=t,"[object Date]"===Ts.call(r)?t=t.toISOString():function(e){return null!==e&&"object"==typeof e}(t)&&(t=JSON.stringify(t)),`${Es(e)}=${Es(t)}`})).join("&")})).filter(Boolean).join("&");if(n){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}function Rs(e,t,r,n,i,o,s,a,u,c){return i=null!=i?parseFloat(i):null,n=parseInt(n||"0",10),isNaN(n)&&(n=0),{data:e,done:t,option:{range:u,vid:c,index:a,contentLength:n,age:i,startTime:o,firstByteTime:s,endTime:Date.now()},response:r}}class ws{constructor(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,this._realTimeSpeed=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}reset(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0}addBytes(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())}get currentKBps(){this.addBytes(0);let e=(this._now()-this._lastCheckpoint)/1e3;return 0===e&&(e=1),this._intervalBytes/e/1024}get lastSecondKBps(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}static getSpeed(){let e=0;if(this._netRecords.length<1)return e;const t=[];this._netRecords.map((e=>{t.push(e)})),t.sort(((e,t)=>e.mSpeedInbPS-t.mSpeedInbPS));const r=t.length;let n=0;for(let i=0;i<r;i++)n+=t[i].mBytes;n/=2;for(let i=0;i<r;i++)if(n-=t[i].mBytes,n<=0){e=t[i].mSpeedInbPS;break}return e<0?0:e}static getRealTimeSpeed(){return this._realTimeSpeed}static getRTT(){if(this._netRecords.length<1)return 0;const e=[];this._netRecords.map((t=>{e.push(t.mRTT)})),e.sort(((e,t)=>e-t));const t=e.length;return t%2==0?(e[t/2-1]+e[t/2])/2:e[Math.floor(t/2)]}static netSampling(e){this._netRecords.push(e),this._realTimeSpeed=e.mSpeedInbPS,this._netRecords.length>10&&this._netRecords.splice(0,1)}}e(ws,"_netRecords",[]);class As{constructor(){e(this,"_abortController",null),e(this,"_timeoutTimer",null),e(this,"_reader",null),e(this,"_response",null),e(this,"_aborted",!1),e(this,"_index",-1),e(this,"_range",null),e(this,"_receivedLength",0),e(this,"_running",!1),e(this,"_logger",null),e(this,"_vid","")}load({url:e,vid:t,timeout:r,responseType:n,onProgress:i,index:o,onTimeout:s,range:a,transformResponse:u,request:c,params:h,logger:l,method:d,headers:f,body:_,mode:p,credentials:g,cache:y,redirect:m,referrer:b,referrerPolicy:T}){var S;this._logger=l,this._aborted=!1,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=o,this._range=a||[0,0],this._vid=t||e;const v={method:d,headers:f,body:_,mode:p,credentials:g,cache:y,redirect:m,referrer:b,referrerPolicy:T,signal:null==(S=this._abortController)?void 0:S.signal};let E=!1;clearTimeout(this._timeoutTimer),e=Os(e,h);const O=vs(a);O&&((f=c?c.headers:v.headers=v.headers||new Headers)instanceof Headers?f.append("Range",O):f.Range=O),r&&(this._timeoutTimer=setTimeout((()=>{if(E=!0,this.cancel(),s){const t=new bs(e,v);t.isTimeout=!0,s(t)}}),r));const R=Date.now();return this._logger.debug("[fetch load start], index,",o,",range,",a),fetch(c||e,c?void 0:v).then((async t=>{if(clearTimeout(this._timeoutTimer),this._response=t,this._aborted)return;if(u&&(t=u(t,e)||t),!t.ok)throw this._running=!1,new bs(e,v,t,"bad network response");const r=Date.now();let s;if(n===ms.TEXT)s=await t.text(),this._running=!1;else if(n===ms.JSON)s=await t.json(),this._running=!1;else if(i)this._loadChunk(t,i,R,r);else{s=await t.arrayBuffer(),s=new Uint8Array(s),this._running=!1,this._logger.debug("[fetch load end], index,",o,",range,",a);const e=Date.now()-R;ws.netSampling({mTime:e,mBytes:s.byteLength,mSpeedInbPS:8*s.byteLength/(e/1e3),mRTT:r-R})}return Rs(s,!0,t,t.headers.get("Content-Length"),t.headers.get("age"),R,r,o,a,this._vid)})).catch((t=>{if(clearTimeout(this._timeoutTimer),this._running=!1,!this._aborted||E)throw(t=t instanceof bs?t:new bs(e,v)).startTime=R,t.endTime=Date.now(),t.isTimeout=E,t}))}async cancel(){if(!this._aborted){if(this._aborted=!0,this._running=!1,this._response){try{this._reader&&await this._reader.cancel()}catch(e){}this._response=this._reader=null}if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}}}_loadChunk(e,t,r,n){if(!e.body||!e.body.getReader)throw new bs(e.url,"",e,"onProgress of bad response.body.getReader");const i=this._reader=e.body.getReader();let o,s,a;const u=async()=>{s=Date.now();try{o=await i.read(),a=Date.now()}catch(l){a=Date.now();const r=this._range[0]+this._receivedLength,n=this._aborted?null:l;return void t(void 0,!1,{range:[r,r],vid:this._vid,index:this._index,startTime:s,endTime:a,err:n},e)}const c=this._range[0]+this._receivedLength;if(this._aborted)return void t(void 0,!1,{range:[c,c],vid:this._vid,index:this._index,startTime:s,endTime:a},e);this._receivedLength+=o.value?o.value.byteLength:0,this._logger.debug("【fetchLoader,onProgress call】,task,",this._range,", start,",c,", end,",this._range[0]+this._receivedLength,", done,",o.done),t(o.value,o.done,{range:[c,this._range[0]+this._receivedLength],vid:this._vid,index:this._index,startTime:s,endTime:a},e);const h=Date.now()-r;this._logger.debug("[fetchLoader SPEED], fetch speed(b/s),",8*this._receivedLength/(h/1e3)),ws.netSampling({mTime:h,mBytes:this._receivedLength,mSpeedInbPS:8*this._receivedLength/(h/1e3),mRTT:n-r}),o.done?(this._running=!1,this._logger.debug("[fetchLoader onProgress end],task,",this._range,",done,",o.done)):u()};u()}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}static isSupported(){return!("undefined"==typeof fetch)}}class Ps{constructor(){e(this,"_xhr",null),e(this,"_aborted",!1),e(this,"_timeoutTimer",null),e(this,"_range",null),e(this,"_receivedLength",0),e(this,"_url",null),e(this,"_onProgress",null),e(this,"_index",-1),e(this,"_headers",null),e(this,"_chunkSizeKBList",[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192]),e(this,"_currentChunkSizeKB",384),e(this,"_currentSpeedNormalized",0),e(this,"_zeroSpeedChunkCount",0),e(this,"_timeout",null),e(this,"_xhr",null),e(this,"_withCredentials",null),e(this,"_startTime",-1),e(this,"_speedSampler",new ws),e(this,"_loadCompleteResolve",null),e(this,"_loadCompleteReject",null),e(this,"_runing",!1),e(this,"_logger",!1),e(this,"_vid",""),e(this,"_responseType",void 0),e(this,"_credentials",void 0),e(this,"_method",void 0),e(this,"_transformResponse",void 0),e(this,"_firstRtt",void 0),e(this,"_subRangeStartTime",void 0)}load(e){clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range||[0,0],this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,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._request=e.request,this._credentials=e.credentials,this._logger.debug("【xhrLoader task】, range",this._range),this._url=Os(e.url,e.params);const t=Date.now();return new Promise(((e,t)=>{this._loadCompleteResolve=e,this._loadCompleteReject=t,this._startLoad()})).catch((e=>{if(clearTimeout(this._timeoutTimer),this._runing=!1,!this._aborted)throw(e=e instanceof bs?e:new bs(this._url,this._request)).startTime=t,e.endTime=Date.now(),e}))}_startLoad(){let e=null;if(this._range&&this._range.length>1)if(this._onProgress){this._subRangeStartTime=Date.now(),this._firstRtt=-1;let 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)}_internalOpen(e){try{this._startTime=Date.now();let t=this._xhr=new XMLHttpRequest;t.open(this._method||"GET",this._url,!0),t.responseType=this._responseType,this._timeout&&(t.timeout=this._timeout),t.withCredentials=this._credentials,t.onload=this._onLoad.bind(this),t.onreadystatechange=this._onReadyStatechange.bind(this),t.onerror=e=>{this._running=!1,this._loadCompleteReject(e)},t.ontimeout=e=>{if(this.cancel(),this._onTimeout){const e=new bs(this._url,this._request);e.isTimeout=!0,this._onTimeout(e)}this._loadCompleteReject(e)};const r=vs(e);let n=null;r&&(n=this._headers||{},n.Range=r),n&&Object.keys(n).forEach((e=>{t.setRequestHeader(e,n[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),t.send()}catch(t){this._loadCompleteReject(t)}}_onReadyStatechange(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}_onLoad(e){const t=e.target.status;if(t<200||t>299)return this._loadCompleteReject(new bs(this._url,null,{...e.target.response,status:t},"bad response,status:"+t));let r=this._speedSampler.lastSecondKBps;if(0===r&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(r=this._speedSampler.currentKBps)),0!==r){let e=this._normalizeSpeed(r);this._currentSpeedNormalized!==e&&(this._currentSpeedNormalized=e,this._currentChunkSizeKB=e)}let n,i=null,o=!1;if(this._responseType===ms.ARRAY_BUFFER){let t=new Uint8Array(e.target.response);if(n=this._range[0]+this._receivedLength,t&&t.byteLength>0){this._receivedLength+=t.byteLength;const e=Date.now()-this._subRangeStartTime;this._speedSampler.addBytes(t.byteLength),ws.netSampling({mTime:e,mBytes:this._receivedLength,mSpeedInbPS:8*this._receivedLength/(e/1e3),mRTT:this._firstRtt-this._subRangeStartTime})}i=t,o=!(this._range.length>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",n,"end ",this._range[0]+this._receivedLength,",dataLen,",t?t.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",o)}else o=!0,i=e.target.response;let s={ok:t>=200&&t<300,status:t,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(s=this._transformResponse(s,this._url)||s),this._onProgress&&this._onProgress(i,o,{index:this._index,vid:this._vid,range:[n,this._range[0]+this._receivedLength],startTime:this._startTime,endTime:Date.now()},s),o?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(Rs(this._onProgress?null:i,o,s,s.headers["content-length"],s.headers.age,this._startTime,-1,this._index,this._range,this._vid))):this._startLoad()}_normalizeSpeed(e){let t=this._chunkSizeKBList,r=t.length-1,n=0,i=0,o=r;if(e<t[0])return t[0];for(;i<=o;){if(n=i+Math.floor((o-i)/2),n===r||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?i=n+1:o=n-1}}cancel(){if(!this._aborted)return this._aborted=!0,this._runing=!1,this._xhr?this._xhr.abort():void 0}static isSupported(){return"undefined"!=typeof XMLHttpRequest}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}_getHeaders(e){const t=e.getAllResponseHeaders().trim().split("\r\n"),r={};for(const n of t){const e=n.split(": ");r[e[0].toLowerCase()]=e.slice(1).join(": ")}return r}}class Cs{constructor(e,t){this.promise=Wi(),this.alive=!!t.onProgress,this._loaderType=e,this._loader=e===ys.FETCH?new As:new Ps,this._config=t,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._logger=t.logger}exec(){const{retry:e,retryDelay:t,onRetryError:r,transformError:n,...i}=this._config,o=async()=>{try{const e=await this._loader.load(i);this.promise.resolve(e)}catch(s){if(this._loader.running=!1,this._logger.debug("[task request catch err]",s),this._canceled)return;if(s.response&&s.response.status>=400&&s.response.status<=599)return void this.promise.reject(s);s.loaderType=this._loaderType,s.retryCount=this._retryCount;let a=s;if(n&&(a=n(a)||a),r&&this._retryCount>0&&r(a,this._retryCount,e),this._retryCount++,this._retryCount<=e)return clearTimeout(this._retryTimer),this._logger.debug("[task request setTimeout],retry",this._retryCount,",retry range,",i.range),void(this._retryTimer=setTimeout(o,t));this.promise.reject(a)}};return o(),this.promise}async cancel(){return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,this._loader.cancel()}get running(){return this._loader&&this._loader.running}}function Ls(e=0){return new Promise((t=>setTimeout(t,e)))}var Ds=Object.freeze(Object.defineProperty({__proto__:null,isMediaPlaying:function(e){return e&&!e.paused&&!e.ended&&0!==e.playbackRate&&0!==e.readyState},getVideoPlaybackQuality:function(e){if(!e)return{};if("function"==typeof e.getVideoPlaybackQuality){const t=e.getVideoPlaybackQuality();return{droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}return{droppedVideoFrames:e.webkitDroppedFrameCount,totalVideoFrames:e.webkitDecodedFrameCount,creationTime:performance.now()}},concatUint8Array:function(...e){if((e=e.filter(Boolean)).length<2)return e[0];const t=new Uint8Array(e.reduce(((e,t)=>e+t.byteLength),0));let r=0;return e.forEach((e=>{t.set(e,r),r+=e.byteLength})),t},sleep:Ls},Symbol.toStringTag,{value:"Module"}));var js=Object.freeze(Object.defineProperty({__proto__:null,LoaderType:ys,ResponseType:ms,NetLoader:class{constructor(t){e(this,"type",ys.FETCH),e(this,"_queue",[]),e(this,"_alive",[]),e(this,"_currentTask",null),this._config=function(e){return{loaderType:ys.FETCH,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:ms.TEXT,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,...e}}(t),this._config.loaderType!==ys.XHR&&As.isSupported()||(this.type=ys.XHR),this.log=t.logger}isFetch(){return this.type===ys.FETCH}static isFetchSupport(){return As.isSupported()}load(e,t={}){"string"!=typeof e&&e?t=e:t.url=e||t.url||this._config.url,(t=Object.assign({},this._config,t)).params&&(t.params=Object.assign({},t.params)),t.headers&&Ss(t.headers)&&(t.headers=Object.assign({},t.headers)),t.body&&Ss(t.body)&&(t.body=Object.assign({},t.body)),t.transformRequest&&(t=t.transformRequest(t)||t),t.logger=this.log;const r=new Cs(this.type,t);return this._queue.push(r),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),r.promise}async cancel(){const e=this._queue.map((e=>e.cancel())).concat(this._alive.map((e=>e.cancel())));this._currentTask&&e.push(this._currentTask.cancel()),this._queue=[],this._alive=[],await Promise.all(e),await Ls()}_processTask(){this._currentTask=this._queue.shift(),this._currentTask&&(this._currentTask.alive&&this._alive.push(this._currentTask),this._currentTask.exec().finally((()=>{this._processTask()})))}static getSpeed(){return ws.getSpeed()}static getRealTimeSpeed(){return ws.getRealTimeSpeed()}static getRTT(){return ws.getRTT()}}},Symbol.toStringTag,{value:"Module"}));const ks={ERROR:"error",TTFB:"core.ttfb",LOAD_START:"core.loadstart",LOAD_RESPONSE_HEADERS:"core.loadresponseheaders",LOAD_COMPLETE:"core.loadcomplete",LOAD_RETRY:"core.loadretry",SOURCEBUFFER_CREATED:"core.sourcebuffercreated",ANALYZE_DURATION_EXCEEDED:"core.analyzedurationexceeded",REMOVE_BUFFER:"core.removebuffer",BUFFEREOS:"core.buffereos",KEYFRAME:"core.keyframe",METADATA_PARSED:"core.metadataparsed",SEI:"core.sei",SEI_IN_TIME:"core.seiintime",FLV_SCRIPT_DATA:"core.flvscriptdata",LOWDECODE:"core.lowdecode",SWITCH_URL_SUCCESS:"core.switchurlsuccess",SWITCH_URL_FAILED:"core.switchurlfailed",SPEED:"core.speed",HLS_MANIFEST_LOADED:"core.hlsmanifestloaded",HLS_LEVEL_LOADED:"core.hlslevelloaded",STREAM_EXCEPTION:"core.streamexception",LARGE_AV_FIRST_FRAME_GAP_DETECT:"LARGE_AV_FIRST_FRAME_GAP_DETECT",LARGE_VIDEO_DTS_GAP_DETECT:"LARGE_VIDEO_DTS_GAP_DETECT",LARGE_AUDIO_DTS_GAP_DETECT:"LARGE_AUDIO_DTS_GAP_DETECT",AUDIO_GAP_DETECT:"AUDIO_GAP_DETECT",AUDIO_OVERLAP_DETECT:"AUDIO_OVERLAP_DETECT",MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT:"MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT"};var Bs=Object.freeze(Object.defineProperty({__proto__:null,EVENT:ks},Symbol.toStringTag,{value:"Module"}));var xs=Object.freeze(Object.defineProperty({__proto__:null,GapService:class{constructor(){e(this,"_prevCurrentTime",0)}do(e,t=3,r,n=1){if(!e)return;const i=e.currentTime;let o=0;if(this._prevCurrentTime===i){const s=Xi.info(Xi.get(e),i);if(!s.buffers.length)return;r&&s.nextStart||s.nextStart&&s.nextStart-i<t?o=s.nextStart+.1:s.end&&s.end-i>n&&!e.seeking&&(o=i+.1)}this._prevCurrentTime=i,o&&i!==o&&(e.currentTime=o)}},SeiService:class{constructor(t){e(this,"_seiSet",new Set),this.emitter=t,t.on(ks.SEI,(e=>{e&&this._seiSet.add(e)}))}throw(e){if(null==e||!this._seiSet.size)return;const t=e-.2,r=e+.2,n=[];this._seiSet.forEach((e=>{e.time>=t&&e.time<=r&&n.push(e)})),n.forEach((e=>{this._seiSet.delete(e),this.emitter.emit(ks.SEI_IN_TIME,e)}))}reset(){this._seiSet.clear()}},BandwidthService:class{constructor(){e(this,"_chunkSpeeds",[]),e(this,"_speeds",[])}addRecord(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}addChunkRecord(e,t){e&&t&&(this._chunkSpeeds.push(8e3*e/t),this._chunkSpeeds=this._chunkSpeeds.slice(-10))}getAvgSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds.reduce(((e,t)=>e+t))/this._speeds.length:this._chunkSpeeds.reduce(((e,t)=>e+t))/this._chunkSpeeds.length:0}getLatestSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeeds[this._chunkSpeeds.length-1]:0}reset(){this._chunkSpeeds=[],this._speeds=[]}}},Symbol.toStringTag,{value:"Module"}));class Ms{constructor(e){this.name=e||"",this._prefix=`[${this.name}]`}debug(...e){Ms.disabled||console.debug(this._prefix,...e)}log(...e){Ms.disabled||console.log(this._prefix,...e)}warn(...e){Ms.disabled||console.warn(this._prefix,...e)}error(...e){Ms.disabled||console.error(this._prefix,...e)}table(...e){Ms.disabled||(console.group(this._prefix),console.table(...e),console.groupEnd())}static enable(){Ms.disabled=!1}static disable(){Ms.disabled=!0}}return e(Ms,"disabled",!0),{...ao,...Yi,...js,...Zi,...Bs,...xs,...Ds,Logger:Ms}}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).XGPlayerStreamingShared=t()}(this,(function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(e){return e&&e.Math==Math&&e},n=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||Function("return this")(),i={},o=function(e){try{return!!e()}catch(t){return!0}},s=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),a=!o((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),u=a,c=Function.prototype.call,h=u?c.bind(c):function(){return c.apply(c,arguments)},l={},d={}.propertyIsEnumerable,f=Object.getOwnPropertyDescriptor,_=f&&!d.call({1:2},1);l.f=_?function(e){var t=f(this,e);return!!t&&t.enumerable}:d;var p,g,y=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},m=a,b=Function.prototype,T=b.bind,v=b.call,S=m&&T.bind(v,v),E=m?function(e){return e&&S(e)}:function(e){return e&&function(){return v.apply(e,arguments)}},O=E,R=O({}.toString),w=O("".slice),A=function(e){return w(R(e),8,-1)},P=o,L=A,C=Object,D=E("".split),j=P((function(){return!C("z").propertyIsEnumerable(0)}))?function(e){return"String"==L(e)?D(e,""):C(e)}:C,k=function(e){return null==e},B=k,x=TypeError,M=function(e){if(B(e))throw x("Can't call method on "+e);return e},I=j,F=M,U=function(e){return I(F(e))},q=function(e){return"function"==typeof e},N=q,H="object"==typeof document&&document.all,z=void 0===H&&void 0!==H?function(e){return"object"==typeof e?null!==e:N(e)||e===H}:function(e){return"object"==typeof e?null!==e:N(e)},V=n,G=q,K=function(e){return G(e)?e:void 0},W=function(e,t){return arguments.length<2?K(V[e]):V[e]&&V[e][t]},X=E({}.isPrototypeOf),Y=n,Q=W("navigator","userAgent")||"",$=Y.process,J=Y.Deno,Z=$&&$.versions||J&&J.version,ee=Z&&Z.v8;ee&&(g=(p=ee.split("."))[0]>0&&p[0]<4?1:+(p[0]+p[1])),!g&&Q&&(!(p=Q.match(/Edge\/(\d+)/))||p[1]>=74)&&(p=Q.match(/Chrome\/(\d+)/))&&(g=+p[1]);var te=g,re=o,ne=!!Object.getOwnPropertySymbols&&!re((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&te&&te<41})),ie=ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,oe=W,se=q,ae=X,ue=Object,ce=ie?function(e){return"symbol"==typeof e}:function(e){var t=oe("Symbol");return se(t)&&ae(t.prototype,ue(e))},he=String,le=function(e){try{return he(e)}catch(t){return"Object"}},de=q,fe=le,_e=TypeError,pe=function(e){if(de(e))return e;throw _e(fe(e)+" is not a function")},ge=pe,ye=k,me=h,be=q,Te=z,ve=TypeError,Se={exports:{}},Ee=n,Oe=Object.defineProperty,Re=function(e,t){try{Oe(Ee,e,{value:t,configurable:!0,writable:!0})}catch(r){Ee[e]=t}return t},we=Re,Ae="__core-js_shared__",Pe=n[Ae]||we(Ae,{}),Le=Pe;(Se.exports=function(e,t){return Le[e]||(Le[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.25.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.25.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Ce=M,De=Object,je=function(e){return De(Ce(e))},ke=je,Be=E({}.hasOwnProperty),xe=Object.hasOwn||function(e,t){return Be(ke(e),t)},Me=E,Ie=0,Fe=Math.random(),Ue=Me(1..toString),qe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ue(++Ie+Fe,36)},Ne=n,He=Se.exports,ze=xe,Ve=qe,Ge=ne,Ke=ie,We=He("wks"),Xe=Ne.Symbol,Ye=Xe&&Xe.for,Qe=Ke?Xe:Xe&&Xe.withoutSetter||Ve,$e=function(e){if(!ze(We,e)||!Ge&&"string"!=typeof We[e]){var t="Symbol."+e;Ge&&ze(Xe,e)?We[e]=Xe[e]:We[e]=Ke&&Ye?Ye(t):Qe(t)}return We[e]},Je=h,Ze=z,et=ce,tt=function(e,t){var r=e[t];return ye(r)?void 0:ge(r)},rt=function(e,t){var r,n;if("string"===t&&be(r=e.toString)&&!Te(n=me(r,e)))return n;if(be(r=e.valueOf)&&!Te(n=me(r,e)))return n;if("string"!==t&&be(r=e.toString)&&!Te(n=me(r,e)))return n;throw ve("Can't convert object to primitive value")},nt=TypeError,it=$e("toPrimitive"),ot=function(e,t){if(!Ze(e)||et(e))return e;var r,n=tt(e,it);if(n){if(void 0===t&&(t="default"),r=Je(n,e,t),!Ze(r)||et(r))return r;throw nt("Can't convert object to primitive value")}return void 0===t&&(t="number"),rt(e,t)},st=ce,at=function(e){var t=ot(e,"string");return st(t)?t:t+""},ut=z,ct=n.document,ht=ut(ct)&&ut(ct.createElement),lt=function(e){return ht?ct.createElement(e):{}},dt=!s&&!o((function(){return 7!=Object.defineProperty(lt("div"),"a",{get:function(){return 7}}).a})),ft=s,_t=h,pt=l,gt=y,yt=U,mt=at,bt=xe,Tt=dt,vt=Object.getOwnPropertyDescriptor;i.f=ft?vt:function(e,t){if(e=yt(e),t=mt(t),Tt)try{return vt(e,t)}catch(r){}if(bt(e,t))return gt(!_t(pt.f,e,t),e[t])};var St={},Et=s&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ot=z,Rt=String,wt=TypeError,At=function(e){if(Ot(e))return e;throw wt(Rt(e)+" is not an object")},Pt=s,Lt=dt,Ct=Et,Dt=At,jt=at,kt=TypeError,Bt=Object.defineProperty,xt=Object.getOwnPropertyDescriptor,Mt="enumerable",It="configurable",Ft="writable";St.f=Pt?Ct?function(e,t,r){if(Dt(e),t=jt(t),Dt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Ft in r&&!r.writable){var n=xt(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:It in r?r.configurable:n.configurable,enumerable:Mt in r?r.enumerable:n.enumerable,writable:!1})}return Bt(e,t,r)}:Bt:function(e,t,r){if(Dt(e),t=jt(t),Dt(r),Lt)try{return Bt(e,t,r)}catch(n){}if("get"in r||"set"in r)throw kt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Ut=St,qt=y,Nt=s?function(e,t,r){return Ut.f(e,t,qt(1,r))}:function(e,t,r){return e[t]=r,e},Ht={exports:{}},zt=s,Vt=xe,Gt=Function.prototype,Kt=zt&&Object.getOwnPropertyDescriptor,Wt=Vt(Gt,"name"),Xt={EXISTS:Wt,PROPER:Wt&&"something"===function(){}.name,CONFIGURABLE:Wt&&(!zt||zt&&Kt(Gt,"name").configurable)},Yt=q,Qt=Pe,$t=E(Function.toString);Yt(Qt.inspectSource)||(Qt.inspectSource=function(e){return $t(e)});var Jt,Zt,er,tr=Qt.inspectSource,rr=q,nr=n.WeakMap,ir=rr(nr)&&/native code/.test(String(nr)),or=Se.exports,sr=qe,ar=or("keys"),ur=function(e){return ar[e]||(ar[e]=sr(e))},cr={},hr=ir,lr=n,dr=E,fr=z,_r=Nt,pr=xe,gr=Pe,yr=ur,mr=cr,br="Object already initialized",Tr=lr.TypeError,vr=lr.WeakMap;if(hr||gr.state){var Sr=gr.state||(gr.state=new vr),Er=dr(Sr.get),Or=dr(Sr.has),Rr=dr(Sr.set);Jt=function(e,t){if(Or(Sr,e))throw Tr(br);return t.facade=e,Rr(Sr,e,t),t},Zt=function(e){return Er(Sr,e)||{}},er=function(e){return Or(Sr,e)}}else{var wr=yr("state");mr[wr]=!0,Jt=function(e,t){if(pr(e,wr))throw Tr(br);return t.facade=e,_r(e,wr,t),t},Zt=function(e){return pr(e,wr)?e[wr]:{}},er=function(e){return pr(e,wr)}}var Ar={set:Jt,get:Zt,has:er,enforce:function(e){return er(e)?Zt(e):Jt(e,{})},getterFor:function(e){return function(t){var r;if(!fr(t)||(r=Zt(t)).type!==e)throw Tr("Incompatible receiver, "+e+" required");return r}}},Pr=o,Lr=q,Cr=xe,Dr=s,jr=Xt.CONFIGURABLE,kr=tr,Br=Ar.enforce,xr=Ar.get,Mr=Object.defineProperty,Ir=Dr&&!Pr((function(){return 8!==Mr((function(){}),"length",{value:8}).length})),Fr=String(String).split("String"),Ur=Ht.exports=function(e,t,r){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!Cr(e,"name")||jr&&e.name!==t)&&(Dr?Mr(e,"name",{value:t,configurable:!0}):e.name=t),Ir&&r&&Cr(r,"arity")&&e.length!==r.arity&&Mr(e,"length",{value:r.arity});try{r&&Cr(r,"constructor")&&r.constructor?Dr&&Mr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(i){}var n=Br(e);return Cr(n,"source")||(n.source=Fr.join("string"==typeof t?t:"")),e};Function.prototype.toString=Ur((function(){return Lr(this)&&xr(this).source||kr(this)}),"toString");var qr=q,Nr=St,Hr=Ht.exports,zr=Re,Vr=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(qr(r)&&Hr(r,o,n),n.global)i?e[t]=r:zr(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(s){}i?e[t]=r:Nr.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Gr={},Kr=Math.ceil,Wr=Math.floor,Xr=Math.trunc||function(e){var t=+e;return(t>0?Wr:Kr)(t)},Yr=function(e){var t=+e;return t!=t||0===t?0:Xr(t)},Qr=Yr,$r=Math.max,Jr=Math.min,Zr=Yr,en=Math.min,tn=function(e){return e>0?en(Zr(e),9007199254740991):0},rn=function(e){return tn(e.length)},nn=U,on=function(e,t){var r=Qr(e);return r<0?$r(r+t,0):Jr(r,t)},sn=rn,an=function(e){return function(t,r,n){var i,o=nn(t),s=sn(o),a=on(n,s);if(e&&r!=r){for(;s>a;)if((i=o[a++])!=i)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},un={includes:an(!0),indexOf:an(!1)},cn=xe,hn=U,ln=un.indexOf,dn=cr,fn=E([].push),_n=function(e,t){var r,n=hn(e),i=0,o=[];for(r in n)!cn(dn,r)&&cn(n,r)&&fn(o,r);for(;t.length>i;)cn(n,r=t[i++])&&(~ln(o,r)||fn(o,r));return o},pn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"].concat("length","prototype");Gr.f=Object.getOwnPropertyNames||function(e){return _n(e,pn)};var gn={};gn.f=Object.getOwnPropertySymbols;var yn=W,mn=Gr,bn=gn,Tn=At,vn=E([].concat),Sn=yn("Reflect","ownKeys")||function(e){var t=mn.f(Tn(e)),r=bn.f;return r?vn(t,r(e)):t},En=xe,On=Sn,Rn=i,wn=St,An=function(e,t,r){for(var n=On(t),i=wn.f,o=Rn.f,s=0;s<n.length;s++){var a=n[s];En(e,a)||r&&En(r,a)||i(e,a,o(t,a))}},Pn=o,Ln=q,Cn=/#|\.prototype\./,Dn=function(e,t){var r=kn[jn(e)];return r==xn||r!=Bn&&(Ln(t)?Pn(t):!!t)},jn=Dn.normalize=function(e){return String(e).replace(Cn,".").toLowerCase()},kn=Dn.data={},Bn=Dn.NATIVE="N",xn=Dn.POLYFILL="P",Mn=Dn,In=n,Fn=i.f,Un=Nt,qn=Vr,Nn=Re,Hn=An,zn=Mn,Vn=a,Gn=Function.prototype,Kn=Gn.apply,Wn=Gn.call,Xn="object"==typeof Reflect&&Reflect.apply||(Vn?Wn.bind(Kn):function(){return Wn.apply(Kn,arguments)}),Yn=q,Qn=String,$n=TypeError,Jn=E,Zn=At,ei=function(e){if("object"==typeof e||Yn(e))return e;throw $n("Can't set "+Qn(e)+" as a prototype")},ti=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Jn(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return Zn(r),ei(n),t?e(r,n):r.__proto__=n,r}}():void 0),ri=St.f,ni=q,ii=z,oi=ti,si={};si[$e("toStringTag")]="z";var ai="[object z]"===String(si),ui=q,ci=A,hi=$e("toStringTag"),li=Object,di="Arguments"==ci(function(){return arguments}()),fi=ai?ci: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(r){}}(t=li(e),hi))?r:di?ci(t):"Object"==(n=ci(t))&&ui(t.callee)?"Arguments":n},_i=fi,pi=String,gi=function(e){if("Symbol"===_i(e))throw TypeError("Cannot convert a Symbol value to a string");return pi(e)},yi=z,mi=Nt,bi=Error,Ti=E("".replace),vi=String(bi("zxcasd").stack),Si=/\n\s*at [^:]*:[^\n]*/,Ei=Si.test(vi),Oi=y,Ri=!o((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Oi(1,7)),7!==e.stack)})),wi=W,Ai=xe,Pi=Nt,Li=X,Ci=ti,Di=An,ji=function(e,t,r){r in e||ri(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},ki=function(e,t,r){var n,i;return oi&&ni(n=t.constructor)&&n!==r&&ii(i=n.prototype)&&i!==r.prototype&&oi(e,i),e},Bi=function(e,t){return void 0===e?arguments.length<2?"":t:gi(e)},xi=function(e,t){yi(t)&&"cause"in t&&mi(e,"cause",t.cause)},Mi=function(e,t){if(Ei&&"string"==typeof e&&!bi.prepareStackTrace)for(;t--;)e=Ti(e,Si,"");return e},Ii=Ri,Fi=s,Ui=function(e,t){var r,n,i,o,s,a=e.target,u=e.global,c=e.stat;if(r=u?In:c?In[a]||Nn(a,{}):(In[a]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(s=Fn(r,n))&&s.value:r[n],!zn(u?n:a+(c?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;Hn(o,i)}(e.sham||i&&i.sham)&&Un(o,"sham",!0),qn(r,n,o,e)}},qi=Xn,Ni=function(e,t,r,n){var i="stackTraceLimit",o=n?2:1,s=e.split("."),a=s[s.length-1],u=wi.apply(null,s);if(u){var c=u.prototype;if(Ai(c,"cause")&&delete c.cause,!r)return u;var h=wi("Error"),l=t((function(e,t){var r=Bi(n?t:e,void 0),i=n?new u(e):new u;return void 0!==r&&Pi(i,"message",r),Ii&&Pi(i,"stack",Mi(i.stack,2)),this&&Li(c,this)&&ki(i,this,l),arguments.length>o&&xi(i,arguments[o]),i}));l.prototype=c,"Error"!==a?Ci?Ci(l,h):Di(l,h,{name:!0}):Fi&&i in u&&(ji(l,u,i),ji(l,u,"prepareStackTrace")),Di(l,u);try{c.name!==a&&Pi(c,"name",a),c.constructor=l}catch(d){}return l}},Hi="WebAssembly",zi=n.WebAssembly,Vi=7!==Error("e",{cause:7}).cause,Gi=function(e,t){var r={};r[e]=Ni(e,t,Vi),Ui({global:!0,constructor:!0,arity:1,forced:Vi},r)},Ki=function(e,t){if(zi&&zi[e]){var r={};r[e]=Ni("WebAssembly."+e,t,Vi),Ui({target:Hi,stat:!0,constructor:!0,arity:1,forced:Vi},r)}};function Wi(){let e,t;const r=new Promise(((r,n)=>{e=r,t=n}));return r.used=!1,r.resolve=(...t)=>(r.used=!0,e(...t)),r.reject=(...e)=>(r.used=!0,t(...e)),r}Gi("Error",(function(e){return function(t){return qi(e,this,arguments)}})),Gi("EvalError",(function(e){return function(t){return qi(e,this,arguments)}})),Gi("RangeError",(function(e){return function(t){return qi(e,this,arguments)}})),Gi("ReferenceError",(function(e){return function(t){return qi(e,this,arguments)}})),Gi("SyntaxError",(function(e){return function(t){return qi(e,this,arguments)}})),Gi("TypeError",(function(e){return function(t){return qi(e,this,arguments)}})),Gi("URIError",(function(e){return function(t){return qi(e,this,arguments)}})),Ki("CompileError",(function(e){return function(t){return qi(e,this,arguments)}})),Ki("LinkError",(function(e){return function(t){return qi(e,this,arguments)}})),Ki("RuntimeError",(function(e){return function(t){return qi(e,this,arguments)}}));class Xi{static start(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}static end(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}static get(e){if(e)try{return e.buffered}catch(t){}}static buffers(e,t){if(!e||!e.length)return[];const r=[];for(let n=0,i=e.length;n<i;n++){const i=r.length;if(i&&t){const o=r[i-1],s=o[1];if(e.start(n)-s<=t){const t=e.end(n);t>s&&(o[1]=t)}else r.push([e.start(n),e.end(n)])}else r.push([e.start(n),e.end(n)])}return r}static length(e){return e&&e.length?e.reduce(((e,t)=>e+(t[1]-t[0])),0):0}static info(e,t=0,r=0){if(!e||!e.length)return{start:0,end:0,buffers:[]};let n=0,i=0,o=0,s=0,a=0,u=0,c=0;const h=Xi.buffers(e,r);for(let l=0,d=h.length;l<d;l++){const e=h[l];if(t+r>=e[0]&&t<e[1])n=e[0],i=e[1],o=l;else{if(t+r<e[0]){s=e[0],a=e[1];break}t+r>e[1]&&(u=e[0],c=e[1])}}return{start:n,end:i,index:o,buffers:h,nextStart:s,nextEnd:a,prevStart:u,prevEnd:c,currentTime:t,behind:t-n,remaining:i?i-t:0,length:Xi.length&&Xi.length(h)}}}var Yi=Object.freeze(Object.defineProperty({__proto__:null,Buffer:Xi},Symbol.toStringTag,{value:"Module"}));const Qi={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",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",OPTION:"OPTION"}},$i={[Qi.MANIFEST]:{HLS:1100},[Qi.NETWORK]:2100,[Qi.NETWORK_TIMEOUT]:2101,[Qi.DEMUX]:{FLV:3100,HLS:3200,MP4:3300,FMP4:3400},[Qi.REMUX]:{FMP4:4100,MP4:4200},[Qi.MEDIA]:{MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202},[Qi.OTHER]:8e3};class Ji extends Error{constructor(e,t,r,n,i){super(i||(null==r?void 0:r.message)),this.errorType=e===Qi.NETWORK_TIMEOUT?Qi.NETWORK:e,this.originError=r,this.ext=n,this.errorCode=$i[e][t]||$i[e],this.errorMessage=this.message,this.errorCode||(this.errorType=Qi.OTHER,this.errorCode=$i[this.errorType])}static create(e,t,r,n,i){return e instanceof Ji?e:(e instanceof Error&&(r=e,e=""),e||(e=Qi.OTHER),new Ji(e,t,r,n,i))}static network(e){var t;return new Ji((null==e?void 0:e.isTimeout)?Qi.NETWORK_TIMEOUT:Qi.NETWORK,e,null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==(t=null==e?void 0:e.response)?void 0:t.status})}}var Zi=Object.freeze(Object.defineProperty({__proto__:null,ERR:Qi,ERR_CODE:$i,StreamingError:Ji},Symbol.toStringTag,{value:"Module"}));const eo="undefined"!=typeof window;const to=function(){try{return eo?window.MediaSource:null}catch(e){}}();class ro extends Error{constructor(e,t){super(t||e),this.type=e,this.msg=t}}class no{constructor(t){e(this,"media",null),e(this,"mediaSource",null),e(this,"_openPromise",Wi()),e(this,"_queue",Object.create(null)),e(this,"_sourceBuffer",Object.create(null)),e(this,"_onSBUpdateEnd",(e=>{const t=this._queue[e];if(t){const r=t.shift();r&&(r.promise.resolve(),this._startQueue(e))}})),e(this,"_onSBUpdateError",((e,t)=>{const r=this._queue[e];if(r){const e=r[0];e&&e.promise.reject(new Ji(Qi.MEDIA,Qi.SUB_TYPES.MSE_APPEND_BUFFER,t))}})),t&&this.bindMedia(t)}get isOpened(){var e;return"open"===(null==(e=this.mediaSource)?void 0:e.readyState)}get duration(){var e;return(null==(e=this.mediaSource)?void 0:e.duration)||-1}updateDuration(e){return this._enqueueBlockingOp((()=>{this.mediaSource&&(this.mediaSource.duration=e)}))}open(){if(this._openPromise.used&&!this.isOpened&&this.mediaSource){const e=this.mediaSource,t=()=>{e.removeEventListener("sourceopen",t),this._openPromise.resolve()};e.addEventListener("sourceopen",t),this._openPromise=Wi()}return this._openPromise}async bindMedia(e){if((this.mediaSource||this.media)&&await this.unbindMedia(),!e||!to)throw new Error("Param media or MediaSource does not exist");this.media=e;const t=this.mediaSource=new to;e.src=URL.createObjectURL(t);const r=()=>{t.removeEventListener("sourceopen",r),URL.revokeObjectURL(e.src),this._openPromise.resolve()};return t.addEventListener("sourceopen",r),this._openPromise}async unbindMedia(){this._openPromise.used||this._openPromise.resolve();const e=this.mediaSource;if(e){Object.keys(this._queue).forEach((e=>{const t=this._queue[e];t&&t.forEach((e=>e.promise.resolve))}));const r=!!this.media&&this.media.readyState>=1,n="open"===e.readyState;if(r&&n)try{e.endOfStream()}catch(t){}Object.keys(this._sourceBuffer).forEach((r=>{try{e.removeSourceBuffer(this._sourceBuffer[r])}catch(t){}}))}if(this.media){this.media.removeAttribute("src");try{this.media.load()}catch(t){}this.media=null}this.mediaSource=null,this._openPromise=Wi(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null)}createSource(e,t){if(this._sourceBuffer[e]||!this.mediaSource)return;let r;try{r=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(n){throw new Ji(Qi.MEDIA,Qi.SUB_TYPES.MSE_ADD_SB,n)}r.mimeType=t,r.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),r.addEventListener("error",this._onSBUpdateError.bind(this,e))}changeType(e,t){const r=this._sourceBuffer[e];return this.mediaSource&&r&&r.mimeType!==t&&"function"==typeof r.changeType?this._enqueueOp((()=>{r.changeType(t)})):Promise.resolve()}createOrChangeSource(e,t){return this.createSource(e,t),this.changeType(e,t)}append(e,t){return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(()=>{var r;this.mediaSource&&(null==(r=this._sourceBuffer[e])||r.appendBuffer(t))})):Promise.resolve()}remove(e,t,r){return 1===Object.keys(this._sourceBuffer).length?Promise.resolve():this._enqueueOp(e,(()=>{if(!this.mediaSource)return;const n=this._sourceBuffer[e];t>=r||!n?this._onSBUpdateEnd(e):n.remove(t,r)}))}clearBuffer(e,t){let r;return Object.keys(this._sourceBuffer).forEach((n=>{r=this._enqueueOp(n,(()=>{if(!this.mediaSource)return;this._sourceBuffer[n].remove(e,t)}))})),r}clearAllBuffer(){let e;return Object.keys(this._sourceBuffer).forEach((t=>{e=this._enqueueOp(t,(()=>{if(!this.mediaSource)return;const e=this._sourceBuffer[t];e.remove(0,Xi.end(Xi.get(e)))}))})),e}endOfStream(e){return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((()=>{const t=this.mediaSource;t&&"open"===t.readyState&&(e?t.endOfStream(e):t.endOfStream())})):Promise.resolve()}setLiveSeekableRange(e,t){const r=this.mediaSource;e<0||t<e||!(null==r?void 0:r.setLiveSeekableRange)||"open"!==r.readyState||r.setLiveSeekableRange(e,t)}buffered(e){return Xi.get(this._sourceBuffer[e])}bufferStart(e){return Xi.start(this.buffered(e))}bufferEnd(e){return Xi.end(this.buffered(e))}_enqueueOp(e,t){if(!this.mediaSource)return Promise.resolve();const r=this._queue[e]=this._queue[e]||[],n={exec:t,promise:Wi()};return r.push(n),1===r.length&&this._startQueue(e),n.promise}async _enqueueBlockingOp(e){if(!this.mediaSource)return Promise.resolve();const t=Object.keys(this._sourceBuffer);if(!t.length)return e();const r=[];return t.forEach((e=>{const t=this._queue[e],n=Wi();r.push(n),t.push({exec:()=>n.resolve(),promise:n}),1===t.length&&this._startQueue(e)})),Promise.all(r).then((()=>{try{return e()}finally{t.forEach((e=>{const t=this._queue[e],r=this._sourceBuffer[e];null==t||t.shift(),r&&r.updating||this._startQueue(e)}))}}))}_startQueue(e){const t=this._queue[e];if(t){const n=t[0];if(n)try{n.exec()}catch(r){n.promise.reject(new Ji(Qi.MEDIA,Qi.SUB_TYPES.MSE_OTHER,r)),t.shift(),this._startQueue(e)}}}static isSupported(e='video/mp4; codecs="avc1.42E01E,mp4a.40.2"'){if(!to)return!1;try{return to.isTypeSupported(e)}catch(t){return!1}}}e(no,"VIDEO","video"),e(no,"AUDIO","audio");var io,oo,so,ao=Object.freeze(Object.defineProperty({__proto__:null,MSEErrorType:{UPDATE_ERROR:"updateError"},MSEError:ro,MSE:no},Symbol.toStringTag,{value:"Module"})),uo="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,co=!o((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),ho=xe,lo=q,fo=je,_o=co,po=ur("IE_PROTO"),go=Object,yo=go.prototype,mo=_o?go.getPrototypeOf:function(e){var t=fo(e);if(ho(t,po))return t[po];var r=t.constructor;return lo(r)&&t instanceof r?r.prototype:t instanceof go?yo:null},bo=uo,To=s,vo=n,So=q,Eo=z,Oo=xe,Ro=fi,wo=le,Ao=Nt,Po=Vr,Lo=St.f,Co=X,Do=mo,jo=ti,ko=$e,Bo=qe,xo=Ar.enforce,Mo=Ar.get,Io=vo.Int8Array,Fo=Io&&Io.prototype,Uo=vo.Uint8ClampedArray,qo=Uo&&Uo.prototype,No=Io&&Do(Io),Ho=Fo&&Do(Fo),zo=Object.prototype,Vo=vo.TypeError,Go=ko("toStringTag"),Ko=Bo("TYPED_ARRAY_TAG"),Wo="TypedArrayConstructor",Xo=bo&&!!jo&&"Opera"!==Ro(vo.opera),Yo=!1,Qo={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},$o={BigInt64Array:8,BigUint64Array:8},Jo=function(e){var t=Do(e);if(Eo(t)){var r=Mo(t);return r&&Oo(r,Wo)?r.TypedArrayConstructor:Jo(t)}},Zo=function(e){if(!Eo(e))return!1;var t=Ro(e);return Oo(Qo,t)||Oo($o,t)};for(io in Qo)(so=(oo=vo[io])&&oo.prototype)?xo(so).TypedArrayConstructor=oo:Xo=!1;for(io in $o)(so=(oo=vo[io])&&oo.prototype)&&(xo(so).TypedArrayConstructor=oo);if((!Xo||!So(No)||No===Function.prototype)&&(No=function(){throw Vo("Incorrect invocation")},Xo))for(io in Qo)vo[io]&&jo(vo[io],No);if((!Xo||!Ho||Ho===zo)&&(Ho=No.prototype,Xo))for(io in Qo)vo[io]&&jo(vo[io].prototype,Ho);if(Xo&&Do(qo)!==Ho&&jo(qo,Ho),To&&!Oo(Ho,Go))for(io in Yo=!0,Lo(Ho,Go,{get:function(){return Eo(this)?this[Ko]:void 0}}),Qo)vo[io]&&Ao(vo[io],Ko,io);var es={NATIVE_ARRAY_BUFFER_VIEWS:Xo,TYPED_ARRAY_TAG:Yo&&Ko,aTypedArray:function(e){if(Zo(e))return e;throw Vo("Target is not a typed array")},aTypedArrayConstructor:function(e){if(So(e)&&(!jo||Co(No,e)))return e;throw Vo(wo(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(To){if(r)for(var i in Qo){var o=vo[i];if(o&&Oo(o.prototype,e))try{delete o.prototype[e]}catch(s){try{o.prototype[e]=t}catch(a){}}}Ho[e]&&!r||Po(Ho,e,r?t:Xo&&Fo[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(To){if(jo){if(r)for(n in Qo)if((i=vo[n])&&Oo(i,e))try{delete i[e]}catch(o){}if(No[e]&&!r)return;try{return Po(No,e,r?t:Xo&&No[e]||t)}catch(o){}}for(n in Qo)!(i=vo[n])||i[e]&&!r||Po(i,e,t)}},getTypedArrayConstructor:Jo,isView:function(e){if(!Eo(e))return!1;var t=Ro(e);return"DataView"===t||Oo(Qo,t)||Oo($o,t)},isTypedArray:Zo,TypedArray:No,TypedArrayPrototype:Ho},ts=rn,rs=Yr,ns=es.aTypedArray;(0,es.exportTypedArrayMethod)("at",(function(e){var t=ns(this),r=ts(t),n=rs(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var is=pe,os=a,ss=E(E.bind),as=function(e,t){return is(e),void 0===t?e:os?ss(e,t):function(){return e.apply(t,arguments)}},us=j,cs=je,hs=rn,ls=function(e){var t=1==e;return function(r,n,i){for(var o,s=cs(r),a=us(s),u=as(n,i),c=hs(a);c-- >0;)if(u(o=a[c],c,s))switch(e){case 0:return o;case 1:return c}return t?-1:void 0}},ds={findLast:ls(0),findLastIndex:ls(1)},fs=ds.findLast,_s=es.aTypedArray;(0,es.exportTypedArrayMethod)("findLast",(function(e){return fs(_s(this),e,arguments.length>1?arguments[1]:void 0)}));var ps=ds.findLastIndex,gs=es.aTypedArray;(0,es.exportTypedArrayMethod)("findLastIndex",(function(e){return ps(gs(this),e,arguments.length>1?arguments[1]:void 0)}));const ys={FETCH:"fetch",XHR:"xhr"},ms={ARRAY_BUFFER:"arraybuffer",TEXT:"text",JSON:"json"};class bs extends Error{constructor(t,r,n,i){super(i),e(this,"retryCount",0),e(this,"isTimeout",!1),e(this,"loaderType",ys.FETCH),e(this,"startTime",0),e(this,"endTime",0),this.url=t,this.request=r,this.response=n}}const Ts=Object.prototype.toString;function vs(e){if("[object Object]"!==Ts.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function Ss(e){if(!e||null===e[0]||void 0===e[0]||0===e[0]&&(null===e[1]||void 0===e[1]))return;let t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}function Es(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Os(e,t){if(!e)return;if(!t)return e;let r;const n=Object.keys(t).map((e=>{if(r=t[e],null!=r)return Array.isArray(r)?e+="[]":r=[r],r.map((t=>{var r;return r=t,"[object Date]"===Ts.call(r)?t=t.toISOString():function(e){return null!==e&&"object"==typeof e}(t)&&(t=JSON.stringify(t)),`${Es(e)}=${Es(t)}`})).join("&")})).filter(Boolean).join("&");if(n){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}function Rs(e,t,r,n,i,o,s,a,u,c){i=null!=i?parseFloat(i):null,n=parseInt(n||"0",10),Number.isNaN(n)&&(n=0);return{data:e,done:t,option:{range:u,vid:c,index:a,contentLength:n,age:i,startTime:o,firstByteTime:s,endTime:Date.now()},response:r}}class ws{constructor(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,this._realTimeSpeed=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}reset(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0}addBytes(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())}get currentKBps(){this.addBytes(0);let e=(this._now()-this._lastCheckpoint)/1e3;return 0===e&&(e=1),this._intervalBytes/e/1024}get lastSecondKBps(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}static getSpeed(){let e=0;if(this._netRecords.length<1)return e;const t=[];this._netRecords.map((e=>{t.push(e)})),t.sort(((e,t)=>e.mSpeedInbPS-t.mSpeedInbPS));const r=t.length;let n=0;for(let i=0;i<r;i++)n+=t[i].mBytes;n/=2;for(let i=0;i<r;i++)if(n-=t[i].mBytes,n<=0){e=t[i].mSpeedInbPS;break}return e<0?0:e}static getRealTimeSpeed(){return this._realTimeSpeed}static getRTT(){if(this._netRecords.length<1)return 0;const e=[];this._netRecords.map((t=>{e.push(t.mRTT)})),e.sort(((e,t)=>e-t));const t=e.length;return t%2==0?(e[t/2-1]+e[t/2])/2:e[Math.floor(t/2)]}static netSampling(e){this._netRecords.push(e),this._realTimeSpeed=e.mSpeedInbPS,this._netRecords.length>10&&this._netRecords.splice(0,1)}}e(ws,"_netRecords",[]);class As{constructor(){e(this,"_abortController",null),e(this,"_timeoutTimer",null),e(this,"_reader",null),e(this,"_response",null),e(this,"_aborted",!1),e(this,"_index",-1),e(this,"_range",null),e(this,"_receivedLength",0),e(this,"_running",!1),e(this,"_logger",null),e(this,"_vid","")}load({url:e,vid:t,timeout:r,responseType:n,onProgress:i,index:o,onTimeout:s,range:a,transformResponse:u,request:c,params:h,logger:l,method:d,headers:f,body:_,mode:p,credentials:g,cache:y,redirect:m,referrer:b,referrerPolicy:T}){var v;this._logger=l,this._aborted=!1,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=o,this._range=a||[0,0],this._vid=t||e;const S={method:d,headers:f,body:_,mode:p,credentials:g,cache:y,redirect:m,referrer:b,referrerPolicy:T,signal:null==(v=this._abortController)?void 0:v.signal};let E=!1;clearTimeout(this._timeoutTimer),e=Os(e,h);const O=Ss(a);O&&((f=c?c.headers:S.headers=S.headers||new Headers)instanceof Headers?f.append("Range",O):f.Range=O),r&&(this._timeoutTimer=setTimeout((()=>{if(E=!0,this.cancel(),s){const t=new bs(e,S);t.isTimeout=!0,s(t)}}),r));const R=Date.now();return this._logger.debug("[fetch load start], index,",o,",range,",a),new Promise(((t,r)=>{fetch(c||e,c?void 0:S).then((async s=>{if(clearTimeout(this._timeoutTimer),this._response=s,this._aborted||!this._running)return;u&&(s=u(s,e)||s),s.ok||(this._running=!1,r(bs(e,S,s,"bad network response")));const c=Date.now();let h;if(n===ms.TEXT)h=await s.text(),this._running=!1;else if(n===ms.JSON)h=await s.json(),this._running=!1;else{if(i)return this.resolve=t,this.reject=r,void this._loadChunk(s,i,R,c);{h=await s.arrayBuffer(),h=new Uint8Array(h),this._running=!1;const e=Date.now()-R;ws.netSampling({mTime:e,mBytes:h.byteLength,mSpeedInbPS:8*h.byteLength/(e/1e3),mRTT:c-R})}}this._logger.debug("[fetch load end], index,",o,",range,",a),t(Rs(h,!0,s,s.headers.get("Content-Length"),s.headers.get("age"),R,c,o,a,this._vid))})).catch((t=>{clearTimeout(this._timeoutTimer),this._running=!1,this._aborted&&!E||((t=t instanceof bs?t:new bs(e,S)).startTime=R,t.endTime=Date.now(),t.isTimeout=E,r(t))}))}))}async cancel(){if(!this._aborted){if(this._aborted=!0,this._running=!1,this._response){try{this._reader&&await this._reader.cancel()}catch(e){}this._response=this._reader=null}if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}}}_loadChunk(e,t,r,n){if(!e.body||!e.body.getReader)return this._running=!1,void this.reject(bs(e.url,"",e,"onProgress of bad response.body.getReader"));const i=this._reader=e.body.getReader();let o,s,a;const u=async()=>{s=Date.now();try{o=await i.read(),a=Date.now()}catch(l){return a=Date.now(),void(this._aborted||(this._running=!1,this.reject(l)))}const c=this._range[0]+this._receivedLength;if(this._aborted)return this._running=!1,void t(void 0,!1,{range:[c,c],vid:this._vid,index:this._index,startTime:s,endTime:a},e);this._receivedLength+=o.value?o.value.byteLength:0,this._logger.debug("【fetchLoader,onProgress call】,task,",this._range,", start,",c,", end,",this._range[0]+this._receivedLength,", done,",o.done),t(o.value,o.done,{range:[c,this._range[0]+this._receivedLength],vid:this._vid,index:this._index,startTime:s,endTime:a},e);const h=Date.now()-r;this._logger.debug("[fetchLoader SPEED], fetch speed(b/s),",8*this._receivedLength/(h/1e3)),ws.netSampling({mTime:h,mBytes:this._receivedLength,mSpeedInbPS:8*this._receivedLength/(h/1e3),mRTT:n-r}),o.done?(this._running=!1,this._logger.debug("[fetchLoader onProgress end],task,",this._range,",done,",o.done),this.resolve(Rs(o,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),s,n,this._index,this._range,this._vid))):u()};u()}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}static isSupported(){return!("undefined"==typeof fetch)}}class Ps{constructor(){e(this,"_xhr",null),e(this,"_aborted",!1),e(this,"_timeoutTimer",null),e(this,"_range",null),e(this,"_receivedLength",0),e(this,"_url",null),e(this,"_onProgress",null),e(this,"_index",-1),e(this,"_headers",null),e(this,"_chunkSizeKBList",[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192]),e(this,"_currentChunkSizeKB",384),e(this,"_currentSpeedNormalized",0),e(this,"_zeroSpeedChunkCount",0),e(this,"_timeout",null),e(this,"_xhr",null),e(this,"_withCredentials",null),e(this,"_startTime",-1),e(this,"_speedSampler",new ws),e(this,"_loadCompleteResolve",null),e(this,"_loadCompleteReject",null),e(this,"_runing",!1),e(this,"_logger",!1),e(this,"_vid",""),e(this,"_responseType",void 0),e(this,"_credentials",void 0),e(this,"_method",void 0),e(this,"_transformResponse",void 0),e(this,"_firstRtt",void 0),e(this,"_subRangeStartTime",void 0)}load(e){clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range||[0,0],this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,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._request=e.request,this._credentials=e.credentials,this._logger.debug("【xhrLoader task】, range",this._range),this._url=Os(e.url,e.params);const t=Date.now();return new Promise(((e,t)=>{this._loadCompleteResolve=e,this._loadCompleteReject=t,this._startLoad()})).catch((e=>{if(clearTimeout(this._timeoutTimer),this._runing=!1,!this._aborted)throw(e=e instanceof bs?e:new bs(this._url,this._request)).startTime=t,e.endTime=Date.now(),e}))}_startLoad(){let e=null;if(this._range&&this._range.length>1)if(this._onProgress){this._subRangeStartTime=Date.now(),this._firstRtt=-1;const t=1024*this._currentChunkSizeKB,r=this._range[0]+this._receivedLength;let 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)}_internalOpen(e){try{this._startTime=Date.now();const t=this._xhr=new XMLHttpRequest;t.open(this._method||"GET",this._url,!0),t.responseType=this._responseType,this._timeout&&(t.timeout=this._timeout),t.withCredentials=this._credentials,t.onload=this._onLoad.bind(this),t.onreadystatechange=this._onReadyStatechange.bind(this),t.onerror=e=>{this._running=!1,this._loadCompleteReject(e)},t.ontimeout=e=>{if(this.cancel(),this._onTimeout){const e=new bs(this._url,this._request);e.isTimeout=!0,this._onTimeout(e)}this._loadCompleteReject(e)};const r=Ss(e);let n=null;r&&(n=this._headers||{},n.Range=r),n&&Object.keys(n).forEach((e=>{t.setRequestHeader(e,n[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),t.send()}catch(t){this._loadCompleteReject(t)}}_onReadyStatechange(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}_onLoad(e){const t=e.target.status;if(t<200||t>299)return this._loadCompleteReject(new bs(this._url,null,{...e.target.response,status:t},"bad response,status:"+t));let r=this._speedSampler.lastSecondKBps;if(0===r&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(r=this._speedSampler.currentKBps)),0!==r){const e=this._normalizeSpeed(r);this._currentSpeedNormalized!==e&&(this._currentSpeedNormalized=e,this._currentChunkSizeKB=e)}let n,i=null,o=!1;if(this._responseType===ms.ARRAY_BUFFER){const t=new Uint8Array(e.target.response);if(n=this._range[0]+this._receivedLength,t&&t.byteLength>0){this._receivedLength+=t.byteLength;const e=Date.now()-this._subRangeStartTime;this._speedSampler.addBytes(t.byteLength),ws.netSampling({mTime:e,mBytes:this._receivedLength,mSpeedInbPS:8*this._receivedLength/(e/1e3),mRTT:this._firstRtt-this._subRangeStartTime})}i=t,o=!(this._range.length>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",n,"end ",this._range[0]+this._receivedLength,",dataLen,",t?t.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",o)}else o=!0,i=e.target.response;let s={ok:t>=200&&t<300,status:t,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(s=this._transformResponse(s,this._url)||s),this._onProgress&&this._onProgress(i,o,{index:this._index,vid:this._vid,range:[n,this._range[0]+this._receivedLength],startTime:this._startTime,endTime:Date.now()},s),o?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(Rs(this._onProgress?null:i,o,s,s.headers["content-length"],s.headers.age,this._startTime,-1,this._index,this._range,this._vid))):this._startLoad()}_normalizeSpeed(e){const t=this._chunkSizeKBList,r=t.length-1;let n=0,i=0,o=r;if(e<t[0])return t[0];for(;i<=o;){if(n=i+Math.floor((o-i)/2),n===r||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?i=n+1:o=n-1}}cancel(){if(!this._aborted)return this._aborted=!0,this._runing=!1,this._xhr?this._xhr.abort():void 0}static isSupported(){return"undefined"!=typeof XMLHttpRequest}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}_getHeaders(e){const t=e.getAllResponseHeaders().trim().split("\r\n"),r={};for(const n of t){const e=n.split(": ");r[e[0].toLowerCase()]=e.slice(1).join(": ")}return r}}class Ls{constructor(e){this.name=e||"",this._prefix=`[${this.name}]`}debug(...e){Ls.disabled||console.debug(this._prefix,...e)}log(...e){Ls.disabled||console.log(this._prefix,...e)}warn(...e){Ls.disabled||console.warn(this._prefix,...e)}error(...e){Ls.disabled||console.error(this._prefix,...e)}table(...e){Ls.disabled||(console.group(this._prefix),console.table(...e),console.groupEnd())}static enable(){Ls.disabled=!1}static disable(){Ls.disabled=!0}}e(Ls,"disabled",!0);class Cs{constructor(e,t){this.promise=Wi(),this.alive=!!t.onProgress,!t.logger&&(t.logger=new Ls("Loader")),this._loaderType=e,this._loader=e===ys.FETCH?new As:new Ps,this._config=t,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._logger=t.logger}exec(){const{retry:e,retryDelay:t,onRetryError:r,transformError:n,...i}=this._config,o=async()=>{try{const e=await this._loader.load(i);this.promise.resolve(e)}catch(s){if(this._loader.running=!1,this._logger.debug("[task request catch err]",s),this._canceled)return;if(s.response&&s.response.status>=400&&s.response.status<=599)return void this.promise.reject(s);s.loaderType=this._loaderType,s.retryCount=this._retryCount;let a=s;if(n&&(a=n(a)||a),r&&this._retryCount>0&&r(a,this._retryCount,e),this._retryCount++,this._retryCount<=e)return clearTimeout(this._retryTimer),this._logger.debug("[task request setTimeout],retry",this._retryCount,",retry range,",i.range),void(this._retryTimer=setTimeout(o,t));this.promise.reject(a)}};return o(),this.promise}async cancel(){return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,this._loader.cancel()}get running(){return this._loader&&this._loader.running}}function Ds(e=0){return new Promise((t=>setTimeout(t,e)))}var js=Object.freeze(Object.defineProperty({__proto__:null,isMediaPlaying:function(e){return e&&!e.paused&&!e.ended&&0!==e.playbackRate&&0!==e.readyState},getVideoPlaybackQuality:function(e){if(!e)return{};if("function"==typeof e.getVideoPlaybackQuality){const t=e.getVideoPlaybackQuality();return{droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}return{droppedVideoFrames:e.webkitDroppedFrameCount,totalVideoFrames:e.webkitDecodedFrameCount,creationTime:performance.now()}},concatUint8Array:function(...e){if((e=e.filter(Boolean)).length<2)return e[0];const t=new Uint8Array(e.reduce(((e,t)=>e+t.byteLength),0));let r=0;return e.forEach((e=>{t.set(e,r),r+=e.byteLength})),t},sleep:Ds},Symbol.toStringTag,{value:"Module"}));var ks=Object.freeze(Object.defineProperty({__proto__:null,LoaderType:ys,ResponseType:ms,NetLoader:class{constructor(t){e(this,"type",ys.FETCH),e(this,"_queue",[]),e(this,"_alive",[]),e(this,"_currentTask",null),this._config=function(e){return{loaderType:ys.FETCH,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:ms.TEXT,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,...e}}(t),this._config.loaderType!==ys.XHR&&As.isSupported()||(this.type=ys.XHR),this.log=t.logger}isFetch(){return this.type===ys.FETCH}static isFetchSupport(){return As.isSupported()}load(e,t={}){"string"!=typeof e&&e?t=e:t.url=e||t.url||this._config.url,(t=Object.assign({},this._config,t)).params&&(t.params=Object.assign({},t.params)),t.headers&&vs(t.headers)&&(t.headers=Object.assign({},t.headers)),t.body&&vs(t.body)&&(t.body=Object.assign({},t.body)),t.transformRequest&&(t=t.transformRequest(t)||t),t.logger=this.log;const r=new Cs(this.type,t);return this._queue.push(r),this.log.debug("[currentTask] len ",this._queue.length),1!==this._queue.length||this._currentTask&&this._currentTask.running||(this.log.debug("[currentTask] this._queue.length is 1 processTask"),this._processTask()),r.promise}async cancel(){const e=this._queue.map((e=>e.cancel())).concat(this._alive.map((e=>e.cancel())));this._currentTask&&e.push(this._currentTask.cancel()),this._queue=[],this._alive=[],await Promise.all(e),await Ds()}_processTask(){this._currentTask=this._queue.shift(),this._currentTask&&(this._currentTask.alive&&this._alive.push(this._currentTask),this._currentTask.exec().finally((()=>{this.log.debug("[currentTask] exec finally, queueLen,",this._queue.length),this._processTask()})))}static getSpeed(){return ws.getSpeed()}static getRealTimeSpeed(){return ws.getRealTimeSpeed()}static getRTT(){return ws.getRTT()}}},Symbol.toStringTag,{value:"Module"}));const Bs={ERROR:"error",TTFB:"core.ttfb",LOAD_START:"core.loadstart",LOAD_RESPONSE_HEADERS:"core.loadresponseheaders",LOAD_COMPLETE:"core.loadcomplete",LOAD_RETRY:"core.loadretry",SOURCEBUFFER_CREATED:"core.sourcebuffercreated",ANALYZE_DURATION_EXCEEDED:"core.analyzedurationexceeded",REMOVE_BUFFER:"core.removebuffer",BUFFEREOS:"core.buffereos",KEYFRAME:"core.keyframe",METADATA_PARSED:"core.metadataparsed",SEI:"core.sei",SEI_IN_TIME:"core.seiintime",FLV_SCRIPT_DATA:"core.flvscriptdata",LOWDECODE:"core.lowdecode",SWITCH_URL_SUCCESS:"core.switchurlsuccess",SWITCH_URL_FAILED:"core.switchurlfailed",SPEED:"core.speed",HLS_MANIFEST_LOADED:"core.hlsmanifestloaded",HLS_LEVEL_LOADED:"core.hlslevelloaded",STREAM_EXCEPTION:"core.streamexception",LARGE_AV_FIRST_FRAME_GAP_DETECT:"LARGE_AV_FIRST_FRAME_GAP_DETECT",LARGE_VIDEO_DTS_GAP_DETECT:"LARGE_VIDEO_DTS_GAP_DETECT",LARGE_AUDIO_DTS_GAP_DETECT:"LARGE_AUDIO_DTS_GAP_DETECT",AUDIO_GAP_DETECT:"AUDIO_GAP_DETECT",AUDIO_OVERLAP_DETECT:"AUDIO_OVERLAP_DETECT",MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT:"MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT"};var xs=Object.freeze(Object.defineProperty({__proto__:null,EVENT:Bs},Symbol.toStringTag,{value:"Module"}));return{...ao,...Yi,...ks,...Zi,...xs,...Object.freeze(Object.defineProperty({__proto__:null,GapService:class{constructor(){e(this,"_prevCurrentTime",0)}do(e,t=3,r,n=1){if(!e)return;const i=e.currentTime;let o=0;if(this._prevCurrentTime===i){const s=Xi.info(Xi.get(e),i);if(!s.buffers.length)return;r&&s.nextStart||s.nextStart&&s.nextStart-i<t?o=s.nextStart+.1:s.end&&s.end-i>n&&!e.seeking&&(o=i+.1)}this._prevCurrentTime=i,o&&i!==o&&(e.currentTime=o)}},SeiService:class{constructor(t){e(this,"_seiSet",new Set),this.emitter=t,t.on(Bs.SEI,(e=>{e&&this._seiSet.add(e)}))}throw(e){if(null==e||!this._seiSet.size)return;const t=e-.2,r=e+.2,n=[];this._seiSet.forEach((e=>{e.time>=t&&e.time<=r&&n.push(e)})),n.forEach((e=>{this._seiSet.delete(e),this.emitter.emit(Bs.SEI_IN_TIME,e)}))}reset(){this._seiSet.clear()}},BandwidthService:class{constructor(){e(this,"_chunkSpeeds",[]),e(this,"_speeds",[])}addRecord(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}addChunkRecord(e,t){e&&t&&(this._chunkSpeeds.push(8e3*e/t),this._chunkSpeeds=this._chunkSpeeds.slice(-100))}getAvgSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds.reduce(((e,t)=>e+t))/this._speeds.length:this._chunkSpeeds.reduce(((e,t)=>e+t))/this._chunkSpeeds.length:0}getLatestSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeeds[this._chunkSpeeds.length-1]:0}reset(){this._chunkSpeeds=[],this._speeds=[]}}},Symbol.toStringTag,{value:"Module"})),...js,Logger:Ls}}));
//# sourceMappingURL=index.min.js.map

@@ -37,2 +37,4 @@ export class FetchLoader {

}): any;
resolve: any;
reject: any;
cancel(): any;

@@ -39,0 +41,0 @@ _loadChunk(response: any, onProgress: any, st: any, firstByteTime: any): void;

@@ -95,50 +95,55 @@ import { defineProperty as _defineProperty } from "../_virtual/_rollupPluginBabelHelpers.js";

this._logger.debug("[fetch load start], index,", index, ",range,", range);
return fetch(request || url, request ? void 0 : init).then(async (response) => {
clearTimeout(this._timeoutTimer);
this._response = response;
if (this._aborted)
return;
if (transformResponse) {
response = transformResponse(response, url) || response;
}
if (!response.ok) {
this._running = false;
throw new NetError(url, init, response, "bad network response");
}
const firstByteTime = Date.now();
let data;
if (responseType === ResponseType.TEXT) {
data = await response.text();
this._running = false;
} else if (responseType === ResponseType.JSON) {
data = await response.json();
this._running = false;
} else {
if (onProgress) {
this._loadChunk(response, onProgress, startTime, firstByteTime);
} else {
data = await response.arrayBuffer();
data = new Uint8Array(data);
return new Promise((resolve, reject) => {
fetch(request || url, request ? void 0 : init).then(async (response) => {
clearTimeout(this._timeoutTimer);
this._response = response;
if (this._aborted || !this._running)
return;
if (transformResponse) {
response = transformResponse(response, url) || response;
}
if (!response.ok) {
this._running = false;
this._logger.debug("[fetch load end], index,", index, ",range,", range);
const costTime = Date.now() - startTime;
SpeedSampler.netSampling({
mTime: costTime,
mBytes: data.byteLength,
mSpeedInbPS: data.byteLength * 8 / (costTime / 1e3),
mRTT: firstByteTime - startTime
});
reject(NetError(url, init, response, "bad network response"));
}
}
return createResponse(data, true, response, response.headers.get("Content-Length"), response.headers.get("age"), startTime, firstByteTime, index, range, this._vid);
}).catch((error) => {
clearTimeout(this._timeoutTimer);
this._running = false;
if (this._aborted && !isTimeout)
return;
error = error instanceof NetError ? error : new NetError(url, init);
error.startTime = startTime;
error.endTime = Date.now();
error.isTimeout = isTimeout;
throw error;
const firstByteTime = Date.now();
let data;
if (responseType === ResponseType.TEXT) {
data = await response.text();
this._running = false;
} else if (responseType === ResponseType.JSON) {
data = await response.json();
this._running = false;
} else {
if (onProgress) {
this.resolve = resolve;
this.reject = reject;
this._loadChunk(response, onProgress, startTime, firstByteTime);
return;
} else {
data = await response.arrayBuffer();
data = new Uint8Array(data);
this._running = false;
const costTime = Date.now() - startTime;
SpeedSampler.netSampling({
mTime: costTime,
mBytes: data.byteLength,
mSpeedInbPS: data.byteLength * 8 / (costTime / 1e3),
mRTT: firstByteTime - startTime
});
}
}
this._logger.debug("[fetch load end], index,", index, ",range,", range);
resolve(createResponse(data, true, response, response.headers.get("Content-Length"), response.headers.get("age"), startTime, firstByteTime, index, range, this._vid));
}).catch((error) => {
clearTimeout(this._timeoutTimer);
this._running = false;
if (this._aborted && !isTimeout)
return;
error = error instanceof NetError ? error : new NetError(url, init);
error.startTime = startTime;
error.endTime = Date.now();
error.isTimeout = isTimeout;
reject(error);
});
});

@@ -170,3 +175,5 @@ }

if (!response.body || !response.body.getReader) {
throw new NetError(response.url, "", response, "onProgress of bad response.body.getReader");
this._running = false;
this.reject(NetError(response.url, "", response, "onProgress of bad response.body.getReader"));
return;
}

@@ -184,12 +191,6 @@ const reader = this._reader = response.body.getReader();

endTime = Date.now();
const startByte2 = this._range[0] + this._receivedLength;
const err = this._aborted ? null : e;
onProgress(void 0, false, {
range: [startByte2, startByte2],
vid: this._vid,
index: this._index,
startTime,
endTime,
err
}, response);
if (!this._aborted) {
this._running = false;
this.reject(e);
}
return;

@@ -199,2 +200,3 @@ }

if (this._aborted) {
this._running = false;
onProgress(void 0, false, {

@@ -231,2 +233,3 @@ range: [startByte, startByte],

this._logger.debug("[fetchLoader onProgress end],task,", this._range, ",done,", data.done);
this.resolve(createResponse(data, true, response, response.headers.get("Content-Length"), response.headers.get("age"), startTime, firstByteTime, this._index, this._range, this._vid));
}

@@ -233,0 +236,0 @@ };

import { isDate, isObject } from "../is.js";
function getRangeValue(value) {
if (!value || value[0] == null || value[0] === 0 && value[1] == null) {
if (!value || value[0] === null || value[0] === void 0 || value[0] === 0 && (value[1] === null || value[1] === void 0)) {
return;

@@ -22,3 +22,3 @@ }

v = params[k];
if (v == null)
if (v === null || v === void 0)
return;

@@ -49,7 +49,7 @@ if (Array.isArray(v)) {

function createResponse(data, done, response, contentLength, age, startTime, firstByteTime, index, range, vid) {
age = age != null ? parseFloat(age) : null;
age = age !== null && age !== void 0 ? parseFloat(age) : null;
contentLength = parseInt(contentLength || "0", 10);
if (isNaN(contentLength))
if (Number.isNaN(contentLength))
contentLength = 0;
let option = {
const option = {
range,

@@ -56,0 +56,0 @@ vid,

@@ -47,3 +47,5 @@ import { defineProperty as _defineProperty } from "../_virtual/_rollupPluginBabelHelpers.js";

this._queue.push(task);
this.log.debug("[currentTask] len ", this._queue.length);
if (this._queue.length === 1 && (!this._currentTask || !this._currentTask.running)) {
this.log.debug("[currentTask] this._queue.length is 1 processTask");
this._processTask();

@@ -71,2 +73,3 @@ }

this._currentTask.exec().finally(() => {
this.log.debug("[currentTask] exec finally, queueLen,", this._queue.length);
this._processTask();

@@ -73,0 +76,0 @@ });

@@ -5,2 +5,3 @@ import { FetchLoader } from "./fetch.js";

import { createPublicPromise } from "../utils.js";
import { Logger } from "../logger.js";
class Task {

@@ -10,2 +11,3 @@ constructor(type, config) {

this.alive = !!config.onProgress;
!config.logger && (config.logger = new Logger("Loader"));
this._loaderType = type;

@@ -12,0 +14,0 @@ this._loader = type === LoaderType.FETCH ? new FetchLoader() : new XhrLoader();

@@ -81,4 +81,4 @@ import { defineProperty as _defineProperty } from "../_virtual/_rollupPluginBabelHelpers.js";

this._firstRtt = -1;
let chunkSize = this._currentChunkSizeKB * 1024;
let from = this._range[0] + this._receivedLength;
const chunkSize = this._currentChunkSizeKB * 1024;
const from = this._range[0] + this._receivedLength;
let to = this._range[1];

@@ -100,3 +100,3 @@ if (chunkSize < this._range[1] - from) {

this._startTime = Date.now();
let xhr = this._xhr = new XMLHttpRequest();
const xhr = this._xhr = new XMLHttpRequest();
xhr.open(this._method || "GET", this._url, true);

@@ -160,3 +160,3 @@ xhr.responseType = this._responseType;

if (KBps !== 0) {
let normalized = this._normalizeSpeed(KBps);
const normalized = this._normalizeSpeed(KBps);
if (this._currentSpeedNormalized !== normalized) {

@@ -171,3 +171,3 @@ this._currentSpeedNormalized = normalized;

if (this._responseType === ResponseType.ARRAY_BUFFER) {
let chunk = new Uint8Array(e.target.response);
const chunk = new Uint8Array(e.target.response);
byteStart = this._range[0] + this._receivedLength;

@@ -224,4 +224,4 @@ if (chunk && chunk.byteLength > 0) {

_normalizeSpeed(input) {
let list = this._chunkSizeKBList;
let last = list.length - 1;
const list = this._chunkSizeKBList;
const last = list.length - 1;
let mid = 0;

@@ -228,0 +228,0 @@ let lbound = 0;

@@ -17,3 +17,3 @@ import { defineProperty as _defineProperty } from "../_virtual/_rollupPluginBabelHelpers.js";

this._chunkSpeeds.push(8e3 * totalByte / ms);
this._chunkSpeeds = this._chunkSpeeds.slice(-10);
this._chunkSpeeds = this._chunkSpeeds.slice(-100);
}

@@ -20,0 +20,0 @@ getAvgSpeed() {

@@ -13,3 +13,3 @@ import { defineProperty as _defineProperty } from "../_virtual/_rollupPluginBabelHelpers.js";

throw(currentTime) {
if (currentTime == null || !this._seiSet.size)
if (currentTime === null || currentTime === void 0 || !this._seiSet.size)
return;

@@ -16,0 +16,0 @@ const min = currentTime - 0.2;

{
"name": "xgplayer-streaming-shared",
"version": "3.0.0-alpha.5-16",
"version": "3.0.0-alpha.5-17",
"main": "dist/index.min.js",

@@ -5,0 +5,0 @@ "module": "es/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc