lemon-mse 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lemon/flv.js CHANGED
@@ -1,6 +1,9 @@
1
- (()=>{var _w=Object.create;var{getPrototypeOf:iw,defineProperty:n0,getOwnPropertyNames:lO,getOwnPropertyDescriptor:sw}=Object,nO=Object.prototype.hasOwnProperty;var o0=(Y,K,O)=>{O=Y!=null?_w(iw(Y)):{};let w=K||!Y||!Y.__esModule?n0(O,"default",{value:Y,enumerable:!0}):O;for(let G of lO(Y))if(!nO.call(w,G))n0(w,G,{get:()=>Y[G],enumerable:!0});return w},pO=new WeakMap,aw=(Y)=>{var K=pO.get(Y),O;if(K)return K;if(K=n0({},"__esModule",{value:!0}),Y&&typeof Y==="object"||typeof Y==="function")lO(Y).map((w)=>!nO.call(K,w)&&n0(K,w,{get:()=>Y[w],enumerable:!(O=sw(Y,w))||O.enumerable}));return pO.set(Y,K),K},tw=(Y,K)=>()=>(K||Y((K={exports:{}}).exports,K),K.exports);var ew=(Y,K)=>{for(var O in K)n0(Y,O,{get:K[O],enumerable:!0,configurable:!0,set:(w)=>K[O]=()=>w})};var k0=tw((k1,qO)=>{var Y1=Object.prototype.hasOwnProperty,Z0="~";function d0(){}if(Object.create){if(d0.prototype=Object.create(null),!new d0().__proto__)Z0=!1}function J1(Y,K,O){this.fn=Y,this.context=K,this.once=O||!1}function sO(Y,K,O,w,G){if(typeof O!=="function")throw new TypeError("The listener must be a function");var J=new J1(O,w||Y,G),Q=Z0?Z0+K:K;if(!Y._events[Q])Y._events[Q]=J,Y._eventsCount++;else if(!Y._events[Q].fn)Y._events[Q].push(J);else Y._events[Q]=[Y._events[Q],J];return Y}function YO(Y,K){if(--Y._eventsCount===0)Y._events=new d0;else delete Y._events[K]}function K0(){this._events=new d0,this._eventsCount=0}K0.prototype.eventNames=function Y(){var K=[],O,w;if(this._eventsCount===0)return K;for(w in O=this._events)if(Y1.call(O,w))K.push(Z0?w.slice(1):w);if(Object.getOwnPropertySymbols)return K.concat(Object.getOwnPropertySymbols(O));return K};K0.prototype.listeners=function Y(K){var O=Z0?Z0+K:K,w=this._events[O];if(!w)return[];if(w.fn)return[w.fn];for(var G=0,J=w.length,Q=new Array(J);G<J;G++)Q[G]=w[G].fn;return Q};K0.prototype.listenerCount=function Y(K){var O=Z0?Z0+K:K,w=this._events[O];if(!w)return 0;if(w.fn)return 1;return w.length};K0.prototype.emit=function Y(K,O,w,G,J,Q){var Z=Z0?Z0+K:K;if(!this._events[Z])return!1;var W=this._events[Z],X=arguments.length,U,D;if(W.fn){if(W.once)this.removeListener(K,W.fn,void 0,!0);switch(X){case 1:return W.fn.call(W.context),!0;case 2:return W.fn.call(W.context,O),!0;case 3:return W.fn.call(W.context,O,w),!0;case 4:return W.fn.call(W.context,O,w,G),!0;case 5:return W.fn.call(W.context,O,w,G,J),!0;case 6:return W.fn.call(W.context,O,w,G,J,Q),!0}for(D=1,U=new Array(X-1);D<X;D++)U[D-1]=arguments[D];W.fn.apply(W.context,U)}else{var V=W.length,q;for(D=0;D<V;D++){if(W[D].once)this.removeListener(K,W[D].fn,void 0,!0);switch(X){case 1:W[D].fn.call(W[D].context);break;case 2:W[D].fn.call(W[D].context,O);break;case 3:W[D].fn.call(W[D].context,O,w);break;case 4:W[D].fn.call(W[D].context,O,w,G);break;default:if(!U)for(q=1,U=new Array(X-1);q<X;q++)U[q-1]=arguments[q];W[D].fn.apply(W[D].context,U)}}}return!0};K0.prototype.on=function Y(K,O,w){return sO(this,K,O,w,!1)};K0.prototype.once=function Y(K,O,w){return sO(this,K,O,w,!0)};K0.prototype.removeListener=function Y(K,O,w,G){var J=Z0?Z0+K:K;if(!this._events[J])return this;if(!O)return YO(this,J),this;var Q=this._events[J];if(Q.fn){if(Q.fn===O&&(!G||Q.once)&&(!w||Q.context===w))YO(this,J)}else{for(var Z=0,W=[],X=Q.length;Z<X;Z++)if(Q[Z].fn!==O||G&&!Q[Z].once||w&&Q[Z].context!==w)W.push(Q[Z]);if(W.length)this._events[J]=W.length===1?W[0]:W;else YO(this,J)}return this};K0.prototype.removeAllListeners=function Y(K){var O;if(K){if(O=Z0?Z0+K:K,this._events[O])YO(this,O)}else this._events=new d0,this._eventsCount=0;return this};K0.prototype.off=K0.prototype.removeListener;K0.prototype.addListener=K0.prototype.on;K0.prefixed=Z0;K0.EventEmitter=K0;if(typeof qO!=="undefined")qO.exports=K0});var f1={};ew(f1,{Flv:()=>wO});function oO(Y,K){var O=Object.keys(Y);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(Y);K&&(w=w.filter(function(G){return Object.getOwnPropertyDescriptor(Y,G).enumerable})),O.push.apply(O,w)}return O}function H0(Y){for(var K=1;K<arguments.length;K++){var O=arguments[K]!=null?arguments[K]:{};K%2?oO(Object(O),!0).forEach(function(w){y(Y,w,O[w])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Y,Object.getOwnPropertyDescriptors(O)):oO(Object(O)).forEach(function(w){Object.defineProperty(Y,w,Object.getOwnPropertyDescriptor(O,w))})}return Y}function k(){k=function(){return Y};var Y={},K=Object.prototype,O=K.hasOwnProperty,w=Object.defineProperty||function(H,A,N){H[A]=N.value},G=typeof Symbol=="function"?Symbol:{},J=G.iterator||"@@iterator",Q=G.asyncIterator||"@@asyncIterator",Z=G.toStringTag||"@@toStringTag";function W(H,A,N){return Object.defineProperty(H,A,{value:N,enumerable:!0,configurable:!0,writable:!0}),H[A]}try{W({},"")}catch(H){W=function(A,N,B){return A[N]=B}}function X(H,A,N,B){var j=A&&A.prototype instanceof V?A:V,$=Object.create(j.prototype),T=new P(B||[]);return w($,"_invoke",{value:R(H,N,T)}),$}function U(H,A,N){try{return{type:"normal",arg:H.call(A,N)}}catch(B){return{type:"throw",arg:B}}}Y.wrap=X;var D={};function V(){}function q(){}function L(){}var z={};W(z,J,function(){return this});var I=Object.getPrototypeOf,E=I&&I(I(l([])));E&&E!==K&&O.call(E,J)&&(z=E);var S=L.prototype=V.prototype=Object.create(z);function x(H){["next","throw","return"].forEach(function(A){W(H,A,function(N){return this._invoke(A,N)})})}function C(H,A){function N(j,$,T,n){var o=U(H[j],H,$);if(o.type!=="throw"){var i=o.arg,w0=i.value;return w0&&typeof w0=="object"&&O.call(w0,"__await")?A.resolve(w0.__await).then(function(d){N("next",d,T,n)},function(d){N("throw",d,T,n)}):A.resolve(w0).then(function(d){i.value=d,T(i)},function(d){return N("throw",d,T,n)})}n(o.arg)}var B;w(this,"_invoke",{value:function(j,$){function T(){return new A(function(n,o){N(j,$,n,o)})}return B=B?B.then(T,T):T()}})}function R(H,A,N){var B="suspendedStart";return function(j,$){if(B==="executing")throw new Error("Generator is already running");if(B==="completed"){if(j==="throw")throw $;return Y0()}for(N.method=j,N.arg=$;;){var T=N.delegate;if(T){var n=v(T,N);if(n){if(n===D)continue;return n}}if(N.method==="next")N.sent=N._sent=N.arg;else if(N.method==="throw"){if(B==="suspendedStart")throw B="completed",N.arg;N.dispatchException(N.arg)}else N.method==="return"&&N.abrupt("return",N.arg);B="executing";var o=U(H,A,N);if(o.type==="normal"){if(B=N.done?"completed":"suspendedYield",o.arg===D)continue;return{value:o.arg,done:N.done}}o.type==="throw"&&(B="completed",N.method="throw",N.arg=o.arg)}}}function v(H,A){var N=A.method,B=H.iterator[N];if(B===void 0)return A.delegate=null,N==="throw"&&H.iterator.return&&(A.method="return",A.arg=void 0,v(H,A),A.method==="throw")||N!=="return"&&(A.method="throw",A.arg=new TypeError("The iterator does not provide a '"+N+"' method")),D;var j=U(B,H.iterator,A.arg);if(j.type==="throw")return A.method="throw",A.arg=j.arg,A.delegate=null,D;var $=j.arg;return $?$.done?(A[H.resultName]=$.value,A.next=H.nextLoc,A.method!=="return"&&(A.method="next",A.arg=void 0),A.delegate=null,D):$:(A.method="throw",A.arg=new TypeError("iterator result is not an object"),A.delegate=null,D)}function _(H){var A={tryLoc:H[0]};1 in H&&(A.catchLoc=H[1]),2 in H&&(A.finallyLoc=H[2],A.afterLoc=H[3]),this.tryEntries.push(A)}function t(H){var A=H.completion||{};A.type="normal",delete A.arg,H.completion=A}function P(H){this.tryEntries=[{tryLoc:"root"}],H.forEach(_,this),this.reset(!0)}function l(H){if(H){var A=H[J];if(A)return A.call(H);if(typeof H.next=="function")return H;if(!isNaN(H.length)){var N=-1,B=function j(){for(;++N<H.length;)if(O.call(H,N))return j.value=H[N],j.done=!1,j;return j.value=void 0,j.done=!0,j};return B.next=B}}return{next:Y0}}function Y0(){return{value:void 0,done:!0}}return q.prototype=L,w(S,"constructor",{value:L,configurable:!0}),w(L,"constructor",{value:q,configurable:!0}),q.displayName=W(L,Z,"GeneratorFunction"),Y.isGeneratorFunction=function(H){var A=typeof H=="function"&&H.constructor;return!!A&&(A===q||(A.displayName||A.name)==="GeneratorFunction")},Y.mark=function(H){return Object.setPrototypeOf?Object.setPrototypeOf(H,L):(H.__proto__=L,W(H,Z,"GeneratorFunction")),H.prototype=Object.create(S),H},Y.awrap=function(H){return{__await:H}},x(C.prototype),W(C.prototype,Q,function(){return this}),Y.AsyncIterator=C,Y.async=function(H,A,N,B,j){j===void 0&&(j=Promise);var $=new C(X(H,A,N,B),j);return Y.isGeneratorFunction(A)?$:$.next().then(function(T){return T.done?T.value:$.next()})},x(S),W(S,Z,"Generator"),W(S,J,function(){return this}),W(S,"toString",function(){return"[object Generator]"}),Y.keys=function(H){var A=Object(H),N=[];for(var B in A)N.push(B);return N.reverse(),function j(){for(;N.length;){var $=N.pop();if($ in A)return j.value=$,j.done=!1,j}return j.done=!0,j}},Y.values=l,P.prototype={constructor:P,reset:function(H){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(t),!H)for(var A in this)A.charAt(0)==="t"&&O.call(this,A)&&!isNaN(+A.slice(1))&&(this[A]=void 0)},stop:function(){this.done=!0;var H=this.tryEntries[0].completion;if(H.type==="throw")throw H.arg;return this.rval},dispatchException:function(H){if(this.done)throw H;var A=this;function N(o,i){return $.type="throw",$.arg=H,A.next=o,i&&(A.method="next",A.arg=void 0),!!i}for(var B=this.tryEntries.length-1;B>=0;--B){var j=this.tryEntries[B],$=j.completion;if(j.tryLoc==="root")return N("end");if(j.tryLoc<=this.prev){var T=O.call(j,"catchLoc"),n=O.call(j,"finallyLoc");if(T&&n){if(this.prev<j.catchLoc)return N(j.catchLoc,!0);if(this.prev<j.finallyLoc)return N(j.finallyLoc)}else if(T){if(this.prev<j.catchLoc)return N(j.catchLoc,!0)}else{if(!n)throw new Error("try statement without catch or finally");if(this.prev<j.finallyLoc)return N(j.finallyLoc)}}}},abrupt:function(H,A){for(var N=this.tryEntries.length-1;N>=0;--N){var B=this.tryEntries[N];if(B.tryLoc<=this.prev&&O.call(B,"finallyLoc")&&this.prev<B.finallyLoc){var j=B;break}}j&&(H==="break"||H==="continue")&&j.tryLoc<=A&&A<=j.finallyLoc&&(j=null);var $=j?j.completion:{};return $.type=H,$.arg=A,j?(this.method="next",this.next=j.finallyLoc,D):this.complete($)},complete:function(H,A){if(H.type==="throw")throw H.arg;return H.type==="break"||H.type==="continue"?this.next=H.arg:H.type==="return"?(this.rval=this.arg=H.arg,this.method="return",this.next="end"):H.type==="normal"&&A&&(this.next=A),D},finish:function(H){for(var A=this.tryEntries.length-1;A>=0;--A){var N=this.tryEntries[A];if(N.finallyLoc===H)return this.complete(N.completion,N.afterLoc),t(N),D}},catch:function(H){for(var A=this.tryEntries.length-1;A>=0;--A){var N=this.tryEntries[A];if(N.tryLoc===H){var B=N.completion;if(B.type==="throw"){var j=B.arg;t(N)}return j}}throw new Error("illegal catch attempt")},delegateYield:function(H,A,N){return this.delegate={iterator:l(H),resultName:A,nextLoc:N},this.method==="next"&&(this.arg=void 0),D}},Y}function dO(Y,K,O,w,G,J,Q){try{var Z=Y[J](Q),W=Z.value}catch(X){O(X);return}if(Z.done)K(W);else Promise.resolve(W).then(w,G)}function O0(Y){return function(){var K=this,O=arguments;return new Promise(function(w,G){var J=Y.apply(K,O);function Q(W){dO(J,w,G,Q,Z,"next",W)}function Z(W){dO(J,w,G,Q,Z,"throw",W)}Q(void 0)})}}function h0(Y,K){if(!(Y instanceof K))throw new TypeError("Cannot call a class as a function")}function cO(Y,K){for(var O=0;O<K.length;O++){var w=K[O];if(w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w)w.writable=!0;Object.defineProperty(Y,iO(w.key),w)}}function x0(Y,K,O){if(K)cO(Y.prototype,K);if(O)cO(Y,O);return Object.defineProperty(Y,"prototype",{writable:!1}),Y}function y(Y,K,O){if(K=iO(K),K in Y)Object.defineProperty(Y,K,{value:O,enumerable:!0,configurable:!0,writable:!0});else Y[K]=O;return Y}function rO(Y,K){if(typeof K!=="function"&&K!==null)throw new TypeError("Super expression must either be null or a function");if(Y.prototype=Object.create(K&&K.prototype,{constructor:{value:Y,writable:!0,configurable:!0}}),Object.defineProperty(Y,"prototype",{writable:!1}),K)VO(Y,K)}function GO(Y){return GO=Object.setPrototypeOf?Object.getPrototypeOf.bind():function K(O){return O.__proto__||Object.getPrototypeOf(O)},GO(Y)}function VO(Y,K){return VO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function O(w,G){return w.__proto__=G,w},VO(Y,K)}function O1(){if(typeof Reflect==="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy==="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(Y){return!1}}function p(Y){if(Y===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Y}function w1(Y,K){if(K&&(typeof K==="object"||typeof K==="function"))return K;else if(K!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return p(Y)}function _O(Y){var K=O1();return function O(){var w=GO(Y),G;if(K){var J=GO(this).constructor;G=Reflect.construct(w,arguments,J)}else G=w.apply(this,arguments);return w1(this,G)}}function G1(Y,K){if(typeof Y!=="object"||Y===null)return Y;var O=Y[Symbol.toPrimitive];if(O!==void 0){var w=O.call(Y,K||"default");if(typeof w!=="object")return w;throw new TypeError("@@toPrimitive must return a primitive value.")}return(K==="string"?String:Number)(Y)}function iO(Y){var K=G1(Y,"string");return typeof K==="symbol"?K:String(K)}function aO(Y,K){var O=Object.keys(Y);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(Y);K&&(w=w.filter(function(G){return Object.getOwnPropertyDescriptor(Y,G).enumerable})),O.push.apply(O,w)}return O}function M0(Y){for(var K=1;K<arguments.length;K++){var O=arguments[K]!=null?arguments[K]:{};K%2?aO(Object(O),!0).forEach(function(w){F(Y,w,O[w])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Y,Object.getOwnPropertyDescriptors(O)):aO(Object(O)).forEach(function(w){Object.defineProperty(Y,w,Object.getOwnPropertyDescriptor(O,w))})}return Y}function a(){a=function(){return Y};var Y={},K=Object.prototype,O=K.hasOwnProperty,w=Object.defineProperty||function(H,A,N){H[A]=N.value},G=typeof Symbol=="function"?Symbol:{},J=G.iterator||"@@iterator",Q=G.asyncIterator||"@@asyncIterator",Z=G.toStringTag||"@@toStringTag";function W(H,A,N){return Object.defineProperty(H,A,{value:N,enumerable:!0,configurable:!0,writable:!0}),H[A]}try{W({},"")}catch(H){W=function(A,N,B){return A[N]=B}}function X(H,A,N,B){var j=A&&A.prototype instanceof V?A:V,$=Object.create(j.prototype),T=new P(B||[]);return w($,"_invoke",{value:R(H,N,T)}),$}function U(H,A,N){try{return{type:"normal",arg:H.call(A,N)}}catch(B){return{type:"throw",arg:B}}}Y.wrap=X;var D={};function V(){}function q(){}function L(){}var z={};W(z,J,function(){return this});var I=Object.getPrototypeOf,E=I&&I(I(l([])));E&&E!==K&&O.call(E,J)&&(z=E);var S=L.prototype=V.prototype=Object.create(z);function x(H){["next","throw","return"].forEach(function(A){W(H,A,function(N){return this._invoke(A,N)})})}function C(H,A){function N(j,$,T,n){var o=U(H[j],H,$);if(o.type!=="throw"){var i=o.arg,w0=i.value;return w0&&typeof w0=="object"&&O.call(w0,"__await")?A.resolve(w0.__await).then(function(d){N("next",d,T,n)},function(d){N("throw",d,T,n)}):A.resolve(w0).then(function(d){i.value=d,T(i)},function(d){return N("throw",d,T,n)})}n(o.arg)}var B;w(this,"_invoke",{value:function(j,$){function T(){return new A(function(n,o){N(j,$,n,o)})}return B=B?B.then(T,T):T()}})}function R(H,A,N){var B="suspendedStart";return function(j,$){if(B==="executing")throw new Error("Generator is already running");if(B==="completed"){if(j==="throw")throw $;return Y0()}for(N.method=j,N.arg=$;;){var T=N.delegate;if(T){var n=v(T,N);if(n){if(n===D)continue;return n}}if(N.method==="next")N.sent=N._sent=N.arg;else if(N.method==="throw"){if(B==="suspendedStart")throw B="completed",N.arg;N.dispatchException(N.arg)}else N.method==="return"&&N.abrupt("return",N.arg);B="executing";var o=U(H,A,N);if(o.type==="normal"){if(B=N.done?"completed":"suspendedYield",o.arg===D)continue;return{value:o.arg,done:N.done}}o.type==="throw"&&(B="completed",N.method="throw",N.arg=o.arg)}}}function v(H,A){var N=A.method,B=H.iterator[N];if(B===void 0)return A.delegate=null,N==="throw"&&H.iterator.return&&(A.method="return",A.arg=void 0,v(H,A),A.method==="throw")||N!=="return"&&(A.method="throw",A.arg=new TypeError("The iterator does not provide a '"+N+"' method")),D;var j=U(B,H.iterator,A.arg);if(j.type==="throw")return A.method="throw",A.arg=j.arg,A.delegate=null,D;var $=j.arg;return $?$.done?(A[H.resultName]=$.value,A.next=H.nextLoc,A.method!=="return"&&(A.method="next",A.arg=void 0),A.delegate=null,D):$:(A.method="throw",A.arg=new TypeError("iterator result is not an object"),A.delegate=null,D)}function _(H){var A={tryLoc:H[0]};1 in H&&(A.catchLoc=H[1]),2 in H&&(A.finallyLoc=H[2],A.afterLoc=H[3]),this.tryEntries.push(A)}function t(H){var A=H.completion||{};A.type="normal",delete A.arg,H.completion=A}function P(H){this.tryEntries=[{tryLoc:"root"}],H.forEach(_,this),this.reset(!0)}function l(H){if(H){var A=H[J];if(A)return A.call(H);if(typeof H.next=="function")return H;if(!isNaN(H.length)){var N=-1,B=function j(){for(;++N<H.length;)if(O.call(H,N))return j.value=H[N],j.done=!1,j;return j.value=void 0,j.done=!0,j};return B.next=B}}return{next:Y0}}function Y0(){return{value:void 0,done:!0}}return q.prototype=L,w(S,"constructor",{value:L,configurable:!0}),w(L,"constructor",{value:q,configurable:!0}),q.displayName=W(L,Z,"GeneratorFunction"),Y.isGeneratorFunction=function(H){var A=typeof H=="function"&&H.constructor;return!!A&&(A===q||(A.displayName||A.name)==="GeneratorFunction")},Y.mark=function(H){return Object.setPrototypeOf?Object.setPrototypeOf(H,L):(H.__proto__=L,W(H,Z,"GeneratorFunction")),H.prototype=Object.create(S),H},Y.awrap=function(H){return{__await:H}},x(C.prototype),W(C.prototype,Q,function(){return this}),Y.AsyncIterator=C,Y.async=function(H,A,N,B,j){j===void 0&&(j=Promise);var $=new C(X(H,A,N,B),j);return Y.isGeneratorFunction(A)?$:$.next().then(function(T){return T.done?T.value:$.next()})},x(S),W(S,Z,"Generator"),W(S,J,function(){return this}),W(S,"toString",function(){return"[object Generator]"}),Y.keys=function(H){var A=Object(H),N=[];for(var B in A)N.push(B);return N.reverse(),function j(){for(;N.length;){var $=N.pop();if($ in A)return j.value=$,j.done=!1,j}return j.done=!0,j}},Y.values=l,P.prototype={constructor:P,reset:function(H){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(t),!H)for(var A in this)A.charAt(0)==="t"&&O.call(this,A)&&!isNaN(+A.slice(1))&&(this[A]=void 0)},stop:function(){this.done=!0;var H=this.tryEntries[0].completion;if(H.type==="throw")throw H.arg;return this.rval},dispatchException:function(H){if(this.done)throw H;var A=this;function N(o,i){return $.type="throw",$.arg=H,A.next=o,i&&(A.method="next",A.arg=void 0),!!i}for(var B=this.tryEntries.length-1;B>=0;--B){var j=this.tryEntries[B],$=j.completion;if(j.tryLoc==="root")return N("end");if(j.tryLoc<=this.prev){var T=O.call(j,"catchLoc"),n=O.call(j,"finallyLoc");if(T&&n){if(this.prev<j.catchLoc)return N(j.catchLoc,!0);if(this.prev<j.finallyLoc)return N(j.finallyLoc)}else if(T){if(this.prev<j.catchLoc)return N(j.catchLoc,!0)}else{if(!n)throw new Error("try statement without catch or finally");if(this.prev<j.finallyLoc)return N(j.finallyLoc)}}}},abrupt:function(H,A){for(var N=this.tryEntries.length-1;N>=0;--N){var B=this.tryEntries[N];if(B.tryLoc<=this.prev&&O.call(B,"finallyLoc")&&this.prev<B.finallyLoc){var j=B;break}}j&&(H==="break"||H==="continue")&&j.tryLoc<=A&&A<=j.finallyLoc&&(j=null);var $=j?j.completion:{};return $.type=H,$.arg=A,j?(this.method="next",this.next=j.finallyLoc,D):this.complete($)},complete:function(H,A){if(H.type==="throw")throw H.arg;return H.type==="break"||H.type==="continue"?this.next=H.arg:H.type==="return"?(this.rval=this.arg=H.arg,this.method="return",this.next="end"):H.type==="normal"&&A&&(this.next=A),D},finish:function(H){for(var A=this.tryEntries.length-1;A>=0;--A){var N=this.tryEntries[A];if(N.finallyLoc===H)return this.complete(N.completion,N.afterLoc),t(N),D}},catch:function(H){for(var A=this.tryEntries.length-1;A>=0;--A){var N=this.tryEntries[A];if(N.tryLoc===H){var B=N.completion;if(B.type==="throw"){var j=B.arg;t(N)}return j}}throw new Error("illegal catch attempt")},delegateYield:function(H,A,N){return this.delegate={iterator:l(H),resultName:A,nextLoc:N},this.method==="next"&&(this.arg=void 0),D}},Y}function z0(Y){return z0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(K){return typeof K}:function(K){return K&&typeof Symbol=="function"&&K.constructor===Symbol&&K!==Symbol.prototype?"symbol":typeof K},z0(Y)}function tO(Y,K,O,w,G,J,Q){try{var Z=Y[J](Q),W=Z.value}catch(X){O(X);return}if(Z.done)K(W);else Promise.resolve(W).then(w,G)}function U0(Y){return function(){var K=this,O=arguments;return new Promise(function(w,G){var J=Y.apply(K,O);function Q(W){tO(J,w,G,Q,Z,"next",W)}function Z(W){tO(J,w,G,Q,Z,"throw",W)}Q(void 0)})}}function c(Y,K){if(!(Y instanceof K))throw new TypeError("Cannot call a class as a function")}function eO(Y,K){for(var O=0;O<K.length;O++){var w=K[O];if(w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w)w.writable=!0;Object.defineProperty(Y,Jw(w.key),w)}}function r(Y,K,O){if(K)eO(Y.prototype,K);if(O)eO(Y,O);return Object.defineProperty(Y,"prototype",{writable:!1}),Y}function F(Y,K,O){if(K=Jw(K),K in Y)Object.defineProperty(Y,K,{value:O,enumerable:!0,configurable:!0,writable:!0});else Y[K]=O;return Y}function V0(Y,K){if(typeof K!=="function"&&K!==null)throw new TypeError("Super expression must either be null or a function");if(Y.prototype=Object.create(K&&K.prototype,{constructor:{value:Y,writable:!0,configurable:!0}}),Object.defineProperty(Y,"prototype",{writable:!1}),K)r0(Y,K)}function v0(Y){return v0=Object.setPrototypeOf?Object.getPrototypeOf.bind():function K(O){return O.__proto__||Object.getPrototypeOf(O)},v0(Y)}function r0(Y,K){return r0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function O(w,G){return w.__proto__=G,w},r0(Y,K)}function ww(){if(typeof Reflect==="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy==="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(Y){return!1}}function JO(Y,K,O){if(ww())JO=Reflect.construct.bind();else JO=function w(G,J,Q){var Z=[null];Z.push.apply(Z,J);var W=Function.bind.apply(G,Z),X=new W;if(Q)r0(X,Q.prototype);return X};return JO.apply(null,arguments)}function K1(Y){return Function.toString.call(Y).indexOf("[native code]")!==-1}function T0(Y){var K=typeof Map==="function"?new Map:void 0;return T0=function O(w){if(w===null||!K1(w))return w;if(typeof w!=="function")throw new TypeError("Super expression must either be null or a function");if(typeof K!=="undefined"){if(K.has(w))return K.get(w);K.set(w,G)}function G(){return JO(w,arguments,v0(this).constructor)}return G.prototype=Object.create(w.prototype,{constructor:{value:G,enumerable:!1,writable:!0,configurable:!0}}),r0(G,w)},T0(Y)}function Q1(Y,K){if(Y==null)return{};var O={},w=Object.keys(Y),G,J;for(J=0;J<w.length;J++){if(G=w[J],K.indexOf(G)>=0)continue;O[G]=Y[G]}return O}function Gw(Y,K){if(Y==null)return{};var O=Q1(Y,K),w,G;if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols(Y);for(G=0;G<J.length;G++){if(w=J[G],K.indexOf(w)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(Y,w))continue;O[w]=Y[w]}}return O}function M(Y){if(Y===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Y}function Z1(Y,K){if(K&&(typeof K==="object"||typeof K==="function"))return K;else if(K!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return M(Y)}function q0(Y){var K=ww();return function O(){var w=v0(Y),G;if(K){var J=v0(this).constructor;G=Reflect.construct(w,arguments,J)}else G=w.apply(this,arguments);return Z1(this,G)}}function W1(Y,K){while(!Object.prototype.hasOwnProperty.call(Y,K))if(Y=v0(Y),Y===null)break;return Y}function c0(){if(typeof Reflect!=="undefined"&&Reflect.get)c0=Reflect.get.bind();else c0=function Y(K,O,w){var G=W1(K,O);if(!G)return;var J=Object.getOwnPropertyDescriptor(G,O);if(J.get)return J.get.call(arguments.length<3?K:w);return J.value};return c0.apply(this,arguments)}function X1(Y,K){if(!Y)return;if(typeof Y==="string")return Ow(Y,K);var O=Object.prototype.toString.call(Y).slice(8,-1);if(O==="Object"&&Y.constructor)O=Y.constructor.name;if(O==="Map"||O==="Set")return Array.from(Y);if(O==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(O))return Ow(Y,K)}function Ow(Y,K){if(K==null||K>Y.length)K=Y.length;for(var O=0,w=new Array(K);O<K;O++)w[O]=Y[O];return w}function Yw(Y,K){var O=typeof Symbol!=="undefined"&&Y[Symbol.iterator]||Y["@@iterator"];if(!O){if(Array.isArray(Y)||(O=X1(Y))||K&&Y&&typeof Y.length==="number"){if(O)Y=O;var w=0,G=function(){};return{s:G,n:function(){if(w>=Y.length)return{done:!0};return{done:!1,value:Y[w++]}},e:function(W){throw W},f:G}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var J=!0,Q=!1,Z;return{s:function(){O=O.call(Y)},n:function(){var W=O.next();return J=W.done,W},e:function(W){Q=!0,Z=W},f:function(){try{if(!J&&O.return!=null)O.return()}finally{if(Q)throw Z}}}}function U1(Y,K){if(typeof Y!=="object"||Y===null)return Y;var O=Y[Symbol.toPrimitive];if(O!==void 0){var w=O.call(Y,K||"default");if(typeof w!=="object")return w;throw new TypeError("@@toPrimitive must return a primitive value.")}return(K==="string"?String:Number)(Y)}function Jw(Y){var K=U1(Y,"string");return typeof K==="symbol"?K:String(K)}var e=function(){function Y(){c(this,Y)}return r(Y,null,[{key:"start",value:function K(O){if(!O||!O.length)return 0;if(O.length===1&&O.end(0)-O.start(0)<0.000001)return 0;if(O.length===1&&O.start(0)<0)return 0;return O.start(0)}},{key:"end",value:function K(O){if(!O||!O.length)return 0;if(O.length===1&&O.end(0)-O.start(0)<0.000001)return 0;return O.end(O.length-1)}},{key:"get",value:function K(O){if(!O)return;try{return O.buffered}catch(w){}}},{key:"buffers",value:function K(O,w){if(!O||!O.length)return[];var G=[];for(var J=0,Q=O.length;J<Q;J++){var Z=G.length;if(!Z||!w)G.push([O.start(J),O.end(J)]);else{var W=G[Z-1],X=W[1],U=O.start(J);if(U-X<=w){var D=O.end(J);if(D>X)W[1]=D}else G.push([O.start(J),O.end(J)])}}return G}},{key:"totalLength",value:function K(O){if(!O||!O.length)return 0;return O.reduce(function(w,G){return w+=G[1]-G[0]},0)}},{key:"info",value:function K(O){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(!O||!O.length)return{start:0,end:0,buffers:[]};var J=0,Q=0,Z=0,W=0,X=0,U=0,D=0,V=Y.buffers(O,G);for(var q=0,L=V.length;q<L;q++){var z=V[q];if(w+G>=z[0]&&w<=z[1])J=z[0],Q=z[1],Z=q;else if(w+G<z[0]){W=z[0],X=z[1];break}else if(w+G>z[1])U=z[0],D=z[1]}return{start:J,end:Q,index:Z,buffers:V,nextStart:W,nextEnd:X,prevStart:U,prevEnd:D,currentTime:w,behind:w-J,remaining:Q?Q-w:0,length:Y.totalLength&&Y.totalLength(V)}}},{key:"isBuffered",value:function K(O,w){if(O){var G=Y.get(O);if(G!==null&&G!==void 0&&G.length){for(var J=0;J<G.length;J++)if(w>=G.start(J)&&w<=G.end(J))return!0}}return!1}}]),Y}();var Kw=typeof window!=="undefined";var X0,m={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",NETWORK_FORBIDDEN:"network_forbidden",NETWORK_NOTFOUND:"network_notfound",NETWROK_RANGE_NOT_SATISFIABLE:"network_range_not_satisfiable",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",RUNTIME:"runtime",SUB_TYPES:{FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",MSE_CHANGE_TYPE:"MSE_CHANGE_TYPE",OPTION:"OPTION",DASH:"DASH",LICENSE:"LICENSE",CUSTOM_LICENSE:"CUSTOM_LICENSE",MSE_HIJACK:"MSE_HIJACK",EME_HIJACK:"EME_HIJACK",SIDX:"SIDX",NO_CANPLAY_ERROR:"NO_CANPLAY_ERROR",BUFFERBREAK_ERROR:"BUFFERBREAK_ERROR",WAITING_TIMEOUT_ERROR:"WAITING_TIMEOUT_ERROR",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_CODEC_NOT_SUPPORTED:"MEDIA_ERR_CODEC_NOT_SUPPORTED",MEDIA_ERR_URL_EMPTY:"MEDIA_ERR_URL_EMPTY"}},KO=(X0={},F(X0,m.MANIFEST,{HLS:1100,DASH:1200}),F(X0,m.NETWORK,2100),F(X0,m.NETWORK_TIMEOUT,2101),F(X0,m.NETWORK_FORBIDDEN,2103),F(X0,m.NETWORK_NOTFOUND,2104),F(X0,m.NETWROK_RANGE_NOT_SATISFIABLE,2116),F(X0,m.DEMUX,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),F(X0,m.REMUX,{FMP4:4100,MP4:4200}),F(X0,m.MEDIA,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,MSE_CHANGE_TYPE:5205,EME_HIJACK:5301}),F(X0,m.DRM,{LICENSE:7100,CUSTOM_LICENSE:7200}),F(X0,m.OTHER,8000),F(X0,m.RUNTIME,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003}),X0),Q0=function(Y){V0(O,Y);var K=q0(O);function O(w,G,J,Q,Z){var W;if(c(this,O),W=K.call(this,Z||(J===null||J===void 0?void 0:J.message)),W.errorType=w===m.NETWORK_TIMEOUT?m.NETWORK:w,W.originError=J,W.ext=Q,W.errorCode=KO[w][G]||KO[w],W.errorMessage=W.message,!W.errorCode)W.errorType=m.OTHER,W.errorCode=KO[W.errorType];return W}return r(O,null,[{key:"create",value:function w(G,J,Q,Z,W){if(G instanceof O)return G;else if(G instanceof Error)Q=G,G="";if(!G)G=m.OTHER;return new O(G,J,Q,Z,W)}},{key:"network",value:function w(G){var J;return new O(G!==null&&G!==void 0&&G.isTimeout?m.NETWORK_TIMEOUT:m.NETWORK,null,G instanceof Error?G:null,{url:G===null||G===void 0?void 0:G.url,response:G===null||G===void 0?void 0:G.response,httpCode:G===null||G===void 0?void 0:(J=G.response)===null||J===void 0?void 0:J.status})}}]),O}(T0(Error));var i0={DEBUG:1,LOG:2,WARN:3,ERROR:4},D1=204800,A1=["Boolean","Number","String","Undefined","Null","Date","Object"],D0=function(){function Y(K,O){c(this,Y),this.name=K||"",this._prefix="[".concat(this.name,"]"),this.logCacheLevel=(O===null||O===void 0?void 0:O.logCacheLevel)||3,this.logMaxSize=(O===null||O===void 0?void 0:O.logMaxSize)||D1,this.logSize=0,this.logTextArray=[]}return r(Y,[{key:"debug",value:function K(){var O;for(var w=arguments.length,G=new Array(w),J=0;J<w;J++)G[J]=arguments[J];if(this.logCache.apply(this,[i0.DEBUG].concat(G)),Y.disabled)return;(O=console).debug.apply(O,["[".concat(_0(),"]"),this._prefix].concat(G))}},{key:"log",value:function K(){var O;for(var w=arguments.length,G=new Array(w),J=0;J<w;J++)G[J]=arguments[J];if(this.logCache.apply(this,[i0.LOG].concat(G)),Y.disabled)return;(O=console).log.apply(O,["[".concat(_0(),"]"),this._prefix].concat(G))}},{key:"warn",value:function K(){var O;for(var w=arguments.length,G=new Array(w),J=0;J<w;J++)G[J]=arguments[J];if(this.logCache.apply(this,[i0.WARN].concat(G)),Y.disabled)return;(O=console).warn.apply(O,["[".concat(_0(),"]"),this._prefix].concat(G))}},{key:"error",value:function K(){var O;for(var w=arguments.length,G=new Array(w),J=0;J<w;J++)G[J]=arguments[J];if(this.logCache.apply(this,[i0.ERROR].concat(G)),Y.disabled)return;(O=console).error.apply(O,["[".concat(_0(),"]"),this._prefix].concat(G))}},{key:"logCache",value:function K(O){if(O<this.logCacheLevel)return;var w="";try{for(var G=arguments.length,J=new Array(G>1?G-1:0),Q=1;Q<G;Q++)J[Q-1]=arguments[Q];var Z=J.map(function(X){return Qw(X)});w="[".concat(_0(),"]")+this._prefix+JSON.stringify(Z)}catch(X){return}if(O>=this.logCacheLevel)this.logSize+=w.length,this.logTextArray.push(w);if(this.logSize>this.logMaxSize){var W=this.logTextArray.shift();this.logSize-=W.length}}},{key:"getLogCache",value:function K(){var O=this.logTextArray.join(`
3
- `);return this.reset(),O}},{key:"reset",value:function K(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function K(){var O;if(Y.disabled)return;console.group(this._prefix),(O=console).table.apply(O,arguments),console.groupEnd()}},{key:"setLogLevel",value:function K(O){this.logCacheLevel=O}}],[{key:"enable",value:function K(){Y.disabled=!1}},{key:"disable",value:function K(){Y.disabled=!0}}]),Y}();F(D0,"disabled",!0);function _0(){return new Date().toLocaleString()}function H1(Y){if(z0(Y)!=="object")return Y;var K=Object.prototype.toString.call(Y).slice(8,-1);switch(K){case"Array":case"Uint8Array":case"ArrayBuffer":return K+"["+Y.length+"]";case"Object":return"{}";default:return K}}function Qw(Y,K,O){if(!O)O=1;if(!K)K=2;var w={};if(!Y||z0(Y)!=="object")return Y;var G=Object.prototype.toString.call(Y).slice(8,-1);if(!A1.includes(G))return G;if(O>K)return;for(var J in Y)if(Object.prototype.hasOwnProperty.call(Y,J))if(O===K)w[J]=H1(Y[J]);else if(z0(Y[J])==="object")w[J]=Qw(Y[J],K,O+1);else w[J]=Y[J];return w}function y0(){var Y,K,O=new Promise(function(w,G){Y=w,K=G});return O.used=!1,O.resolve=function(){return O.used=!0,Y.apply(void 0,arguments)},O.reject=function(){return O.used=!0,K.apply(void 0,arguments)},O}function f0(){try{return parseInt(performance.now(),10)}catch(Y){return new Date().getTime()}}var Zw={stringify:function Y(K){try{return JSON.stringify(K)}catch(O){return""}},parse:function Y(K){try{return JSON.parse(K)}catch(O){return}}};function Ww(){var Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;try{if(!Kw)return null;if(Y&&typeof ManagedMediaSource!=="undefined")return ManagedMediaSource;return window.MediaSource}catch(K){}}function FO(Y){return/ManagedMediaSource/gi.test(Object.prototype.toString.call(Y))}function N1(Y){var K=[];if(Y instanceof TimeRanges)for(var O=0;O<Y.length;O++)K.push({start:Y.start(O),end:Y.end(O)});return K}var QO={APPEND:"appendBuffer",REMOVE:"removeBuffer",UPDATE_DURATION:"updateDuration"};var P0=function(){function Y(K,O){var w=this;if(c(this,Y),F(this,"media",null),F(this,"mediaSource",null),F(this,"_openPromise",y0()),F(this,"_queue",Object.create(null)),F(this,"_sourceBuffer",Object.create(null)),F(this,"_mseFullFlag",{}),F(this,"_st",0),F(this,"_opst",0),F(this,"_logger",null),F(this,"_config",null),F(this,"_url",null),F(this,"_onStartStreaming",function(){w._logger.debug("startstreaming")}),F(this,"_onEndStreaming",function(){w._logger.debug("endstreaming")}),F(this,"_onSBUpdateEnd",function(G){var J=w._queue[G];if(J){var Q=J[0];if((Q===null||Q===void 0?void 0:Q.opName)!==QO.UPDATE_DURATION)J.shift();if(Q){var Z,W,X=f0()-w._opst;w._logger.debug("UpdateEnd(".concat(G,"/").concat(Q.opName,")"),Zw.stringify(N1((Z=w._sourceBuffer[G])===null||Z===void 0?void 0:Z.buffered)),X,Q.context),Q.promise.resolve({name:Q.opName,context:Q.context,costtime:X});var U=(W=Q.context)===null||W===void 0?void 0:W.callback;if(U&&typeof U==="function")U(Q.context);w._startQueue(G)}}}),F(this,"_onSBUpdateError",function(G,J){var Q=w._queue[G];if(Q){var Z=Q[0];if(Z)w._logger.error("UpdateError",G,Z.opName,Z.context),Z.promise.reject(new Q0(m.MEDIA,m.SUB_TYPES.MSE_APPEND_BUFFER,J))}}),this._config=Object.assign(Y.getDefaultConfig(),O),K)this.bindMedia(K);if(this._logger=new D0("MSE"),this._config.openLog)D0.enable()}return r(Y,[{key:"isOpened",get:function K(){var O;return((O=this.mediaSource)===null||O===void 0?void 0:O.readyState)==="open"}},{key:"hasOpTasks",get:function K(){var O=this,w=!1;return Object.keys(this._queue).forEach(function(G){var J=O._queue[G];if(Array.isArray(J))w||(w=J.length>0)}),w}},{key:"url",get:function K(){return this._url}},{key:"duration",get:function K(){var O;return((O=this.mediaSource)===null||O===void 0?void 0:O.duration)||-1}},{key:"isEnded",get:function K(){return this.mediaSource?this.mediaSource.readyState==="ended":!1}},{key:"streaming",get:function K(){return FO(this.mediaSource)?this.mediaSource.streaming:!0}},{key:"isFull",value:function K(O){return O?this._mseFullFlag[O]:this._mseFullFlag[Y.VIDEO]}},{key:"updateDuration",value:function K(O){var w=this,G=this.mediaSource&&this.mediaSource.duration>O;if(this.mediaSource&&this.mediaSource.duration>O){var J=0;if(Object.keys(this._sourceBuffer).forEach(function(Q){try{J=Math.max(w.bufferEnd(Q)||0,J)}catch(Z){}}),O<J)return Promise.resolve()}return this._enqueueBlockingOp(function(){if(w.isEnded){w._logger.debug("setDuration but ended");return}if(w.mediaSource)w.mediaSource.duration=O,w._logger.debug("setDuration",O)},QO.UPDATE_DURATION,{isReduceDuration:G})}},{key:"open",value:function K(){var O=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var w=this.mediaSource,G=function J(){var Q=f0()-O._st;O._logger.debug("sourceopen",Q),w.removeEventListener("sourceopen",J),O._openPromise.resolve({costtime:Q})};w.addEventListener("sourceopen",G),this._openPromise=y0()}return this._openPromise}},{key:"bindMedia",value:function(){var K=U0(a().mark(function w(G){var J=this,Q,Z,W,X;return a().wrap(function U(D){while(!0)switch(D.prev=D.next){case 0:if(!(this.mediaSource||this.media)){D.next=3;break}return D.next=3,this.unbindMedia();case 3:if(Q=Ww(this._config.preferMMS),!(!G||!Q)){D.next=6;break}throw new Error("Param media or MediaSource does not exist");case 6:if(this.media=G,Z=this.mediaSource=new Q,W=FO(Z),this._st=f0(),X=function V(){var q=f0()-J._st;J._logger.debug("sourceopen"),Z.removeEventListener("sourceopen",V),URL.revokeObjectURL(G.src),J._openPromise.resolve({costtime:q})},Z.addEventListener("sourceopen",X),W)Z.addEventListener("startstreaming",this._onStartStreaming),Z.addEventListener("endstreaming",this._onEndStreaming);return this._url=URL.createObjectURL(Z),G.src=this._url,G.disableRemotePlayback=W,D.abrupt("return",this._openPromise);case 17:case"end":return D.stop()}},w,this)}));function O(w){return K.apply(this,arguments)}return O}()},{key:"unbindMedia",value:function(){var K=U0(a().mark(function w(){var G=this,J,Q,Z;return a().wrap(function W(X){while(!0)switch(X.prev=X.next){case 0:if(!this._openPromise.used)this._openPromise.resolve();if(J=this.mediaSource,J){if(Object.keys(this._queue).forEach(function(U){var D=G._queue[U];if(D)D.forEach(function(V){var q,L;return(q=V.promise)===null||q===void 0?void 0:(L=q.resolve)===null||L===void 0?void 0:L.call(q)})}),Q=!!this.media&&this.media.readyState>=1,Z=J.readyState==="open",Q&&Z)try{J.endOfStream()}catch(U){}if(Object.keys(this._sourceBuffer).forEach(function(U){try{J.removeSourceBuffer(G._sourceBuffer[U])}catch(D){}}),FO(J))J.removeEventListener("startstreaming",this._onStartStreaming),J.removeEventListener("endstreaming",this._onEndStreaming)}if(this.media){this.media.disableRemotePlayback=!1,this.media.removeAttribute("src");try{this.media.load()}catch(U){}this.media=null}this.mediaSource=null,this._openPromise=y0(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return X.stop()}},w,this)}));function O(){return K.apply(this,arguments)}return O}()},{key:"createSource",value:function K(O,w){if(this._sourceBuffer[O]||!this.mediaSource)return;var G;try{G=this._sourceBuffer[O]=this.mediaSource.addSourceBuffer(w)}catch(J){throw new Q0(m.MEDIA,m.SUB_TYPES.MSE_ADD_SB,J)}G.mimeType=w,G.addEventListener("updateend",this._onSBUpdateEnd.bind(this,O)),G.addEventListener("error",this._onSBUpdateError.bind(this,O))}},{key:"changeType",value:function K(O,w){var G=this,J=this._sourceBuffer[O];if(!this.mediaSource||!J||J.mimeType===w)return Promise.resolve();if(typeof J.changeType!=="function")return Promise.reject(new Q0(m.MEDIA,m.SUB_TYPES.MSE_CHANGE_TYPE,new Error("changeType is not a function")));return this._enqueueOp(O,function(){try{J.changeType(w)}catch(Q){throw new Q0(m.MEDIA,m.SUB_TYPES.MSE_CHANGE_TYPE,Q)}J.mimeType=w,G._onSBUpdateEnd(O)},"changeType",{mimeType:w})}},{key:"createOrChangeSource",value:function K(O,w){return this.createSource(O,w),this.changeType(O,w)}},{key:"append",value:function K(O,w,G){var J=this;if(!w||!w.byteLength)return Promise.resolve();if(!this._sourceBuffer[O])return Promise.resolve();return this._enqueueOp(O,function(){var Q;if(!J.mediaSource||J.media.error)return;J._logger.debug("MSE APPEND START",G),J._opst=f0(),(Q=J._sourceBuffer[O])===null||Q===void 0||Q.appendBuffer(w)},QO.APPEND,G)}},{key:"remove",value:function K(O,w,G,J){var Q=this,Z=!1;if(this._mseFullFlag[O])Z=!0;return this._enqueueOp(O,function(){if(!Q.mediaSource||Q.media.error)return;var W=Q._sourceBuffer[O];if(w>=G||!W){Q._onSBUpdateEnd(O);return}Q._opst=f0(),Q._logger.debug("MSE REMOVE START",O,w,G,J),W.remove(w,G)},QO.REMOVE,J,Z)}},{key:"clearBuffer",value:function K(O,w){var G=this,J;return Object.keys(this._sourceBuffer).forEach(function(Q){J=G.remove(Q,O,w)}),J||Promise.resolve()}},{key:"clearAllBuffer",value:function K(){var O=this,w;return Object.keys(this._sourceBuffer).forEach(function(G){var J=O._sourceBuffer[G];w=O.remove(G,0,e.end(e.get(J)))}),w}},{key:"clearOpQueues",value:function K(O,w){var G;this._logger.debug("MSE clearOpQueue START");var J=this._queue[O];if(w&&J){this._queue[O]=[];return}if(!J||!J[O]||J.length<5)return;var Q=[];J.forEach(function(Z){if(Z.context&&Z.context.isinit)Q.push(Z)}),this._queue[O]=J.slice(0,2),Q.length>0&&(G=this._queue[O]).push.apply(G,Q)}},{key:"endOfStream",value:function K(O){var w=this;if(!this.mediaSource||this.mediaSource.readyState!=="open")return Promise.resolve();return this._enqueueBlockingOp(function(){var G=w.mediaSource;if(!G||G.readyState!=="open")return;if(w._logger.debug("MSE endOfStream START"),O)G.endOfStream(O);else G.endOfStream()},"endOfStream")}},{key:"setLiveSeekableRange",value:function K(O,w){var G=this.mediaSource;if(O<0||w<O||!(G!==null&&G!==void 0&&G.setLiveSeekableRange)||G.readyState!=="open")return;G.setLiveSeekableRange(O,w)}},{key:"getSourceBuffer",value:function K(O){return this._sourceBuffer[O]}},{key:"buffered",value:function K(O){return e.get(this._sourceBuffer[O])}},{key:"bufferStart",value:function K(O){return e.start(this.buffered(O))}},{key:"bufferEnd",value:function K(O){return e.end(this.buffered(O))}},{key:"_enqueueOp",value:function K(O,w,G,J,Q){var Z=this;if(!this.mediaSource)return Promise.resolve();var W=this._queue[O]=this._queue[O]||[],X={exec:w,promise:y0(),opName:G,context:J};if(Q)W.splice(0,0,X),this._mseFullFlag[O]=!1,this._startQueue(O);else W.push(X);if(this.isOpened||this.isEnded){if(W.length===1)this._startQueue(O)}else this._openPromise.then(function(){if(W.length===1)Z._startQueue(O)});return X.promise}},{key:"_enqueueBlockingOp",value:function(){var K=U0(a().mark(function w(G,J,Q){var Z=this,W,X;return a().wrap(function U(D){while(!0)switch(D.prev=D.next){case 0:if(this.mediaSource){D.next=2;break}return D.abrupt("return",Promise.resolve());case 2:if(W=Object.keys(this._sourceBuffer),W.length){D.next=5;break}return D.abrupt("return",G());case 5:return X=[],W.forEach(function(V){var q=Z._queue[V],L=y0();if(X.push(L),q.push({exec:function z(){L.resolve()},promise:L,opName:J,context:Q}),q.length===1)Z._startQueue(V)}),D.abrupt("return",Promise.all(X).then(function(){try{return G()}finally{W.forEach(function(V){var q=Z._queue[V],L=Z._sourceBuffer[V];if(q===null||q===void 0||q.shift(),!L||!L.updating)Z._startQueue(V)})}}));case 8:case"end":return D.stop()}},w,this)}));function O(w,G,J){return K.apply(this,arguments)}return O}()},{key:"_startQueue",value:function K(O){var w=this._queue[O];if(w){var G=w[0];if(G&&!this._mseFullFlag[O])try{G.exec()}catch(Z){if(Z&&Z.message&&Z.message.indexOf("SourceBuffer is full")>=0){var J;if(this._mseFullFlag[O]=!0,G.context&&z0(G.context)==="object")G.context.isFull=!0;this._logger.error("[MSE error], context,",G.context," ,name,",G.opName,",err,SourceBuffer is full"),G===null||G===void 0||(J=G.promise)===null||J===void 0||J.reject(new Q0(m.MEDIA,m.SUB_TYPES.MSE_FULL,Z))}else{var Q;this._logger.error(Z),G===null||G===void 0||(Q=G.promise)===null||Q===void 0||Q.reject(Z.constructor===Q0?Z:new Q0(m.MEDIA,m.SUB_TYPES.MSE_OTHER,Z)),w.shift(),this._startQueue(O)}}}}},{key:"setTimeoffset",value:function K(O,w,G){var J=this;return this._enqueueOp(O,function(){if(w<0)w+=0.001;J._sourceBuffer[O].timestampOffset=w,J._onSBUpdateEnd(O)},"setTimeoffset",G)}},{key:"abort",value:function K(O,w){var G=this;if(!this.isOpened)return Promise.resolve();return this._enqueueOp(O,function(){G._sourceBuffer[O].abort(),G._onSBUpdateEnd(O)},"abort",w)}}],[{key:"isSupported",value:function K(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"',w=Ww();if(!w)return!1;try{return w.isTypeSupported(O)}catch(G){return this._logger.error(O,G),!1}}},{key:"isMMSOnly",value:function K(){return typeof ManagedMediaSource!=="undefined"&&typeof MediaSource==="undefined"}},{key:"getDefaultConfig",value:function K(){return{openLog:!1,preferMMS:!1}}}]),Y}();F(P0,"VIDEO","video");F(P0,"AUDIO","audio");var F0={FETCH:"fetch",XHR:"xhr"},u0={ARRAY_BUFFER:"arraybuffer",TEXT:"text",JSON:"json"};var N0=function(Y){V0(O,Y);var K=q0(O);function O(w,G,J,Q){var Z;return c(this,O),Z=K.call(this,Q),F(M(Z),"retryCount",0),F(M(Z),"isTimeout",!1),F(M(Z),"loaderType",F0.FETCH),F(M(Z),"startTime",0),F(M(Z),"endTime",0),F(M(Z),"options",{}),Z.url=w,Z.request=G,Z.response=J,Z}return r(O)}(T0(Error));var Xw=Object.prototype.toString;function Uw(Y){return Y!==null&&z0(Y)==="object"}function LO(Y){if(Xw.call(Y)!=="[object Object]")return!1;var K=Object.getPrototypeOf(Y);return K===null||K===Object.prototype}function Dw(Y){return Xw.call(Y)==="[object Date]"}function ZO(Y){if(!Y||Y[0]===null||Y[0]===void 0||Y[0]===0&&(Y[1]===null||Y[1]===void 0))return;var K="bytes="+Y[0]+"-";if(Y[1])K+=Y[1];return K}function Aw(Y){return encodeURIComponent(Y).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function WO(Y,K){if(!Y)return;if(!K)return Y;var O,w=Object.keys(K).map(function(J){if(O=K[J],O===null||O===void 0)return;if(Array.isArray(O))J=J+"[]";else O=[O];return O.map(function(Q){if(Dw(Q))Q=Q.toISOString();else if(Uw(Q))Q=JSON.stringify(Q);return"".concat(Aw(J),"=").concat(Aw(Q))}).join("&")}).filter(Boolean).join("&");if(w){var G=Y.indexOf("#");if(G!==-1)Y=Y.slice(0,G);Y+=(Y.indexOf("?")===-1?"?":"&")+w}return Y}function s0(Y,K,O,w,G,J,Q,Z,W,X,U){if(G=G!==null&&G!==void 0?parseFloat(G):null,w=parseInt(w||"0",10),Number.isNaN(w))w=0;var D={range:W,vid:X,index:Z,contentLength:w,age:G,startTime:J,firstByteTime:Q,endTime:Date.now(),priOptions:U};return{data:Y,done:K,options:D,response:O}}function a0(Y,K){return Math.round(Y*8*1000/K/1024)}var u={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",MEDIASOURCE_OPENED:"core.mediasourceopened",ANALYZE_DURATION_EXCEEDED:"core.analyzedurationexceeded",APPEND_BUFFER:"core.appendbuffer",REMOVE_BUFFER:"core.removebuffer",BUFFEREOS:"core.buffereos",KEYFRAME:"core.keyframe",CHASEFRAME:"core.chaseframe",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",DEMUXED_TRACK:"core.demuxedtrack",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",REAL_TIME_SPEED:"real_time_speed"};var Nw=o0(k0()),Hw=2097152,t0=function(Y){V0(O,Y);var K=q0(O);function O(){var w;return c(this,O),w=K.call(this),F(M(w),"_abortController",null),F(M(w),"_timeoutTimer",null),F(M(w),"_reader",null),F(M(w),"_response",null),F(M(w),"_aborted",!1),F(M(w),"_index",-1),F(M(w),"_range",null),F(M(w),"_receivedLength",0),F(M(w),"_running",!1),F(M(w),"_logger",null),F(M(w),"_vid",""),F(M(w),"_onProcessMinLen",0),F(M(w),"_onCancel",null),F(M(w),"_priOptions",null),w}return r(O,[{key:"load",value:function w(G){var J,Q=this,Z=G.url,W=G.vid,X=G.timeout,U=G.responseType,D=G.onProgress,V=G.index,q=G.onTimeout,L=G.onCancel,z=G.range,I=G.transformResponse,E=G.request,S=G.params,x=G.logger,C=G.method,R=G.headers,v=G.body,_=G.mode,t=G.credentials,P=G.cache,l=G.redirect,Y0=G.referrer,H=G.referrerPolicy,A=G.onProcessMinLen,N=G.priOptions;this._logger=x,this._aborted=!1,this._onProcessMinLen=A,this._onCancel=L,this._abortController=typeof AbortController!=="undefined"&&new AbortController,this._running=!0,this._index=V,this._range=z||[0,0],this._vid=W||Z,this._priOptions=N||{};var B={method:C,headers:R,body:v,mode:_,credentials:t,cache:P,redirect:l,referrer:Y0,referrerPolicy:H,signal:(J=this._abortController)===null||J===void 0?void 0:J.signal},j=!1;clearTimeout(this._timeoutTimer),Z=WO(Z,S);var $=ZO(z);if($){if(E)R=E.headers;else R=B.headers=B.headers||(Headers?new Headers:{});if(Headers&&R instanceof Headers)R.append("Range",$);else R.Range=$}if(X)this._timeoutTimer=setTimeout(function(){if(j=!0,Q.cancel(),q){var n=new N0(Z,B,null,"timeout");n.isTimeout=!0,q(n,{index:Q._index,range:Q._range,vid:Q._vid,priOptions:Q._priOptions})}},X);var T=Date.now();return this._logger.debug("[fetch load start], index,",V,",range,",z),new Promise(function(n,o){fetch(E||Z,E?void 0:B).then(function(){var i=U0(a().mark(function w0(d){var HO,C0,NO,mO;return a().wrap(function g1(G0){while(!0)switch(G0.prev=G0.next){case 0:if(clearTimeout(Q._timeoutTimer),Q._response=d,!(Q._aborted||!Q._running)){G0.next=4;break}return G0.abrupt("return");case 4:if(I)d=I(d,Z)||d;if(d.ok){G0.next=7;break}throw new N0(Z,B,d,"bad network response");case 7:if(HO=Date.now(),U!==u0.TEXT){G0.next=15;break}return G0.next=11,d.text();case 11:C0=G0.sent,Q._running=!1,G0.next=37;break;case 15:if(U!==u0.JSON){G0.next=22;break}return G0.next=18,d.json();case 18:C0=G0.sent,Q._running=!1,G0.next=37;break;case 22:if(!D){G0.next=29;break}return Q.resolve=n,Q.reject=o,Q._loadChunk(d,D,T,HO),G0.abrupt("return");case 29:return G0.next=31,d.arrayBuffer();case 31:C0=G0.sent,C0=new Uint8Array(C0),Q._running=!1,NO=Date.now()-T,mO=a0(C0.byteLength,NO),Q.emit(u.REAL_TIME_SPEED,{speed:mO,len:C0.byteLength,time:NO,vid:Q._vid,index:Q._index,range:Q._range,priOptions:Q._priOptions});case 37:Q._logger.debug("[fetch load end], index,",V,",range,",z),n(s0(C0,!0,d,d.headers.get("Content-Length"),d.headers.get("age"),T,HO,V,z,Q._vid,Q._priOptions));case 39:case"end":return G0.stop()}},w0)}));return function(w0){return i.apply(this,arguments)}}()).catch(function(i){var w0;if(clearTimeout(Q._timeoutTimer),Q._running=!1,Q._aborted&&!j)return;i=i instanceof N0?i:new N0(Z,B,null,(w0=i)===null||w0===void 0?void 0:w0.message),i.startTime=T,i.endTime=Date.now(),i.isTimeout=j,i.options={index:Q._index,range:Q._range,vid:Q._vid,priOptions:Q._priOptions},o(i)})})}},{key:"cancel",value:function(){var w=U0(a().mark(function J(){return a().wrap(function Q(Z){while(!0)switch(Z.prev=Z.next){case 0:if(!this._aborted){Z.next=2;break}return Z.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){Z.next=14;break}if(Z.prev=5,!this._reader){Z.next=9;break}return Z.next=9,this._reader.cancel();case 9:Z.next=13;break;case 11:Z.prev=11,Z.t0=Z.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(W){}this._abortController=null}if(this._onCancel)this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return Z.stop()}},J,this,[[5,11]])}));function G(){return w.apply(this,arguments)}return G}()},{key:"_loadChunk",value:function w(G,J,Q,Z){var W=this;if(!G.body||!G.body.getReader){this._running=!1;var X=new N0(G.url,"",G,"onProgress of bad response.body.getReader");X.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this.reject(X);return}if(this._onProcessMinLen>0)this._cache=new Uint8Array(Hw),this._writeIdx=0;var U=this._reader=G.body.getReader(),D,V,q,L=function(){var z=U0(a().mark(function I(){var E,S,x,C,R,v,_,t;return a().wrap(function P(l){while(!0)switch(l.prev=l.next){case 0:return V=Date.now(),l.prev=1,l.next=4,U.read();case 4:D=l.sent,q=Date.now(),l.next=13;break;case 8:if(l.prev=8,l.t0=l.catch(1),q=Date.now(),!W._aborted)W._running=!1,l.t0.options={index:W._index,range:W._range,vid:W._vid,priOptions:W._priOptions},W.reject(l.t0);return l.abrupt("return");case 13:if(S=((E=W._range)===null||E===void 0?void 0:E.length)>0?W._range[0]:0,x=S+W._receivedLength,!W._aborted){l.next=19;break}return W._running=!1,J(void 0,!1,{range:[x,x],vid:W._vid,index:W._index,startTime:V,endTime:q,st:Q,firstByteTime:Z,priOptions:W._priOptions},G),l.abrupt("return");case 19:if(C=D.value?D.value.byteLength:0,W._receivedLength+=C,W._logger.debug("【fetchLoader,onProgress call】,task,",W._range,", start,",x,", end,",S+W._receivedLength,", done,",D.done),W._onProcessMinLen>0){if(W._writeIdx+C>=W._onProcessMinLen||D.done)R=new Uint8Array(W._writeIdx+C),R.set(W._cache.slice(0,W._writeIdx),0),C>0&&R.set(D.value,W._writeIdx),W._writeIdx=0,W._logger.debug("【fetchLoader,onProgress enough】,done,",D.done,",len,",R.byteLength,", writeIdx,",W._writeIdx);else if(C>0&&W._writeIdx+C<Hw)W._cache.set(D.value,W._writeIdx),W._writeIdx+=C,W._logger.debug("【fetchLoader,onProgress cache】,len,",C,", writeIdx,",W._writeIdx);else if(C>0)v=new Uint8Array(W._writeIdx+C+2048),W._logger.debug("【fetchLoader,onProgress extra start】,size,",W._writeIdx+C+2048,", datalen,",C,", writeIdx,",W._writeIdx),v.set(W._cache.slice(0,W._writeIdx),0),C>0&&v.set(D.value,W._writeIdx),W._writeIdx+=C,delete W._cache,W._cache=v,W._logger.debug("【fetchLoader,onProgress extra end】,len,",C,", writeIdx,",W._writeIdx)}else R=D.value;if(R&&R.byteLength>0||D.done)J(R,D.done,{range:[W._range[0]+W._receivedLength-(R?R.byteLength:0),W._range[0]+W._receivedLength],vid:W._vid,index:W._index,startTime:V,endTime:q,st:Q,firstByteTime:Z,priOptions:W._priOptions},G);if(!D.done)L();else _=Date.now()-Q,t=a0(W._receivedLength,_),W.emit(u.REAL_TIME_SPEED,{speed:t,len:W._receivedLength,time:_,vid:W._vid,index:W._index,range:W._range,priOptions:W._priOptions}),W._running=!1,W._logger.debug("[fetchLoader onProgress end],task,",W._range,",done,",D.done),W.resolve(s0(D,!0,G,G.headers.get("Content-Length"),G.headers.get("age"),Q,Z,W._index,W._range,W._vid,W._priOptions));case 25:case"end":return l.stop()}},I,null,[[1,8]])}));return function I(){return z.apply(this,arguments)}}();L()}},{key:"receiveLen",get:function w(){return this._receivedLength}},{key:"running",get:function w(){return this._running},set:function w(G){this._running=G}}],[{key:"isSupported",value:function w(){return typeof fetch!=="undefined"}}]),O}(Nw.default);function Vw(Y){return M0({loaderType:F0.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:u0.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,onProcessMinLen:0},Y)}var qw=o0(k0()),Fw=function(Y){V0(O,Y);var K=q0(O);function O(){var w;return c(this,O),w=K.call(this),F(M(w),"_xhr",null),F(M(w),"_aborted",!1),F(M(w),"_timeoutTimer",null),F(M(w),"_range",null),F(M(w),"_receivedLength",0),F(M(w),"_url",null),F(M(w),"_onProgress",null),F(M(w),"_index",-1),F(M(w),"_headers",null),F(M(w),"_currentChunkSizeKB",384),F(M(w),"_timeout",null),F(M(w),"_xhr",null),F(M(w),"_withCredentials",null),F(M(w),"_startTime",-1),F(M(w),"_loadCompleteResolve",null),F(M(w),"_loadCompleteReject",null),F(M(w),"_runing",!1),F(M(w),"_logger",!1),F(M(w),"_vid",""),F(M(w),"_responseType",void 0),F(M(w),"_credentials",void 0),F(M(w),"_method",void 0),F(M(w),"_transformResponse",void 0),F(M(w),"_firstRtt",void 0),F(M(w),"_onCancel",null),F(M(w),"_priOptions",null),w}return r(O,[{key:"load",value:function w(G){var J=this;clearTimeout(this._timeoutTimer),this._logger=G.logger,this._range=G.range,this._onProgress=G.onProgress,this._index=G.index,this._headers=G.headers,this._withCredentials=G.credentials==="include"||G.credentials==="same-origin",this._body=G.body||null,G.method&&(this._method=G.method),this._timeout=G.timeout||null,this._runing=!0,this._vid=G.vid||G.url,this._responseType=G.responseType,this._firstRtt=-1,this._onTimeout=G.onTimeout,this._onCancel=G.onCancel,this._request=G.request,this._priOptions=G.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=WO(G.url,G.params);var Q=Date.now();return new Promise(function(Z,W){J._loadCompleteResolve=Z,J._loadCompleteReject=W,J._startLoad()}).catch(function(Z){if(clearTimeout(J._timeoutTimer),J._runing=!1,J._aborted)return;throw Z=Z instanceof N0?Z:new N0(J._url,J._request),Z.startTime=Q,Z.endTime=Date.now(),Z.options={index:J._index,vid:J._vid,priOptions:J._priOptions},Z})}},{key:"_startLoad",value:function w(){var G=null;if(this._responseType===u0.ARRAY_BUFFER&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var J=this._currentChunkSizeKB*1024,Q=this._range[0]+this._receivedLength,Z=this._range[1];if(J<this._range[1]-Q)Z=Q+J;G=[Q,Z],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",G)}else G=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",G);this._internalOpen(G)}},{key:"_internalOpen",value:function w(G){var J=this;try{this._startTime=Date.now();var Q=this._xhr=new XMLHttpRequest;Q.open(this._method||"GET",this._url,!0),Q.responseType=this._responseType,this._timeout&&(Q.timeout=this._timeout),Q.withCredentials=this._withCredentials,Q.onload=this._onLoad.bind(this),Q.onreadystatechange=this._onReadyStatechange.bind(this),Q.onerror=function(X){var U,D,V;J._running=!1;var q=new N0(J._url,J._request,X===null||X===void 0?void 0:(U=X.currentTarget)===null||U===void 0?void 0:U.response,"xhr.onerror.status:"+(X===null||X===void 0?void 0:(D=X.currentTarget)===null||D===void 0?void 0:D.status)+",statusText,"+(X===null||X===void 0?void 0:(V=X.currentTarget)===null||V===void 0?void 0:V.statusText));q.options={index:J._index,range:J._range,vid:J._vid,priOptions:J._priOptions},J._loadCompleteReject(q)},Q.ontimeout=function(X){J.cancel();var U=new N0(J._url,J._request,{status:408},"timeout");if(J._onTimeout)U.isTimeout=!0,J._onTimeout(U,{index:J._index,range:J._range,vid:J._vid,priOptions:J._priOptions});U.options={index:J._index,range:J._range,vid:J._vid,priOptions:J._priOptions},J._loadCompleteReject(U)};var Z=this._headers||{},W=ZO(G);if(W)Z.Range=W;if(Z)Object.keys(Z).forEach(function(X){Q.setRequestHeader(X,Z[X])});this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",G),Q.send(this._body)}catch(X){X.options={index:this._index,range:G,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(X)}}},{key:"_onReadyStatechange",value:function w(G){var J=G.target;if(J.readyState===2)this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function w(G){var J,Q=G.target.status;if(Q<200||Q>299){var Z=new N0(this._url,null,M0(M0({},G.target.response),{},{status:Q}),"bad response,status:"+Q);return Z.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(Z)}var W=null,X=!1,U,D=((J=this._range)===null||J===void 0?void 0:J.length)>0?this._range[0]:0;if(this._responseType===u0.ARRAY_BUFFER){var V,q=new Uint8Array(G.target.response);if(U=D+this._receivedLength,q&&q.byteLength>0){this._receivedLength+=q.byteLength;var L=Date.now()-this._startTime,z=a0(this._receivedLength,L);this.emit(u.REAL_TIME_SPEED,{speed:z,len:this._receivedLength,time:L,vid:this._vid,index:this._index,range:[U,D+this._receivedLength],priOptions:this._priOptions})}if(W=q,((V=this._range)===null||V===void 0?void 0:V.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0])X=!1;else X=!0;this._logger.debug("[xhr load done->], tast :",this._range,", start",U,"end ",D+this._receivedLength,",dataLen,",q?q.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",X)}else X=!0,W=G.target.response;var I={ok:Q>=200&&Q<300,status:Q,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};if(this._transformResponse)I=this._transformResponse(I,this._url)||I;if(this._onProgress)this._onProgress(W,X,{index:this._index,vid:this._vid,range:[U,D+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},I);if(!X)this._startLoad();else this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(s0(this._onProgress?null:W,X,I,I.headers["content-length"],I.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))}},{key:"cancel",value:function w(){if(this._aborted)return;if(this._aborted=!0,this._runing=!1,c0(v0(O.prototype),"removeAllListeners",this).call(this),this._onCancel)this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});if(this._xhr)return this._xhr.abort()}},{key:"receiveLen",get:function w(){return this._receivedLength}},{key:"running",get:function w(){return this._running},set:function w(G){this._running=G}},{key:"_getHeaders",value:function w(G){var J=G.getAllResponseHeaders().trim().split(`\r
4
- `),Q={},Z=Yw(J),W;try{for(Z.s();!(W=Z.n()).done;){var X=W.value,U=X.split(": ");Q[U[0].toLowerCase()]=U.slice(1).join(": ")}}catch(D){Z.e(D)}finally{Z.f()}return Q}}],[{key:"isSupported",value:function w(){return typeof XMLHttpRequest!=="undefined"}}]),O}(qw.default);var V1=["retry","retryDelay","onRetryError","transformError"],Lw=function(){function Y(K,O){c(this,Y),this.promise=y0(),this.alive=!!O.onProgress,!O.logger&&(O.logger=new D0("Loader")),this._loaderType=K,this._loader=K===F0.FETCH&&typeof fetch!=="undefined"?new t0:new Fw,this._config=O,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=O.retryCheckFunc,this._logger=O.logger}return r(Y,[{key:"exec",value:function K(){var O=this,w=this._config,G=w.retry,J=w.retryDelay,Q=w.onRetryError,Z=w.transformError,W=Gw(w,V1),X=function(){var U=U0(a().mark(function D(){var V,q,L;return a().wrap(function z(I){while(!0)switch(I.prev=I.next){case 0:return I.prev=0,I.next=3,O._loader.load(W);case 3:V=I.sent,O.promise.resolve(V),I.next=27;break;case 7:if(I.prev=7,I.t0=I.catch(0),O._loader.running=!1,O._logger.debug("[task request catch err]",I.t0),!O._canceled){I.next=13;break}return I.abrupt("return");case 13:if(I.t0.loaderType=O._loaderType,I.t0.retryCount=O._retryCount,q=I.t0,Z)q=Z(q)||q;if(Q&&O._retryCount>0)Q(q,O._retryCount,{index:W.index,vid:W.vid,range:W.range,priOptions:W.priOptions});if(O._retryCount++,L=!0,O._retryCheckFunc)L=O._retryCheckFunc(I.t0);if(!(L&&O._retryCount<=G)){I.next=26;break}return clearTimeout(O._retryTimer),O._logger.debug("[task request setTimeout],retry",O._retryCount,",retry range,",W.range),O._retryTimer=setTimeout(X,J),I.abrupt("return");case 26:O.promise.reject(q);case 27:case"end":return I.stop()}},D,null,[[0,7]])}));return function D(){return U.apply(this,arguments)}}();return X(),this.promise}},{key:"cancel",value:function(){var K=U0(a().mark(function w(){return a().wrap(function G(J){while(!0)switch(J.prev=J.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,J.abrupt("return",this._loader.cancel());case 4:case"end":return J.stop()}},w,this)}));function O(){return K.apply(this,arguments)}return O}()},{key:"running",get:function K(){return this._loader&&this._loader.running}},{key:"loader",get:function K(){return this._loader}}]),Y}();function jO(Y){return Y&&!Y.paused&&!Y.ended&&Y.playbackRate!==0&&Y.readyState!==0}function bO(Y){if(!Y)return{};if(typeof Y.getVideoPlaybackQuality==="function"){var K=Y.getVideoPlaybackQuality();return{droppedVideoFrames:K.droppedVideoFrames||K.corruptedVideoFrames,totalVideoFrames:K.totalVideoFrames,creationTime:K.creationTime}}return{droppedVideoFrames:Y.webkitDroppedFrameCount,totalVideoFrames:Y.webkitDecodedFrameCount,creationTime:performance.now()}}function IO(){for(var Y=arguments.length,K=new Array(Y),O=0;O<Y;O++)K[O]=arguments[O];if(K=K.filter(Boolean),K.length<2)return K[0];var w=new Uint8Array(K.reduce(function(J,Q){return J+Q.byteLength},0)),G=0;return K.forEach(function(J){w.set(J,G),G+=J.byteLength}),w}function zO(){var Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return new Promise(function(K){return setTimeout(K,Y)})}var jw=o0(k0()),BO=function(Y){V0(O,Y);var K=q0(O);function O(w){var G;if(c(this,O),G=K.call(this,w),F(M(G),"type",F0.FETCH),F(M(G),"_queue",[]),F(M(G),"_alive",[]),F(M(G),"_currentTask",null),F(M(G),"_finnalUrl",""),F(M(G),"_config",void 0),G._config=Vw(w),G._config.loaderType===F0.XHR||!t0.isSupported())G.type=F0.XHR;return G.log=w.logger,G}return r(O,[{key:"isFetch",value:function w(){return this.type===F0.FETCH}},{key:"load",value:function w(G){var J=this,Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof G==="string"||!G)Q.url=G||Q.url||this._config.url;else Q=G;if(Q=Object.assign({},this._config,Q),Q.params)Q.params=Object.assign({},Q.params);if(Q.headers&&LO(Q.headers))Q.headers=Object.assign({},Q.headers);if(Q.body&&LO(Q.body))Q.body=Object.assign({},Q.body);if(Q.transformRequest)Q=Q.transformRequest(Q)||Q;Q.logger=this.log;var Z=new Lw(this.type,Q);if(Z.loader.on(u.REAL_TIME_SPEED,function(W){J.emit(u.REAL_TIME_SPEED,W)}),this._queue.push(Z),this._queue.length===1&&(!this._currentTask||!this._currentTask.running))this._processTask();return Z.promise}},{key:"cancel",value:function(){var w=U0(a().mark(function J(){var Q;return a().wrap(function Z(W){while(!0)switch(W.prev=W.next){case 0:if(Q=this._queue.map(function(X){return X.cancel()}).concat(this._alive.map(function(X){return X.cancel()})),this._currentTask)Q.push(this._currentTask.cancel());return this._queue=[],this._alive=[],W.next=6,Promise.all(Q);case 6:return W.next=8,zO();case 8:case"end":return W.stop()}},J,this)}));function G(){return w.apply(this,arguments)}return G}()},{key:"_processTask",value:function w(){var G=this;if(this._currentTask=this._queue.shift(),!this._currentTask)return;if(this._currentTask.alive)this._alive.push(this._currentTask);var J=this._currentTask.exec().catch(function(Q){});if(!(J&&typeof J.finally==="function"))return;J.finally(function(){var Q,Z;if((Q=G._currentTask)!==null&&Q!==void 0&&Q.alive&&((Z=G._alive)===null||Z===void 0?void 0:Z.length)>0)G._alive=G._alive.filter(function(W){return W&&W!==G._currentTask});G._processTask()})}}],[{key:"isFetchSupport",value:function w(){return t0.isSupported()}}]),O}(jw.default);var RO=function(){function Y(){c(this,Y),F(this,"_prevCurrentTime",0)}return r(Y,[{key:"do",value:function K(O){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3,G=arguments.length>2?arguments[2]:void 0,J=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!O)return;var Q=O.currentTime,Z=0;if(this._prevCurrentTime===Q){var W=e.info(e.get(O),Q);if(!W.buffers.length)return;if(G&&W.nextStart||W.nextStart&&W.nextStart-Q<w)Z=W.nextStart+0.1;else if(W.end&&W.end-Q>J&&!O.seeking)Z=Q+0.1}if(this._prevCurrentTime=Q,Z&&Q!==Z)O.currentTime=Z}}]),Y}();var EO=function(){function Y(K){var O=this;c(this,Y),F(this,"_seiSet",new Set),this.emitter=K,K.on(u.SEI,function(w){if(w)O._seiSet.add(w)})}return r(Y,[{key:"throw",value:function K(O,w){var G=this;if(O===null||O===void 0||!this._seiSet.size)return;var J=O-0.2,Q=O+0.2,Z=[];if(this._seiSet.forEach(function(W){if(W.time>=J&&W.time<=Q)Z.push(W)}),Z.forEach(function(W){G._seiSet.delete(W),G.emitter.emit(u.SEI_IN_TIME,W)}),!w)return;this._seiSet.forEach(function(W){if(W.time<O-5)G._seiSet.delete(W)})}},{key:"reset",value:function K(){this._seiSet.clear()}}]),Y}();var q1=1000,F1=50,L1=3,j1=3000,SO=function(){function Y(K){c(this,Y),F(this,"_chunkSpeed",0),F(this,"_chunkCache",[]),F(this,"_speeds",[]),F(this,"_totalSize",0),F(this,"_totalCost",0),this._opts=K||{}}return r(Y,[{key:"addRecord",value:function K(O,w){if(!O||!w)return;this._speeds.push(8000*O/w),this._speeds=this._speeds.slice(-L1)}},{key:"addChunkRecord",value:function K(O,w){var G,J;if(!O||!w||O<(((G=this._opts)===null||G===void 0?void 0:G.skipChunkSize)||q1))return;this._totalSize+=O,this._totalCost+=w,this._chunkSpeed=8000*O/w,this._chunkCache.push({size:O,duration:w,timestamp:performance.now()});var Q=((J=this._opts)===null||J===void 0?void 0:J.chunkCountForSpeed)||F1;if(this._chunkCache.length>Q)this._chunkCache=this._chunkCache.slice(-Q)}},{key:"getAvgSpeed",value:function K(){var O;if(!this._chunkCache.length&&!this._speeds.length)return 0;if(this._speeds.length)return this._speeds.reduce(function(Z,W){return Z+=W})/this._speeds.length;var w=this._chunkCache[this._chunkCache.length-1],G=performance.now()-w.timestamp;if(G>(((O=this._opts)===null||O===void 0?void 0:O.longtimeNoReceived)||j1))this._chunkCache.push({size:0,duration:G,timestamp:performance.now()});var J=this._chunkCache.reduce(function(Z,W){return Z+=W.size},0),Q=this._chunkCache.reduce(function(Z,W){return Z+=W.duration},0);return 8000*J/Q}},{key:"getLatestSpeed",value:function K(){if(!this._chunkCache.length&&!this._speeds.length)return 0;if(this._speeds.length)return this._speeds[this._speeds.length-1];return this._chunkSpeed}},{key:"getTotalSize",value:function K(){return this._totalSize}},{key:"getTotalCost",value:function K(){return this._totalCost}},{key:"reset",value:function K(){this._chunkCache=[],this._speeds=[],this._totalSize=0,this._totalCost=0}}]),Y}();var eG=o0(k0());var bw=function(){function Y(K){c(this,Y),F(this,"encodeType",""),F(this,"audioCodec",""),F(this,"videoCodec",""),F(this,"domain",""),F(this,"fps",0),F(this,"bitrate",0),F(this,"width",0),F(this,"height",0),F(this,"samplerate",0),F(this,"channelCount",0),F(this,"gop",0),F(this,"_bitsAccumulateSize",0),F(this,"_bitsAccumulateDuration",0),F(this,"_startGopId",-1),this._timescale=K}return r(Y,[{key:"getStats",value:function K(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}},{key:"setEncodeType",value:function K(O){this.encodeType=O}},{key:"setFpsFromScriptData",value:function K(O){var w,G=O.data,J=G===null||G===void 0?void 0:(w=G.onMetaData)===null||w===void 0?void 0:w.framerate;if(J&&J>0&&J<100)this.fps=J}},{key:"setVideoMeta",value:function K(O){if(this.width=O.width,this.height=O.height,this.videoCodec=O.codec,this.encodeType=O.codecType,O.fpsNum&&O.fpsDen){var w=O.fpsNum/O.fpsDen;if(w>0&&w<100)this.fps=w}}},{key:"setAudioMeta",value:function K(O){this.audioCodec=O.codec,this.samplerate=O.sampleRate,this.channelCount=O.channelCount}},{key:"setDomain",value:function K(O){this.domain=O.split("/").slice(2,3)[0]}},{key:"updateBitrate",value:function K(O){var w=this;if(!this.fps||this.fps>=100){if(O.length){var G=O.reduce(function(J,Q){return J+=Q.duration},0)/O.length;this.fps=Math.round(this._timescale/G)}}O.forEach(function(J){if(w._startGopId===-1)w._startGopId=J.gopId;if(J.gopId===w._startGopId)w.gop++;if(w._bitsAccumulateDuration+=J.duration/(w._timescale/1000),w._bitsAccumulateSize+=J.units.reduce(function(Q,Z){return Q+=Z.length},0),w._bitsAccumulateDuration>=1000)w.bitrate=w._bitsAccumulateSize*8,w._bitsAccumulateDuration=0,w._bitsAccumulateSize=0})}}]),Y}(),$O=function(){function Y(K){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1000;c(this,Y),F(this,"_core",null),F(this,"_samples",[]),this._core=K,this._timescale=O,this._stats=new bw(O),this._bindEvents()}return r(Y,[{key:"getStats",value:function K(){var O,w,G,J,Q,Z,W,X,U,D,V,q=((O=this._core)===null||O===void 0?void 0:O.media)||{},L=q.currentTime,z=L===void 0?0:L,I=q.decodeFps,E=I===void 0?0:I;return M0(M0({},this._stats.getStats()),{},{downloadSpeed:((w=this._core)===null||w===void 0?void 0:(G=w.speedInfo)===null||G===void 0?void 0:G.call(w).speed)||0,avgSpeed:((J=this._core)===null||J===void 0?void 0:(Q=J.speedInfo)===null||Q===void 0?void 0:Q.call(J).avgSpeed)||0,totalReceivedByte:((Z=this._core)===null||Z===void 0?void 0:(W=Z.speedInfo)===null||W===void 0?void 0:W.call(Z).totalSize)||0,totalReceivedCost:((X=this._core)===null||X===void 0?void 0:(U=X.speedInfo)===null||U===void 0?void 0:U.call(X).totalCost)||0,currentTime:z,bufferEnd:((D=this._core)===null||D===void 0?void 0:(V=D.bufferInfo())===null||V===void 0?void 0:V.remaining)||0,decodeFps:E})}},{key:"_bindEvents",value:function K(){var O=this;this._core.on(u.DEMUXED_TRACK,function(w){var G=w.videoTrack;return O._stats.updateBitrate(G.samples)}),this._core.on(u.FLV_SCRIPT_DATA,function(w){O._stats.setFpsFromScriptData(w)}),this._core.on(u.METADATA_PARSED,function(w){if(w.type==="video")O._stats.setVideoMeta(w.track);else O._stats.setAudioMeta(w.track)}),this._core.on(u.TTFB,function(w){O._stats.setDomain(w.responseUrl)})}},{key:"reset",value:function K(){this._samples=[],this._stats=new bw(this._timescale)}}]),Y}();var rw=o0(k0());function b1(Y,K){var O=Y==null?null:typeof Symbol!="undefined"&&Y[Symbol.iterator]||Y["@@iterator"];if(O!=null){var w,G,J,Q,Z=[],W=!0,X=!1;try{if(J=(O=O.call(Y)).next,K===0){if(Object(O)!==O)return;W=!1}else for(;!(W=(w=J.call(O)).done)&&(Z.push(w.value),Z.length!==K);W=!0);}catch(U){X=!0,G=U}finally{try{if(!W&&O.return!=null&&(Q=O.return(),Object(Q)!==Q))return}finally{if(X)throw G}}return Z}}function f(Y,K){if(!(Y instanceof K))throw new TypeError("Cannot call a class as a function")}function Iw(Y,K){for(var O=0;O<K.length;O++){var w=K[O];if(w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w)w.writable=!0;Object.defineProperty(Y,Rw(w.key),w)}}function g(Y,K,O){if(K)Iw(Y.prototype,K);if(O)Iw(Y,O);return Object.defineProperty(Y,"prototype",{writable:!1}),Y}function b(Y,K,O){if(K=Rw(K),K in Y)Object.defineProperty(Y,K,{value:O,enumerable:!0,configurable:!0,writable:!0});else Y[K]=O;return Y}function MO(Y,K){if(typeof K!=="function"&&K!==null)throw new TypeError("Super expression must either be null or a function");if(Y.prototype=Object.create(K&&K.prototype,{constructor:{value:Y,writable:!0,configurable:!0}}),Object.defineProperty(Y,"prototype",{writable:!1}),K)CO(Y,K)}function XO(Y){return XO=Object.setPrototypeOf?Object.getPrototypeOf.bind():function K(O){return O.__proto__||Object.getPrototypeOf(O)},XO(Y)}function CO(Y,K){return CO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function O(w,G){return w.__proto__=G,w},CO(Y,K)}function I1(){if(typeof Reflect==="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy==="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(Y){return!1}}function z1(Y){if(Y===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Y}function B1(Y,K){if(K&&(typeof K==="object"||typeof K==="function"))return K;else if(K!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return z1(Y)}function yO(Y){var K=I1();return function O(){var w=XO(Y),G;if(K){var J=XO(this).constructor;G=Reflect.construct(w,arguments,J)}else G=w.apply(this,arguments);return B1(this,G)}}function zw(Y,K){return E1(Y)||b1(Y,K)||Bw(Y,K)||C1()}function L0(Y){return R1(Y)||S1(Y)||Bw(Y)||$1()}function R1(Y){if(Array.isArray(Y))return vO(Y)}function E1(Y){if(Array.isArray(Y))return Y}function S1(Y){if(typeof Symbol!=="undefined"&&Y[Symbol.iterator]!=null||Y["@@iterator"]!=null)return Array.from(Y)}function Bw(Y,K){if(!Y)return;if(typeof Y==="string")return vO(Y,K);var O=Object.prototype.toString.call(Y).slice(8,-1);if(O==="Object"&&Y.constructor)O=Y.constructor.name;if(O==="Map"||O==="Set")return Array.from(Y);if(O==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(O))return vO(Y,K)}function vO(Y,K){if(K==null||K>Y.length)K=Y.length;for(var O=0,w=new Array(K);O<K;O++)w[O]=Y[O];return w}function $1(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
5
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function C1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
6
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v1(Y,K){if(typeof Y!=="object"||Y===null)return Y;var O=Y[Symbol.toPrimitive];if(O!==void 0){var w=O.call(Y,K||"default");if(typeof w!=="object")return w;throw new TypeError("@@toPrimitive must return a primitive value.")}return(K==="string"?String:Number)(Y)}function Rw(Y){var K=v1(Y,"string");return typeof K==="symbol"?K:String(K)}var j0={VIDEO:"video",AUDIO:"audio",METADATA:"metadata"},R0={AV1:"av1",AVC:"avc",HEVC:"hevc"},s={AAC:"aac",G711PCMA:"g7110a",G711PCMU:"g7110m",OPUS:"opus",MP3:"mp3"},W0={LARGE_AV_SHIFT:"LARGE_AV_SHIFT",LARGE_VIDEO_GAP:"LARGE_VIDEO_GAP",LARGE_VIDEO_GAP_BETWEEN_CHUNK:"LARGE_VIDEO_GAP_BETWEEN_CHUNK",LARGE_AUDIO_GAP:"LARGE_AUDIO_GAP",AUDIO_FILLED:"AUDIO_FILLED",AUDIO_DROPPED:"AUDIO_DROPPED"};var Ew=function(){function Y(){f(this,Y),b(this,"id",1),b(this,"type",j0.VIDEO),b(this,"codecType",R0.AVC),b(this,"pid",-1),b(this,"hvcC",void 0),b(this,"codec",""),b(this,"timescale",0),b(this,"formatTimescale",0),b(this,"sequenceNumber",0),b(this,"baseMediaDecodeTime",0),b(this,"baseDts",0),b(this,"duration",0),b(this,"warnings",[]),b(this,"samples",[]),b(this,"pps",[]),b(this,"sps",[]),b(this,"vps",[]),b(this,"fpsNum",0),b(this,"fpsDen",0),b(this,"sarRatio",[]),b(this,"width",0),b(this,"height",0),b(this,"nalUnitSize",4),b(this,"present",!1),b(this,"isVideoEncryption",!1),b(this,"isAudioEncryption",!1),b(this,"isVideo",!0),b(this,"lastKeyFrameDts",0),b(this,"kid",null),b(this,"pssh",null),b(this,"ext",void 0)}return g(Y,[{key:"reset",value:function K(){this.sequenceNumber=this.width=this.height=this.fpsDen=this.fpsNum=this.duration=this.baseMediaDecodeTime=this.timescale=0,this.codec="",this.present=!1,this.pid=-1,this.pps=[],this.sps=[],this.vps=[],this.sarRatio=[],this.samples=[],this.warnings=[],this.hvcC=null}},{key:"firstDts",get:function K(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function K(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function K(){if(this.samples.length>0){var O=this.samples[0],w=this.samples[this.samples.length-1];return w.dts-O.dts+w.duration}return 0}},{key:"exist",value:function K(){if(/av01/.test(this.codec))return!0;return!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function K(){return!!this.samples.length}},{key:"isEncryption",get:function K(){return this.isVideoEncryption}}]),Y}();var Sw=function(){function Y(){f(this,Y),b(this,"id",2),b(this,"type",j0.AUDIO),b(this,"codecType",s.AAC),b(this,"pid",-1),b(this,"codec",""),b(this,"container",""),b(this,"sequenceNumber",0),b(this,"sampleDuration",0),b(this,"timescale",0),b(this,"formatTimescale",0),b(this,"baseMediaDecodeTime",0),b(this,"duration",0),b(this,"warnings",[]),b(this,"samples",[]),b(this,"baseDts",0),b(this,"sampleSize",16),b(this,"sampleRate",0),b(this,"channelCount",0),b(this,"objectType",0),b(this,"sampleRateIndex",0),b(this,"config",[]),b(this,"present",!1),b(this,"isVideoEncryption",!1),b(this,"isAudioEncryption",!1),b(this,"kid",null),b(this,"ext",void 0)}return g(Y,[{key:"reset",value:function K(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function K(){return!!(this.sampleRate&&this.channelCount&&(this.codec||this.container)&&(this.codecType===s.AAC||this.codecType===s.G711PCMA||this.codecType===s.G711PCMU||this.codecType===s.OPUS||this.codecType===s.MP3))}},{key:"hasSample",value:function K(){return!!this.samples.length}},{key:"isEncryption",get:function K(){return this.isAudioEncryption}},{key:"firstDts",get:function K(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function K(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function K(){if(this.samples.length>0){var O=this.samples[0],w=this.samples[this.samples.length-1];return w.dts-O.dts+w.duration}return 0}}]),Y}();var $w=function(){function Y(K,O,w){if(f(this,Y),b(this,"flag",{}),b(this,"keyframe",!1),b(this,"gopId",0),b(this,"duration",0),b(this,"size",0),b(this,"units",[]),b(this,"chromaFormat",420),this.originPts=this.pts=K,this.originDts=this.dts=O,w)this.units=w}return g(Y,[{key:"cts",get:function K(){return this.pts-this.dts}},{key:"setToKeyframe",value:function K(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}]),Y}();var m0=g(function Y(K,O,w,G){if(f(this,Y),b(this,"duration",1024),b(this,"flag",{dependsOn:2,isNonSyncSample:0}),b(this,"keyframe",!0),this.originPts=this.pts=this.dts=K,this.data=O,this.size=O.byteLength,this.sampleOffset=G,w)this.duration=w});var Cw=g(function Y(K,O){f(this,Y),b(this,"time",0),this.data=K,this.originPts=this.pts=O}),vw=function(Y){MO(O,Y);var K=yO(O);function O(){return f(this,O),K.apply(this,arguments)}return g(O)}(Cw),Mw=function(Y){MO(O,Y);var K=yO(O);function O(){return f(this,O),K.apply(this,arguments)}return g(O)}(Cw),yw=function(){function Y(){f(this,Y),b(this,"id",3),b(this,"type",j0.METADATA),b(this,"timescale",0),b(this,"flvScriptSamples",[]),b(this,"seiSamples",[])}return g(Y,[{key:"exist",value:function K(){return!!((this.flvScriptSamples.length||this.seiSamples.length)&&this.timescale)}},{key:"reset",value:function K(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function K(){return!!(this.flvScriptSamples.length||this.seiSamples.length)}}]),Y}();var g0=function(){function Y(K){f(this,Y),this.name=K||"",this._prefix="[".concat(this.name,"]")}return g(Y,[{key:"warn",value:function K(){var O;if(Y.disabled)return;for(var w=arguments.length,G=new Array(w),J=0;J<w;J++)G[J]=arguments[J];(O=console).warn.apply(O,[this._prefix].concat(G))}}],[{key:"enable",value:function K(){Y.disabled=!1}},{key:"disable",value:function K(){Y.disabled=!0}}]),Y}();b(g0,"disabled",!0);var UO=typeof window!=="undefined",PO=UO&&navigator.userAgent.toLocaleLowerCase(),Pw=UO&&/^((?!chrome|android).)*safari/.test(PO),uw=UO&&PO.includes("firefox"),Tw=UO&&PO.includes("android");var p0=function(){function Y(){f(this,Y)}return g(Y,null,[{key:"getRateIndexByRate",value:function K(O){return Y.FREQ.indexOf(O)}},{key:"parseADTS",value:function K(O,w){var G=O.length,J=0;while(J+2<G){if(O[J]===255&&(O[J+1]&246)===240)break;J++}if(J>=G)return;var Q=J,Z=[],W=(O[J+2]&60)>>>2,X=Y.FREQ[W];if(!X)throw new Error("Invalid sampling index: ".concat(W));var U=((O[J+2]&192)>>>6)+1,D=(O[J+2]&1)<<2|(O[J+3]&192)>>>6,V=Y._getConfig(W,D,U),q=V.config,L=V.codec,z,I,E=0,S=Y.getFrameDuration(X);while(J+7<G){if(O[J]!==255||(O[J+1]&246)!==240){J++;continue}if(I=(O[J+3]&3)<<11|O[J+4]<<3|(O[J+5]&224)>>5,!I||G-J<I)break;z=(~O[J+1]&1)*2,Z.push({pts:w+E*S,data:O.subarray(J+7+z,J+I)}),E++,J+=I}return{skip:Q,remaining:J>=G?void 0:O.subarray(J),frames:Z,samplingFrequencyIndex:W,sampleRate:X,objectType:U,channelCount:D,codec:L,config:q,originCodec:"mp4a.40.".concat(U)}}},{key:"parseAudioSpecificConfig",value:function K(O){if(!O.length)return;var w=O[0]>>>3,G=(O[0]&7)<<1|O[1]>>>7,J=(O[1]&120)>>>3,Q=Y.FREQ[G];if(!Q)return;var Z=Y._getConfig(G,J,w),W=Z.config,X=Z.codec;return{samplingFrequencyIndex:G,sampleRate:Q,objectType:w,channelCount:J,config:W,codec:X,originCodec:"mp4a.40.".concat(w)}}},{key:"getFrameDuration",value:function K(O){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:90000;return 1024*w/O}},{key:"_getConfig",value:function K(O,w,G){var J=[],Q,Z;if(uw)if(O>=6)Q=5,Z=O-3;else Q=2,Z=O;else if(Tw)Q=2,Z=O;else if(Q=5,Z=O,O>=6)Z=O-3;else if(w===1)Q=2,Z=O;if(J[0]=Q<<3,J[0]|=(O&14)>>1,J[1]=(O&1)<<7,J[1]|=w<<3,Q===5)J[1]|=(Z&14)>>1,J[2]=(Z&1)<<7,J[2]|=8,J[3]=0;return{config:J,codec:"mp4a.40.".concat(Q)}}},{key:"getSilentFrame",value:function K(O,w){switch(O){case"mp4a.40.2":if(w===1)return new Uint8Array([0,200,0,128,35,128]);if(w===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(w===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(w===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(w===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(w===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(w===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(w===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(w===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}]),Y}();b(p0,"FREQ",[96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350]);var e0=function(){function Y(){f(this,Y)}return g(Y,null,[{key:"getFrameDuration",value:function K(O){return 20}},{key:"parseHeaderPackets",value:function K(O){if(!O.length)return;var w=new DataView(O.buffer,O.byteOffset,O.byteLength),G="";for(var J=0;J<8;J++)G+=String.fromCodePoint(O[J]);if(G!=="OpusHead")throw new Error("Invalid Opus MagicSignature");var Q=O[9];console.log("Pre-skip",O[10],O[11]);var Z=w.getUint32(12,!0),W=w.getInt16(16,!0);if(!Z)return;var X="opus",U="opus",D=new Uint8Array(O.buffer,O.byteOffset+8,O.byteLength-8);return{outputGain:W,sampleRate:Z,channelCount:Q,config:D,codec:X,originCodec:U}}}]),Y}();var M1=500,fw=3,uO=1000,TO=5000,y1=1000,P1=200,gw=5000,hw=5,xw=function(){function Y(K,O,w){f(this,Y),this.videoTrack=K,this.audioTrack=O,this.metadataTrack=w,this._baseDts=-1,this._baseDtsInited=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=0,this._videoTimestampBreak=0,this._lastVideoDuration=0,this._keyFrameInNextChunk=!1,this._lastAudioExceptionGapDot=-1/0,this._lastAudioExceptionOverlapDot=-1/0,this._lastAudioExceptionLargeGapDot=-1/0,this._lastVideoExceptionLargeGapDot=-1/0,this._lastVideoExceptionChunkFirstDtsDot=-1/0}return g(Y,[{key:"fix",value:function K(){var O=this,w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,J=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;w=Math.round(w*1000);var Q=this.videoTrack,Z=this.audioTrack;if(G||!J)this._videoLastSample=null,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=0,this._videoTimestampBreak=0,this._lastAudioExceptionGapDot=-1/0,this._lastAudioExceptionOverlapDot=-1/0,this._lastAudioExceptionLargeGapDot=-1/0,this._lastVideoExceptionLargeGapDot=-1/0,this._lastVideoExceptionChunkFirstDtsDot=-1/0;if(G&&!J)this._baseDtsInited=!1;if(!this._baseDtsInited)this._calculateBaseDts(Z,Q);if(!J&&w)this._audioNextPts=this._videoNextDts=w;var W=this._baseDtsInited&&(this._videoTimestampBreak||!this.videoTrack.exist())&&(this._audioTimestampBreak||!this.audioTrack.exist());if(W)this._resetBaseDtsWhenStreamBreaked();if(this._fixAudio(Z),this._keyFrameInNextChunk=!1,this._fixVideo(Q),this.metadataTrack.exist()){var X=this.metadataTrack.timescale;this.metadataTrack.seiSamples.forEach(function(U){U.pts=U.originPts-O._baseDts,U.time=Math.max(0,U.pts)/X}),this.metadataTrack.flvScriptSamples.forEach(function(U){U.pts=U.originPts-O._baseDts,U.time=Math.max(0,U.pts)/X})}if(Q.samples.length)Q.baseMediaDecodeTime=Q.samples[0].dts;if(Z.samples.length)Z.baseMediaDecodeTime=Z.samples[0].pts*Z.timescale/1000}},{key:"_fixVideo",value:function K(O){var w=this,G=O.samples;if(!G.length)return;G.forEach(function(S){if(S.dts-=w._baseDts,S.pts-=w._baseDts,S.keyframe)w._keyFrameInNextChunk=!0});var J;if(O.fpsNum&&O.fpsDen)J=O.timescale*(O.fpsDen/O.fpsNum);else if(O.length>1){var Q=O.samples[0],Z=O.samples[G.length-1];J=Math.floor((Z.dts-Q.dts)/(G.length-1))}else J=this._lastVideoDuration||40;var W=G.pop();if(this._videoLastSample)G.unshift(this._videoLastSample);if(this._videoLastSample=W,!G.length)return;if(this._videoNextDts===void 0){var X=G[0];this._videoNextDts=X.dts}var U=G.length,D=0,V=G[0],q=this._videoNextDts-V.dts;if(Math.abs(q)>P1){if(Math.abs(V.dts-this._lastVideoExceptionChunkFirstDtsDot)>gw){var L;this._lastVideoExceptionChunkFirstDtsDot=V.dts,O.warnings.push({type:W0.LARGE_VIDEO_GAP_BETWEEN_CHUNK,nextDts:this._videoNextDts,firstSampleDts:V.dts,nextSampleDts:(L=G[1])===null||L===void 0?void 0:L.dts,sampleDuration:q})}if(this._videoTimestampBreak>=hw)this._videoNextDts=V.dts,this._videoTimestampBreak=0;else if(V.dts+=q,V.pts+=q,!this.audioTrack.exist())this._videoTimestampBreak=1}for(var z=0;z<U;z++){var I=G[z].dts,E=G[z+1];if(z<U-1)D=E.dts-I;else if(W)D=W.dts-I;else D=J;if(D>y1||D<0){if(this._videoTimestampBreak++,Math.abs(I-this._lastVideoExceptionLargeGapDot)>gw)this._lastVideoExceptionLargeGapDot=I,O.warnings.push({type:W0.LARGE_VIDEO_GAP,time:I/O.timescale,dts:I,originDts:G[z].originDts,nextDts:this._videoNextDts,sampleDuration:D,refSampleDuration:J});D=J}G[z].duration=D,this._videoNextDts+=D,this._lastVideoDuration=D}}},{key:"_fixAudio",value:function K(O){var w=this,G=O.samples;if(!G.length)return;G.forEach(function(J){J.dts=J.pts-=w._baseDts}),this._doFixAudioInternal(O,G,1000)}},{key:"_calculateBaseDts",value:function K(O,w){var G=O.samples,J=w.samples;if(!G.length&&!J.length)return!1;var Q=1/0,Z=1/0;if(G.length)O.baseDts=Q=G[0].pts;if(J.length)w.baseDts=Z=J[0].dts;this._baseDts=Math.min(Q,Z);var W=Z-Q;if(Number.isFinite(W)&&Math.abs(W)>M1)w.warnings.push({type:W0.LARGE_AV_SHIFT,videoBaseDts:Z,audioBasePts:Q,baseDts:this._baseDts,delta:W});return this._baseDtsInited=!0,!0}},{key:"_resetBaseDtsWhenStreamBreaked",value:function K(){var O=this._calculateBaseDts(this.audioTrack,this.videoTrack);if(!O)return;if(!this.audioTrack.exist())this._baseDts-=this._videoNextDts;else if(!this.videoTrack.exist())this._baseDts-=this._audioNextPts;else this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts);this._videoTimestampBreak=0,this._audioTimestampBreak=0}},{key:"_doFixAudioInternal",value:function K(O,w,G){if(!O.sampleDuration)switch(O.codecType){case s.AAC:{O.sampleDuration=p0.getFrameDuration(O.timescale,G);break}case s.OPUS:{O.sampleDuration=e0.getFrameDuration(O.samples,G);break}case s.G711PCMA:case s.G711PCMU:{O.sampleDuration=this._getG711Duration(O);break}default:console.error("can't fix audio codecType:",O.codecType);break}var J=O.sampleDuration,Q=O.codecType===s.OPUS?20:O.codecType===s.AAC?1024:J*O.timescale/1000;if(this._audioNextPts===void 0){var Z=w[0];this._audioNextPts=Z.pts}for(var W=0;W<w.length;W++){var X=this._audioNextPts,U=w[W],D=U.pts-X;if(W===0&&this._audioTimestampBreak>=hw&&this._keyFrameInNextChunk)X=this._audioNextPts=U.dts,D=0,this._audioTimestampBreak=0;if(!this._audioTimestampBreak&&D>=fw*J&&D<=uO&&!Pw){var V=this._getSilentFrame(O)||w[0].data.subarray(),q=Math.floor(D/J);if(Math.abs(U.pts-this._lastAudioExceptionGapDot)>TO)this._lastAudioExceptionGapDot=U.pts,O.warnings.push({type:W0.AUDIO_FILLED,pts:U.pts,originPts:U.originPts,count:q,nextPts:X,refSampleDuration:J});for(var L=0;L<q;L++){var z=new m0(Math.floor(this._audioNextPts+J)-Math.floor(this._audioNextPts),V,Q);z.originPts=Math.floor(this._baseDts+X),w.splice(W,0,z),this._audioNextPts+=J,W++}W--}else if(D<=-fw*J&&D>=-1*uO){if(Math.abs(U.pts-this._lastAudioExceptionOverlapDot)>TO)this._lastAudioExceptionOverlapDot=U.pts,O.warnings.push({type:W0.AUDIO_DROPPED,pts:U.pts,originPts:U.originPts,nextPts:X,refSampleDuration:J});w.splice(W,1),W--}else{if(Math.abs(D)>uO){if(this._audioTimestampBreak++,Math.abs(U.pts-this._lastAudioExceptionLargeGapDot)>TO)this._lastAudioExceptionLargeGapDot=U.pts,O.warnings.push({type:W0.LARGE_AUDIO_GAP,time:U.pts/1000,pts:U.pts,originPts:U.originPts,nextPts:X,sampleDuration:D,refSampleDuration:J})}if(O.codecType===s.OPUS){var I=w[w.length-1];if(I)I.duration=U.pts-I.pts}else U.dts=U.pts=X,U.duration=Q;this._audioNextPts+=J}}}},{key:"_getG711Duration",value:function K(O){var{sampleSize:w,channelCount:G,sampleRate:J}=O,Q=O.samples[0];if(!Q)return;return Q.data.byteLength*2/G/(w/8)/J*1000}},{key:"_getSilentFrame",value:function K(O){if(O.codecType===s.AAC)return p0.getSilentFrame(O.codec,O.channelCount);return new Uint8Array(8*O.sampleDuration*O.channelCount)}}]),Y}();function A0(){for(var Y=arguments.length,K=new Array(Y),O=0;O<Y;O++)K[O]=arguments[O];K=K.filter(Boolean);var w=new Uint8Array(K.reduce(function(J,Q){return J+Q.byteLength},0)),G=0;return K.forEach(function(J){w.set(J,G),G+=J.byteLength}),w}var d2=Math.pow(2,32);function l0(Y){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(Y[K]<<24>>>0)+(Y[K+1]<<16)+(Y[K+2]<<8)+(Y[K+3]||0)}function kw(Y){var K="avc1.",O;for(var w=0;w<3;w++){if(O=Y[w].toString(16),O.length<2)O="0".concat(O);K+=O}return K}function fO(Y){if(!Array.isArray(Y)){var K=[],O="";for(var w=0;w<Y.length;w++)if(w%2)O=Y[w-1]+Y[w],K.push(parseInt(O,16)),O="";return K}return Y.map(function(G){return parseInt(G,16)})}var E0=function(){function Y(){f(this,Y)}return g(Y,null,[{key:"parseAnnexB",value:function K(O){var w=O.byteLength-1,G=0;do{if(O[w]===0)G++;else break;w--}while(w>0);if(G>=3)O=O.subarray(0,w+1);var J=O.length,Q=2,Z=0;while(O[Q]!==null&&O[Q]!==void 0&&O[Q]!==1)Q++;if(Q++,Z=Q+2,Z>=J)return[];var W=[];while(Z<J)switch(O[Z]){case 0:if(O[Z-1]!==0){Z+=2;break}else if(O[Z-2]!==0){Z++;break}else if(Z<J-1&&O[Z+1]!==1){Z++;break}if(Q!==Z-2)W.push(O.subarray(Q,Z-2));do Z++;while(O[Z]!==1&&Z<J);Q=Z+1,Z=Q+2;break;case 1:if(O[Z-1]!==0||O[Z-2]!==0){Z+=3;break}if(Q!==Z-2)W.push(O.subarray(Q,Z-2));Q=Z+1,Z=Q+2;break;default:Z+=3;break}if(Q<J)W.push(O.subarray(Q));return W}},{key:"parseAvcC",value:function K(O){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;if(O.length<4)return;var G=O.length,J=[],Q=0,Z;while(Q+w<G){if(Z=l0(O,Q),w===3)Z>>>=8;if(Q+=w,!Z)continue;if(Q+Z>G)break;J.push(O.subarray(Q,Q+Z)),Q+=Z}return J}},{key:"parseSEI",value:function K(O,w){var G=O.length,J=w?2:1,Q=0,Z=0,W="";while(O[J]===255)Q+=255,J++;Q+=O[J++];while(O[J]===255)Z+=255,J++;if(Z+=O[J++],Q===5&&G>J+16)for(var X=0;X<16;X++)W+=O[J].toString(16),J++;return{payload:O.subarray(J,J+Z),type:Q,size:Z,uuid:W}}},{key:"removeEPB",value:function K(O){var w=O.byteLength,G=[],J=1;while(J<w-2)if(O[J]===0&&O[J+1]===0&&O[J+2]===3)G.push(J+2),J+=2;else J++;if(!G.length)return O;var Q=w-G.length,Z=new Uint8Array(Q),W=0;for(J=0;J<Q;W++,J++){if(W===G[0])W++,G.shift();Z[J]=O[W]}return Z}}]),Y}();var OO=function(){function Y(K){if(f(this,Y),b(this,"_bytesAvailable",void 0),b(this,"_bitsAvailable",0),b(this,"_word",0),!K)throw new Error("ExpGolomb data params is required");if(this._data=K,this._bytesAvailable=K.byteLength,this._bytesAvailable)this._loadWord()}return g(Y,[{key:"bitsAvailable",get:function K(){return this._bitsAvailable}},{key:"_loadWord",value:function K(){var O=this._data.byteLength-this._bytesAvailable,w=Math.min(4,this._bytesAvailable);if(w===0)throw new Error("No bytes available");var G=new Uint8Array(4);G.set(this._data.subarray(O,O+w)),this._word=new DataView(G.buffer).getUint32(0),this._bitsAvailable=w*8,this._bytesAvailable-=w}},{key:"skipBits",value:function K(O){if(this._bitsAvailable>O)this._word<<=O,this._bitsAvailable-=O;else{O-=this._bitsAvailable;var w=Math.floor(O/8);O-=w*8,this._bytesAvailable-=w,this._loadWord(),this._word<<=O,this._bitsAvailable-=O}}},{key:"readBits",value:function K(O){if(O>32)throw new Error("Cannot read more than 32 bits");var w=Math.min(this._bitsAvailable,O),G=this._word>>>32-w;if(this._bitsAvailable-=w,this._bitsAvailable>0)this._word<<=w;else if(this._bytesAvailable>0)this._loadWord();if(w=O-w,w>0&&this._bitsAvailable)return G<<w|this.readBits(w);return G}},{key:"skipLZ",value:function K(){var O;for(O=0;O<this._bitsAvailable;++O)if((this._word&2147483648>>>O)!==0)return this._word<<=O,this._bitsAvailable-=O,O;return this._loadWord(),O+this.skipLZ()}},{key:"skipUEG",value:function K(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function K(){var O=this.skipLZ();return this.readBits(O+1)-1}},{key:"readEG",value:function K(){var O=this.readUEG();if(1&O)return 1+O>>>1;return-1*(O>>>1)}},{key:"readBool",value:function K(){return this.readBits(1)===1}},{key:"readUByte",value:function K(){return this.readBits(8)}},{key:"skipScalingList",value:function K(O){var w=8,G=8,J;for(var Q=0;Q<O;Q++){if(G!==0)J=this.readEG(),G=(w+J+256)%256;w=G===0?w:G}}}]),Y}();var mw=function(){function Y(){f(this,Y)}return g(Y,null,[{key:"parseAVCDecoderConfigurationRecord",value:function K(O){if(O.length<7)return;var w=(O[4]&3)+1,G,J=[],Q=[],Z=6,W=O[5]&31,X;for(var U=0;U<W;U++){if(X=O[Z]<<8|O[Z+1],Z+=2,!X)continue;var D=O.subarray(Z,Z+X);if(Z+=X,J.push(D),!G)G=Y.parseSPS(E0.removeEPB(D))}var V=O[Z];Z++;var q;for(var L=0;L<V;L++){if(q=O[Z]<<8|O[Z+1],Z+=2,!q)continue;Q.push(O.subarray(Z,Z+q)),Z+=q}return{sps:G,spsArr:J,ppsArr:Q,nalUnitSize:w}}},{key:"parseSPS",value:function K(O){var w=new OO(O);w.readUByte();var G=w.readUByte(),J=w.readUByte(),Q=w.readUByte();w.skipUEG();var Z=420;if(G===100||G===110||G===122||G===244||G===44||G===83||G===86||G===118||G===128||G===138||G===144){var W=w.readUEG();if(W<=3)Z=[0,420,422,444][W];if(W===3)w.skipBits(1);if(w.skipUEG(),w.skipUEG(),w.skipBits(1),w.readBool()){var X=W!==3?8:12;for(var U=0;U<X;U++)if(w.readBool())if(U<6)w.skipScalingList(16);else w.skipScalingList(64)}}w.skipUEG();var D=w.readUEG();if(D===0)w.readUEG();else if(D===1){w.skipBits(1),w.skipUEG(),w.skipUEG();var V=w.readUEG();for(var q=0;q<V;q++)w.skipUEG()}w.skipUEG(),w.skipBits(1);var L=w.readUEG(),z=w.readUEG(),I=w.readBits(1);if(I===0)w.skipBits(1);w.skipBits(1);var E=0,S=0,x=0,C=0;if(w.readBool())E=w.readUEG(),S=w.readUEG(),x=w.readUEG(),C=w.readUEG();var R,v,_,t,P;if(w.readBool()){if(w.readBool()){var l=w.readUByte();switch(l){case 1:R=[1,1];break;case 2:R=[12,11];break;case 3:R=[10,11];break;case 4:R=[16,11];break;case 5:R=[40,33];break;case 6:R=[24,11];break;case 7:R=[20,11];break;case 8:R=[32,11];break;case 9:R=[80,33];break;case 10:R=[18,11];break;case 11:R=[15,11];break;case 12:R=[64,33];break;case 13:R=[160,99];break;case 14:R=[4,3];break;case 15:R=[3,2];break;case 16:R=[2,1];break;case 255:{R=[w.readUByte()<<8|w.readUByte(),w.readUByte()<<8|w.readUByte()];break}}}if(w.readBool())w.readBool();if(w.readBool()){if(w.readBits(4),w.readBool())w.readBits(24)}if(w.readBool())w.readUEG(),w.readUEG();if(w.readBool()){var Y0=w.readBits(32),H=w.readBits(32);v=w.readBool(),_=H,t=Y0*2,P=_/t}}return{codec:kw(O.subarray(1,4)),profileIdc:G,profileCompatibility:J,levelIdc:Q,chromaFormat:Z,width:Math.ceil((L+1)*16-2*(E+S)),height:(2-I)*(z+1)*16-(I?2:4)*(x+C),sarRatio:R,fpsNum:_,fpsDen:t,fps:P,fixedFrame:v}}}]),Y}();var pw=function(){function Y(){f(this,Y)}return g(Y,null,[{key:"parseHEVCDecoderConfigurationRecord",value:function K(O){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(O.length<23)return;w=w||{};var G=(O[21]&3)+1,J,Q,Z=[],W=[],X=[],U=23,D=O[22],V,q,L;for(var z=0;z<D;z++){V=O[U]&63,q=O[U+1]<<8|O[U+2],U+=3;for(var I=0;I<q;I++){if(L=O[U]<<8|O[U+1],U+=2,!L)continue;switch(V){case 32:{var E=O.subarray(U,U+L);if(!J)J=Y.parseVPS(E0.removeEPB(E),w);X.push(E)}break;case 33:{var S=O.subarray(U,U+L);if(!Q)Q=Y.parseSPS(E0.removeEPB(S),w);Z.push(S)}break;case 34:W.push(O.subarray(U,U+L));break}U+=L}}return{hvcC:w,sps:Q,spsArr:Z,ppsArr:W,vpsArr:X,nalUnitSize:G}}},{key:"parseVPS",value:function K(O,w){w=w||{};var G=new OO(O);G.readUByte(),G.readUByte(),G.readBits(12);var J=G.readBits(3);return w.numTemporalLayers=Math.max(w.numTemporalLayers||0,J+1),G.readBits(17),Y._parseProfileTierLevel(G,J,w),w}},{key:"parseSPS",value:function K(O){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w=w||{};var G=new OO(O);G.readUByte(),G.readUByte(),G.readBits(4);var J=G.readBits(3);w.numTemporalLayers=Math.max(J+1,w.numTemporalLayers||0),w.temporalIdNested=G.readBits(1),Y._parseProfileTierLevel(G,J,w),G.readUEG();var Q=w.chromaFormatIdc=G.readUEG(),Z=420;if(Q<=3)Z=[0,420,422,444][Q];var W=0;if(Q===3)W=G.readBits(1);var X=G.readUEG(),U=G.readUEG(),D=G.readBits(1),V,q,L,z;if(D===1)V=G.readUEG(),q=G.readUEG(),L=G.readUEG(),z=G.readUEG();if(w.bitDepthLumaMinus8=G.readUEG(),w.bitDepthChromaMinus8=G.readUEG(),D===1){var I=(Q===1||Q===2)&&W===0?2:1,E=Q===1&&W===0?2:1;X-=I*(q+V),U-=E*(z+L)}return{codec:"hev1.1.6.L93.B0",width:X,height:U,chromaFormat:Z,hvcC:w}}},{key:"_parseProfileTierLevel",value:function K(O,w,G){var J=G.generalTierFlag||0;G.generalProfileSpace=O.readBits(2),G.generalTierFlag=Math.max(O.readBits(1),J),G.generalProfileIdc=Math.max(O.readBits(5),G.generalProfileIdc||0),G.generalProfileCompatibilityFlags=O.readBits(32),G.generalConstraintIndicatorFlags=[O.readBits(8),O.readBits(8),O.readBits(8),O.readBits(8),O.readBits(8),O.readBits(8)];var Q=O.readBits(8);if(J<G.generalTierFlag)G.generalLevelIdc=Q;else G.generalLevelIdc=Math.max(Q,G.generalLevelIdc||0);var Z=[],W=[];if(w>O.bitsAvailable)throw new Error("maxSubLayersMinus inavlid size ".concat(w));for(var X=0;X<w;X++)Z[X]=O.readBits(1),W[X]=O.readBits(1);if(w>0)O.readBits((8-w)*2);for(var U=0;U<w;U++){if(Z[U]!==0)O.readBits(2),O.readBits(1),O.readBits(5),O.readBits(16),O.readBits(16),O.readBits(4),O.readBits(16),O.readBits(16),O.readBits(12);if(W[U]!==0)O.readBits(8)}}}]),Y}();var gO=function(){function Y(){f(this,Y)}return g(Y,null,[{key:"decode",value:function K(O){var w=[],G=O,J=0,Q=O.length;while(J<Q){if(G[J]<128){w.push(String.fromCharCode(G[J])),++J;continue}else if(G[J]<192);else if(G[J]<224){if(Y._checkContinuation(G,J,1)){var Z=(G[J]&31)<<6|G[J+1]&63;if(Z>=128){w.push(String.fromCharCode(Z&65535)),J+=2;continue}}}else if(G[J]<240){if(Y._checkContinuation(G,J,2)){var W=(G[J]&15)<<12|(G[J+1]&63)<<6|G[J+2]&63;if(W>=2048&&(W&63488)!==55296){w.push(String.fromCharCode(W&65535)),J+=3;continue}}}else if(G[J]<248){if(Y._checkContinuation(G,J,3)){var X=(G[J]&7)<<18|(G[J+1]&63)<<12|(G[J+2]&63)<<6|G[J+3]&63;if(X>65536&&X<1114112){X-=65536,w.push(String.fromCharCode(X>>>10|55296)),w.push(String.fromCharCode(X&1023|56320)),J+=4;continue}}}w.push(String.fromCharCode(65533)),++J}return w.join("")}},{key:"_checkContinuation",value:function K(O,w,G){var J=O;if(w+G<J.length){while(G--)if((J[++w]&192)!==128)return!1;return!0}else return!1}}]),Y}();var lw=function(){function Y(){f(this,Y)}return g(Y,null,[{key:"parse",value:function K(O){if(O.length<3)return;var w={},G=Y._parseValue(new DataView(O.buffer,O.byteOffset,O.byteLength)),J=Y._parseValue(new DataView(O.buffer,O.byteOffset+G.size,O.byteLength-G.size));return w[G.data]=J.data,w}},{key:"_parseValue",value:function K(O){var w=O.byteLength,G=O.getUint8(0),J=1,Q=!1,Z;switch(G){case 0:Z=O.getFloat64(1),J+=8;break;case 1:{Z=!!O.getUint8(1),J+=1;break}case 2:{var W=Y._parseString(new DataView(O.buffer,O.byteOffset+J,O.byteLength-J)),X=W.data,U=W.size;Z=X,J+=U}break;case 3:{Z={};var D=0;if((O.getUint32(w-4)&16777215)===9)D=3;while(J<w-4){var V=Y._parseObject(new DataView(O.buffer,O.byteOffset+J,O.byteLength-J-D)),q=V.size,L=V.data,z=V.isEnd;if(z)break;Z[L.name]=L.value,J+=q}if(J<=w-3){var I=O.getUint32(J-1)&16777215;if(I===9)J+=3}}break;case 8:{Z={},J+=4;var E=0;if((O.getUint32(w-4)&16777215)===9)E=3;while(J<w-8){var S=Y._parseObject(new DataView(O.buffer,O.byteOffset+J,O.byteLength-J-E)),x=S.size,C=S.data,R=S.isEnd;if(R)break;Z[C.name]=C.value,J+=x}if(J<=w-3){var v=O.getUint32(J-1)&16777215;if(v===9)J+=3}}break;case 9:Z=void 0,J=1,Q=!0;break;case 10:{Z=[];var _=O.getUint32(1);J+=4;for(var t=0;t<_;t++){var P=Y._parseValue(new DataView(O.buffer,O.byteOffset+J,O.byteLength-J)),l=P.data,Y0=P.size;Z.push(l),J+=Y0}}break;case 11:{var H=O.getFloat64(J)+O.getInt16(J+8)*60000;Z=new Date(H),J+=10}break;case 12:{var A=O.getUint32(1);if(J+=4,Z="",A>0)Z=gO.decode(new Uint8Array(O.buffer,O.byteOffset+J,A));J+=A}break;default:J=w;break}return{data:Z,size:J,isEnd:Q}}},{key:"_parseString",value:function K(O){var w=O.getUint16(0),G="";if(w>0)G=gO.decode(new Uint8Array(O.buffer,O.byteOffset+2,w));return{data:G,size:2+w}}},{key:"_parseObject",value:function K(O){if(O.byteLength<3)return;var w=Y._parseString(O),G=Y._parseValue(new DataView(O.buffer,O.byteOffset+w.size,O.byteLength-w.size));return{data:{name:w.data,value:G.data},size:w.size+G.size,isEnd:G.isEnd}}}]),Y}();var b0={MP3:2,G711A:7,G711M:8,AAC:10,OPUS:13};var I0=new g0("FlvDemuxer"),DO=function(){function Y(K,O,w){f(this,Y),b(this,"_headerParsed",!1),b(this,"_remainingData",null),b(this,"_gopId",0),b(this,"_needAddMetaBeforeKeyFrameNal",!0),this.videoTrack=K||new Ew,this.audioTrack=O||new Sw,this.metadataTrack=w||new yw,this._fixer=new xw(this.videoTrack,this.audioTrack,this.metadataTrack)}return g(Y,[{key:"demux",value:function K(O){var w,G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,J=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,Q=arguments.length>3?arguments[3]:void 0,Z=this.audioTrack,W=this.videoTrack,X=this.metadataTrack;if(G||!J)this._remainingData=null;if(G)this._headerParsed=!1;if(G)W.reset(),Z.reset(),X.reset();else if(W.samples=[],Z.samples=[],X.seiSamples=[],X.flvScriptSamples=[],W.warnings=[],Z.warnings=[],this._remainingData)O=A0(this._remainingData,O),this._remainingData=null;if(!O.length)return{videoTrack:W,audioTrack:Z,metadataTrack:X};var U=0;if(!this._headerParsed){if(!Y.probe(O))throw new Error("Invalid flv file");Z.present=(O[4]&4)>>>2!==0,W.present=(O[4]&1)!==0,this._headerParsed=!0,U=l0(O,5)+4}var D=O.length,V,q,L,z,I;while(U+15<D){if(V=O[U],q=O[U+1]<<16|O[U+2]<<8|O[U+3],U+15+q>D)break;if(L=(O[U+7]<<24>>>0)+(O[U+4]<<16)+(O[U+5]<<8)+O[U+6],U+=11,z=O.subarray(U,U+q),V===8)this._parseAudio(z,L);else if(V===9){if(Q)this.seamlessLoadingSwitching=!0;this._parseVideo(z,L)}else if(V===18)this._parseScript(z,L);else I0.warn("Invalid tag type: ".concat(V));if(U+=q,I=l0(O,U),I!==11+q)I0.warn("Invalid PrevTagSize ".concat(I," (").concat(11+q,")"));U+=4}if(U<D)this._remainingData=O.subarray(U);if(Z.formatTimescale=W.formatTimescale=W.timescale=X.timescale=1000,Z.timescale=Z.codecType===s.OPUS?1000:Z.sampleRate||0,!Z.exist()&&Z.hasSample())Z.reset();if(!W.exist()&&W.hasSample())W.reset();var E=X.flvScriptSamples[X.flvScriptSamples.length-1],S=E===null||E===void 0?void 0:(w=E.data)===null||w===void 0?void 0:w.onMetaData;if(S){if(W!==null&&W!==void 0&&W.exist()){if(S.hasOwnProperty("duration"))W.duration=S.duration*1000;if(S.hasOwnProperty("width")&&S.hasOwnProperty("height"))W.width=S.width,W.height=S.height}if(Z!==null&&Z!==void 0&&Z.exist()){if(S.hasOwnProperty("duration"))Z.duration=S.duration*1000}}return{videoTrack:W,audioTrack:Z,metadataTrack:X}}},{key:"fix",value:function K(O,w,G){return this._fixer.fix(O,w,G),{videoTrack:this.videoTrack,audioTrack:this.audioTrack,metadataTrack:this.metadataTrack}}},{key:"demuxAndFix",value:function K(O,w,G,J,Q){return this.demux(O,w,G,Q),this.fix(J,w,G)}},{key:"_parseAudio",value:function K(O,w){if(!O.length)return;var G=(O[0]&240)>>>4,J=this.audioTrack;if(G!==b0.AAC&&G!==b0.G711A&&G!==b0.G711M&&G!==b0.OPUS){I0.warn("Unsupported sound format: ".concat(G)),J.reset();return}if(G!==b0.AAC&&G!==b0.OPUS){var Q=(O[0]&12)>>2,Z=(O[0]&2)>>1,W=O[0]&1;J.sampleRate=Y.AUDIO_RATE[Q],J.sampleSize=Z?16:8,J.channelCount=W+1}switch(G){case b0.G711A:case b0.G711M:this._parseG711(O,w,G);break;case b0.AAC:this._parseAac(O,w);break;case b0.OPUS:this._parseOpus(O,w);break}}},{key:"_parseOpus",value:function K(O,w){var G=this.audioTrack,J=O[1];switch(G.codecType=s.OPUS,J){case 0:{var Q=e0.parseHeaderPackets(O.subarray(2));if(Q)G.codec=Q.codec,G.channelCount=Q.channelCount,G.sampleRate=Q.sampleRate,G.config=Q.config,G.sampleDuration=e0.getFrameDuration([],G.timescale);else G.reset(),I0.warn("Cannot parse AudioSpecificConfig",O);break}case 1:{if(w===void 0||w===null)return;var Z=new m0(w,O.subarray(2),G.sampleDuration);G.samples.push(Z);break}default:I0.warn("Unknown OpusPacketType: ".concat(J))}}},{key:"_parseG711",value:function K(O,w,G){var J=this.audioTrack,Q=O.subarray(1);if(Q.byteLength<1)return;var Z=new m0(w,Q);J.codecType=G===7?s.G711PCMA:s.G711PCMU,J.sampleRate=8000,J.codec=J.codecType,J.samples.push(Z)}},{key:"_parseAac",value:function K(O,w){var G=this.audioTrack;if(G.codecType=s.AAC,O[1]===0){var J=p0.parseAudioSpecificConfig(O.subarray(2));if(J)G.codec=J.codec,G.channelCount=J.channelCount,G.sampleRate=J.sampleRate,G.config=J.config,G.objectType=J.objectType,G.sampleRateIndex=J.samplingFrequencyIndex;else G.reset(),I0.warn("Cannot parse AudioSpecificConfig",O)}else if(O[1]===1){if(w===void 0||w===null)return;G.samples.push(new m0(w,O.subarray(2)))}else I0.warn("Unknown AACPacketType: ".concat(O[1]))}},{key:"_parseVideo",value:function K(O,w){var G=this;if(O.length<6)return;var J=(O[0]&240)>>>4,Q=O[0]&15,Z=this.videoTrack;if(Q!==7&&Q!==12){Z.reset(),I0.warn("Unsupported codecId: ".concat(Q));return}var W=Q===12;Z.codecType=W?R0.HEVC:R0.AVC;var X=O[1],U=(O[2]<<16|O[3]<<8|O[4])<<8>>8;if(X===0){var D=O.subarray(5),V=W?pw.parseHEVCDecoderConfigurationRecord(D):mw.parseAVCDecoderConfigurationRecord(D);if(V){var{hvcC:q,sps:L,ppsArr:z,spsArr:I,vpsArr:E,nalUnitSize:S}=V;if(q)Z.hvcC=Z.hvcC||q;if(L)Z.codec=L.codec,Z.width=L.width,Z.height=L.height,Z.sarRatio=L.sarRatio,Z.fpsNum=L.fpsNum,Z.fpsDen=L.fpsDen;if(I.length)Z.sps=I;if(z.length)Z.pps=z;if(E&&E.length)Z.vps=E;if(S)Z.nalUnitSize=S}else I0.warn("Cannot parse ".concat(W?"HEVC":"AVC","DecoderConfigurationRecord"),O)}else if(X===1){var x=E0.parseAvcC(O.subarray(5),Z.nalUnitSize);if(x=this._checkAddMetaNalToUnits(W,x,Z),x&&x.length){var C=new $w(w+U,w,x);if(this.seamlessLoadingSwitching&&w<Z.lastKeyFrameDts)return;if(this.seamlessLoadingSwitching=!1,J===1)C.setToKeyframe(),Z.lastKeyFrameDts=w;if(Z.samples.push(C),x.forEach(function(R){var v=W?R[0]>>>1&63:R[0]&31;switch(v){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!W&&v!==5||W&&v===5)break;C.setToKeyframe();break;case 6:case 39:case 40:if(!W&&v!==6||W&&v===6)break;G.metadataTrack.seiSamples.push(new Mw(E0.parseSEI(E0.removeEPB(R),W),w+U));break}}),C.keyframe)this._gopId++;C.gopId=this._gopId}else I0.warn("Cannot parse NALUs",O)}else if(X===2);else I0.warn("Unknown AVCPacketType: ".concat(X))}},{key:"_checkAddMetaNalToUnits",value:function K(O,w,G){if(!O||!this._needAddMetaBeforeKeyFrameNal)return this._needAddMetaBeforeKeyFrameNal=!1,w;var J=w.map(function(Q){return Q[0]>>>1&63});if(J.includes(32))return this._needAddMetaBeforeKeyFrameNal=!1,w;return w.unshift(G.pps[0]),w.unshift(G.sps[0]),w.unshift(G.vps[0]),w.filter(Boolean)}},{key:"_parseScript",value:function K(O,w){this.metadataTrack.flvScriptSamples.push(new vw(lw.parse(O),w))}}],[{key:"probe",value:function K(O){if(O[0]!==70||O[1]!==76||O[2]!==86||O[3]!==1)return!1;return l0(O,5)>=9}}]),Y}();b(DO,"AUDIO_RATE",[5500,11000,22000,44000]);function u1(Y){var K=0;for(var O=arguments.length,w=new Array(O>1?O-1:0),G=1;G<O;G++)w[G-1]=arguments[G];w.forEach(function(Z){K+=Z.length});var J=new Y(K),Q=0;return w.forEach(function(Z){J.set(Z,Q),Q+=Z.length}),J}var J0=function(){function Y(){f(this,Y),this.buffer=new Uint8Array(0)}return g(Y,[{key:"write",value:function K(){var O=this;for(var w=arguments.length,G=new Array(w),J=0;J<w;J++)G[J]=arguments[J];G.forEach(function(Q){if(Q)O.buffer=u1(Uint8Array,O.buffer,Q);else window.console.warn(Q)})}}],[{key:"writeUint16",value:function K(O){return new Uint8Array([O>>8&255,O&255])}},{key:"writeUint32",value:function K(O){return new Uint8Array([O>>24,O>>16&255,O>>8&255,O&255])}}]),Y}();var nw=Math.pow(2,32)-1,h=function(){function Y(){f(this,Y)}return g(Y,null,[{key:"box",value:function K(O){for(var w=arguments.length,G=new Array(w>1?w-1:0),J=1;J<w;J++)G[J-1]=arguments[J];G=G.filter(Boolean);var Q=8+G.reduce(function(X,U){return X+U.byteLength},0),Z=new Uint8Array(Q);Z[0]=Q>>24&255,Z[1]=Q>>16&255,Z[2]=Q>>8&255,Z[3]=Q&255,Z.set(O,4);var W=8;return G.forEach(function(X){Z.set(X,W),W+=X.byteLength}),Z}},{key:"ftyp",value:function K(O){var w=O.find(function(G){return G.type===j0.VIDEO&&G.codecType===R0.HEVC});return w?Y.FTYPHEV1:Y.FTYPAVC1}},{key:"initSegment",value:function K(O){var w=Y.ftyp(O),G=A0(w,Y.moov(O));return G}},{key:"pssh",value:function K(O){var w=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],fO(O.kid),[0,0,0,0]));return Y.box(Y.types.pssh,w)}},{key:"moov",value:function K(O){if(O[0].useEME&&(O[0].encv||O[0].enca)){if(!O[0].pssh)O[0].pssh={kid:O[0].kid};var w=this.pssh(O[0].pssh);return Y.box.apply(Y,[Y.types.moov,Y.mvhd(O[0].mvhdDurtion||O[0].duration,O[0].mvhdTimecale||O[0].timescale),Y.mvex(O)].concat(L0(O.map(function(G){return Y.trak(G)})),[w]))}else return Y.box.apply(Y,[Y.types.moov,Y.mvhd(O[0].mvhdDurtion||O[0].duration,O[0].mvhdTimecale||O[0].timescale)].concat(L0(O.map(function(G){return Y.trak(G)})),[Y.mvex(O)]))}},{key:"mvhd",value:function K(O){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:90000,G=Y.box(Y.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,w>>24&255,w>>16&255,w>>8&255,w&255,O>>24&255,O>>16&255,O>>8&255,O&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]));return G}},{key:"trak",value:function K(O){var w=Y.box(Y.types.trak,Y.tkhd(O.id,O.tkhdDuration||0,O.width,O.height),Y.mdia(O));return w}},{key:"tkhd",value:function K(O,w){var G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,J=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,Q=Y.box(Y.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,O>>24&255,O>>16&255,O>>8&255,O&255,0,0,0,0,w>>24&255,w>>16&255,w>>8&255,w&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,G>>8&255,G&255,0,0,J>>8&255,J&255,0,0]));return Q}},{key:"mdia",value:function K(O){var w=Y.box(Y.types.mdia,Y.mdhd(O.duration,O.timescale),Y.hdlr(O.type),Y.minf(O));return w}},{key:"mdhd",value:function K(O){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:90000,G=Y.box(Y.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,w>>24&255,w>>16&255,w>>8&255,w&255,O>>24&255,O>>16&255,O>>8&255,O&255,85,196,0,0]));return G}},{key:"hdlr",value:function K(O){var w=Y.box(Y.types.hdlr,Y.HDLR_TYPES[O]);return w}},{key:"minf",value:function K(O){var w=Y.box(Y.types.minf,O.type===j0.VIDEO?Y.VMHD:Y.SMHD,Y.DINF,Y.stbl(O));return w}},{key:"stbl",value:function K(O){var w=[];if(O&&O.ext)O.ext.stss&&w.push(Y.stss(O.ext.stss.entries));var G=Y.box(Y.types.stbl,Y.stsd(O),Y.STTS,w[0],Y.STSC,Y.STSZ,Y.STCO);return G}},{key:"stsd",value:function K(O){var w;if(O.type==="audio")if(O.useEME&&O.enca)w=Y.enca(O);else if(O.codecType===s.OPUS)w=Y.opus(O);else w=Y.mp4a(O);else if(O.useEME&&O.encv)w=Y.encv(O);else if(O.av1C)w=Y.av01(O);else w=Y.avc1hev1(O);var G=Y.box(Y.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),w);return G}},{key:"enca",value:function K(O){var w=O.enca.channelCount,G=O.enca.sampleRate,J=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,w,0,16,0,0,0,0,G>>8&255,G&255,0,0]),Q=Y.esds(O.config),Z=Y.sinf(O.enca);return Y.box(Y.types.enca,J,Q,Z)}},{key:"encv",value:function K(O){var w,G,J=O.sps.length>0?O.sps[0]:[],Q=O.pps.length>0?O.pps[0]:[],Z=O.width,W=O.height,X=O.sarRatio[0],U=O.sarRatio[1],D=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,Z>>8&255,Z&255,W>>8&255,W&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),V=new Uint8Array((w=(G=[1,J[1],J[2],J[3],255,225,J.length>>>8&255,J.length&255]).concat.apply(G,L0(J)).concat([1,Q.length>>>8&255,Q.length&255])).concat.apply(w,L0(Q))),q=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),L=Y.sinf(O.encv),z=new Uint8Array([X>>24,X>>16&255,X>>8&255,X&255,U>>24,U>>16&255,U>>8&255,U&255]);return Y.box(Y.types.encv,D,Y.box(Y.types.avcC,V),Y.box(Y.types.btrt,q),L,Y.box(Y.types.pasp,z))}},{key:"schi",value:function K(O){var w=new Uint8Array([]),G=Y.tenc(O);return Y.box(Y.types.schi,w,G)}},{key:"tenc",value:function K(O){var w=new Uint8Array([0,0,0,0,0,0,O.default_IsEncrypted&255,O.default_IV_size&255].concat(fO(O.default_KID)));return Y.box(Y.types.tenc,w)}},{key:"sinf",value:function K(O){var w=new Uint8Array([]),G=new Uint8Array([O.data_format.charCodeAt(0),O.data_format.charCodeAt(1),O.data_format.charCodeAt(2),O.data_format.charCodeAt(3)]),J=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),Q=Y.schi(O);return Y.box(Y.types.sinf,w,Y.box(Y.types.frma,G),Y.box(Y.types.schm,J),Q)}},{key:"av01",value:function K(O){return Y.box(Y.types.av01,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,O.width>>8&255,O.width&255,O.height>>8&255,O.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),O.av1C,O.colr)}},{key:"avc1hev1",value:function K(O){var w=O.codecType===R0.HEVC,G=w?Y.types.hvc1:Y.types.avc1,J=w?Y.hvcC(O):Y.avcC(O),Q=[new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,O.width>>8&255,O.width&255,O.height>>8&255,O.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),J];if(w)Q.push(Y.box(Y.types.fiel,new Uint8Array([1,0])));else if(O.sarRatio&&O.sarRatio.length>1)Q.push(Y.pasp(O.sarRatio));return Y.box.apply(Y,[G].concat(Q))}},{key:"avcC",value:function K(O){var w,G,J=[],Q=[],Z;return O.sps.forEach(function(W){Z=W.byteLength,J.push(Z>>>8&255),J.push(Z&255),J.push.apply(J,L0(W))}),O.pps.forEach(function(W){Z=W.byteLength,Q.push(Z>>>8&255),Q.push(Z&255),Q.push.apply(Q,L0(W))}),Y.box(Y.types.avcC,new Uint8Array((w=(G=[1,J[3],J[4],J[5],255,224|O.sps.length]).concat.apply(G,J).concat([O.pps.length])).concat.apply(w,Q)))}},{key:"hvcC",value:function K(O){var w=O.hvcC;if(w instanceof ArrayBuffer||w instanceof Uint8Array)return w;var{vps:G,sps:J,pps:Q}=O,Z;if(w){var{generalProfileCompatibilityFlags:W,generalConstraintIndicatorFlags:X}=w,U=(G.length&&1)+(J.length&&1)+(Q.length&&1);Z=[1,w.generalProfileSpace<<6|w.generalTierFlag<<5|w.generalProfileIdc,W>>>24,W>>>16,W>>>8,W,X[0],X[1],X[2],X[3],X[4],X[5],w.generalLevelIdc,240,0,252,w.chromaFormatIdc|252,w.bitDepthLumaMinus8|248,w.bitDepthChromaMinus8|248,0,0,w.numTemporalLayers<<3|w.temporalIdNested<<2|3,U];var D=function V(q){var L;Z.push(q.length>>8,q.length),(L=Z).push.apply(L,L0(q))};if(G.length)Z.push(160,0,G.length),G.forEach(D);if(J.length)Z.push(161,0,J.length),J.forEach(D);if(Q.length)Z.push(162,0,Q.length),Q.forEach(D)}else Z=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return Y.box(Y.types.hvcC,new Uint8Array(Z))}},{key:"pasp",value:function K(O){var w=zw(O,2),G=w[0],J=w[1];return Y.box(Y.types.pasp,new Uint8Array([G>>24,G>>16&255,G>>8&255,G&255,J>>24,J>>16&255,J>>8&255,J&255]))}},{key:"mp4a",value:function K(O){return Y.box(Y.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,O.channelCount,0,16,0,0,0,0,O.sampleRate>>8&255,O.sampleRate&255,0,0]),O.config.length?Y.esds(O.config):void 0)}},{key:"esds",value:function K(O){var w=O.length,G=Y.box(Y.types.esds,new Uint8Array([0,0,0,0,3,23+w,0,0,0,4,15+w,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([w]).concat(O).concat([6,1,2])));return G}},{key:"opus",value:function K(O){var w=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,O.channelCount,0,16,0,0,0,0,O.sampleRate>>8&255,O.sampleRate&255,0,0]),G=O.config.length?Y.dOps(O):[];return Y.box(Y.types.Opus,w,G)}},{key:"dOps",value:function K(O){if(O.config)return O.config[4]=O.sampleRate>>>24&255,O.config[5]=O.sampleRate>>>16&255,O.config[6]=O.sampleRate>>>8&255,O.config[7]=O.sampleRate&255,Y.box(Y.types.dOps,O.config)}},{key:"mvex",value:function K(O){var w=Y.box.apply(Y,[Y.types.mvex].concat(L0(O.map(function(G){return Y.trex(G.id)}))));return w}},{key:"trex",value:function K(O){var w=Y.box(Y.types.trex,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]));return w}},{key:"trex1",value:function K(O){var w=Y.box(Y.types.trex,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]));return w}},{key:"trex2",value:function K(O){var w=Y.box(Y.types.trex,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]));return w}},{key:"moof",value:function K(O){var w=Y.box.apply(Y,[Y.types.moof,Y.mfhd(O[0].samples?O[0].samples[0].gopId:0)].concat(L0(O.map(function(G){return Y.traf(G)}))));return w}},{key:"mfhd",value:function K(O){var w=Y.box(Y.types.mfhd,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255]));return w}},{key:"traf",value:function K(O){var w=Y.tfhd(O.id),G=Y.tfdt(O,O.baseMediaDecodeTime),J=0,Q;if(O.isVideo&&O.videoSenc)Q=O.videoSenc,Q.forEach(function(A){if(J=J+8,A.subsamples&&A.subsamples.length)J=J+2,J=J+A.subsamples.length*6});if(O.videoSencLength=J,!O.useEME||!O.isVideoEncryption&&!O.isAudioEncryption){var Z=Y.sdtp(O),W=76;return Y.box(Y.types.traf,w,G,Z,Y.trun(O.samples,Z.byteLength+W))}else if(O.isVideoEncryption)if(O.isVideo){var X=Y.saiz(O),U=Y.saio(O),D=Y.trun1(O),V=Y.senc(O),q=Y.box(Y.types.traf,w,G,X,U,D,V);return q}else if(!O.isAudioEncryption){var L=Y.sbgp(),z=Y.trun1(O);return Y.box(Y.types.traf,w,G,L,z)}else{var I=Y.sbgp(),E=Y.saiz(O),S=Y.saio(O),x=Y.senc(O),C=Y.trun1(O),R=Y.box(Y.types.traf,w,G,I,E,S,x,C);return R}else if(O.isVideo){var v=Y.trun1(O);return Y.box(Y.types.traf,w,G,v)}else{var _=Y.sbgp(),t=Y.saiz(O),P=Y.saio(O),l=Y.senc(O),Y0=Y.trun1(O),H=Y.box(Y.types.traf,w,G,_,t,P,l,Y0);return H}}},{key:"sdtp",value:function K(O){var w=new J0;return O.samples.forEach(function(G){w.write(new Uint8Array(O.isVideo?[G.keyframe?32:16]:[16]))}),Y.box(Y.types.sdtp,this.extension(0,0),w.buffer)}},{key:"trun1",value:function K(O){var w=new J0,G=J0.writeUint32(O.samples.length),J=null;if(O.isVideo){var Q=O.videoSencLength;if(J=J0.writeUint32(O.samples.length*16+Q+149),!O.isVideoEncryption&&O.isAudioEncryption)J=J0.writeUint32(O.samples.length*16+92)}else{var Z=O.samples.length*12+124;if(O.isAudioEncryption)Z=O.samples.length*12+8*O.audioSenc.length+177;J=J0.writeUint32(Z)}return O.samples.forEach(function(W){if(w.write(J0.writeUint32(W.duration)),w.write(J0.writeUint32(W.size)),w.write(J0.writeUint32(W.keyframe?33554432:65536)),O.isVideo)w.write(J0.writeUint32(W.cts?W.cts:0))}),Y.box(Y.types.trun,this.extension(0,O.flags),G,J,w.buffer)}},{key:"senc",value:function K(O){var w=new J0,G=O.samples.length,J=O.isVideo?16:8,Q=O.isVideo?2:0,Z=[],W=0;if(O.isVideo)Z=O.videoSenc,W=O.videoSencLength;else Z=O.audioSenc;return W=W||J*G,w.write(J0.writeUint32(16+W),Y.types.senc,this.extension(0,Q)),w.write(J0.writeUint32(G)),Z.forEach(function(X){for(var U=0;U<X.InitializationVector.length;U++)w.write(new Uint8Array([X.InitializationVector[U]]));if(X.subsamples&&X.subsamples.length)w.write(J0.writeUint16(X.subsamples.length)),X.subsamples.forEach(function(D){w.write(J0.writeUint16(D.BytesOfClearData)),w.write(J0.writeUint32(D.BytesOfProtectedData))})}),w.buffer}},{key:"saio",value:function K(O){var w=O.samples.length*12+141;if(!O.isVideo&&O.isAudioEncryption)w=149;var G=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,w>>24&255,w>>16&255,w>>8&255,w&255]);return Y.box(Y.types.saio,G)}},{key:"saiz",value:function K(O){var w=O.samples.length,G=new Uint8Array([0,0,0,0,16,w>>24&255,w>>16&255,w>>8&255,w&255]);return Y.box(Y.types.saiz,G)}},{key:"sbgp",value:function K(){var O=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return Y.box(Y.types.sbgp,this.extension(0,0),O)}},{key:"extension",value:function K(O,w){return new Uint8Array([O,w>>16&255,w>>8&255,w&255])}},{key:"tfhd",value:function K(O){return Y.box(Y.types.tfhd,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255]))}},{key:"tfdt",value:function K(O,w){var G=Math.floor(w/(nw+1)),J=Math.floor(w%(nw+1));if(O.useEME&&(O.isVideoEncryption||O.isAudioEncryption))return Y.box(Y.types.tfdt,new Uint8Array([0,0,0,0,J>>24,J>>16&255,J>>8&255,J&255]));else return Y.box(Y.types.tfdt,new Uint8Array([1,0,0,0,G>>24,G>>16&255,G>>8&255,G&255,J>>24,J>>16&255,J>>8&255,J&255]))}},{key:"trun",value:function K(O,w){var G=O.length,J=12+16*G;w+=8+J;var Q=new Uint8Array(J);Q.set([0,0,15,1,G>>>24&255,G>>>16&255,G>>>8&255,G&255,w>>>24&255,w>>>16&255,w>>>8&255,w&255],0);for(var Z=0;Z<G;Z++){var W=O[Z],X=W.duration,U=W.size,D=W.flag,V=D===void 0?{}:D,q=W.cts,L=q===void 0?0:q;Q.set([X>>>24&255,X>>>16&255,X>>>8&255,X&255,U>>>24&255,U>>>16&255,U>>>8&255,U&255,V.isLeading<<2|(V.dependsOn===null||V.dependsOn===void 0?1:V.dependsOn),V.isDependedOn<<6|V.hasRedundancy<<4|V.paddingValue<<1|(V.isNonSyncSample===null||V.isNonSyncSample===void 0?1:V.isNonSyncSample),V.degradationPriority&61440,V.degradationPriority&15,L>>>24&255,L>>>16&255,L>>>8&255,L&255],12+16*Z)}return Y.box(Y.types.trun,Q)}},{key:"moovMP4",value:function K(O){return Y.box.apply(Y,[Y.types.moov,Y.mvhd(O[0].duration,O[0].timescale)].concat(L0(O.map(function(w){return Y.trackMP4(w)}))))}},{key:"trackMP4",value:function K(O){return Y.box(Y.types.trak,Y.tkhd(O.id,O.duration,O.width,O.height),Y.mdiaMP4(O))}},{key:"mdiaMP4",value:function K(O){return Y.box(Y.types.mdia,Y.mdhd(O.duration,O.timescale),Y.hdlr(O.type),Y.minfMP4(O))}},{key:"minfMP4",value:function K(O){return Y.box(Y.types.minf,O.type===j0.VIDEO?Y.VMHD:Y.SMHD,Y.DINF,Y.stblMP4(O))}},{key:"stblMP4",value:function K(O){var w=O.ext,G=[Y.stsd(O),Y.stts(w.stts),Y.stsc(w.stsc),Y.stsz(w.stsz),Y.stco(w.stco)];if(w.stss.length)G.push(Y.stss(w.stss));if(w.ctts.length)G.push(Y.ctts(w.ctts));return Y.box.apply(Y,[Y.types.stbl].concat(G))}},{key:"stts",value:function K(O){var w=O.length,G=new Uint8Array(8*w),J=0;return O.forEach(function(Q){var{value:Z,count:W}=Q;G.set([W>>24,W>>16&255,W>>8&255,W&255,Z>>24,Z>>16&255,Z>>8&255,Z&255],J),J+=8}),Y.box(Y.types.stts,A0(new Uint8Array([0,0,0,0,w>>24,w>>16&255,w>>8&255,w&255]),G))}},{key:"stsc",value:function K(O){var w=O.length,G=new Uint8Array(12*w),J=0;return O.forEach(function(Q){var{firstChunk:Z,samplesPerChunk:W,sampleDescIndex:X}=Q;G.set([Z>>24,Z>>16&255,Z>>8&255,Z&255,W>>24,W>>16&255,W>>8&255,W&255,X>>24,X>>16&255,X>>8&255,X&255],J),J+=12}),Y.box(Y.types.stsc,A0(new Uint8Array([0,0,0,0,w>>24,w>>16&255,w>>8&255,w&255]),G))}},{key:"stsz",value:function K(O){var w=O.length,G=new Uint8Array(4*w),J=0;return O.forEach(function(Q){G.set([Q>>24,Q>>16&255,Q>>8&255,Q&255],J),J+=4}),Y.box(Y.types.stsz,A0(new Uint8Array([0,0,0,0,0,0,0,0,w>>24,w>>16&255,w>>8&255,w&255]),G))}},{key:"stco",value:function K(O){var w=O.length,G=new Uint8Array(4*w),J=0;return O.forEach(function(Q){G.set([Q>>24,Q>>16&255,Q>>8&255,Q&255],J),J+=4}),Y.box(Y.types.stco,A0(new Uint8Array([0,0,0,0,w>>24,w>>16&255,w>>8&255,w&255]),G))}},{key:"stss",value:function K(O){var w=O.length,G=new Uint8Array(4*w),J=0;return O.forEach(function(Q){G.set([Q>>24,Q>>16&255,Q>>8&255,Q&255],J),J+=4}),Y.box(Y.types.stss,A0(new Uint8Array([0,0,0,0,w>>24,w>>16&255,w>>8&255,w&255]),G))}},{key:"ctts",value:function K(O){var w=O.length,G=new Uint8Array(8*w),J=0;return O.forEach(function(Q){var{value:Z,count:W}=Q;G.set([W>>24,W>>16&255,W>>8&255,W&255,Z>>24,Z>>16&255,Z>>8&255,Z&255],J),J+=8}),Y.box(Y.types.ctts,A0(new Uint8Array([0,0,0,0,w>>24,w>>16&255,w>>8&255,w&255]),G))}},{key:"styp",value:function K(){return Y.box(Y.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function K(O){var w=O.timescale,G=O.samples[0].duration,J=G*O.samples.length,Q=O.samples[0].sampleOffset*G,Z=8;O.samples.forEach(function(V){Z+=V.size});var W=0;if(O.isVideo){var X=0,U;if(O.videoSenc)U=O.videoSenc;if(O.isVideo)U.forEach(function(V){if(X=X+8,V.subsamples&&V.subsamples.length)X=X+2,X=X+V.subsamples.length*6});if(O.videoSencLength=X,W=Z+141+O.samples.length*16+X,O.useEME&&O.isAudioEncryption&&!O.isVideoEncryption)W=Z+O.samples.length*16+84}else if(W=Z+116+O.samples.length*12,O.useEME&&O.isAudioEncryption)W=Z+169+O.samples.length*12+8*O.audioSenc.length;var D=new Uint8Array([0,0,0,0,0,0,0,O.id&255,w>>24&255,w>>16&255,w>>8&255,w&255,Q>>24&255,Q>>16&255,Q>>8&255,Q&255,0,0,0,0,0,0,0,1,0,W>>16&255,W>>8&255,W&255,J>>24&255,J>>16&255,J>>8&255,J&255,144,0,0,0]);return Y.box(Y.types.sidx,D)}},{key:"mdat",value:function K(O){var w=Y.box(Y.types.mdat,O);return w}}]),Y}();b(h,"types",["Opus","dOps","av01","av1C","avc1","avcC","hvc1","hvcC","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp"].reduce(function(Y,K){return Y[K]=[K.charCodeAt(0),K.charCodeAt(1),K.charCodeAt(2),K.charCodeAt(3)],Y},Object.create(null)));b(h,"HDLR_TYPES",{video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])});b(h,"FTYPAVC1",h.box(h.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49])));b(h,"FTYPHEV1",h.box(h.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49])));b(h,"DINF",h.box(h.types.dinf,h.box(h.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]))));b(h,"VMHD",h.box(h.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])));b(h,"SMHD",h.box(h.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0])));b(h,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0]));b(h,"STTS",h.box(h.types.stts,h.StblTable));b(h,"STSC",h.box(h.types.stsc,h.StblTable));b(h,"STSZ",h.box(h.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0])));b(h,"STCO",h.box(h.types.stco,h.StblTable));var hO=function(){function Y(K,O){f(this,Y),this.name=K||"",this._prefix="[".concat(this.name,"]"),Y.disabled=O}return g(Y,[{key:"debug",value:function K(){var O;if(Y.disabled)return;for(var w=arguments.length,G=new Array(w),J=0;J<w;J++)G[J]=arguments[J];(O=console).debug.apply(O,[this._prefix].concat(G))}},{key:"log",value:function K(){var O;if(Y.disabled)return;for(var w=arguments.length,G=new Array(w),J=0;J<w;J++)G[J]=arguments[J];(O=console).log.apply(O,[this._prefix].concat(G))}},{key:"warn",value:function K(){var O;if(Y.disabled)return;for(var w=arguments.length,G=new Array(w),J=0;J<w;J++)G[J]=arguments[J];(O=console).warn.apply(O,[this._prefix].concat(G))}},{key:"error",value:function K(){var O;if(Y.disabled)return;for(var w=arguments.length,G=new Array(w),J=0;J<w;J++)G[J]=arguments[J];(O=console).error.apply(O,[this._prefix].concat(G))}},{key:"table",value:function K(){var O;if(Y.disabled)return;console.group(this._prefix),(O=console).table.apply(O,arguments),console.groupEnd()}}],[{key:"enable",value:function K(){Y.disabled=!1}},{key:"disable",value:function K(){Y.disabled=!0}}]),Y}();b(hO,"disabled",!0);var xO=function(){function Y(K,O,w){f(this,Y),this.videoTrack=K,this.audioTrack=O;var G=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=G&&Number(G[1])<50,this.log=new hO("FMP4Remuxer",w&&w.openLog?!w.openLog:!0)}return g(Y,[{key:"remux",value:function K(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},G=this.videoTrack,J=this.audioTrack,Q=G.exist(),Z=J.exist(),W,X,U,D=[];if(O)if(w&&w.initMerge){if(Q)D.push(this.videoTrack);if(Z)D.push(this.audioTrack);U=h.initSegment(D)}else{if(Q)W=h.initSegment([this.videoTrack]);if(Z)X=h.initSegment([this.audioTrack])}var V,q;if(Q&&G.hasSample())V=this._remuxVideo();if(Z&&J.hasSample())q=this._remuxAudio();return G.samples=[],J.samples=[],{initSegment:U,videoInitSegment:W,audioInitSegment:X,videoSegment:V,audioSegment:q}}},{key:"_remuxVideo",value:function K(){var O=this.videoTrack;if(this.forceFirstIDR)O.samples[0].flag={dependsOn:2,isNonSyncSample:0};var w=O.samples,G=/av01/.test(O.codec),J=0;if(G)w.forEach(function(x){J+=x.data.byteLength});else w.forEach(function(x){J+=x.units.reduce(function(C,R){return C+R.byteLength},0),J+=x.units.length*4});var Q=new Uint8Array(J);if(G)for(var Z=0,W=w.length,X=0,U;Z<W;Z++)U=w[Z],Q.set(U.data,X),U.size=U.data.byteLength,X+=U.size;else{var D=new DataView(Q.buffer),V=function x(C,R){R=w[q];var v=0;R.units.forEach(function(_){D.setUint32(C,_.byteLength),C+=4,Q.set(_,C),C+=_.byteLength,v+=4+_.byteLength}),R.size=v,z=C,I=R};for(var q=0,L=w.length,z=0,I;q<L;q++)V(z,I)}var E=h.mdat(Q),S=h.moof([O]);return A0(S,E)}},{key:"_remuxAudio",value:function K(){var O=this.audioTrack,w=new Uint8Array(O.samples.reduce(function(Q,Z){return Q+Z.size},0));O.samples.reduce(function(Q,Z){return w.set(Z.data,Q),Q+Z.size},0);var G=h.mdat(w),J=h.moof([O]);return A0(J,G)}},{key:"reset",value:function K(){this.videoTrack.reset(),this.audioTrack.reset()}}]),Y}();var ow=function(){function Y(){h0(this,Y),y(this,"_ttfb",0),y(this,"_demuxStart",0),y(this,"_demuxEnd",0),y(this,"_demuxCost",0),y(this,"_remuxStart",0),y(this,"_remuxEnd",0),y(this,"_remuxCost",0),y(this,"_appendStart",0),y(this,"_appendEnd",0),y(this,"_appendCost",0)}return x0(Y,[{key:"set",value:function K(O,w){this["_".concat(O)]=w}},{key:"start",value:function K(O){this["_".concat(O,"Start")]=Date.now()}},{key:"end",value:function K(O){this["_".concat(O,"End")]=Date.now(),this["_".concat(O,"Cost")]=this["_".concat(O,"Cost")]+(this["_".concat(O,"End")]-this["_".concat(O,"Start")])}},{key:"transferCost",get:function K(){return{ttfbCost:this._ttfb,demuxCost:this._demuxCost,remuxCost:this._remuxCost,appendCost:this._appendCost}}}]),Y}(),S0={TTFB:"ttfb",DEMUX:"demux",REMUX:"remux",APPEND:"append"};var $0=new D0("BufferService"),dw=function(){function Y(K,O){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(h0(this,Y),y(this,"flv",null),y(this,"_demuxer",new DO),y(this,"_remuxer",null),y(this,"_mse",null),y(this,"_softVideo",null),y(this,"_sourceCreated",!1),y(this,"_needInitSegment",!0),y(this,"_discontinuity",!0),y(this,"_contiguous",!1),y(this,"_initSegmentId",""),y(this,"_cachedBuffer",null),y(this,"_demuxStartTime",0),y(this,"_opts",null),this.flv=K,this._opts=w,O)this._softVideo=O;else this._remuxer=new xO(this._demuxer.videoTrack,this._demuxer.audioTrack),this._mse=new P0(null,{preferMMS:typeof w.preferMMS==="boolean"?w.preferMMS:!!w.perferMMS}),this._mse.bindMedia(K.media)}return x0(Y,[{key:"baseDts",get:function K(){var O,w;return(O=this._demuxer)===null||O===void 0?void 0:(w=O._fixer)===null||w===void 0?void 0:w._baseDts}},{key:"blobUrl",get:function K(){var O;return(O=this._mse)===null||O===void 0?void 0:O.url}},{key:"isFull",value:function K(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:P0.VIDEO;return this._mse.isFull(O)}},{key:"seamlessSwitch",value:function K(){this._needInitSegment=!0,this._discontinuity=!0,this._contiguous=!0,this._initSegmentId=""}},{key:"unContiguous",value:function K(O){this._contiguous=!1,this._demuxStartTime=O}},{key:"reset",value:function(){var K=O0(k().mark(function w(){var G,J=arguments;return k().wrap(function Q(Z){while(!0)switch(Z.prev=Z.next){case 0:if(G=J.length>0&&J[0]!==void 0?J[0]:!1,!(this._mse&&!G)){Z.next=6;break}return Z.next=4,this._mse.unbindMedia();case 4:return Z.next=6,this._mse.bindMedia(this.flv.media);case 6:this._needInitSegment=!0,this._discontinuity=!0,this._contiguous=!1,this._sourceCreated=!1,this._initSegmentId="",this.resetSeamlessSwitchStats();case 12:case"end":return Z.stop()}},w,this)}));function O(){return K.apply(this,arguments)}return O}()},{key:"resetSeamlessSwitchStats",value:function K(){if(this.seamlessLoadingSwitch=null,this.seamlessLoadingSwitching=!1,this._demuxer)this._demuxer.seamlessLoadingSwitching=!1}},{key:"endOfStream",value:function(){var K=O0(k().mark(function w(){return k().wrap(function G(J){while(!0)switch(J.prev=J.next){case 0:if(!this._mse){J.next=7;break}if(!this._sourceCreated){J.next=5;break}return J.next=4,this._mse.endOfStream();case 4:this.flv.emit(u.BUFFEREOS);case 5:J.next=8;break;case 7:if(this._softVideo)this._softVideo.endOfStream();case 8:case"end":return J.stop()}},w,this)}));function O(){return K.apply(this,arguments)}return O}()},{key:"updateDuration",value:function(){var K=O0(k().mark(function w(G){return k().wrap(function J(Q){while(!0)switch(Q.prev=Q.next){case 0:if(!this._mse){Q.next=7;break}if(this._mse.isOpened){Q.next=4;break}return Q.next=4,this._mse.open();case 4:return $0.debug("update duration",G),Q.next=7,this._mse.updateDuration(G);case 7:case"end":return Q.stop()}},w,this)}));function O(w){return K.apply(this,arguments)}return O}()},{key:"destroy",value:function(){var K=O0(k().mark(function w(){return k().wrap(function G(J){while(!0)switch(J.prev=J.next){case 0:if(!this._mse){J.next=3;break}return J.next=3,this._mse.unbindMedia();case 3:this._mse=null,this._softVideo=null,this._demuxer=null,this._remuxer=null;case 7:case"end":return J.stop()}},w,this)}));function O(){return K.apply(this,arguments)}return O}()},{key:"appendBuffer",value:function(){var K=O0(k().mark(function w(G){var J=this,Q,Z,W,X,U,D,V,q,L,z,I,E,S,x,C,R,v,_;return k().wrap(function t(P){while(!0)switch(P.prev=P.next){case 0:if(Q=!1,this._cachedBuffer)G=IO(this._cachedBuffer,G),this._cachedBuffer=null;if(Z=this._demuxer,!(!G||!G.length||!Z)){P.next=5;break}return P.abrupt("return");case 5:P.prev=5,this.flv._transferCost.start(S0.DEMUX),Z.demuxAndFix(G,this.seamlessLoadingSwitching||this._discontinuity,this._contiguous,this._demuxStartTime,this.seamlessLoadingSwitching),this.seamlessLoadingSwitching=!1,this.flv._transferCost.end(S0.DEMUX),P.next=15;break;case 12:throw P.prev=12,P.t0=P.catch(5),new Q0(m.DEMUX,m.SUB_TYPES.FLV,P.t0);case 15:if(W=Z.videoTrack,X=Z.audioTrack,U=Z.metadataTrack,!this.seamlessLoadingSwitch){P.next=25;break}if(D=W.samples.findIndex(function(l){return l.originDts===W.lastKeyFrameDts}),!(D>=0)){P.next=25;break}return W.samples.splice(D),P.next=22,this.seamlessLoadingSwitch();case 22:this.seamlessLoadingSwitch=null,G=null,Q=!0;case 25:if(V=W.exist(),q=X.exist(),this._opts.onlyAudio)V=!1,W.present=!1;if(this._opts.onlyVideo)q=!1,X.present=!1;if(!(!V&&W.present||!q&&X.present)){P.next=42;break}if(L=0,z=V?W:q?X:void 0,z&&z.samples.length)L=(z.samples[z.samples.length-1].originPts-z.samples[0].originPts)/z.timescale*1000;if(!(L>this._opts.analyzeDuration)){P.next=40;break}$0.warn("analyze duration exceeded, ".concat(L,"ms"),z),W.present=V,X.present=q,this.flv.emit(u.ANALYZE_DURATION_EXCEEDED,{duration:L}),P.next=42;break;case 40:return this._cachedBuffer=G,P.abrupt("return");case 42:if(I=W.type,E=X.type,this._fireEvents(W,X,U),!Q)this._discontinuity=!1,this._contiguous=!0,this._demuxStartTime=0;if(S=this._mse,x=function l(){var Y0;if((Y0=J.flv)!==null&&Y0!==void 0&&Y0.emit){var H;(H=J.flv)===null||H===void 0||H.emit(u.APPEND_BUFFER,{})}},this.flv.emit(u.DEMUXED_TRACK,{videoTrack:W}),C="".concat(W.codec,"/").concat(W.width,"/").concat(W.height,"/").concat(X.codec,"/").concat(X.config),C!==this._initSegmentId)this._needInitSegment=!0,this._initSegmentId=C,this._emitMetaParsedEvent(W,X);if(!S){P.next=83;break}if(this._sourceCreated){P.next=59;break}return P.next=55,S.open();case 55:if(V)$0.log("codec: video/mp4;codecs=".concat(W.codec)),S.createSource(I,"video/mp4;codecs=".concat(W.codec));if(q)$0.log("codec: audio/mp4;codecs=".concat(X.codec)),S.createSource(E,"audio/mp4;codecs=".concat(X.codec));this._sourceCreated=!0,this.flv.emit(u.SOURCEBUFFER_CREATED);case 59:if(P.prev=59,this._needInitSegment&&!this._opts.mseLowLatency)W.duration=this._opts.durationForMSELowLatencyOff*W.timescale,X.duration=this._opts.durationForMSELowLatencyOff*q.timescale;this.flv._transferCost.start(S0.REMUX),R=this._remuxer.remux(this._needInitSegment),this.flv._transferCost.end(S0.REMUX),P.next=69;break;case 66:throw P.prev=66,P.t1=P.catch(59),new Q0(m.REMUX,m.SUB_TYPES.FMP4,P.t1);case 69:if(!(this._needInitSegment&&!R.videoInitSegment&&!R.audioInitSegment)){P.next=71;break}return P.abrupt("return");case 71:if(this._needInitSegment=!1,v=[],R.videoInitSegment)v.push(S.append(I,R.videoInitSegment));if(R.audioInitSegment)v.push(S.append(E,R.audioInitSegment));if(R.videoSegment)v.push(S.append(I,R.videoSegment));if(R.audioSegment)v.push(S.append(E,R.audioSegment));return this.flv._transferCost.start(S0.APPEND),_=Promise.all(v),_.then(x).then(function(){J.flv._transferCost.end(S0.APPEND),x()}),P.abrupt("return",_);case 83:if(this._softVideo)this._softVideo.appendBuffer(W,X),x();case 84:case"end":return P.stop()}},w,this,[[5,12],[59,66]])}));function O(w){return K.apply(this,arguments)}return O}()},{key:"evictBuffer",value:function(){var K=O0(k().mark(function w(G){var J=this,Q,Z,W,X;return k().wrap(function U(D){while(!0)switch(D.prev=D.next){case 0:if(Q=this.flv.media,!(!this._mse||!this._demuxer||!Q||!G||G<0)){D.next=3;break}return D.abrupt("return");case 3:if(Z=Q.currentTime,W=Z-G,!(W<=0)){D.next=7;break}return D.abrupt("return");case 7:if(X=e.start(e.get(Q)),!(X+1>=W)){D.next=10;break}return D.abrupt("return");case 10:return D.abrupt("return",this._mse.clearBuffer(0,W).then(function(){return J.flv.emit(u.REMOVE_BUFFER,{removeEnd:W})}));case 11:case"end":return D.stop()}},w,this)}));function O(w){return K.apply(this,arguments)}return O}()},{key:"_emitMetaParsedEvent",value:function K(O,w){if(O.exist())this.flv.emit(u.METADATA_PARSED,{type:"video",track:O,meta:{codec:O.codec,timescale:O.timescale,width:O.width,height:O.height,sarRatio:O.sarRatio,baseDts:O.baseDts}});if(w.exist())this.flv.emit(u.METADATA_PARSED,{type:"audio",track:w,meta:{codec:w.codec,channelCount:w.channelCount,sampleRate:w.sampleRate,timescale:w.timescale,baseDts:w.baseDts}});$0.debug("track parsed",O,w)}},{key:"_fireEvents",value:function K(O,w,G){var J=this;$0.debug("videoTrack samples count: ".concat(O.samples.length,", audioTrack samples count: ").concat(w.samples.length)),G.flvScriptSamples.forEach(function(Q){J.flv.emit(u.FLV_SCRIPT_DATA,Q),$0.debug("flvScriptData",Q)}),O.samples.forEach(function(Q){if(Q.keyframe)J.flv.emit(u.KEYFRAME,{pts:Q.originPts})}),O.warnings.forEach(function(Q){var Z;switch(Q.type){case W0.LARGE_AV_SHIFT:Z=u.LARGE_AV_FIRST_FRAME_GAP_DETECT;break;case W0.LARGE_VIDEO_GAP:Z=u.LARGE_VIDEO_DTS_GAP_DETECT;break;case W0.LARGE_VIDEO_GAP_BETWEEN_CHUNK:Z=u.MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT;break}if(Z)J.flv.emit(u.STREAM_EXCEPTION,H0(H0({},Q),{},{type:Z}));$0.warn("video exception",Q)}),w.warnings.forEach(function(Q){var Z;switch(Q.type){case W0.LARGE_AUDIO_GAP:Z=u.LARGE_AUDIO_DTS_GAP_DETECT;break;case W0.AUDIO_FILLED:Z=u.AUDIO_GAP_DETECT;break;case W0.AUDIO_DROPPED:Z=u.AUDIO_OVERLAP_DETECT;break}if(Z)J.flv.emit(u.STREAM_EXCEPTION,H0(H0({},Q),{},{type:Z}));$0.warn("audio exception",Q)}),G.seiSamples.forEach(function(Q){J.flv.emit(u.SEI,H0(H0({},Q),{},{sei:{code:Q.data.type,content:Q.data.payload,dts:Q.pts}}))})}}]),Y}();function cw(Y){var K=H0({retryCount:3,retryDelay:1000,disconnectRetryCount:0,loadTimeout:1e4,maxReaderInterval:5000,preloadTime:5,defaultVodLoadSize:1e7,isLive:!1,softDecode:!1,bufferBehind:10,maxJumpDistance:3,analyzeDuration:20000,seamlesslyReload:!1,keepStatusAfterSwitch:!0,onlyVideo:!1,onlyAudio:!1,preferMMS:!1,mseLowLatency:!0,durationForMSELowLatencyOff:6,chunkCountForSpeed:50,skipChunkSize:1000,longtimeNoReceived:3000,enableStartGapJump:!0},Y);if(K.isLive){if(K.preloadTime){if(!K.maxLatency)K.maxLatency=K.preloadTime*2;if(!K.targetLatency)K.targetLatency=K.preloadTime;if(K.disconnectTime===null||K.disconnectTime===void 0)K.disconnectTime=K.maxLatency}}return K}function kO(Y,K){var O=0,w=Y.length-1,G=0,J=0,Q=w;if(K<Y[0])O=0,J=Q+1;while(J<=Q)if(G=J+Math.floor((Q-J)/2),G===w||K>=Y[G]&&K<Y[G+1]){O=G;break}else if(Y[G]<K)J=G+1;else Q=G-1;return O}var B0=new D0("flv"),AO=0.1,T1=0.3,wO=function(Y){rO(O,Y);var K=_O(O);function O(w){var G;if(h0(this,O),G=K.call(this),y(p(G),"media",null),y(p(G),"_loading",!1),y(p(G),"_opts",null),y(p(G),"_bufferService",null),y(p(G),"_gapService",null),y(p(G),"_stats",null),y(p(G),"_mediaLoader",null),y(p(G),"_maxChunkWaitTimer",null),y(p(G),"_tickTimer",null),y(p(G),"_tickInterval",500),y(p(G),"_urlSwitching",!1),y(p(G),"_seamlessSwitching",!1),y(p(G),"_disconnectRetryCount",0),y(p(G),"_preLoadEndPoint",0),y(p(G),"_keyframes",null),y(p(G),"_acceptRanges",!0),y(p(G),"_onProgress",function(){var J=O0(k().mark(function Q(Z,W,X,U){var D,V,q,L,z,I,E,S,x,C;return k().wrap(function R(v){while(!0)switch(v.prev=v.next){case 0:if(D=X.startTime,V=X.endTime,q=X.st,L=X.firstByteTime,G._loading=!W,G._firstProgressEmit){v.next=13;break}if(G.media){v.next=6;break}return(z=G._mediaLoader)===null||z===void 0||z.cancel(),v.abrupt("return");case 6:I=U.headers,E=q?L-q:V-D,G.emit(u.TTFB,{url:G._opts.url,responseUrl:U.url,elapsed:E}),G.emit(u.LOAD_RESPONSE_HEADERS,{headers:I}),G._transferCost.set(S0.TTFB,E),G._acceptRanges=!!(I!==null&&I!==void 0&&I.get("Accept-Ranges"))||!!(I!==null&&I!==void 0&&I.get("Content-Range")),G._firstProgressEmit=!0;case 13:if(G._bufferService){v.next=15;break}return v.abrupt("return");case 15:return clearTimeout(G._maxChunkWaitTimer),G._bandwidthService.addChunkRecord(Z===null||Z===void 0?void 0:Z.byteLength,V-D),v.prev=17,v.next=20,G._bufferService.appendBuffer(Z);case 20:(S=G._bufferService)===null||S===void 0||S.evictBuffer(G._opts.bufferBehind),v.next=33;break;case 23:if(v.prev=23,v.t0=v.catch(17),!(!G.isLive&&G._bufferService.isFull())){v.next=32;break}return v.next=28,G._mediaLoader.cancel();case 28:return G._loading=!1,x=G.bufferInfo().remaining,G._opts.preloadTime=parseInt(x)/2,v.abrupt("return");case 32:return v.abrupt("return",G._emitError(Q0.create(v.t0)));case 33:if(G._urlSwitching)G._urlSwitching=!1,G.emit(u.SWITCH_URL_SUCCESS,{url:G._opts.url});if(G._seamlessSwitching)G._seamlessSwitching=!1,G._tick();if(!(W&&!G.media.seeking)){v.next=40;break}if(G.emit(u.LOAD_COMPLETE),B0.debug("load done"),G.isLive&&G._disconnectRetryCount<=0)G._end();return v.abrupt("return");case 40:if(G.isLive){v.next=42;break}return v.abrupt("return");case 42:if(C=G._opts.maxReaderInterval,C&&G._firstProgressEmit)clearTimeout(G._maxChunkWaitTimer),G._maxChunkWaitTimer=setTimeout(function(){if(G._disconnectRetryCount){G._disconnectRetryCount--,G.load();return}B0.debug("onMaxChunkWait",C),G._end()},C);case 44:case"end":return v.stop()}},Q,null,[[17,23]])}));return function(Q,Z,W,X){return J.apply(this,arguments)}}()),y(p(G),"_onRetryError",function(J,Q){B0.debug("load retry",J,Q),G.emit(u.LOAD_RETRY,{error:Q0.network(J),retryTime:Q})}),y(p(G),"_end",function(){if(G._clear(),G._bufferService)G._bufferService.endOfStream();B0.debug("end stream")}),y(p(G),"_resetDisconnectCount",function(){G._disconnectRetryCount=G._opts.disconnectRetryCount}),y(p(G),"_tick",function(){clearTimeout(G._tickTimer);var J=p(G),Q=J.media;if(!Q)return;G._tickTimer=setTimeout(G._tick,G._tickInterval);var Z=e.end(e.get(Q));if(Z<AO||!Q.readyState)return;var W=G._opts;if(jO(Q)&&Q.currentTime){if(G._gapService)G._gapService.do(Q,W.maxJumpDistance,G.isLive,3)}else{if(!Q.currentTime&&G._gapService&&W.enableStartGapJump){var X=G._opts.mseLowLatency||G._opts.mseLowLatency===!1&&G.bufferInfo(T1).nextStart;if(X)G._gapService.do(Q,W.maxJumpDistance,G.isLive,3);return}if(W.isLive&&Q.readyState===4&&Z-Q.currentTime>W.disconnectTime)G.disconnect()}}),y(p(G),"_onPlay",function(){var J,Q,Z=G._opts.softDecode||((J=G.media)===null||J===void 0?void 0:(Q=J.buffered)===null||Q===void 0?void 0:Q.length);if(G.isLive){if(!G._loading&&Z)G.replay(void 0,!0);return}var W=G.bufferInfo();if((W.start||W.nextStart)>AO)G._tick()}),y(p(G),"_onLoadeddata",function(){if(G.isLive&&!G._opts.mseLowLatency){if(G.media.duration!==1/0)G._bufferService.updateDuration(1/0).catch(function(J){})}}),y(p(G),"_onSeeking",O0(k().mark(function J(){return k().wrap(function Q(Z){while(!0)switch(Z.prev=Z.next){case 0:if(!G.isLive&&G.seekable)G._preLoadEndPoint=-1,G._checkPreload();case 1:case"end":return Z.stop()}},J)}))),y(p(G),"_onTimeupdate",function(){if(!G.media)return;var J=G._opts,Q=G.media.currentTime;if(J.isLive&&J.maxLatency&&J.targetLatency){var Z=e.end(e.get(G.media)),W=Z-Q;if(W>=J.maxLatency)G.media.currentTime=Z-J.targetLatency,G.emit(u.CHASEFRAME,{currentTime:G.media.currentTime,latency:J.targetLatency})}if(G._seiService.throw(Q,!0),J.isLive||!G.seekable||G._loading)return;G._checkPreload()}),y(p(G),"_onWaiting",function(){if(G.isLive&&!G._loading&&G._disconnectRetryCount)G._disconnectRetryCount--,G.load()}),y(p(G),"_onBufferUpdate",function(){if(G._opts.isLive)return;var J=G.bufferInfo(),Q=J.end,Z=J.nextEnd;if(Math.abs((Q||Z)-G.media.duration)<1){if(G._end(),G.media.readyState<=2)G._tick()}}),y(p(G),"_checkPreload",O0(k().mark(function J(){var Q,Z,W,X,U,D,V,q,L,z;return k().wrap(function I(E){while(!0)switch(E.prev=E.next){case 0:if(Q=G.bufferInfo(),Z=Q.remaining,W=Z===void 0?0:Z,X=G._opts,U=G._keyframes.filepositions,D=G._keyframes.times,V=G.media.currentTime,!(W<X.preloadTime)){E.next=19;break}if(q=kO(G._keyframes.times,V+W+AO),L=kO(G._keyframes.times,V+W+G._opts.preloadTime),L===q)L=q+1;if(G._preLoadEndPoint!==L){E.next=11;break}return E.abrupt("return");case 11:if(z=U[q],!(z===null||z===void 0)){E.next=14;break}return E.abrupt("return");case 14:return E.next=16,G._mediaLoader.cancel();case 16:G._loadData(null,[z,U[L]]),G._preLoadEndPoint=L,G._bufferService.unContiguous(D[q]);case 19:case"end":return E.stop()}},J)}))),y(p(G),"_onFlvScriptData",function(J){var Q,Z,W,X,U=(Q=J.data)===null||Q===void 0?void 0:(Z=Q.onMetaData)===null||Z===void 0?void 0:Z.keyframes,D=(W=J.data)===null||W===void 0?void 0:(X=W.onMetaData)===null||X===void 0?void 0:X.duration;if(U)G._keyframes=U;if(!G._opts.isLive&&D)G._bufferService.updateDuration(D)}),G._opts=cw(w),G.media=G._opts.media||document.createElement("video"),G._opts.media=null,G._firstProgressEmit=!1,G._mediaLoader=new BO(H0(H0({},G._opts.fetchOptions),{},{retry:G._opts.retryCount,retryDelay:G._opts.retryDelay,timeout:G._opts.loadTimeout,onRetryError:G._onRetryError,onProgress:G._onProgress,responseType:"arraybuffer"})),G._disconnectRetryCount=G._opts.disconnectRetryCount,G._transferCost=new ow,G._bufferService=new dw(p(G),G._opts.softDecode?G.media:void 0,G._opts),G._seiService=new EO(p(G)),G._bandwidthService=new SO({chunkCountForSpeed:G._opts.chunkCountForSpeed,skipChunkSize:G._opts.skipChunkSize,longtimeNoReceived:G._opts.longtimeNoReceived}),G._stats=new $O(p(G)),!G._opts.softDecode)G._gapService=new RO;return G.media.addEventListener("play",G._onPlay),G.media.addEventListener("loadeddata",G._onLoadeddata),G.media.addEventListener("seeking",G._onSeeking),G.media.addEventListener("timeupdate",G._onTimeupdate),G.media.addEventListener("progress",G._onBufferUpdate),G.media.addEventListener("waiting",G._onWaiting),G.on(u.FLV_SCRIPT_DATA,G._onFlvScriptData),G}return x0(O,[{key:"version",get:function w(){return"3.0.21"}},{key:"isLive",get:function w(){return this._opts.isLive}},{key:"baseDts",get:function w(){var G;return(G=this._bufferService)===null||G===void 0?void 0:G.baseDts}},{key:"seekable",get:function w(){return!!this._keyframes&&this._acceptRanges}},{key:"loader",get:function w(){return this._mediaLoader}},{key:"blobUrl",get:function w(){var G;return(G=this._bufferService)===null||G===void 0?void 0:G.blobUrl}},{key:"speedInfo",value:function w(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed(),totalSize:this._bandwidthService.getTotalSize(),totalCost:this._bandwidthService.getTotalCost()}}},{key:"getStats",value:function w(){return this._stats.getStats()}},{key:"bufferInfo",value:function w(){var G,J=arguments.length>0&&arguments[0]!==void 0?arguments[0]:AO;return e.info(e.get(this.media),(G=this.media)===null||G===void 0?void 0:G.currentTime,J)}},{key:"playbackQuality",value:function w(){return bO(this.media)}},{key:"load",value:function(){var w=O0(k().mark(function J(Q){var Z,W=arguments;return k().wrap(function X(U){while(!0)switch(U.prev=U.next){case 0:if(Z=W.length>1&&W[1]!==void 0?W[1]:!1,this._bufferService){U.next=3;break}return U.abrupt("return");case 3:return U.next=5,this._reset(Z);case 5:this._loadData(Q,this._opts.isLive?[]:[0,this._opts.defaultVodLoadSize]),clearTimeout(this._tickTimer),this._tickTimer=setTimeout(this._tick,this._tickInterval);case 8:case"end":return U.stop()}},J,this)}));function G(J){return w.apply(this,arguments)}return G}()},{key:"replay",value:function(){var w=O0(k().mark(function J(){var Q=this,Z,W,X=arguments;return k().wrap(function U(D){while(!0)switch(D.prev=D.next){case 0:if(Z=X.length>0&&X[0]!==void 0?X[0]:this._opts.seamlesslyReload,W=X.length>1?X[1]:void 0,this.media){D.next=4;break}return D.abrupt("return");case 4:if(this._resetDisconnectCount(),!Z){D.next=11;break}return D.next=8,this._clear();case 8:setTimeout(function(){Q._seamlessSwitching=!0,Q._loadData(Q._opts.url),Q._bufferService.seamlessSwitch()}),D.next=13;break;case 11:return D.next=13,this.load();case 13:return D.abrupt("return",this.media.play(!W).catch(function(){}));case 14:case"end":return D.stop()}},J,this)}));function G(){return w.apply(this,arguments)}return G}()},{key:"disconnect",value:function w(){var G;return B0.debug("disconnect!"),(G=this._bufferService)===null||G===void 0||G.resetSeamlessSwitchStats(),this._clear()}},{key:"switchURL",value:function(){var w=O0(k().mark(function J(Q,Z){var W=this;return k().wrap(function X(U){while(!0)switch(U.prev=U.next){case 0:if(this._bufferService){U.next=2;break}return U.abrupt("return");case 2:if(this._resetDisconnectCount(),!(this._loading&&Z)){U.next=6;break}return this._bufferService.seamlessLoadingSwitch=function(){var D=O0(k().mark(function V(q){return k().wrap(function L(z){while(!0)switch(z.prev=z.next){case 0:return z.next=2,W._clear();case 2:W._bufferService.seamlessLoadingSwitching=!0,W._urlSwitching=!0,W._seamlessSwitching=!0,W._bufferService.seamlessSwitch(),W._loadData(Q);case 7:case"end":return z.stop()}},V)}));return function(V){return D.apply(this,arguments)}}(),U.abrupt("return");case 6:if(!(!Z||!this._opts.isLive)){U.next=11;break}return U.next=9,this.load(Q);case 9:return this._urlSwitching=!0,U.abrupt("return",this.media.play(!0).catch(function(){}));case 11:return U.next=13,this._clear();case 13:setTimeout(function(){W._urlSwitching=!0,W._seamlessSwitching=!0,W._loadData(Q),W._bufferService.seamlessSwitch()});case 14:case"end":return U.stop()}},J,this)}));function G(J,Q){return w.apply(this,arguments)}return G}()},{key:"destroy",value:function(){var w=O0(k().mark(function J(){return k().wrap(function Q(Z){while(!0)switch(Z.prev=Z.next){case 0:if(this.media){Z.next=2;break}return Z.abrupt("return");case 2:return this.removeAllListeners(),this._seiService.reset(),this.media.removeEventListener("play",this._onPlay),this.media.removeEventListener("loadeddata",this._onLoadeddata),this.media.removeEventListener("seeking",this._onSeeking),this.media.removeEventListener("timeupdate",this._onTimeupdate),this.media.removeEventListener("waiting",this._onWaiting),this.media.removeEventListener("progress",this._onBufferUpdate),Z.next=12,Promise.all([this._clear(),this._bufferService.destroy()]);case 12:this.media=null,this._bufferService=null;case 14:case"end":return Z.stop()}},J,this)}));function G(){return w.apply(this,arguments)}return G}()},{key:"_emitError",value:function w(G){var J,Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(B0.table(G),B0.error(G),B0.error((J=this.media)===null||J===void 0?void 0:J.error),this._urlSwitching)this._urlSwitching=!1,this._seamlessSwitching=!1,this.emit(u.SWITCH_URL_FAILED,G);if(this.emit(u.ERROR,G),Q)this._seiService.reset(),this._end()}},{key:"_reset",value:function(){var w=O0(k().mark(function J(){var Q,Z=arguments;return k().wrap(function W(X){while(!0)switch(X.prev=X.next){case 0:return Q=Z.length>0&&Z[0]!==void 0?Z[0]:!1,this._seiService.reset(),this._bandwidthService.reset(),this._stats.reset(),X.next=6,this._clear();case 6:return X.next=8,this._bufferService.reset(Q);case 8:case"end":return X.stop()}},J,this)}));function G(){return w.apply(this,arguments)}return G}()},{key:"_loadData",value:function(){var w=O0(k().mark(function J(Q,Z){var W;return k().wrap(function X(U){while(!0)switch(U.prev=U.next){case 0:if(Q)this._opts.url=Q;if(W=Q=this._opts.url,Q){U.next=4;break}throw new Error("Source url is missing");case 4:if(this._opts.preProcessUrl)W=this._opts.preProcessUrl(Q).url;if(this._mediaLoader.finnalUrl=W,this.emit(u.LOAD_START,{url:W,seamlessSwitching:this._seamlessSwitching}),B0.debug("load data, loading:",this._loading,W),!this._loading){U.next=11;break}return U.next=11,this._mediaLoader.cancel();case 11:return this._loading=!0,U.prev=12,U.next=15,this._mediaLoader.load({url:W,range:Z});case 15:U.next=21;break;case 17:return U.prev=17,U.t0=U.catch(12),this._loading=!1,U.abrupt("return",this._emitError(Q0.network(U.t0),!1));case 21:case"end":return U.stop()}},J,this,[[12,17]])}));function G(J,Q){return w.apply(this,arguments)}return G}()},{key:"_clear",value:function(){var w=O0(k().mark(function J(){return k().wrap(function Q(Z){while(!0)switch(Z.prev=Z.next){case 0:if(!this._mediaLoader){Z.next=3;break}return Z.next=3,this._mediaLoader.cancel();case 3:clearTimeout(this._maxChunkWaitTimer),clearTimeout(this._tickTimer),this._loading=!1,this._firstProgressEmit=!1;case 7:case"end":return Z.stop()}},J,this)}));function G(){return w.apply(this,arguments)}return G}()}],[{key:"isSupported",value:function w(G){if(!G||G==="video"||G==="audio")return P0.isSupported();return typeof WebAssembly!=="undefined"}},{key:"enableLogger",value:function w(){D0.enable(),g0.enable()}},{key:"disableLogger",value:function w(){D0.disable(),g0.disable()}}]),O}(rw.default);try{if(localStorage.getItem("xgd"))wO.enableLogger();else wO.disableLogger()}catch(Y){}})();
1
+ (function(g,f){if(typeof define=="function"&&define.amd){define(f)}else if(typeof exports=="object" && typeof module<"u"){module.exports=f()}else{var m=f();for(var i in m) g[i]=m[i]}}(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : this,function(){var exports={};var __exports=exports;var module={exports};
2
+ "use strict";var $r=Object.create;var tt=Object.defineProperty;var Kr=Object.getOwnPropertyDescriptor;var Xr=Object.getOwnPropertyNames;var qr=Object.getPrototypeOf,Yr=Object.prototype.hasOwnProperty;var Qr=(i,a)=>()=>(a||i((a={exports:{}}).exports,a),a.exports),Jr=(i,a)=>{for(var e in a)tt(i,e,{get:a[e],enumerable:!0})},Vt=(i,a,e,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let t of Xr(a))!Yr.call(i,t)&&t!==e&&tt(i,t,{get:()=>a[t],enumerable:!(r=Kr(a,t))||r.enumerable});return i};var He=(i,a,e)=>(e=i!=null?$r(qr(i)):{},Vt(a||!i||!i.__esModule?tt(e,"default",{value:i,enumerable:!0}):e,i)),Zr=i=>Vt(tt({},"__esModule",{value:!0}),i);var Fe=Qr((Fi,mt)=>{"use strict";var ii=Object.prototype.hasOwnProperty,oe="~";function ze(){}Object.create&&(ze.prototype=Object.create(null),new ze().__proto__||(oe=!1));function ni(i,a,e){this.fn=i,this.context=a,this.once=e||!1}function Xt(i,a,e,r,t){if(typeof e!="function")throw new TypeError("The listener must be a function");var n=new ni(e,r||i,t),s=oe?oe+a:a;return i._events[s]?i._events[s].fn?i._events[s]=[i._events[s],n]:i._events[s].push(n):(i._events[s]=n,i._eventsCount++),i}function it(i,a){--i._eventsCount===0?i._events=new ze:delete i._events[a]}function ae(){this._events=new ze,this._eventsCount=0}ae.prototype.eventNames=function(){var a=[],e,r;if(this._eventsCount===0)return a;for(r in e=this._events)ii.call(e,r)&&a.push(oe?r.slice(1):r);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a};ae.prototype.listeners=function(a){var e=oe?oe+a:a,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var t=0,n=r.length,s=new Array(n);t<n;t++)s[t]=r[t].fn;return s};ae.prototype.listenerCount=function(a){var e=oe?oe+a:a,r=this._events[e];return r?r.fn?1:r.length:0};ae.prototype.emit=function(a,e,r,t,n,s){var o=oe?oe+a:a;if(!this._events[o])return!1;var u=this._events[o],l=arguments.length,c,f;if(u.fn){switch(u.once&&this.removeListener(a,u.fn,void 0,!0),l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,r),!0;case 4:return u.fn.call(u.context,e,r,t),!0;case 5:return u.fn.call(u.context,e,r,t,n),!0;case 6:return u.fn.call(u.context,e,r,t,n,s),!0}for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];u.fn.apply(u.context,c)}else{var v=u.length,m;for(f=0;f<v;f++)switch(u[f].once&&this.removeListener(a,u[f].fn,void 0,!0),l){case 1:u[f].fn.call(u[f].context);break;case 2:u[f].fn.call(u[f].context,e);break;case 3:u[f].fn.call(u[f].context,e,r);break;case 4:u[f].fn.call(u[f].context,e,r,t);break;default:if(!c)for(m=1,c=new Array(l-1);m<l;m++)c[m-1]=arguments[m];u[f].fn.apply(u[f].context,c)}}return!0};ae.prototype.on=function(a,e,r){return Xt(this,a,e,r,!1)};ae.prototype.once=function(a,e,r){return Xt(this,a,e,r,!0)};ae.prototype.removeListener=function(a,e,r,t){var n=oe?oe+a:a;if(!this._events[n])return this;if(!e)return it(this,n),this;var s=this._events[n];if(s.fn)s.fn===e&&(!t||s.once)&&(!r||s.context===r)&&it(this,n);else{for(var o=0,u=[],l=s.length;o<l;o++)(s[o].fn!==e||t&&!s[o].once||r&&s[o].context!==r)&&u.push(s[o]);u.length?this._events[n]=u.length===1?u[0]:u:it(this,n)}return this};ae.prototype.removeAllListeners=function(a){var e;return a?(e=oe?oe+a:a,this._events[e]&&it(this,e)):(this._events=new ze,this._eventsCount=0),this};ae.prototype.off=ae.prototype.removeListener;ae.prototype.addListener=ae.prototype.on;ae.prefixed=oe;ae.EventEmitter=ae;typeof mt<"u"&&(mt.exports=ae)});var Mi={};Jr(Mi,{Flv:()=>et});module.exports=Zr(Mi);function jt(i,a){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);a&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable})),e.push.apply(e,r)}return e}function pe(i){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?jt(Object(e),!0).forEach(function(r){R(i,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):jt(Object(e)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(e,r))})}return i}function F(){F=function(){return i};var i={},a=Object.prototype,e=a.hasOwnProperty,r=Object.defineProperty||function(p,h,d){p[h]=d.value},t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",s=t.asyncIterator||"@@asyncIterator",o=t.toStringTag||"@@toStringTag";function u(p,h,d){return Object.defineProperty(p,h,{value:d,enumerable:!0,configurable:!0,writable:!0}),p[h]}try{u({},"")}catch{u=function(h,d,T){return h[d]=T}}function l(p,h,d,T){var y=h&&h.prototype instanceof v?h:v,k=Object.create(y.prototype),I=new L(T||[]);return r(k,"_invoke",{value:w(p,d,I)}),k}function c(p,h,d){try{return{type:"normal",arg:p.call(h,d)}}catch(T){return{type:"throw",arg:T}}}i.wrap=l;var f={};function v(){}function m(){}function g(){}var E={};u(E,n,function(){return this});var S=Object.getPrototypeOf,C=S&&S(S(j([])));C&&C!==a&&e.call(C,n)&&(E=C);var A=g.prototype=v.prototype=Object.create(E);function N(p){["next","throw","return"].forEach(function(h){u(p,h,function(d){return this._invoke(h,d)})})}function O(p,h){function d(y,k,I,H){var z=c(p[y],p,k);if(z.type!=="throw"){var q=z.arg,te=q.value;return te&&typeof te=="object"&&e.call(te,"__await")?h.resolve(te.__await).then(function(W){d("next",W,I,H)},function(W){d("throw",W,I,H)}):h.resolve(te).then(function(W){q.value=W,I(q)},function(W){return d("throw",W,I,H)})}H(z.arg)}var T;r(this,"_invoke",{value:function(y,k){function I(){return new h(function(H,z){d(y,k,H,z)})}return T=T?T.then(I,I):I()}})}function w(p,h,d){var T="suspendedStart";return function(y,k){if(T==="executing")throw new Error("Generator is already running");if(T==="completed"){if(y==="throw")throw k;return ie()}for(d.method=y,d.arg=k;;){var I=d.delegate;if(I){var H=P(I,d);if(H){if(H===f)continue;return H}}if(d.method==="next")d.sent=d._sent=d.arg;else if(d.method==="throw"){if(T==="suspendedStart")throw T="completed",d.arg;d.dispatchException(d.arg)}else d.method==="return"&&d.abrupt("return",d.arg);T="executing";var z=c(p,h,d);if(z.type==="normal"){if(T=d.done?"completed":"suspendedYield",z.arg===f)continue;return{value:z.arg,done:d.done}}z.type==="throw"&&(T="completed",d.method="throw",d.arg=z.arg)}}}function P(p,h){var d=h.method,T=p.iterator[d];if(T===void 0)return h.delegate=null,d==="throw"&&p.iterator.return&&(h.method="return",h.arg=void 0,P(p,h),h.method==="throw")||d!=="return"&&(h.method="throw",h.arg=new TypeError("The iterator does not provide a '"+d+"' method")),f;var y=c(T,p.iterator,h.arg);if(y.type==="throw")return h.method="throw",h.arg=y.arg,h.delegate=null,f;var k=y.arg;return k?k.done?(h[p.resultName]=k.value,h.next=p.nextLoc,h.method!=="return"&&(h.method="next",h.arg=void 0),h.delegate=null,f):k:(h.method="throw",h.arg=new TypeError("iterator result is not an object"),h.delegate=null,f)}function X(p){var h={tryLoc:p[0]};1 in p&&(h.catchLoc=p[1]),2 in p&&(h.finallyLoc=p[2],h.afterLoc=p[3]),this.tryEntries.push(h)}function J(p){var h=p.completion||{};h.type="normal",delete h.arg,p.completion=h}function L(p){this.tryEntries=[{tryLoc:"root"}],p.forEach(X,this),this.reset(!0)}function j(p){if(p){var h=p[n];if(h)return h.call(p);if(typeof p.next=="function")return p;if(!isNaN(p.length)){var d=-1,T=function y(){for(;++d<p.length;)if(e.call(p,d))return y.value=p[d],y.done=!1,y;return y.value=void 0,y.done=!0,y};return T.next=T}}return{next:ie}}function ie(){return{value:void 0,done:!0}}return m.prototype=g,r(A,"constructor",{value:g,configurable:!0}),r(g,"constructor",{value:m,configurable:!0}),m.displayName=u(g,o,"GeneratorFunction"),i.isGeneratorFunction=function(p){var h=typeof p=="function"&&p.constructor;return!!h&&(h===m||(h.displayName||h.name)==="GeneratorFunction")},i.mark=function(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,g):(p.__proto__=g,u(p,o,"GeneratorFunction")),p.prototype=Object.create(A),p},i.awrap=function(p){return{__await:p}},N(O.prototype),u(O.prototype,s,function(){return this}),i.AsyncIterator=O,i.async=function(p,h,d,T,y){y===void 0&&(y=Promise);var k=new O(l(p,h,d,T),y);return i.isGeneratorFunction(h)?k:k.next().then(function(I){return I.done?I.value:k.next()})},N(A),u(A,o,"Generator"),u(A,n,function(){return this}),u(A,"toString",function(){return"[object Generator]"}),i.keys=function(p){var h=Object(p),d=[];for(var T in h)d.push(T);return d.reverse(),function y(){for(;d.length;){var k=d.pop();if(k in h)return y.value=k,y.done=!1,y}return y.done=!0,y}},i.values=j,L.prototype={constructor:L,reset:function(p){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(J),!p)for(var h in this)h.charAt(0)==="t"&&e.call(this,h)&&!isNaN(+h.slice(1))&&(this[h]=void 0)},stop:function(){this.done=!0;var p=this.tryEntries[0].completion;if(p.type==="throw")throw p.arg;return this.rval},dispatchException:function(p){if(this.done)throw p;var h=this;function d(z,q){return k.type="throw",k.arg=p,h.next=z,q&&(h.method="next",h.arg=void 0),!!q}for(var T=this.tryEntries.length-1;T>=0;--T){var y=this.tryEntries[T],k=y.completion;if(y.tryLoc==="root")return d("end");if(y.tryLoc<=this.prev){var I=e.call(y,"catchLoc"),H=e.call(y,"finallyLoc");if(I&&H){if(this.prev<y.catchLoc)return d(y.catchLoc,!0);if(this.prev<y.finallyLoc)return d(y.finallyLoc)}else if(I){if(this.prev<y.catchLoc)return d(y.catchLoc,!0)}else{if(!H)throw new Error("try statement without catch or finally");if(this.prev<y.finallyLoc)return d(y.finallyLoc)}}}},abrupt:function(p,h){for(var d=this.tryEntries.length-1;d>=0;--d){var T=this.tryEntries[d];if(T.tryLoc<=this.prev&&e.call(T,"finallyLoc")&&this.prev<T.finallyLoc){var y=T;break}}y&&(p==="break"||p==="continue")&&y.tryLoc<=h&&h<=y.finallyLoc&&(y=null);var k=y?y.completion:{};return k.type=p,k.arg=h,y?(this.method="next",this.next=y.finallyLoc,f):this.complete(k)},complete:function(p,h){if(p.type==="throw")throw p.arg;return p.type==="break"||p.type==="continue"?this.next=p.arg:p.type==="return"?(this.rval=this.arg=p.arg,this.method="return",this.next="end"):p.type==="normal"&&h&&(this.next=h),f},finish:function(p){for(var h=this.tryEntries.length-1;h>=0;--h){var d=this.tryEntries[h];if(d.finallyLoc===p)return this.complete(d.completion,d.afterLoc),J(d),f}},catch:function(p){for(var h=this.tryEntries.length-1;h>=0;--h){var d=this.tryEntries[h];if(d.tryLoc===p){var T=d.completion;if(T.type==="throw"){var y=T.arg;J(d)}return y}}throw new Error("illegal catch attempt")},delegateYield:function(p,h,d){return this.delegate={iterator:j(p),resultName:h,nextLoc:d},this.method==="next"&&(this.arg=void 0),f}},i}function Ht(i,a,e,r,t,n,s){try{var o=i[n](s),u=o.value}catch(l){e(l);return}o.done?a(u):Promise.resolve(u).then(r,t)}function ee(i){return function(){var a=this,e=arguments;return new Promise(function(r,t){var n=i.apply(a,e);function s(u){Ht(n,r,t,s,o,"next",u)}function o(u){Ht(n,r,t,s,o,"throw",u)}s(void 0)})}}function Be(i,a){if(!(i instanceof a))throw new TypeError("Cannot call a class as a function")}function zt(i,a){for(var e=0;e<a.length;e++){var r=a[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,Kt(r.key),r)}}function Ne(i,a,e){return a&&zt(i.prototype,a),e&&zt(i,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function R(i,a,e){return a=Kt(a),a in i?Object.defineProperty(i,a,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[a]=e,i}function Wt(i,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(a&&a.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),a&&vt(i,a)}function rt(i){return rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},rt(i)}function vt(i,a){return vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,t){return r.__proto__=t,r},vt(i,a)}function ei(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function V(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function ti(i,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return V(i)}function $t(i){var a=ei();return function(){var r=rt(i),t;if(a){var n=rt(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return ti(this,t)}}function ri(i,a){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var r=e.call(i,a||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(i)}function Kt(i){var a=ri(i,"string");return typeof a=="symbol"?a:String(a)}function qt(i,a){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);a&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable})),e.push.apply(e,r)}return e}function De(i){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?qt(Object(e),!0).forEach(function(r){_(i,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):qt(Object(e)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(e,r))})}return i}function Q(){Q=function(){return i};var i={},a=Object.prototype,e=a.hasOwnProperty,r=Object.defineProperty||function(p,h,d){p[h]=d.value},t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",s=t.asyncIterator||"@@asyncIterator",o=t.toStringTag||"@@toStringTag";function u(p,h,d){return Object.defineProperty(p,h,{value:d,enumerable:!0,configurable:!0,writable:!0}),p[h]}try{u({},"")}catch{u=function(h,d,T){return h[d]=T}}function l(p,h,d,T){var y=h&&h.prototype instanceof v?h:v,k=Object.create(y.prototype),I=new L(T||[]);return r(k,"_invoke",{value:w(p,d,I)}),k}function c(p,h,d){try{return{type:"normal",arg:p.call(h,d)}}catch(T){return{type:"throw",arg:T}}}i.wrap=l;var f={};function v(){}function m(){}function g(){}var E={};u(E,n,function(){return this});var S=Object.getPrototypeOf,C=S&&S(S(j([])));C&&C!==a&&e.call(C,n)&&(E=C);var A=g.prototype=v.prototype=Object.create(E);function N(p){["next","throw","return"].forEach(function(h){u(p,h,function(d){return this._invoke(h,d)})})}function O(p,h){function d(y,k,I,H){var z=c(p[y],p,k);if(z.type!=="throw"){var q=z.arg,te=q.value;return te&&typeof te=="object"&&e.call(te,"__await")?h.resolve(te.__await).then(function(W){d("next",W,I,H)},function(W){d("throw",W,I,H)}):h.resolve(te).then(function(W){q.value=W,I(q)},function(W){return d("throw",W,I,H)})}H(z.arg)}var T;r(this,"_invoke",{value:function(y,k){function I(){return new h(function(H,z){d(y,k,H,z)})}return T=T?T.then(I,I):I()}})}function w(p,h,d){var T="suspendedStart";return function(y,k){if(T==="executing")throw new Error("Generator is already running");if(T==="completed"){if(y==="throw")throw k;return ie()}for(d.method=y,d.arg=k;;){var I=d.delegate;if(I){var H=P(I,d);if(H){if(H===f)continue;return H}}if(d.method==="next")d.sent=d._sent=d.arg;else if(d.method==="throw"){if(T==="suspendedStart")throw T="completed",d.arg;d.dispatchException(d.arg)}else d.method==="return"&&d.abrupt("return",d.arg);T="executing";var z=c(p,h,d);if(z.type==="normal"){if(T=d.done?"completed":"suspendedYield",z.arg===f)continue;return{value:z.arg,done:d.done}}z.type==="throw"&&(T="completed",d.method="throw",d.arg=z.arg)}}}function P(p,h){var d=h.method,T=p.iterator[d];if(T===void 0)return h.delegate=null,d==="throw"&&p.iterator.return&&(h.method="return",h.arg=void 0,P(p,h),h.method==="throw")||d!=="return"&&(h.method="throw",h.arg=new TypeError("The iterator does not provide a '"+d+"' method")),f;var y=c(T,p.iterator,h.arg);if(y.type==="throw")return h.method="throw",h.arg=y.arg,h.delegate=null,f;var k=y.arg;return k?k.done?(h[p.resultName]=k.value,h.next=p.nextLoc,h.method!=="return"&&(h.method="next",h.arg=void 0),h.delegate=null,f):k:(h.method="throw",h.arg=new TypeError("iterator result is not an object"),h.delegate=null,f)}function X(p){var h={tryLoc:p[0]};1 in p&&(h.catchLoc=p[1]),2 in p&&(h.finallyLoc=p[2],h.afterLoc=p[3]),this.tryEntries.push(h)}function J(p){var h=p.completion||{};h.type="normal",delete h.arg,p.completion=h}function L(p){this.tryEntries=[{tryLoc:"root"}],p.forEach(X,this),this.reset(!0)}function j(p){if(p){var h=p[n];if(h)return h.call(p);if(typeof p.next=="function")return p;if(!isNaN(p.length)){var d=-1,T=function y(){for(;++d<p.length;)if(e.call(p,d))return y.value=p[d],y.done=!1,y;return y.value=void 0,y.done=!0,y};return T.next=T}}return{next:ie}}function ie(){return{value:void 0,done:!0}}return m.prototype=g,r(A,"constructor",{value:g,configurable:!0}),r(g,"constructor",{value:m,configurable:!0}),m.displayName=u(g,o,"GeneratorFunction"),i.isGeneratorFunction=function(p){var h=typeof p=="function"&&p.constructor;return!!h&&(h===m||(h.displayName||h.name)==="GeneratorFunction")},i.mark=function(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,g):(p.__proto__=g,u(p,o,"GeneratorFunction")),p.prototype=Object.create(A),p},i.awrap=function(p){return{__await:p}},N(O.prototype),u(O.prototype,s,function(){return this}),i.AsyncIterator=O,i.async=function(p,h,d,T,y){y===void 0&&(y=Promise);var k=new O(l(p,h,d,T),y);return i.isGeneratorFunction(h)?k:k.next().then(function(I){return I.done?I.value:k.next()})},N(A),u(A,o,"Generator"),u(A,n,function(){return this}),u(A,"toString",function(){return"[object Generator]"}),i.keys=function(p){var h=Object(p),d=[];for(var T in h)d.push(T);return d.reverse(),function y(){for(;d.length;){var k=d.pop();if(k in h)return y.value=k,y.done=!1,y}return y.done=!0,y}},i.values=j,L.prototype={constructor:L,reset:function(p){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(J),!p)for(var h in this)h.charAt(0)==="t"&&e.call(this,h)&&!isNaN(+h.slice(1))&&(this[h]=void 0)},stop:function(){this.done=!0;var p=this.tryEntries[0].completion;if(p.type==="throw")throw p.arg;return this.rval},dispatchException:function(p){if(this.done)throw p;var h=this;function d(z,q){return k.type="throw",k.arg=p,h.next=z,q&&(h.method="next",h.arg=void 0),!!q}for(var T=this.tryEntries.length-1;T>=0;--T){var y=this.tryEntries[T],k=y.completion;if(y.tryLoc==="root")return d("end");if(y.tryLoc<=this.prev){var I=e.call(y,"catchLoc"),H=e.call(y,"finallyLoc");if(I&&H){if(this.prev<y.catchLoc)return d(y.catchLoc,!0);if(this.prev<y.finallyLoc)return d(y.finallyLoc)}else if(I){if(this.prev<y.catchLoc)return d(y.catchLoc,!0)}else{if(!H)throw new Error("try statement without catch or finally");if(this.prev<y.finallyLoc)return d(y.finallyLoc)}}}},abrupt:function(p,h){for(var d=this.tryEntries.length-1;d>=0;--d){var T=this.tryEntries[d];if(T.tryLoc<=this.prev&&e.call(T,"finallyLoc")&&this.prev<T.finallyLoc){var y=T;break}}y&&(p==="break"||p==="continue")&&y.tryLoc<=h&&h<=y.finallyLoc&&(y=null);var k=y?y.completion:{};return k.type=p,k.arg=h,y?(this.method="next",this.next=y.finallyLoc,f):this.complete(k)},complete:function(p,h){if(p.type==="throw")throw p.arg;return p.type==="break"||p.type==="continue"?this.next=p.arg:p.type==="return"?(this.rval=this.arg=p.arg,this.method="return",this.next="end"):p.type==="normal"&&h&&(this.next=h),f},finish:function(p){for(var h=this.tryEntries.length-1;h>=0;--h){var d=this.tryEntries[h];if(d.finallyLoc===p)return this.complete(d.completion,d.afterLoc),J(d),f}},catch:function(p){for(var h=this.tryEntries.length-1;h>=0;--h){var d=this.tryEntries[h];if(d.tryLoc===p){var T=d.completion;if(T.type==="throw"){var y=T.arg;J(d)}return y}}throw new Error("illegal catch attempt")},delegateYield:function(p,h,d){return this.delegate={iterator:j(p),resultName:h,nextLoc:d},this.method==="next"&&(this.arg=void 0),f}},i}function Ee(i){"@babel/helpers - typeof";return Ee=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},Ee(i)}function Yt(i,a,e,r,t,n,s){try{var o=i[n](s),u=o.value}catch(l){e(l);return}o.done?a(u):Promise.resolve(u).then(r,t)}function ce(i){return function(){var a=this,e=arguments;return new Promise(function(r,t){var n=i.apply(a,e);function s(u){Yt(n,r,t,s,o,"next",u)}function o(u){Yt(n,r,t,s,o,"throw",u)}s(void 0)})}}function $(i,a){if(!(i instanceof a))throw new TypeError("Cannot call a class as a function")}function Qt(i,a){for(var e=0;e<a.length;e++){var r=a[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,rr(r.key),r)}}function K(i,a,e){return a&&Qt(i.prototype,a),e&&Qt(i,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function _(i,a,e){return a=rr(a),a in i?Object.defineProperty(i,a,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[a]=e,i}function ve(i,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(a&&a.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),a&&$e(i,a)}function Pe(i){return Pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Pe(i)}function $e(i,a){return $e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,t){return r.__proto__=t,r},$e(i,a)}function Zt(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function nt(i,a,e){return Zt()?nt=Reflect.construct.bind():nt=function(t,n,s){var o=[null];o.push.apply(o,n);var u=Function.bind.apply(t,o),l=new u;return s&&$e(l,s.prototype),l},nt.apply(null,arguments)}function ai(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function Ie(i){var a=typeof Map=="function"?new Map:void 0;return Ie=function(r){if(r===null||!ai(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a<"u"){if(a.has(r))return a.get(r);a.set(r,t)}function t(){return nt(r,arguments,Pe(this).constructor)}return t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),$e(t,r)},Ie(i)}function si(i,a){if(i==null)return{};var e={},r=Object.keys(i),t,n;for(n=0;n<r.length;n++)t=r[n],!(a.indexOf(t)>=0)&&(e[t]=i[t]);return e}function er(i,a){if(i==null)return{};var e=si(i,a),r,t;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);for(t=0;t<n.length;t++)r=n[t],!(a.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(i,r)&&(e[r]=i[r])}return e}function D(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function oi(i,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return D(i)}function me(i){var a=Zt();return function(){var r=Pe(i),t;if(a){var n=Pe(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return oi(this,t)}}function ui(i,a){for(;!Object.prototype.hasOwnProperty.call(i,a)&&(i=Pe(i),i!==null););return i}function We(){return typeof Reflect<"u"&&Reflect.get?We=Reflect.get.bind():We=function(a,e,r){var t=ui(a,e);if(t){var n=Object.getOwnPropertyDescriptor(t,e);return n.get?n.get.call(arguments.length<3?a:r):n.value}},We.apply(this,arguments)}function li(i,a){if(i){if(typeof i=="string")return Jt(i,a);var e=Object.prototype.toString.call(i).slice(8,-1);if(e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set")return Array.from(i);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Jt(i,a)}}function Jt(i,a){(a==null||a>i.length)&&(a=i.length);for(var e=0,r=new Array(a);e<a;e++)r[e]=i[e];return r}function tr(i,a){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!e){if(Array.isArray(i)||(e=li(i))||a&&i&&typeof i.length=="number"){e&&(i=e);var r=0,t=function(){};return{s:t,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(u){throw u},f:t}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,s=!1,o;return{s:function(){e=e.call(i)},n:function(){var u=e.next();return n=u.done,u},e:function(u){s=!0,o=u},f:function(){try{!n&&e.return!=null&&e.return()}finally{if(s)throw o}}}}function ci(i,a){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var r=e.call(i,a||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(i)}function rr(i){var a=ci(i,"string");return typeof a=="symbol"?a:String(a)}var Z=function(){function i(){$(this,i)}return K(i,null,[{key:"start",value:function(e){return!e||!e.length||e.length===1&&e.end(0)-e.start(0)<1e-6||e.length===1&&e.start(0)<0?0:e.start(0)}},{key:"end",value:function(e){return!e||!e.length||e.length===1&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1)}},{key:"get",value:function(e){if(e)try{return e.buffered}catch{}}},{key:"buffers",value:function(e,r){if(!e||!e.length)return[];for(var t=[],n=0,s=e.length;n<s;n++){var o=t.length;if(!o||!r)t.push([e.start(n),e.end(n)]);else{var u=t[o-1],l=u[1],c=e.start(n);if(c-l<=r){var f=e.end(n);f>l&&(u[1]=f)}else t.push([e.start(n),e.end(n)])}}return t}},{key:"totalLength",value:function(e){return!e||!e.length?0:e.reduce(function(r,t){return r+=t[1]-t[0]},0)}},{key:"info",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(!e||!e.length)return{start:0,end:0,buffers:[]};for(var n=0,s=0,o=0,u=0,l=0,c=0,f=0,v=i.buffers(e,t),m=0,g=v.length;m<g;m++){var E=v[m];if(r+t>=E[0]&&r<=E[1])n=E[0],s=E[1],o=m;else if(r+t<E[0]){u=E[0],l=E[1];break}else r+t>E[1]&&(c=E[0],f=E[1])}return{start:n,end:s,index:o,buffers:v,nextStart:u,nextEnd:l,prevStart:c,prevEnd:f,currentTime:r,behind:r-n,remaining:s?s-r:0,length:i.totalLength&&i.totalLength(v)}}},{key:"isBuffered",value:function(e,r){if(e){var t=i.get(e);if(t!=null&&t.length){for(var n=0;n<t.length;n++)if(r>=t.start(n)&&r<=t.end(n))return!0}}return!1}}]),i}();var ir=typeof window<"u";var le,G={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",NETWORK_FORBIDDEN:"network_forbidden",NETWORK_NOTFOUND:"network_notfound",NETWROK_RANGE_NOT_SATISFIABLE:"network_range_not_satisfiable",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",RUNTIME:"runtime",SUB_TYPES:{FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",MSE_CHANGE_TYPE:"MSE_CHANGE_TYPE",OPTION:"OPTION",DASH:"DASH",LICENSE:"LICENSE",CUSTOM_LICENSE:"CUSTOM_LICENSE",MSE_HIJACK:"MSE_HIJACK",EME_HIJACK:"EME_HIJACK",SIDX:"SIDX",NO_CANPLAY_ERROR:"NO_CANPLAY_ERROR",BUFFERBREAK_ERROR:"BUFFERBREAK_ERROR",WAITING_TIMEOUT_ERROR:"WAITING_TIMEOUT_ERROR",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_CODEC_NOT_SUPPORTED:"MEDIA_ERR_CODEC_NOT_SUPPORTED",MEDIA_ERR_URL_EMPTY:"MEDIA_ERR_URL_EMPTY"}},at=(le={},_(le,G.MANIFEST,{HLS:1100,DASH:1200}),_(le,G.NETWORK,2100),_(le,G.NETWORK_TIMEOUT,2101),_(le,G.NETWORK_FORBIDDEN,2103),_(le,G.NETWORK_NOTFOUND,2104),_(le,G.NETWROK_RANGE_NOT_SATISFIABLE,2116),_(le,G.DEMUX,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),_(le,G.REMUX,{FMP4:4100,MP4:4200}),_(le,G.MEDIA,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,MSE_CHANGE_TYPE:5205,EME_HIJACK:5301}),_(le,G.DRM,{LICENSE:7100,CUSTOM_LICENSE:7200}),_(le,G.OTHER,8e3),_(le,G.RUNTIME,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003}),le),se=function(i){ve(e,i);var a=me(e);function e(r,t,n,s,o){var u;return $(this,e),u=a.call(this,o||n?.message),u.errorType=r===G.NETWORK_TIMEOUT?G.NETWORK:r,u.originError=n,u.ext=s,u.errorCode=at[r][t]||at[r],u.errorMessage=u.message,u.errorCode||(u.errorType=G.OTHER,u.errorCode=at[u.errorType]),u}return K(e,null,[{key:"create",value:function(t,n,s,o,u){return t instanceof e?t:(t instanceof Error&&(s=t,t=""),t||(t=G.OTHER),new e(t,n,s,o,u))}},{key:"network",value:function(t){var n;return new e(t!=null&&t.isTimeout?G.NETWORK_TIMEOUT:G.NETWORK,null,t instanceof Error?t:null,{url:t?.url,response:t?.response,httpCode:t==null||(n=t.response)===null||n===void 0?void 0:n.status})}}]),e}(Ie(Error));var Xe={DEBUG:1,LOG:2,WARN:3,ERROR:4},fi=200*1024,hi=["Boolean","Number","String","Undefined","Null","Date","Object"],fe=function(){function i(a,e){$(this,i),this.name=a||"",this._prefix="[".concat(this.name,"]"),this.logCacheLevel=e?.logCacheLevel||3,this.logMaxSize=e?.logMaxSize||fi,this.logSize=0,this.logTextArray=[]}return K(i,[{key:"debug",value:function(){for(var e,r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];this.logCache.apply(this,[Xe.DEBUG].concat(t)),!i.disabled&&(e=console).debug.apply(e,["[".concat(Ke(),"]"),this._prefix].concat(t))}},{key:"log",value:function(){for(var e,r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];this.logCache.apply(this,[Xe.LOG].concat(t)),!i.disabled&&(e=console).log.apply(e,["[".concat(Ke(),"]"),this._prefix].concat(t))}},{key:"warn",value:function(){for(var e,r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];this.logCache.apply(this,[Xe.WARN].concat(t)),!i.disabled&&(e=console).warn.apply(e,["[".concat(Ke(),"]"),this._prefix].concat(t))}},{key:"error",value:function(){for(var e,r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];this.logCache.apply(this,[Xe.ERROR].concat(t)),!i.disabled&&(e=console).error.apply(e,["[".concat(Ke(),"]"),this._prefix].concat(t))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var r="";try{for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];var o=n.map(function(l){return nr(l)});r="[".concat(Ke(),"]")+this._prefix+JSON.stringify(o)}catch{return}if(e>=this.logCacheLevel&&(this.logSize+=r.length,this.logTextArray.push(r)),this.logSize>this.logMaxSize){var u=this.logTextArray.shift();this.logSize-=u.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join(`
4
+ `);return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var e;i.disabled||(console.group(this._prefix),(e=console).table.apply(e,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){i.disabled=!1}},{key:"disable",value:function(){i.disabled=!0}}]),i}();_(fe,"disabled",!0);function Ke(){return new Date().toLocaleString()}function pi(i){if(Ee(i)!=="object")return i;var a=Object.prototype.toString.call(i).slice(8,-1);switch(a){case"Array":case"Uint8Array":case"ArrayBuffer":return a+"["+i.length+"]";case"Object":return"{}";default:return a}}function nr(i,a,e){e||(e=1),a||(a=2);var r={};if(!i||Ee(i)!=="object")return i;var t=Object.prototype.toString.call(i).slice(8,-1);if(!hi.includes(t))return t;if(!(e>a)){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e===a?r[n]=pi(i[n]):Ee(i[n])==="object"?r[n]=nr(i[n],a,e+1):r[n]=i[n]);return r}}function Re(){var i,a,e=new Promise(function(r,t){i=r,a=t});return e.used=!1,e.resolve=function(){return e.used=!0,i.apply(void 0,arguments)},e.reject=function(){return e.used=!0,a.apply(void 0,arguments)},e}function Me(){try{return parseInt(performance.now(),10)}catch{return new Date().getTime()}}var ar={stringify:function(a){try{return JSON.stringify(a)}catch{return""}},parse:function(a){try{return JSON.parse(a)}catch{return}}};function sr(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;try{return ir?i&&typeof ManagedMediaSource<"u"?ManagedMediaSource:window.MediaSource:null}catch{}}function _t(i){return/ManagedMediaSource/gi.test(Object.prototype.toString.call(i))}function di(i){var a=[];if(i instanceof TimeRanges)for(var e=0;e<i.length;e++)a.push({start:i.start(e),end:i.end(e)});return a}var st={APPEND:"appendBuffer",REMOVE:"removeBuffer",UPDATE_DURATION:"updateDuration"};var Le=function(){function i(a,e){var r=this;$(this,i),_(this,"media",null),_(this,"mediaSource",null),_(this,"_openPromise",Re()),_(this,"_queue",Object.create(null)),_(this,"_sourceBuffer",Object.create(null)),_(this,"_mseFullFlag",{}),_(this,"_st",0),_(this,"_opst",0),_(this,"_logger",null),_(this,"_config",null),_(this,"_url",null),_(this,"_onStartStreaming",function(){r._logger.debug("startstreaming")}),_(this,"_onEndStreaming",function(){r._logger.debug("endstreaming")}),_(this,"_onSBUpdateEnd",function(t){var n=r._queue[t];if(n){var s=n[0];if(s?.opName!==st.UPDATE_DURATION&&n.shift(),s){var o,u,l=Me()-r._opst;r._logger.debug("UpdateEnd(".concat(t,"/").concat(s.opName,")"),ar.stringify(di((o=r._sourceBuffer[t])===null||o===void 0?void 0:o.buffered)),l,s.context),s.promise.resolve({name:s.opName,context:s.context,costtime:l});var c=(u=s.context)===null||u===void 0?void 0:u.callback;c&&typeof c=="function"&&c(s.context),r._startQueue(t)}}}),_(this,"_onSBUpdateError",function(t,n){var s=r._queue[t];if(s){var o=s[0];o&&(r._logger.error("UpdateError",t,o.opName,o.context),o.promise.reject(new se(G.MEDIA,G.SUB_TYPES.MSE_APPEND_BUFFER,n)))}}),this._config=Object.assign(i.getDefaultConfig(),e),a&&this.bindMedia(a),this._logger=new fe("MSE"),this._config.openLog&&fe.enable()}return K(i,[{key:"isOpened",get:function(){var e;return((e=this.mediaSource)===null||e===void 0?void 0:e.readyState)==="open"}},{key:"hasOpTasks",get:function(){var e=this,r=!1;return Object.keys(this._queue).forEach(function(t){var n=e._queue[t];Array.isArray(n)&&(r||(r=n.length>0))}),r}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return((e=this.mediaSource)===null||e===void 0?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return this.mediaSource?this.mediaSource.readyState==="ended":!1}},{key:"streaming",get:function(){return _t(this.mediaSource)?this.mediaSource.streaming:!0}},{key:"isFull",value:function(e){return e?this._mseFullFlag[e]:this._mseFullFlag[i.VIDEO]}},{key:"updateDuration",value:function(e){var r=this,t=this.mediaSource&&this.mediaSource.duration>e;if(this.mediaSource&&this.mediaSource.duration>e){var n=0;if(Object.keys(this._sourceBuffer).forEach(function(s){try{n=Math.max(r.bufferEnd(s)||0,n)}catch{}}),e<n)return Promise.resolve()}return this._enqueueBlockingOp(function(){if(r.isEnded){r._logger.debug("setDuration but ended");return}r.mediaSource&&(r.mediaSource.duration=e,r._logger.debug("setDuration",e))},st.UPDATE_DURATION,{isReduceDuration:t})}},{key:"open",value:function(){var e=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var r=this.mediaSource,t=function n(){var s=Me()-e._st;e._logger.debug("sourceopen",s),r.removeEventListener("sourceopen",n),e._openPromise.resolve({costtime:s})};r.addEventListener("sourceopen",t),this._openPromise=Re()}return this._openPromise}},{key:"bindMedia",value:function(){var a=ce(Q().mark(function r(t){var n=this,s,o,u,l;return Q().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(!(this.mediaSource||this.media)){f.next=3;break}return f.next=3,this.unbindMedia();case 3:if(s=sr(this._config.preferMMS),!(!t||!s)){f.next=6;break}throw new Error("Param media or MediaSource does not exist");case 6:return this.media=t,o=this.mediaSource=new s,u=_t(o),this._st=Me(),l=function v(){var m=Me()-n._st;n._logger.debug("sourceopen"),o.removeEventListener("sourceopen",v),URL.revokeObjectURL(t.src),n._openPromise.resolve({costtime:m})},o.addEventListener("sourceopen",l),u&&(o.addEventListener("startstreaming",this._onStartStreaming),o.addEventListener("endstreaming",this._onEndStreaming)),this._url=URL.createObjectURL(o),t.src=this._url,t.disableRemotePlayback=u,f.abrupt("return",this._openPromise);case 17:case"end":return f.stop()}},r,this)}));function e(r){return a.apply(this,arguments)}return e}()},{key:"unbindMedia",value:function(){var a=ce(Q().mark(function r(){var t=this,n,s,o;return Q().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),n=this.mediaSource,n){if(Object.keys(this._queue).forEach(function(c){var f=t._queue[c];f&&f.forEach(function(v){var m,g;return(m=v.promise)===null||m===void 0||(g=m.resolve)===null||g===void 0?void 0:g.call(m)})}),s=!!this.media&&this.media.readyState>=1,o=n.readyState==="open",s&&o)try{n.endOfStream()}catch{}Object.keys(this._sourceBuffer).forEach(function(c){try{n.removeSourceBuffer(t._sourceBuffer[c])}catch{}}),_t(n)&&(n.removeEventListener("startstreaming",this._onStartStreaming),n.removeEventListener("endstreaming",this._onEndStreaming))}if(this.media){this.media.disableRemotePlayback=!1,this.media.removeAttribute("src");try{this.media.load()}catch{}this.media=null}this.mediaSource=null,this._openPromise=Re(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return l.stop()}},r,this)}));function e(){return a.apply(this,arguments)}return e}()},{key:"createSource",value:function(e,r){if(!(this._sourceBuffer[e]||!this.mediaSource)){var t;try{t=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(r)}catch(n){throw new se(G.MEDIA,G.SUB_TYPES.MSE_ADD_SB,n)}t.mimeType=r,t.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),t.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,r){var t=this,n=this._sourceBuffer[e];return!this.mediaSource||!n||n.mimeType===r?Promise.resolve():typeof n.changeType!="function"?Promise.reject(new se(G.MEDIA,G.SUB_TYPES.MSE_CHANGE_TYPE,new Error("changeType is not a function"))):this._enqueueOp(e,function(){try{n.changeType(r)}catch(s){throw new se(G.MEDIA,G.SUB_TYPES.MSE_CHANGE_TYPE,s)}n.mimeType=r,t._onSBUpdateEnd(e)},"changeType",{mimeType:r})}},{key:"createOrChangeSource",value:function(e,r){return this.createSource(e,r),this.changeType(e,r)}},{key:"append",value:function(e,r,t){var n=this;return!r||!r.byteLength||!this._sourceBuffer[e]?Promise.resolve():this._enqueueOp(e,function(){var s;!n.mediaSource||n.media.error||(n._logger.debug("MSE APPEND START",t),n._opst=Me(),(s=n._sourceBuffer[e])===null||s===void 0||s.appendBuffer(r))},st.APPEND,t)}},{key:"remove",value:function(e,r,t,n){var s=this,o=!1;return this._mseFullFlag[e]&&(o=!0),this._enqueueOp(e,function(){if(!(!s.mediaSource||s.media.error)){var u=s._sourceBuffer[e];if(r>=t||!u){s._onSBUpdateEnd(e);return}s._opst=Me(),s._logger.debug("MSE REMOVE START",e,r,t,n),u.remove(r,t)}},st.REMOVE,n,o)}},{key:"clearBuffer",value:function(e,r){var t=this,n;return Object.keys(this._sourceBuffer).forEach(function(s){n=t.remove(s,e,r)}),n||Promise.resolve()}},{key:"clearAllBuffer",value:function(){var e=this,r;return Object.keys(this._sourceBuffer).forEach(function(t){var n=e._sourceBuffer[t];r=e.remove(t,0,Z.end(Z.get(n)))}),r}},{key:"clearOpQueues",value:function(e,r){var t;this._logger.debug("MSE clearOpQueue START");var n=this._queue[e];if(r&&n){this._queue[e]=[];return}if(!(!n||!n[e]||n.length<5)){var s=[];n.forEach(function(o){o.context&&o.context.isinit&&s.push(o)}),this._queue[e]=n.slice(0,2),s.length>0&&(t=this._queue[e]).push.apply(t,s)}}},{key:"endOfStream",value:function(e){var r=this;return!this.mediaSource||this.mediaSource.readyState!=="open"?Promise.resolve():this._enqueueBlockingOp(function(){var t=r.mediaSource;!t||t.readyState!=="open"||(r._logger.debug("MSE endOfStream START"),e?t.endOfStream(e):t.endOfStream())},"endOfStream")}},{key:"setLiveSeekableRange",value:function(e,r){var t=this.mediaSource;e<0||r<e||!(t!=null&&t.setLiveSeekableRange)||t.readyState!=="open"||t.setLiveSeekableRange(e,r)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return Z.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return Z.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return Z.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,r,t,n,s){var o=this;if(!this.mediaSource)return Promise.resolve();var u=this._queue[e]=this._queue[e]||[],l={exec:r,promise:Re(),opName:t,context:n};return s?(u.splice(0,0,l),this._mseFullFlag[e]=!1,this._startQueue(e)):u.push(l),this.isOpened||this.isEnded?u.length===1&&this._startQueue(e):this._openPromise.then(function(){u.length===1&&o._startQueue(e)}),l.promise}},{key:"_enqueueBlockingOp",value:function(){var a=ce(Q().mark(function r(t,n,s){var o=this,u,l;return Q().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(this.mediaSource){f.next=2;break}return f.abrupt("return",Promise.resolve());case 2:if(u=Object.keys(this._sourceBuffer),u.length){f.next=5;break}return f.abrupt("return",t());case 5:return l=[],u.forEach(function(v){var m=o._queue[v],g=Re();l.push(g),m.push({exec:function(){g.resolve()},promise:g,opName:n,context:s}),m.length===1&&o._startQueue(v)}),f.abrupt("return",Promise.all(l).then(function(){try{return t()}finally{u.forEach(function(v){var m=o._queue[v],g=o._sourceBuffer[v];m?.shift(),(!g||!g.updating)&&o._startQueue(v)})}}));case 8:case"end":return f.stop()}},r,this)}));function e(r,t,n){return a.apply(this,arguments)}return e}()},{key:"_startQueue",value:function(e){var r=this._queue[e];if(r){var t=r[0];if(t&&!this._mseFullFlag[e])try{t.exec()}catch(o){if(o&&o.message&&o.message.indexOf("SourceBuffer is full")>=0){var n;this._mseFullFlag[e]=!0,t.context&&Ee(t.context)==="object"&&(t.context.isFull=!0),this._logger.error("[MSE error], context,",t.context," ,name,",t.opName,",err,SourceBuffer is full"),t==null||(n=t.promise)===null||n===void 0||n.reject(new se(G.MEDIA,G.SUB_TYPES.MSE_FULL,o))}else{var s;this._logger.error(o),t==null||(s=t.promise)===null||s===void 0||s.reject(o.constructor===se?o:new se(G.MEDIA,G.SUB_TYPES.MSE_OTHER,o)),r.shift(),this._startQueue(e)}}}}},{key:"setTimeoffset",value:function(e,r,t){var n=this;return this._enqueueOp(e,function(){r<0&&(r+=.001),n._sourceBuffer[e].timestampOffset=r,n._onSBUpdateEnd(e)},"setTimeoffset",t)}},{key:"abort",value:function(e,r){var t=this;return this.isOpened?this._enqueueOp(e,function(){t._sourceBuffer[e].abort(),t._onSBUpdateEnd(e)},"abort",r):Promise.resolve()}}],[{key:"isSupported",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"',r=sr();if(!r)return!1;try{return r.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}}},{key:"isMMSOnly",value:function(){return typeof ManagedMediaSource<"u"&&typeof MediaSource>"u"}},{key:"getDefaultConfig",value:function(){return{openLog:!1,preferMMS:!1}}}]),i}();_(Le,"VIDEO","video");_(Le,"AUDIO","audio");var _e={FETCH:"fetch",XHR:"xhr"},xe={ARRAY_BUFFER:"arraybuffer",TEXT:"text",JSON:"json"};var de=function(i){ve(e,i);var a=me(e);function e(r,t,n,s){var o;return $(this,e),o=a.call(this,s),_(D(o),"retryCount",0),_(D(o),"isTimeout",!1),_(D(o),"loaderType",_e.FETCH),_(D(o),"startTime",0),_(D(o),"endTime",0),_(D(o),"options",{}),o.url=r,o.request=t,o.response=n,o}return K(e)}(Ie(Error));var or=Object.prototype.toString;function ur(i){return i!==null&&Ee(i)==="object"}function gt(i){if(or.call(i)!=="[object Object]")return!1;var a=Object.getPrototypeOf(i);return a===null||a===Object.prototype}function lr(i){return or.call(i)==="[object Date]"}function ot(i){if(!(!i||i[0]===null||i[0]===void 0||i[0]===0&&(i[1]===null||i[1]===void 0))){var a="bytes="+i[0]+"-";return i[1]&&(a+=i[1]),a}}function cr(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ut(i,a){if(i){if(!a)return i;var e,r=Object.keys(a).map(function(n){if(e=a[n],e!=null)return Array.isArray(e)?n=n+"[]":e=[e],e.map(function(s){return lr(s)?s=s.toISOString():ur(s)&&(s=JSON.stringify(s)),"".concat(cr(n),"=").concat(cr(s))}).join("&")}).filter(Boolean).join("&");if(r){var t=i.indexOf("#");t!==-1&&(i=i.slice(0,t)),i+=(i.indexOf("?")===-1?"?":"&")+r}return i}}function qe(i,a,e,r,t,n,s,o,u,l,c){t=t!=null?parseFloat(t):null,r=parseInt(r||"0",10),Number.isNaN(r)&&(r=0);var f={range:u,vid:l,index:o,contentLength:r,age:t,startTime:n,firstByteTime:s,endTime:Date.now(),priOptions:c};return{data:i,done:a,options:f,response:e}}function Ye(i,a){return Math.round(i*8*1e3/a/1024)}var x={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",MEDIASOURCE_OPENED:"core.mediasourceopened",ANALYZE_DURATION_EXCEEDED:"core.analyzedurationexceeded",APPEND_BUFFER:"core.appendbuffer",REMOVE_BUFFER:"core.removebuffer",BUFFEREOS:"core.buffereos",KEYFRAME:"core.keyframe",CHASEFRAME:"core.chaseframe",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",DEMUXED_TRACK:"core.demuxedtrack",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",REAL_TIME_SPEED:"real_time_speed"};var hr=He(Fe()),fr=2*1024*1024,Qe=function(i){ve(e,i);var a=me(e);function e(){var r;return $(this,e),r=a.call(this),_(D(r),"_abortController",null),_(D(r),"_timeoutTimer",null),_(D(r),"_reader",null),_(D(r),"_response",null),_(D(r),"_aborted",!1),_(D(r),"_index",-1),_(D(r),"_range",null),_(D(r),"_receivedLength",0),_(D(r),"_running",!1),_(D(r),"_logger",null),_(D(r),"_vid",""),_(D(r),"_onProcessMinLen",0),_(D(r),"_onCancel",null),_(D(r),"_priOptions",null),r}return K(e,[{key:"load",value:function(t){var n,s=this,o=t.url,u=t.vid,l=t.timeout,c=t.responseType,f=t.onProgress,v=t.index,m=t.onTimeout,g=t.onCancel,E=t.range,S=t.transformResponse,C=t.request,A=t.params,N=t.logger,O=t.method,w=t.headers,P=t.body,X=t.mode,J=t.credentials,L=t.cache,j=t.redirect,ie=t.referrer,p=t.referrerPolicy,h=t.onProcessMinLen,d=t.priOptions;this._logger=N,this._aborted=!1,this._onProcessMinLen=h,this._onCancel=g,this._abortController=typeof AbortController<"u"&&new AbortController,this._running=!0,this._index=v,this._range=E||[0,0],this._vid=u||o,this._priOptions=d||{};var T={method:O,headers:w,body:P,mode:X,credentials:J,cache:L,redirect:j,referrer:ie,referrerPolicy:p,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},y=!1;clearTimeout(this._timeoutTimer),o=ut(o,A);var k=ot(E);k&&(C?w=C.headers:w=T.headers=T.headers||(Headers?new Headers:{}),Headers&&w instanceof Headers?w.append("Range",k):w.Range=k),l&&(this._timeoutTimer=setTimeout(function(){if(y=!0,s.cancel(),m){var H=new de(o,T,null,"timeout");H.isTimeout=!0,m(H,{index:s._index,range:s._range,vid:s._vid,priOptions:s._priOptions})}},l));var I=Date.now();return this._logger.debug("[fetch load start], index,",v,",range,",E),new Promise(function(H,z){fetch(C||o,C?void 0:T).then(function(){var q=ce(Q().mark(function te(W){var pt,Oe,dt,Gt;return Q().wrap(function(re){for(;;)switch(re.prev=re.next){case 0:if(clearTimeout(s._timeoutTimer),s._response=W,!(s._aborted||!s._running)){re.next=4;break}return re.abrupt("return");case 4:if(S&&(W=S(W,o)||W),W.ok){re.next=7;break}throw new de(o,T,W,"bad network response");case 7:if(pt=Date.now(),c!==xe.TEXT){re.next=15;break}return re.next=11,W.text();case 11:Oe=re.sent,s._running=!1,re.next=37;break;case 15:if(c!==xe.JSON){re.next=22;break}return re.next=18,W.json();case 18:Oe=re.sent,s._running=!1,re.next=37;break;case 22:if(!f){re.next=29;break}return s.resolve=H,s.reject=z,s._loadChunk(W,f,I,pt),re.abrupt("return");case 29:return re.next=31,W.arrayBuffer();case 31:Oe=re.sent,Oe=new Uint8Array(Oe),s._running=!1,dt=Date.now()-I,Gt=Ye(Oe.byteLength,dt),s.emit(x.REAL_TIME_SPEED,{speed:Gt,len:Oe.byteLength,time:dt,vid:s._vid,index:s._index,range:s._range,priOptions:s._priOptions});case 37:s._logger.debug("[fetch load end], index,",v,",range,",E),H(qe(Oe,!0,W,W.headers.get("Content-Length"),W.headers.get("age"),I,pt,v,E,s._vid,s._priOptions));case 39:case"end":return re.stop()}},te)}));return function(te){return q.apply(this,arguments)}}()).catch(function(q){var te;clearTimeout(s._timeoutTimer),s._running=!1,!(s._aborted&&!y)&&(q=q instanceof de?q:new de(o,T,null,(te=q)===null||te===void 0?void 0:te.message),q.startTime=I,q.endTime=Date.now(),q.isTimeout=y,q.options={index:s._index,range:s._range,vid:s._vid,priOptions:s._priOptions},z(q))})})}},{key:"cancel",value:function(){var r=ce(Q().mark(function n(){return Q().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!this._aborted){o.next=2;break}return o.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){o.next=14;break}if(o.prev=5,!this._reader){o.next=9;break}return o.next=9,this._reader.cancel();case 9:o.next=13;break;case 11:o.prev=11,o.t0=o.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch{}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return o.stop()}},n,this,[[5,11]])}));function t(){return r.apply(this,arguments)}return t}()},{key:"_loadChunk",value:function(t,n,s,o){var u=this;if(!t.body||!t.body.getReader){this._running=!1;var l=new de(t.url,"",t,"onProgress of bad response.body.getReader");l.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this.reject(l);return}this._onProcessMinLen>0&&(this._cache=new Uint8Array(fr),this._writeIdx=0);var c=this._reader=t.body.getReader(),f,v,m,g=function(){var E=ce(Q().mark(function S(){var C,A,N,O,w,P,X,J;return Q().wrap(function(j){for(;;)switch(j.prev=j.next){case 0:return v=Date.now(),j.prev=1,j.next=4,c.read();case 4:f=j.sent,m=Date.now(),j.next=13;break;case 8:return j.prev=8,j.t0=j.catch(1),m=Date.now(),u._aborted||(u._running=!1,j.t0.options={index:u._index,range:u._range,vid:u._vid,priOptions:u._priOptions},u.reject(j.t0)),j.abrupt("return");case 13:if(A=((C=u._range)===null||C===void 0?void 0:C.length)>0?u._range[0]:0,N=A+u._receivedLength,!u._aborted){j.next=19;break}return u._running=!1,n(void 0,!1,{range:[N,N],vid:u._vid,index:u._index,startTime:v,endTime:m,st:s,firstByteTime:o,priOptions:u._priOptions},t),j.abrupt("return");case 19:O=f.value?f.value.byteLength:0,u._receivedLength+=O,u._logger.debug("\u3010fetchLoader,onProgress call\u3011,task,",u._range,", start,",N,", end,",A+u._receivedLength,", done,",f.done),u._onProcessMinLen>0?u._writeIdx+O>=u._onProcessMinLen||f.done?(w=new Uint8Array(u._writeIdx+O),w.set(u._cache.slice(0,u._writeIdx),0),O>0&&w.set(f.value,u._writeIdx),u._writeIdx=0,u._logger.debug("\u3010fetchLoader,onProgress enough\u3011,done,",f.done,",len,",w.byteLength,", writeIdx,",u._writeIdx)):O>0&&u._writeIdx+O<fr?(u._cache.set(f.value,u._writeIdx),u._writeIdx+=O,u._logger.debug("\u3010fetchLoader,onProgress cache\u3011,len,",O,", writeIdx,",u._writeIdx)):O>0&&(P=new Uint8Array(u._writeIdx+O+2048),u._logger.debug("\u3010fetchLoader,onProgress extra start\u3011,size,",u._writeIdx+O+2048,", datalen,",O,", writeIdx,",u._writeIdx),P.set(u._cache.slice(0,u._writeIdx),0),O>0&&P.set(f.value,u._writeIdx),u._writeIdx+=O,delete u._cache,u._cache=P,u._logger.debug("\u3010fetchLoader,onProgress extra end\u3011,len,",O,", writeIdx,",u._writeIdx)):w=f.value,(w&&w.byteLength>0||f.done)&&n(w,f.done,{range:[u._range[0]+u._receivedLength-(w?w.byteLength:0),u._range[0]+u._receivedLength],vid:u._vid,index:u._index,startTime:v,endTime:m,st:s,firstByteTime:o,priOptions:u._priOptions},t),f.done?(X=Date.now()-s,J=Ye(u._receivedLength,X),u.emit(x.REAL_TIME_SPEED,{speed:J,len:u._receivedLength,time:X,vid:u._vid,index:u._index,range:u._range,priOptions:u._priOptions}),u._running=!1,u._logger.debug("[fetchLoader onProgress end],task,",u._range,",done,",f.done),u.resolve(qe(f,!0,t,t.headers.get("Content-Length"),t.headers.get("age"),s,o,u._index,u._range,u._vid,u._priOptions))):g();case 25:case"end":return j.stop()}},S,null,[[1,8]])}));return function(){return E.apply(this,arguments)}}();g()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(t){this._running=t}}],[{key:"isSupported",value:function(){return typeof fetch<"u"}}]),e}(hr.default);function pr(i){return De({loaderType:_e.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:xe.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,onProcessMinLen:0},i)}var dr=He(Fe()),vr=function(i){ve(e,i);var a=me(e);function e(){var r;return $(this,e),r=a.call(this),_(D(r),"_xhr",null),_(D(r),"_aborted",!1),_(D(r),"_timeoutTimer",null),_(D(r),"_range",null),_(D(r),"_receivedLength",0),_(D(r),"_url",null),_(D(r),"_onProgress",null),_(D(r),"_index",-1),_(D(r),"_headers",null),_(D(r),"_currentChunkSizeKB",384),_(D(r),"_timeout",null),_(D(r),"_xhr",null),_(D(r),"_withCredentials",null),_(D(r),"_startTime",-1),_(D(r),"_loadCompleteResolve",null),_(D(r),"_loadCompleteReject",null),_(D(r),"_runing",!1),_(D(r),"_logger",!1),_(D(r),"_vid",""),_(D(r),"_responseType",void 0),_(D(r),"_credentials",void 0),_(D(r),"_method",void 0),_(D(r),"_transformResponse",void 0),_(D(r),"_firstRtt",void 0),_(D(r),"_onCancel",null),_(D(r),"_priOptions",null),r}return K(e,[{key:"load",value:function(t){var n=this;clearTimeout(this._timeoutTimer),this._logger=t.logger,this._range=t.range,this._onProgress=t.onProgress,this._index=t.index,this._headers=t.headers,this._withCredentials=t.credentials==="include"||t.credentials==="same-origin",this._body=t.body||null,t.method&&(this._method=t.method),this._timeout=t.timeout||null,this._runing=!0,this._vid=t.vid||t.url,this._responseType=t.responseType,this._firstRtt=-1,this._onTimeout=t.onTimeout,this._onCancel=t.onCancel,this._request=t.request,this._priOptions=t.priOptions||{},this._logger.debug("\u3010xhrLoader task\u3011, range",this._range),this._url=ut(t.url,t.params);var s=Date.now();return new Promise(function(o,u){n._loadCompleteResolve=o,n._loadCompleteReject=u,n._startLoad()}).catch(function(o){if(clearTimeout(n._timeoutTimer),n._runing=!1,!n._aborted)throw o=o instanceof de?o:new de(n._url,n._request),o.startTime=s,o.endTime=Date.now(),o.options={index:n._index,vid:n._vid,priOptions:n._priOptions},o})}},{key:"_startLoad",value:function(){var t=null;if(this._responseType===xe.ARRAY_BUFFER&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var n=this._currentChunkSizeKB*1024,s=this._range[0]+this._receivedLength,o=this._range[1];n<this._range[1]-s&&(o=s+n),t=[s,o],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",t)}else t=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",t);this._internalOpen(t)}},{key:"_internalOpen",value:function(t){var n=this;try{this._startTime=Date.now();var s=this._xhr=new XMLHttpRequest;s.open(this._method||"GET",this._url,!0),s.responseType=this._responseType,this._timeout&&(s.timeout=this._timeout),s.withCredentials=this._withCredentials,s.onload=this._onLoad.bind(this),s.onreadystatechange=this._onReadyStatechange.bind(this),s.onerror=function(l){var c,f,v;n._running=!1;var m=new de(n._url,n._request,l==null||(c=l.currentTarget)===null||c===void 0?void 0:c.response,"xhr.onerror.status:"+(l==null||(f=l.currentTarget)===null||f===void 0?void 0:f.status)+",statusText,"+(l==null||(v=l.currentTarget)===null||v===void 0?void 0:v.statusText));m.options={index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions},n._loadCompleteReject(m)},s.ontimeout=function(l){n.cancel();var c=new de(n._url,n._request,{status:408},"timeout");n._onTimeout&&(c.isTimeout=!0,n._onTimeout(c,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions})),c.options={index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions},n._loadCompleteReject(c)};var o=this._headers||{},u=ot(t);u&&(o.Range=u),o&&Object.keys(o).forEach(function(l){s.setRequestHeader(l,o[l])}),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",t),s.send(this._body)}catch(l){l.options={index:this._index,range:t,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(l)}}},{key:"_onReadyStatechange",value:function(t){var n=t.target;n.readyState===2&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(t){var n,s=t.target.status;if(s<200||s>299){var o=new de(this._url,null,De(De({},t.target.response),{},{status:s}),"bad response,status:"+s);return o.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(o)}var u=null,l=!1,c,f=((n=this._range)===null||n===void 0?void 0:n.length)>0?this._range[0]:0;if(this._responseType===xe.ARRAY_BUFFER){var v,m=new Uint8Array(t.target.response);if(c=f+this._receivedLength,m&&m.byteLength>0){this._receivedLength+=m.byteLength;var g=Date.now()-this._startTime,E=Ye(this._receivedLength,g);this.emit(x.REAL_TIME_SPEED,{speed:E,len:this._receivedLength,time:g,vid:this._vid,index:this._index,range:[c,f+this._receivedLength],priOptions:this._priOptions})}u=m,((v=this._range)===null||v===void 0?void 0:v.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]?l=!1:l=!0,this._logger.debug("[xhr load done->], tast :",this._range,", start",c,"end ",f+this._receivedLength,",dataLen,",m?m.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",l)}else l=!0,u=t.target.response;var S={ok:s>=200&&s<300,status:s,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(u,l,{index:this._index,vid:this._vid,range:[c,f+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},S),l?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(qe(this._onProgress?null:u,l,S,S.headers["content-length"],S.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted&&(this._aborted=!0,this._runing=!1,We(Pe(e.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr))return this._xhr.abort()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(t){this._running=t}},{key:"_getHeaders",value:function(t){var n=t.getAllResponseHeaders().trim().split(`\r
5
+ `),s={},o=tr(n),u;try{for(o.s();!(u=o.n()).done;){var l=u.value,c=l.split(": ");s[c[0].toLowerCase()]=c.slice(1).join(": ")}}catch(f){o.e(f)}finally{o.f()}return s}}],[{key:"isSupported",value:function(){return typeof XMLHttpRequest<"u"}}]),e}(dr.default);var vi=["retry","retryDelay","onRetryError","transformError"],mr=function(){function i(a,e){$(this,i),this.promise=Re(),this.alive=!!e.onProgress,!e.logger&&(e.logger=new fe("Loader")),this._loaderType=a,this._loader=a===_e.FETCH&&typeof fetch<"u"?new Qe:new vr,this._config=e,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=e.retryCheckFunc,this._logger=e.logger}return K(i,[{key:"exec",value:function(){var e=this,r=this._config,t=r.retry,n=r.retryDelay,s=r.onRetryError,o=r.transformError,u=er(r,vi),l=function(){var c=ce(Q().mark(function f(){var v,m,g;return Q().wrap(function(S){for(;;)switch(S.prev=S.next){case 0:return S.prev=0,S.next=3,e._loader.load(u);case 3:v=S.sent,e.promise.resolve(v),S.next=27;break;case 7:if(S.prev=7,S.t0=S.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",S.t0),!e._canceled){S.next=13;break}return S.abrupt("return");case 13:if(S.t0.loaderType=e._loaderType,S.t0.retryCount=e._retryCount,m=S.t0,o&&(m=o(m)||m),s&&e._retryCount>0&&s(m,e._retryCount,{index:u.index,vid:u.vid,range:u.range,priOptions:u.priOptions}),e._retryCount++,g=!0,e._retryCheckFunc&&(g=e._retryCheckFunc(S.t0)),!(g&&e._retryCount<=t)){S.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",u.range),e._retryTimer=setTimeout(l,n),S.abrupt("return");case 26:e.promise.reject(m);case 27:case"end":return S.stop()}},f,null,[[0,7]])}));return function(){return c.apply(this,arguments)}}();return l(),this.promise}},{key:"cancel",value:function(){var a=ce(Q().mark(function r(){return Q().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,n.abrupt("return",this._loader.cancel());case 4:case"end":return n.stop()}},r,this)}));function e(){return a.apply(this,arguments)}return e}()},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),i}();function yt(i){return i&&!i.paused&&!i.ended&&i.playbackRate!==0&&i.readyState!==0}function bt(i){if(!i)return{};if(typeof i.getVideoPlaybackQuality=="function"){var a=i.getVideoPlaybackQuality();return{droppedVideoFrames:a.droppedVideoFrames||a.corruptedVideoFrames,totalVideoFrames:a.totalVideoFrames,creationTime:a.creationTime}}return{droppedVideoFrames:i.webkitDroppedFrameCount,totalVideoFrames:i.webkitDecodedFrameCount,creationTime:performance.now()}}function St(){for(var i=arguments.length,a=new Array(i),e=0;e<i;e++)a[e]=arguments[e];if(a=a.filter(Boolean),a.length<2)return a[0];var r=new Uint8Array(a.reduce(function(n,s){return n+s.byteLength},0)),t=0;return a.forEach(function(n){r.set(n,t),t+=n.byteLength}),r}function Et(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return new Promise(function(a){return setTimeout(a,i)})}var _r=He(Fe()),Tt=function(i){ve(e,i);var a=me(e);function e(r){var t;return $(this,e),t=a.call(this,r),_(D(t),"type",_e.FETCH),_(D(t),"_queue",[]),_(D(t),"_alive",[]),_(D(t),"_currentTask",null),_(D(t),"_finnalUrl",""),_(D(t),"_config",void 0),t._config=pr(r),(t._config.loaderType===_e.XHR||!Qe.isSupported())&&(t.type=_e.XHR),t.log=r.logger,t}return K(e,[{key:"isFetch",value:function(){return this.type===_e.FETCH}},{key:"load",value:function(t){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof t=="string"||!t?s.url=t||s.url||this._config.url:s=t,s=Object.assign({},this._config,s),s.params&&(s.params=Object.assign({},s.params)),s.headers&&gt(s.headers)&&(s.headers=Object.assign({},s.headers)),s.body&&gt(s.body)&&(s.body=Object.assign({},s.body)),s.transformRequest&&(s=s.transformRequest(s)||s),s.logger=this.log;var o=new mr(this.type,s);return o.loader.on(x.REAL_TIME_SPEED,function(u){n.emit(x.REAL_TIME_SPEED,u)}),this._queue.push(o),this._queue.length===1&&(!this._currentTask||!this._currentTask.running)&&this._processTask(),o.promise}},{key:"cancel",value:function(){var r=ce(Q().mark(function n(){var s;return Q().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return s=this._queue.map(function(l){return l.cancel()}).concat(this._alive.map(function(l){return l.cancel()})),this._currentTask&&s.push(this._currentTask.cancel()),this._queue=[],this._alive=[],u.next=6,Promise.all(s);case 6:return u.next=8,Et();case 8:case"end":return u.stop()}},n,this)}));function t(){return r.apply(this,arguments)}return t}()},{key:"_processTask",value:function(){var t=this;if(this._currentTask=this._queue.shift(),!!this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var n=this._currentTask.exec().catch(function(s){});n&&typeof n.finally=="function"&&n.finally(function(){var s,o;(s=t._currentTask)!==null&&s!==void 0&&s.alive&&((o=t._alive)===null||o===void 0?void 0:o.length)>0&&(t._alive=t._alive.filter(function(u){return u&&u!==t._currentTask})),t._processTask()})}}}],[{key:"isFetchSupport",value:function(){return Qe.isSupported()}}]),e}(_r.default);var wt=function(){function i(){$(this,i),_(this,"_prevCurrentTime",0)}return K(i,[{key:"do",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3,t=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(e){var s=e.currentTime,o=0;if(this._prevCurrentTime===s){var u=Z.info(Z.get(e),s);if(!u.buffers.length)return;t&&u.nextStart||u.nextStart&&u.nextStart-s<r?o=u.nextStart+.1:u.end&&u.end-s>n&&!e.seeking&&(o=s+.1)}this._prevCurrentTime=s,o&&s!==o&&(e.currentTime=o)}}}]),i}();var Ct=function(){function i(a){var e=this;$(this,i),_(this,"_seiSet",new Set),this.emitter=a,a.on(x.SEI,function(r){r&&e._seiSet.add(r)})}return K(i,[{key:"throw",value:function(e,r){var t=this;if(!(e==null||!this._seiSet.size)){var n=e-.2,s=e+.2,o=[];this._seiSet.forEach(function(u){u.time>=n&&u.time<=s&&o.push(u)}),o.forEach(function(u){t._seiSet.delete(u),t.emitter.emit(x.SEI_IN_TIME,u)}),r&&this._seiSet.forEach(function(u){u.time<e-5&&t._seiSet.delete(u)})}}},{key:"reset",value:function(){this._seiSet.clear()}}]),i}();var mi=1e3,_i=50,gi=3,yi=3e3,At=function(){function i(a){$(this,i),_(this,"_chunkSpeed",0),_(this,"_chunkCache",[]),_(this,"_speeds",[]),_(this,"_totalSize",0),_(this,"_totalCost",0),this._opts=a||{}}return K(i,[{key:"addRecord",value:function(e,r){!e||!r||(this._speeds.push(8e3*e/r),this._speeds=this._speeds.slice(-gi))}},{key:"addChunkRecord",value:function(e,r){var t,n;if(!(!e||!r||e<(((t=this._opts)===null||t===void 0?void 0:t.skipChunkSize)||mi))){this._totalSize+=e,this._totalCost+=r,this._chunkSpeed=8e3*e/r,this._chunkCache.push({size:e,duration:r,timestamp:performance.now()});var s=((n=this._opts)===null||n===void 0?void 0:n.chunkCountForSpeed)||_i;this._chunkCache.length>s&&(this._chunkCache=this._chunkCache.slice(-s))}}},{key:"getAvgSpeed",value:function(){var e;if(!this._chunkCache.length&&!this._speeds.length)return 0;if(this._speeds.length)return this._speeds.reduce(function(o,u){return o+=u})/this._speeds.length;var r=this._chunkCache[this._chunkCache.length-1],t=performance.now()-r.timestamp;t>(((e=this._opts)===null||e===void 0?void 0:e.longtimeNoReceived)||yi)&&this._chunkCache.push({size:0,duration:t,timestamp:performance.now()});var n=this._chunkCache.reduce(function(o,u){return o+=u.size},0),s=this._chunkCache.reduce(function(o,u){return o+=u.duration},0);return 8e3*n/s}},{key:"getLatestSpeed",value:function(){return!this._chunkCache.length&&!this._speeds.length?0:this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeed}},{key:"getTotalSize",value:function(){return this._totalSize}},{key:"getTotalCost",value:function(){return this._totalCost}},{key:"reset",value:function(){this._chunkCache=[],this._speeds=[],this._totalSize=0,this._totalCost=0}}]),i}();var ea=He(Fe());var gr=function(){function i(a){$(this,i),_(this,"encodeType",""),_(this,"audioCodec",""),_(this,"videoCodec",""),_(this,"domain",""),_(this,"fps",0),_(this,"bitrate",0),_(this,"width",0),_(this,"height",0),_(this,"samplerate",0),_(this,"channelCount",0),_(this,"gop",0),_(this,"_bitsAccumulateSize",0),_(this,"_bitsAccumulateDuration",0),_(this,"_startGopId",-1),this._timescale=a}return K(i,[{key:"getStats",value:function(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}},{key:"setEncodeType",value:function(e){this.encodeType=e}},{key:"setFpsFromScriptData",value:function(e){var r,t=e.data,n=t==null||(r=t.onMetaData)===null||r===void 0?void 0:r.framerate;n&&n>0&&n<100&&(this.fps=n)}},{key:"setVideoMeta",value:function(e){if(this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen){var r=e.fpsNum/e.fpsDen;r>0&&r<100&&(this.fps=r)}}},{key:"setAudioMeta",value:function(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}},{key:"setDomain",value:function(e){this.domain=e.split("/").slice(2,3)[0]}},{key:"updateBitrate",value:function(e){var r=this;if((!this.fps||this.fps>=100)&&e.length){var t=e.reduce(function(n,s){return n+=s.duration},0)/e.length;this.fps=Math.round(this._timescale/t)}e.forEach(function(n){r._startGopId===-1&&(r._startGopId=n.gopId),n.gopId===r._startGopId&&r.gop++,r._bitsAccumulateDuration+=n.duration/(r._timescale/1e3),r._bitsAccumulateSize+=n.units.reduce(function(s,o){return s+=o.length},0),r._bitsAccumulateDuration>=1e3&&(r.bitrate=r._bitsAccumulateSize*8,r._bitsAccumulateDuration=0,r._bitsAccumulateSize=0)})}}]),i}(),kt=function(){function i(a){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e3;$(this,i),_(this,"_core",null),_(this,"_samples",[]),this._core=a,this._timescale=e,this._stats=new gr(e),this._bindEvents()}return K(i,[{key:"getStats",value:function(){var e,r,t,n,s,o,u,l,c,f,v,m=((e=this._core)===null||e===void 0?void 0:e.media)||{},g=m.currentTime,E=g===void 0?0:g,S=m.decodeFps,C=S===void 0?0:S;return De(De({},this._stats.getStats()),{},{downloadSpeed:((r=this._core)===null||r===void 0||(t=r.speedInfo)===null||t===void 0?void 0:t.call(r).speed)||0,avgSpeed:((n=this._core)===null||n===void 0||(s=n.speedInfo)===null||s===void 0?void 0:s.call(n).avgSpeed)||0,totalReceivedByte:((o=this._core)===null||o===void 0||(u=o.speedInfo)===null||u===void 0?void 0:u.call(o).totalSize)||0,totalReceivedCost:((l=this._core)===null||l===void 0||(c=l.speedInfo)===null||c===void 0?void 0:c.call(l).totalCost)||0,currentTime:E,bufferEnd:((f=this._core)===null||f===void 0||(v=f.bufferInfo())===null||v===void 0?void 0:v.remaining)||0,decodeFps:C})}},{key:"_bindEvents",value:function(){var e=this;this._core.on(x.DEMUXED_TRACK,function(r){var t=r.videoTrack;return e._stats.updateBitrate(t.samples)}),this._core.on(x.FLV_SCRIPT_DATA,function(r){e._stats.setFpsFromScriptData(r)}),this._core.on(x.METADATA_PARSED,function(r){r.type==="video"?e._stats.setVideoMeta(r.track):e._stats.setAudioMeta(r.track)}),this._core.on(x.TTFB,function(r){e._stats.setDomain(r.responseUrl)})}},{key:"reset",value:function(){this._samples=[],this._stats=new gr(this._timescale)}}]),i}();var Wr=He(Fe());function bi(i,a){var e=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e!=null){var r,t,n,s,o=[],u=!0,l=!1;try{if(n=(e=e.call(i)).next,a===0){if(Object(e)!==e)return;u=!1}else for(;!(u=(r=n.call(e)).done)&&(o.push(r.value),o.length!==a);u=!0);}catch(c){l=!0,t=c}finally{try{if(!u&&e.return!=null&&(s=e.return(),Object(s)!==s))return}finally{if(l)throw t}}return o}}function M(i,a){if(!(i instanceof a))throw new TypeError("Cannot call a class as a function")}function yr(i,a){for(var e=0;e<a.length;e++){var r=a[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,Er(r.key),r)}}function U(i,a,e){return a&&yr(i.prototype,a),e&&yr(i,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function b(i,a,e){return a=Er(a),a in i?Object.defineProperty(i,a,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[a]=e,i}function Dt(i,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(a&&a.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),a&&Ot(i,a)}function lt(i){return lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},lt(i)}function Ot(i,a){return Ot=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,t){return r.__proto__=t,r},Ot(i,a)}function Si(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ei(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Ti(i,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ei(i)}function Rt(i){var a=Si();return function(){var r=lt(i),t;if(a){var n=lt(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return Ti(this,t)}}function br(i,a){return Ci(i)||bi(i,a)||Sr(i,a)||Oi()}function ge(i){return wi(i)||Ai(i)||Sr(i)||ki()}function wi(i){if(Array.isArray(i))return Pt(i)}function Ci(i){if(Array.isArray(i))return i}function Ai(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Sr(i,a){if(i){if(typeof i=="string")return Pt(i,a);var e=Object.prototype.toString.call(i).slice(8,-1);if(e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set")return Array.from(i);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Pt(i,a)}}function Pt(i,a){(a==null||a>i.length)&&(a=i.length);for(var e=0,r=new Array(a);e<a;e++)r[e]=i[e];return r}function ki(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
6
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Oi(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
7
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pi(i,a){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var r=e.call(i,a||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(i)}function Er(i){var a=Pi(i,"string");return typeof a=="symbol"?a:String(a)}var ye={VIDEO:"video",AUDIO:"audio",METADATA:"metadata"},we={AV1:"av1",AVC:"avc",HEVC:"hevc"},Y={AAC:"aac",G711PCMA:"g7110a",G711PCMU:"g7110m",OPUS:"opus",MP3:"mp3"},ue={LARGE_AV_SHIFT:"LARGE_AV_SHIFT",LARGE_VIDEO_GAP:"LARGE_VIDEO_GAP",LARGE_VIDEO_GAP_BETWEEN_CHUNK:"LARGE_VIDEO_GAP_BETWEEN_CHUNK",LARGE_AUDIO_GAP:"LARGE_AUDIO_GAP",AUDIO_FILLED:"AUDIO_FILLED",AUDIO_DROPPED:"AUDIO_DROPPED"};var Tr=function(){function i(){M(this,i),b(this,"id",1),b(this,"type",ye.VIDEO),b(this,"codecType",we.AVC),b(this,"pid",-1),b(this,"hvcC",void 0),b(this,"codec",""),b(this,"timescale",0),b(this,"formatTimescale",0),b(this,"sequenceNumber",0),b(this,"baseMediaDecodeTime",0),b(this,"baseDts",0),b(this,"duration",0),b(this,"warnings",[]),b(this,"samples",[]),b(this,"pps",[]),b(this,"sps",[]),b(this,"vps",[]),b(this,"fpsNum",0),b(this,"fpsDen",0),b(this,"sarRatio",[]),b(this,"width",0),b(this,"height",0),b(this,"nalUnitSize",4),b(this,"present",!1),b(this,"isVideoEncryption",!1),b(this,"isAudioEncryption",!1),b(this,"isVideo",!0),b(this,"lastKeyFrameDts",0),b(this,"kid",null),b(this,"pssh",null),b(this,"ext",void 0)}return U(i,[{key:"reset",value:function(){this.sequenceNumber=this.width=this.height=this.fpsDen=this.fpsNum=this.duration=this.baseMediaDecodeTime=this.timescale=0,this.codec="",this.present=!1,this.pid=-1,this.pps=[],this.sps=[],this.vps=[],this.sarRatio=[],this.samples=[],this.warnings=[],this.hvcC=null}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],r=this.samples[this.samples.length-1];return r.dts-e.dts+r.duration}return 0}},{key:"exist",value:function(){return/av01/.test(this.codec)?!0:!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}]),i}();var wr=function(){function i(){M(this,i),b(this,"id",2),b(this,"type",ye.AUDIO),b(this,"codecType",Y.AAC),b(this,"pid",-1),b(this,"codec",""),b(this,"container",""),b(this,"sequenceNumber",0),b(this,"sampleDuration",0),b(this,"timescale",0),b(this,"formatTimescale",0),b(this,"baseMediaDecodeTime",0),b(this,"duration",0),b(this,"warnings",[]),b(this,"samples",[]),b(this,"baseDts",0),b(this,"sampleSize",16),b(this,"sampleRate",0),b(this,"channelCount",0),b(this,"objectType",0),b(this,"sampleRateIndex",0),b(this,"config",[]),b(this,"present",!1),b(this,"isVideoEncryption",!1),b(this,"isAudioEncryption",!1),b(this,"kid",null),b(this,"ext",void 0)}return U(i,[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!!(this.sampleRate&&this.channelCount&&(this.codec||this.container)&&(this.codecType===Y.AAC||this.codecType===Y.G711PCMA||this.codecType===Y.G711PCMU||this.codecType===Y.OPUS||this.codecType===Y.MP3))}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],r=this.samples[this.samples.length-1];return r.dts-e.dts+r.duration}return 0}}]),i}();var Cr=function(){function i(a,e,r){M(this,i),b(this,"flag",{}),b(this,"keyframe",!1),b(this,"gopId",0),b(this,"duration",0),b(this,"size",0),b(this,"units",[]),b(this,"chromaFormat",420),this.originPts=this.pts=a,this.originDts=this.dts=e,r&&(this.units=r)}return U(i,[{key:"cts",get:function(){return this.pts-this.dts}},{key:"setToKeyframe",value:function(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}]),i}();var Ge=U(function i(a,e,r,t){M(this,i),b(this,"duration",1024),b(this,"flag",{dependsOn:2,isNonSyncSample:0}),b(this,"keyframe",!0),this.originPts=this.pts=this.dts=a,this.data=e,this.size=e.byteLength,this.sampleOffset=t,r&&(this.duration=r)});var Ar=U(function i(a,e){M(this,i),b(this,"time",0),this.data=a,this.originPts=this.pts=e}),kr=function(i){Dt(e,i);var a=Rt(e);function e(){return M(this,e),a.apply(this,arguments)}return U(e)}(Ar),Or=function(i){Dt(e,i);var a=Rt(e);function e(){return M(this,e),a.apply(this,arguments)}return U(e)}(Ar),Pr=function(){function i(){M(this,i),b(this,"id",3),b(this,"type",ye.METADATA),b(this,"timescale",0),b(this,"flvScriptSamples",[]),b(this,"seiSamples",[])}return U(i,[{key:"exist",value:function(){return!!((this.flvScriptSamples.length||this.seiSamples.length)&&this.timescale)}},{key:"reset",value:function(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function(){return!!(this.flvScriptSamples.length||this.seiSamples.length)}}]),i}();var Ue=function(){function i(a){M(this,i),this.name=a||"",this._prefix="[".concat(this.name,"]")}return U(i,[{key:"warn",value:function(){var e;if(!i.disabled){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];(e=console).warn.apply(e,[this._prefix].concat(t))}}}],[{key:"enable",value:function(){i.disabled=!1}},{key:"disable",value:function(){i.disabled=!0}}]),i}();b(Ue,"disabled",!0);var ct=typeof window<"u",Lt=ct&&navigator.userAgent.toLocaleLowerCase(),Dr=ct&&/^((?!chrome|android).)*safari/.test(Lt),Rr=ct&&Lt.includes("firefox"),Lr=ct&&Lt.includes("android");var Ve=function(){function i(){M(this,i)}return U(i,null,[{key:"getRateIndexByRate",value:function(e){return i.FREQ.indexOf(e)}},{key:"parseADTS",value:function(e,r){for(var t=e.length,n=0;n+2<t&&!(e[n]===255&&(e[n+1]&246)===240);)n++;if(!(n>=t)){var s=n,o=[],u=(e[n+2]&60)>>>2,l=i.FREQ[u];if(!l)throw new Error("Invalid sampling index: ".concat(u));for(var c=((e[n+2]&192)>>>6)+1,f=(e[n+2]&1)<<2|(e[n+3]&192)>>>6,v=i._getConfig(u,f,c),m=v.config,g=v.codec,E,S,C=0,A=i.getFrameDuration(l);n+7<t;){if(e[n]!==255||(e[n+1]&246)!==240){n++;continue}if(S=(e[n+3]&3)<<11|e[n+4]<<3|(e[n+5]&224)>>5,!S||t-n<S)break;E=(~e[n+1]&1)*2,o.push({pts:r+C*A,data:e.subarray(n+7+E,n+S)}),C++,n+=S}return{skip:s,remaining:n>=t?void 0:e.subarray(n),frames:o,samplingFrequencyIndex:u,sampleRate:l,objectType:c,channelCount:f,codec:g,config:m,originCodec:"mp4a.40.".concat(c)}}}},{key:"parseAudioSpecificConfig",value:function(e){if(e.length){var r=e[0]>>>3,t=(e[0]&7)<<1|e[1]>>>7,n=(e[1]&120)>>>3,s=i.FREQ[t];if(s){var o=i._getConfig(t,n,r),u=o.config,l=o.codec;return{samplingFrequencyIndex:t,sampleRate:s,objectType:r,channelCount:n,config:u,codec:l,originCodec:"mp4a.40.".concat(r)}}}}},{key:"getFrameDuration",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:9e4;return 1024*r/e}},{key:"_getConfig",value:function(e,r,t){var n=[],s,o;return Rr?e>=6?(s=5,o=e-3):(s=2,o=e):Lr?(s=2,o=e):(s=5,o=e,e>=6?o=e-3:r===1&&(s=2,o=e)),n[0]=s<<3,n[0]|=(e&14)>>1,n[1]=(e&1)<<7,n[1]|=r<<3,s===5&&(n[1]|=(o&14)>>1,n[2]=(o&1)<<7,n[2]|=8,n[3]=0),{config:n,codec:"mp4a.40.".concat(s)}}},{key:"getSilentFrame",value:function(e,r){switch(e){case"mp4a.40.2":if(r===1)return new Uint8Array([0,200,0,128,35,128]);if(r===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(r===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(r===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(r===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(r===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(r===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(r===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(r===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}]),i}();b(Ve,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var Je=function(){function i(){M(this,i)}return U(i,null,[{key:"getFrameDuration",value:function(e){return 20}},{key:"parseHeaderPackets",value:function(e){if(e.length){for(var r=new DataView(e.buffer,e.byteOffset,e.byteLength),t="",n=0;n<8;n++)t+=String.fromCodePoint(e[n]);if(t!=="OpusHead")throw new Error("Invalid Opus MagicSignature");var s=e[9];console.log("Pre-skip",e[10],e[11]);var o=r.getUint32(12,!0),u=r.getInt16(16,!0);if(o){var l="opus",c="opus",f=new Uint8Array(e.buffer,e.byteOffset+8,e.byteLength-8);return{outputGain:u,sampleRate:o,channelCount:s,config:f,codec:l,originCodec:c}}}}}]),i}();var Di=500,xr=3,xt=1e3,It=5e3,Ri=1e3,Li=200,Ir=5e3,Mr=5,Ur=function(){function i(a,e,r){M(this,i),this.videoTrack=a,this.audioTrack=e,this.metadataTrack=r,this._baseDts=-1,this._baseDtsInited=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=0,this._videoTimestampBreak=0,this._lastVideoDuration=0,this._keyFrameInNextChunk=!1,this._lastAudioExceptionGapDot=-1/0,this._lastAudioExceptionOverlapDot=-1/0,this._lastAudioExceptionLargeGapDot=-1/0,this._lastVideoExceptionLargeGapDot=-1/0,this._lastVideoExceptionChunkFirstDtsDot=-1/0}return U(i,[{key:"fix",value:function(){var e=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;r=Math.round(r*1e3);var s=this.videoTrack,o=this.audioTrack;(t||!n)&&(this._videoLastSample=null,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=0,this._videoTimestampBreak=0,this._lastAudioExceptionGapDot=-1/0,this._lastAudioExceptionOverlapDot=-1/0,this._lastAudioExceptionLargeGapDot=-1/0,this._lastVideoExceptionLargeGapDot=-1/0,this._lastVideoExceptionChunkFirstDtsDot=-1/0),t&&!n&&(this._baseDtsInited=!1),this._baseDtsInited||this._calculateBaseDts(o,s),!n&&r&&(this._audioNextPts=this._videoNextDts=r);var u=this._baseDtsInited&&(this._videoTimestampBreak||!this.videoTrack.exist())&&(this._audioTimestampBreak||!this.audioTrack.exist());if(u&&this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(o),this._keyFrameInNextChunk=!1,this._fixVideo(s),this.metadataTrack.exist()){var l=this.metadataTrack.timescale;this.metadataTrack.seiSamples.forEach(function(c){c.pts=c.originPts-e._baseDts,c.time=Math.max(0,c.pts)/l}),this.metadataTrack.flvScriptSamples.forEach(function(c){c.pts=c.originPts-e._baseDts,c.time=Math.max(0,c.pts)/l})}s.samples.length&&(s.baseMediaDecodeTime=s.samples[0].dts),o.samples.length&&(o.baseMediaDecodeTime=o.samples[0].pts*o.timescale/1e3)}},{key:"_fixVideo",value:function(e){var r=this,t=e.samples;if(t.length){t.forEach(function(A){A.dts-=r._baseDts,A.pts-=r._baseDts,A.keyframe&&(r._keyFrameInNextChunk=!0)});var n;if(e.fpsNum&&e.fpsDen)n=e.timescale*(e.fpsDen/e.fpsNum);else if(e.length>1){var s=e.samples[0],o=e.samples[t.length-1];n=Math.floor((o.dts-s.dts)/(t.length-1))}else n=this._lastVideoDuration||40;var u=t.pop();if(this._videoLastSample&&t.unshift(this._videoLastSample),this._videoLastSample=u,!!t.length){if(this._videoNextDts===void 0){var l=t[0];this._videoNextDts=l.dts}var c=t.length,f=0,v=t[0],m=this._videoNextDts-v.dts;if(Math.abs(m)>Li){if(Math.abs(v.dts-this._lastVideoExceptionChunkFirstDtsDot)>Ir){var g;this._lastVideoExceptionChunkFirstDtsDot=v.dts,e.warnings.push({type:ue.LARGE_VIDEO_GAP_BETWEEN_CHUNK,nextDts:this._videoNextDts,firstSampleDts:v.dts,nextSampleDts:(g=t[1])===null||g===void 0?void 0:g.dts,sampleDuration:m})}this._videoTimestampBreak>=Mr?(this._videoNextDts=v.dts,this._videoTimestampBreak=0):(v.dts+=m,v.pts+=m,this.audioTrack.exist()||(this._videoTimestampBreak=1))}for(var E=0;E<c;E++){var S=t[E].dts,C=t[E+1];E<c-1?f=C.dts-S:u?f=u.dts-S:f=n,(f>Ri||f<0)&&(this._videoTimestampBreak++,Math.abs(S-this._lastVideoExceptionLargeGapDot)>Ir&&(this._lastVideoExceptionLargeGapDot=S,e.warnings.push({type:ue.LARGE_VIDEO_GAP,time:S/e.timescale,dts:S,originDts:t[E].originDts,nextDts:this._videoNextDts,sampleDuration:f,refSampleDuration:n})),f=n),t[E].duration=f,this._videoNextDts+=f,this._lastVideoDuration=f}}}}},{key:"_fixAudio",value:function(e){var r=this,t=e.samples;t.length&&(t.forEach(function(n){n.dts=n.pts-=r._baseDts}),this._doFixAudioInternal(e,t,1e3))}},{key:"_calculateBaseDts",value:function(e,r){var t=e.samples,n=r.samples;if(!t.length&&!n.length)return!1;var s=1/0,o=1/0;t.length&&(e.baseDts=s=t[0].pts),n.length&&(r.baseDts=o=n[0].dts),this._baseDts=Math.min(s,o);var u=o-s;return Number.isFinite(u)&&Math.abs(u)>Di&&r.warnings.push({type:ue.LARGE_AV_SHIFT,videoBaseDts:o,audioBasePts:s,baseDts:this._baseDts,delta:u}),this._baseDtsInited=!0,!0}},{key:"_resetBaseDtsWhenStreamBreaked",value:function(){var e=this._calculateBaseDts(this.audioTrack,this.videoTrack);e&&(this.audioTrack.exist()?this.videoTrack.exist()?this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts):this._baseDts-=this._audioNextPts:this._baseDts-=this._videoNextDts,this._videoTimestampBreak=0,this._audioTimestampBreak=0)}},{key:"_doFixAudioInternal",value:function(e,r,t){if(!e.sampleDuration)switch(e.codecType){case Y.AAC:{e.sampleDuration=Ve.getFrameDuration(e.timescale,t);break}case Y.OPUS:{e.sampleDuration=Je.getFrameDuration(e.samples,t);break}case Y.G711PCMA:case Y.G711PCMU:{e.sampleDuration=this._getG711Duration(e);break}default:console.error("can't fix audio codecType:",e.codecType);break}var n=e.sampleDuration,s=e.codecType===Y.OPUS?20:e.codecType===Y.AAC?1024:n*e.timescale/1e3;if(this._audioNextPts===void 0){var o=r[0];this._audioNextPts=o.pts}for(var u=0;u<r.length;u++){var l=this._audioNextPts,c=r[u],f=c.pts-l;if(u===0&&this._audioTimestampBreak>=Mr&&this._keyFrameInNextChunk&&(l=this._audioNextPts=c.dts,f=0,this._audioTimestampBreak=0),!this._audioTimestampBreak&&f>=xr*n&&f<=xt&&!Dr){var v=this._getSilentFrame(e)||r[0].data.subarray(),m=Math.floor(f/n);Math.abs(c.pts-this._lastAudioExceptionGapDot)>It&&(this._lastAudioExceptionGapDot=c.pts,e.warnings.push({type:ue.AUDIO_FILLED,pts:c.pts,originPts:c.originPts,count:m,nextPts:l,refSampleDuration:n}));for(var g=0;g<m;g++){var E=new Ge(Math.floor(this._audioNextPts+n)-Math.floor(this._audioNextPts),v,s);E.originPts=Math.floor(this._baseDts+l),r.splice(u,0,E),this._audioNextPts+=n,u++}u--}else if(f<=-xr*n&&f>=-1*xt)Math.abs(c.pts-this._lastAudioExceptionOverlapDot)>It&&(this._lastAudioExceptionOverlapDot=c.pts,e.warnings.push({type:ue.AUDIO_DROPPED,pts:c.pts,originPts:c.originPts,nextPts:l,refSampleDuration:n})),r.splice(u,1),u--;else{if(Math.abs(f)>xt&&(this._audioTimestampBreak++,Math.abs(c.pts-this._lastAudioExceptionLargeGapDot)>It&&(this._lastAudioExceptionLargeGapDot=c.pts,e.warnings.push({type:ue.LARGE_AUDIO_GAP,time:c.pts/1e3,pts:c.pts,originPts:c.originPts,nextPts:l,sampleDuration:f,refSampleDuration:n}))),e.codecType===Y.OPUS){var S=r[r.length-1];S&&(S.duration=c.pts-S.pts)}else c.dts=c.pts=l,c.duration=s;this._audioNextPts+=n}}}},{key:"_getG711Duration",value:function(e){var r=e.sampleSize,t=e.channelCount,n=e.sampleRate,s=e.samples[0];if(s)return s.data.byteLength*2/t/(r/8)/n*1e3}},{key:"_getSilentFrame",value:function(e){return e.codecType===Y.AAC?Ve.getSilentFrame(e.codec,e.channelCount):new Uint8Array(8*e.sampleDuration*e.channelCount)}}]),i}();function he(){for(var i=arguments.length,a=new Array(i),e=0;e<i;e++)a[e]=arguments[e];a=a.filter(Boolean);var r=new Uint8Array(a.reduce(function(n,s){return n+s.byteLength},0)),t=0;return a.forEach(function(n){r.set(n,t),t+=n.byteLength}),r}var $a=Math.pow(2,32);function je(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(i[a]<<24>>>0)+(i[a+1]<<16)+(i[a+2]<<8)+(i[a+3]||0)}function Br(i){for(var a="avc1.",e,r=0;r<3;r++)e=i[r].toString(16),e.length<2&&(e="0".concat(e)),a+=e;return a}function Mt(i){if(!Array.isArray(i)){for(var a=[],e="",r=0;r<i.length;r++)r%2&&(e=i[r-1]+i[r],a.push(parseInt(e,16)),e="");return a}return i.map(function(t){return parseInt(t,16)})}var Ce=function(){function i(){M(this,i)}return U(i,null,[{key:"parseAnnexB",value:function(e){var r=e.byteLength-1,t=0;do{if(e[r]===0)t++;else break;r--}while(r>0);t>=3&&(e=e.subarray(0,r+1));for(var n=e.length,s=2,o=0;e[s]!==null&&e[s]!==void 0&&e[s]!==1;)s++;if(s++,o=s+2,o>=n)return[];for(var u=[];o<n;)switch(e[o]){case 0:if(e[o-1]!==0){o+=2;break}else if(e[o-2]!==0){o++;break}else if(o<n-1&&e[o+1]!==1){o++;break}s!==o-2&&u.push(e.subarray(s,o-2));do o++;while(e[o]!==1&&o<n);s=o+1,o=s+2;break;case 1:if(e[o-1]!==0||e[o-2]!==0){o+=3;break}s!==o-2&&u.push(e.subarray(s,o-2)),s=o+1,o=s+2;break;default:o+=3;break}return s<n&&u.push(e.subarray(s)),u}},{key:"parseAvcC",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;if(!(e.length<4)){for(var t=e.length,n=[],s=0,o;s+r<t;)if(o=je(e,s),r===3&&(o>>>=8),s+=r,!!o){if(s+o>t)break;n.push(e.subarray(s,s+o)),s+=o}return n}}},{key:"parseSEI",value:function(e,r){for(var t=e.length,n=r?2:1,s=0,o=0,u="";e[n]===255;)s+=255,n++;for(s+=e[n++];e[n]===255;)o+=255,n++;if(o+=e[n++],s===5&&t>n+16)for(var l=0;l<16;l++)u+=e[n].toString(16),n++;return{payload:e.subarray(n,n+o),type:s,size:o,uuid:u}}},{key:"removeEPB",value:function(e){for(var r=e.byteLength,t=[],n=1;n<r-2;)e[n]===0&&e[n+1]===0&&e[n+2]===3?(t.push(n+2),n+=2):n++;if(!t.length)return e;var s=r-t.length,o=new Uint8Array(s),u=0;for(n=0;n<s;u++,n++)u===t[0]&&(u++,t.shift()),o[n]=e[u];return o}}]),i}();var Ze=function(){function i(a){if(M(this,i),b(this,"_bytesAvailable",void 0),b(this,"_bitsAvailable",0),b(this,"_word",0),!a)throw new Error("ExpGolomb data params is required");this._data=a,this._bytesAvailable=a.byteLength,this._bytesAvailable&&this._loadWord()}return U(i,[{key:"bitsAvailable",get:function(){return this._bitsAvailable}},{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,r=Math.min(4,this._bytesAvailable);if(r===0)throw new Error("No bytes available");var t=new Uint8Array(4);t.set(this._data.subarray(e,e+r)),this._word=new DataView(t.buffer).getUint32(0),this._bitsAvailable=r*8,this._bytesAvailable-=r}},{key:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{e-=this._bitsAvailable;var r=Math.floor(e/8);e-=r*8,this._bytesAvailable-=r,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw new Error("Cannot read more than 32 bits");var r=Math.min(this._bitsAvailable,e),t=this._word>>>32-r;return this._bitsAvailable-=r,this._bitsAvailable>0?this._word<<=r:this._bytesAvailable>0&&this._loadWord(),r=e-r,r>0&&this._bitsAvailable?t<<r|this.readBits(r):t}},{key:"skipLZ",value:function(){var e;for(e=0;e<this._bitsAvailable;++e)if((this._word&2147483648>>>e)!==0)return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return this.readBits(1)===1}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var r=8,t=8,n,s=0;s<e;s++)t!==0&&(n=this.readEG(),t=(r+n+256)%256),r=t===0?r:t}}]),i}();var Nr=function(){function i(){M(this,i)}return U(i,null,[{key:"parseAVCDecoderConfigurationRecord",value:function(e){if(!(e.length<7)){for(var r=(e[4]&3)+1,t,n=[],s=[],o=6,u=e[5]&31,l,c=0;c<u;c++)if(l=e[o]<<8|e[o+1],o+=2,!!l){var f=e.subarray(o,o+l);o+=l,n.push(f),t||(t=i.parseSPS(Ce.removeEPB(f)))}var v=e[o];o++;for(var m,g=0;g<v;g++)m=e[o]<<8|e[o+1],o+=2,m&&(s.push(e.subarray(o,o+m)),o+=m);return{sps:t,spsArr:n,ppsArr:s,nalUnitSize:r}}}},{key:"parseSPS",value:function(e){var r=new Ze(e);r.readUByte();var t=r.readUByte(),n=r.readUByte(),s=r.readUByte();r.skipUEG();var o=420;if(t===100||t===110||t===122||t===244||t===44||t===83||t===86||t===118||t===128||t===138||t===144){var u=r.readUEG();if(u<=3&&(o=[0,420,422,444][u]),u===3&&r.skipBits(1),r.skipUEG(),r.skipUEG(),r.skipBits(1),r.readBool())for(var l=u!==3?8:12,c=0;c<l;c++)r.readBool()&&(c<6?r.skipScalingList(16):r.skipScalingList(64))}r.skipUEG();var f=r.readUEG();if(f===0)r.readUEG();else if(f===1){r.skipBits(1),r.skipUEG(),r.skipUEG();for(var v=r.readUEG(),m=0;m<v;m++)r.skipUEG()}r.skipUEG(),r.skipBits(1);var g=r.readUEG(),E=r.readUEG(),S=r.readBits(1);S===0&&r.skipBits(1),r.skipBits(1);var C=0,A=0,N=0,O=0;r.readBool()&&(C=r.readUEG(),A=r.readUEG(),N=r.readUEG(),O=r.readUEG());var w,P,X,J,L;if(r.readBool()){if(r.readBool()){var j=r.readUByte();switch(j){case 1:w=[1,1];break;case 2:w=[12,11];break;case 3:w=[10,11];break;case 4:w=[16,11];break;case 5:w=[40,33];break;case 6:w=[24,11];break;case 7:w=[20,11];break;case 8:w=[32,11];break;case 9:w=[80,33];break;case 10:w=[18,11];break;case 11:w=[15,11];break;case 12:w=[64,33];break;case 13:w=[160,99];break;case 14:w=[4,3];break;case 15:w=[3,2];break;case 16:w=[2,1];break;case 255:{w=[r.readUByte()<<8|r.readUByte(),r.readUByte()<<8|r.readUByte()];break}}}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){var ie=r.readBits(32),p=r.readBits(32);P=r.readBool(),X=p,J=ie*2,L=X/J}}return{codec:Br(e.subarray(1,4)),profileIdc:t,profileCompatibility:n,levelIdc:s,chromaFormat:o,width:Math.ceil((g+1)*16-2*(C+A)),height:(2-S)*(E+1)*16-(S?2:4)*(N+O),sarRatio:w,fpsNum:X,fpsDen:J,fps:L,fixedFrame:P}}}]),i}();var Fr=function(){function i(){M(this,i)}return U(i,null,[{key:"parseHEVCDecoderConfigurationRecord",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!(e.length<23)){r=r||{};for(var t=(e[21]&3)+1,n,s,o=[],u=[],l=[],c=23,f=e[22],v,m,g,E=0;E<f;E++){v=e[c]&63,m=e[c+1]<<8|e[c+2],c+=3;for(var S=0;S<m;S++)if(g=e[c]<<8|e[c+1],c+=2,!!g){switch(v){case 32:{var C=e.subarray(c,c+g);n||(n=i.parseVPS(Ce.removeEPB(C),r)),l.push(C)}break;case 33:{var A=e.subarray(c,c+g);s||(s=i.parseSPS(Ce.removeEPB(A),r)),o.push(A)}break;case 34:u.push(e.subarray(c,c+g));break}c+=g}}return{hvcC:r,sps:s,spsArr:o,ppsArr:u,vpsArr:l,nalUnitSize:t}}}},{key:"parseVPS",value:function(e,r){r=r||{};var t=new Ze(e);t.readUByte(),t.readUByte(),t.readBits(12);var n=t.readBits(3);return r.numTemporalLayers=Math.max(r.numTemporalLayers||0,n+1),t.readBits(17),i._parseProfileTierLevel(t,n,r),r}},{key:"parseSPS",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};r=r||{};var t=new Ze(e);t.readUByte(),t.readUByte(),t.readBits(4);var n=t.readBits(3);r.numTemporalLayers=Math.max(n+1,r.numTemporalLayers||0),r.temporalIdNested=t.readBits(1),i._parseProfileTierLevel(t,n,r),t.readUEG();var s=r.chromaFormatIdc=t.readUEG(),o=420;s<=3&&(o=[0,420,422,444][s]);var u=0;s===3&&(u=t.readBits(1));var l=t.readUEG(),c=t.readUEG(),f=t.readBits(1),v,m,g,E;if(f===1&&(v=t.readUEG(),m=t.readUEG(),g=t.readUEG(),E=t.readUEG()),r.bitDepthLumaMinus8=t.readUEG(),r.bitDepthChromaMinus8=t.readUEG(),f===1){var S=(s===1||s===2)&&u===0?2:1,C=s===1&&u===0?2:1;l-=S*(m+v),c-=C*(E+g)}return{codec:"hev1.1.6.L93.B0",width:l,height:c,chromaFormat:o,hvcC:r}}},{key:"_parseProfileTierLevel",value:function(e,r,t){var n=t.generalTierFlag||0;t.generalProfileSpace=e.readBits(2),t.generalTierFlag=Math.max(e.readBits(1),n),t.generalProfileIdc=Math.max(e.readBits(5),t.generalProfileIdc||0),t.generalProfileCompatibilityFlags=e.readBits(32),t.generalConstraintIndicatorFlags=[e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8)];var s=e.readBits(8);n<t.generalTierFlag?t.generalLevelIdc=s:t.generalLevelIdc=Math.max(s,t.generalLevelIdc||0);var o=[],u=[];if(r>e.bitsAvailable)throw new Error("maxSubLayersMinus inavlid size ".concat(r));for(var l=0;l<r;l++)o[l]=e.readBits(1),u[l]=e.readBits(1);r>0&&e.readBits((8-r)*2);for(var c=0;c<r;c++)o[c]!==0&&(e.readBits(2),e.readBits(1),e.readBits(5),e.readBits(16),e.readBits(16),e.readBits(4),e.readBits(16),e.readBits(16),e.readBits(12)),u[c]!==0&&e.readBits(8)}}]),i}();var Ut=function(){function i(){M(this,i)}return U(i,null,[{key:"decode",value:function(e){for(var r=[],t=e,n=0,s=e.length;n<s;){if(t[n]<128){r.push(String.fromCharCode(t[n])),++n;continue}else if(!(t[n]<192)){if(t[n]<224){if(i._checkContinuation(t,n,1)){var o=(t[n]&31)<<6|t[n+1]&63;if(o>=128){r.push(String.fromCharCode(o&65535)),n+=2;continue}}}else if(t[n]<240){if(i._checkContinuation(t,n,2)){var u=(t[n]&15)<<12|(t[n+1]&63)<<6|t[n+2]&63;if(u>=2048&&(u&63488)!==55296){r.push(String.fromCharCode(u&65535)),n+=3;continue}}}else if(t[n]<248&&i._checkContinuation(t,n,3)){var l=(t[n]&7)<<18|(t[n+1]&63)<<12|(t[n+2]&63)<<6|t[n+3]&63;if(l>65536&&l<1114112){l-=65536,r.push(String.fromCharCode(l>>>10|55296)),r.push(String.fromCharCode(l&1023|56320)),n+=4;continue}}}r.push("\uFFFD"),++n}return r.join("")}},{key:"_checkContinuation",value:function(e,r,t){var n=e;if(r+t<n.length){for(;t--;)if((n[++r]&192)!==128)return!1;return!0}else return!1}}]),i}();var Gr=function(){function i(){M(this,i)}return U(i,null,[{key:"parse",value:function(e){if(!(e.length<3)){var r={},t=i._parseValue(new DataView(e.buffer,e.byteOffset,e.byteLength)),n=i._parseValue(new DataView(e.buffer,e.byteOffset+t.size,e.byteLength-t.size));return r[t.data]=n.data,r}}},{key:"_parseValue",value:function(e){var r=e.byteLength,t=e.getUint8(0),n=1,s=!1,o;switch(t){case 0:o=e.getFloat64(1),n+=8;break;case 1:{o=!!e.getUint8(1),n+=1;break}case 2:{var u=i._parseString(new DataView(e.buffer,e.byteOffset+n,e.byteLength-n)),l=u.data,c=u.size;o=l,n+=c}break;case 3:{o={};var f=0;for((e.getUint32(r-4)&16777215)===9&&(f=3);n<r-4;){var v=i._parseObject(new DataView(e.buffer,e.byteOffset+n,e.byteLength-n-f)),m=v.size,g=v.data,E=v.isEnd;if(E)break;o[g.name]=g.value,n+=m}if(n<=r-3){var S=e.getUint32(n-1)&16777215;S===9&&(n+=3)}}break;case 8:{o={},n+=4;var C=0;for((e.getUint32(r-4)&16777215)===9&&(C=3);n<r-8;){var A=i._parseObject(new DataView(e.buffer,e.byteOffset+n,e.byteLength-n-C)),N=A.size,O=A.data,w=A.isEnd;if(w)break;o[O.name]=O.value,n+=N}if(n<=r-3){var P=e.getUint32(n-1)&16777215;P===9&&(n+=3)}}break;case 9:o=void 0,n=1,s=!0;break;case 10:{o=[];var X=e.getUint32(1);n+=4;for(var J=0;J<X;J++){var L=i._parseValue(new DataView(e.buffer,e.byteOffset+n,e.byteLength-n)),j=L.data,ie=L.size;o.push(j),n+=ie}}break;case 11:{var p=e.getFloat64(n)+e.getInt16(n+8)*6e4;o=new Date(p),n+=10}break;case 12:{var h=e.getUint32(1);n+=4,o="",h>0&&(o=Ut.decode(new Uint8Array(e.buffer,e.byteOffset+n,h))),n+=h}break;default:n=r;break}return{data:o,size:n,isEnd:s}}},{key:"_parseString",value:function(e){var r=e.getUint16(0),t="";return r>0&&(t=Ut.decode(new Uint8Array(e.buffer,e.byteOffset+2,r))),{data:t,size:2+r}}},{key:"_parseObject",value:function(e){if(!(e.byteLength<3)){var r=i._parseString(e),t=i._parseValue(new DataView(e.buffer,e.byteOffset+r.size,e.byteLength-r.size));return{data:{name:r.data,value:t.data},size:r.size+t.size,isEnd:t.isEnd}}}}]),i}();var be={MP3:2,G711A:7,G711M:8,AAC:10,OPUS:13};var Se=new Ue("FlvDemuxer"),ft=function(){function i(a,e,r){M(this,i),b(this,"_headerParsed",!1),b(this,"_remainingData",null),b(this,"_gopId",0),b(this,"_needAddMetaBeforeKeyFrameNal",!0),this.videoTrack=a||new Tr,this.audioTrack=e||new wr,this.metadataTrack=r||new Pr,this._fixer=new Ur(this.videoTrack,this.audioTrack,this.metadataTrack)}return U(i,[{key:"demux",value:function(e){var r,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=arguments.length>3?arguments[3]:void 0,o=this.audioTrack,u=this.videoTrack,l=this.metadataTrack;if((t||!n)&&(this._remainingData=null),t&&(this._headerParsed=!1),t?(u.reset(),o.reset(),l.reset()):(u.samples=[],o.samples=[],l.seiSamples=[],l.flvScriptSamples=[],u.warnings=[],o.warnings=[],this._remainingData&&(e=he(this._remainingData,e),this._remainingData=null)),!e.length)return{videoTrack:u,audioTrack:o,metadataTrack:l};var c=0;if(!this._headerParsed){if(!i.probe(e))throw new Error("Invalid flv file");o.present=(e[4]&4)>>>2!==0,u.present=(e[4]&1)!==0,this._headerParsed=!0,c=je(e,5)+4}for(var f=e.length,v,m,g,E,S;c+15<f&&(v=e[c],m=e[c+1]<<16|e[c+2]<<8|e[c+3],!(c+15+m>f));)g=(e[c+7]<<24>>>0)+(e[c+4]<<16)+(e[c+5]<<8)+e[c+6],c+=11,E=e.subarray(c,c+m),v===8?this._parseAudio(E,g):v===9?(s&&(this.seamlessLoadingSwitching=!0),this._parseVideo(E,g)):v===18?this._parseScript(E,g):Se.warn("Invalid tag type: ".concat(v)),c+=m,S=je(e,c),S!==11+m&&Se.warn("Invalid PrevTagSize ".concat(S," (").concat(11+m,")")),c+=4;c<f&&(this._remainingData=e.subarray(c)),o.formatTimescale=u.formatTimescale=u.timescale=l.timescale=1e3,o.timescale=o.codecType===Y.OPUS?1e3:o.sampleRate||0,!o.exist()&&o.hasSample()&&o.reset(),!u.exist()&&u.hasSample()&&u.reset();var C=l.flvScriptSamples[l.flvScriptSamples.length-1],A=C==null||(r=C.data)===null||r===void 0?void 0:r.onMetaData;return A&&(u!=null&&u.exist()&&(A.hasOwnProperty("duration")&&(u.duration=A.duration*1e3),A.hasOwnProperty("width")&&A.hasOwnProperty("height")&&(u.width=A.width,u.height=A.height)),o!=null&&o.exist()&&A.hasOwnProperty("duration")&&(o.duration=A.duration*1e3)),{videoTrack:u,audioTrack:o,metadataTrack:l}}},{key:"fix",value:function(e,r,t){return this._fixer.fix(e,r,t),{videoTrack:this.videoTrack,audioTrack:this.audioTrack,metadataTrack:this.metadataTrack}}},{key:"demuxAndFix",value:function(e,r,t,n,s){return this.demux(e,r,t,s),this.fix(n,r,t)}},{key:"_parseAudio",value:function(e,r){if(e.length){var t=(e[0]&240)>>>4,n=this.audioTrack;if(t!==be.AAC&&t!==be.G711A&&t!==be.G711M&&t!==be.OPUS){Se.warn("Unsupported sound format: ".concat(t)),n.reset();return}if(t!==be.AAC&&t!==be.OPUS){var s=(e[0]&12)>>2,o=(e[0]&2)>>1,u=e[0]&1;n.sampleRate=i.AUDIO_RATE[s],n.sampleSize=o?16:8,n.channelCount=u+1}switch(t){case be.G711A:case be.G711M:this._parseG711(e,r,t);break;case be.AAC:this._parseAac(e,r);break;case be.OPUS:this._parseOpus(e,r);break}}}},{key:"_parseOpus",value:function(e,r){var t=this.audioTrack,n=e[1];switch(t.codecType=Y.OPUS,n){case 0:{var s=Je.parseHeaderPackets(e.subarray(2));s?(t.codec=s.codec,t.channelCount=s.channelCount,t.sampleRate=s.sampleRate,t.config=s.config,t.sampleDuration=Je.getFrameDuration([],t.timescale)):(t.reset(),Se.warn("Cannot parse AudioSpecificConfig",e));break}case 1:{if(r==null)return;var o=new Ge(r,e.subarray(2),t.sampleDuration);t.samples.push(o);break}default:Se.warn("Unknown OpusPacketType: ".concat(n))}}},{key:"_parseG711",value:function(e,r,t){var n=this.audioTrack,s=e.subarray(1);if(!(s.byteLength<1)){var o=new Ge(r,s);n.codecType=t===7?Y.G711PCMA:Y.G711PCMU,n.sampleRate=8e3,n.codec=n.codecType,n.samples.push(o)}}},{key:"_parseAac",value:function(e,r){var t=this.audioTrack;if(t.codecType=Y.AAC,e[1]===0){var n=Ve.parseAudioSpecificConfig(e.subarray(2));n?(t.codec=n.codec,t.channelCount=n.channelCount,t.sampleRate=n.sampleRate,t.config=n.config,t.objectType=n.objectType,t.sampleRateIndex=n.samplingFrequencyIndex):(t.reset(),Se.warn("Cannot parse AudioSpecificConfig",e))}else if(e[1]===1){if(r==null)return;t.samples.push(new Ge(r,e.subarray(2)))}else Se.warn("Unknown AACPacketType: ".concat(e[1]))}},{key:"_parseVideo",value:function(e,r){var t=this;if(!(e.length<6)){var n=(e[0]&240)>>>4,s=e[0]&15,o=this.videoTrack;if(s!==7&&s!==12){o.reset(),Se.warn("Unsupported codecId: ".concat(s));return}var u=s===12;o.codecType=u?we.HEVC:we.AVC;var l=e[1],c=(e[2]<<16|e[3]<<8|e[4])<<8>>8;if(l===0){var f=e.subarray(5),v=u?Fr.parseHEVCDecoderConfigurationRecord(f):Nr.parseAVCDecoderConfigurationRecord(f);if(v){var m=v.hvcC,g=v.sps,E=v.ppsArr,S=v.spsArr,C=v.vpsArr,A=v.nalUnitSize;m&&(o.hvcC=o.hvcC||m),g&&(o.codec=g.codec,o.width=g.width,o.height=g.height,o.sarRatio=g.sarRatio,o.fpsNum=g.fpsNum,o.fpsDen=g.fpsDen),S.length&&(o.sps=S),E.length&&(o.pps=E),C&&C.length&&(o.vps=C),A&&(o.nalUnitSize=A)}else Se.warn("Cannot parse ".concat(u?"HEVC":"AVC","DecoderConfigurationRecord"),e)}else if(l===1){var N=Ce.parseAvcC(e.subarray(5),o.nalUnitSize);if(N=this._checkAddMetaNalToUnits(u,N,o),N&&N.length){var O=new Cr(r+c,r,N);if(this.seamlessLoadingSwitching&&r<o.lastKeyFrameDts)return;this.seamlessLoadingSwitching=!1,n===1&&(O.setToKeyframe(),o.lastKeyFrameDts=r),o.samples.push(O),N.forEach(function(w){var P=u?w[0]>>>1&63:w[0]&31;switch(P){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!u&&P!==5||u&&P===5)break;O.setToKeyframe();break;case 6:case 39:case 40:if(!u&&P!==6||u&&P===6)break;t.metadataTrack.seiSamples.push(new Or(Ce.parseSEI(Ce.removeEPB(w),u),r+c));break}}),O.keyframe&&this._gopId++,O.gopId=this._gopId}else Se.warn("Cannot parse NALUs",e)}else l===2||Se.warn("Unknown AVCPacketType: ".concat(l))}}},{key:"_checkAddMetaNalToUnits",value:function(e,r,t){if(!e||!this._needAddMetaBeforeKeyFrameNal)return this._needAddMetaBeforeKeyFrameNal=!1,r;var n=r.map(function(s){return s[0]>>>1&63});return n.includes(32)?(this._needAddMetaBeforeKeyFrameNal=!1,r):(r.unshift(t.pps[0]),r.unshift(t.sps[0]),r.unshift(t.vps[0]),r.filter(Boolean))}},{key:"_parseScript",value:function(e,r){this.metadataTrack.flvScriptSamples.push(new kr(Gr.parse(e),r))}}],[{key:"probe",value:function(e){return e[0]!==70||e[1]!==76||e[2]!==86||e[3]!==1?!1:je(e,5)>=9}}]),i}();b(ft,"AUDIO_RATE",[5500,11e3,22e3,44e3]);function xi(i){for(var a=0,e=arguments.length,r=new Array(e>1?e-1:0),t=1;t<e;t++)r[t-1]=arguments[t];r.forEach(function(o){a+=o.length});var n=new i(a),s=0;return r.forEach(function(o){n.set(o,s),s+=o.length}),n}var ne=function(){function i(){M(this,i),this.buffer=new Uint8Array(0)}return U(i,[{key:"write",value:function(){for(var e=this,r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];t.forEach(function(s){s?e.buffer=xi(Uint8Array,e.buffer,s):window.console.warn(s)})}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,e&255])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,e&255])}}]),i}();var Vr=Math.pow(2,32)-1,B=function(){function i(){M(this,i)}return U(i,null,[{key:"box",value:function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];t=t.filter(Boolean);var s=8+t.reduce(function(l,c){return l+c.byteLength},0),o=new Uint8Array(s);o[0]=s>>24&255,o[1]=s>>16&255,o[2]=s>>8&255,o[3]=s&255,o.set(e,4);var u=8;return t.forEach(function(l){o.set(l,u),u+=l.byteLength}),o}},{key:"ftyp",value:function(e){var r=e.find(function(t){return t.type===ye.VIDEO&&t.codecType===we.HEVC});return r?i.FTYPHEV1:i.FTYPAVC1}},{key:"initSegment",value:function(e){var r=i.ftyp(e),t=he(r,i.moov(e));return t}},{key:"pssh",value:function(e){var r=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],Mt(e.kid),[0,0,0,0]));return i.box(i.types.pssh,r)}},{key:"moov",value:function(e){if(e[0].useEME&&(e[0].encv||e[0].enca)){e[0].pssh||(e[0].pssh={kid:e[0].kid});var r=this.pssh(e[0].pssh);return i.box.apply(i,[i.types.moov,i.mvhd(e[0].mvhdDurtion||e[0].duration,e[0].mvhdTimecale||e[0].timescale),i.mvex(e)].concat(ge(e.map(function(t){return i.trak(t)})),[r]))}else return i.box.apply(i,[i.types.moov,i.mvhd(e[0].mvhdDurtion||e[0].duration,e[0].mvhdTimecale||e[0].timescale)].concat(ge(e.map(function(t){return i.trak(t)})),[i.mvex(e)]))}},{key:"mvhd",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:9e4,t=i.box(i.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,r&255,e>>24&255,e>>16&255,e>>8&255,e&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]));return t}},{key:"trak",value:function(e){var r=i.box(i.types.trak,i.tkhd(e.id,e.tkhdDuration||0,e.width,e.height),i.mdia(e));return r}},{key:"tkhd",value:function(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=i.box(i.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,e>>24&255,e>>16&255,e>>8&255,e&255,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,r&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,t>>8&255,t&255,0,0,n>>8&255,n&255,0,0]));return s}},{key:"mdia",value:function(e){var r=i.box(i.types.mdia,i.mdhd(e.duration,e.timescale),i.hdlr(e.type),i.minf(e));return r}},{key:"mdhd",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:9e4,t=i.box(i.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,r&255,e>>24&255,e>>16&255,e>>8&255,e&255,85,196,0,0]));return t}},{key:"hdlr",value:function(e){var r=i.box(i.types.hdlr,i.HDLR_TYPES[e]);return r}},{key:"minf",value:function(e){var r=i.box(i.types.minf,e.type===ye.VIDEO?i.VMHD:i.SMHD,i.DINF,i.stbl(e));return r}},{key:"stbl",value:function(e){var r=[];e&&e.ext&&e.ext.stss&&r.push(i.stss(e.ext.stss.entries));var t=i.box(i.types.stbl,i.stsd(e),i.STTS,r[0],i.STSC,i.STSZ,i.STCO);return t}},{key:"stsd",value:function(e){var r;e.type==="audio"?e.useEME&&e.enca?r=i.enca(e):e.codecType===Y.OPUS?r=i.opus(e):r=i.mp4a(e):e.useEME&&e.encv?r=i.encv(e):e.av1C?r=i.av01(e):r=i.avc1hev1(e);var t=i.box(i.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),r);return t}},{key:"enca",value:function(e){var r=e.enca.channelCount,t=e.enca.sampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,t>>8&255,t&255,0,0]),s=i.esds(e.config),o=i.sinf(e.enca);return i.box(i.types.enca,n,s,o)}},{key:"encv",value:function(e){var r,t,n=e.sps.length>0?e.sps[0]:[],s=e.pps.length>0?e.pps[0]:[],o=e.width,u=e.height,l=e.sarRatio[0],c=e.sarRatio[1],f=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,o&255,u>>8&255,u&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),v=new Uint8Array((r=(t=[1,n[1],n[2],n[3],255,225,n.length>>>8&255,n.length&255]).concat.apply(t,ge(n)).concat([1,s.length>>>8&255,s.length&255])).concat.apply(r,ge(s))),m=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),g=i.sinf(e.encv),E=new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,c>>24,c>>16&255,c>>8&255,c&255]);return i.box(i.types.encv,f,i.box(i.types.avcC,v),i.box(i.types.btrt,m),g,i.box(i.types.pasp,E))}},{key:"schi",value:function(e){var r=new Uint8Array([]),t=i.tenc(e);return i.box(i.types.schi,r,t)}},{key:"tenc",value:function(e){var r=new Uint8Array([0,0,0,0,0,0,e.default_IsEncrypted&255,e.default_IV_size&255].concat(Mt(e.default_KID)));return i.box(i.types.tenc,r)}},{key:"sinf",value:function(e){var r=new Uint8Array([]),t=new Uint8Array([e.data_format.charCodeAt(0),e.data_format.charCodeAt(1),e.data_format.charCodeAt(2),e.data_format.charCodeAt(3)]),n=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),s=i.schi(e);return i.box(i.types.sinf,r,i.box(i.types.frma,t),i.box(i.types.schm,n),s)}},{key:"av01",value:function(e){return i.box(i.types.av01,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,e.width>>8&255,e.width&255,e.height>>8&255,e.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),e.av1C,e.colr)}},{key:"avc1hev1",value:function(e){var r=e.codecType===we.HEVC,t=r?i.types.hvc1:i.types.avc1,n=r?i.hvcC(e):i.avcC(e),s=[new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,e.width>>8&255,e.width&255,e.height>>8&255,e.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n];return r?s.push(i.box(i.types.fiel,new Uint8Array([1,0]))):e.sarRatio&&e.sarRatio.length>1&&s.push(i.pasp(e.sarRatio)),i.box.apply(i,[t].concat(s))}},{key:"avcC",value:function(e){var r,t,n=[],s=[],o;return e.sps.forEach(function(u){o=u.byteLength,n.push(o>>>8&255),n.push(o&255),n.push.apply(n,ge(u))}),e.pps.forEach(function(u){o=u.byteLength,s.push(o>>>8&255),s.push(o&255),s.push.apply(s,ge(u))}),i.box(i.types.avcC,new Uint8Array((r=(t=[1,n[3],n[4],n[5],255,224|e.sps.length]).concat.apply(t,n).concat([e.pps.length])).concat.apply(r,s)))}},{key:"hvcC",value:function(e){var r=e.hvcC;if(r instanceof ArrayBuffer||r instanceof Uint8Array)return r;var t=e.vps,n=e.sps,s=e.pps,o;if(r){var u=r.generalProfileCompatibilityFlags,l=r.generalConstraintIndicatorFlags,c=(t.length&&1)+(n.length&&1)+(s.length&&1);o=[1,r.generalProfileSpace<<6|r.generalTierFlag<<5|r.generalProfileIdc,u>>>24,u>>>16,u>>>8,u,l[0],l[1],l[2],l[3],l[4],l[5],r.generalLevelIdc,240,0,252,r.chromaFormatIdc|252,r.bitDepthLumaMinus8|248,r.bitDepthChromaMinus8|248,0,0,r.numTemporalLayers<<3|r.temporalIdNested<<2|3,c];var f=function(m){var g;o.push(m.length>>8,m.length),(g=o).push.apply(g,ge(m))};t.length&&(o.push(160,0,t.length),t.forEach(f)),n.length&&(o.push(161,0,n.length),n.forEach(f)),s.length&&(o.push(162,0,s.length),s.forEach(f))}else o=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return i.box(i.types.hvcC,new Uint8Array(o))}},{key:"pasp",value:function(e){var r=br(e,2),t=r[0],n=r[1];return i.box(i.types.pasp,new Uint8Array([t>>24,t>>16&255,t>>8&255,t&255,n>>24,n>>16&255,n>>8&255,n&255]))}},{key:"mp4a",value:function(e){return i.box(i.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,e.sampleRate>>8&255,e.sampleRate&255,0,0]),e.config.length?i.esds(e.config):void 0)}},{key:"esds",value:function(e){var r=e.length,t=i.box(i.types.esds,new Uint8Array([0,0,0,0,3,23+r,0,0,0,4,15+r,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([r]).concat(e).concat([6,1,2])));return t}},{key:"opus",value:function(e){var r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,e.sampleRate>>8&255,e.sampleRate&255,0,0]),t=e.config.length?i.dOps(e):[];return i.box(i.types.Opus,r,t)}},{key:"dOps",value:function(e){if(e.config)return e.config[4]=e.sampleRate>>>24&255,e.config[5]=e.sampleRate>>>16&255,e.config[6]=e.sampleRate>>>8&255,e.config[7]=e.sampleRate&255,i.box(i.types.dOps,e.config)}},{key:"mvex",value:function(e){var r=i.box.apply(i,[i.types.mvex].concat(ge(e.map(function(t){return i.trex(t.id)}))));return r}},{key:"trex",value:function(e){var r=i.box(i.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]));return r}},{key:"trex1",value:function(e){var r=i.box(i.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]));return r}},{key:"trex2",value:function(e){var r=i.box(i.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]));return r}},{key:"moof",value:function(e){var r=i.box.apply(i,[i.types.moof,i.mfhd(e[0].samples?e[0].samples[0].gopId:0)].concat(ge(e.map(function(t){return i.traf(t)}))));return r}},{key:"mfhd",value:function(e){var r=i.box(i.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]));return r}},{key:"traf",value:function(e){var r=i.tfhd(e.id),t=i.tfdt(e,e.baseMediaDecodeTime),n=0,s;if(e.isVideo&&e.videoSenc&&(s=e.videoSenc,s.forEach(function(h){n=n+8,h.subsamples&&h.subsamples.length&&(n=n+2,n=n+h.subsamples.length*6)})),e.videoSencLength=n,!e.useEME||!e.isVideoEncryption&&!e.isAudioEncryption){var o=i.sdtp(e),u=76;return i.box(i.types.traf,r,t,o,i.trun(e.samples,o.byteLength+u))}else if(e.isVideoEncryption)if(e.isVideo){var l=i.saiz(e),c=i.saio(e),f=i.trun1(e),v=i.senc(e),m=i.box(i.types.traf,r,t,l,c,f,v);return m}else if(e.isAudioEncryption){var S=i.sbgp(),C=i.saiz(e),A=i.saio(e),N=i.senc(e),O=i.trun1(e),w=i.box(i.types.traf,r,t,S,C,A,N,O);return w}else{var g=i.sbgp(),E=i.trun1(e);return i.box(i.types.traf,r,t,g,E)}else if(e.isVideo){var P=i.trun1(e);return i.box(i.types.traf,r,t,P)}else{var X=i.sbgp(),J=i.saiz(e),L=i.saio(e),j=i.senc(e),ie=i.trun1(e),p=i.box(i.types.traf,r,t,X,J,L,j,ie);return p}}},{key:"sdtp",value:function(e){var r=new ne;return e.samples.forEach(function(t){r.write(new Uint8Array(e.isVideo?[t.keyframe?32:16]:[16]))}),i.box(i.types.sdtp,this.extension(0,0),r.buffer)}},{key:"trun1",value:function(e){var r=new ne,t=ne.writeUint32(e.samples.length),n=null;if(e.isVideo){var s=e.videoSencLength;n=ne.writeUint32(e.samples.length*16+s+149),!e.isVideoEncryption&&e.isAudioEncryption&&(n=ne.writeUint32(e.samples.length*16+92))}else{var o=e.samples.length*12+124;e.isAudioEncryption&&(o=e.samples.length*12+8*e.audioSenc.length+177),n=ne.writeUint32(o)}return e.samples.forEach(function(u){r.write(ne.writeUint32(u.duration)),r.write(ne.writeUint32(u.size)),r.write(ne.writeUint32(u.keyframe?33554432:65536)),e.isVideo&&r.write(ne.writeUint32(u.cts?u.cts:0))}),i.box(i.types.trun,this.extension(0,e.flags),t,n,r.buffer)}},{key:"senc",value:function(e){var r=new ne,t=e.samples.length,n=e.isVideo?16:8,s=e.isVideo?2:0,o=[],u=0;return e.isVideo?(o=e.videoSenc,u=e.videoSencLength):o=e.audioSenc,u=u||n*t,r.write(ne.writeUint32(16+u),i.types.senc,this.extension(0,s)),r.write(ne.writeUint32(t)),o.forEach(function(l){for(var c=0;c<l.InitializationVector.length;c++)r.write(new Uint8Array([l.InitializationVector[c]]));l.subsamples&&l.subsamples.length&&(r.write(ne.writeUint16(l.subsamples.length)),l.subsamples.forEach(function(f){r.write(ne.writeUint16(f.BytesOfClearData)),r.write(ne.writeUint32(f.BytesOfProtectedData))}))}),r.buffer}},{key:"saio",value:function(e){var r=e.samples.length*12+141;!e.isVideo&&e.isAudioEncryption&&(r=149);var t=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,r&255]);return i.box(i.types.saio,t)}},{key:"saiz",value:function(e){var r=e.samples.length,t=new Uint8Array([0,0,0,0,16,r>>24&255,r>>16&255,r>>8&255,r&255]);return i.box(i.types.saiz,t)}},{key:"sbgp",value:function(){var e=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return i.box(i.types.sbgp,this.extension(0,0),e)}},{key:"extension",value:function(e,r){return new Uint8Array([e,r>>16&255,r>>8&255,r&255])}},{key:"tfhd",value:function(e){return i.box(i.types.tfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}},{key:"tfdt",value:function(e,r){var t=Math.floor(r/(Vr+1)),n=Math.floor(r%(Vr+1));return e.useEME&&(e.isVideoEncryption||e.isAudioEncryption)?i.box(i.types.tfdt,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255])):i.box(i.types.tfdt,new Uint8Array([1,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,n>>24,n>>16&255,n>>8&255,n&255]))}},{key:"trun",value:function(e,r){var t=e.length,n=12+16*t;r+=8+n;var s=new Uint8Array(n);s.set([0,0,15,1,t>>>24&255,t>>>16&255,t>>>8&255,t&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255],0);for(var o=0;o<t;o++){var u=e[o],l=u.duration,c=u.size,f=u.flag,v=f===void 0?{}:f,m=u.cts,g=m===void 0?0:m;s.set([l>>>24&255,l>>>16&255,l>>>8&255,l&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,v.isLeading<<2|(v.dependsOn===null||v.dependsOn===void 0?1:v.dependsOn),v.isDependedOn<<6|v.hasRedundancy<<4|v.paddingValue<<1|(v.isNonSyncSample===null||v.isNonSyncSample===void 0?1:v.isNonSyncSample),v.degradationPriority&61440,v.degradationPriority&15,g>>>24&255,g>>>16&255,g>>>8&255,g&255],12+16*o)}return i.box(i.types.trun,s)}},{key:"moovMP4",value:function(e){return i.box.apply(i,[i.types.moov,i.mvhd(e[0].duration,e[0].timescale)].concat(ge(e.map(function(r){return i.trackMP4(r)}))))}},{key:"trackMP4",value:function(e){return i.box(i.types.trak,i.tkhd(e.id,e.duration,e.width,e.height),i.mdiaMP4(e))}},{key:"mdiaMP4",value:function(e){return i.box(i.types.mdia,i.mdhd(e.duration,e.timescale),i.hdlr(e.type),i.minfMP4(e))}},{key:"minfMP4",value:function(e){return i.box(i.types.minf,e.type===ye.VIDEO?i.VMHD:i.SMHD,i.DINF,i.stblMP4(e))}},{key:"stblMP4",value:function(e){var r=e.ext,t=[i.stsd(e),i.stts(r.stts),i.stsc(r.stsc),i.stsz(r.stsz),i.stco(r.stco)];return r.stss.length&&t.push(i.stss(r.stss)),r.ctts.length&&t.push(i.ctts(r.ctts)),i.box.apply(i,[i.types.stbl].concat(t))}},{key:"stts",value:function(e){var r=e.length,t=new Uint8Array(8*r),n=0;return e.forEach(function(s){var o=s.value,u=s.count;t.set([u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255],n),n+=8}),i.box(i.types.stts,he(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255]),t))}},{key:"stsc",value:function(e){var r=e.length,t=new Uint8Array(12*r),n=0;return e.forEach(function(s){var o=s.firstChunk,u=s.samplesPerChunk,l=s.sampleDescIndex;t.set([o>>24,o>>16&255,o>>8&255,o&255,u>>24,u>>16&255,u>>8&255,u&255,l>>24,l>>16&255,l>>8&255,l&255],n),n+=12}),i.box(i.types.stsc,he(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255]),t))}},{key:"stsz",value:function(e){var r=e.length,t=new Uint8Array(4*r),n=0;return e.forEach(function(s){t.set([s>>24,s>>16&255,s>>8&255,s&255],n),n+=4}),i.box(i.types.stsz,he(new Uint8Array([0,0,0,0,0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255]),t))}},{key:"stco",value:function(e){var r=e.length,t=new Uint8Array(4*r),n=0;return e.forEach(function(s){t.set([s>>24,s>>16&255,s>>8&255,s&255],n),n+=4}),i.box(i.types.stco,he(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255]),t))}},{key:"stss",value:function(e){var r=e.length,t=new Uint8Array(4*r),n=0;return e.forEach(function(s){t.set([s>>24,s>>16&255,s>>8&255,s&255],n),n+=4}),i.box(i.types.stss,he(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255]),t))}},{key:"ctts",value:function(e){var r=e.length,t=new Uint8Array(8*r),n=0;return e.forEach(function(s){var o=s.value,u=s.count;t.set([u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255],n),n+=8}),i.box(i.types.ctts,he(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255]),t))}},{key:"styp",value:function(){return i.box(i.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(e){var r=e.timescale,t=e.samples[0].duration,n=t*e.samples.length,s=e.samples[0].sampleOffset*t,o=8;e.samples.forEach(function(v){o+=v.size});var u=0;if(e.isVideo){var l=0,c;e.videoSenc&&(c=e.videoSenc),e.isVideo&&c.forEach(function(v){l=l+8,v.subsamples&&v.subsamples.length&&(l=l+2,l=l+v.subsamples.length*6)}),e.videoSencLength=l,u=o+141+e.samples.length*16+l,e.useEME&&e.isAudioEncryption&&!e.isVideoEncryption&&(u=o+e.samples.length*16+84)}else u=o+116+e.samples.length*12,e.useEME&&e.isAudioEncryption&&(u=o+169+e.samples.length*12+8*e.audioSenc.length);var f=new Uint8Array([0,0,0,0,0,0,0,e.id&255,r>>24&255,r>>16&255,r>>8&255,r&255,s>>24&255,s>>16&255,s>>8&255,s&255,0,0,0,0,0,0,0,1,0,u>>16&255,u>>8&255,u&255,n>>24&255,n>>16&255,n>>8&255,n&255,144,0,0,0]);return i.box(i.types.sidx,f)}},{key:"mdat",value:function(e){var r=i.box(i.types.mdat,e);return r}}]),i}();b(B,"types",["Opus","dOps","av01","av1C","avc1","avcC","hvc1","hvcC","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp"].reduce(function(i,a){return i[a]=[a.charCodeAt(0),a.charCodeAt(1),a.charCodeAt(2),a.charCodeAt(3)],i},Object.create(null)));b(B,"HDLR_TYPES",{video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])});b(B,"FTYPAVC1",B.box(B.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49])));b(B,"FTYPHEV1",B.box(B.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49])));b(B,"DINF",B.box(B.types.dinf,B.box(B.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]))));b(B,"VMHD",B.box(B.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])));b(B,"SMHD",B.box(B.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0])));b(B,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0]));b(B,"STTS",B.box(B.types.stts,B.StblTable));b(B,"STSC",B.box(B.types.stsc,B.StblTable));b(B,"STSZ",B.box(B.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0])));b(B,"STCO",B.box(B.types.stco,B.StblTable));var Bt=function(){function i(a,e){M(this,i),this.name=a||"",this._prefix="[".concat(this.name,"]"),i.disabled=e}return U(i,[{key:"debug",value:function(){var e;if(!i.disabled){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];(e=console).debug.apply(e,[this._prefix].concat(t))}}},{key:"log",value:function(){var e;if(!i.disabled){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];(e=console).log.apply(e,[this._prefix].concat(t))}}},{key:"warn",value:function(){var e;if(!i.disabled){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];(e=console).warn.apply(e,[this._prefix].concat(t))}}},{key:"error",value:function(){var e;if(!i.disabled){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];(e=console).error.apply(e,[this._prefix].concat(t))}}},{key:"table",value:function(){var e;i.disabled||(console.group(this._prefix),(e=console).table.apply(e,arguments),console.groupEnd())}}],[{key:"enable",value:function(){i.disabled=!1}},{key:"disable",value:function(){i.disabled=!0}}]),i}();b(Bt,"disabled",!0);var Nt=function(){function i(a,e,r){M(this,i),this.videoTrack=a,this.audioTrack=e;var t=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=t&&Number(t[1])<50,this.log=new Bt("FMP4Remuxer",r&&r.openLog?!r.openLog:!0)}return U(i,[{key:"remux",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=this.videoTrack,n=this.audioTrack,s=t.exist(),o=n.exist(),u,l,c,f=[];e&&(r&&r.initMerge?(s&&f.push(this.videoTrack),o&&f.push(this.audioTrack),c=B.initSegment(f)):(s&&(u=B.initSegment([this.videoTrack])),o&&(l=B.initSegment([this.audioTrack]))));var v,m;return s&&t.hasSample()&&(v=this._remuxVideo()),o&&n.hasSample()&&(m=this._remuxAudio()),t.samples=[],n.samples=[],{initSegment:c,videoInitSegment:u,audioInitSegment:l,videoSegment:v,audioSegment:m}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var r=e.samples,t=/av01/.test(e.codec),n=0;t?r.forEach(function(N){n+=N.data.byteLength}):r.forEach(function(N){n+=N.units.reduce(function(O,w){return O+w.byteLength},0),n+=N.units.length*4});var s=new Uint8Array(n);if(t)for(var o=0,u=r.length,l=0,c;o<u;o++)c=r[o],s.set(c.data,l),c.size=c.data.byteLength,l+=c.size;else for(var f=new DataView(s.buffer),v=function(O,w){w=r[m];var P=0;w.units.forEach(function(X){f.setUint32(O,X.byteLength),O+=4,s.set(X,O),O+=X.byteLength,P+=4+X.byteLength}),w.size=P,E=O,S=w},m=0,g=r.length,E=0,S;m<g;m++)v(E,S);var C=B.mdat(s),A=B.moof([e]);return he(A,C)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,r=new Uint8Array(e.samples.reduce(function(s,o){return s+o.size},0));e.samples.reduce(function(s,o){return r.set(o.data,s),s+o.size},0);var t=B.mdat(r),n=B.moof([e]);return he(n,t)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),i}();var jr=function(){function i(){Be(this,i),R(this,"_ttfb",0),R(this,"_demuxStart",0),R(this,"_demuxEnd",0),R(this,"_demuxCost",0),R(this,"_remuxStart",0),R(this,"_remuxEnd",0),R(this,"_remuxCost",0),R(this,"_appendStart",0),R(this,"_appendEnd",0),R(this,"_appendCost",0)}return Ne(i,[{key:"set",value:function(e,r){this["_".concat(e)]=r}},{key:"start",value:function(e){this["_".concat(e,"Start")]=Date.now()}},{key:"end",value:function(e){this["_".concat(e,"End")]=Date.now(),this["_".concat(e,"Cost")]=this["_".concat(e,"Cost")]+(this["_".concat(e,"End")]-this["_".concat(e,"Start")])}},{key:"transferCost",get:function(){return{ttfbCost:this._ttfb,demuxCost:this._demuxCost,remuxCost:this._remuxCost,appendCost:this._appendCost}}}]),i}(),Ae={TTFB:"ttfb",DEMUX:"demux",REMUX:"remux",APPEND:"append"};var ke=new fe("BufferService"),Hr=function(){function i(a,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Be(this,i),R(this,"flv",null),R(this,"_demuxer",new ft),R(this,"_remuxer",null),R(this,"_mse",null),R(this,"_softVideo",null),R(this,"_sourceCreated",!1),R(this,"_needInitSegment",!0),R(this,"_discontinuity",!0),R(this,"_contiguous",!1),R(this,"_initSegmentId",""),R(this,"_cachedBuffer",null),R(this,"_demuxStartTime",0),R(this,"_opts",null),this.flv=a,this._opts=r,e?this._softVideo=e:(this._remuxer=new Nt(this._demuxer.videoTrack,this._demuxer.audioTrack),this._mse=new Le(null,{preferMMS:typeof r.preferMMS=="boolean"?r.preferMMS:!!r.perferMMS}),this._mse.bindMedia(a.media))}return Ne(i,[{key:"baseDts",get:function(){var e,r;return(e=this._demuxer)===null||e===void 0||(r=e._fixer)===null||r===void 0?void 0:r._baseDts}},{key:"blobUrl",get:function(){var e;return(e=this._mse)===null||e===void 0?void 0:e.url}},{key:"isFull",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Le.VIDEO;return this._mse.isFull(e)}},{key:"seamlessSwitch",value:function(){this._needInitSegment=!0,this._discontinuity=!0,this._contiguous=!0,this._initSegmentId=""}},{key:"unContiguous",value:function(e){this._contiguous=!1,this._demuxStartTime=e}},{key:"reset",value:function(){var a=ee(F().mark(function r(){var t,n=arguments;return F().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(t=n.length>0&&n[0]!==void 0?n[0]:!1,!(this._mse&&!t)){o.next=6;break}return o.next=4,this._mse.unbindMedia();case 4:return o.next=6,this._mse.bindMedia(this.flv.media);case 6:this._needInitSegment=!0,this._discontinuity=!0,this._contiguous=!1,this._sourceCreated=!1,this._initSegmentId="",this.resetSeamlessSwitchStats();case 12:case"end":return o.stop()}},r,this)}));function e(){return a.apply(this,arguments)}return e}()},{key:"resetSeamlessSwitchStats",value:function(){this.seamlessLoadingSwitch=null,this.seamlessLoadingSwitching=!1,this._demuxer&&(this._demuxer.seamlessLoadingSwitching=!1)}},{key:"endOfStream",value:function(){var a=ee(F().mark(function r(){return F().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(!this._mse){n.next=7;break}if(!this._sourceCreated){n.next=5;break}return n.next=4,this._mse.endOfStream();case 4:this.flv.emit(x.BUFFEREOS);case 5:n.next=8;break;case 7:this._softVideo&&this._softVideo.endOfStream();case 8:case"end":return n.stop()}},r,this)}));function e(){return a.apply(this,arguments)}return e}()},{key:"updateDuration",value:function(){var a=ee(F().mark(function r(t){return F().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!this._mse){s.next=7;break}if(this._mse.isOpened){s.next=4;break}return s.next=4,this._mse.open();case 4:return ke.debug("update duration",t),s.next=7,this._mse.updateDuration(t);case 7:case"end":return s.stop()}},r,this)}));function e(r){return a.apply(this,arguments)}return e}()},{key:"destroy",value:function(){var a=ee(F().mark(function r(){return F().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(!this._mse){n.next=3;break}return n.next=3,this._mse.unbindMedia();case 3:this._mse=null,this._softVideo=null,this._demuxer=null,this._remuxer=null;case 7:case"end":return n.stop()}},r,this)}));function e(){return a.apply(this,arguments)}return e}()},{key:"appendBuffer",value:function(){var a=ee(F().mark(function r(t){var n=this,s,o,u,l,c,f,v,m,g,E,S,C,A,N,O,w,P,X;return F().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:if(s=!1,this._cachedBuffer&&(t=St(this._cachedBuffer,t),this._cachedBuffer=null),o=this._demuxer,!(!t||!t.length||!o)){L.next=5;break}return L.abrupt("return");case 5:L.prev=5,this.flv._transferCost.start(Ae.DEMUX),o.demuxAndFix(t,this.seamlessLoadingSwitching||this._discontinuity,this._contiguous,this._demuxStartTime,this.seamlessLoadingSwitching),this.seamlessLoadingSwitching=!1,this.flv._transferCost.end(Ae.DEMUX),L.next=15;break;case 12:throw L.prev=12,L.t0=L.catch(5),new se(G.DEMUX,G.SUB_TYPES.FLV,L.t0);case 15:if(u=o.videoTrack,l=o.audioTrack,c=o.metadataTrack,!this.seamlessLoadingSwitch){L.next=25;break}if(f=u.samples.findIndex(function(j){return j.originDts===u.lastKeyFrameDts}),!(f>=0)){L.next=25;break}return u.samples.splice(f),L.next=22,this.seamlessLoadingSwitch();case 22:this.seamlessLoadingSwitch=null,t=null,s=!0;case 25:if(v=u.exist(),m=l.exist(),this._opts.onlyAudio&&(v=!1,u.present=!1),this._opts.onlyVideo&&(m=!1,l.present=!1),!(!v&&u.present||!m&&l.present)){L.next=42;break}if(g=0,E=v?u:m?l:void 0,E&&E.samples.length&&(g=(E.samples[E.samples.length-1].originPts-E.samples[0].originPts)/E.timescale*1e3),!(g>this._opts.analyzeDuration)){L.next=40;break}ke.warn("analyze duration exceeded, ".concat(g,"ms"),E),u.present=v,l.present=m,this.flv.emit(x.ANALYZE_DURATION_EXCEEDED,{duration:g}),L.next=42;break;case 40:return this._cachedBuffer=t,L.abrupt("return");case 42:if(S=u.type,C=l.type,this._fireEvents(u,l,c),s||(this._discontinuity=!1,this._contiguous=!0,this._demuxStartTime=0),A=this._mse,N=function(){var ie;if((ie=n.flv)!==null&&ie!==void 0&&ie.emit){var p;(p=n.flv)===null||p===void 0||p.emit(x.APPEND_BUFFER,{})}},this.flv.emit(x.DEMUXED_TRACK,{videoTrack:u}),O="".concat(u.codec,"/").concat(u.width,"/").concat(u.height,"/").concat(l.codec,"/").concat(l.config),O!==this._initSegmentId&&(this._needInitSegment=!0,this._initSegmentId=O,this._emitMetaParsedEvent(u,l)),!A){L.next=83;break}if(this._sourceCreated){L.next=59;break}return L.next=55,A.open();case 55:v&&(ke.log("codec: video/mp4;codecs=".concat(u.codec)),A.createSource(S,"video/mp4;codecs=".concat(u.codec))),m&&(ke.log("codec: audio/mp4;codecs=".concat(l.codec)),A.createSource(C,"audio/mp4;codecs=".concat(l.codec))),this._sourceCreated=!0,this.flv.emit(x.SOURCEBUFFER_CREATED);case 59:L.prev=59,this._needInitSegment&&!this._opts.mseLowLatency&&(u.duration=this._opts.durationForMSELowLatencyOff*u.timescale,l.duration=this._opts.durationForMSELowLatencyOff*m.timescale),this.flv._transferCost.start(Ae.REMUX),w=this._remuxer.remux(this._needInitSegment),this.flv._transferCost.end(Ae.REMUX),L.next=69;break;case 66:throw L.prev=66,L.t1=L.catch(59),new se(G.REMUX,G.SUB_TYPES.FMP4,L.t1);case 69:if(!(this._needInitSegment&&!w.videoInitSegment&&!w.audioInitSegment)){L.next=71;break}return L.abrupt("return");case 71:return this._needInitSegment=!1,P=[],w.videoInitSegment&&P.push(A.append(S,w.videoInitSegment)),w.audioInitSegment&&P.push(A.append(C,w.audioInitSegment)),w.videoSegment&&P.push(A.append(S,w.videoSegment)),w.audioSegment&&P.push(A.append(C,w.audioSegment)),this.flv._transferCost.start(Ae.APPEND),X=Promise.all(P),X.then(N).then(function(){n.flv._transferCost.end(Ae.APPEND),N()}),L.abrupt("return",X);case 83:this._softVideo&&(this._softVideo.appendBuffer(u,l),N());case 84:case"end":return L.stop()}},r,this,[[5,12],[59,66]])}));function e(r){return a.apply(this,arguments)}return e}()},{key:"evictBuffer",value:function(){var a=ee(F().mark(function r(t){var n=this,s,o,u,l;return F().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(s=this.flv.media,!(!this._mse||!this._demuxer||!s||!t||t<0)){f.next=3;break}return f.abrupt("return");case 3:if(o=s.currentTime,u=o-t,!(u<=0)){f.next=7;break}return f.abrupt("return");case 7:if(l=Z.start(Z.get(s)),!(l+1>=u)){f.next=10;break}return f.abrupt("return");case 10:return f.abrupt("return",this._mse.clearBuffer(0,u).then(function(){return n.flv.emit(x.REMOVE_BUFFER,{removeEnd:u})}));case 11:case"end":return f.stop()}},r,this)}));function e(r){return a.apply(this,arguments)}return e}()},{key:"_emitMetaParsedEvent",value:function(e,r){e.exist()&&this.flv.emit(x.METADATA_PARSED,{type:"video",track:e,meta:{codec:e.codec,timescale:e.timescale,width:e.width,height:e.height,sarRatio:e.sarRatio,baseDts:e.baseDts}}),r.exist()&&this.flv.emit(x.METADATA_PARSED,{type:"audio",track:r,meta:{codec:r.codec,channelCount:r.channelCount,sampleRate:r.sampleRate,timescale:r.timescale,baseDts:r.baseDts}}),ke.debug("track parsed",e,r)}},{key:"_fireEvents",value:function(e,r,t){var n=this;ke.debug("videoTrack samples count: ".concat(e.samples.length,", audioTrack samples count: ").concat(r.samples.length)),t.flvScriptSamples.forEach(function(s){n.flv.emit(x.FLV_SCRIPT_DATA,s),ke.debug("flvScriptData",s)}),e.samples.forEach(function(s){s.keyframe&&n.flv.emit(x.KEYFRAME,{pts:s.originPts})}),e.warnings.forEach(function(s){var o;switch(s.type){case ue.LARGE_AV_SHIFT:o=x.LARGE_AV_FIRST_FRAME_GAP_DETECT;break;case ue.LARGE_VIDEO_GAP:o=x.LARGE_VIDEO_DTS_GAP_DETECT;break;case ue.LARGE_VIDEO_GAP_BETWEEN_CHUNK:o=x.MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT;break}o&&n.flv.emit(x.STREAM_EXCEPTION,pe(pe({},s),{},{type:o})),ke.warn("video exception",s)}),r.warnings.forEach(function(s){var o;switch(s.type){case ue.LARGE_AUDIO_GAP:o=x.LARGE_AUDIO_DTS_GAP_DETECT;break;case ue.AUDIO_FILLED:o=x.AUDIO_GAP_DETECT;break;case ue.AUDIO_DROPPED:o=x.AUDIO_OVERLAP_DETECT;break}o&&n.flv.emit(x.STREAM_EXCEPTION,pe(pe({},s),{},{type:o})),ke.warn("audio exception",s)}),t.seiSamples.forEach(function(s){n.flv.emit(x.SEI,pe(pe({},s),{},{sei:{code:s.data.type,content:s.data.payload,dts:s.pts}}))})}}]),i}();function zr(i){var a=pe({retryCount:3,retryDelay:1e3,disconnectRetryCount:0,loadTimeout:1e4,maxReaderInterval:5e3,preloadTime:5,defaultVodLoadSize:1e7,isLive:!1,softDecode:!1,bufferBehind:10,maxJumpDistance:3,analyzeDuration:2e4,seamlesslyReload:!1,keepStatusAfterSwitch:!0,onlyVideo:!1,onlyAudio:!1,preferMMS:!1,mseLowLatency:!0,durationForMSELowLatencyOff:6,chunkCountForSpeed:50,skipChunkSize:1e3,longtimeNoReceived:3e3,enableStartGapJump:!0},i);return a.isLive&&a.preloadTime&&(a.maxLatency||(a.maxLatency=a.preloadTime*2),a.targetLatency||(a.targetLatency=a.preloadTime),(a.disconnectTime===null||a.disconnectTime===void 0)&&(a.disconnectTime=a.maxLatency)),a}function Ft(i,a){var e=0,r=i.length-1,t=0,n=0,s=r;for(a<i[0]&&(e=0,n=s+1);n<=s;)if(t=n+Math.floor((s-n)/2),t===r||a>=i[t]&&a<i[t+1]){e=t;break}else i[t]<a?n=t+1:s=t-1;return e}var Te=new fe("flv"),ht=.1,Ii=.3,et=function(i){Wt(e,i);var a=$t(e);function e(r){var t;return Be(this,e),t=a.call(this),R(V(t),"media",null),R(V(t),"_loading",!1),R(V(t),"_opts",null),R(V(t),"_bufferService",null),R(V(t),"_gapService",null),R(V(t),"_stats",null),R(V(t),"_mediaLoader",null),R(V(t),"_maxChunkWaitTimer",null),R(V(t),"_tickTimer",null),R(V(t),"_tickInterval",500),R(V(t),"_urlSwitching",!1),R(V(t),"_seamlessSwitching",!1),R(V(t),"_disconnectRetryCount",0),R(V(t),"_preLoadEndPoint",0),R(V(t),"_keyframes",null),R(V(t),"_acceptRanges",!0),R(V(t),"_onProgress",function(){var n=ee(F().mark(function s(o,u,l,c){var f,v,m,g,E,S,C,A,N,O;return F().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:if(f=l.startTime,v=l.endTime,m=l.st,g=l.firstByteTime,t._loading=!u,t._firstProgressEmit){P.next=13;break}if(t.media){P.next=6;break}return(E=t._mediaLoader)===null||E===void 0||E.cancel(),P.abrupt("return");case 6:S=c.headers,C=m?g-m:v-f,t.emit(x.TTFB,{url:t._opts.url,responseUrl:c.url,elapsed:C}),t.emit(x.LOAD_RESPONSE_HEADERS,{headers:S}),t._transferCost.set(Ae.TTFB,C),t._acceptRanges=!!(S!=null&&S.get("Accept-Ranges"))||!!(S!=null&&S.get("Content-Range")),t._firstProgressEmit=!0;case 13:if(t._bufferService){P.next=15;break}return P.abrupt("return");case 15:return clearTimeout(t._maxChunkWaitTimer),t._bandwidthService.addChunkRecord(o?.byteLength,v-f),P.prev=17,P.next=20,t._bufferService.appendBuffer(o);case 20:(A=t._bufferService)===null||A===void 0||A.evictBuffer(t._opts.bufferBehind),P.next=33;break;case 23:if(P.prev=23,P.t0=P.catch(17),!(!t.isLive&&t._bufferService.isFull())){P.next=32;break}return P.next=28,t._mediaLoader.cancel();case 28:return t._loading=!1,N=t.bufferInfo().remaining,t._opts.preloadTime=parseInt(N)/2,P.abrupt("return");case 32:return P.abrupt("return",t._emitError(se.create(P.t0)));case 33:if(t._urlSwitching&&(t._urlSwitching=!1,t.emit(x.SWITCH_URL_SUCCESS,{url:t._opts.url})),t._seamlessSwitching&&(t._seamlessSwitching=!1,t._tick()),!(u&&!t.media.seeking)){P.next=40;break}return t.emit(x.LOAD_COMPLETE),Te.debug("load done"),t.isLive&&t._disconnectRetryCount<=0&&t._end(),P.abrupt("return");case 40:if(t.isLive){P.next=42;break}return P.abrupt("return");case 42:O=t._opts.maxReaderInterval,O&&t._firstProgressEmit&&(clearTimeout(t._maxChunkWaitTimer),t._maxChunkWaitTimer=setTimeout(function(){if(t._disconnectRetryCount){t._disconnectRetryCount--,t.load();return}Te.debug("onMaxChunkWait",O),t._end()},O));case 44:case"end":return P.stop()}},s,null,[[17,23]])}));return function(s,o,u,l){return n.apply(this,arguments)}}()),R(V(t),"_onRetryError",function(n,s){Te.debug("load retry",n,s),t.emit(x.LOAD_RETRY,{error:se.network(n),retryTime:s})}),R(V(t),"_end",function(){t._clear(),t._bufferService&&t._bufferService.endOfStream(),Te.debug("end stream")}),R(V(t),"_resetDisconnectCount",function(){t._disconnectRetryCount=t._opts.disconnectRetryCount}),R(V(t),"_tick",function(){clearTimeout(t._tickTimer);var n=V(t),s=n.media;if(s){t._tickTimer=setTimeout(t._tick,t._tickInterval);var o=Z.end(Z.get(s));if(!(o<ht||!s.readyState)){var u=t._opts;if(yt(s)&&s.currentTime)t._gapService&&t._gapService.do(s,u.maxJumpDistance,t.isLive,3);else{if(!s.currentTime&&t._gapService&&u.enableStartGapJump){var l=t._opts.mseLowLatency||t._opts.mseLowLatency===!1&&t.bufferInfo(Ii).nextStart;l&&t._gapService.do(s,u.maxJumpDistance,t.isLive,3);return}u.isLive&&s.readyState===4&&o-s.currentTime>u.disconnectTime&&t.disconnect()}}}}),R(V(t),"_onPlay",function(){var n,s,o=t._opts.softDecode||((n=t.media)===null||n===void 0||(s=n.buffered)===null||s===void 0?void 0:s.length);if(t.isLive){!t._loading&&o&&t.replay(void 0,!0);return}var u=t.bufferInfo();(u.start||u.nextStart)>ht&&t._tick()}),R(V(t),"_onLoadeddata",function(){t.isLive&&!t._opts.mseLowLatency&&t.media.duration!==1/0&&t._bufferService.updateDuration(1/0).catch(function(n){})}),R(V(t),"_onSeeking",ee(F().mark(function n(){return F().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:!t.isLive&&t.seekable&&(t._preLoadEndPoint=-1,t._checkPreload());case 1:case"end":return o.stop()}},n)}))),R(V(t),"_onTimeupdate",function(){if(t.media){var n=t._opts,s=t.media.currentTime;if(n.isLive&&n.maxLatency&&n.targetLatency){var o=Z.end(Z.get(t.media)),u=o-s;u>=n.maxLatency&&(t.media.currentTime=o-n.targetLatency,t.emit(x.CHASEFRAME,{currentTime:t.media.currentTime,latency:n.targetLatency}))}t._seiService.throw(s,!0),!(n.isLive||!t.seekable||t._loading)&&t._checkPreload()}}),R(V(t),"_onWaiting",function(){t.isLive&&!t._loading&&t._disconnectRetryCount&&(t._disconnectRetryCount--,t.load())}),R(V(t),"_onBufferUpdate",function(){if(!t._opts.isLive){var n=t.bufferInfo(),s=n.end,o=n.nextEnd;Math.abs((s||o)-t.media.duration)<1&&(t._end(),t.media.readyState<=2&&t._tick())}}),R(V(t),"_checkPreload",ee(F().mark(function n(){var s,o,u,l,c,f,v,m,g,E;return F().wrap(function(C){for(;;)switch(C.prev=C.next){case 0:if(s=t.bufferInfo(),o=s.remaining,u=o===void 0?0:o,l=t._opts,c=t._keyframes.filepositions,f=t._keyframes.times,v=t.media.currentTime,!(u<l.preloadTime)){C.next=19;break}if(m=Ft(t._keyframes.times,v+u+ht),g=Ft(t._keyframes.times,v+u+t._opts.preloadTime),g===m&&(g=m+1),t._preLoadEndPoint!==g){C.next=11;break}return C.abrupt("return");case 11:if(E=c[m],E!=null){C.next=14;break}return C.abrupt("return");case 14:return C.next=16,t._mediaLoader.cancel();case 16:t._loadData(null,[E,c[g]]),t._preLoadEndPoint=g,t._bufferService.unContiguous(f[m]);case 19:case"end":return C.stop()}},n)}))),R(V(t),"_onFlvScriptData",function(n){var s,o,u,l,c=(s=n.data)===null||s===void 0||(o=s.onMetaData)===null||o===void 0?void 0:o.keyframes,f=(u=n.data)===null||u===void 0||(l=u.onMetaData)===null||l===void 0?void 0:l.duration;c&&(t._keyframes=c),!t._opts.isLive&&f&&t._bufferService.updateDuration(f)}),t._opts=zr(r),t.media=t._opts.media||document.createElement("video"),t._opts.media=null,t._firstProgressEmit=!1,t._mediaLoader=new Tt(pe(pe({},t._opts.fetchOptions),{},{retry:t._opts.retryCount,retryDelay:t._opts.retryDelay,timeout:t._opts.loadTimeout,onRetryError:t._onRetryError,onProgress:t._onProgress,responseType:"arraybuffer"})),t._disconnectRetryCount=t._opts.disconnectRetryCount,t._transferCost=new jr,t._bufferService=new Hr(V(t),t._opts.softDecode?t.media:void 0,t._opts),t._seiService=new Ct(V(t)),t._bandwidthService=new At({chunkCountForSpeed:t._opts.chunkCountForSpeed,skipChunkSize:t._opts.skipChunkSize,longtimeNoReceived:t._opts.longtimeNoReceived}),t._stats=new kt(V(t)),t._opts.softDecode||(t._gapService=new wt),t.media.addEventListener("play",t._onPlay),t.media.addEventListener("loadeddata",t._onLoadeddata),t.media.addEventListener("seeking",t._onSeeking),t.media.addEventListener("timeupdate",t._onTimeupdate),t.media.addEventListener("progress",t._onBufferUpdate),t.media.addEventListener("waiting",t._onWaiting),t.on(x.FLV_SCRIPT_DATA,t._onFlvScriptData),t}return Ne(e,[{key:"version",get:function(){return"3.0.21"}},{key:"isLive",get:function(){return this._opts.isLive}},{key:"baseDts",get:function(){var t;return(t=this._bufferService)===null||t===void 0?void 0:t.baseDts}},{key:"seekable",get:function(){return!!this._keyframes&&this._acceptRanges}},{key:"loader",get:function(){return this._mediaLoader}},{key:"blobUrl",get:function(){var t;return(t=this._bufferService)===null||t===void 0?void 0:t.blobUrl}},{key:"speedInfo",value:function(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed(),totalSize:this._bandwidthService.getTotalSize(),totalCost:this._bandwidthService.getTotalCost()}}},{key:"getStats",value:function(){return this._stats.getStats()}},{key:"bufferInfo",value:function(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ht;return Z.info(Z.get(this.media),(t=this.media)===null||t===void 0?void 0:t.currentTime,n)}},{key:"playbackQuality",value:function(){return bt(this.media)}},{key:"load",value:function(){var r=ee(F().mark(function n(s){var o,u=arguments;return F().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(o=u.length>1&&u[1]!==void 0?u[1]:!1,this._bufferService){c.next=3;break}return c.abrupt("return");case 3:return c.next=5,this._reset(o);case 5:this._loadData(s,this._opts.isLive?[]:[0,this._opts.defaultVodLoadSize]),clearTimeout(this._tickTimer),this._tickTimer=setTimeout(this._tick,this._tickInterval);case 8:case"end":return c.stop()}},n,this)}));function t(n){return r.apply(this,arguments)}return t}()},{key:"replay",value:function(){var r=ee(F().mark(function n(){var s=this,o,u,l=arguments;return F().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(o=l.length>0&&l[0]!==void 0?l[0]:this._opts.seamlesslyReload,u=l.length>1?l[1]:void 0,this.media){f.next=4;break}return f.abrupt("return");case 4:if(this._resetDisconnectCount(),!o){f.next=11;break}return f.next=8,this._clear();case 8:setTimeout(function(){s._seamlessSwitching=!0,s._loadData(s._opts.url),s._bufferService.seamlessSwitch()}),f.next=13;break;case 11:return f.next=13,this.load();case 13:return f.abrupt("return",this.media.play(!u).catch(function(){}));case 14:case"end":return f.stop()}},n,this)}));function t(){return r.apply(this,arguments)}return t}()},{key:"disconnect",value:function(){var t;return Te.debug("disconnect!"),(t=this._bufferService)===null||t===void 0||t.resetSeamlessSwitchStats(),this._clear()}},{key:"switchURL",value:function(){var r=ee(F().mark(function n(s,o){var u=this;return F().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(this._bufferService){c.next=2;break}return c.abrupt("return");case 2:if(this._resetDisconnectCount(),!(this._loading&&o)){c.next=6;break}return this._bufferService.seamlessLoadingSwitch=function(){var f=ee(F().mark(function v(m){return F().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return E.next=2,u._clear();case 2:u._bufferService.seamlessLoadingSwitching=!0,u._urlSwitching=!0,u._seamlessSwitching=!0,u._bufferService.seamlessSwitch(),u._loadData(s);case 7:case"end":return E.stop()}},v)}));return function(v){return f.apply(this,arguments)}}(),c.abrupt("return");case 6:if(!(!o||!this._opts.isLive)){c.next=11;break}return c.next=9,this.load(s);case 9:return this._urlSwitching=!0,c.abrupt("return",this.media.play(!0).catch(function(){}));case 11:return c.next=13,this._clear();case 13:setTimeout(function(){u._urlSwitching=!0,u._seamlessSwitching=!0,u._loadData(s),u._bufferService.seamlessSwitch()});case 14:case"end":return c.stop()}},n,this)}));function t(n,s){return r.apply(this,arguments)}return t}()},{key:"destroy",value:function(){var r=ee(F().mark(function n(){return F().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(this.media){o.next=2;break}return o.abrupt("return");case 2:return this.removeAllListeners(),this._seiService.reset(),this.media.removeEventListener("play",this._onPlay),this.media.removeEventListener("loadeddata",this._onLoadeddata),this.media.removeEventListener("seeking",this._onSeeking),this.media.removeEventListener("timeupdate",this._onTimeupdate),this.media.removeEventListener("waiting",this._onWaiting),this.media.removeEventListener("progress",this._onBufferUpdate),o.next=12,Promise.all([this._clear(),this._bufferService.destroy()]);case 12:this.media=null,this._bufferService=null;case 14:case"end":return o.stop()}},n,this)}));function t(){return r.apply(this,arguments)}return t}()},{key:"_emitError",value:function(t){var n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;Te.table(t),Te.error(t),Te.error((n=this.media)===null||n===void 0?void 0:n.error),this._urlSwitching&&(this._urlSwitching=!1,this._seamlessSwitching=!1,this.emit(x.SWITCH_URL_FAILED,t)),this.emit(x.ERROR,t),s&&(this._seiService.reset(),this._end())}},{key:"_reset",value:function(){var r=ee(F().mark(function n(){var s,o=arguments;return F().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return s=o.length>0&&o[0]!==void 0?o[0]:!1,this._seiService.reset(),this._bandwidthService.reset(),this._stats.reset(),l.next=6,this._clear();case 6:return l.next=8,this._bufferService.reset(s);case 8:case"end":return l.stop()}},n,this)}));function t(){return r.apply(this,arguments)}return t}()},{key:"_loadData",value:function(){var r=ee(F().mark(function n(s,o){var u;return F().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(s&&(this._opts.url=s),u=s=this._opts.url,s){c.next=4;break}throw new Error("Source url is missing");case 4:if(this._opts.preProcessUrl&&(u=this._opts.preProcessUrl(s).url),this._mediaLoader.finnalUrl=u,this.emit(x.LOAD_START,{url:u,seamlessSwitching:this._seamlessSwitching}),Te.debug("load data, loading:",this._loading,u),!this._loading){c.next=11;break}return c.next=11,this._mediaLoader.cancel();case 11:return this._loading=!0,c.prev=12,c.next=15,this._mediaLoader.load({url:u,range:o});case 15:c.next=21;break;case 17:return c.prev=17,c.t0=c.catch(12),this._loading=!1,c.abrupt("return",this._emitError(se.network(c.t0),!1));case 21:case"end":return c.stop()}},n,this,[[12,17]])}));function t(n,s){return r.apply(this,arguments)}return t}()},{key:"_clear",value:function(){var r=ee(F().mark(function n(){return F().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!this._mediaLoader){o.next=3;break}return o.next=3,this._mediaLoader.cancel();case 3:clearTimeout(this._maxChunkWaitTimer),clearTimeout(this._tickTimer),this._loading=!1,this._firstProgressEmit=!1;case 7:case"end":return o.stop()}},n,this)}));function t(){return r.apply(this,arguments)}return t}()}],[{key:"isSupported",value:function(t){return!t||t==="video"||t==="audio"?Le.isSupported():typeof WebAssembly<"u"}},{key:"enableLogger",value:function(){fe.enable(),Ue.enable()}},{key:"disableLogger",value:function(){fe.disable(),Ue.disable()}}]),e}(Wr.default);try{localStorage.getItem("xgd")?et.enableLogger():et.disableLogger()}catch{}
8
+
9
+ if(__exports != exports)module.exports = exports;return module.exports}));