@volcengine/veplayer-plugin 2.5.0 → 2.5.1-rc.0
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/esm/index.development.js +34 -17
- package/esm/index.production.js +1 -1
- package/esm/veplayer.plugin.flv.development.js +7 -3
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.hls.development.js +11 -5
- package/esm/veplayer.plugin.hls.production.js +1 -1
- package/esm/veplayer.plugin.mp4.development.js +1 -1
- package/esm/veplayer.plugin.mp4.production.js +1 -1
- package/esm/veplayer.plugin.rtm.development.js +18 -11
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.plugin.flv.development.js +7 -3
- package/umd/veplayer.plugin.flv.production.js +1 -1
- package/umd/veplayer.plugin.hls.development.js +11 -5
- package/umd/veplayer.plugin.hls.production.js +1 -1
- package/umd/veplayer.plugin.mp4.development.js +1 -1
- package/umd/veplayer.plugin.mp4.production.js +1 -1
- package/umd/veplayer.plugin.rtm.development.js +18 -11
- package/umd/veplayer.plugin.rtm.production.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).__VEPLAYER_PLUGIN_HLS__={})}(this,(function(e){"use strict";function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function n(){n=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(O){c=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof d?t:d,o=Object.create(a.prototype),s=new T(n||[]);return i(o,"_invoke",{value:k(e,r,s)}),o}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(O){return{type:"throw",arg:O}}}e.wrap=l;var h={};function d(){}function p(){}function v(){}var m={};c(m,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(A([])));g&&g!==t&&r.call(g,o)&&(m=g);var _=v.prototype=d.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,a,o,s){var u=f(e[i],e,a);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,o,s)}),(function(e){n("throw",e,o,s)})):t.resolve(l).then((function(e){c.value=e,o(c)}),(function(e){return n("throw",e,o,s)}))}s(u.arg)}var a;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return a=a?a.then(i,i):i()}})}function k(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=E(o,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function E(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=f(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function A(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:D}}function D(){return{value:void 0,done:!0}}return p.prototype=v,i(_,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:p,configurable:!0}),p.displayName=c(v,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,c(e,u,"GeneratorFunction")),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},b(S.prototype),c(S.prototype,s,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new S(l(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(_),c(_,u,"Generator"),c(_,o,(function(){return this})),c(_,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=A,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:A(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(c){return void r(c)}s.done?t(u):Promise.resolve(u).then(n,i)}function o(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){a(o,n,i,s,u,"next",e)}function u(e){a(o,n,i,s,u,"throw",e)}s(void 0)}))}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,S(n.key),n)}}function c(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,r){return(t=S(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function p(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=h(e);if(t){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}(this,r)}}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(l){c=!0,i=l}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(e,t)||_(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,t){if(e){if("string"==typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,t):void 0}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function S(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var w=function(e){try{return!!e()}catch(t){return!0}},x=!w((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),T=x,A=Function.prototype,D=A.call,O=T&&A.bind.bind(D,D),L=T?O:function(e){return function(){return D.apply(e,arguments)}},C=L({}.isPrototypeOf),P=function(e){return e&&e.Math==Math&&e},R=P("object"==typeof globalThis&&globalThis)||P("object"==typeof window&&window)||P("object"==typeof self&&self)||P("object"==typeof k&&k)||function(){return this}()||k||Function("return this")(),I=x,M=Function.prototype,B=M.apply,U=M.call,N="object"==typeof Reflect&&Reflect.apply||(I?U.bind(B):function(){return U.apply(B,arguments)}),F=L,j=F({}.toString),V=F("".slice),G=function(e){return V(j(e),8,-1)},z=G,H=L,q=function(e){if("Function"===z(e))return H(e)},Y="object"==typeof document&&document.all,K={all:Y,IS_HTMLDDA:void 0===Y&&void 0!==Y},W=K.all,X=K.IS_HTMLDDA?function(e){return"function"==typeof e||e===W}:function(e){return"function"==typeof e},Q={},$=!w((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),J=x,Z=Function.prototype.call,ee=J?Z.bind(Z):function(){return Z.apply(Z,arguments)},te={},re={}.propertyIsEnumerable,ne=Object.getOwnPropertyDescriptor,ie=ne&&!re.call({1:2},1);te.f=ie?function(e){var t=ne(this,e);return!!t&&t.enumerable}:re;var ae,oe,se=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ue=w,ce=G,le=Object,fe=L("".split),he=ue((function(){return!le("z").propertyIsEnumerable(0)}))?function(e){return"String"==ce(e)?fe(e,""):le(e)}:le,de=function(e){return null==e},pe=de,ve=TypeError,me=function(e){if(pe(e))throw ve("Can't call method on "+e);return e},ye=he,ge=me,_e=function(e){return ye(ge(e))},be=X,Se=K.all,ke=K.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:be(e)||e===Se}:function(e){return"object"==typeof e?null!==e:be(e)},Ee={},we=Ee,xe=R,Te=X,Ae=function(e){return Te(e)?e:void 0},De=function(e,t){return arguments.length<2?Ae(we[e])||Ae(xe[e]):we[e]&&we[e][t]||xe[e]&&xe[e][t]},Oe="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Le=R,Ce=Oe,Pe=Le.process,Re=Le.Deno,Ie=Pe&&Pe.versions||Re&&Re.version,Me=Ie&&Ie.v8;Me&&(oe=(ae=Me.split("."))[0]>0&&ae[0]<4?1:+(ae[0]+ae[1])),!oe&&Ce&&(!(ae=Ce.match(/Edge\/(\d+)/))||ae[1]>=74)&&(ae=Ce.match(/Chrome\/(\d+)/))&&(oe=+ae[1]);var Be=oe,Ue=Be,Ne=w,Fe=R.String,je=!!Object.getOwnPropertySymbols&&!Ne((function(){var e=Symbol();return!Fe(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Ue&&Ue<41})),Ve=je&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ge=De,ze=X,He=C,qe=Object,Ye=Ve?function(e){return"symbol"==typeof e}:function(e){var t=Ge("Symbol");return ze(t)&&He(t.prototype,qe(e))},Ke=String,We=function(e){try{return Ke(e)}catch(t){return"Object"}},Xe=X,Qe=We,$e=TypeError,Je=function(e){if(Xe(e))return e;throw $e(Qe(e)+" is not a function")},Ze=Je,et=de,tt=function(e,t){var r=e[t];return et(r)?void 0:Ze(r)},rt=ee,nt=X,it=ke,at=TypeError,ot={exports:{}},st=R,ut=Object.defineProperty,ct=function(e,t){try{ut(st,e,{value:t,configurable:!0,writable:!0})}catch(r){st[e]=t}return t},lt="__core-js_shared__",ft=R[lt]||ct(lt,{}),ht=ft;(ot.exports=function(e,t){return ht[e]||(ht[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.30.2",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.30.2/LICENSE",source:"https://github.com/zloirock/core-js"});var dt=ot.exports,pt=me,vt=Object,mt=function(e){return vt(pt(e))},yt=mt,gt=L({}.hasOwnProperty),_t=Object.hasOwn||function(e,t){return gt(yt(e),t)},bt=L,St=0,kt=Math.random(),Et=bt(1..toString),wt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Et(++St+kt,36)},xt=dt,Tt=_t,At=wt,Dt=je,Ot=Ve,Lt=R.Symbol,Ct=xt("wks"),Pt=Ot?Lt.for||Lt:Lt&&Lt.withoutSetter||At,Rt=function(e){return Tt(Ct,e)||(Ct[e]=Dt&&Tt(Lt,e)?Lt[e]:Pt("Symbol."+e)),Ct[e]},It=ee,Mt=ke,Bt=Ye,Ut=tt,Nt=function(e,t){var r,n;if("string"===t&&nt(r=e.toString)&&!it(n=rt(r,e)))return n;if(nt(r=e.valueOf)&&!it(n=rt(r,e)))return n;if("string"!==t&&nt(r=e.toString)&&!it(n=rt(r,e)))return n;throw at("Can't convert object to primitive value")},Ft=TypeError,jt=Rt("toPrimitive"),Vt=function(e,t){if(!Mt(e)||Bt(e))return e;var r,n=Ut(e,jt);if(n){if(void 0===t&&(t="default"),r=It(n,e,t),!Mt(r)||Bt(r))return r;throw Ft("Can't convert object to primitive value")}return void 0===t&&(t="number"),Nt(e,t)},Gt=Ye,zt=function(e){var t=Vt(e,"string");return Gt(t)?t:t+""},Ht=ke,qt=R.document,Yt=Ht(qt)&&Ht(qt.createElement),Kt=function(e){return Yt?qt.createElement(e):{}},Wt=Kt,Xt=!$&&!w((function(){return 7!=Object.defineProperty(Wt("div"),"a",{get:function(){return 7}}).a})),Qt=$,$t=ee,Jt=te,Zt=se,er=_e,tr=zt,rr=_t,nr=Xt,ir=Object.getOwnPropertyDescriptor;Q.f=Qt?ir:function(e,t){if(e=er(e),t=tr(t),nr)try{return ir(e,t)}catch(r){}if(rr(e,t))return Zt(!$t(Jt.f,e,t),e[t])};var ar=w,or=X,sr=/#|\.prototype\./,ur=function(e,t){var r=lr[cr(e)];return r==hr||r!=fr&&(or(t)?ar(t):!!t)},cr=ur.normalize=function(e){return String(e).replace(sr,".").toLowerCase()},lr=ur.data={},fr=ur.NATIVE="N",hr=ur.POLYFILL="P",dr=ur,pr=Je,vr=x,mr=q(q.bind),yr=function(e,t){return pr(e),void 0===t?e:vr?mr(e,t):function(){return e.apply(t,arguments)}},gr={},_r=$&&w((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),br=ke,Sr=String,kr=TypeError,Er=function(e){if(br(e))return e;throw kr(Sr(e)+" is not an object")},wr=$,xr=Xt,Tr=_r,Ar=Er,Dr=zt,Or=TypeError,Lr=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,Pr="enumerable",Rr="configurable",Ir="writable";gr.f=wr?Tr?function(e,t,r){if(Ar(e),t=Dr(t),Ar(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Ir in r&&!r[Ir]){var n=Cr(e,t);n&&n[Ir]&&(e[t]=r.value,r={configurable:Rr in r?r[Rr]:n[Rr],enumerable:Pr in r?r[Pr]:n[Pr],writable:!1})}return Lr(e,t,r)}:Lr:function(e,t,r){if(Ar(e),t=Dr(t),Ar(r),xr)try{return Lr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw Or("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Mr=gr,Br=se,Ur=$?function(e,t,r){return Mr.f(e,t,Br(1,r))}:function(e,t,r){return e[t]=r,e},Nr=R,Fr=N,jr=q,Vr=X,Gr=Q.f,zr=dr,Hr=Ee,qr=yr,Yr=Ur,Kr=_t,Wr=function(e){var t=function(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return Fr(e,this,arguments)};return t.prototype=e.prototype,t},Xr=function(e,t){var r,n,i,a,o,s,u,c,l,f=e.target,h=e.global,d=e.stat,p=e.proto,v=h?Nr:d?Nr[f]:(Nr[f]||{}).prototype,m=h?Hr:Hr[f]||Yr(Hr,f,{})[f],y=m.prototype;for(a in t)n=!(r=zr(h?a:f+(d?".":"#")+a,e.forced))&&v&&Kr(v,a),s=m[a],n&&(u=e.dontCallGetSet?(l=Gr(v,a))&&l.value:v[a]),o=n&&u?u:t[a],n&&typeof s==typeof o||(c=e.bind&&n?qr(o,Nr):e.wrap&&n?Wr(o):p&&Vr(o)?jr(o):o,(e.sham||o&&o.sham||s&&s.sham)&&Yr(c,"sham",!0),Yr(m,a,c),p&&(Kr(Hr,i=f+"Prototype")||Yr(Hr,i,{}),Yr(Hr[i],a,o),e.real&&y&&(r||!y[a])&&Yr(y,a,o)))},Qr=Math.ceil,$r=Math.floor,Jr=Math.trunc||function(e){var t=+e;return(t>0?$r:Qr)(t)},Zr=function(e){var t=+e;return t!=t||0===t?0:Jr(t)},en=Zr,tn=Math.max,rn=Math.min,nn=function(e,t){var r=en(e);return r<0?tn(r+t,0):rn(r,t)},an=Zr,on=Math.min,sn=function(e){return e>0?on(an(e),9007199254740991):0},un=sn,cn=function(e){return un(e.length)},ln=_e,fn=nn,hn=cn,dn=function(e){return function(t,r,n){var i,a=ln(t),o=hn(a),s=fn(n,o);if(e&&r!=r){for(;o>s;)if((i=a[s++])!=i)return!0}else for(;o>s;s++)if((e||s in a)&&a[s]===r)return e||s||0;return!e&&-1}},pn={includes:dn(!0),indexOf:dn(!1)},vn=w,mn=function(e,t){var r=[][e];return!!r&&vn((function(){r.call(null,t||function(){return 1},1)}))},yn=Xr,gn=pn.indexOf,_n=mn,bn=q([].indexOf),Sn=!!bn&&1/bn([1],1,-0)<0;yn({target:"Array",proto:!0,forced:Sn||!_n("indexOf")},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Sn?bn(this,e,t)||0:gn(this,e,t)}});var kn=Ee,En=function(e){return kn[e+"Prototype"]},wn=En("Array").indexOf,xn=C,Tn=wn,An=Array.prototype,Dn=E((function(e){var t=e.indexOf;return e===An||xn(An,e)&&t===An.indexOf?Tn:t})),On=G,Ln=Array.isArray||function(e){return"Array"==On(e)},Cn={};Cn[Rt("toStringTag")]="z";var Pn="[object z]"===String(Cn),Rn=Pn,In=X,Mn=G,Bn=Rt("toStringTag"),Un=Object,Nn="Arguments"==Mn(function(){return arguments}()),Fn=Rn?Mn:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(r){}}(t=Un(e),Bn))?r:Nn?Mn(t):"Object"==(n=Mn(t))&&In(t.callee)?"Arguments":n},jn=X,Vn=ft,Gn=L(Function.toString);jn(Vn.inspectSource)||(Vn.inspectSource=function(e){return Gn(e)});var zn=Vn.inspectSource,Hn=L,qn=w,Yn=X,Kn=Fn,Wn=zn,Xn=function(){},Qn=[],$n=De("Reflect","construct"),Jn=/^\s*(?:class|function)\b/,Zn=Hn(Jn.exec),ei=!Jn.exec(Xn),ti=function(e){if(!Yn(e))return!1;try{return $n(Xn,Qn,e),!0}catch(t){return!1}},ri=function(e){if(!Yn(e))return!1;switch(Kn(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ei||!!Zn(Jn,Wn(e))}catch(t){return!0}};ri.sham=!0;var ni=!$n||qn((function(){var e;return ti(ti.call)||!ti(Object)||!ti((function(){e=!0}))||e}))?ri:ti,ii=Ln,ai=ni,oi=ke,si=Rt("species"),ui=Array,ci=function(e){var t;return ii(e)&&(t=e.constructor,(ai(t)&&(t===ui||ii(t.prototype))||oi(t)&&null===(t=t[si]))&&(t=void 0)),void 0===t?ui:t},li=function(e,t){return new(ci(e))(0===t?0:t)},fi=yr,hi=he,di=mt,pi=cn,vi=li,mi=L([].push),yi=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,a=6==e,o=7==e,s=5==e||a;return function(u,c,l,f){for(var h,d,p=di(u),v=hi(p),m=fi(c,l),y=pi(v),g=0,_=f||vi,b=t?_(u,y):r||o?_(u,0):void 0;y>g;g++)if((s||g in v)&&(d=m(h=v[g],g,p),e))if(t)b[g]=d;else if(d)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:mi(b,h)}else switch(e){case 4:return!1;case 7:mi(b,h)}return a?-1:n||i?i:b}},gi={forEach:yi(0),map:yi(1),filter:yi(2),some:yi(3),every:yi(4),find:yi(5),findIndex:yi(6),filterReject:yi(7)},_i=TypeError,bi=function(e){if(e>9007199254740991)throw _i("Maximum allowed index exceeded");return e},Si=zt,ki=gr,Ei=se,wi=function(e,t,r){var n=Si(t);n in e?ki.f(e,n,Ei(0,r)):e[n]=r},xi=w,Ti=Be,Ai=Rt("species"),Di=function(e){return Ti>=51||!xi((function(){var t=[];return(t.constructor={})[Ai]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Oi=Xr,Li=w,Ci=Ln,Pi=ke,Ri=mt,Ii=cn,Mi=bi,Bi=wi,Ui=li,Ni=Di,Fi=Be,ji=Rt("isConcatSpreadable"),Vi=Fi>=51||!Li((function(){var e=[];return e[ji]=!1,e.concat()[0]!==e})),Gi=function(e){if(!Pi(e))return!1;var t=e[ji];return void 0!==t?!!t:Ci(e)};Oi({target:"Array",proto:!0,arity:1,forced:!Vi||!Ni("concat")},{concat:function(e){var t,r,n,i,a,o=Ri(this),s=Ui(o,0),u=0;for(t=-1,n=arguments.length;t<n;t++)if(Gi(a=-1===t?o:arguments[t]))for(i=Ii(a),Mi(u+i),r=0;r<i;r++,u++)r in a&&Bi(s,u,a[r]);else Mi(u+1),Bi(s,u++,a);return s.length=u,s}});var zi,Hi,qi,Yi=En("Array").concat,Ki=C,Wi=Yi,Xi=Array.prototype,Qi=E((function(e){var t=e.concat;return e===Xi||Ki(Xi,e)&&t===Xi.concat?Wi:t})),$i={},Ji=X,Zi=R.WeakMap,ea=Ji(Zi)&&/native code/.test(String(Zi)),ta=wt,ra=dt("keys"),na=function(e){return ra[e]||(ra[e]=ta(e))},ia={},aa=ea,oa=R,sa=ke,ua=Ur,ca=_t,la=ft,fa=na,ha=ia,da="Object already initialized",pa=oa.TypeError,va=oa.WeakMap;if(aa||la.state){var ma=la.state||(la.state=new va);ma.get=ma.get,ma.has=ma.has,ma.set=ma.set,zi=function(e,t){if(ma.has(e))throw pa(da);return t.facade=e,ma.set(e,t),t},Hi=function(e){return ma.get(e)||{}},qi=function(e){return ma.has(e)}}else{var ya=fa("state");ha[ya]=!0,zi=function(e,t){if(ca(e,ya))throw pa(da);return t.facade=e,ua(e,ya,t),t},Hi=function(e){return ca(e,ya)?e[ya]:{}},qi=function(e){return ca(e,ya)}}var ga={set:zi,get:Hi,has:qi,enforce:function(e){return qi(e)?Hi(e):zi(e,{})},getterFor:function(e){return function(t){var r;if(!sa(t)||(r=Hi(t)).type!==e)throw pa("Incompatible receiver, "+e+" required");return r}}},_a=$,ba=_t,Sa=Function.prototype,ka=_a&&Object.getOwnPropertyDescriptor,Ea=ba(Sa,"name"),wa={EXISTS:Ea,PROPER:Ea&&"something"===function(){}.name,CONFIGURABLE:Ea&&(!_a||_a&&ka(Sa,"name").configurable)},xa={},Ta=_t,Aa=_e,Da=pn.indexOf,Oa=ia,La=L([].push),Ca=function(e,t){var r,n=Aa(e),i=0,a=[];for(r in n)!Ta(Oa,r)&&Ta(n,r)&&La(a,r);for(;t.length>i;)Ta(n,r=t[i++])&&(~Da(a,r)||La(a,r));return a},Pa=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ra=Ca,Ia=Pa,Ma=Object.keys||function(e){return Ra(e,Ia)},Ba=$,Ua=_r,Na=gr,Fa=Er,ja=_e,Va=Ma;xa.f=Ba&&!Ua?Object.defineProperties:function(e,t){Fa(e);for(var r,n=ja(t),i=Va(t),a=i.length,o=0;a>o;)Na.f(e,r=i[o++],n[r]);return e};var Ga,za=De("document","documentElement"),Ha=Er,qa=xa,Ya=Pa,Ka=ia,Wa=za,Xa=Kt,Qa="prototype",$a="script",Ja=na("IE_PROTO"),Za=function(){},eo=function(e){return"<"+$a+">"+e+"</"+$a+">"},to=function(e){e.write(eo("")),e.close();var t=e.parentWindow.Object;return e=null,t},ro=function(){try{Ga=new ActiveXObject("htmlfile")}catch(i){}var e,t,r;ro="undefined"!=typeof document?document.domain&&Ga?to(Ga):(t=Xa("iframe"),r="java"+$a+":",t.style.display="none",Wa.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(eo("document.F=Object")),e.close(),e.F):to(Ga);for(var n=Ya.length;n--;)delete ro[Qa][Ya[n]];return ro()};Ka[Ja]=!0;var no,io,ao,oo=Object.create||function(e,t){var r;return null!==e?(Za[Qa]=Ha(e),r=new Za,Za[Qa]=null,r[Ja]=e):r=ro(),void 0===t?r:qa.f(r,t)},so=!w((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),uo=_t,co=X,lo=mt,fo=so,ho=na("IE_PROTO"),po=Object,vo=po.prototype,mo=fo?po.getPrototypeOf:function(e){var t=lo(e);if(uo(t,ho))return t[ho];var r=t.constructor;return co(r)&&t instanceof r?r.prototype:t instanceof po?vo:null},yo=Ur,go=function(e,t,r,n){return n&&n.enumerable?e[t]=r:yo(e,t,r),e},_o=w,bo=X,So=ke,ko=oo,Eo=mo,wo=go,xo=Rt("iterator"),To=!1;[].keys&&("next"in(ao=[].keys())?(io=Eo(Eo(ao)))!==Object.prototype&&(no=io):To=!0);var Ao=!So(no)||_o((function(){var e={};return no[xo].call(e)!==e}));bo((no=Ao?{}:ko(no))[xo])||wo(no,xo,(function(){return this}));var Do={IteratorPrototype:no,BUGGY_SAFARI_ITERATORS:To},Oo=Fn,Lo=Pn?{}.toString:function(){return"[object "+Oo(this)+"]"},Co=Pn,Po=gr.f,Ro=Ur,Io=_t,Mo=Lo,Bo=Rt("toStringTag"),Uo=function(e,t,r,n){if(e){var i=r?e:e.prototype;Io(i,Bo)||Po(i,Bo,{configurable:!0,value:t}),n&&!Co&&Ro(i,"toString",Mo)}},No=Do.IteratorPrototype,Fo=oo,jo=se,Vo=Uo,Go=$i,zo=function(){return this},Ho=Xr,qo=ee,Yo=wa,Ko=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Fo(No,{next:jo(+!n,r)}),Vo(e,i,!1,!0),Go[i]=zo,e},Wo=mo,Xo=Uo,Qo=go,$o=$i,Jo=Do,Zo=Yo.PROPER,es=Jo.BUGGY_SAFARI_ITERATORS,ts=Rt("iterator"),rs="keys",ns="values",is="entries",as=function(){return this},os=function(e,t,r,n,i,a,o){Ko(r,t,n);var s,u,c,l=function(e){if(e===i&&v)return v;if(!es&&e in d)return d[e];switch(e){case rs:case ns:case is:return function(){return new r(this,e)}}return function(){return new r(this)}},f=t+" Iterator",h=!1,d=e.prototype,p=d[ts]||d["@@iterator"]||i&&d[i],v=!es&&p||l(i),m="Array"==t&&d.entries||p;if(m&&(s=Wo(m.call(new e)))!==Object.prototype&&s.next&&(Xo(s,f,!0,!0),$o[f]=as),Zo&&i==ns&&p&&p.name!==ns&&(h=!0,v=function(){return qo(p,this)}),i)if(u={values:l(ns),keys:a?v:l(rs),entries:l(is)},o)for(c in u)(es||h||!(c in d))&&Qo(d,c,u[c]);else Ho({target:t,proto:!0,forced:es||h},u);return o&&d[ts]!==v&&Qo(d,ts,v,{name:i}),$o[t]=v,u},ss=function(e,t){return{value:e,done:t}},us=_e,cs=$i,ls=ga;gr.f;var fs=os,hs=ss,ds="Array Iterator",ps=ls.set,vs=ls.getterFor(ds);fs(Array,"Array",(function(e,t){ps(this,{type:ds,target:us(e),index:0,kind:t})}),(function(){var e=vs(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,hs(void 0,!0)):hs("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),cs.Arguments=cs.Array;var ms={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},ys=R,gs=Fn,_s=Ur,bs=$i,Ss=Rt("toStringTag");for(var ks in ms){var Es=ys[ks],ws=Es&&Es.prototype;ws&&gs(ws)!==Ss&&_s(ws,Ss,ks),bs[ks]=bs.Array}var xs=gi.forEach,Ts=mn("forEach")?[].forEach:function(e){return xs(this,e,arguments.length>1?arguments[1]:void 0)};Xr({target:"Array",proto:!0,forced:[].forEach!=Ts},{forEach:Ts});var As=En("Array").forEach,Ds=Fn,Os=_t,Ls=C,Cs=As,Ps=Array.prototype,Rs={DOMTokenList:!0,NodeList:!0},Is=E((function(e){var t=e.forEach;return e===Ps||Ls(Ps,e)&&t===Ps.forEach||Os(Rs,Ds(e))?Cs:t})),Ms=mt,Bs=Ma;Xr({target:"Object",stat:!0,forced:w((function(){Bs(1)}))},{keys:function(e){return Bs(Ms(e))}});var Us=E(Ee.Object.keys),Ns=L([].slice),Fs=Xr,js=Ln,Vs=ni,Gs=ke,zs=nn,Hs=cn,qs=_e,Ys=wi,Ks=Rt,Ws=Ns,Xs=Di("slice"),Qs=Ks("species"),$s=Array,Js=Math.max;Fs({target:"Array",proto:!0,forced:!Xs},{slice:function(e,t){var r,n,i,a=qs(this),o=Hs(a),s=zs(e,o),u=zs(void 0===t?o:t,o);if(js(a)&&(r=a.constructor,(Vs(r)&&(r===$s||js(r.prototype))||Gs(r)&&null===(r=r[Qs]))&&(r=void 0),r===$s||void 0===r))return Ws(a,s,u);for(n=new(void 0===r?$s:r)(Js(u-s,0)),i=0;s<u;s++,i++)s in a&&Ys(n,i,a[s]);return n.length=i,n}});var Zs=En("Array").slice,eu=C,tu=Zs,ru=Array.prototype,nu=E((function(e){var t=e.slice;return e===ru||eu(ru,e)&&t===ru.slice?tu:t})),iu=$,au=Ln,ou=TypeError,su=Object.getOwnPropertyDescriptor,uu=iu&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}(),cu=We,lu=TypeError,fu=function(e,t){if(!delete e[t])throw lu("Cannot delete property "+cu(t)+" of "+cu(e))},hu=Xr,du=mt,pu=nn,vu=Zr,mu=cn,yu=uu?function(e,t){if(au(e)&&!su(e,"length").writable)throw ou("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},gu=bi,_u=li,bu=wi,Su=fu,ku=Di("splice"),Eu=Math.max,wu=Math.min;hu({target:"Array",proto:!0,forced:!ku},{splice:function(e,t){var r,n,i,a,o,s,u=du(this),c=mu(u),l=pu(e,c),f=arguments.length;for(0===f?r=n=0:1===f?(r=0,n=c-l):(r=f-2,n=wu(Eu(vu(t),0),c-l)),gu(c+r-n),i=_u(u,n),a=0;a<n;a++)(o=l+a)in u&&bu(i,a,u[o]);if(i.length=n,r<n){for(a=l;a<c-n;a++)s=a+r,(o=a+n)in u?u[s]=u[o]:Su(u,s);for(a=c;a>c-n+r;a--)Su(u,a-1)}else if(r>n)for(a=c-n;a>l;a--)s=a+r-1,(o=a+n-1)in u?u[s]=u[o]:Su(u,s);for(a=0;a<r;a++)u[a+l]=arguments[a+2];return yu(u,c-n+r),i}});var xu=En("Array").splice,Tu=C,Au=xu,Du=Array.prototype,Ou=E((function(e){var t=e.splice;return e===Du||Tu(Du,e)&&t===Du.splice?Au:t})),Lu={},Cu=Ca,Pu=Pa.concat("length","prototype");Lu.f=Object.getOwnPropertyNames||function(e){return Cu(e,Pu)};var Ru={};Ru.f=Object.getOwnPropertySymbols;var Iu=De,Mu=Lu,Bu=Ru,Uu=Er,Nu=L([].concat),Fu=Iu("Reflect","ownKeys")||function(e){var t=Mu.f(Uu(e)),r=Bu.f;return r?Nu(t,r(e)):t},ju=$i,Vu=Rt("iterator"),Gu=Array.prototype,zu=Fn,Hu=tt,qu=de,Yu=$i,Ku=Rt("iterator"),Wu=function(e){if(!qu(e))return Hu(e,Ku)||Hu(e,"@@iterator")||Yu[zu(e)]},Xu=ee,Qu=Je,$u=Er,Ju=We,Zu=Wu,ec=TypeError,tc=ee,rc=Er,nc=tt,ic=Fn,ac=String,oc=function(e){if("Symbol"===ic(e))throw TypeError("Cannot convert a Symbol value to a string");return ac(e)},sc=gr,uc=TypeError,cc=Rt("iterator"),lc=!1;try{var fc=0,hc={next:function(){return{done:!!fc++}},return:function(){lc=!0}};hc[cc]=function(){return this},Array.from(hc,(function(){throw 2}))}catch(Xb){}var dc=L,pc=Zr,vc=oc,mc=me,yc=dc("".charAt),gc=dc("".charCodeAt),_c=dc("".slice),bc=function(e){return function(t,r){var n,i,a=vc(mc(t)),o=pc(r),s=a.length;return o<0||o>=s?e?"":void 0:(n=gc(a,o))<55296||n>56319||o+1===s||(i=gc(a,o+1))<56320||i>57343?e?yc(a,o):n:e?_c(a,o,o+2):i-56320+(n-55296<<10)+65536}},Sc={codeAt:bc(!1),charAt:bc(!0)}.charAt,kc=oc,Ec=ga,wc=os,xc=ss,Tc="String Iterator",Ac=Ec.set,Dc=Ec.getterFor(Tc);wc(String,"String",(function(e){Ac(this,{type:Tc,string:kc(e),index:0})}),(function(){var e,t=Dc(this),r=t.string,n=t.index;return n>=r.length?xc(void 0,!0):(e=Sc(r,n),t.index+=e.length,xc(e,!1))}));var Oc="\t\n\v\f\r \u2028\u2029\ufeff",Lc=me,Cc=oc,Pc=Oc,Rc=L("".replace),Ic=RegExp("^["+Pc+"]+"),Mc=RegExp("(^|[^"+Pc+"])["+Pc+"]+$"),Bc=function(e){return function(t){var r=Cc(Lc(t));return 1&e&&(r=Rc(r,Ic,"")),2&e&&(r=Rc(r,Mc,"$1")),r}},Uc={start:Bc(1),end:Bc(2),trim:Bc(3)},Nc=R,Fc=w,jc=L,Vc=oc,Gc=Uc.trim,zc=Oc,Hc=Nc.parseInt,qc=Nc.Symbol,Yc=qc&&qc.iterator,Kc=/^[+-]?0x/i,Wc=jc(Kc.exec),Xc=8!==Hc(zc+"08")||22!==Hc(zc+"0x16")||Yc&&!Fc((function(){Hc(Object(Yc))}))?function(e,t){var r=Gc(Vc(e));return Hc(r,t>>>0||(Wc(Kc,r)?16:10))}:Hc;Xr({global:!0,forced:parseInt!=Xc},{parseInt:Xc});var Qc=E(Ee.parseInt),$c=gi.map;Xr({target:"Array",proto:!0,forced:!Di("map")},{map:function(e){return $c(this,e,arguments.length>1?arguments[1]:void 0)}});var Jc=En("Array").map,Zc=C,el=Jc,tl=Array.prototype,rl=E((function(e){var t=e.map;return e===tl||Zc(tl,e)&&t===tl.map?el:t}));Xr({target:"Array",stat:!0},{isArray:Ln});var nl=E(Ee.Array.isArray),il=gi.filter;Xr({target:"Array",proto:!0,forced:!Di("filter")},{filter:function(e){return il(this,e,arguments.length>1?arguments[1]:void 0)}});var al=En("Array").filter,ol=C,sl=al,ul=Array.prototype,cl=E((function(e){var t=e.filter;return e===ul||ol(ul,e)&&t===ul.filter?sl:t})),ll={},fl=nn,hl=cn,dl=wi,pl=Array,vl=Math.max,ml=function(e,t,r){for(var n=hl(e),i=fl(t,n),a=fl(void 0===r?n:r,n),o=pl(vl(a-i,0)),s=0;i<a;i++,s++)dl(o,s,e[i]);return o.length=s,o},yl=G,gl=_e,_l=Lu.f,bl=ml,Sl="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];ll.f=function(e){return Sl&&"Window"==yl(e)?function(e){try{return _l(e)}catch(Xb){return bl(Sl)}}(e):_l(gl(e))};var kl={},El=Rt;kl.f=El;var wl=Ee,xl=_t,Tl=kl,Al=gr.f,Dl=function(e){var t=wl.Symbol||(wl.Symbol={});xl(t,e)||Al(t,e,{value:Tl.f(e)})},Ol=ee,Ll=De,Cl=Rt,Pl=go,Rl=function(){var e=Ll("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=Cl("toPrimitive");t&&!t[n]&&Pl(t,n,(function(e){return Ol(r,this)}),{arity:1})},Il=Xr,Ml=R,Bl=ee,Ul=L,Nl=$,Fl=je,jl=w,Vl=_t,Gl=C,zl=Er,Hl=_e,ql=zt,Yl=oc,Kl=se,Wl=oo,Xl=Ma,Ql=Lu,$l=ll,Jl=Ru,Zl=Q,ef=gr,tf=xa,rf=te,nf=go,af=function(e,t,r){return sc.f(e,t,r)},of=dt,sf=ia,uf=wt,cf=Rt,lf=kl,ff=Dl,hf=Rl,df=Uo,pf=ga,vf=gi.forEach,mf=na("hidden"),yf="Symbol",gf="prototype",_f=pf.set,bf=pf.getterFor(yf),Sf=Object[gf],kf=Ml.Symbol,Ef=kf&&kf[gf],wf=Ml.TypeError,xf=Ml.QObject,Tf=Zl.f,Af=ef.f,Df=$l.f,Of=rf.f,Lf=Ul([].push),Cf=of("symbols"),Pf=of("op-symbols"),Rf=of("wks"),If=!xf||!xf[gf]||!xf[gf].findChild,Mf=Nl&&jl((function(){return 7!=Wl(Af({},"a",{get:function(){return Af(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Tf(Sf,t);n&&delete Sf[t],Af(e,t,r),n&&e!==Sf&&Af(Sf,t,n)}:Af,Bf=function(e,t){var r=Cf[e]=Wl(Ef);return _f(r,{type:yf,tag:e,description:t}),Nl||(r.description=t),r},Uf=function(e,t,r){e===Sf&&Uf(Pf,t,r),zl(e);var n=ql(t);return zl(r),Vl(Cf,n)?(r.enumerable?(Vl(e,mf)&&e[mf][n]&&(e[mf][n]=!1),r=Wl(r,{enumerable:Kl(0,!1)})):(Vl(e,mf)||Af(e,mf,Kl(1,{})),e[mf][n]=!0),Mf(e,n,r)):Af(e,n,r)},Nf=function(e,t){zl(e);var r=Hl(t),n=Xl(r).concat(Gf(r));return vf(n,(function(t){Nl&&!Bl(Ff,r,t)||Uf(e,t,r[t])})),e},Ff=function(e){var t=ql(e),r=Bl(Of,this,t);return!(this===Sf&&Vl(Cf,t)&&!Vl(Pf,t))&&(!(r||!Vl(this,t)||!Vl(Cf,t)||Vl(this,mf)&&this[mf][t])||r)},jf=function(e,t){var r=Hl(e),n=ql(t);if(r!==Sf||!Vl(Cf,n)||Vl(Pf,n)){var i=Tf(r,n);return!i||!Vl(Cf,n)||Vl(r,mf)&&r[mf][n]||(i.enumerable=!0),i}},Vf=function(e){var t=Df(Hl(e)),r=[];return vf(t,(function(e){Vl(Cf,e)||Vl(sf,e)||Lf(r,e)})),r},Gf=function(e){var t=e===Sf,r=Df(t?Pf:Hl(e)),n=[];return vf(r,(function(e){!Vl(Cf,e)||t&&!Vl(Sf,e)||Lf(n,Cf[e])})),n};Fl||(kf=function(){if(Gl(Ef,this))throw wf("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Yl(arguments[0]):void 0,t=uf(e),r=function(e){this===Sf&&Bl(r,Pf,e),Vl(this,mf)&&Vl(this[mf],t)&&(this[mf][t]=!1),Mf(this,t,Kl(1,e))};return Nl&&If&&Mf(Sf,t,{configurable:!0,set:r}),Bf(t,e)},nf(Ef=kf[gf],"toString",(function(){return bf(this).tag})),nf(kf,"withoutSetter",(function(e){return Bf(uf(e),e)})),rf.f=Ff,ef.f=Uf,tf.f=Nf,Zl.f=jf,Ql.f=$l.f=Vf,Jl.f=Gf,lf.f=function(e){return Bf(cf(e),e)},Nl&&af(Ef,"description",{configurable:!0,get:function(){return bf(this).description}})),Il({global:!0,constructor:!0,wrap:!0,forced:!Fl,sham:!Fl},{Symbol:kf}),vf(Xl(Rf),(function(e){ff(e)})),Il({target:yf,stat:!0,forced:!Fl},{useSetter:function(){If=!0},useSimple:function(){If=!1}}),Il({target:"Object",stat:!0,forced:!Fl,sham:!Nl},{create:function(e,t){return void 0===t?Wl(e):Nf(Wl(e),t)},defineProperty:Uf,defineProperties:Nf,getOwnPropertyDescriptor:jf}),Il({target:"Object",stat:!0,forced:!Fl},{getOwnPropertyNames:Vf}),hf(),df(kf,yf),sf[mf]=!0;var zf=je&&!!Symbol.for&&!!Symbol.keyFor,Hf=Xr,qf=De,Yf=_t,Kf=oc,Wf=dt,Xf=zf,Qf=Wf("string-to-symbol-registry"),$f=Wf("symbol-to-string-registry");Hf({target:"Symbol",stat:!0,forced:!Xf},{for:function(e){var t=Kf(e);if(Yf(Qf,t))return Qf[t];var r=qf("Symbol")(t);return Qf[t]=r,$f[r]=t,r}});var Jf=Xr,Zf=_t,eh=Ye,th=We,rh=zf,nh=dt("symbol-to-string-registry");Jf({target:"Symbol",stat:!0,forced:!rh},{keyFor:function(e){if(!eh(e))throw TypeError(th(e)+" is not a symbol");if(Zf(nh,e))return nh[e]}});var ih=Ln,ah=X,oh=G,sh=oc,uh=L([].push),ch=Xr,lh=De,fh=N,hh=ee,dh=L,ph=w,vh=X,mh=Ye,yh=Ns,gh=function(e){if(ah(e))return e;if(ih(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?uh(r,i):"number"!=typeof i&&"Number"!=oh(i)&&"String"!=oh(i)||uh(r,sh(i))}var a=r.length,o=!0;return function(e,t){if(o)return o=!1,t;if(ih(this))return t;for(var n=0;n<a;n++)if(r[n]===e)return t}}},_h=je,bh=String,Sh=lh("JSON","stringify"),kh=dh(/./.exec),Eh=dh("".charAt),wh=dh("".charCodeAt),xh=dh("".replace),Th=dh(1..toString),Ah=/[\uD800-\uDFFF]/g,Dh=/^[\uD800-\uDBFF]$/,Oh=/^[\uDC00-\uDFFF]$/,Lh=!_h||ph((function(){var e=lh("Symbol")();return"[null]"!=Sh([e])||"{}"!=Sh({a:e})||"{}"!=Sh(Object(e))})),Ch=ph((function(){return'"\\udf06\\ud834"'!==Sh("\udf06\ud834")||'"\\udead"'!==Sh("\udead")})),Ph=function(e,t){var r=yh(arguments),n=gh(t);if(vh(n)||void 0!==e&&!mh(e))return r[1]=function(e,t){if(vh(n)&&(t=hh(n,this,bh(e),t)),!mh(t))return t},fh(Sh,null,r)},Rh=function(e,t,r){var n=Eh(r,t-1),i=Eh(r,t+1);return kh(Dh,e)&&!kh(Oh,i)||kh(Oh,e)&&!kh(Dh,n)?"\\u"+Th(wh(e,0),16):e};Sh&&ch({target:"JSON",stat:!0,arity:3,forced:Lh||Ch},{stringify:function(e,t,r){var n=yh(arguments),i=fh(Lh?Ph:Sh,null,n);return Ch&&"string"==typeof i?xh(i,Ah,Rh):i}});var Ih=Ru,Mh=mt;Xr({target:"Object",stat:!0,forced:!je||w((function(){Ih.f(1)}))},{getOwnPropertySymbols:function(e){var t=Ih.f;return t?t(Mh(e)):[]}}),Dl("asyncIterator"),Dl("hasInstance"),Dl("isConcatSpreadable"),Dl("iterator"),Dl("match"),Dl("matchAll"),Dl("replace"),Dl("search"),Dl("species"),Dl("split");var Bh=Rl;Dl("toPrimitive"),Bh();var Uh=De,Nh=Uo;Dl("toStringTag"),Nh(Uh("Symbol"),"Symbol"),Dl("unscopables"),Uo(R.JSON,"JSON",!0);var Fh=Ee.Symbol;Dl("dispose");var jh=Fh;Dl("asyncDispose");var Vh=Xr,Gh=L,zh=De("Symbol"),Hh=zh.keyFor,qh=Gh(zh.prototype.valueOf);Vh({target:"Symbol",stat:!0},{isRegistered:function(e){try{return void 0!==Hh(qh(e))}catch(Xb){return!1}}});for(var Yh=Xr,Kh=dt,Wh=De,Xh=L,Qh=Ye,$h=Rt,Jh=Wh("Symbol"),Zh=Jh.isWellKnown,ed=Wh("Object","getOwnPropertyNames"),td=Xh(Jh.prototype.valueOf),rd=Kh("wks"),nd=0,id=ed(Jh),ad=id.length;nd<ad;nd++)try{var od=id[nd];Qh(Jh[od])&&$h(od)}catch(Xb){}Yh({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(e){if(Zh&&Zh(e))return!0;try{for(var t=td(e),r=0,n=ed(rd),i=n.length;r<i;r++)if(rd[n[r]]==t)return!0}catch(Xb){}return!1}}),Dl("matcher"),Dl("metadataKey"),Dl("observable"),Dl("metadata"),Dl("patternMatch"),Dl("replaceAll");var sd=jh,ud=E(sd),cd=kl.f("iterator"),ld=E(cd);function fd(e){return(fd="function"==typeof ud&&"symbol"==typeof ld?function(e){return typeof e}:function(e){return e&&"function"==typeof ud&&e.constructor===ud&&e!==ud.prototype?"symbol":typeof e})(e)}var hd=E(Ee.Object.getOwnPropertySymbols),dd={exports:{}},pd=Xr,vd=w,md=_e,yd=Q.f,gd=$;pd({target:"Object",stat:!0,forced:!gd||vd((function(){yd(1)})),sham:!gd},{getOwnPropertyDescriptor:function(e,t){return yd(md(e),t)}});var _d=Ee.Object,bd=dd.exports=function(e,t){return _d.getOwnPropertyDescriptor(e,t)};_d.getOwnPropertyDescriptor.sham&&(bd.sham=!0);var Sd=E(dd.exports),kd=Fu,Ed=_e,wd=Q,xd=wi;Xr({target:"Object",stat:!0,sham:!$},{getOwnPropertyDescriptors:function(e){for(var t,r,n=Ed(e),i=wd.f,a=kd(n),o={},s=0;a.length>s;)void 0!==(r=i(n,t=a[s++]))&&xd(o,t,r);return o}});var Td=E(Ee.Object.getOwnPropertyDescriptors),Ad={exports:{}},Dd=Xr,Od=$,Ld=xa.f;Dd({target:"Object",stat:!0,forced:Object.defineProperties!==Ld,sham:!Od},{defineProperties:Ld});var Cd=Ee.Object,Pd=Ad.exports=function(e,t){return Cd.defineProperties(e,t)};Cd.defineProperties.sham&&(Pd.sham=!0);var Rd=E(Ad.exports),Id={exports:{}},Md=Xr,Bd=$,Ud=gr.f;Md({target:"Object",stat:!0,forced:Object.defineProperty!==Ud,sham:!Bd},{defineProperty:Ud});var Nd=Ee.Object,Fd=Id.exports=function(e,t,r){return Nd.defineProperty(e,t,r)};Nd.defineProperty.sham&&(Fd.sham=!0);var jd=E(Id.exports),Vd=E(sd),Gd=E(cd);Xr({target:"Object",stat:!0,sham:!$},{create:oo});var zd=Ee.Object,Hd=E((function(e,t){return zd.create(e,t)})),qd=L,Yd=Je,Kd=ke,Wd=_t,Xd=Ns,Qd=x,$d=Function,Jd=qd([].concat),Zd=qd([].join),ep={},tp=Qd?$d.bind:function(e){var t=Yd(this),r=t.prototype,n=Xd(arguments,1),i=function(){var r=Jd(n,Xd(arguments));return this instanceof i?function(e,t,r){if(!Wd(ep,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";ep[t]=$d("C,a","return new C("+Zd(n,",")+")")}return ep[t](e,r)}(t,r.length,r):t.apply(e,r)};return Kd(r)&&(i.prototype=r),i},rp=tp;Xr({target:"Function",proto:!0,forced:Function.bind!==rp},{bind:rp});var np=En("Function").bind,ip=C,ap=np,op=Function.prototype,sp=E((function(e){var t=e.bind;return e===op||ip(op,e)&&t===op.bind?ap:t})),up=E(Wu),cp=Er,lp=function(e,t,r){var n,i;rc(e);try{if(!(n=nc(e,"return"))){if("throw"===t)throw r;return r}n=tc(n,e)}catch(Xb){i=!0,n=Xb}if("throw"===t)throw r;if(i)throw n;return rc(n),r},fp=yr,hp=ee,dp=mt,pp=function(e,t,r,n){try{return n?t(cp(r)[0],r[1]):t(r)}catch(Xb){lp(e,"throw",Xb)}},vp=function(e){return void 0!==e&&(ju.Array===e||Gu[Vu]===e)},mp=ni,yp=cn,gp=wi,_p=function(e,t){var r=arguments.length<2?Zu(e):t;if(Qu(r))return $u(Xu(r,e));throw ec(Ju(e)+" is not iterable")},bp=Wu,Sp=Array,kp=function(e){var t=dp(e),r=mp(this),n=arguments.length,i=n>1?arguments[1]:void 0,a=void 0!==i;a&&(i=fp(i,n>2?arguments[2]:void 0));var o,s,u,c,l,f,h=bp(t),d=0;if(!h||this===Sp&&vp(h))for(o=yp(t),s=r?new this(o):Sp(o);o>d;d++)f=a?i(t[d],d):t[d],gp(s,d,f);else for(l=(c=_p(t,h)).next,s=r?new this:[];!(u=hp(l,c)).done;d++)f=a?pp(c,i,[u.value,d],!0):u.value,gp(s,d,f);return s.length=d,s};Xr({target:"Array",stat:!0,forced:!function(e,t){if(!t&&!lc)return!1;var r=!1;try{var n={};n[cc]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(Xb){}return r}((function(e){Array.from(e)}))},{from:kp});var Ep=E(Ee.Array.from),wp=E(kl.f("toPrimitive"));function xp(e,t){var r=Us(e);if(hd){var n=hd(e);t&&(n=cl(n).call(n,(function(t){return Sd(e,t).enumerable}))),r.push.apply(r,n)}return r}function Tp(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?Is(r=xp(Object(i),!0)).call(r,(function(t){Cp(e,t,i[t])})):Td?Rd(e,Td(i)):Is(n=xp(Object(i))).call(n,(function(t){jd(e,t,Sd(i,t))}))}return e}function Ap(e){return(Ap="function"==typeof Vd&&"symbol"==typeof Gd?function(e){return typeof e}:function(e){return e&&"function"==typeof Vd&&e.constructor===Vd&&e!==Vd.prototype?"symbol":typeof e})(e)}function Dp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Op(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),jd(e,Ip(n.key),n)}}function Lp(e,t,r){return t&&Op(e.prototype,t),r&&Op(e,r),jd(e,"prototype",{writable:!1}),e}function Cp(e,t,r){return(t=Ip(t))in e?jd(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pp(e){return function(e){if(nl(e))return Rp(e)}(e)||function(e){if(void 0!==Vd&&null!=up(e)||null!=e["@@iterator"])return Ep(e)}(e)||function(e,t){var r;if(!e)return;if("string"==typeof e)return Rp(e,t);var n=nu(r=Object.prototype.toString.call(e)).call(r,8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Ep(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rp(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ip(e){var t=function(e,t){if("object"!==fd(e)||null===e)return e;var r=e[wp];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==fd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===fd(t)?t:String(t)}var Mp={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,n,a,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,a||e,o),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Hd&&(n.prototype=Hd(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?nu(n).call(n,1):n);return hd?Qi(i).call(i,hd(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=new Array(a);i<a;i++)o[i]=n[i].fn;return o},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],f=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,i),!0;case 5:return l.fn.call(l.context,t,n,i,a),!0;case 6:return l.fn.call(l.context,t,n,i,a,o),!0}for(c=1,u=new Array(f-1);c<f;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var h,d=l.length;for(c=0;c<d;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),f){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,i);break;default:if(!u)for(h=1,u=new Array(f-1);h<f;h++)u[h-1]=arguments[h];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||o(this,a);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==t||i&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[a]=1===c.length?c[0]:c:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&o(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(Mp);var Bp=E(Mp.exports),Up=gi.some;Xr({target:"Array",proto:!0,forced:!mn("some")},{some:function(e){return Up(this,e,arguments.length>1?arguments[1]:void 0)}});var Np=En("Array").some,Fp=C,jp=Np,Vp=Array.prototype,Gp=E((function(e){var t=e.some;return e===Vp||Fp(Vp,e)&&t===Vp.some?jp:t})),zp=Zr,Hp=oc,qp=me,Yp=RangeError,Kp=L,Wp=sn,Xp=oc,Qp=me,$p=Kp((function(e){var t=Hp(qp(this)),r="",n=zp(e);if(n<0||n==1/0)throw Yp("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r})),Jp=Kp("".slice),Zp=Math.ceil,ev=function(e){return function(t,r,n){var i,a,o=Xp(Qp(t)),s=Wp(r),u=o.length,c=void 0===n?" ":Xp(n);return s<=u||""==c?o:((a=$p(c,Zp((i=s-u)/c.length))).length>i&&(a=Jp(a,0,i)),e?o+a:a+o)}},tv={start:ev(!1),end:ev(!0)},rv=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Oe),nv=tv.start;Xr({target:"String",proto:!0,forced:rv},{padStart:function(e){return nv(this,e,arguments.length>1?arguments[1]:void 0)}});var iv,av=En("String").padStart,ov=C,sv=av,uv=String.prototype,cv=E((function(e){var t=e.padStart;return"string"==typeof e||e===uv||ov(uv,e)&&t===uv.padStart?sv:t})),lv="function"==typeof Bun&&Bun&&"string"==typeof Bun.version,fv=R,hv=N,dv=X,pv=lv,vv=Oe,mv=Ns,yv=function(e,t){if(e<t)throw uc("Not enough arguments");return e},gv=fv.Function,_v=/MSIE .\./.test(vv)||pv&&((iv=fv.Bun.version.split(".")).length<3||0==iv[0]&&(iv[1]<3||3==iv[1]&&0==iv[2])),bv=function(e,t){var r=t?2:1;return _v?function(n,i){var a=yv(arguments.length,1)>r,o=dv(n)?n:gv(n),s=a?mv(arguments,r):[],u=a?function(){hv(o,this,s)}:o;return t?e(u,i):e(u)}:e},Sv=Xr,kv=R,Ev=bv(kv.setInterval,!0);Sv({global:!0,bind:!0,forced:kv.setInterval!==Ev},{setInterval:Ev});var wv=Xr,xv=R,Tv=bv(xv.setTimeout,!0);wv({global:!0,bind:!0,forced:xv.setTimeout!==Tv},{setTimeout:Tv});var Av=E(Ee.setInterval),Dv=E(Ee.setTimeout),Ov=gi.every;Xr({target:"Array",proto:!0,forced:!mn("every")},{every:function(e){return Ov(this,e,arguments.length>1?arguments[1]:void 0)}});var Lv=En("Array").every,Cv=C,Pv=Lv,Rv=Array.prototype,Iv=E((function(e){var t=e.every;return e===Rv||Cv(Rv,e)&&t===Rv.every?Pv:t})),Mv=R,Bv=w,Uv=oc,Nv=Uc.trim,Fv=Oc,jv=L("".charAt),Vv=Mv.parseFloat,Gv=Mv.Symbol,zv=Gv&&Gv.iterator,Hv=1/Vv(Fv+"-0")!=-1/0||zv&&!Bv((function(){Vv(Object(zv))}))?function(e){var t=Nv(Uv(e)),r=Vv(t);return 0===r&&"-"==jv(t,0)?-0:r}:Vv;Xr({global:!0,forced:parseFloat!=Hv},{parseFloat:Hv});var qv=E(Ee.parseFloat),Yv=wa.PROPER,Kv=w,Wv=Oc,Xv=Uc.trim;Xr({target:"String",proto:!0,forced:function(e){return Kv((function(){return!!Wv[e]()||"
"!=="
"[e]()||Yv&&Wv[e].name!==e}))}("trim")},{trim:function(){return Xv(this)}});var Qv=En("String").trim,$v=C,Jv=Qv,Zv=String.prototype,em=E((function(e){var t=e.trim;return"string"==typeof e||e===Zv||$v(Zv,e)&&t===Zv.trim?Jv:t})),tm=ml,rm=Math.floor,nm=function(e,t){var r=e.length,n=rm(r/2);return r<8?im(e,t):am(e,nm(tm(e,0,n),t),nm(tm(e,n),t),t)},im=function(e,t){for(var r,n,i=e.length,a=1;a<i;){for(n=a,r=e[a];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==a++&&(e[n]=r)}return e},am=function(e,t,r,n){for(var i=t.length,a=r.length,o=0,s=0;o<i||s<a;)e[o+s]=o<i&&s<a?n(t[o],r[s])<=0?t[o++]:r[s++]:o<i?t[o++]:r[s++];return e},om=nm,sm=Oe.match(/firefox\/(\d+)/i),um=!!sm&&+sm[1],cm=/MSIE|Trident/.test(Oe),lm=Oe.match(/AppleWebKit\/(\d+)\./),fm=!!lm&&+lm[1],hm=Xr,dm=L,pm=Je,vm=mt,mm=cn,ym=fu,gm=oc,_m=w,bm=om,Sm=mn,km=um,Em=cm,wm=Be,xm=fm,Tm=[],Am=dm(Tm.sort),Dm=dm(Tm.push),Om=_m((function(){Tm.sort(void 0)})),Lm=_m((function(){Tm.sort(null)})),Cm=Sm("sort"),Pm=!_m((function(){if(wm)return wm<70;if(!(km&&km>3)){if(Em)return!0;if(xm)return xm<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)Tm.push({k:t+n,v:r})}for(Tm.sort((function(e,t){return t.v-e.v})),n=0;n<Tm.length;n++)t=Tm[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));hm({target:"Array",proto:!0,forced:Om||!Lm||!Cm||!Pm},{sort:function(e){void 0!==e&&pm(e);var t=vm(this);if(Pm)return void 0===e?Am(t):Am(t,e);var r,n,i=[],a=mm(t);for(n=0;n<a;n++)n in t&&Dm(i,t[n]);for(bm(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:gm(t)>gm(r)?1:-1}}(e)),r=mm(i),n=0;n<r;)t[n]=i[n++];for(;n<a;)ym(t,n++);return t}});var Rm,Im=En("Array").sort,Mm=C,Bm=Im,Um=Array.prototype,Nm=E((function(e){var t=e.sort;return e===Um||Mm(Um,e)&&t===Um.sort?Bm:t})),Fm="undefined"!=typeof window&&window.location&&Dn(Rm=window.location.href).call(Rm,"xgplayerdebugger=1")>-1,jm="color: #525252; background-color: #90ee90;",Vm="color: #525252; background-color: red;",Gm="color: #525252; background-color: yellow; ",zm="%c[xgplayer]",Hm={config:{debug:Fm?3:0},logInfo:function(e){for(var t,r,n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];this.config.debug>=3&&(r=console).log.apply(r,Qi(t=[zm,jm,e]).call(t,i))},logWarn:function(e){for(var t,r,n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];this.config.debug>=1&&(r=console).warn.apply(r,Qi(t=[zm,Gm,e]).call(t,i))},logError:function(e){var t,r;if(!(this.config.debug<1)){for(var n=this.config.debug>=2?"trace":"error",i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];(r=console)[n].apply(r,Qi(t=[zm,Vm,e]).call(t,a))}}},qm=function(){function e(t){Dp(this,e),this.bufferedList=t}return Lp(e,[{key:"start",value:function(e){return this.bufferedList[e].start}},{key:"end",value:function(e){return this.bufferedList[e].end}},{key:"length",get:function(){return this.bufferedList.length}}]),e}(),Ym={};Ym.createDom=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=document.createElement(t);return a.className=i,a.innerHTML=r,Is(e=Us(n)).call(e,(function(e){var r=e,i=n[e];"video"===t||"audio"===t||"live-video"===t?i&&a.setAttribute(r,i):a.setAttribute(r,i)})),a},Ym.createDomFromHtml=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var n=document.createElement("div");n.innerHTML=e;var i=n.children;if(n=null,i.length>0){var a;if(i=i[0],r&&Ym.addClass(i,r),t)Is(a=Us(t)).call(a,(function(e){i.setAttribute(e,t[e])}));return i}return null}catch(o){return Hm.logError("util.createDomFromHtml",o),null}},Ym.hasClass=function(e,t){if(!e||!t)return!1;try{return Gp(Array.prototype).call(e.classList,(function(e){return e===t}))}catch(n){var r=e.className&&"object"===Ap(e.className)?e.getAttribute("class"):e.className;return r&&!!r.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},Ym.addClass=function(e,t){if(e&&t)try{var r;Is(r=t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g)).call(r,(function(t){t&&e.classList.add(t)}))}catch(n){Ym.hasClass(e,t)||(e.className&&"object"===Ap(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},Ym.removeClass=function(e,t){if(e&&t)try{var r;Is(r=t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g)).call(r,(function(t){t&&e.classList.remove(t)}))}catch(i){var n;if(Ym.hasClass(e,t))Is(n=t.split(/\s+/g)).call(n,(function(t){var r=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===Ap(e.className)?e.setAttribute("class",e.getAttribute("class").replace(r," ")):e.className=e.className.replace(r," ")}))}},Ym.toggleClass=function(e,t){var r;e&&Is(r=t.split(/\s+/g)).call(r,(function(t){Ym.hasClass(e,t)?Ym.removeClass(e,t):Ym.addClass(e,t)}))},Ym.classNames=function(){for(var e=arguments,t=[],r=function(r){if("String"===Ym.typeOf(e[r]))t.push(e[r]);else if("Object"===Ym.typeOf(e[r])){var n;rl(n=Us(e[r])).call(n,(function(n){e[r][n]&&t.push(n)}))}},n=0;n<arguments.length;n++)r(n);return t.join(" ")},Ym.findDom=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,r=arguments.length>1?arguments[1]:void 0;try{e=t.querySelector(r)}catch(n){Hm.logError("util.findDom",n),0===Dn(r).call(r,"#")&&(e=t.getElementById(nu(r).call(r,1)))}return e},Ym.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},Ym.padStart=function(e,t,r){for(var n=String(r),i=t>>0,a=Math.ceil(i/n.length),o=[],s=String(e);a--;)o.push(n);return o.join("").substring(0,i-s.length)+s},Ym.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=cv(Ym).call(Ym,Math.floor(e/3600),2,0),r=cv(Ym).call(Ym,Math.floor((e-3600*t)/60),2,0),n=cv(Ym).call(Ym,Math.floor(e-3600*t-60*r),2,0);return("00"===t?[r,n]:[t,r,n]).join(":")},Ym.event=function(e){if(e.touches){var t=e.touches[0]||e.changedTouches[0];e.clientX=t.clientX||0,e.clientY=t.clientY||0,e.offsetX=t.pageX-t.target.offsetLeft,e.offsetY=t.pageY-t.target.offsetTop}e._target=e.target||e.srcElement},Ym.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},Ym.deepCopy=function(e,t){var r;if("Object"===Ym.typeOf(t)&&"Object"===Ym.typeOf(e))return Is(r=Us(t)).call(r,(function(r){if("Object"!==Ym.typeOf(t[r])||t[r]instanceof Node)if("Array"===Ym.typeOf(t[r])){var n;e[r]="Array"===Ym.typeOf(e[r])?Qi(n=e[r]).call(n,t[r]):t[r]}else e[r]=t[r];else void 0===e[r]||void 0===e[r]?e[r]=t[r]:Ym.deepCopy(e[r],t[r])})),e},Ym.deepMerge=function(e,t){var r;return rl(r=Us(t)).call(r,(function(r){var n;"Array"===Ym.typeOf(t[r])&&"Array"===Ym.typeOf(e[r])?"Array"===Ym.typeOf(e[r])&&(n=e[r]).push.apply(n,Pp(t[r])):Ym.typeOf(e[r])!==Ym.typeOf(t[r])||null===e[r]||"Object"!==Ym.typeOf(e[r])||t[r]instanceof window.Node?null!==t[r]&&(e[r]=t[r]):Ym.deepMerge(e[r],t[r])})),e},Ym.getBgImage=function(e){var t=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;if(!t||"none"===t)return"";var r=document.createElement("a");return r.href=t.replace(/url\("|"\)/g,""),r.href},Ym.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Is(Array.prototype).call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},Ym.setInterval=function(e,t,r,n){e._interval[t]||(e._interval[t]=Av(sp(r).call(r,e),n))},Ym.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},Ym.setTimeout=function(e,t,r){e._timers||(e._timers=[]);var n=Dv((function(){t(),Ym.clearTimeout(e,n)}),r);return e._timers.push(n),n},Ym.clearTimeout=function(e,t){var r=e._timers;if("Array"===Ym.typeOf(r)){for(var n=0;n<r.length;n++)if(r[n]===t){Ou(r).call(r,n,1),clearTimeout(t);break}}else clearTimeout(t)},Ym.clearAllTimers=function(e){var t=e._timers;"Array"===Ym.typeOf(t)&&(rl(t).call(t,(function(e){clearTimeout(e)})),e._timerIds=[])},Ym.createImgBtn=function(e,t,r,n){var i,a,o,s,u,c,l,f,h,d,p,v,m=Ym.createDom("xg-".concat(e),"",{},"xgplayer-".concat(e,"-img"));(m.style.backgroundImage='url("'.concat(t,'")'),r&&n)&&(Iv(i=["px","rem","em","pt","dp","vw","vh","vm","%"]).call(i,(function(e){var t,i;return!(Dn(r).call(r,e)>-1&&Dn(n).call(n,e)>-1)||(l=qv(em(t=nu(r).call(r,0,Dn(r).call(r,e))).call(t)),f=qv(em(i=nu(n).call(n,0,Dn(n).call(n,e))).call(i)),h=e,!1)})),m.style.width=Qi(a="".concat(l)).call(a,h),m.style.height=Qi(o="".concat(f)).call(o,h),m.style.backgroundSize=Qi(s=Qi(u=Qi(c="".concat(l)).call(c,h," ")).call(u,f)).call(s,h),m.style.margin="start"===e?Qi(d=Qi(p=Qi(v="-".concat(f/2)).call(v,h," auto auto -")).call(p,l/2)).call(d,h):"auto 5px auto 5px");return m},Ym.Hex2RGBA=function(e,t){var r,n=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var i="#";e.replace(/[0-9A-F]/gi,(function(e){i+=e+e})),e=i}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){n.push(Qc(e,16))})),Qi(r="rgba(".concat(n.join(","),", ")).call(r,t,")")):"rgba(255, 255, 255, 0.1)"},Ym.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},Ym.checkIsFunction=function(e){return e&&"function"==typeof e},Ym.checkIsObject=function(e){return null!==e&&"object"===Ap(e)},Ym.hide=function(e){e.style.display="none"},Ym.show=function(e,t){e.style.display=t||"block"},Ym.isUndefined=function(e){if(null==e)return!0},Ym.isNotNull=function(e){return!(null==e)},Ym.setStyleFromCsstext=function(e,t){if(t)if("String"===Ym.typeOf(t)){var r=t.replace(/\s+/g,"").split(";");rl(r).call(r,(function(t){if(t){var r=t.split(":");r.length>1&&(e.style[r[0]]=r[1])}}))}else{var n;rl(n=Us(t)).call(n,(function(r){e.style[r]=t[r]}))}},Ym.filterStyleFromText=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],n=e.style.cssText;if(!n)return{};var i=n.replace(/\s+/g,"").split(";"),a={},o={};return rl(i).call(i,(function(e){if(e){var t=e.split(":");t.length>1&&(!function(e,t){for(var r=0,n=t.length;r<n;r++)if(Dn(e).call(e,t[r])>-1)return!0;return!1}(t[0],r)?o[t[0]]=t[1]:a[t[0]]=t[1])}})),e.setAttribute("style",""),rl(t=Us(o)).call(t,(function(t){e.style[t]=o[t]})),a},Ym.getStyleFromCsstext=function(e){var t=e.style.cssText;if(!t)return{};var r=t.replace(/\s+/g,"").split(";"),n={};return rl(r).call(r,(function(e){if(e){var t=e.split(":");t.length>1&&(n[t[0]]=t[1])}})),n},Ym.preloadImg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){var n=new window.Image;n.onload=function(e){n=null,t&&t(e)},n.onerror=function(e){n=null,r&&r(e)},n.src=e}},Ym.stopPropagation=function(e){e&&e.stopPropagation()},Ym.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},Ym.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},Ym.checkTouchSupport=function(){return"ontouchstart"in window},Ym.getBuffered2=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,r=[],n=0;n<e.length;n++)r.push({start:e.start(n)<.5?0:e.start(n),end:e.end(n)});Nm(r).call(r,(function(e,t){var r=e.start-t.start;return r||t.end-e.end}));var i=[];if(t)for(var a=0;a<r.length;a++){var o=i.length;if(o){var s=i[o-1].end;r[a].start-s<t?r[a].end>s&&(i[o-1].end=r[a].end):i.push(r[a])}else i.push(r[a])}else i=r;return new qm(i)},Ym.getEventPos=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.touches&&e.touches.length>0&&(e=e.touches[0]),{x:e.x/t,y:e.y/t,clientX:e.clientX/t,clientY:e.clientY/t,offsetX:e.offsetX/t,offsetY:e.offsetY/t,pageX:e.pageX/t,pageY:e.pageY/t}},Ym.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},Ym.getHostFromUrl=function(e){if("String"!==Ym.typeOf(e))return"";var t=e.split("/"),r="";return t.length>3&&t[2]&&(r=t[2]),r},Ym.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},Ym.isMSE=function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},Ym.isBlob=function(e){return"string"==typeof e&&/^blob/.test(e)},Ym.generateSessionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=Qc(e)}catch(r){e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=Qc(window.performance.now())),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))},Ym.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},Ym.adjustTimeByDuration=function(e,t,r){return t&&e&&(e>t||r&&e<t)?t:e},Ym.createPositionBar=function(e,t){var r=Ym.createDom("xg-bar","",{"data-index":-1},e);return t.appendChild(r),r},Ym.getTransformStyle=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n={scale:"".concat(t.scale||1),translate:Qi(e="".concat(t.x||0,"%, ")).call(e,t.y||0,"%"),rotate:"".concat(t.rotate||0,"deg")},i=Us(n);return Is(i).call(i,(function(e){var t,i=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),a=Qi(t="".concat(e,"(")).call(t,n[e],")");i.test(r)?(i.lastIndex=-1,r=r.replace(i,a)):r+="".concat(a," ")})),r},Ym.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360},Ym.getIndexByTime=function(e,t){var r=t.length,n=-1;if(r<1)return n;if(e<=t[0].end||r<2)n=0;else if(e>t[r-1].end)n=r-1;else for(var i=1;i<r;i++)if(e>t[i-1].end&&e<=t[i].end){n=i;break}return n},Ym.getOffsetCurrentTime=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n=-1;if((n=r>=0&&r<t.length?r:Ym.getIndexByTime(e,t))<0)return-1;var i=t.length,a=t[n],o=a.start,s=a.end,u=a.cTime,c=a.offset;return e<o?u:e>=o&&e<=s?e-c:e>s&&n>=i-1?s:-1},Ym.getCurrentTimeByOffset=function(e,t){var r=-1;if(!t||t.length<0)return e;for(var n=0;n<t.length;n++)if(e<=t[n].duration){r=n;break}if(-1!==r){var i=t[r].start;return r-1<0?i+e:i+(e-t[r-1].duration)}return e};var Km="3.0.21-rc.2",Wm={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},Xm=Lp((function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};Dp(this,e);var n=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var i,a=r.mediaError?r.mediaError:t.media.error||{},o=t.duration,s=t.currentTime,u=t.ended,c=t.src,l=t.currentSrc,f=t.media,h=f.readyState,d=f.networkState,p=r.errorCode||a.code;Wm[p]&&(p=Wm[p]);var v={playerVersion:Km,currentTime:s,duration:o,ended:u,readyState:h,networkState:d,src:c||l,errorType:r.errorType,errorCode:p,message:r.errorMessage||a.message,mediaError:a,originError:r.originError?r.originError.stack:"",host:Ym.getHostFromUrl(c||l)};return r.ext&&rl(i=Us(r.ext)).call(i,(function(e){v[e]=r.ext[e]})),v}if(arguments.length>1){for(var m={playerVersion:Km,domain:document.domain},y=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],g=0;g<arguments.length;g++)m[y[g]]=arguments[g];return m.ex=n?(n[arguments[0]]||{}).msg:"",m}}));function Qm(e,t,r){for(var n,i=arguments.length,a=new Array(i>3?i-3:0),o=3;o<i;o++)a[o-3]=arguments[o];var s,u=t.call.apply(t,Qi(n=[e]).call(n,a));r&&"function"==typeof r&&(u&&u.then?u.then((function(){for(var t,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];r.call.apply(r,Qi(t=[e]).call(t,i))})):r.call.apply(r,Qi(s=[e]).call(s,a)))}function $m(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[e]&&(this.__hooks[e]=null),sp(r=function(){var r,i=arguments,a=this;if(n.pre)try{var o,s;(s=n.pre).call.apply(s,Qi(o=[this]).call(o,nu(Array.prototype).call(arguments)))}catch(v){var u,c;throw v.message=Qi(u=Qi(c="[pluginName: ".concat(this.pluginName,":")).call(c,e,":pre error] >> ")).call(u,v.message),v}if(this.__hooks&&this.__hooks[e])try{var l,f=function(e,t,r){for(var n=arguments.length,i=new Array(n>3?n-3:0),a=3;a<n;a++)i[a-3]=arguments[a];if(e.__hooks&&nl(e.__hooks[t])){var o,s=e.__hooks[t],u=-1,c=function e(t,r,n){for(var i,a,o=arguments.length,c=new Array(o>3?o-3:0),l=3;l<o;l++)c[l-3]=arguments[l];if(u++,0===s.length||u===s.length)return n.call.apply(n,Qi(a=[t,t]).call(a,c));var f,h=s[u],d=h.call.apply(h,Qi(i=[t,t]).call(i,c));return d&&d.then?d.then((function(i){var a;return!1===i?null:e.apply(void 0,Qi(a=[t,r,n]).call(a,c))})).catch((function(e){console.warn("[runHooks]".concat(r," reject"),e.message)})):!1!==d?e.apply(void 0,Qi(f=[t,r,n]).call(f,c)):void 0};return c.apply(void 0,Qi(o=[e,t,r]).call(o,i))}var l;return r.call.apply(r,Qi(l=[e,e]).call(l,i))}(this,e,t);if(f)if(f.then)f.then((function(e){var r;!1!==e&&Qm.apply(void 0,Qi(r=[a,t,n.next]).call(r,Pp(i)))})).catch((function(e){throw e}));else Qm.apply(void 0,Qi(l=[this,t,n.next]).call(l,nu(Array.prototype).call(arguments)));else if(void 0===f){var h;Qm.apply(void 0,Qi(h=[this,t,n.next]).call(h,nu(Array.prototype).call(arguments)))}}catch(v){var d,p;throw v.message=Qi(d=Qi(p="[pluginName: ".concat(this.pluginName,":")).call(p,e,"] >> ")).call(d,v.message),v}else Qm.apply(void 0,Qi(r=[this,t,n.next]).call(r,nu(Array.prototype).call(arguments)))}).call(r,this)}function Jm(e,t){var r=this.__hooks;if(!r||!nl(r[e]))return-1;for(var n=r[e],i=0;i<n.length;i++)if(n[i]===t)return i;return-1}function Zm(e,t){var r=this.__hooks;if(r)return r.hasOwnProperty(e)?(nl(r[e])||(r[e]=[]),-1===Jm.call(this,e,t)&&r[e].push(t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function ey(e,t){var r=this.__hooks;if(r){if(nl(r[e])){var n=r[e],i=Jm.call(this,e,t);-1!==i&&Ou(n).call(n,i,1)}delete r[e]}}function ty(e,t){var r;Hm.logError(Qi(r="[".concat(e,"] event or callback cant be undefined or null when call ")).call(r,t))}var ry=function(){function e(t){Dp(this,e),Ym.checkIsFunction(this.beforeCreate)&&this.beforeCreate(t),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.__hooks={},t&&rl(t).call(t,(function(t){e.__hooks[t]=null})),jd(e,"hooks",{get:function(){var t;return e.__hooks&&rl(t=Us(e.__hooks)).call(t,(function(t){if(e.__hooks[t])return t}))}})}(this),this.__args=t,this.__events={},this.__onceEvents={},this.config=t.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(t)}return Lp(e,[{key:"beforeCreate",value:function(e){}},{key:"afterCreate",value:function(){}},{key:"beforePlayerInit",value:function(){}},{key:"onPluginsReady",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"destroy",value:function(){}},{key:"__init",value:function(e){this.player=e.player,this.playerConfig=e.player&&e.player.config,this.pluginName=e.pluginName?e.pluginName.toLowerCase():this.constructor.pluginName.toLowerCase(),this.logger=e.player&&e.player.logger}},{key:"updateLang",value:function(e){e||(e=this.lang)}},{key:"lang",get:function(){return this.player.lang}},{key:"i18n",get:function(){return this.player.i18n}},{key:"i18nKeys",get:function(){return this.player.i18nKeys}},{key:"domEventType",get:function(){var e=Ym.checkTouchSupport()?"touch":"mouse";return!this.playerConfig||"touch"!==this.playerConfig.domEventType&&"mouse"!==this.playerConfig.domEventType||(e=this.playerConfig.domEventType),e}},{key:"on",value:function(e,t){var r=this;e&&t&&this.player?"string"==typeof e?(this.__events[e]=t,this.player.on(e,t)):nl(e)&&Is(e).call(e,(function(e){r.__events[e]=t,r.player.on(e,t)})):ty(this.pluginName,"plugin.on(event, callback)")}},{key:"once",value:function(e,t){var r=this;e&&t&&this.player?"string"==typeof e?(this.__onceEvents[e]=t,this.player.once(e,t)):nl(e)&&Is(e).call(e,(function(n){r.__onceEvents[n]=t,r.player.once(e,t)})):ty(this.pluginName,"plugin.once(event, callback)")}},{key:"off",value:function(e,t){var r=this;e&&t&&this.player?"string"==typeof e?(delete this.__events[e],this.player.off(e,t)):nl(e)&&Is(e).call(e,(function(n){delete r.__events[e],r.player.off(n,t)})):ty(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var e,t=this;Is(e=["__events","__onceEvents"]).call(e,(function(e){var r;Is(r=Us(t[e])).call(r,(function(r){t[e][r]&&t.off(r,t[e][r]),r&&delete t[e][r]}))})),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(e){var t,r;if(this.player){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];(r=this.player).emit.apply(r,Qi(t=[e]).call(t,i))}}},{key:"emitUserAction",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var n=Tp(Tp({},r),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,n)}}},{key:"hook",value:function(e,t){var r;return $m.call.apply($m,Qi(r=[this]).call(r,nu(Array.prototype).call(arguments)))}},{key:"useHooks",value:function(e,t){for(var r,n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];return Zm.call.apply(Zm,Qi(r=[this]).call(r,nu(Array.prototype).call(arguments)))}},{key:"removeHooks",value:function(e,t){for(var r,n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];return ey.call.apply(ey,Qi(r=[this]).call(r,nu(Array.prototype).call(arguments)))}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.player)return r&&(t.pluginName=r),this.player.registerPlugin({plugin:e,options:t})}},{key:"getPlugin",value:function(e){return this.player?this.player.getPlugin(e):null}},{key:"__destroy",value:function(){var e,t=this,r=this.player,n=this.pluginName;this.offAll(),Ym.clearAllTimers(this),Ym.checkIsFunction(this.destroy)&&this.destroy(),rl(e=["player","playerConfig","pluginName","logger","__args","__hooks"]).call(e,(function(e){t[e]=null})),r.unRegisterPlugin(n),this.__hooks=null}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&jd(e,r,t[r])}},{key:"defineMethod",value:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&"function"==typeof t[r]&&jd(e,r,{configurable:!0,value:t[r]})}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),e}();function ny(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function iy(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ny(Object(r),!0).forEach((function(t){hy(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ny(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ay(){ay=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(D){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new x(i||[]);return n(o,"_invoke",{value:S(e,r,s)}),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(D){return{type:"throw",arg:D}}}e.wrap=c;var f={};function h(){}function d(){}function p(){}var v={};u(v,a,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(T([])));y&&y!==t&&r.call(y,a)&&(v=y);var g=p.prototype=h.prototype=Object.create(v);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function i(n,a,o,s){var u=l(e[n],e,a);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(f).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function S(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=k(o,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function k(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function T(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return d.prototype=p,n(g,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:d,configurable:!0}),d.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},_(b.prototype),u(b.prototype,o,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new b(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},_(g),u(g,s,"Generator"),u(g,a,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=T,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;w(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function oy(e){return(oy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function sy(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(Xb){return void r(Xb)}s.done?t(u):Promise.resolve(u).then(n,i)}function uy(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){sy(a,n,i,o,s,"next",e)}function s(e){sy(a,n,i,o,s,"throw",e)}o(void 0)}))}}function cy(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ly(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,xy(n.key),n)}}function fy(e,t,r){return t&&ly(e.prototype,t),r&&ly(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function hy(e,t,r){return(t=xy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dy(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&vy(e,t)}function py(e){return(py=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function vy(e,t){return(vy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function my(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function yy(e,t,r){return(yy=my()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&vy(i,r.prototype),i}).apply(null,arguments)}function gy(e){var t="function"==typeof Map?new Map:void 0;return gy=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return yy(e,arguments,py(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),vy(n,e)},gy(e)}function _y(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function by(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Sy(e){var t=my();return function(){var r,n=py(e);if(t){var i=py(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return by(e)}(this,r)}}function ky(){return ky="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=py(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},ky.apply(this,arguments)}function Ey(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function wy(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Ey(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ey(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function xy(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var Ty,Ay=function(){function e(){cy(this,e)}return fy(e,null,[{key:"start",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0):0}},{key:"end",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(Xb){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var r=[],n=0,i=e.length;n<i;n++){var a=r.length;if(a&&t){var o=r[a-1],s=o[1];if(e.start(n)-s<=t){var u=e.end(n);u>s&&(o[1]=u)}else r.push([e.start(n),e.end(n)])}else r.push([e.start(n),e.end(n)])}return r}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce((function(e,t){return e+(t[1]-t[0])}),0):0}},{key:"info",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var i=0,a=0,o=0,s=0,u=0,c=0,l=0,f=e.buffers(t,n),h=0,d=f.length;h<d;h++){var p=f[h];if(r+n>=p[0]&&r<=p[1])i=p[0],a=p[1],o=h;else{if(r+n<p[0]){s=p[0],u=p[1];break}r+n>p[1]&&(c=p[0],l=p[1])}}return{start:i,end:a,index:o,buffers:f,nextStart:s,nextEnd:u,prevStart:c,prevEnd:l,currentTime:r,behind:r-i,remaining:a?a-r:0,length:e.totalLength&&e.totalLength(f)}}},{key:"isBuffered",value:function(t,r){if(t){var n=e.get(t);if(null!=n&&n.length)for(var i=0;i<n.length;i++)if(r>=n.start(i)&&r<=n.end(i))return!0}return!1}}]),e}(),Dy="undefined"!=typeof window,Oy="manifest",Ly="network",Cy="network_timeout",Py="network_forbidden",Ry="network_notfound",Iy="network_range_not_satisfiable",My="demux",By="remux",Uy="media",Ny="drm",Fy="other",jy="runtime",Vy={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"},Gy=(hy(Ty={},Oy,{HLS:1100,DASH:1200}),hy(Ty,Ly,2100),hy(Ty,Cy,2101),hy(Ty,Py,2103),hy(Ty,Ry,2104),hy(Ty,Iy,2116),hy(Ty,My,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),hy(Ty,By,{FMP4:4100,MP4:4200}),hy(Ty,Uy,{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}),hy(Ty,Ny,{LICENSE:7100,CUSTOM_LICENSE:7200}),hy(Ty,Fy,8e3),hy(Ty,jy,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003}),Ty),zy=function(e){dy(r,e);var t=Sy(r);function r(e,n,i,a,o){var s;return cy(this,r),(s=t.call(this,o||(null==i?void 0:i.message))).errorType=e===Cy?Ly:e,s.originError=i,s.ext=a,s.errorCode=Gy[e][n]||Gy[e],s.errorMessage=s.message,s.errorCode||(s.errorType=Fy,s.errorCode=Gy[s.errorType]),s}return fy(r,null,[{key:"create",value:function(e,t,n,i,a){return e instanceof r?e:(e instanceof Error&&(n=e,e=""),e||(e=Fy),new r(e,t,n,i,a))}},{key:"network",value:function(e){var t;return new r(null!=e&&e.isTimeout?Cy:Ly,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}]),r}(gy(Error)),Hy={DEBUG:1,LOG:2,WARN:3,ERROR:4},qy=["Boolean","Number","String","Undefined","Null","Date","Object"],Yy=function(){function e(t,r){cy(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),this.logCacheLevel=(null==r?void 0:r.logCacheLevel)||3,this.logMaxSize=(null==r?void 0:r.logMaxSize)||204800,this.logSize=0,this.logTextArray=[]}return fy(e,[{key:"debug",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[Hy.DEBUG].concat(n)),e.disabled||(t=console).debug.apply(t,["[".concat(Ky(),"]"),this._prefix].concat(n))}},{key:"log",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[Hy.LOG].concat(n)),e.disabled||(t=console).log.apply(t,["[".concat(Ky(),"]"),this._prefix].concat(n))}},{key:"warn",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[Hy.WARN].concat(n)),e.disabled||(t=console).warn.apply(t,["[".concat(Ky(),"]"),this._prefix].concat(n))}},{key:"error",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[Hy.ERROR].concat(n)),e.disabled||(t=console).error.apply(t,["[".concat(Ky(),"]"),this._prefix].concat(n))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var a=n.map((function(e){return Xy(e)}));t="[".concat(Ky(),"]")+this._prefix+JSON.stringify(a)}catch(s){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var o=this.logTextArray.shift();this.logSize-=o.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function Ky(){return(new Date).toLocaleString()}function Wy(e){if("object"!==oy(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function Xy(e,t,r){r||(r=1),t||(t=2);var n={};if(!e||"object"!==oy(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!qy.includes(i))return i;if(!(r>t)){for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r===t?n[a]=Wy(e[a]):"object"===oy(e[a])?n[a]=Xy(e[a],t,r+1):n[a]=e[a]);return n}}function Qy(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.used=!1,r.resolve=function(){return r.used=!0,e.apply(void 0,arguments)},r.reject=function(){return r.used=!0,t.apply(void 0,arguments)},r}function $y(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}hy(Yy,"disabled",!0);var Jy=function(e){try{return JSON.stringify(e)}catch(t){return""}};function Zy(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];try{return Dy?e&&"undefined"!=typeof ManagedMediaSource?ManagedMediaSource:window.MediaSource:null}catch(t){}}function eg(e){return/ManagedMediaSource/gi.test(Object.prototype.toString.call(e))}var tg="appendBuffer",rg="removeBuffer",ng="updateDuration",ig=function(){function e(t,r){var n=this;cy(this,e),hy(this,"media",null),hy(this,"mediaSource",null),hy(this,"_openPromise",Qy()),hy(this,"_queue",Object.create(null)),hy(this,"_sourceBuffer",Object.create(null)),hy(this,"_mseFullFlag",{}),hy(this,"_st",0),hy(this,"_opst",0),hy(this,"_logger",null),hy(this,"_config",null),hy(this,"_url",null),hy(this,"_onStartStreaming",(function(){n._logger.debug("startstreaming")})),hy(this,"_onEndStreaming",(function(){n._logger.debug("endstreaming")})),hy(this,"_onSBUpdateEnd",(function(e){var t=n._queue[e];if(t){var r=t[0];if((null==r?void 0:r.opName)!==ng&&t.shift(),r){var i,a,o=$y()-n._opst;n._logger.debug("UpdateEnd(".concat(e,"/").concat(r.opName,")"),Jy(function(e){var t=[];if(e instanceof TimeRanges)for(var r=0;r<e.length;r++)t.push({start:e.start(r),end:e.end(r)});return t}(null===(i=n._sourceBuffer[e])||void 0===i?void 0:i.buffered)),o,r.context),r.promise.resolve({name:r.opName,context:r.context,costtime:o});var s=null===(a=r.context)||void 0===a?void 0:a.callback;s&&"function"==typeof s&&s(r.context),n._startQueue(e)}}})),hy(this,"_onSBUpdateError",(function(e,t){var r=n._queue[e];if(r){var i=r[0];i&&(n._logger.error("UpdateError",e,i.opName,i.context),i.promise.reject(new zy(Uy,Vy.MSE_APPEND_BUFFER,t)))}})),this._config=Object.assign(e.getDefaultConfig(),r),t&&this.bindMedia(t),this._logger=new Yy("MSE"),this._config.openLog&&Yy.enable()}var t,r,n;return fy(e,[{key:"isOpened",get:function(){var e;return"open"===(null===(e=this.mediaSource)||void 0===e?void 0:e.readyState)}},{key:"hasOpTasks",get:function(){var e=this,t=!1;return Object.keys(this._queue).forEach((function(r){var n=e._queue[r];Array.isArray(n)&&(t||(t=n.length>0))})),t}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"streaming",get:function(){return!eg(this.mediaSource)||this.mediaSource.streaming}},{key:"isFull",value:function(t){return t?this._mseFullFlag[t]:this._mseFullFlag[e.VIDEO]}},{key:"updateDuration",value:function(e){var t=this,r=this.mediaSource&&this.mediaSource.duration>e;if(this.mediaSource&&this.mediaSource.duration>e){var n=0;if(Object.keys(this._sourceBuffer).forEach((function(e){try{n=Math.max(t.bufferEnd(e)||0,n)}catch(Xb){}})),e<n)return Promise.resolve()}return this._enqueueBlockingOp((function(){t.isEnded?t._logger.debug("setDuration but ended"):t.mediaSource&&(t.mediaSource.duration=e,t._logger.debug("setDuration",e))}),ng,{isReduceDuration:r})}},{key:"open",value:function(){var e=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var t=this.mediaSource;t.addEventListener("sourceopen",(function r(){var n=$y()-e._st;e._logger.debug("sourceopen",n),t.removeEventListener("sourceopen",r),e._openPromise.resolve({costtime:n})})),this._openPromise=Qy()}return this._openPromise}},{key:"bindMedia",value:(n=uy(ay().mark((function e(t){var r,n,i,a,o=this;return ay().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mediaSource&&!this.media){e.next=3;break}return e.next=3,this.unbindMedia();case 3:if(r=Zy(this._config.preferMMS),t&&r){e.next=6;break}throw new Error("Param media or MediaSource does not exist");case 6:return this.media=t,n=this.mediaSource=new r,i=eg(n),this._st=$y(),a=function e(){var r=$y()-o._st;o._logger.debug("sourceopen"),n.removeEventListener("sourceopen",e),URL.revokeObjectURL(t.src),o._openPromise.resolve({costtime:r})},n.addEventListener("sourceopen",a),i&&(n.addEventListener("startstreaming",this._onStartStreaming),n.addEventListener("endstreaming",this._onEndStreaming)),this._url=URL.createObjectURL(n),t.src=this._url,t.disableRemotePlayback=i,e.abrupt("return",this._openPromise);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"unbindMedia",value:(r=uy(ay().mark((function e(){var t,r,n,i=this;return ay().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),t=this.mediaSource){if(Object.keys(this._queue).forEach((function(e){var t=i._queue[e];t&&t.forEach((function(e){var t,r;return null===(t=e.promise)||void 0===t||null===(r=t.resolve)||void 0===r?void 0:r.call(t)}))})),r=!!this.media&&this.media.readyState>=1,n="open"===t.readyState,r&&n)try{t.endOfStream()}catch(Xb){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(i._sourceBuffer[e])}catch(Xb){}})),eg(t)&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming))}if(this.media){this.media.disableRemotePlayback=!1,this.media.removeAttribute("src");try{this.media.load()}catch(Xb){}this.media=null}this.mediaSource=null,this._openPromise=Qy(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var r;try{r=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(Xb){throw new zy(Uy,Vy.MSE_ADD_SB,Xb)}r.mimeType=t,r.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),r.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var r=this,n=this._sourceBuffer[e];return this.mediaSource&&n&&n.mimeType!==t?"function"!=typeof n.changeType?Promise.reject(new zy(Uy,Vy.MSE_CHANGE_TYPE,new Error("changeType is not a function"))):this._enqueueOp(e,(function(){try{n.changeType(t)}catch(i){throw new zy(Uy,Vy.MSE_CHANGE_TYPE,i)}n.mimeType=t,r._onSBUpdateEnd(e)}),"changeType",{mimeType:t}):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,r){var n=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(function(){var i;n.mediaSource&&!n.media.error&&(n._logger.debug("MSE APPEND START",r),n._opst=$y(),null===(i=n._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),tg,r):Promise.resolve()}},{key:"remove",value:function(e,t,r,n){var i=this,a=!1;return this._mseFullFlag[e]&&(a=!0),this._enqueueOp(e,(function(){if(i.mediaSource&&!i.media.error){var a=i._sourceBuffer[e];t>=r||!a?i._onSBUpdateEnd(e):(i._opst=$y(),i._logger.debug("MSE REMOVE START",e,t,r,n),a.remove(t,r))}}),rg,n,a)}},{key:"clearBuffer",value:function(e,t){var r,n=this;return Object.keys(this._sourceBuffer).forEach((function(i){r=n.remove(i,e,t)})),r||Promise.resolve()}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach((function(r){var n=t._sourceBuffer[r];e=t.remove(r,0,Ay.end(Ay.get(n)))})),e}},{key:"clearOpQueues",value:function(e,t){var r;this._logger.debug("MSE clearOpQueue START");var n=this._queue[e];if(t&&n)this._queue[e]=[];else if(n&&n[e]&&!(n.length<5)){var i=[];n.forEach((function(e){e.context&&e.context.isinit&&i.push(e)})),this._queue[e]=n.slice(0,2),i.length>0&&(r=this._queue[e]).push.apply(r,i)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((function(){var r=t.mediaSource;r&&"open"===r.readyState&&(t._logger.debug("MSE endOfStream START"),e?r.endOfStream(e):r.endOfStream())}),"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var r=this.mediaSource;e<0||t<e||null==r||!r.setLiveSeekableRange||"open"!==r.readyState||r.setLiveSeekableRange(e,t)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return Ay.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return Ay.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return Ay.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,r,n,i){var a=this;if(!this.mediaSource)return Promise.resolve();var o=this._queue[e]=this._queue[e]||[],s={exec:t,promise:Qy(),opName:r,context:n};return i?(o.splice(0,0,s),this._mseFullFlag[e]=!1,this._startQueue(e)):o.push(s),this.isOpened||this.isEnded?1===o.length&&this._startQueue(e):this._openPromise.then((function(){1===o.length&&a._startQueue(e)})),s.promise}},{key:"_enqueueBlockingOp",value:(t=uy(ay().mark((function e(t,r,n){var i,a,o=this;return ay().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:if((i=Object.keys(this._sourceBuffer)).length){e.next=5;break}return e.abrupt("return",t());case 5:return a=[],i.forEach((function(e){var t=o._queue[e],i=Qy();a.push(i),t.push({exec:function(){i.resolve()},promise:i,opName:r,context:n}),1===t.length&&o._startQueue(e)})),e.abrupt("return",Promise.all(a).then((function(){try{return t()}finally{i.forEach((function(e){var t=o._queue[e],r=o._sourceBuffer[e];null==t||t.shift(),r&&r.updating||o._startQueue(e)}))}})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})},{key:"_startQueue",value:function(e){var t=this._queue[e];if(t){var r=t[0];if(r&&!this._mseFullFlag[e])try{r.exec()}catch(Xb){Xb&&Xb.message&&Xb.message.indexOf("SourceBuffer is full")>=0?(this._mseFullFlag[e]=!0,r.context&&"object"===oy(r.context)&&(r.context.isFull=!0),this._logger.error("[MSE error], context,",r.context," ,name,",r.opName,",err,SourceBuffer is full"),r.promise.reject(new zy(Uy,Vy.MSE_FULL,Xb))):(this._logger.error(Xb),r.promise.reject(Xb.constructor===zy?Xb:new zy(Uy,Vy.MSE_OTHER,Xb)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,r){var n=this;return this._enqueueOp(e,(function(){t<0&&(t+=.001),n._sourceBuffer[e].timestampOffset=t,n._onSBUpdateEnd(e)}),"setTimeoffset",r)}},{key:"abort",value:function(e,t){var r=this;return this.isOpened?this._enqueueOp(e,(function(){r._sourceBuffer[e].abort(),r._onSBUpdateEnd(e)}),"abort",t):Promise.resolve()}}],[{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"',t=Zy();if(!t)return!1;try{return t.isTypeSupported(e)}catch(Xb){return this._logger.error(e,Xb),!1}}},{key:"isMMSOnly",value:function(){return"undefined"!=typeof ManagedMediaSource&&"undefined"==typeof MediaSource}},{key:"getDefaultConfig",value:function(){return{openLog:!1,preferMMS:!1}}}]),e}();hy(ig,"VIDEO","video"),hy(ig,"AUDIO","audio");var ag="fetch",og="xhr",sg="arraybuffer",ug="text",cg="json",lg=function(e){dy(r,e);var t=Sy(r);function r(e,n,i,a){var o;return cy(this,r),hy(by(o=t.call(this,a)),"retryCount",0),hy(by(o),"isTimeout",!1),hy(by(o),"loaderType",ag),hy(by(o),"startTime",0),hy(by(o),"endTime",0),hy(by(o),"options",{}),o.url=e,o.request=n,o.response=i,o}return fy(r)}(gy(Error)),fg=Object.prototype.toString;function hg(e){if("[object Object]"!==fg.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function dg(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function pg(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function vg(e,t){if(e){if(!t)return e;var r,n=Object.keys(t).map((function(e){if(null!=(r=t[e]))return Array.isArray(r)?e+="[]":r=[r],r.map((function(t){var r;return r=t,"[object Date]"===fg.call(r)?t=t.toISOString():function(e){return null!==e&&"object"===oy(e)}(t)&&(t=JSON.stringify(t)),"".concat(pg(e),"=").concat(pg(t))})).join("&")})).filter(Boolean).join("&");if(n){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}}function mg(e,t,r,n,i,a,o,s,u,c,l){return i=null!=i?parseFloat(i):null,n=parseInt(n||"0",10),Number.isNaN(n)&&(n=0),{data:e,done:t,options:{range:u,vid:c,index:s,contentLength:n,age:i,startTime:a,firstByteTime:o,endTime:Date.now(),priOptions:l},response:r}}function yg(e,t){return Math.round(8*e*1e3/t/1024)}var gg={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"},_g=2097152,bg=function(e){dy(n,e);var t,r=Sy(n);function n(){var e;return cy(this,n),hy(by(e=r.call(this)),"_abortController",null),hy(by(e),"_timeoutTimer",null),hy(by(e),"_reader",null),hy(by(e),"_response",null),hy(by(e),"_aborted",!1),hy(by(e),"_index",-1),hy(by(e),"_range",null),hy(by(e),"_receivedLength",0),hy(by(e),"_running",!1),hy(by(e),"_logger",null),hy(by(e),"_vid",""),hy(by(e),"_onProcessMinLen",0),hy(by(e),"_onCancel",null),hy(by(e),"_priOptions",null),e}return fy(n,[{key:"load",value:function(e){var t,r=this,n=e.url,i=e.vid,a=e.timeout,o=e.responseType,s=e.onProgress,u=e.index,c=e.onTimeout,l=e.onCancel,f=e.range,h=e.transformResponse,d=e.request,p=e.params,v=e.logger,m=e.method,y=e.headers,g=e.body,_=e.mode,b=e.credentials,S=e.cache,k=e.redirect,E=e.referrer,w=e.referrerPolicy,x=e.onProcessMinLen,T=e.priOptions;this._logger=v,this._aborted=!1,this._onProcessMinLen=x,this._onCancel=l,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=u,this._range=f||[0,0],this._vid=i||n,this._priOptions=T||{};var A={method:m,headers:y,body:g,mode:_,credentials:b,cache:S,redirect:k,referrer:E,referrerPolicy:w,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},D=!1;clearTimeout(this._timeoutTimer),n=vg(n,p);var O=dg(f);O&&(y=d?d.headers:A.headers=A.headers||(Headers?new Headers:{}),Headers&&y instanceof Headers?y.append("Range",O):y.Range=O),a&&(this._timeoutTimer=setTimeout((function(){if(D=!0,r.cancel(),c){var e=new lg(n,A,null,"timeout");e.isTimeout=!0,c(e,{index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions})}}),a));var L=Date.now();return this._logger.debug("[fetch load start], index,",u,",range,",f),new Promise((function(e,t){fetch(d||n,d?void 0:A).then(function(){var i=uy(ay().mark((function i(a){var c,l,d,p;return ay().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(r._timeoutTimer),r._response=a,!r._aborted&&r._running){i.next=4;break}return i.abrupt("return");case 4:if(h&&(a=h(a,n)||a),a.ok){i.next=7;break}throw new lg(n,A,a,"bad network response");case 7:if(c=Date.now(),o!==ug){i.next=15;break}return i.next=11,a.text();case 11:l=i.sent,r._running=!1,i.next=37;break;case 15:if(o!==cg){i.next=22;break}return i.next=18,a.json();case 18:l=i.sent,r._running=!1,i.next=37;break;case 22:if(!s){i.next=29;break}return r.resolve=e,r.reject=t,r._loadChunk(a,s,L,c),i.abrupt("return");case 29:return i.next=31,a.arrayBuffer();case 31:l=i.sent,l=new Uint8Array(l),r._running=!1,d=Date.now()-L,p=yg(l.byteLength,d),r.emit(gg.REAL_TIME_SPEED,{speed:p,len:l.byteLength,time:d,vid:r._vid,index:r._index,range:r._range,priOptions:r._priOptions});case 37:r._logger.debug("[fetch load end], index,",u,",range,",f),e(mg(l,!0,a,a.headers.get("Content-Length"),a.headers.get("age"),L,c,u,f,r._vid,r._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){var i;clearTimeout(r._timeoutTimer),r._running=!1,r._aborted&&!D||((e=e instanceof lg?e:new lg(n,A,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=L,e.endTime=Date.now(),e.isTimeout=D,e.options={index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions},t(e))}))}))}},{key:"cancel",value:(t=uy(ay().mark((function e(){return ay().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(Xb){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,r,n){var i=this;if(!e.body||!e.body.getReader){this._running=!1;var a=new lg(e.url,"",e,"onProgress of bad response.body.getReader");return a.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(a)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(_g),this._writeIdx=0);var o,s,u,c=this._reader=e.body.getReader(),l=function(){var a=uy(ay().mark((function a(){var f,h,d,p,v,m,y,g;return ay().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return s=Date.now(),a.prev=1,a.next=4,c.read();case 4:o=a.sent,u=Date.now(),a.next=13;break;case 8:return a.prev=8,a.t0=a.catch(1),u=Date.now(),i._aborted||(i._running=!1,a.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(a.t0)),a.abrupt("return");case 13:if(h=(null===(f=i._range)||void 0===f?void 0:f.length)>0?i._range[0]:0,d=h+i._receivedLength,!i._aborted){a.next=19;break}return i._running=!1,t(void 0,!1,{range:[d,d],vid:i._vid,index:i._index,startTime:s,endTime:u,st:r,firstByteTime:n,priOptions:i._priOptions},e),a.abrupt("return");case 19:p=o.value?o.value.byteLength:0,i._receivedLength+=p,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",d,", end,",h+i._receivedLength,", done,",o.done),i._onProcessMinLen>0?i._writeIdx+p>=i._onProcessMinLen||o.done?((v=new Uint8Array(i._writeIdx+p)).set(i._cache.slice(0,i._writeIdx),0),p>0&&v.set(o.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",o.done,",len,",v.byteLength,", writeIdx,",i._writeIdx)):p>0&&i._writeIdx+p<_g?(i._cache.set(o.value,i._writeIdx),i._writeIdx+=p,i._logger.debug("【fetchLoader,onProgress cache】,len,",p,", writeIdx,",i._writeIdx)):p>0&&(m=new Uint8Array(i._writeIdx+p+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+p+2048,", datalen,",p,", writeIdx,",i._writeIdx),m.set(i._cache.slice(0,i._writeIdx),0),p>0&&m.set(o.value,i._writeIdx),i._writeIdx+=p,delete i._cache,i._cache=m,i._logger.debug("【fetchLoader,onProgress extra end】,len,",p,", writeIdx,",i._writeIdx)):v=o.value,(v&&v.byteLength>0||o.done)&&t(v,o.done,{range:[i._range[0]+i._receivedLength-(v?v.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:s,endTime:u,st:r,firstByteTime:n,priOptions:i._priOptions},e),o.done?(y=Date.now()-r,g=yg(i._receivedLength,y),i.emit(gg.REAL_TIME_SPEED,{speed:g,len:i._receivedLength,time:y,vid:i._vid,index:i._index,range:i._range,priOptions:i._priOptions}),i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",o.done),i.resolve(mg(o,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),r,n,i._index,i._range,i._vid,i._priOptions))):l();case 25:case"end":return a.stop()}}),a,null,[[1,8]])})));return function(){return a.apply(this,arguments)}}();l()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),n}(Bp);var Sg=function(e){dy(r,e);var t=Sy(r);function r(){var e;return cy(this,r),hy(by(e=t.call(this)),"_xhr",null),hy(by(e),"_aborted",!1),hy(by(e),"_timeoutTimer",null),hy(by(e),"_range",null),hy(by(e),"_receivedLength",0),hy(by(e),"_url",null),hy(by(e),"_onProgress",null),hy(by(e),"_index",-1),hy(by(e),"_headers",null),hy(by(e),"_currentChunkSizeKB",384),hy(by(e),"_timeout",null),hy(by(e),"_xhr",null),hy(by(e),"_withCredentials",null),hy(by(e),"_startTime",-1),hy(by(e),"_loadCompleteResolve",null),hy(by(e),"_loadCompleteReject",null),hy(by(e),"_runing",!1),hy(by(e),"_logger",!1),hy(by(e),"_vid",""),hy(by(e),"_responseType",void 0),hy(by(e),"_credentials",void 0),hy(by(e),"_method",void 0),hy(by(e),"_transformResponse",void 0),hy(by(e),"_firstRtt",void 0),hy(by(e),"_onCancel",null),hy(by(e),"_priOptions",null),e}return fy(r,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=vg(e.url,e.params);var r=Date.now();return new Promise((function(e,r){t._loadCompleteResolve=e,t._loadCompleteReject=r,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof lg?e:new lg(t._url,t._request)).startTime=r,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===sg&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,r=this._range[0]+this._receivedLength,n=this._range[1];t<this._range[1]-r&&(n=r+t),e=[r,n],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var r=this._xhr=new XMLHttpRequest;r.open(this._method||"GET",this._url,!0),r.responseType=this._responseType,this._timeout&&(r.timeout=this._timeout),r.withCredentials=this._withCredentials,r.onload=this._onLoad.bind(this),r.onreadystatechange=this._onReadyStatechange.bind(this),r.onerror=function(e){var r,n,i;t._running=!1;var a=new lg(t._url,t._request,null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.response,"xhr.onerror.status:"+(null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));a.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(a)},r.ontimeout=function(e){t.cancel();var r=new lg(t._url,t._request,{status:408},"timeout");t._onTimeout&&(r.isTimeout=!0,t._onTimeout(r,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),r.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(r)};var n=this._headers||{},i=dg(e);i&&(n.Range=i),n&&Object.keys(n).forEach((function(e){r.setRequestHeader(e,n[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),r.send(this._body)}catch(a){a.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(a)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t,r=e.target.status;if(r<200||r>299){var n=new lg(this._url,null,iy(iy({},e.target.response),{},{status:r}),"bad response,status:"+r);return n.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(n)}var i,a=null,o=!1,s=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===sg){var u,c=new Uint8Array(e.target.response);if(i=s+this._receivedLength,c&&c.byteLength>0){this._receivedLength+=c.byteLength;var l=Date.now()-this._startTime,f=yg(this._receivedLength,l);this.emit(gg.REAL_TIME_SPEED,{speed:f,len:this._receivedLength,time:l,vid:this._vid,index:this._index,range:[i,s+this._receivedLength],priOptions:this._priOptions})}a=c,o=!((null===(u=this._range)||void 0===u?void 0:u.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",i,"end ",s+this._receivedLength,",dataLen,",c?c.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",o)}else o=!0,a=e.target.response;var h={ok:r>=200&&r<300,status:r,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(h=this._transformResponse(h,this._url)||h),this._onProgress&&this._onProgress(a,o,{index:this._index,vid:this._vid,range:[i,s+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},h),o?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(mg(this._onProgress?null:a,o,h,h.headers["content-length"],h.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,ky(py(r.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,r={},n=wy(e.getAllResponseHeaders().trim().split("\r\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value.split(": ");r[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(a){n.e(a)}finally{n.f()}return r}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),r}(Bp),kg=["retry","retryDelay","onRetryError","transformError"],Eg=function(){function e(t,r){cy(this,e),this.promise=Qy(),this.alive=!!r.onProgress,!r.logger&&(r.logger=new Yy("Loader")),this._loaderType=t,this._loader=t===ag&&"undefined"!=typeof fetch?new bg:new Sg,this._config=r,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=r.retryCheckFunc,this._logger=r.logger}var t;return fy(e,[{key:"exec",value:function(){var e=this,t=this._config,r=t.retry,n=t.retryDelay,i=t.onRetryError,a=t.transformError,o=_y(t,kg),s=function(){var t=uy(ay().mark((function t(){var u,c,l;return ay().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(o);case 3:u=t.sent,e.promise.resolve(u),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,a&&(c=a(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,{index:o.index,vid:o.vid,range:o.range,priOptions:o.priOptions}),e._retryCount++,l=!0,e._retryCheckFunc&&(l=e._retryCheckFunc(t.t0)),!(l&&e._retryCount<=r)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",o.range),e._retryTimer=setTimeout(s,n),t.abrupt("return");case 26:e.promise.reject(c);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return s(),this.promise}},{key:"cancel",value:(t=uy(ay().mark((function e(){return ay().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e}();function wg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if((t=t.filter(Boolean)).length<2)return t[0];var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}function xg(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var Tg=function(e){dy(n,e);var t,r=Sy(n);function n(e){var t;return cy(this,n),hy(by(t=r.call(this,e)),"type",ag),hy(by(t),"_queue",[]),hy(by(t),"_alive",[]),hy(by(t),"_currentTask",null),hy(by(t),"_finnalUrl",""),hy(by(t),"_config",void 0),t._config=function(e){return iy({loaderType:ag,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:ug,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e)}(e),t._config.loaderType!==og&&bg.isSupported()||(t.type=og),t.log=e.logger,t}return fy(n,[{key:"isFetch",value:function(){return this.type===ag}},{key:"load",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?r=e:r.url=e||r.url||this._config.url,(r=Object.assign({},this._config,r)).params&&(r.params=Object.assign({},r.params)),r.headers&&hg(r.headers)&&(r.headers=Object.assign({},r.headers)),r.body&&hg(r.body)&&(r.body=Object.assign({},r.body)),r.transformRequest&&(r=r.transformRequest(r)||r),r.logger=this.log;var n=new Eg(this.type,r);return n.loader.on(gg.REAL_TIME_SPEED,(function(e){t.emit(gg.REAL_TIME_SPEED,e)})),this._queue.push(n),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),n.promise}},{key:"cancel",value:(t=uy(ay().mark((function e(){var t;return ay().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,xg();case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,r;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(r=e._alive)||void 0===r?void 0:r.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return bg.isSupported()}}]),n}(Bp),Ag=function(){function e(){cy(this,e),hy(this,"_prevCurrentTime",0)}return fy(e,[{key:"do",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(e){var i=e.currentTime,a=0;if(this._prevCurrentTime===i){var o=Ay.info(Ay.get(e),i);if(!o.buffers.length)return;r&&o.nextStart||o.nextStart&&o.nextStart-i<t?a=o.nextStart+.1:o.end&&o.end-i>n&&!e.seeking&&(a=i+.1)}this._prevCurrentTime=i,a&&i!==a&&(e.currentTime=a)}}}]),e}(),Dg=function(){function e(t){var r=this;cy(this,e),hy(this,"_seiSet",new Set),this.emitter=t,t.on(gg.SEI,(function(e){e&&r._seiSet.add(e)}))}return fy(e,[{key:"throw",value:function(e,t){var r=this;if(null!=e&&this._seiSet.size){var n=e-.2,i=e+.2,a=[];this._seiSet.forEach((function(e){e.time>=n&&e.time<=i&&a.push(e)})),a.forEach((function(e){r._seiSet.delete(e),r.emitter.emit(gg.SEI_IN_TIME,e)})),t&&this._seiSet.forEach((function(t){t.time<e-5&&r._seiSet.delete(t)}))}}},{key:"reset",value:function(){this._seiSet.clear()}}]),e}(),Og=function(){function e(t){cy(this,e),hy(this,"_chunkSpeed",0),hy(this,"_chunkCache",[]),hy(this,"_speeds",[]),hy(this,"_totalSize",0),hy(this,"_totalCost",0),this._opts=t||{}}return fy(e,[{key:"addRecord",value:function(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}},{key:"addChunkRecord",value:function(e,t){var r,n;if(e&&t&&!(e<((null===(r=this._opts)||void 0===r?void 0:r.skipChunkSize)||1e3))){this._totalSize+=e,this._totalCost+=t,this._chunkSpeed=8e3*e/t,this._chunkCache.push({size:e,duration:t,timestamp:performance.now()});var i=(null===(n=this._opts)||void 0===n?void 0:n.chunkCountForSpeed)||50;this._chunkCache.length>i&&(this._chunkCache=this._chunkCache.slice(-i))}}},{key:"getAvgSpeed",value:function(){var e;if(!this._chunkCache.length&&!this._speeds.length)return 0;if(this._speeds.length)return this._speeds.reduce((function(e,t){return e+t}))/this._speeds.length;var t=this._chunkCache[this._chunkCache.length-1],r=performance.now()-t.timestamp;return r>((null===(e=this._opts)||void 0===e?void 0:e.longtimeNoReceived)||3e3)&&this._chunkCache.push({size:0,duration:r,timestamp:performance.now()}),8e3*this._chunkCache.reduce((function(e,t){return e+t.size}),0)/this._chunkCache.reduce((function(e,t){return e+t.duration}),0)}},{key:"getLatestSpeed",value:function(){return this._chunkCache.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeed:0}},{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}}]),e}(),Lg=function(){function e(t){cy(this,e),hy(this,"encodeType",""),hy(this,"audioCodec",""),hy(this,"videoCodec",""),hy(this,"domain",""),hy(this,"fps",0),hy(this,"bitrate",0),hy(this,"width",0),hy(this,"height",0),hy(this,"samplerate",0),hy(this,"channelCount",0),hy(this,"gop",0),hy(this,"_bitsAccumulateSize",0),hy(this,"_bitsAccumulateDuration",0),hy(this,"_startGopId",-1),this._timescale=t}return fy(e,[{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 t,r=e.data,n=null==r||null===(t=r.onMetaData)||void 0===t?void 0:t.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 t=e.fpsNum/e.fpsDen;t>0&&t<100&&(this.fps=t)}}},{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 t=this;if((!this.fps||this.fps>=100)&&e.length){var r=e.reduce((function(e,t){return e+t.duration}),0)/e.length;this.fps=Math.round(this._timescale/r)}e.forEach((function(e){-1===t._startGopId&&(t._startGopId=e.gopId),e.gopId===t._startGopId&&t.gop++,t._bitsAccumulateDuration+=e.duration/(t._timescale/1e3),t._bitsAccumulateSize+=e.units.reduce((function(e,t){return e+t.length}),0),t._bitsAccumulateDuration>=1e3&&(t.bitrate=8*t._bitsAccumulateSize,t._bitsAccumulateDuration=0,t._bitsAccumulateSize=0)}))}}]),e}(),Cg=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;cy(this,e),hy(this,"_core",null),hy(this,"_samples",[]),this._core=t,this._timescale=r,this._stats=new Lg(r),this._bindEvents()}return fy(e,[{key:"getStats",value:function(){var e,t,r,n,i,a,o,s,u,c,l,f=(null===(e=this._core)||void 0===e?void 0:e.media)||{},h=f.currentTime,d=void 0===h?0:h,p=f.decodeFps,v=void 0===p?0:p;return iy(iy({},this._stats.getStats()),{},{downloadSpeed:(null===(t=this._core)||void 0===t||null===(r=t.speedInfo)||void 0===r?void 0:r.call(t).speed)||0,avgSpeed:(null===(n=this._core)||void 0===n||null===(i=n.speedInfo)||void 0===i?void 0:i.call(n).avgSpeed)||0,totalReceivedByte:(null===(a=this._core)||void 0===a||null===(o=a.speedInfo)||void 0===o?void 0:o.call(a).totalSize)||0,totalReceivedCost:(null===(s=this._core)||void 0===s||null===(u=s.speedInfo)||void 0===u?void 0:u.call(s).totalCost)||0,currentTime:d,bufferEnd:(null===(c=this._core)||void 0===c||null===(l=c.bufferInfo())||void 0===l?void 0:l.remaining)||0,decodeFps:v})}},{key:"_bindEvents",value:function(){var e=this;this._core.on(gg.DEMUXED_TRACK,(function(t){var r=t.videoTrack;return e._stats.updateBitrate(r.samples)})),this._core.on(gg.FLV_SCRIPT_DATA,(function(t){e._stats.setFpsFromScriptData(t)})),this._core.on(gg.METADATA_PARSED,(function(t){"video"===t.type?e._stats.setVideoMeta(t.track):e._stats.setAudioMeta(t.track)})),this._core.on(gg.TTFB,(function(t){e._stats.setDomain(t.responseUrl)}))}},{key:"reset",value:function(){this._samples=[],this._stats=new Lg(this._timescale)}}]),e}();function Pg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rg(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Hg(n.key),n)}}function Ig(e,t,r){return t&&Rg(e.prototype,t),r&&Rg(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mg(e,t,r){return(t=Hg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bg(e){return(Bg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ug(e,t){return(Ug=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ng(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Fg(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Bg(e);if(t){var i=Bg(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ng(this,r)}}function jg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(l){c=!0,i=l}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(e,t)||Gg(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vg(e){return function(e){if(Array.isArray(e))return zg(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Gg(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gg(e,t){if(e){if("string"==typeof e)return zg(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?zg(e,t):void 0}}function zg(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Hg(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var qg="video",Yg="audio",Kg="metadata",Wg="av1",Xg="avc",Qg="hevc",$g="aac",Jg="g7110a",Zg="g7110m",e_="opus",t_="mp3",r_="LARGE_AV_SHIFT",n_="LARGE_VIDEO_GAP",i_="LARGE_VIDEO_GAP_BETWEEN_CHUNK",a_="LARGE_AUDIO_GAP",o_="AUDIO_FILLED",s_="AUDIO_DROPPED",u_=function(){function e(){Pg(this,e),Mg(this,"id",1),Mg(this,"type",qg),Mg(this,"codecType",Xg),Mg(this,"pid",-1),Mg(this,"hvcC",void 0),Mg(this,"codec",""),Mg(this,"timescale",0),Mg(this,"formatTimescale",0),Mg(this,"sequenceNumber",0),Mg(this,"baseMediaDecodeTime",0),Mg(this,"baseDts",0),Mg(this,"duration",0),Mg(this,"warnings",[]),Mg(this,"samples",[]),Mg(this,"pps",[]),Mg(this,"sps",[]),Mg(this,"vps",[]),Mg(this,"fpsNum",0),Mg(this,"fpsDen",0),Mg(this,"sarRatio",[]),Mg(this,"width",0),Mg(this,"height",0),Mg(this,"nalUnitSize",4),Mg(this,"present",!1),Mg(this,"isVideoEncryption",!1),Mg(this,"isAudioEncryption",!1),Mg(this,"isVideo",!0),Mg(this,"lastKeyFrameDts",0),Mg(this,"kid",null),Mg(this,"pssh",null),Mg(this,"ext",void 0)}return Ig(e,[{key:"reset",value:function(){this.sequenceNumber=this.width=this.height=this.fpsDen=this.fpsNum=this.duration=this.baseMediaDecodeTime=this.timescale=0,this.codec="",this.present=!1,this.pid=-1,this.pps=[],this.sps=[],this.vps=[],this.sarRatio=[],this.samples=[],this.warnings=[],this.hvcC=null}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}},{key:"exist",value:function(){return!!/av01/.test(this.codec)||!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}]),e}(),c_=function(){function e(){Pg(this,e),Mg(this,"id",2),Mg(this,"type",Yg),Mg(this,"codecType",$g),Mg(this,"pid",-1),Mg(this,"codec",""),Mg(this,"container",""),Mg(this,"sequenceNumber",0),Mg(this,"sampleDuration",0),Mg(this,"timescale",0),Mg(this,"formatTimescale",0),Mg(this,"baseMediaDecodeTime",0),Mg(this,"duration",0),Mg(this,"warnings",[]),Mg(this,"samples",[]),Mg(this,"baseDts",0),Mg(this,"sampleSize",16),Mg(this,"sampleRate",0),Mg(this,"channelCount",0),Mg(this,"objectType",0),Mg(this,"sampleRateIndex",0),Mg(this,"config",[]),Mg(this,"present",!1),Mg(this,"isVideoEncryption",!1),Mg(this,"isAudioEncryption",!1),Mg(this,"kid",null),Mg(this,"ext",void 0)}return Ig(e,[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!(!this.sampleRate||!this.channelCount||!this.codec&&!this.container||this.codecType!==$g&&this.codecType!==Jg&&this.codecType!==Zg&&this.codecType!==e_&&this.codecType!==t_)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}}]),e}(),l_=function(){function e(t,r,n){Pg(this,e),Mg(this,"flag",{}),Mg(this,"keyframe",!1),Mg(this,"gopId",0),Mg(this,"duration",0),Mg(this,"size",0),Mg(this,"units",[]),Mg(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=r,n&&(this.units=n)}return Ig(e,[{key:"cts",get:function(){return this.pts-this.dts}},{key:"setToKeyframe",value:function(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}]),e}(),f_=Ig((function e(t,r,n,i){Pg(this,e),Mg(this,"duration",1024),Mg(this,"flag",{dependsOn:2,isNonSyncSample:0}),Mg(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=r,this.size=r.byteLength,this.sampleOffset=i,n&&(this.duration=n)})),h_=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ug(e,t)}(r,e);var t=Fg(r);function r(){return Pg(this,r),t.apply(this,arguments)}return Ig(r)}(Ig((function e(t,r){Pg(this,e),Mg(this,"time",0),this.data=t,this.originPts=this.pts=r}))),d_=function(){function e(){Pg(this,e),Mg(this,"id",3),Mg(this,"type",Kg),Mg(this,"timescale",0),Mg(this,"flvScriptSamples",[]),Mg(this,"seiSamples",[])}return Ig(e,[{key:"exist",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length||!this.timescale)}},{key:"reset",value:function(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length)}}]),e}(),p_=function(){function e(t){Pg(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return Ig(e,[{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(n))}}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();Mg(p_,"disabled",!0);var v_="undefined"!=typeof window,m_=v_&&navigator.userAgent.toLocaleLowerCase(),y_=v_&&/^((?!chrome|android).)*safari/.test(m_),g_=v_&&m_.includes("firefox"),__=v_&&m_.includes("android"),b_=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"getRateIndexByRate",value:function(t){return e.FREQ.indexOf(t)}},{key:"parseADTS",value:function(t,r){for(var n=t.length,i=0;i+2<n&&(255!==t[i]||240!=(246&t[i+1]));)i++;if(!(i>=n)){var a=i,o=[],s=(60&t[i+2])>>>2,u=e.FREQ[s];if(!u)throw new Error("Invalid sampling index: ".concat(s));for(var c,l,f=1+((192&t[i+2])>>>6),h=(1&t[i+2])<<2|(192&t[i+3])>>>6,d=e._getConfig(s,h,f),p=d.config,v=d.codec,m=0,y=e.getFrameDuration(u);i+7<n;)if(255===t[i]&&240==(246&t[i+1])){if(!(l=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5)||n-i<l)break;c=2*(1&~t[i+1]),o.push({pts:r+m*y,data:t.subarray(i+7+c,i+l)}),m++,i+=l}else i++;return{skip:a,remaining:i>=n?void 0:t.subarray(i),frames:o,samplingFrequencyIndex:s,sampleRate:u,objectType:f,channelCount:h,codec:v,config:p,originCodec:"mp4a.40.".concat(f)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var r=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,a=e.FREQ[n];if(a){var o=e._getConfig(n,i,r);return{samplingFrequencyIndex:n,sampleRate:a,objectType:r,channelCount:i,config:o.config,codec:o.codec,originCodec:"mp4a.40.".concat(r)}}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,r){var n,i,a=[];return g_?e>=6?(n=5,i=e-3):(n=2,i=e):__?(n=2,i=e):(n=2===r||5===r?r:5,i=e,e>=6?i=e-3:1===t&&(n=2,i=e)),a[0]=n<<3,a[0]|=(14&e)>>1,a[1]=(1&e)<<7,a[1]|=t<<3,5===n&&(a[1]|=(14&i)>>1,a[2]=(1&i)<<7,a[2]|=8,a[3]=0),{config:a,codec:"mp4a.40.".concat(n)}}},{key:"getSilentFrame",value:function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}]),e}();function S_(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t=t.filter(Boolean);var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}Mg(b_,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var k_=Math.pow(2,32);function E_(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function w_(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function x_(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return w_(e,t)*k_+w_(e,t+4)}function T_(e){for(var t,r="avc1.",n=0;n<3;n++)(t=e[n].toString(16)).length<2&&(t="0".concat(t)),r+=t;return r}function A_(e){if(!Array.isArray(e)){for(var t=[],r="",n=0;n<e.length;n++)n%2&&(r=e[n-1]+e[n],t.push(parseInt(r,16)),r="");return t}return e.map((function(e){return parseInt(e,16)}))}function D_(e,t){return Number(e+"."+t)}var O_=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"parseAnnexB",value:function(e){for(var t=e.length,r=2,n=0;null!==e[r]&&void 0!==e[r]&&1!==e[r];)r++;if((n=++r+2)>=t)return[];for(var i=[];n<t;)switch(e[n]){case 0:if(0!==e[n-1]){n+=2;break}if(0!==e[n-2]){n++;break}r!==n-2&&i.push(e.subarray(r,n-2));do{n++}while(1!==e[n]&&n<t);n=(r=n+1)+2;break;case 1:if(0!==e[n-1]||0!==e[n-2]){n+=3;break}r!==n-2&&i.push(e.subarray(r,n-2)),n=(r=n+1)+2;break;default:n+=3}return r<t&&i.push(e.subarray(r)),i}},{key:"parseAvcC",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(!(e.length<4)){for(var r,n=e.length,i=[],a=0;a+t<n;)if(r=w_(e,a),3===t&&(r>>>=8),a+=t,r){if(a+r>n)break;i.push(e.subarray(a,a+r)),a+=r}return i}}},{key:"parseSEI",value:function(e,t){for(var r=e.length,n=t?2:1,i=0,a=0,o="";255===e[n];)i+=255,n++;for(i+=e[n++];255===e[n];)a+=255,n++;if(a+=e[n++],5===i&&r>n+16)for(var s=0;s<16;s++)o+=e[n].toString(16),n++;return{payload:e.subarray(n,n+a),type:i,size:a,uuid:o}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,r=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(!r.length)return e;var i=t-r.length,a=new Uint8Array(i),o=0;for(n=0;n<i;o++,n++)o===r[0]&&(o++,r.shift()),a[n]=e[o];return a}}]),e}(),L_=function(){function e(t){if(Pg(this,e),Mg(this,"_bytesAvailable",void 0),Mg(this,"_bitsAvailable",0),Mg(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return Ig(e,[{key:"bitsAvailable",get:function(){return this._bitsAvailable}},{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw new Error("No bytes available");var r=new Uint8Array(4);r.set(this._data.subarray(e,e+t)),this._word=new DataView(r.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{e-=this._bitsAvailable;var t=Math.floor(e/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw new Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),r=this._word>>>32-t;return this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),(t=e-t)>0&&this._bitsAvailable?r<<t|this.readBits(t):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this._bitsAvailable;++e)if(0!=(this._word&2147483648>>>e))return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,r=8,n=0;n<e;n++)0!==r&&(r=(t+this.readEG()+256)%256),t=0===r?t:r}}]),e}(),C_=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"parseAVCDecoderConfigurationRecord",value:function(t){if(!(t.length<7)){for(var r,n,i=1+(3&t[4]),a=[],o=[],s=6,u=31&t[5],c=0;c<u;c++)if(n=t[s]<<8|t[s+1],s+=2,n){var l=t.subarray(s,s+n);s+=n,a.push(l),r||(r=e.parseSPS(O_.removeEPB(l)))}var f,h=t[s];s++;for(var d=0;d<h;d++)f=t[s]<<8|t[s+1],s+=2,f&&(o.push(t.subarray(s,s+f)),s+=f);return{sps:r,spsArr:a,ppsArr:o,nalUnitSize:i}}}},{key:"parseSPS",value:function(e){var t=new L_(e);t.readUByte();var r=t.readUByte(),n=t.readUByte(),i=t.readUByte();t.skipUEG();var a=420;if(100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r){var o=t.readUEG();if(o<=3&&(a=[0,420,422,444][o]),3===o&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBool())for(var s=3!==o?8:12,u=0;u<s;u++)t.readBool()&&(u<6?t.skipScalingList(16):t.skipScalingList(64))}t.skipUEG();var c=t.readUEG();if(0===c)t.readUEG();else if(1===c){t.skipBits(1),t.skipUEG(),t.skipUEG();for(var l=t.readUEG(),f=0;f<l;f++)t.skipUEG()}t.skipUEG(),t.skipBits(1);var h=t.readUEG(),d=t.readUEG(),p=t.readBits(1);0===p&&t.skipBits(1),t.skipBits(1);var v,m,y,g,_,b=0,S=0,k=0,E=0;if(t.readBool()&&(b=t.readUEG(),S=t.readUEG(),k=t.readUEG(),E=t.readUEG()),t.readBool()){if(t.readBool())switch(t.readUByte()){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:v=[t.readUByte()<<8|t.readUByte(),t.readUByte()<<8|t.readUByte()]}if(t.readBool()&&t.readBool(),t.readBool()&&(t.readBits(4),t.readBool()&&t.readBits(24)),t.readBool()&&(t.readUEG(),t.readUEG()),t.readBool()){var w=t.readBits(32),x=t.readBits(32);m=t.readBool(),_=(y=x)/(g=2*w)}}return{codec:T_(e.subarray(1,4)),profileIdc:r,profileCompatibility:n,levelIdc:i,chromaFormat:a,width:Math.ceil(16*(h+1)-2*(b+S)),height:(2-p)*(d+1)*16-(p?2:4)*(k+E),sarRatio:v,fpsNum:y,fpsDen:g,fps:_,fixedFrame:m}}}]),e}(),P_=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"parseHEVCDecoderConfigurationRecord",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(t.length<23)){r=r||{};for(var n,i,a,o,s,u=1+(3&t[21]),c=[],l=[],f=[],h=23,d=t[22],p=0;p<d;p++){a=63&t[h],o=t[h+1]<<8|t[h+2],h+=3;for(var v=0;v<o;v++)if(s=t[h]<<8|t[h+1],h+=2,s){switch(a){case 32:var m=t.subarray(h,h+s);n||(n=e.parseVPS(O_.removeEPB(m),r)),f.push(m);break;case 33:var y=t.subarray(h,h+s);i||(i=e.parseSPS(O_.removeEPB(y),r)),c.push(y);break;case 34:l.push(t.subarray(h,h+s))}h+=s}}return{hvcC:r,sps:i,spsArr:c,ppsArr:l,vpsArr:f,nalUnitSize:u}}}},{key:"parseVPS",value:function(t,r){r=r||{};var n=new L_(t);n.readUByte(),n.readUByte(),n.readBits(12);var i=n.readBits(3);return r.numTemporalLayers=Math.max(r.numTemporalLayers||0,i+1),n.readBits(17),e._parseProfileTierLevel(n,i,r),r}},{key:"parseSPS",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r=r||{};var n=new L_(t);n.readUByte(),n.readUByte(),n.readBits(4);var i=n.readBits(3);r.numTemporalLayers=Math.max(i+1,r.numTemporalLayers||0),r.temporalIdNested=n.readBits(1),e._parseProfileTierLevel(n,i,r),n.readUEG();var a=r.chromaFormatIdc=n.readUEG(),o=420;a<=3&&(o=[0,420,422,444][a]);var s=0;3===a&&(s=n.readBits(1));var u,c,l,f,h=n.readUEG(),d=n.readUEG(),p=n.readBits(1);(1===p&&(u=n.readUEG(),c=n.readUEG(),l=n.readUEG(),f=n.readUEG()),r.bitDepthLumaMinus8=n.readUEG(),r.bitDepthChromaMinus8=n.readUEG(),1===p)&&(h-=(1!==a&&2!==a||0!==s?1:2)*(c+u),d-=(1===a&&0===s?2:1)*(f+l));return{codec:"hev1.1.6.L93.B0",width:h,height:d,chromaFormat:o,hvcC:r}}},{key:"_parseProfileTierLevel",value:function(e,t,r){var n=r.generalTierFlag||0;r.generalProfileSpace=e.readBits(2),r.generalTierFlag=Math.max(e.readBits(1),n),r.generalProfileIdc=Math.max(e.readBits(5),r.generalProfileIdc||0),r.generalProfileCompatibilityFlags=e.readBits(32),r.generalConstraintIndicatorFlags=[e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8)];var i=e.readBits(8);n<r.generalTierFlag?r.generalLevelIdc=i:r.generalLevelIdc=Math.max(i,r.generalLevelIdc||0);var a=[],o=[];if(t>e.bitsAvailable)throw new Error("maxSubLayersMinus inavlid size ".concat(t));for(var s=0;s<t;s++)a[s]=e.readBits(1),o[s]=e.readBits(1);t>0&&e.readBits(2*(8-t));for(var u=0;u<t;u++)0!==a[u]&&(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)),0!==o[u]&&e.readBits(8)}}]),e}(),R_=9e4,I_=45e4,M_=9e4,B_=function(){function e(t,r,n,i){Pg(this,e),this.videoTrack=t,this.audioTrack=r,this.metadataTrack=n,this._baseDts=-1,this._baseVideoDts=-1,this._baseAudioDts=-1,this._baseDtsInited=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._needForceFixLargeGap=null==i?void 0:i.forceFixLargeGap,this._largeGapThreshold=(null==i?void 0:i.largeGapThreshold)||45e4}return Ig(e,[{key:"fix",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t=Math.round(9e4*t);var i=this.videoTrack,a=this.audioTrack,o=i.samples,s=a.samples;if(o.length||s.length){var u=o[0],c=s[0],l=0;if(o.length&&s.length&&(l=u.dts-c.pts),this._baseDtsInited||this._calculateBaseDts(this.audioTrack,this.videoTrack),r&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=t,this._baseAudioDts-=t,this._baseVideoDts-=t),!n){this._videoNextDts=l>0?t+l:t,this._audioNextPts=l>0?t:t-l,this._needForceFixLargeGap&&(this._videoNextDts=0,this._audioNextPts=0);var f=u?u.dts-this._baseDts-this._videoNextDts:0,h=c?c.pts-this._baseDts-this._audioNextPts:0;Math.abs(f||h)>M_&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=t)}if(this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(a),this._fixVideo(i),this.metadataTrack.exist()){var d=this.metadataTrack.timescale;this.metadataTrack.seiSamples.forEach((function(t){t.pts=t.originPts-e._baseDts,t.time=Math.max(0,t.pts)/d}))}i.samples.length&&(i.baseMediaDecodeTime=i.samples[0].dts),a.samples.length&&(a.baseMediaDecodeTime=a.samples[0].pts*a.timescale/9e4)}}},{key:"_fixVideo",value:function(e){var t=this,r=e.samples;if(r.length){if(r.forEach((function(e){e.dts-=t._needForceFixLargeGap?t._baseVideoDts:t._baseDts,e.pts-=t._needForceFixLargeGap?t._baseVideoDts:t._baseDts})),void 0===this._videoNextDts){var n=r[0];this._videoNextDts=n.dts}var i,a,o=r.length,s=0,u=r[0],c=r[1],l=this._videoNextDts-u.dts;if(Math.abs(l)>45e3)if(e.warnings.push({type:i_,nextDts:this._videoNextDts/90,firstSampleDts:u.dts/90,nextSampleDts:((null===(i=r[1])||void 0===i?void 0:i.dts)||0)/90,sampleDuration:l/90}),u.dts+=l,u.pts+=l,c&&Math.abs(c.dts-u.dts)>M_)this._videoTimestampBreak=!0,r.forEach((function(e,t){0!==t&&(e.dts+=l,e.pts+=l)}));else for(var f=1;f<o-1;f++){var h,d=null===(h=r[f])||void 0===h?void 0:h.dts,p=r[f-1].dts;d&&d-p<0&&(r[f].dts+=l,r[f].pts+=l)}if(e.fpsNum&&e.fpsDen&&(a=e.timescale*(e.fpsDen/e.fpsNum)),a<900&&(a=0),!a){var v=e.samples[0],m=e.samples[1];a=1===o?9e3:Math.floor(m.dts-v.dts)}for(var y=0;y<o;y++){var g=r[y].dts,_=r[y+1];if((s=y<o-1?_.dts-g:r[y-1]?Math.min(g-r[y-1].dts,a):a)>M_||s<0){this._videoTimestampBreak=!0,s=this._audioTimestampBreak?a:Math.max(s,2700);var b=this._audioNextPts||0;_&&_.dts>b&&(s=a),e.warnings.push({type:n_,time:g/e.timescale,dts:g,originDts:r[y].originDts,nextDts:this._videoNextDts,sampleDuration:s,refSampleDuration:a})}r[y].duration=s,this._videoNextDts+=s}}}},{key:"_fixAudio",value:function(e){var t=this,r=e.samples;r.length&&(r.forEach((function(e){e.pts-=t._needForceFixLargeGap?t._baseAudioDts:t._baseDts,e.dts=e.pts})),this._doFixAudioInternal(e,r,9e4))}},{key:"_calculateBaseDts",value:function(e,t){var r=e.samples,n=t.samples;if(!r.length&&!n.length)return!1;var i=1/0,a=1/0;r.length&&(e.baseDts=i=r[0].pts,this._baseAudioDts=i),n.length&&(t.baseDts=a=n[0].dts,this._baseVideoDts=a),this._baseDts=Math.min(i,a);var o=a-i,s=!1;return Number.isFinite(o)&&Math.abs(o)>45e3&&t.warnings.push({type:r_,videoBaseDts:a,audioBasePts:i,baseDts:this._baseDts,delta:o}),Number.isFinite(o)&&Math.abs(o)>this._largeGapThreshold*R_&&(s=!0),this._baseDtsInited||(s&&this._needForceFixLargeGap?this._needForceFixLargeGap=!0:this._needForceFixLargeGap=!1),this._baseDtsInited=!0,!0}},{key:"_resetBaseDtsWhenStreamBreaked",value:function(){if(this._baseDtsInited&&this._videoTimestampBreak&&this._audioTimestampBreak){if(!this._calculateBaseDts(this.audioTrack,this.videoTrack))return;this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts),this._audioLastSample=null,this._videoLastSample=null,this._videoTimestampBreak=!1,this._audioTimestampBreak=!1}}},{key:"_doFixAudioInternal",value:function(e,t,r){e.sampleDuration||(e.sampleDuration=b_.getFrameDuration(e.timescale,r));var n=e.sampleDuration;if(void 0===this._audioNextPts){var i=t[0];this._audioNextPts=i.pts}for(var a=0;a<t.length;a++){var o=this._audioNextPts,s=t[a],u=s.pts-o;if(!this._audioTimestampBreak&&u>=3*n&&u<=R_&&!y_){var c=b_.getSilentFrame(e.codec,e.channelCount)||t[0].data.subarray(),l=Math.floor(u/n);Math.abs(s.pts-this._lastAudioExceptionGapDot)>I_&&(this._lastAudioExceptionGapDot=s.pts),e.warnings.push({type:o_,pts:s.pts/90,originPts:s.originPts,count:l,nextPts:o/90,refSampleDuration:n});for(var f=0;f<l;f++){var h=new f_(Math.floor(o),c);h.originPts=Math.floor(this._baseDts+o),t.splice(a,0,h),this._audioNextPts+=n,a++}a--}else u<=-3*n&&u>=-9e4?(Math.abs(s.pts-this._lastAudioExceptionOverlapDot)>I_&&(this._lastAudioExceptionOverlapDot=s.pts,e.warnings.push({type:s_,pts:s.pts/90,originPts:s.originPts,nextPts:o/90,refSampleDuration:n})),t.splice(a,1),a--):(Math.abs(u)>=R_&&(this._audioTimestampBreak=!0,Math.abs(s.pts-this._lastAudioExceptionLargeGapDot)>I_&&(this._lastAudioExceptionLargeGapDot=s.pts,e.warnings.push({type:a_,time:s.pts/1e3,pts:s.pts/90,originPts:s.originPts,nextPts:o/90,sampleDuration:u,refSampleDuration:n}))),s.dts=s.pts=o,this._audioNextPts+=n)}}}]),e}(),U_=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],N_=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],F_=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],j_=[0,1,1,4],V_=null,G_=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"isHeader",value:function(e,t){return t+1<e.length&&255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}},{key:"appendFrame",value:function(t,r,n,i,a){if(!(n+24>r.length)){var o=e.parseHeader(r,n);if(o&&n+o.frameLength<=r.length){var s=i+a*(9e4*o.samplesPerFrame/o.sampleRate),u={data:r.subarray(n,n+o.frameLength),pts:s,dts:s};return u.size=u.data.byteLength,t.config=[],t.channelCount=o.channelCount,t.sampleRate=o.sampleRate,t.container="audio/mpeg",t.samples.push(u),{length:o.frameLength}}}}},{key:"parseHeader",value:function(e,t){var r=e[t+1]>>3&3,n=e[t+1]>>1&3,i=e[t+2]>>4&15,a=e[t+2]>>2&3;if(1!==r&&0!==i&&15!==i&&3!==a){var o=e[t+2]>>1&1,s=e[t+3]>>6,u=1e3*U_[14*(3===r?3-n:3===n?3:4)+i-1],c=N_[3*(3===r?0:2===r?1:2)+a],l=3===s?1:2,f=F_[r][n],h=j_[n],d=8*f*h,p=Math.floor(f*u/c+o)*h;if(null===V_){var v=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);V_=v?parseInt(v[1]):0}return!!V_&&V_<=87&&2===n&&u>=224e3&&0===s&&(e[t+3]=128|e[t+3]),{sampleRate:c,channelCount:l,frameLength:p,samplesPerFrame:d}}}}]),e}(),z_=new p_("TsDemuxer"),H_=function(){function e(t,r,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Pg(this,e),Mg(this,"_pmtId",-1),Mg(this,"_remainingPacketData",null),Mg(this,"_videoPesData",[]),Mg(this,"_audioPesData",[]),Mg(this,"_gopId",0),this.videoTrack=t||new u_,this.audioTrack=r||new c_,this.metadataTrack=n||new d_,this._fixer=new B_(this.videoTrack,this.audioTrack,this.metadataTrack,i)}return Ig(e,[{key:"demux",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=this.audioTrack,i=this.videoTrack,a=this.metadataTrack;t&&(this._pmtId=-1,i.reset(),n.reset(),a.reset()),!r||t?(this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[]):(i.samples=[],n.samples=[],a.seiSamples=[],i.warnings=[],n.warnings=[],this._remainingPacketData&&(e=S_(this._remainingPacketData,e),this._remainingPacketData=null));var o=e.length,s=o%188;s&&(this._remainingPacketData=e.subarray(o-s),o-=s);for(var u=i.pid,c=n.pid,l=0;l<o;l+=188){if(71!==e[l])throw new Error("TS packet did not start with 0x47");var f=!!(64&e[l+1]),h=((31&e[l+1])<<8)+e[l+2],d=void 0;if((48&e[l+3])>>4>1){if((d=l+5+e[l+4])===l+188)continue}else d=l+4;switch(h){case 0:f&&(d+=e[d]+1),this._pmtId=(31&e[d+10])<<8|e[d+11];break;case this._pmtId:f&&(d+=e[d]+1);var p=d+3+((15&e[d+1])<<8|e[d+2])-4;for(d+=12+((15&e[d+10])<<8|e[d+11]);d<p;){var v=(31&e[d+1])<<8|e[d+2];switch(e[d]){case 15:n.pid=c=v;break;case 3:case 4:n.pid=c=v,n.codecType=t_;break;case 27:if(-1!==u)break;i.codecType=Xg,i.pid=u=v;break;case 36:if(-1!==u)break;i.codecType=Qg,i.pid=u=v;break;default:z_.warn("Unsupported stream. type: ".concat(e[d],", pid: ").concat(v))}d+=5+((15&e[d+3])<<8|e[d+4])}break;case u:f&&this._videoPesData.length&&this._parseVideoData(),this._videoPesData.push(e.subarray(d,l+188));break;case c:f&&this._audioPesData.length&&this._parseAudioData(),this._audioPesData.push(e.subarray(d,l+188));break;case 17:case 8191:break;default:z_.warn("Unknown pid: ".concat(h))}}return this._parseVideoData(),this._parseAudioData(),n.formatTimescale=i.formatTimescale=i.timescale=a.timescale=9e4,n.timescale=n.sampleRate||0,{videoTrack:i,audioTrack:n,metadataTrack:a}}},{key:"fix",value:function(e,t,r){return this._fixer.fix(e,t,r),{videoTrack:this.videoTrack,audioTrack:this.audioTrack,metadataTrack:this.metadataTrack}}},{key:"demuxAndFix",value:function(e,t,r,n){return this.demux(e,t,r),this.fix(n,t,r)}},{key:"_parseVideoData",value:function(){if(this._videoPesData.length){var t=e._parsePES(S_.apply(void 0,Vg(this._videoPesData)));if(t){var r=O_.parseAnnexB(t.data);r?this._createVideoSample(r,t.pts,t.dts):z_.warn("Cannot parse avc units",t),this._videoPesData=[]}else z_.warn("Cannot parse video pes",this._videoPesData)}}},{key:"_createVideoSample",value:function(e,t,r){var n=this;if(e.length){var i=this.videoTrack,a=i.codecType===Qg,o=new l_(t,r);e.forEach((function(e){var r=a?e[0]>>>1&63:31&e[0];switch(r){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!a&&5!==r||a&&5===r)break;o.setToKeyframe(),n._gopId++;break;case 6:case 39:case 40:if(!a&&6!==r||a&&6===r)break;return void n.metadataTrack.seiSamples.push(new h_(O_.parseSEI(O_.removeEPB(e),a),t));case 32:if(!a)break;if(!i.vps.length){var s=P_.parseVPS(O_.removeEPB(e),i.hvcC);i.hvcC=i.hvcC||s,i.vps=[e]}break;case 7:case 33:if(!a&&7!==r||a&&7===r)break;if(!i.sps.length){var u=O_.removeEPB(e),c=a?P_.parseSPS(u,i.hvcC):C_.parseSPS(u);i.sps=[e],i.hvcC=i.hvcC||c.hvcC,i.codec=c.codec,i.width=c.width,i.height=c.height,i.sarRatio=c.sarRatio,i.fpsNum=c.fpsNum,i.fpsDen=c.fpsDen}break;case 8:case 34:if(!a&&8!==r||a&&8===r)break;i.pps.length||(i.pps=[e]);break;case 9:case 35:break;case 38:if(a){for(var l=!1,f=2;f<e.byteLength;f++)if(255===e[f]){l=!0;break}if(!l)return}}o.units.push(e)})),o.gopId=this._gopId,this._pushVideoSample(i,o)}}},{key:"_pushVideoSample",value:function(e,t){if(t.units.length)if(null===t.pts||void 0===t.pts){z_.warn("Video sample no pts",t);var r=e.samples[e.samples.length-1];r?(t.pts=r.pts,t.dts=r.dts):z_.warn("Drop video sample",t)}else e.samples.push(t)}},{key:"_parseAudioData",value:function(){if(this._audioPesData.length){var t=e._parsePES(S_.apply(void 0,Vg(this._audioPesData)));if(t){switch(this.audioTrack.codecType){case $g:this._parseAacData(t);break;case t_:this._parseMPEG(t)}this._audioPesData=[]}else z_.warn("Cannot parse audio pes",this._audioPesData)}}},{key:"_parseAacData",value:function(e){var t=this.audioTrack,r=e.pts;if(null==r){if(z_.warn("AAC pes not pts",t),!t.samples.length||!t.sampleRate)return;r=t.samples[t.samples.length-1].pts+b_.getFrameDuration(t.sampleRate)}var n,i=b_.parseADTS(e.data,r);i?(t.codec=i.codec,t.channelCount=i.channelCount,t.sampleRate=i.sampleRate,t.objectType=i.objectType,t.sampleRateIndex=i.samplingFrequencyIndex,t.config=i.config,(n=t.samples).push.apply(n,Vg(i.frames.map((function(e){return new f_(e.pts,e.data)})))),i.skip&&z_.warn("Skip aac adts ".concat(i.skip," bits")),i.remaining&&z_.warn("Remaining aac adts ".concat(i.remaining," bits"))):z_.warn("Cannot parse aac adts",e)}},{key:"_parseMPEG",value:function(e){var t=e.data,r=t.length,n=0,i=0,a=e.pts;if(void 0!==a)for(;i<r;)if(G_.isHeader(t,i)){var o=G_.appendFrame(this.audioTrack,t,i,a,n);if(!o)break;i+=o.length,n++}else i++;else z_.warn("[tsdemuxer]: MPEG PES unknown PTS")}}],[{key:"probe",value:function(e){return!!e.length&&(71===e[0]&&71===e[188]&&71===e[376])}},{key:"_parsePES",value:function(e){var t=e[8];if(!(null==t||e.length<t+9)&&1===(e[0]<<16|e[1]<<8|e[2])){var r=(e[4]<<8)+e[5];if(!(r&&r>e.length-6)){var n,i,a=e[7];return 192&a&&(n=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&a?n-(i=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2)>54e5&&(n=i):i=n),{data:e.subarray(9+t),pts:n,dts:i}}}}}]),e}(),q_=function(){function e(t,r,n){Pg(this,e),this.dv=new DataView(t),this.start=this.offset=r||this.dv.byteOffset,this.end=n?this.start+n:this.start+this.dv.byteLength}return Ig(e,[{key:"buffer",get:function(){return this.dv.buffer}},{key:"unreadLength",get:function(){return Math.max(this.end-this.offset,0)}},{key:"size",get:function(){return this.end-this.start}},{key:"readFloat",value:function(e){var t=0;switch(e){case 4:t=this.dv.getFloat32(this.offset);break;case 8:t=this.dv.getFloat64(this.offset);break;default:throw new Error("read ".concat(e,"-byte float is not supported"))}return this.offset+=e,t}},{key:"back",value:function(e){this.offset-=e}},{key:"skip",value:function(e){this.offset+=e}},{key:"readInt",value:function(e){var t=this.offset;switch(this.offset+=e,e){case 1:return this.dv.getInt8(t);case 2:return this.dv.getInt16(t);case 4:return this.dv.getInt32(t);default:throw new Error("read ".concat(e,"-byte integers is not supported"))}}},{key:"read",value:function(e){var t=this.offset;switch(this.offset+=e,e){case 1:return this.dv.getUint8(t);case 2:return this.dv.getUint16(t);case 3:return(this.dv.getUint16(t)<<8)+this.dv.getUint8(t+2);case 4:return this.dv.getUint32(t);default:return this.back(e-4),this.read(e-4)+this.dv.getUint32(t)*Math.pow(256,e-4)}}},{key:"write",value:function(e,t){var r=this.offset;switch(this.offset+=e,e){case 1:return this.dv.setUint8(r,t);case 2:return this.dv.setUint16(r,t);case 3:return this.dv.setUint8(r,t>>>16),this.dv.setUint16(r+1,65535&t);case 4:return this.dv.setUint32(r,t);default:throw new Error("write ".concat(e,"-byte integers is not supported"))}}},{key:"readToBuffer",value:function(e){var t;return t=this.offset||e?this.dv.buffer.slice(this.offset,e?this.offset+e:this.end):this.dv.buffer,this.offset+=t.byteLength,t}},{key:"readToUint8",value:function(e){var t=new Uint8Array(this.dv.buffer,this.offset,e||this.unreadLength);return this.offset+=t.byteLength,t}},{key:"readString",value:function(e){for(var t=0,r="";t<e;t++)r+=String.fromCharCode(this.dv.getUint8(this.offset)),this.offset++;return r}}],[{key:"fromUint8",value:function(t){return new e(t.buffer,t.byteOffset,t.byteLength)}},{key:"concatUint8s",value:function(e){var t=new Uint8Array(e.reduce((function(e,t){return e+t.byteLength}),0)),r=0;return e.forEach((function(e){t.set(e,r),r+=e.byteLength})),t}},{key:"concatUint8",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.concatUint8s(t)}}]),e}(),Y_=function(){function e(t,r){Pg(this,e),this.offset=0,this.val=t,this.size=r}return Ig(e,[{key:"skip",value:function(e){this.offset+=e}},{key:"read",value:function(e){var t=this.size-this.offset-e;if(t>=0){var r=0,n=0;if(this.offset+=e,this.size>31){for(;n<e;n++)r+=Math.pow(2,n);return this.val/Math.pow(2,t)&r}for(;n<e;n++)r+=1<<n;return this.val>>>t&r}throw new Error("the number of the read operation exceeds the total length limit of bits")}}],[{key:"fromByte",value:function(t,r){return new e(t.read(r),r<<3)}}]),e}(),K_=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"findBox",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[];if(!t)return i;for(var a=0,o="",s=0;t.length>7;){if(a=w_(t),o=String.fromCharCode.apply(null,t.subarray(4,8)),s=8,1===a?(a=x_(t,8),s+=8):a||(a=t.length),!r[0]||o===r[0]){var u=t.subarray(0,a);if(!(r.length<2))return e.findBox(u.subarray(s),r.slice(1),n+s);i.push({start:n,size:a,headerSize:s,type:o,data:u})}n+=a,t=t.subarray(a)}return i}},{key:"tfhd",value:function(e){return $_(e,!0,(function(e,t){e.trackId=w_(t);var r=4,n=1&e.flags,i=2&e.flags,a=8&e.flags,o=16&e.flags,s=32&e.flags;n&&(r+=4,e.baseDataOffset=w_(t,r),r+=4),i&&(e.sampleDescriptionIndex=w_(t,r),r+=4),a&&(e.defaultSampleDuration=w_(t,r),r+=4),o&&(e.defaultSampleSize=w_(t,r),r+=4),s&&(e.defaultSampleFlags=w_(t,r))}))}},{key:"sidx",value:function(e){return $_(e,!0,(function(e,t){var r=0;e.reference_ID=w_(t,r),r+=4,e.timescale=w_(t,r),r+=4,0===e.version?(e.earliest_presentation_time=w_(t,r),r+=4,e.first_offset=w_(t,r),r+=4):(e.earliest_presentation_time=x_(t,r),r+=8,e.first_offset=x_(t,r),r+=8),r+=2,e.references=[];var n=E_(t,r);r+=2;for(var i=0;i<n;i++){var a={};e.references.push(a);var o=w_(t,r);r+=4,a.reference_type=o>>31&1,a.referenced_size=2147483647&o,a.subsegment_duration=w_(t,r),o=w_(t,r+=4),r+=4,a.starts_with_SAP=o>>31&1,a.SAP_type=o>>28&7,a.SAP_delta_time=268435455&o}}))}},{key:"moov",value:function(t){return $_(t,!1,(function(t,r,n){t.mvhd=e.mvhd(e.findBox(r,["mvhd"],n)[0]),t.trak=e.findBox(r,["trak"],n).map((function(t){return e.trak(t)})),t.pssh=e.pssh(e.findBox(r,["pssh"],n)[0])}))}},{key:"mvhd",value:function(e){return $_(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=w_(t,16),e.duration=x_(t,20),r+=28):(e.timescale=w_(t,8),e.duration=w_(t,12),r+=16),e.nextTrackId=w_(t,r+76)}))}},{key:"trak",value:function(t){return $_(t,!1,(function(t,r,n){t.tkhd=e.tkhd(e.findBox(r,["tkhd"],n)[0]),t.mdia=e.mdia(e.findBox(r,["mdia"],n)[0])}))}},{key:"tkhd",value:function(e){return $_(e,!0,(function(e,t){var r=q_.fromUint8(t);1===e.version?(r.read(8),r.read(8),e.trackId=r.read(4),r.read(4),e.duration=r.read(8)):(r.read(4),r.read(4),e.trackId=r.read(4),r.read(4),e.duration=r.read(4)),r.skip(16),e.matrix=[];for(var n=0;n<36;n++)e.matrix.push(r.read(1));r.back(36);for(var i,a=[],o=0;o<3;o++)a.push(D_(r.readInt(2),r.readInt(2))),a.push(D_(r.readInt(2),r.readInt(2))),i=r.readInt(4),a.push(D_(i>>30,1073741823&i));e.rotation=function(e){if(e.length<5)return 0;var t=Math.hypot(e[0],e[3]),r=Math.hypot(e[1],e[4]);return 0===t||0===r?0:180*Math.atan2(e[1]/r,e[0]/t)/Math.PI}(a),e.width=r.read(4),e.height=r.read(4)}))}},{key:"mdia",value:function(t){return $_(t,!1,(function(t,r,n){t.mdhd=e.mdhd(e.findBox(r,["mdhd"],n)[0]),t.hdlr=e.hdlr(e.findBox(r,["hdlr"],n)[0]),t.minf=e.minf(e.findBox(r,["minf"],n)[0])}))}},{key:"mdhd",value:function(e){return $_(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=w_(t,16),e.duration=x_(t,20),r+=28):(e.timescale=w_(t,8),e.duration=w_(t,12),r+=16);var n=E_(t,r);e.language=String.fromCharCode(96+(n>>10&31),96+(n>>5&31),96+(31&n))}))}},{key:"hdlr",value:function(e){return $_(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return $_(t,!1,(function(t,r,n){t.vmhd=e.vmhd(e.findBox(r,["vmhd"],n)[0]),t.smhd=e.smhd(e.findBox(r,["smhd"],n)[0]),t.stbl=e.stbl(e.findBox(r,["stbl"],n)[0])}))}},{key:"vmhd",value:function(e){return $_(e,!0,(function(e,t){e.graphicsmode=E_(t),e.opcolor=[E_(t,2),E_(t,4),E_(t,6)]}))}},{key:"smhd",value:function(e){return $_(e,!0,(function(e,t){e.balance=E_(t)}))}},{key:"stbl",value:function(t){return $_(t,!1,(function(t,r,n){var i,a,o;t.stsd=e.stsd(e.findBox(r,["stsd"],n)[0]),t.stts=e.stts(e.findBox(r,["stts"],n)[0]),t.ctts=e.ctts(e.findBox(r,["ctts"],n)[0]),t.stsc=e.stsc(e.findBox(r,["stsc"],n)[0]),t.stsz=e.stsz(e.findBox(r,["stsz"],n)[0]),t.stco=e.stco(e.findBox(r,["stco"],n)[0]),t.stco||(t.co64=e.co64(e.findBox(r,["co64"],n)[0]),t.stco=t.co64);var s=null===(i=t.stsd.entries[0])||void 0===i||null===(a=i.sinf)||void 0===a||null===(o=a.schi)||void 0===o?void 0:o.tenc.default_IV_size;t.stss=e.stss(e.findBox(r,["stss"],n)[0]),t.senc=e.senc(e.findBox(r,["senc"],n)[0],s)}))}},{key:"senc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return $_(e,!0,(function(e,r){var n=0,i=w_(r,n);n+=4,e.samples=[];for(var a=0;a<i;a++){for(var o={InitializationVector:[]},s=0;s<t;s++)o.InitializationVector[s]=r[n+s];if(n+=t,2&e.flags){o.subsamples=[];var u=E_(r,n);n+=2;for(var c=0;c<u;c++){var l={};l.BytesOfClearData=E_(r,n),n+=2,l.BytesOfProtectedData=w_(r,n),n+=4,o.subsamples.push(l)}}e.samples.push(o)}}))}},{key:"pssh",value:function(e){return $_(e,!0,(function(e,t){for(var r=[],n=[],i=0,a=0;a<16;a++)n.push(J_(t[i+a]));if(i+=16,e.version>0){var o=w_(t,i);i+=4;for(var s=0;s<(""+o).length;s++)for(var u=0;u<16;u++){var c=t[i];i+=1,r.push(J_(c))}}var l=w_(t,i);e.data_size=l,i+=4,e.kid=r,e.system_id=n,e.buffer=t}))}},{key:"stsd",value:function(t){return $_(t,!0,(function(t,r,n){t.entryCount=w_(r),t.entries=e.findBox(r.subarray(4),[],n+4).map((function(t){switch(t.type){case"av01":return e.av01(t);case"avc1":case"avc2":case"avc3":case"avc4":return e.avc1(t);case"hvc1":case"hev1":return e.hvc1(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return $_(t,!1,(function(t,r,n){t.channelCount=E_(r,16),t.samplesize=E_(r,18),t.sampleRate=w_(r,24)/65536,r=r.subarray(28),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.esds=e.esds(e.findBox(r,["esds"],n)[0])}));case"encv":return $_(t,!1,(function(t,r,n){t.width=E_(r,24),t.height=E_(r,26),t.horizresolution=w_(r,28),t.vertresolution=w_(r,32),r=r.subarray(78),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.avcC=e.avcC(e.findBox(r,["avcC"],n)[0]),t.hvcC=e.hvcC(e.findBox(r,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(r,["pasp"],n)[0])}))}})).filter(Boolean)}))}},{key:"tenc",value:function(e){return $_(e,!1,(function(e,t){var r=6;e.default_IsEncrypted=t[r],r+=1,e.default_IV_size=t[r],r+=1,e.default_KID=[];for(var n=0;n<16;n++)e.default_KID.push(J_(t[r])),r+=1}))}},{key:"schi",value:function(t){return $_(t,!1,(function(t,r,n){t.tenc=e.tenc(e.findBox(r,["tenc"],n)[0])}))}},{key:"sinf",value:function(t){return $_(t,!1,(function(t,r,n){t.schi=e.schi(e.findBox(r,["schi"],n)[0]),t.frma=e.frma(e.findBox(r,["frma"],n)[0])}))}},{key:"frma",value:function(e){return $_(e,!1,(function(e,t){e.data_format="";for(var r=0;r<4;r++)e.data_format+=String.fromCharCode(t[r])}))}},{key:"colr",value:function(e){return $_(e,!1,(function(t,r){var n=q_.fromUint8(r);t.data=e.data,t.colorType=n.readString(4),"nclx"===t.colorType?(t.colorPrimaries=n.read(2),t.transferCharacteristics=n.read(2),t.matrixCoefficients=n.read(2),t.fullRangeFlag=n.read(1)>>7):"rICC"!==t.colorType&&"prof"!==t.colorType||(t.iccProfile=r.readToUint8())}))}},{key:"av01",value:function(t){return $_(t,!1,(function(t,r,n){var i=X_(t,r),a=r.subarray(i);n+=i,t.av1C=e.av1C(e.findBox(a,["av1C"],n)[0]),t.colr=e.colr(e.findBox(a,["colr"],n)[0])}))}},{key:"av1C",value:function(e){return $_(e,!1,(function(t,r){t.data=e.data;var n,i=q_.fromUint8(r),a=Y_.fromByte(i,4);t.marker=a.read(1),t.version=a.read(7),t.seqProfile=a.read(3),t.seqLevelIdx0=a.read(5),t.seqTier0=a.read(1),t.highBitdepth=a.read(1),t.twelveBit=a.read(1),t.monochrome=a.read(1),t.chromaSubsamplingX=a.read(1),t.chromaSubsamplingY=a.read(1),t.chromaSamplePosition=a.read(2),t.reserved=a.read(3),t.initialPresentationDelayPresent=a.read(1),t.initialPresentationDelayPresent?t.initialPresentationDelayMinusOne=a.read(4):t.initialPresentationDelayMinusOne=0,t.configOBUs=i.readToUint8(),2===t.seqLevelIdx0&&1===t.highBitdepth?n=1===t.twelveBit?"12":"10":t.seqProfile<=2&&(n=1===t.highBitdepth?"10":"08"),t.codec=["av01",t.seqProfile,(t.seqLevelIdx0<10?"0"+t.seqLevelIdx0:t.seqLevelIdx0)+(t.seqTier0?"H":"M"),n].join(".")}))}},{key:"avc1",value:function(t){return $_(t,!1,(function(t,r,n){var i=X_(t,r),a=r.subarray(i);n+=i,t.avcC=e.avcC(e.findBox(a,["avcC"],n)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],n)[0])}))}},{key:"avcC",value:function(e){return $_(e,!1,(function(t,r){t.data=e.data,t.configurationVersion=r[0],t.AVCProfileIndication=r[1],t.profileCompatibility=r[2],t.AVCLevelIndication=r[3],t.codec=T_([r[1],r[2],r[3]]),t.lengthSizeMinusOne=3&r[4],t.spsLength=31&r[5],t.sps=[];for(var n=6,i=0;i<t.spsLength;i++){var a=E_(r,n);n+=2,t.sps.push(r.subarray(n,n+a)),n+=a}t.ppsLength=r[n],n+=1,t.pps=[];for(var o=0;o<t.ppsLength;o++){var s=E_(r,n);n+=2,t.pps.push(r.subarray(n,n+=s)),n+=s}}))}},{key:"hvc1",value:function(t){return $_(t,!1,(function(t,r,n){var i=X_(t,r),a=r.subarray(i);n+=i,t.hvcC=e.hvcC(e.findBox(a,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],n)[0])}))}},{key:"hvcC",value:function(e){return $_(e,!1,(function(t,r){t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=r[0];var n=r[1];t.generalProfileSpace=n>>6,t.generalTierFlag=(32&n)>>5,t.generalProfileIdc=31&n,t.generalProfileCompatibility=w_(r,2),t.generalConstraintIndicatorFlags=r.subarray(6,12),t.generalLevelIdc=r[12],t.avgFrameRate=E_(r,19),t.numOfArrays=r[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,a=0,o=0,s=0,u=0;u<t.numOfArrays;u++){a=63&r[i],o=E_(r,i+1),i+=3;for(var c,l=[],f=0;f<o;f++)s=E_(r,i),i+=2,l.push(r.subarray(i,i+s)),i+=s;if(32===a)(c=t.vps).push.apply(c,l);else if(33===a){var h;(h=t.sps).push.apply(h,l)}else if(34===a){var d;(d=t.pps).push.apply(d,l)}}}))}},{key:"pasp",value:function(e){return $_(e,!1,(function(e,t){e.hSpacing=w_(t),e.vSpacing=w_(t,4)}))}},{key:"mp4a",value:function(t){return $_(t,!1,(function(t,r,n){var i=Q_(t,r);t.esds=e.esds(e.findBox(r.subarray(i),["esds"],n+i)[0])}))}},{key:"esds",value:function(e){return $_(e,!0,(function(e,t){e.codec="mp4a.";for(var r=0,n=0,i=0,a=0;t.length;){for(a=t[r=0],n=t[r+1],r+=2;128&n;)i=(127&n)<<7,n=t[r],r+=1;if(i+=127&n,3===a)t=t.subarray(r+3);else{if(4!==a){if(5===a){var o=e.config=t.subarray(r,r+i),s=(248&o[0])>>3;return 31===s&&o.length>=2&&(s=32+((7&o[0])<<3)+((224&o[1])>>5)),e.objectType=s,e.codec+=s.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[r].toString(16)+".").padStart(3,"0"),t=t.subarray(r+13)}}}))}},{key:"alaw",value:function(e){return $_(e,!1,(function(e,t){Q_(e,t)}))}},{key:"stts",value:function(e){return $_(e,!0,(function(e,t){for(var r=w_(t),n=[],i=4,a=0;a<r;a++)n.push({count:w_(t,i),delta:w_(t,i+4)}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"ctts",value:function(e){return $_(e,!0,(function(e,t){var r=w_(t),n=[],i=4;if(1===e.version)for(var a=0;a<r;a++)n.push({count:w_(t,i),offset:w_(t,i+4)}),i+=8;else for(var o=0;o<r;o++)n.push({count:w_(t,i),offset:-(1+~w_(t,i+4))}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stsc",value:function(e){return $_(e,!0,(function(e,t){for(var r=w_(t),n=[],i=4,a=0;a<r;a++)n.push({firstChunk:w_(t,i),samplesPerChunk:w_(t,i+4),sampleDescriptionIndex:w_(t,i+8)}),i+=12;e.entryCount=r,e.entries=n}))}},{key:"stsz",value:function(e){return $_(e,!0,(function(e,t){var r=w_(t),n=w_(t,4),i=[];if(!r)for(var a=8,o=0;o<n;o++)i.push(w_(t,a)),a+=4;e.sampleSize=r,e.sampleCount=n,e.entrySizes=i}))}},{key:"stco",value:function(e){return $_(e,!0,(function(e,t){for(var r=w_(t),n=[],i=4,a=0;a<r;a++)n.push(w_(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"co64",value:function(e){return $_(e,!0,(function(e,t){for(var r=w_(t),n=[],i=4,a=0;a<r;a++)n.push(x_(t,i)),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stss",value:function(e){return $_(e,!0,(function(e,t){for(var r=w_(t),n=[],i=4,a=0;a<r;a++)n.push(w_(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"moof",value:function(t){return $_(t,!1,(function(t,r,n){t.mfhd=e.mfhd(e.findBox(r,["mfhd"],n)[0]),t.traf=e.findBox(r,["traf"],n).map((function(t){return e.traf(t)}))}))}},{key:"mfhd",value:function(e){return $_(e,!0,(function(e,t){e.sequenceNumber=w_(t)}))}},{key:"traf",value:function(t){return $_(t,!1,(function(t,r,n){t.tfhd=e.tfhd(e.findBox(r,["tfhd"],n)[0]),t.tfdt=e.tfdt(e.findBox(r,["tfdt"],n)[0]),t.trun=e.trun(e.findBox(r,["trun"],n)[0])}))}},{key:"trun",value:function(e){return $_(e,!0,(function(e,t){var r=e.version,n=e.flags,i=t.length,a=e.sampleCount=w_(t),o=4;if(i>o&&1&n&&(e.dataOffset=-(1+~w_(t,o)),o+=4),i>o&&4&n&&(e.firstSampleFlags=w_(t,o),o+=4),e.samples=[],i>o)for(var s,u=0;u<a;u++)s={},256&n&&(s.duration=w_(t,o),o+=4),512&n&&(s.size=w_(t,o),o+=4),1024&n&&(s.flags=w_(t,o),o+=4),2048&n&&(s.cts=r?-(1+~w_(t,o+4)):w_(t,o),o+=4),e.samples.push(s)}))}},{key:"tfdt",value:function(e){return $_(e,!0,(function(e,t){1===e.version?e.baseMediaDecodeTime=x_(t):e.baseMediaDecodeTime=w_(t)}))}},{key:"probe",value:function(t){return!!e.findBox(t,["ftyp"])}},{key:"parseSampleFlags",value:function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}},{key:"moovToTrack",value:function(e,t,r){var n,i,a=e.trak;if(a&&a.length){var o=a.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),s=a.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(o&&t){var u,c,l,f,h,d,p,v=t,m=null===(u=o.tkhd)||void 0===u?void 0:u.trackId;null!=m&&(v.id=o.tkhd.trackId),v.tkhdDuration=o.tkhd.duration,v.mvhdDurtion=e.mvhd.duration,v.mvhdTimecale=e.mvhd.timescale,v.timescale=v.formatTimescale=o.mdia.mdhd.timescale,v.duration=o.mdia.mdhd.duration||v.mvhdDurtion/v.mvhdTimecale*v.timescale,v.rotation=o.tkhd.rotation,v.matrix=o.tkhd.matrix;var y,g,_,b,S,k,E,w,x=o.mdia.minf.stbl.stsd.entries[0];if(v.width=x.width,v.height=x.height,x.pasp&&(v.sarRatio=[x.pasp.hSpacing,x.pasp.vSpacing]),x.av1C)v.codecType=Wg,v.codec=x.av1C.codec,v.av1C=x.av1C.data,v.colr=x.colr.data;else if(x.hvcC)v.codecType=Qg,v.codec=x.hvcC.codec,v.vps=x.hvcC.vps,v.sps=x.hvcC.sps,v.pps=x.hvcC.pps,v.hvcC=x.hvcC.data;else{if(!x.avcC)throw new Error("unknown video stsd entry");v.codec=x.avcC.codec,v.sps=x.avcC.sps,v.pps=x.avcC.pps}if(v.present=!0,v.ext={},v.ext.stss=null===(c=o.mdia)||void 0===c||null===(l=c.minf)||void 0===l||null===(f=l.stbl)||void 0===f?void 0:f.stss,v.ext.ctts=null===(h=o.mdia)||void 0===h||null===(d=h.minf)||void 0===d||null===(p=d.stbl)||void 0===p?void 0:p.ctts,x&&"encv"===x.type)v.isVideoEncryption=!0,x.default_KID=null===(y=x.sinf)||void 0===y||null===(g=y.schi)||void 0===g?void 0:g.tenc.default_KID,x.default_IsEncrypted=null===(_=x.sinf)||void 0===_||null===(b=_.schi)||void 0===b?void 0:b.tenc.default_IsEncrypted,x.default_IV_size=null===(S=x.sinf)||void 0===S||null===(k=S.schi)||void 0===k?void 0:k.tenc.default_IV_size,v.videoSenc=o.mdia.minf.stbl.senc&&o.mdia.minf.stbl.senc.samples,x.data_format=null===(E=x.sinf)||void 0===E||null===(w=E.frma)||void 0===w?void 0:w.data_format,v.useEME=e.useEME,v.kidValue=e.kidValue,v.pssh=e.pssh,v.encv=x}if(s&&r){var T,A,D,O,L,C,P,R,I,M=r,B=null===(T=s.tkhd)||void 0===T?void 0:T.trackId;null!=B&&(M.id=s.tkhd.trackId),M.tkhdDuration=s.tkhd.duration,M.mvhdDurtion=e.mvhd.duration,M.mvhdTimecale=e.mvhd.timescale,M.timescale=M.formatTimescale=s.mdia.mdhd.timescale,M.duration=s.mdia.mdhd.duration||M.mvhdDurtion/M.mvhdTimecale*M.timescale;var U,N,F,j,V,G,z,H,q=s.mdia.minf.stbl.stsd.entries[0];switch(M.sampleSize=q.sampleSize,M.sampleRate=q.sampleRate,M.channelCount=q.channelCount,M.present=!0,q.type){case"alaw":M.codecType=M.codec=Jg,M.sampleRate=8e3;break;case"ulaw":M.codecType=M.codec=Zg,M.sampleRate=8e3;break;default:M.sampleDuration=b_.getFrameDuration(M.sampleRate,M.timescale),M.sampleRateIndex=b_.getRateIndexByRate(M.sampleRate),M.objectType=(null===(n=q.esds)||void 0===n?void 0:n.objectType)||2,q.esds&&(M.config=Array.from(q.esds.config)),M.codec=(null===(i=q.esds)||void 0===i?void 0:i.codec)||"mp4a.40.2"}if(M.sampleDuration=b_.getFrameDuration(M.sampleRate,M.timescale),M.objectType=(null===(A=q.esds)||void 0===A?void 0:A.objectType)||2,q.esds&&(q.esds.config?M.config=Array.from(q.esds.config):console.warn("esds config is null")),M.codec=(null===(D=q.esds)||void 0===D?void 0:D.codec)||"mp4a.40.2",M.sampleRateIndex=b_.getRateIndexByRate(M.sampleRate),M.ext={},M.ext.stss=null===(O=s.mdia)||void 0===O||null===(L=O.minf)||void 0===L||null===(C=L.stbl)||void 0===C?void 0:C.stss,M.ext.ctts=null===(P=s.mdia)||void 0===P||null===(R=P.minf)||void 0===R||null===(I=R.stbl)||void 0===I?void 0:I.ctts,M.present=!0,q&&"enca"===q.type)M.isAudioEncryption=!0,q.data_format=null===(U=q.sinf)||void 0===U||null===(N=U.frma)||void 0===N?void 0:N.data_format,q.default_KID=null===(F=q.sinf)||void 0===F||null===(j=F.schi)||void 0===j?void 0:j.tenc.default_KID,q.default_IsEncrypted=null===(V=q.sinf)||void 0===V||null===(G=V.schi)||void 0===G?void 0:G.tenc.default_IsEncrypted,q.default_IV_size=null===(z=q.sinf)||void 0===z||null===(H=z.schi)||void 0===H?void 0:H.tenc.default_IV_size,M.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,M.useEME=e.useEME,M.kidValue=e.kidValue,M.enca=q}if(r&&(r.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!r&&r.isAudioEncryption),null!=t&&t.encv||null!=r&&r.enca){var Y,K,W=null==t||null===(Y=t.encv)||void 0===Y?void 0:Y.default_KID,X=null==r||null===(K=r.enca)||void 0===K?void 0:K.default_KID,Q=W||X?(W||X).join(""):null;t&&(t.kid=Q),r&&(r.kid=Q)}return t&&(t.flags=3841),r&&(r.flags=1793),{videoTrack:t,audioTrack:r}}}},{key:"evaluateDefaultDuration",value:function(e,t,r){var n,i=null==t||null===(n=t.samples)||void 0===n?void 0:n.length;return i?1024*i/t.timescale*e.timescale/r:1024}},{key:"moofToSamples",value:function(t,r,n){var i={};return t.mfhd&&(r&&(r.sequenceNumber=t.mfhd.sequenceNumber),n&&(n.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach((function(t){var a=t.tfhd,o=t.tfdt,s=t.trun;if(a&&s){o&&(r&&r.id===a.trackId&&(r.baseMediaDecodeTime=o.baseMediaDecodeTime),n&&n.id===a.trackId&&(n.baseMediaDecodeTime=o.baseMediaDecodeTime));var u=a.defaultSampleSize||0,c=a.defaultSampleDuration||e.evaluateDefaultDuration(r,n,s.samples.length||s.sampleCount),l=s.dataOffset||0,f=0,h=-1;if(!s.samples.length&&s.sampleCount){i[a.trackId]=[];for(var d=0;d<s.sampleCount;d++)i[a.trackId].push({offset:l,dts:f,duration:c,size:u}),f+=c,l+=u}else i[a.trackId]=s.samples.map((function(e,t){return(e={offset:l,dts:f,pts:f+(e.cts||0),duration:e.duration||c,size:e.size||u,gopId:h,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(h++,e.gopId=h),f+=e.duration,l+=e.size,e}))}})),i}},{key:"moovToSamples",value:function(e){var t=e.trak;if(t&&t.length){var r=t.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),n=t.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(r||n){var i,a;if(r){var o,s,u=null===(o=r.mdia)||void 0===o||null===(s=o.minf)||void 0===s?void 0:s.stbl;if(!u)return;var c=u.stts,l=u.stsc,f=u.stsz,h=u.stco,d=u.stss,p=u.ctts;if(!(c&&l&&f&&h&&d))return;i=W_(c,l,f,h,p,d)}if(n){var v,m,y,g=null===(v=n.mdia)||void 0===v||null===(m=v.minf)||void 0===m?void 0:m.stbl;if(!g)return;var _=null===(y=n.mdia.mdhd)||void 0===y?void 0:y.timescale,b=g.stts,S=g.stsc,k=g.stsz,E=g.stco;if(!(_&&b&&S&&k&&E))return;a=W_(b,S,k,E)}return{videoSamples:i,audioSamples:a}}}}}]),e}();function W_(e,t,r,n,i,a){var o,s,u,c=[],l=null==i?void 0:i.entries,f=t.entries,h=n.entries,d=r.entrySizes,p=null==a?void 0:a.entries;p&&(o={},p.forEach((function(e){o[e-1]=!0}))),l&&(s=[],l.forEach((function(e){for(var t=e.count,r=e.offset,n=0;n<t;n++)s.push(r)})));var v=-1,m=0,y=0,g=0,_=0,b=0,S=f[0].samplesPerChunk,k=f[1]?f[1].firstChunk-1:1/0;return e.entries.forEach((function(e){for(var t=e.count,n=e.delta,i=0;i<t;i++)u={dts:m,duration:n,size:d[y]||r.sampleSize,offset:h[g]+b,index:y},p&&(u.keyframe=o[y],u.keyframe&&v++,u.gopId=v),s&&y<s.length&&(u.pts=u.dts+s[y]),c.push(u),m+=n,++y<S?b+=u.size:(g++,b=0,g>=k&&(_++,k=f[_+1]?f[_+1].firstChunk-1:1/0),S+=f[_].samplesPerChunk)})),c}function X_(e,t){return e.dataReferenceIndex=E_(t,6),e.width=E_(t,24),e.height=E_(t,26),e.horizresolution=w_(t,28),e.vertresolution=w_(t,32),e.frameCount=E_(t,40),e.depth=E_(t,74),78}function Q_(e,t){return e.dataReferenceIndex=E_(t,6),e.channelCount=E_(t,16),e.sampleSize=E_(t,18),e.sampleRate=w_(t,24)/65536,28}function $_(e,t,r){if(e){if(e.size!==e.data.length)throw new Error("box ".concat(e.type," size !== data.length"));var n={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(n.version=e.data[e.headerSize],n.flags=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),n.headerSize+=4),r(n,e.data.subarray(n.headerSize),n.start+n.headerSize),n}}var J_=function(){for(var e=[],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.forEach((function(t){e.push(function(e,t,r){for(var n=String(r),i=t>>0,a=Math.ceil(i/n.length),o=[],s=String(e);a--;)o.push(n);return o.join("").substring(0,i-s.length)+s}(Number(t).toString(16),2,0))})),e[0]},Z_=function(){function e(t,r,n){Pg(this,e),Mg(this,"__loadedMoofWraps",[]),Mg(this,"__lastRemainData",null),Mg(this,"__lastRemainDataStart",0),Mg(this,"__nextMoofStart",-1),this.videoTrack=t||new u_,this.audioTrack=r||new c_,this.metadataTrack=n||new d_}return Ig(e,[{key:"demuxPart",value:function(e,t,r){var n=this,i=this.videoTrack,a=this.audioTrack,o=i.exist(),s=a.exist(),u=/av01/.test(i.codec);i.samples=[],a.samples=[];var c=e,l=t;if(this.__lastRemainData){var f=this.__lastRemainDataStart+this.__lastRemainData.byteLength;if(t<=f&&t>this.__lastRemainDataStart&&t+e.byteLength>f){var h=e.subarray(this.__lastRemainData.byteLength+this.__lastRemainDataStart-t);c=S_(this.__lastRemainData,h),l=this.__lastRemainDataStart,this.__lastRemainData=null}else this.__lastRemainData=null,this.__lastRemainDataStart=0,this.__nextMoofStart=-1}if(!r){var d=K_.findBox(c,["moov"])[0];if(!d)throw new Error("cannot found moov box");r=K_.moov(d)}if(c){var p=l+c.byteLength;o||s||K_.moovToTrack(r,i,a);var v=[];this.__nextMoofStart<0?K_.findBox(c,["moof"],l).forEach((function(e){return v.push(e)})):this.__nextMoofStart>=l&&this.__nextMoofStart<=p-8&&K_.findBox(c.subarray(this.__nextMoofStart-l),["moof"],this.__nextMoofStart).forEach((function(e){return v.push(e)})),v.filter((function(e){return e.size<=e.data.length})).forEach((function(e){var t=K_.moof(e);n.__nextMoofStart=t.start+Math.max.apply(Math,Vg(t.traf.map((function(e){return e.trun.samples.reduce((function(e,t){return e+t.size}),e.trun.dataOffset||0)})))),n.__loadedMoofWraps.push({start:t.start,nextMoofStart:n.__nextMoofStart,moof:t}),n.__loadedMoofWraps.sort((function(e,t){return e.start-t.start}))}));var m,y=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Gg(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}(this.__loadedMoofWraps);try{var g=function(){var e=m.value;if(e.start>p||e.nextMoofStart<l)return"continue";var t,r=e.start,o=K_.moofToSamples(e.moof,i,a),s=i.baseMediaDecodeTime,f=a.baseMediaDecodeTime;Object.keys(o).forEach((function(e){i.id==e?o[e].some((function(e){var a=e.offset+=r;if(!(a<l)){if(a+e.size>p)return!0;var o=new l_((e.pts||e.dts)+s,e.dts+s);o.duration=e.duration,o.gopId=e.gopId,e.keyframe&&o.setToKeyframe();var f=c.subarray(a-l,a-l+e.size);if(o.data=f,!u)for(var h=0,d=f.length-1;h<d;)t=w_(f,h),h+=4,o.units.push(f.subarray(h,h+t)),h+=t;n.__lastRemainDataStart=a+e.size,i.samples.push(o)}})):a.id==e&&o[e].some((function(e){var t=e.offset+r;if(!(t<l)){if(t+e.size>p)return!0;var i=c.subarray(t-l,t-l+e.size);a.samples.push(new f_(e.dts+f,i,e.duration)),n.__lastRemainDataStart=t+e.size}}))}))};for(y.s();!(m=y.n()).done;)g()}catch(_){y.e(_)}finally{y.f()}}return this.__lastRemainDataStart>l&&this.__lastRemainDataStart<c.byteLength+l?this.__lastRemainData=c.subarray(this.__lastRemainDataStart-l):(this.__lastRemainData=c,this.__lastRemainDataStart=l),i.samples.length&&(i.baseMediaDecodeTime=i.samples[0].pts),a.samples.length&&(a.baseMediaDecodeTime=a.samples[0].pts),{videoTrack:i,audioTrack:a,metadataTrack:this.metadataTrack}}},{key:"demux",value:function(e,t){var r=this.videoTrack,n=this.audioTrack,i=r.exist(),a=n.exist();if(r.samples=[],n.samples=[],t){if(!a){var o=K_.findBox(t,["moov"])[0];if(!o)throw new Error("cannot found moov box");K_.moovToTrack(K_.moov(o),null,n)}var s=K_.findBox(t,["moof"])[0];if(s){var u=K_.moofToSamples(K_.moof(s),null,n)[n.id],c=n.baseMediaDecodeTime;if(u){var l=s.start;u.map((function(e){e.offset+=l;var r=t.subarray(e.offset,e.offset+e.size);n.samples.push(new f_(e.dts+c,r,e.duration))}))}}}if(e){if(!i&&!a){var f=K_.findBox(e,["moov"])[0];if(!f)throw new Error("cannot found moov box");K_.moovToTrack(K_.moov(f),r,n)}var h=K_.findBox(e,["moof"])[0];if(h){var d,p=K_.moofToSamples(K_.moof(h),r,n),v=r.baseMediaDecodeTime,m=n.baseMediaDecodeTime,y=h.start;Object.keys(p).forEach((function(t){r.id==t?p[t].map((function(t){t.offset+=y;var n=new l_((t.pts||t.dts)+v,t.dts+v);n.duration=t.duration,n.gopId=t.gopId,t.keyframe&&n.setToKeyframe();var i=e.subarray(t.offset,t.offset+t.size);n.data=i;for(var a=0,o=i.length-1;a<o;)d=w_(i,a),a+=4,n.units.push(i.subarray(a,a+d)),a+=d;r.samples.push(n)})):n.id==t&&p[t].map((function(t){t.offset+=y;var r=e.subarray(t.offset,t.offset+t.size);n.samples.push(new f_(t.dts+m,r,t.duration))}))}))}}return{videoTrack:r,audioTrack:n,metadataTrack:this.metadataTrack}}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset(),this.metadataTrack.reset()}}],[{key:"probe",value:function(e){return K_.probe(e)}}]),e}();var eb=function(){function e(){Pg(this,e),this.buffer=new Uint8Array(0)}return Ig(e,[{key:"write",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach((function(t){t?e.buffer=function(e){for(var t=0,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];n.forEach((function(e){t+=e.length}));var a=new e(t),o=0;return n.forEach((function(e){a.set(e,o),o+=e.length})),a}(Uint8Array,e.buffer,t):window.console.warn(t)}))}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]),e}(),tb=Math.pow(2,32)-1,rb=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=8+(r=r.filter(Boolean)).reduce((function(e,t){return e+t.byteLength}),0),a=new Uint8Array(i);a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=255&i,a.set(e,4);var o=8;return r.forEach((function(e){a.set(e,o),o+=e.byteLength})),a}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===qg&&e.codecType===Qg}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return S_(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var r=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],A_(t.kid),[0,0,0,0]));return e.box(e.types.pssh,r)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var r=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(Vg(t.map((function(t){return e.trak(t)}))),[r]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(Vg(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,t>>24&255,t>>16&255,t>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,i>>8&255,255&i,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===qg?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){var r=[];return t&&t.ext&&t.ext.stss&&r.push(e.stss(t.ext.stss.entries)),e.box(e.types.stbl,e.stsd(t),e.STTS,r[0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var r;return r="audio"===t.type?t.useEME&&t.enca?e.enca(t):t.codecType===e_?e.opus(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):t.av1C?e.av01(t):e.avc1hev1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),r)}},{key:"enca",value:function(t){var r=t.enca.channelCount,n=t.enca.sampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,n>>8&255,255&n,0,0]),a=e.esds(t.config),o=e.sinf(t.enca);return e.box(e.types.enca,i,a,o)}},{key:"encv",value:function(t){var r,n,i=t.sps.length>0?t.sps[0]:[],a=t.pps.length>0?t.pps[0]:[],o=t.width,s=t.height,u=t.sarRatio[0],c=t.sarRatio[1],l=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,s>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),f=new Uint8Array((r=(n=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,255&i.length]).concat.apply(n,Vg(i)).concat([1,a.length>>>8&255,255&a.length])).concat.apply(r,Vg(a))),h=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),d=e.sinf(t.encv),p=new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c]);return e.box(e.types.encv,l,e.box(e.types.avcC,f),e.box(e.types.btrt,h),d,e.box(e.types.pasp,p))}},{key:"schi",value:function(t){var r=new Uint8Array([]),n=e.tenc(t);return e.box(e.types.schi,r,n)}},{key:"tenc",value:function(t){var r=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(A_(t.default_KID)));return e.box(e.types.tenc,r)}},{key:"sinf",value:function(t){var r=new Uint8Array([]),n=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),a=e.schi(t);return e.box(e.types.sinf,r,e.box(e.types.frma,n),e.box(e.types.schm,i),a)}},{key:"av01",value:function(t){return e.box(e.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,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t.av1C,t.colr)}},{key:"avc1hev1",value:function(t){var r=t.codecType===Qg,n=r?e.types.hvc1:e.types.avc1,i=r?e.hvcC(t):e.avcC(t),a=[new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),i];return r?a.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&a.push(e.pasp(t.sarRatio)),e.box.apply(e,[n].concat(a))}},{key:"avcC",value:function(t){var r,n,i,a=[],o=[];return t.sps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,Vg(e))})),t.pps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,Vg(e))})),e.box(e.types.avcC,new Uint8Array((r=(n=[1,a[3],a[4],a[5],255,224|t.sps.length]).concat.apply(n,a).concat([t.pps.length])).concat.apply(r,o)))}},{key:"hvcC",value:function(t){var r=t.hvcC;if(r instanceof ArrayBuffer||r instanceof Uint8Array)return r;var n,i=t.vps,a=t.sps,o=t.pps;if(r){var s=r.generalProfileCompatibilityFlags,u=r.generalConstraintIndicatorFlags,c=(i.length&&1)+(a.length&&1)+(o.length&&1);n=[1,r.generalProfileSpace<<6|r.generalTierFlag<<5|r.generalProfileIdc,s>>>24,s>>>16,s>>>8,s,u[0],u[1],u[2],u[3],u[4],u[5],r.generalLevelIdc,240,0,252,252|r.chromaFormatIdc,248|r.bitDepthLumaMinus8,248|r.bitDepthChromaMinus8,0,0,r.numTemporalLayers<<3|r.temporalIdNested<<2|3,c];var l=function(e){var t;n.push(e.length>>8,e.length),(t=n).push.apply(t,Vg(e))};i.length&&(n.push(160,0,i.length),i.forEach(l)),a.length&&(n.push(161,0,a.length),a.forEach(l)),o.length&&(n.push(162,0,o.length),o.forEach(l))}else n=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(n))}},{key:"pasp",value:function(t){var r=jg(t,2),n=r[0],i=r[1];return e.box(e.types.pasp,new Uint8Array([n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var r=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+r,0,0,0,4,15+r,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([r]).concat(t).concat([6,1,2])))}},{key:"opus",value:function(t){var r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),n=t.config.length?e.dOps(t):[];return e.box(e.types.Opus,r,n)}},{key:"dOps",value:function(t){if(t.config)return t.config[4]=t.sampleRate>>>24&255,t.config[5]=t.sampleRate>>>16&255,t.config[6]=t.sampleRate>>>8&255,t.config[7]=255&t.sampleRate,e.box(e.types.dOps,t.config)}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(Vg(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(Vg(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var r=e.tfhd(t.id),n=e.tfdt(t,t.baseMediaDecodeTime),i=0;if(t.isVideo&&t.videoSenc&&t.videoSenc.forEach((function(e){i+=8,e.subsamples&&e.subsamples.length&&(i+=2,i+=6*e.subsamples.length)})),t.videoSencLength=i,t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(t.isVideo){var a=e.saiz(t),o=e.saio(t),s=e.trun1(t),u=e.senc(t);return e.box(e.types.traf,r,n,a,o,s,u)}if(t.isAudioEncryption){var c=e.sbgp(),l=e.saiz(t),f=e.saio(t),h=e.senc(t),d=e.trun1(t);return e.box(e.types.traf,r,n,c,l,f,h,d)}var p=e.sbgp(),v=e.trun1(t);return e.box(e.types.traf,r,n,p,v)}if(t.isVideo){var m=e.trun1(t);return e.box(e.types.traf,r,n,m)}var y=e.sbgp(),g=e.saiz(t),_=e.saio(t),b=e.senc(t),S=e.trun1(t);return e.box(e.types.traf,r,n,y,g,_,b,S)}var k=e.sdtp(t);return e.box(e.types.traf,r,n,k,e.trun(t.samples,k.byteLength+76))}},{key:"sdtp",value:function(t){var r=new eb;return t.samples.forEach((function(e){r.write(new Uint8Array(t.isVideo?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),r.buffer)}},{key:"trun1",value:function(t){var r=new eb,n=eb.writeUint32(t.samples.length),i=null;if(t.isVideo){var a=t.videoSencLength;i=eb.writeUint32(16*t.samples.length+a+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=eb.writeUint32(16*t.samples.length+92))}else{var o=12*t.samples.length+124;t.isAudioEncryption&&(o=12*t.samples.length+8*t.audioSenc.length+177),i=eb.writeUint32(o)}return t.samples.forEach((function(e){r.write(eb.writeUint32(e.duration)),r.write(eb.writeUint32(e.size)),r.write(eb.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&r.write(eb.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),n,i,r.buffer)}},{key:"senc",value:function(t){var r=new eb,n=t.samples.length,i=t.isVideo?16:8,a=t.isVideo?2:0,o=[],s=0;return t.isVideo?(o=t.videoSenc,s=t.videoSencLength):o=t.audioSenc,s=s||i*n,r.write(eb.writeUint32(16+s),e.types.senc,this.extension(0,a)),r.write(eb.writeUint32(n)),o.forEach((function(e){for(var t=0;t<e.InitializationVector.length;t++)r.write(new Uint8Array([e.InitializationVector[t]]));e.subsamples&&e.subsamples.length&&(r.write(eb.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){r.write(eb.writeUint16(e.BytesOfClearData)),r.write(eb.writeUint32(e.BytesOfProtectedData))})))})),r.buffer}},{key:"saio",value:function(t){var r=12*t.samples.length+141;!t.isVideo&&t.isAudioEncryption&&(r=149);var n=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saio,n)}},{key:"saiz",value:function(t){var r=t.samples.length,n=new Uint8Array([0,0,0,0,16,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saiz,n)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t,r){var n=Math.floor(r/(tb+1)),i=Math.floor(r%(tb+1));return t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)?e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])):e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"trun",value:function(t,r){var n=t.length,i=12+16*n;r+=8+i;var a=new Uint8Array(i);a.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0);for(var o=0;o<n;o++){var s=t[o],u=s.duration,c=s.size,l=s.flag,f=void 0===l?{}:l,h=s.cts,d=void 0===h?0:h;a.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,c>>>24&255,c>>>16&255,c>>>8&255,255&c,f.isLeading<<2|(null===f.dependsOn||void 0===f.dependsOn?1:f.dependsOn),f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|(null===f.isNonSyncSample||void 0===f.isNonSyncSample?1:f.isNonSyncSample),61440&f.degradationPriority,15&f.degradationPriority,d>>>24&255,d>>>16&255,d>>>8&255,255&d],12+16*o)}return e.box(e.types.trun,a)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(Vg(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===qg?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var r=t.ext,n=[e.stsd(t),e.stts(r.stts),e.stsc(r.stsc),e.stsz(r.stsz),e.stco(r.stco)];return r.stss.length&&n.push(e.stss(r.stss)),r.ctts.length&&n.push(e.ctts(r.ctts)),e.box.apply(e,[e.types.stbl].concat(n))}},{key:"stts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.stts,S_(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsc",value:function(t){var r=t.length,n=new Uint8Array(12*r),i=0;return t.forEach((function(e){var t=e.firstChunk,r=e.samplesPerChunk,a=e.sampleDescIndex;n.set([t>>24,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,a>>24,a>>16&255,a>>8&255,255&a],i),i+=12})),e.box(e.types.stsc,S_(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsz",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stsz,S_(new Uint8Array([0,0,0,0,0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stco",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stco,S_(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stss",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stss,S_(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"ctts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.ctts,S_(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var r=t.timescale,n=t.samples[0].duration,i=n*t.samples.length,a=t.samples[0].sampleOffset*n,o=8;t.samples.forEach((function(e){o+=e.size}));var s=0;if(t.isVideo){var u,c=0;t.videoSenc&&(u=t.videoSenc),t.isVideo&&u.forEach((function(e){c+=8,e.subsamples&&e.subsamples.length&&(c+=2,c+=6*e.subsamples.length)})),t.videoSencLength=c,s=o+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=o+16*t.samples.length+84)}else s=o+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=o+169+12*t.samples.length+8*t.audioSenc.length);var l=new Uint8Array([0,0,0,0,0,0,0,255&t.id,r>>24&255,r>>16&255,r>>8&255,255&r,a>>24&255,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,1,0,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,144,0,0,0]);return e.box(e.types.sidx,l)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();Mg(rb,"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(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),Mg(rb,"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])}),Mg(rb,"FTYPAVC1",rb.box(rb.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),Mg(rb,"FTYPHEV1",rb.box(rb.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),Mg(rb,"DINF",rb.box(rb.types.dinf,rb.box(rb.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),Mg(rb,"VMHD",rb.box(rb.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),Mg(rb,"SMHD",rb.box(rb.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),Mg(rb,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),Mg(rb,"STTS",rb.box(rb.types.stts,rb.StblTable)),Mg(rb,"STSC",rb.box(rb.types.stsc,rb.StblTable)),Mg(rb,"STSZ",rb.box(rb.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),Mg(rb,"STCO",rb.box(rb.types.stco,rb.StblTable));var nb=function(){function e(t,r){Pg(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=r}return Ig(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).debug.apply(t,[this._prefix].concat(n))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).log.apply(t,[this._prefix].concat(n))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(n))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).error.apply(t,[this._prefix].concat(n))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();Mg(nb,"disabled",!0);var ib=function(){function e(t,r,n){Pg(this,e),this.videoTrack=t,this.audioTrack=r;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new nb("FMP4Remuxer",!n||!n.openLog||!n.openLog)}return Ig(e,[{key:"remux",value:function(){var e,t,r,n,i,a=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),f=[];return a&&(o&&o.initMerge?(c&&f.push(this.videoTrack),l&&f.push(this.audioTrack),r=rb.initSegment(f)):(c&&(e=rb.initSegment([this.videoTrack])),l&&(t=rb.initSegment([this.audioTrack])))),c&&s.hasSample()&&(n=this._remuxVideo()),l&&u.hasSample()&&(i=this._remuxAudio()),s.samples=[],u.samples=[],{initSegment:r,videoInitSegment:e,audioInitSegment:t,videoSegment:n,audioSegment:i}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,r=/av01/.test(e.codec),n=0;r?t.forEach((function(e){n+=e.data.byteLength})):t.forEach((function(e){n+=e.units.reduce((function(e,t){return e+t.byteLength}),0),n+=4*e.units.length}));var i=new Uint8Array(n);if(r)for(var a,o=0,s=t.length,u=0;o<s;o++)a=t[o],i.set(a.data,u),a.size=a.data.byteLength,u+=a.size;else for(var c,l=new DataView(i.buffer),f=function(e,r){r=t[h];var n=0;r.units.forEach((function(t){l.setUint32(e,t.byteLength),e+=4,i.set(t,e),e+=t.byteLength,n+=4+t.byteLength})),r.size=n,p=e,c=r},h=0,d=t.length,p=0;h<d;h++)f(p,c);var v=rb.mdat(i);return S_(rb.moof([e]),v)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,t=new Uint8Array(e.samples.reduce((function(e,t){return e+t.size}),0));e.samples.reduce((function(e,r){return t.set(r.data,e),e+r.size}),0);var r=rb.mdat(t);return S_(rb.moof([e]),r)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}(),ab=function(){function e(){s(this,e);var t=window.crypto||window.msCrypto;this.subtle=t&&(t.subtle||t.webkitSubtle),this.externalDecryptor=null}var t,r;return c(e,[{key:"destroy",value:function(){var e;null!==(e=this.externalDecryptor)&&void 0!==e&&e.destroy&&this.externalDecryptor.destroy()}},{key:"decrypt",value:function(e,t){if(e||t){var r=[];return e&&(r[0]=this._decryptSegment(e)),t&&(r[1]=this._decryptSegment(t)),Promise.all(r)}}},{key:"_decryptSegment",value:(r=o(n().mark((function e(t){var r;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.data,!t.key){e.next=5;break}return e.next=4,this._decryptData(t.data,t.key,t.keyIv);case 4:r=e.sent;case 5:if(t.map){e.next=7;break}return e.abrupt("return",r);case 7:return e.abrupt("return",wg(t.map,r));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_decryptData",value:(t=o(n().mark((function e(t,r,i){var a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.externalDecryptor){e.next=6;break}return e.next=3,this.externalDecryptor.decrypt(t,r,i);case 3:return e.abrupt("return",e.sent);case 6:if(this.subtle){e.next=8;break}throw new Error("crypto is not defined");case 8:return e.next=10,this.subtle.importKey("raw",r,{name:"AES-CBC"},!1,["encrypt","decrypt"]);case 10:return a=e.sent,e.t0=Uint8Array,e.next=14,this.subtle.decrypt({name:"AES-CBC",iv:i},a,t);case 14:return e.t1=e.sent,e.abrupt("return",new e.t0(e.t1));case 16:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})}]),e}(),ob=r(r({},gg),{},{STREAM_PARSED:"core.streamparsed",NO_AUDIO_TRACK:"core.noaudiotrack",SUBTITLE_SEGMENTS:"core.subtitlesegments",SUBTITLE_PLAYLIST:"core.subtitleplaylist",SEI_PAYLOAD_TIME:"core.seipayloadtime",APPEND_COST:"core.appendcost"}),sb=new Yy("Transmuxer"),ub=function(){function e(t,r,n,i){s(this,e),l(this,"_initSegmentId",""),this.hls=t,this._demuxer=r?new Z_:new H_(null,null,null,i),this._isMP4=r,n&&(this._remuxer=new ib(this._demuxer.videoTrack,this._demuxer.audioTrack))}return c(e,[{key:"transmux",value:function(e,t,n,i,a,o){var s=this._demuxer;try{this._isMP4?s.demux(e,t):s.demuxAndFix(wg(e,t),n,i,a)}catch(Xb){throw new zy(My,Vy.HLS,Xb)}var u=s.videoTrack,c=s.audioTrack,l=s.metadataTrack,f={codec:u.codec,timescale:u.timescale,firstDts:u.firstDts/u.timescale,firstPts:u.firstPts/u.timescale,duration:u.samplesDuration/u.timescale},h={codec:c.codec,timescale:c.timescale,firstDts:c.firstDts/u.timescale,firstPts:c.firstPts/u.timescale,duration:c.samplesDuration/u.timescale,container:c.container},d="".concat(u.codec,"/").concat(u.width,"/").concat(u.height,"/").concat(c.codec,"/").concat(c.config);if(d!==this._initSegmentId&&(this._initSegmentId=d,o=!0),this._fireEvents(u,c,l,n||o),this.hls.emit(ob.DEMUXED_TRACK,{videoTrack:u,audioTrack:c}),!this._remuxer)return[u,c];o&&this.hls.isLive&&!this.hls.config.mseLowLatency&&(u.duration=this.hls.totalDuration*u.timescale,c.duration=this.hls.totalDuration*c.timescale);try{var p=this._remuxer.remux(o),v=p.videoInitSegment,m=p.videoSegment,y=p.audioInitSegment,g=p.audioSegment,_=wg(v,m),b=wg(y,g);return[_?r(r({},f),{},{data:_}):void 0,b?r(r({},h),{},{data:b}):void 0]}catch(Xb){throw new zy(By,Vy.FMP4,Xb)}}},{key:"_fireEvents",value:function(e,t,n,i){var a=this,o=[e,t],s="discontinuity: ".concat(i);o.forEach((function(e){var t;null!==(t=e.samples)&&void 0!==t&&t.length&&(s+="; ".concat(e.samples.length," ").concat(e.type===qg?"video":"audio"," samples, firstDts/firstPts/duration: ").concat((e.firstDts/e.timescale).toFixed(3),"/").concat((e.firstPts/e.timescale).toFixed(3),"/").concat((e.samplesDuration/e.timescale).toFixed(3))),i&&e.exist()&&a.hls.emit(ob.METADATA_PARSED,{type:e.type,track:e,meta:r({codec:e.codec,timescale:e.timescale,baseDts:e.baseDts},e.type===qg?{width:e.width,height:e.height,sarRatio:e.sarRatio}:{codec:e.codec,channelCount:e.channelCount,sampleRate:e.sampleRate})})})),sb.debug(s),e.warnings.forEach((function(e){var t;switch(e.type){case r_:t=ob.LARGE_AV_FIRST_FRAME_GAP_DETECT;break;case n_:t=ob.LARGE_VIDEO_DTS_GAP_DETECT;break;case i_:t=ob.MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT}t&&a.hls.emit(ob.STREAM_EXCEPTION,r(r({},e),{},{type:t})),sb.warn("video exception",e)})),t.warnings.forEach((function(e){var t;switch(e.type){case a_:t=ob.LARGE_AUDIO_DTS_GAP_DETECT;break;case o_:t=ob.AUDIO_GAP_DETECT;break;case s_:t=ob.AUDIO_OVERLAP_DETECT}t&&a.hls.emit(ob.STREAM_EXCEPTION,r(r({},e),{},{type:t})),sb.warn("audio exception",e)})),e.samples.forEach((function(e){e.keyframe&&a.hls.emit(ob.KEYFRAME,{pts:e.pts})})),n.seiSamples.forEach((function(e){a.hls.emit(ob.SEI,r(r({},e),{},{originPts:e.originPts/90,sei:{code:e.data.type,content:e.data.payload,dts:e.pts}}))}))}}]),e}(),cb=["data"],lb=["data"],fb=new Yy("BufferService"),hb=function(){function e(t){var r=this;s(this,e),l(this,"_decryptor",new ab),l(this,"_transmuxer",null),l(this,"_mse",null),l(this,"_softVideo",null),l(this,"_sourceCreated",!1),l(this,"_needInitSegment",!0),l(this,"_directAppend",!1),this.hls=t,t.config.softDecode?this._softVideo=t.media:(this._mse=new ig(null,{preferMMS:t.config.preferMMS}),t.config.url&&this._mse.bindMedia(t.media).then((function(e){r.hls.emit(gg.MEDIASOURCE_OPENED,e)}))),t.config.decryptor&&(this._decryptor.externalDecryptor=t.config.decryptor)}var t,r,i,a,u,f,h,d,v,m;return c(e,[{key:"baseDts",get:function(){var e,t,r;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t||null===(r=t._fixer)||void 0===r?void 0:r._baseDts}},{key:"nbSb",get:function(){var e;return null!==(e=this._mse)&&void 0!==e&&e._sourceBuffer?Object.keys(this._mse._sourceBuffer).length:0}},{key:"msIsOpened",get:function(){var e;return null===(e=this._mse)||void 0===e?void 0:e.isOpened}},{key:"msHasOpTasks",get:function(){var e;return null===(e=this._mse)||void 0===e?void 0:e.hasOpTasks}},{key:"msStreaming",get:function(){var e;return null===(e=this._mse)||void 0===e?void 0:e.streaming}},{key:"updateDuration",value:(m=o(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fb.debug("update duration",t),!this._mse){e.next=9;break}if(this._mse.isOpened){e.next=5;break}return e.next=5,this._mse.open();case 5:return e.next=7,this._mse.updateDuration(t);case 7:e.next=10;break;case 9:this._softVideo&&(this._softVideo.duration=t);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"createSource",value:function(e,t,r,n){if(!this._sourceCreated){var i=e||t;if(i){if(H_.probe(i))this._transmuxer||(this._transmuxer=new ub(this.hls,!1,!this._softVideo,this.hls.config.fixerConfig));else{if(!K_.probe(i))throw new zy(Fy,null,null,null,"unsupported stream");if(this._softVideo)this._transmuxer||(this._transmuxer=new ub(this.hls,!0,null,this.hls.config.fixerConfig));else{this._directAppend=!0;var a=!1;e&&!r&&K_.findBox(e,["moov","trak"]).forEach((function(e){var t=K_.findBox(e.data,["trak","mdia","minf","stbl","stsd"])[0];if(t){var i=K_.stsd(t).entries[0];if(i)if(i.hvcC)r=i.hvcC.codec||"hev1.1.6.L93.B0";else if(i.avcC)r=i.avcC.codec;else if(i.sampleRate||i.esds){var o;n=(null===(o=i.esds)||void 0===o?void 0:o.codec)||"mp4a.40.2",a=!0}}})),t&&!n&&K_.findBox(t,["moov","trak","mdia","minf","stbl","stsd"]).forEach((function(e){var t=K_.stsd(e).entries[0];t&&t.esds&&(n=t.esds.codec)})),e&&!r&&(r="avc1.42e01e"),t&&!n&&(n="mp4a.40.2"),a&&(r+=", ".concat(n),n=""),this._createMseSource(r,n)}}this._softVideo&&(this._sourceCreated=!0)}}}},{key:"appendBuffer",value:(v=o(n().mark((function e(t,r,i,a,o,s,u){var c,l,f,h,d,v,m,g,_,b,S,k,E,w,x=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=i&&i.length||null!=a&&a.length){e.next=2;break}return e.abrupt("return");case 2:if(c=function(){var e,r;null!==(e=x.hls)&&void 0!==e&&e.emit&&(null===(r=x.hls)||void 0===r||r.emit(gg.APPEND_BUFFER,{start:t.start,end:t.end}))},!this._directAppend){e.next=8;break}return l=[],i&&l.push(this._mse.append(ig.VIDEO,i)),a&&l.push(this._mse.append(ig.AUDIO,a)),e.abrupt("return",Promise.all(l).then(c));case 8:if(f=this._needInitSegment||o,h=this._transmuxer.transmux(i,a,f,s,u,this._needInitSegment||o),d=y(h,2),v=d[0],m=d[1],a&&r&&(null==r||r.setTrackExist(!1,!0)),a&&t&&(null==t||t.setTrackExist(!0,!1)),r||null==t||t.setTrackExist(!!v,!!m),v&&!m&&this.hls.emit(ob.NO_AUDIO_TRACK),!this._softVideo){e.next=20;break}this._softVideo.appendBuffer(v,m),this._needInitSegment=!1,c(),e.next=30;break;case 20:if(!this._mse){e.next=30;break}return(g=!this._sourceCreated)&&this._createMseSource(null==v?void 0:v.codec,null==m?void 0:m.codec,null==m?void 0:m.container),this._needInitSegment=!1,_=this._mse,b=[],f&&!g&&this._handleCodecChange(v,m).forEach((function(e){return b.push(e)})),v&&(S=v.data,k=p(v,cb),b.push(_.append(ig.VIDEO,S,k))),m&&(E=m.data,w=p(m,lb),b.push(_.append(ig.AUDIO,E,w))),e.abrupt("return",Promise.all(b).then(c));case 30:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i,a,o){return v.apply(this,arguments)})},{key:"removeBuffer",value:(d=o(n().mark((function e(){var t,r,i,a=this,o=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[0]:0,r=o.length>1&&void 0!==o[1]?o[1]:1/0,i=this.hls.media,!(!this._mse||!i||t<0||r<t||t>=this._mse.duration)){e.next=5;break}return e.abrupt("return");case 5:return e.abrupt("return",this._mse.clearBuffer(t,r).then((function(){return a.hls.emit(gg.REMOVE_BUFFER,{start:t,end:r,removeEnd:r})})));case 6:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"evictBuffer",value:(h=o(n().mark((function e(t){var r,i,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.hls.media,this._mse&&r&&t&&!(t<0)){e.next=3;break}return e.abrupt("return");case 3:if(i=r.currentTime,!((a=i-t)<=0)){e.next=7;break}return e.abrupt("return");case 7:if(!(Ay.start(Ay.get(r))+1>=a)){e.next=10;break}return e.abrupt("return");case 10:return e.abrupt("return",this.removeBuffer(0,a));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"clearAllBuffer",value:(f=o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=2;break}return e.abrupt("return",this._mse.clearAllBuffer());case 2:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"decryptBuffer",value:function(e,t){return this._decryptor.decrypt(e,t)}},{key:"reset",value:(u=o(n().mark((function e(){var t,r=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=r.length>0&&void 0!==r[0]&&r[0],!this._mse||t){e.next=8;break}return this._transmuxer=null,this._sourceCreated=!1,e.next=6,this._mse.unbindMedia();case 6:return e.next=8,this._mse.bindMedia(this.hls.media);case 8:this._needInitSegment=!0,this._directAppend=!1;case 10:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"endOfStream",value:(a=o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=5;break}if(!this._sourceCreated){e.next=5;break}return e.next=4,this._mse.endOfStream();case 4:this.hls.emit(gg.BUFFEREOS);case 5:this._softVideo&&this._softVideo.endOfStream();case 6:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"setLiveSeekableRange",value:(i=o(n().mark((function e(t,r){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._mse&&this._mse.setLiveSeekableRange(t,r);case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"detachMedia",value:(r=o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=3;break}return e.next=3,this._mse.unbindMedia();case 3:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"destroy",value:(t=o(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null===(t=this._decryptor)||void 0===t||t.destroy(),e.next=3,this.detachMedia();case 3:this._decryptor=null,this._mse=null,this._softVideo=null;case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_createMseSource",value:function(e,t,r){fb.debug("create mse source, videoCodec=".concat(e,", audioCodec=").concat(t));var n=this._mse;n&&(e&&(n.createSource(ig.VIDEO,"video/mp4;codecs=".concat(e)),this._sourceCreated=!0),t?(n.createSource(ig.AUDIO,"audio/mp4;codecs=".concat(t)),this._sourceCreated=!0):r&&(n.createSource(ig.AUDIO,"".concat(r,';codecs=""')),this._sourceCreated=!0),this.hls.emit(gg.SOURCEBUFFER_CREATED))}},{key:"_handleCodecChange",value:function(e,t){var r=[],n=this._mse;return[{type:ig.VIDEO,codecs:null==e?void 0:e.codec},{type:ig.AUDIO,codecs:null==t?void 0:t.codec}].filter((function(e){return!!e.codecs})).forEach((function(e){var t=e.type,i=e.codecs,a=n.getSourceBuffer(t);if(a){var o=i.split(",")[0];new RegExp(o,"ig").test(a.mimeType)||r.push(n.changeType(t,"".concat(t,"/mp4;codecs=").concat(i)))}})),r}},{key:"seamlessSwitch",value:function(){this._needInitSegment=!0}},{key:"isFull",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ig.VIDEO;return null===(e=this._mse)||void 0===e?void 0:e.isFull(t)}}]),e}();var db=c((function e(){s(this,e),l(this,"version",0),l(this,"streams",[]),l(this,"isMaster",!0)})),pb="AUDIO",vb="SUBTITLE",mb={CLEAR_KEY:"org.w3.clearkey",FAIRPLAY:["urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2","com.apple.streamingkeydelivery"],WIDEVINE:["urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine.alpha","com.widevine"],PLAYREADY:["urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95","com.microsoft.playready"]};function yb(e){for(var t=[],r=0;r<e.length;r++)Array.isArray(e[r])?t=t.concat(yb(e[r])):t.push(e[r]);return t}var gb=c((function e(){s(this,e),l(this,"id",0),l(this,"url",""),l(this,"default",!1),l(this,"autoSelect",!1),l(this,"forced",!1),l(this,"group",""),l(this,"name",""),l(this,"lang",""),l(this,"segments",[]),l(this,"endSN",0)})),_b=function(e){f(r,e);var t=m(r);function r(){var e;s(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return l(v(e=t.call.apply(t,[this].concat(i))),"mediaType",pb),l(v(e),"channels",0),e}return c(r)}(gb),bb=function(e){f(r,e);var t=m(r);function r(){var e;s(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return l(v(e=t.call.apply(t,[this].concat(i))),"mediaType",vb),e}return c(r)}(gb),Sb=c((function e(){s(this,e),l(this,"id",0),l(this,"bitrate",0),l(this,"width",0),l(this,"height",0),l(this,"name",""),l(this,"url",""),l(this,"audioCodec",""),l(this,"videoCodec",""),l(this,"textCodec",""),l(this,"audioGroup",""),l(this,"audioStreams",[]),l(this,"subtitleStreams",[]),l(this,"closedCaptionsStream",[])})),kb=c((function e(){s(this,e),l(this,"version",0),l(this,"url",""),l(this,"type",""),l(this,"startCC",0),l(this,"endCC",0),l(this,"startSN",0),l(this,"endSN",0),l(this,"totalDuration",0),l(this,"targetDuration",0),l(this,"partTargetDuration",0),l(this,"canSkipUntil",0),l(this,"canSkipDateRanges",!1),l(this,"skippedSegments",0),l(this,"canBlockReload",!1),l(this,"partHoldBack",0),l(this,"live",!0),l(this,"lowLatency",!1),l(this,"endPartIndex",0),l(this,"segments",[]),l(this,"dateRanges",{}),l(this,"skippedSegments",0)})),Eb=function(){function e(t){s(this,e),l(this,"sn",0),l(this,"cc",0),l(this,"url",""),l(this,"parentUrl",""),l(this,"title",""),l(this,"start",0),l(this,"duration",0),l(this,"dataTime",""),l(this,"key",null),l(this,"byteRange",null),l(this,"isInitSegment",!1),l(this,"initSegment",null),l(this,"isLast",!1),l(this,"hasAudio",!1),l(this,"hasVideo",!1),l(this,"independent",!1),l(this,"partIndex",0),this.parentUrl=t}return c(e,[{key:"end",get:function(){return this.start+this.duration}},{key:"setTrackExist",value:function(e,t){this.hasVideo=e,this.hasAudio=t}},{key:"setByteRange",value:function(e,t){this.byteRange=[0];var r=e.split("@");1===r.length&&t&&t.byteRange?(this.byteRange[0]=t.byteRange[1]||0,this.byteRange[0]&&(this.byteRange[0]+=1)):this.byteRange[0]=parseInt(r[1]),this.byteRange[1]=this.byteRange[0]+parseInt(r[0])-1}}]),e}(),wb=function(){function e(t){s(this,e),l(this,"method",""),l(this,"url",""),l(this,"iv",null),l(this,"keyFormat",""),l(this,"keyFormatVersions",""),t instanceof e&&(this.method=t.method,this.url=t.url,this.keyFormat=t.keyFormat,this.keyFormatVersions=t.keyFormatVersions,t.iv&&(this.iv=new Uint8Array(t.iv)))}return c(e,[{key:"clone",value:function(t){var r=new e(this);return null!=t&&r.setIVFromSN(t),r}},{key:"setIVFromSN",value:function(e){if(!this.iv&&"AES-128"===this.method&&"number"==typeof e&&this.url){this.iv=new Uint8Array(16);for(var t=12;t<16;t++)this.iv[t]=e>>8*(15-t)&255}}},{key:"isSegmentEncrypted",value:function(){return"AES-128"===this.method}},{key:"isValidKeySystem",value:function(){return yb([mb.CLEAR_KEY,mb.FAIRPLAY,mb.WIDEVINE,mb.PLAYREADY]).indexOf(this.keyFormat)>-1&&!!(["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)>-1)}},{key:"isSupported",value:function(){return!!this.method&&(!!this.isSegmentEncrypted()||!!this.isValidKeySystem())}}]),e}(),xb=function(){function e(t,r,n){s(this,e),this.msn=t,this.part=r,this.skip=n}return c(e,[{key:"addDirectives",value:function(e){var t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}]),e}(),Tb=/^#(EXT[^:]*)(?::(.*))?$/,Ab=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g,Db=/^(?:[a-zA-Z0-9+\-.]+:)?\/\//,Ob=/^((?:[a-zA-Z0-9+\-.]+:)?\/\/[^/?#]*)?([^?#]*\/)?/;function Lb(e){var t=e.match(Tb);if(t&&t[1])return[t[1].replace("EXT-X-",""),t[2]]}function Cb(e){for(var t={},r=Ab.exec(e);r;)t[r[1]]=r[2]||r[3],r=Ab.exec(e);return t}function Pb(e,t){if(!t||!e||Db.test(e))return e;var r=Ob.exec(t);return r?"/"===e[0]?r[1]+e:r[1]+r[2]+e:e}var Rb={audio:[/^mp4a/,/^vorbis$/,/^opus$/,/^flac$/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function Ib(e,t){var r=Rb[e];if(r&&t&&t.length)for(var n=0;n<r.length;n++)for(var i=0;i<t.length;i++)if(r[n].test(t[i]))return t[i]}function Mb(e,t){var r;if(t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e[n]!==t[n]){r=n;break}var i=null;e.DURATION&&(i=parseFloat(e.DURATION),Number.isFinite(i)?e._endDate&&(i=(e._endDate.getTime()-e._startDate.getTime())/1e3):i=null);var a,o,s=(a=e.CUE||e["X-CUE"],o={pre:!1,post:!1,once:!1},(a?a.split(/[ ,]+/):[]).reduce((function(e,t){return e[t.toLowerCase()]=!0,e}),o));return!!e.ID&&!r&&Number.isFinite(e._startDate.getTime())&&(null===i||i>=0)&&(!("YES"===e.END_ON_NEXT)||!!e.CLASS)&&(!e.CUE||!s.pre&&!s.post||s.pre!==s.post)&&(!("com.apple.hls.interstitial"===e.CLASS)||"X-ASSET-URI"in e||"X-ASSET-LIST"in e)}var Bb=function(){function e(){s(this,e)}return c(e,null,[{key:"parse",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(!t.includes("#EXTM3U"))throw new Error("Invalid m3u8 file");var i=function(e){return e.split(/[\r\n]/).map((function(e){return e.trim()})).filter(Boolean)}(t);return e.isMediaPlaylist(t)?function(e,t,r){var n=new kb;n.url=t;for(var i,a=new Eb(t),o=null,s=null,u=0,c=0,l=0,f=0,h=!1,d=0;i=e[f++];)if("#"===i[0]){var p=Lb(i);if(p){var v=y(p,2),m=v[0],g=v[1];switch(m){case"VERSION":n.version=parseInt(g);break;case"PLAYLIST-TYPE":n.type=null==g?void 0:g.toUpperCase();break;case"TARGETDURATION":n.targetDuration=parseFloat(g);break;case"PART-INF":r&&(n.lowLatency=!0);var _=Cb(g);_["PART-TARGET"]&&(n.partTargetDuration=parseFloat(_["PART-TARGET"]));break;case"SERVER-CONTROL":var b=Cb(g);n.canBlockReload="YES"===b["CAN-BLOCK-RELOAD"],n.partHoldBack=parseFloat(b["PART-HOLD-BACK"]||0),n.canSkipUntil=parseFloat(b["CAN-SKIP-UNTIL"]||0),n.canSkipDateRanges=n.canSkipUntil>0&&"YES"===b["CAN-SKIP-DATERANGES"];break;case"ENDLIST":h=!0;break;case"MEDIA-SEQUENCE":c=n.startSN=parseInt(g);break;case"DISCONTINUITY-SEQUENCE":l=n.startCC=parseInt(g);break;case"DISCONTINUITY":l++;break;case"BYTERANGE":a.setByteRange(g,n.segments[n.segments.length-1]);break;case"PART":if(!n.lowLatency)break;var S=Cb(g);a.duration=parseFloat(S.DURATION),a.independent="YES"===S.INDEPENDENT,a.sn=c,a.cc=l,a.partIndex=d,a.start=u,a.duration=parseFloat(S.DURATION),u+=a.duration,a.url=Pb(S.URI,t),s&&(a.key=s.clone(c)),o&&(a.initSegment=o),n.segments.push(a),a=new Eb(t),d++;break;case"PRELOAD-HINT":var k=Cb(g);if(n.preloadHint=k,"PART"===k.TYPE&&k.URI){var E=k.URI.split(".ts")[0].split("-");n.nextSN=E[3],n.nextIndex=E[E.length-1]}break;case"PROGRAM-DATE-TIME":a.dataTime=g;break;case"EXTINF":if(n.lowLatency){d=0;break}var w=y(g.split(","),2),x=w[0],T=w[1];a.start=u,a.duration=parseFloat(x),u+=a.duration,a.title=T;break;case"KEY":var A=Cb(g);if("NONE"===A.METHOD){s=null;break}if((s=new wb).method=A.METHOD,s.url=/^blob:/.test(A.URI)?A.URI:Pb(A.URI,t),s.keyFormat=A.KEYFORMAT||"identity",s.keyFormatVersions=A.KEYFORMATVERSIONS,!s.isSupported())throw new Error("encrypt ".concat(A.METHOD,"/").concat(A.KEYFORMAT," is not supported"));if(A.IV){var D=A.IV.slice(2);D=(1&D.length?"0":"")+D,s.iv=new Uint8Array(D.length/2);for(var O=0,L=D.length/2;O<L;O++)s.iv[O]=parseInt(D.slice(2*O,2*O+2),16)}break;case"MAP":var C=Cb(g);a.url=Pb(C.URI,t),C.BYTERANGE&&a.setByteRange(C.BYTERANGE),a.isInitSegment=!0,a.sn=0,s&&(a.key=s.clone(0)),o=a,a=new Eb(t);break;case"SKIP":var P=Cb(g),R=parseInt(P["SKIPPED-SEGMENTS"],10);R<=Number.MAX_SAFE_INTEGER&&(n.skippedSegments+=R,c+=R);break;case"DATERANGE":var I=Cb(g),M=n.dateRanges[I.ID];I._startDate=M?M._startDate:new Date(I["START-DATE"]);var B=(null==M?void 0:M._endDate)||new Date(I.END_DATE);Number.isFinite(B)&&(I._endDate=B),(Mb(I,M)||n.skippedSegments)&&(n.dateRanges[I.ID]=I)}}}else{if(n.lowLatency){c++;continue}a.sn=c,a.cc=l,a.url=Pb(i,t),s&&(a.key=s.clone(c)),o&&(a.initSegment=o),n.segments.push(a),a=new Eb(t),c++}n.segments=n.segments.filter((function(e){return 0!==e.duration}));var U=n.segments[n.segments.length-1];return U&&(h&&(U.isLast=!0),n.endSN=U.sn,n.endPartIndex=U.partIndex),h&&(n.live=!1),n.totalDuration=u,n.endCC=l,n}(i,r,n):function(e,t){for(var r,n=new db,i=0,a=[],o=[];r=e[i++];){var s=Lb(r);if(s){var u=y(s,2),c=u[0],l=u[1];if("VERSION"===c)n.version=parseInt(l);else if("MEDIA"===c&&l){var f=Cb(l),h=void 0;switch(f.TYPE){case"AUDIO":h=new _b;break;case"SUBTITLES":h=new bb;break;default:h=new gb}h.url=Pb(f.URI,t),h.default="YES"===f.DEFAULT,h.autoSelect="YES"===f.AUTOSELECT,h.group=f["GROUP-ID"],h.name=f.NAME,h.lang=f.LANGUAGE,f.CHANNELS&&(h.channels=Number(f.CHANNELS.split("/")[0]),Number.isNaN(h.channels)&&(h.channels=0)),"AUDIO"===f.TYPE&&f.URI&&a.push(h),"SUBTITLES"===f.TYPE&&o.push(h)}else if("STREAM-INF"===c&&l){var d=new Sb,p=Cb(l);if(d.bitrate=parseInt(p["AVERAGE-BANDWIDTH"]||p.BANDWIDTH),d.name=p.NAME,d.url=Pb(e[i++],t),p.RESOLUTION){var v=y(p.RESOLUTION.split("x"),2),m=v[0],g=v[1];d.width=parseInt(m),d.height=parseInt(g)}if(p.CODECS){var _=p.CODECS.split(/[ ,]+/).filter(Boolean);d.videoCodec=Ib("video",_),d.audioCodec=Ib("audio",_),d.textCodec=Ib("text",_)}d.audioGroup=p.AUDIO,d.subtitleGroup=p.SUBTITLES,n.streams.push(d)}}}return n.streams.forEach((function(e,t){e.id=t})),a.length&&(a.forEach((function(e,t){e.id=t})),n.streams.forEach((function(e){e.audioGroup&&(e.audioStreams=a.filter((function(t){return t.group===e.audioGroup})))}))),o.length&&(o.forEach((function(e,t){e.id=t})),n.streams.forEach((function(e){e.subtitleGroup&&(e.subtitleStreams=o.filter((function(t){return t.group===e.subtitleGroup})))}))),n}(i,r)}},{key:"isMediaPlaylist",value:function(e){return e.includes("#EXTINF:")||e.includes("#EXT-X-TARGETDURATION:")}}]),e}(),Ub=function(){function e(t){var n=this;s(this,e),l(this,"_emitOnLoaded",(function(e,t){var r=e.response,i=e.options||{},a=i.firstByteTime,o=i.startTime,s=i.endTime,u=i.contentLength,c=s-o;n.hls.emit(gg.SPEED,{time:c,byteLength:u,url:t}),n.hls.emit(gg.LOAD_COMPLETE,{url:t,elapsed:c||0}),n.hls.emit(gg.TTFB,{url:t,responseUrl:r.url,elapsed:a-o}),n.hls.emit(gg.LOAD_RESPONSE_HEADERS,{headers:r.headers,url:t})})),l(this,"_onLoaderRetry",(function(e,t){n.hls.emit(ob.LOAD_RETRY,{error:zy.network(e),retryTime:t})})),this.hls=t,this._timer=null,this._useLowLatency=t.config.useLowLatency;var i=this.hls.config,a=i.retryCount,o=i.retryDelay,u=i.manifestLoadTimeout,c=i.fetchOptions;this._loader=new Tg(r(r({},c),{},{responseType:"text",retry:a,retryDelay:o,timeout:u,onRetryError:this._onLoaderRetry})),this._audioLoader=new Tg(r(r({},c),{},{responseType:"text",retry:a,retryDelay:o,timeout:u,onRetryError:this._onLoaderRetry})),this._subtitleLoader=new Tg(r(r({},c),{},{responseType:"text",retry:a,retryDelay:o,timeout:u,onRetryError:this._onLoaderRetry}))}var t;return c(e,[{key:"load",value:(t=o(n().mark((function e(t,r,i){var a,o,s,u,c,l,f,h,d,p,v,m,g,_,b,S,k,E,w,x;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=[this._loader.load(t)],r&&a.push(this._audioLoader.load(r)),i&&a.push(this._subtitleLoader.load(i)),e.prev=3,e.next=6,Promise.all(a);case 6:if(h=e.sent,d=y(h,3),p=d[0],v=d[1],m=d[2],p){e.next=13;break}return e.abrupt("return",[]);case 13:this._emitOnLoaded(p,t),o=p.data,c=p.response.url||t,r?(s=null==v?void 0:v.data,u=null==m?void 0:m.data,l=(null==v||null===(g=v.response)||void 0===g?void 0:g.url)||r,f=(null==m||null===(_=m.response)||void 0===_?void 0:_.url)||i,s&&this._emitOnLoaded(v,r),u&&this._emitOnLoaded(m,i)):(u=null==v?void 0:v.data,f=(null==v||null===(b=v.response)||void 0===b?void 0:b.url)||i,u&&this._emitOnLoaded(v,i)),e.next=22;break;case 19:throw e.prev=19,e.t0=e.catch(3),zy.network(e.t0);case 22:if(S=this.hls.config.onPreM3U8Parse,e.prev=23,S&&(o=S(o)||o,s&&(s=S(s,!0)||s),u&&(u=S(u,!0)||u)),k=Bb.parse(o,c,this._useLowLatency),!1!==(null===(x=k)||void 0===x?void 0:x.live)||!k.segments||k.segments.length){e.next=28;break}throw new Error("empty segments list");case 28:s&&(E=Bb.parse(s,l,this._useLowLatency)),u&&(w=Bb.parse(u,f,this._useLowLatency)),e.next=35;break;case 32:throw e.prev=32,e.t1=e.catch(23),new zy(Oy,Vy.HLS,e.t1);case 35:return k&&(k.isMaster?this.hls.emit(ob.HLS_MANIFEST_LOADED,{playlist:k}):(this._useLowLatency&&(k.canBlockReload?this.deliveryDirectives=new xb(k.nextSN,k.nextIndex,""):this.deliveryDirectives=null),this.hls.emit(ob.HLS_LEVEL_LOADED,{playlist:k}))),e.abrupt("return",[k,E,w]);case 37:case"end":return e.stop()}}),e,this,[[3,19],[23,32]])}))),function(e,r,n){return t.apply(this,arguments)})},{key:"parseText",value:function(e,t){var r,n=this.hls.config.onPreM3U8Parse;try{var i;if(n&&(e=n(e)||e),!1===(null===(i=r=Bb.parse(e,t,this._useLowLatency))||void 0===i?void 0:i.live)&&r.segments&&!r.segments.length)throw new Error("empty segments list")}catch(Xb){throw new zy(Oy,Vy.HLS,Xb)}return r&&(r.isMaster?this.hls.emit(ob.HLS_MANIFEST_LOADED,{playlist:r}):this.hls.emit(ob.HLS_LEVEL_LOADED,{playlist:r})),[r]}},{key:"poll",value:function(e,t,r,i,a,s){var u=this;clearTimeout(this._timer),s=s||3e3;var c=this.hls.config.pollRetryCount,l=function(){var f=o(n().mark((function o(){var f,h;return n().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return clearTimeout(u._timer),f=e,n.prev=2,u.deliveryDirectives&&(f=u.deliveryDirectives.addDirectives(e)),n.next=6,u.load(f,t,r);case 6:if((h=n.sent)[0]){n.next=9;break}return n.abrupt("return");case 9:c=u.hls.config.pollRetryCount,i(h[0],h[1],h[2]),n.next=17;break;case 13:n.prev=13,n.t0=n.catch(2),--c<=0&&a(n.t0);case 17:u._timer=setTimeout(l,s);case 18:case"end":return n.stop()}}),o,null,[[2,13]])})));return function(){return f.apply(this,arguments)}}();this._timer=setTimeout(l,s)}},{key:"stopPoll",value:function(){return clearTimeout(this._timer),this.cancel()}},{key:"cancel",value:function(){return Promise.all([this._loader.cancel(),this._audioLoader.cancel()])}}]),e}();function Nb(e,t,r){return t>r&&(r=t),Math.min(Math.max(e,t),r)}var Fb=new Yy("playlist"),jb=function(){function e(t,r,n){s(this,e),l(this,"live",void 0),l(this,"id",0),l(this,"bitrate",0),l(this,"width",0),l(this,"height",0),l(this,"name",""),l(this,"url",""),l(this,"audioCodec",""),l(this,"videoCodec",""),l(this,"textCodec",""),l(this,"startCC",0),l(this,"endCC",0),l(this,"startSN",0),l(this,"endSN",-1),l(this,"totalDuration",0),l(this,"targetDuration",0),l(this,"partTargetDuration",0),l(this,"canSkipUntil",0),l(this,"canSkipDateRanges",!1),l(this,"skippedSegments",0),l(this,"canBlockReload",!1),l(this,"partHoldBack",0),l(this,"lowLatency",!1),l(this,"endPartIndex",0),l(this,"snDiff",null),l(this,"segments",[]),l(this,"audioStreams",[]),l(this,"subtitleStreams",[]),l(this,"closedCaptions",[]),l(this,"currentAudioStream",null),l(this,"currentSubtitleStream",null),this.update(this._setLLPlaybackPoint(t),r,n)}return c(e,[{key:"lastSegment",get:function(){return this.segments.length?this.segments[this.segments.length-1]:null}},{key:"segmentDuration",get:function(){var e;return this.targetDuration||(null===(e=this.segments[0])||void 0===e?void 0:e.duration)||0}},{key:"liveEdge",get:function(){return this.endTime},set:function(e){this.endTime=e}},{key:"endTime",get:function(){var e;return(null===(e=this.lastSegment)||void 0===e?void 0:e.end)||0},set:function(e){var t=this.lastSegment;t&&(t.duration=e-t.start)}},{key:"currentSubtitleEndSn",get:function(){var e;return(null===(e=this.currentSubtitleStream)||void 0===e?void 0:e.endSN)||0}},{key:"clearOldSegment",value:function(e,t){return this.currentAudioStream&&this._clearSegments(e,t),this._clearSegments(e,t)}},{key:"getAudioSegment",value:function(e){if(e&&this.currentAudioStream){var t=e.sn-this.snDiff;return this.currentAudioStream.segments.find((function(e){return e.sn===t}))}}},{key:"update",value:function(e,t){this.url=e.url,Array.isArray(e.segments)?(null!==this.live&&void 0!==this.live||(this.live=e.live),this._updateSegments(e,this),this.startCC=e.startCC,this.endCC=e.endCC,this.startSN=e.startSN,this.endSN=e.endSN||-1,this.totalDuration=e.totalDuration,this.targetDuration=e.targetDuration,this.live=e.live,this.lowLatency=e.lowLatency,this.canBlockReload=e.canBlockReload,this.canSkipDateRanges=e.canSkipDateRanges,this.canSkipUntil=e.canSkipUntil,this.partHoldBack=e.partHoldBack,this.partTargetDuration=e.partTargetDuration,this.skippedSegments=e.skippedSegments,this.endPartIndex=e.endPartIndex,t&&this.currentAudioStream&&Array.isArray(t.segments)&&(this._updateSegments(t,this.currentAudioStream),(null===this.snDiff||void 0===this.snDiff)&&e.segments.length&&t.segments.length&&(this.snDiff=e.segments[0].sn-t.segments[0].sn))):(this.id=e.id,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.name=e.name,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.textCodec=e.textCodec,this.audioStreams=e.audioStreams,this.subtitleStreams=e.subtitleStreams,!this.currentAudioStream&&this.audioStreams.length&&(this.currentAudioStream=this.audioStreams.find((function(e){return e.default}))||this.audioStreams[0]),!this.currentSubtitleStream&&this.subtitleStreams.length&&(this.currentSubtitleStream=this.subtitleStreams.find((function(e){return e.default}))||this.subtitleStreams[0]))}},{key:"updateSubtitle",value:function(e){var t=this;if(e&&this.currentSubtitleStream&&Array.isArray(e.segments)){var r=this._updateSegments(e,this.currentSubtitleStream),n=this.currentSubtitleStream.segments;if(n.length>100&&(this.currentSubtitleStream.segments=n.slice(100)),r)return r.map((function(e){return{sn:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end,lang:t.currentSubtitleStream.lang}}))}}},{key:"switchSubtitle",value:function(e){var t=this.subtitleStreams.find((function(t){return t.lang===e})),r=this.currentSubtitleStream;t&&(this.currentSubtitleStream=t,r.segments=[])}},{key:"_setLLPlaybackPoint",value:function(e){if(!e.lowLatency||!e.segments.length)return e;for(var t=e.totalDuration-e.partHoldBack,r=e.segments,n=0,i=0,a=r.length;i<a;i++)r[i].start<=t&&r[i].independent&&(n=i);var o=r.slice(n),s=0;return o.forEach((function(e){e.start=s,s=e.end})),e.segments=o,e.totalDuration=s,e.startSN=o[0].sn,e.startCC=o[0].cc,Fb.log("set ll-hls playback point: SN=".concat(e.startSN," partIndex=").concat(o[0].partIndex,", duration=").concat(s)),e}},{key:"_clearSegments",value:function(e,t){for(var r=0,n=this.segments,i=0,a=n.length;i<a;i++)if(n[i].end>=e){r=i;break}return r>t&&(r=t),r&&(this.segments=this.segments.slice(r),this.currentAudioStream&&(this.currentAudioStream.segments=this.currentAudioStream.segments.slice(r))),t-r}},{key:"_updateSegments",value:function(e,t){var r=t.segments;if(this.live){var n,i=e.lowLatency,a=r[r.length-1],o=null!==(n=null==a?void 0:a.sn)&&void 0!==n?n:-1,s=(null==a?void 0:a.partIndex)||0,u=o<e.endSN&&e.segments.length;if(i&&(u=u||s<e.endPartIndex),u){Fb.log("update segments: endSN:".concat(o,", partIndex:").concat(s," --\x3e endSN:").concat(e.endSN,", partIndex:").concat(e.endPartIndex));var c=e.segments.findIndex((function(e){return e.sn===o&&e.partIndex===s})),l=c<0?e.segments:e.segments.slice(c+1);if(r.length&&l.length){var f=a.end,h=f;l.forEach((function(e){e.start=f,f=e.end})),Fb.log("liveEdge: ".concat(h," -> ").concat(f));var d=(null==a?void 0:a.cc)||-1;d>l[0].cc&&l.forEach((function(e){return e.cc+=d}))}return t.endSN=e.endSN,t.segments=r.concat(l),l}}else t.segments=e.segments}}]),e}(),Vb=function(){function e(t){s(this,e),l(this,"streams",[]),l(this,"currentStream",null),l(this,"dvrWindow",0),l(this,"_segmentPointer",-1),this.hls=t}return c(e,[{key:"lowLatency",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lowLatency}},{key:"lastSegment",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lastSegment}},{key:"currentSegment",get:function(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer]}},{key:"nextSegment",get:function(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer+1]}},{key:"currentSegments",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.segments}},{key:"currentSubtitleEndSn",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.currentSubtitleEndSn}},{key:"liveEdge",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.liveEdge},set:function(e){this.currentStream&&(this.currentStream.liveEdge=e)}},{key:"totalDuration",get:function(){var e;return(null===(e=this.currentStream)||void 0===e?void 0:e.totalDuration)||0}},{key:"seekRange",get:function(){var e=this.currentSegments;if(e&&e.length)return[e[0].start,e[e.length-1].end]}},{key:"nbSegments",get:function(){var e;return(null===(e=this.currentSegments)||void 0===e?void 0:e.length)||0}},{key:"isEmpty",get:function(){var e;return!(null!==(e=this.currentSegments)&&void 0!==e&&e.length)}},{key:"isLive",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.live}},{key:"hadSegmentLoaded",get:function(){return-1!==this._segmentPointer}},{key:"hasSubtitle",get:function(){var e;return!(null===(e=this.currentStream)||void 0===e||!e.currentSubtitleStream)}},{key:"getAudioSegment",value:function(e){var t;return null===(t=this.currentStream)||void 0===t?void 0:t.getAudioSegment(e)}},{key:"moveSegmentPointer",value:function(e){var t;null==e&&(e=this._segmentPointer+1),this._segmentPointer=Nb(e,-1,null===(t=this.currentSegments)||void 0===t?void 0:t.length)}},{key:"reset",value:function(){this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1}},{key:"getSegmentByIndex",value:function(e){var t;return null===(t=this.currentSegments)||void 0===t?void 0:t[e]}},{key:"setNextSegmentByIndex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._segmentPointer=e-1}},{key:"setNextSegmentBySN",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=null===(e=this.currentSegments)||void 0===e?void 0:e.findIndex((function(e){return e.sn===t}));return-1!==r&&this.setNextSegmentByIndex(r+1),r}},{key:"findSegmentIndexByTime",value:function(e){var t=this.currentSegments;if(t){for(var r,n=0,i=t.length;n<i;n++)if(e>=(r=t[n]).start&&e<r.end)return n;var a=t[t.length-1];if(Math.abs(e-(null==a?void 0:a.end))<.2)return t.length-1}}},{key:"upsertPlaylist",value:function(e,t,r){var n=this;if(e){if(e.isMaster)this.streams.length=e.streams.length,e.streams.filter((function(e){return e.url})).forEach((function(e,t){n.streams[t]?n.streams[t].update(e):n.streams[t]=new jb(e)})),this.currentStream=this.streams[0];else if(Array.isArray(e.segments)){var i=this.currentStream;if(i){i.update(e,t,r);var a=i.updateSubtitle(r);a&&this.hls.emit(ob.SUBTITLE_SEGMENTS,{list:a})}else this.reset(),this.currentStream=this.streams[0]=new jb(e,t,r)}this.currentStream&&this.hls.isLive&&!this.dvrWindow&&(this.dvrWindow=this.currentSegments.reduce((function(e,t){return e+=t.duration}),0))}}},{key:"updateSegmentsRanges",value:function(e,t){var r;(null===(r=this.currentSegments)||void 0===r?void 0:r.filter((function(t){return t.sn>=e}))).forEach((function(e){e.start=t,t=e.end}))}},{key:"switchSubtitle",value:function(e){var t;null===(t=this.currentStream)||void 0===t||t.switchSubtitle(e)}},{key:"clearOldSegment",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.hls.config.maxPlaylistSize||50,t=this.currentStream;if(this.dvrWindow&&t){var r=t.endTime-this.dvrWindow;if(!(r<=0))t.segments.length<=e||(this._segmentPointer=t.clearOldSegment(r,this._segmentPointer))}}},{key:"checkSegmentTrackChange",value:function(e,t){var r=this.findSegmentIndexByTime(e),n=this.getSegmentByIndex(r);if(n&&(n.hasAudio||n.hasVideo)){if(2!==t&&n.hasAudio&&n.hasVideo)return n;if(!(n.end-e>.3)){var i=this.getSegmentByIndex(r+1);if(i&&(i.hasAudio||i.hasVideo))return i.hasAudio!==n.hasAudio||i.hasVideo!==n.hasVideo?i:void 0}}}},{key:"feedbackLiveEdge",value:function(e,t){var r;this.currentSegments&&((null===(r=this.lastSegment)||void 0===r?void 0:r.sn)===e.sn?this.liveEdge=t:this.updateSegmentsRanges(e.sn+1,t))}}]),e}(),Gb=function(){function e(t){var n=this;s(this,e),l(this,"error",null),l(this,"_emitOnLoaded",(function(e,t){var r=e.data,i=e.response,a=e.options||{},o=a.firstByteTime,s=a.startTime,u=a.endTime,c=a.contentLength,l=u-s;n._bandwidthService.addRecord(c||r.byteLength,l),n.hls.emit(gg.SPEED,{time:l,byteLength:c,url:t}),n.hls.emit(gg.LOAD_COMPLETE,{url:t,elapsed:l||0}),n.hls.emit(gg.TTFB,{url:t,responseUrl:i.url,elapsed:o-s}),n.hls.emit(gg.LOAD_RESPONSE_HEADERS,{headers:i.headers,url:t})})),l(this,"_onLoaderRetry",(function(e,t){n.hls.emit(gg.LOAD_RETRY,{error:zy.network(e),retryTime:t})})),this.hls=t,this._bandwidthService=new Og,this._mapCache={},this._keyCache={};var i=this.hls.config,a=i.retryCount,o=i.retryDelay,u=i.loadTimeout,c=i.fetchOptions;this._segmentLoader=new Tg(r(r({},c),{},{responseType:"arraybuffer",retry:a,retryDelay:o,timeout:u,onRetryError:this._onLoaderRetry})),this._audioSegmentLoader=new Tg(r(r({},c),{},{responseType:"arraybuffer",retry:a,retryDelay:o,timeout:u,onRetryError:this._onLoaderRetry})),this._keyLoader=new Tg(r(r({},c),{},{responseType:"arraybuffer",retry:a,retryDelay:o,timeout:u,onRetryError:this._onLoaderRetry}))}var t,i;return c(e,[{key:"speedInfo",value:function(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed()}}},{key:"load",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r,i=[];return e&&(i[0]=this.loadVideoSegment(e,r)),t&&(i[1]=this.loadAudioSegment(t,n)),Promise.all(i)}},{key:"loadVideoSegment",value:function(e,t){return this._loadSegment(this._segmentLoader,e,t)}},{key:"loadAudioSegment",value:function(e,t){return this._loadSegment(this._audioSegmentLoader,e,t)}},{key:"_loadSegment",value:(i=o(n().mark((function e(t,r,i){var a,o,s,u,c,l,f,h,d,p,v,m,g,_,b,S=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f=[],this.hls.emit(gg.LOAD_START,{url:r.url}),f[0]=t.load(r.url),i&&r.initSegment&&(d=r.initSegment.url,(o=this._mapCache[d])||(this.hls.emit(gg.LOAD_START,{url:d}),f[1]=t.load(d).then((function(e){e&&(Object.keys(S._mapCache)>30&&(S._mapCache={}),o=S._mapCache[d]=e.data,S._emitOnLoaded(e,d))}))),(p=null===(h=r.initSegment.key)||void 0===h?void 0:h.url)&&(l=r.initSegment.key.iv,(c=this._keyCache[p])||(this.hls.emit(gg.LOAD_START,{url:p}),f[2]=this._keyLoader.load(p).then((function(e){e&&(c=S._keyCache[p]=e.data,S._emitOnLoaded(e,p))}))))),(v=null===(a=r.key)||void 0===a?void 0:a.url)&&r.key.isSegmentEncrypted()&&(u=r.key.iv,(s=this._keyCache[v])||(this.hls.emit(gg.LOAD_START,{url:v}),f[3]=this._keyLoader.load(v).then((function(e){e&&(s=S._keyCache[v]=e.data,S._emitOnLoaded(e,v))})))),e.next=8,Promise.all(f);case 8:if(m=e.sent,g=y(m,1),_=g[0]){e.next=13;break}return e.abrupt("return");case 13:return b=_.data,this._emitOnLoaded(_,r.url),e.abrupt("return",{data:b,map:o,key:s,mapKey:c,keyIv:u,mapKeyIv:l});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return i.apply(this,arguments)})},{key:"reset",value:function(){this.error=null,this._mapCache={},this._keyCache={},this._bandwidthService.reset()}},{key:"cancel",value:(t=o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this._keyLoader.cancel(),this._segmentLoader.cancel(),this._audioSegmentLoader.cancel()]);case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),zb=new Yy("hls"),Hb=function(e){f(O,e);var t,a,u,h,d,p,_,b,S,k,E,w,x,T,A,D=m(O);function O(e){var t,i,a;return s(this,O),l(v(t=D.call(this)),"version",O.version),l(v(t),"media",null),l(v(t),"config",null),l(v(t),"_manifestLoader",null),l(v(t),"_segmentLoader",null),l(v(t),"_playlist",null),l(v(t),"_bufferService",null),l(v(t),"_gapService",null),l(v(t),"_seiService",null),l(v(t),"_stats",null),l(v(t),"_prevSegSn",null),l(v(t),"_prevSegCc",null),l(v(t),"_tickTimer",null),l(v(t),"_tickInterval",500),l(v(t),"_segmentProcessing",!1),l(v(t),"_reloadOnPlay",!1),l(v(t),"_switchUrlOpts",null),l(v(t),"_isProcessQuotaExceeded",!1),l(v(t),"_loadSegment",o(n().mark((function e(){var r,i,a,o,s,u,c,l;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t._segmentProcessing&&t.media){e.next=2;break}return e.abrupt("return");case 2:if(r=t._playlist,i=r.nextSegment,a=r.lastSegment,o=v(t),s=o.config,.016,u=Math.min(Math.max((null==a?void 0:a.duration)-.008||0,.016),.1),i){e.next=8;break}return e.abrupt("return");case 8:if(t.isLive){e.next=18;break}if(c=t.bufferInfo(),t.media.paused&&!t.media.currentTime&&(c=t.bufferInfo(c.nextStart||.5)),l=Math.abs(c.end-t.media.duration)<u,!(c.remaining>=s.preloadTime||l)){e.next=15;break}return t._tryEos(),e.abrupt("return");case 15:if(!s.preferMMSStreaming||t._bufferService.msStreaming){e.next=17;break}return e.abrupt("return");case 17:!t._urlSwitching&&t._prevSegSn!==i.sn-1&&c.end&&Math.abs(i.start-c.end)>1&&t._playlist.setNextSegmentByIndex(t._playlist.findSegmentIndexByTime(c.end+.1));case 18:return e.abrupt("return",t._loadSegmentDirect());case 19:case"end":return e.stop()}}),e)})))),l(v(t),"_onLoadeddata",(function(){t.isLive&&!t.config.mseLowLatency&&t.media.duration!==1/0&&t._bufferService.updateDuration(1/0).catch((function(e){}))})),l(v(t),"_onPlay",o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.media.seeking||0!==t.media.currentTime){e.next=3;break}return zb.debug("replay currentTime 0, return"),e.abrupt("return");case 3:if(clearTimeout(t._disconnectTimer),!t._reloadOnPlay){e.next=9;break}t._reloadOnPlay=!1,t.replay(!0),e.next=12;break;case 9:return e.next=11,t._loadSegment();case 11:t._startTick();case 12:case"end":return e.stop()}}),e)})))),l(v(t),"_onPause",(function(){if(t.isLive){if(!t._reloadOnPlay){var e=t.config.disconnectTime;if(null==e&&(e=t._playlist.dvrWindow),!Number.isFinite(e))return;clearTimeout(t._disconnectTimer),t._disconnectTimer=setTimeout((function(){t._reloadOnPlay=!0,t._clear()}),e||0)}}else t._stopTick()})),l(v(t),"_onSeeking",o(n().mark((function e(){var r,i,a,o,s,u,c;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.media){e.next=2;break}return e.abrupt("return");case 2:if(t._onCheckQuotaExceeded(),r=t.media.currentTime,!(i=t._playlist.seekRange)){e.next=10;break}if(!((a=Nb(r,i[0],t.isLive?i[1]:t.media.duration))>=0&&Math.abs(r-a)>=.1)){e.next=10;break}return t.media.currentTime=a,e.abrupt("return");case 10:if(o=t._playlist.currentSegment,s=Ay.info(Ay.get(t.media),r,.1),!o){e.next=17;break}if(!(s.end&&Math.abs(s.end-o.end)<.2)){e.next=15;break}return e.abrupt("return");case 15:if(!t.isLive||!s.end){e.next=17;break}return e.abrupt("return");case 17:if(u=t._playlist.findSegmentIndexByTime(r),c=t._playlist.getSegmentByIndex(u),null!=u&&c&&(!t._segmentProcessing||c!==t._playlist.nextSegment)){e.next=21;break}return e.abrupt("return");case 21:return zb.debug("seek to",r,c),t._playlist.setNextSegmentByIndex(u),t._stopTick(),e.next=26,t._segmentLoader.cancel();case 26:if(t._segmentProcessing=!1,s.end&&!t.isLive){e.next=30;break}return e.next=30,t._loadSegmentDirect(!0);case 30:t._startTick();case 31:case"end":return e.stop()}}),e)})))),l(v(t),"_onTimeupdate",(function(){if(t.media){var e,r=t.config;if(r.isLive&&r.maxLatency&&r.targetLatency&&t.media){var n=t._playlist.liveEdge;if(!n)return;var i=n-t.media.currentTime;i>=r.maxLatency&&(zb.debug("latency jump, currentTime:".concat(t.media.currentTime,", liveEdge:").concat(n,", latency=").concat(i)),t.media.currentTime=n-r.targetLatency)}if(r.seiInTime)null===(e=t._seiService)||void 0===e||e.throw(t.media.currentTime);t.config.allowedStreamTrackChange&&!t.config.softDecode&&t._checkStreamTrackChange(t.media.currentTime)}})),l(v(t),"_tick",(function(){if(t.media){t._startTick();var e=t.media,r=t._segmentLoader.error;if(t._onCheckQuotaExceeded(),t._isProcessQuotaExceeded&&(t._bufferService.isFull()||(t._isProcessQuotaExceeded=!1,t._segmentProcessing=!1)),r){(!e.readyState||t.bufferInfo(.5).remaining<1)&&(r.fatal=!0,t._emitError(zy.network(r)))}else e.readyState&&(!function(e){return e&&!e.paused&&!e.ended&&0!==e.playbackRate&&0!==e.readyState}(e)?e.readyState<2&&t._gapService&&t._gapService.do(e,t.config.maxJumpDistance,!e.currentTime||t.isLive):(t._loadSegment(),t._gapService&&t._gapService.do(e,t.config.maxJumpDistance,t.isLive))),t.isLive||t._tryEos()}})),t.config=(a=(null==(i=e)?void 0:i.media)||document.createElement("video"),e=r(r({maxPlaylistSize:50,retryCount:3,retryDelay:1e3,pollRetryCount:2,loadTimeout:1e4,manifestLoadTimeout:1e4,preloadTime:30,softDecode:!1,bufferBehind:10,maxJumpDistance:3,startTime:0,useLowLatency:!0,targetLatency:10,maxLatency:20,allowedStreamTrackChange:!0,seiInTime:!1,manifestList:[],minSegmentsStartPlay:3,preferMMS:!1,preferMMSStreaming:!1,mseLowLatency:!0,fixerConfig:{forceFixLargeGap:!1,largeGapThreshold:5}},i),{},{media:a})),t.media=t.config.media,t._manifestLoader=new Ub(v(t)),t._segmentLoader=new Gb(v(t)),t._playlist=new Vb(v(t)),t._bufferService=new hb(v(t)),e.seiInTime&&(t._seiService=new Dg(v(t))),e.softDecode||(t._gapService=new Ag),t._stats=new Cg(v(t),9e4),t.media.addEventListener("loadeddata",t._onLoadeddata),t.media.addEventListener("play",t._onPlay),t.media.addEventListener("pause",t._onPause),t.media.addEventListener("seeking",t._onSeeking),t.media.addEventListener("timeupdate",t._onTimeupdate),t}return c(O,[{key:"isLive",get:function(){return this._playlist.isLive}},{key:"streams",get:function(){return this._playlist.streams}},{key:"currentStream",get:function(){return this._playlist.currentStream}},{key:"hasSubtitle",get:function(){return this._playlist.hasSubtitle}},{key:"totalDuration",get:function(){return this._playlist.totalDuration}},{key:"baseDts",get:function(){var e;return null===(e=this._bufferService)||void 0===e?void 0:e.baseDts}},{key:"abrSwitchPoint",get:function(){var e=this._urlSwitching?this._playlist.currentSegment:this._playlist.nextSegment;return e?e.start+e.duration/2:null}},{key:"speedInfo",value:function(){return this._segmentLoader.speedInfo()}},{key:"bufferInfo",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.1;return Ay.info(Ay.get(this.media),null===(e=this.media)||void 0===e?void 0:e.currentTime,t)}},{key:"getStats",value:function(){return this._stats.getStats()}},{key:"playbackQuality",value:function(){return function(e){if(!e)return{};if("function"==typeof e.getVideoPlaybackQuality){var t=e.getVideoPlaybackQuality();return{droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}return{droppedVideoFrames:e.webkitDroppedFrameCount,totalVideoFrames:e.webkitDecodedFrameCount,creationTime:performance.now()}}(this.media)}},{key:"load",value:(A=o(n().mark((function e(){var t,r,a,o=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:"",a="boolean"==typeof(r=o.length>1&&void 0!==o[1]?o[1]:{})?r:!(null==r||!r.reuseMse),"object"===i(r)&&null!=r&&r.clearSwitchStatus&&(this._urlSwitching=!1,this._switchUrlOpts=null,this.config.startTime=void 0),t&&(this.config.url=t),t=this.config.url,e.next=8,this._reset(a);case 8:return e.next=10,this._loadData(t);case 10:this._startTick();case 11:case"end":return e.stop()}}),e,this)}))),function(){return A.apply(this,arguments)})},{key:"_loadData",value:(T=o(n().mark((function e(t){var r,i,a,o,s,u,c,l,f,h,d,p,v;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{t&&(t=t.trim())}catch(n){}if(t){e.next=3;break}throw this._emitError(new zy(Fy,Vy.OPTION,null,null,"m3u8 url is missing"));case 3:return e.next=5,this._loadM3U8(t);case 5:if(r=e.sent,i=this._playlist.currentStream,!this._urlSwitching){e.next=23;break}if(!this.isLive){e.next=14;break}a=this._playlist.setNextSegmentBySN(this._prevSegSn),zb.log("segment nb=".concat(this._prevSegSn," index of ").concat(a," in the new playlist")),-1===a&&(this._prevSegCc=null,this._prevSegSn=null),e.next=23;break;case 14:if(0===i.bitrate&&null!==(o=this._switchUrlOpts)&&void 0!==o&&o.bitrate&&(i.bitrate=null===(c=this._switchUrlOpts)||void 0===c?void 0:c.bitrate),l="number"==typeof(null===(s=this._switchUrlOpts)||void 0===s?void 0:s.startTime)?null===(u=this._switchUrlOpts)||void 0===u?void 0:u.startTime:this._getSeamlessSwitchPoint(),this.config.startTime=l,f=this._playlist.findSegmentIndexByTime(l),!(h=this._playlist.getSegmentByIndex(f+1))){e.next=23;break}return d=h.start,e.next=23,this._bufferService.removeBuffer(d);case 23:if(r){e.next=25;break}return e.abrupt("return");case 25:if(!this.isLive){e.next=36;break}if(this._bufferService.setLiveSeekableRange(0,4294967295),zb.log("totalDuration first time got:",this._playlist.totalDuration),zb.log("nb segments got:",this._playlist.nbSegments),this.config.targetLatency<this._playlist.totalDuration&&(this.config.targetLatency=this._playlist.totalDuration,this.config.maxLatency=1.5*this.config.targetLatency),r.isMaster||this._pollM3U8(t),!(this._playlist.nbSegments<this.config.minSegmentsStartPlay)){e.next=33;break}return e.abrupt("return");case 33:return e.next=35,this._loadSegment();case 35:return e.abrupt("return");case 36:return e.next=38,this._bufferService.updateDuration(i.totalDuration);case 38:return(p=this.config.startTime)&&(null!==(v=this._switchUrlOpts)&&void 0!==v&&v.seamless||(this.media.currentTime=p),this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(p)||0)),e.next=42,this._loadSegment();case 42:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"replay",value:(x=o(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.config.startTime=0,this._urlSwitching=!1,this._switchUrlOpts=null,e.next=5,this.load();case 5:return this._reloadOnPlay=!1,e.abrupt("return",this.media.play(!t));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"switchURL",value:(w=o(n().mark((function e(t){var r,a,o,s,u,c,l,f=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=f.length>1&&void 0!==f[1]?f[1]:{},a={seamless:!1,startTime:0,bitrate:0},e.t0=i(r),e.next="number"===e.t0?5:"boolean"===e.t0?7:"object"===e.t0?9:11;break;case 5:return r={startTime:r},e.abrupt("break",12);case 7:return r={seamless:r},e.abrupt("break",12);case 9:for(o in r)void 0!==r[o]&&null!==r[o]||delete r[o];return e.abrupt("break",12);case 11:throw"unsupported switchURL args: ".concat(r);case 12:if(r=Object.assign({},a,r),u=(s=r).seamless,c=s.startTime,this.config.url=t,this.config.startTime=c,this._switchUrlOpts=r,u){e.next=38;break}if(e.prev=18,!this.config.softDecode){e.next=23;break}e.t1=this.load(t),e.next=26;break;case 23:return e.next=25,this.load(t);case 25:e.t1=e.sent;case 26:l=e.t1,e.next=33;break;case 29:throw e.prev=29,e.t2=e.catch(18),this.emit(ob.SWITCH_URL_FAILED,e.t2),e.t2;case 33:return this._reloadOnPlay=!1,l&&this.emit(ob.SWITCH_URL_SUCCESS,{url:t}),e.abrupt("return",this.media.play(!0));case 38:return this._urlSwitching=!0,this.isLive||(this._prevSegSn=null,this._prevSegCc=null),this._playlist.reset(),this._bufferService.seamlessSwitch(),e.next=44,this._clear();case 44:return e.next=46,this._loadData(t);case 46:this._startTick();case 47:this._switchUrlOpts=null;case 48:case"end":return e.stop()}}),e,this,[[18,29]])}))),function(e){return w.apply(this,arguments)})},{key:"switchStream",value:(E=o(n().mark((function e(t){var r,i,a,o,s,u=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(u.length>1&&void 0!==u[1])||u[1],i=this.currentStream,a=this.streams,i&&i.id!==t&&a&&!(a.length<2)){e.next=5;break}return e.abrupt("return");case 5:if(o=a.find((function(e){return e.id===t}))){e.next=8;break}return e.abrupt("return");case 8:return e.prev=8,e.next=11,this._clear();case 11:if(!r){e.next=14;break}return e.next=14,this._bufferService.clearAllBuffer();case 14:e.next=19;break;case 16:throw e.prev=16,e.t0=e.catch(8),this._emitError(zy.create(e.t0));case 19:if(i.currentAudioStream&&o.audioStreams.length>2&&(s=i.currentAudioStream.id,o.currentAudioStream=o.audioStreams.find((function(e){return e.id===s}))||o.currentAudioStream),this._playlist.currentStream=o,e.prev=21,!this.isLive&&o.segments.length){e.next=25;break}return e.next=25,this._refreshM3U8();case 25:return this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(this.media.currentTime)||0),this._prevSegCc=null,e.next=29,this._loadSegmentDirect();case 29:e.next=35;break;case 31:throw e.prev=31,e.t1=e.catch(21),this._playlist.currentStream=i,e.t1;case 35:return this._startTick(),e.abrupt("return",o);case 37:case"end":return e.stop()}}),e,this,[[8,16],[21,31]])}))),function(e){return E.apply(this,arguments)})},{key:"switchAudioStream",value:(k=o(n().mark((function e(t){var r,i,a,o,s=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(s.length>1&&void 0!==s[1])||s[1],i=this.currentStream){e.next=4;break}return e.abrupt("return");case 4:if((a=i.currentAudioStream)&&a.id!==t&&!(i.audioStreams.length<2)){e.next=7;break}return e.abrupt("return");case 7:if(o=i.audioStreams.find((function(e){return e.id===t}))){e.next=10;break}return e.abrupt("return");case 10:return e.prev=10,e.next=13,this._clear();case 13:if(!r){e.next=16;break}return e.next=16,this._bufferService.clearAllBuffer();case 16:e.next=21;break;case 18:throw e.prev=18,e.t0=e.catch(10),this._emitError(zy.create(e.t0));case 21:if(i.currentAudioStream=o,e.prev=22,!this.isLive&&o.segments.length){e.next=26;break}return e.next=26,this._refreshM3U8();case 26:return this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(this.media.currentTime)||0),this._prevSegCc=null,e.next=30,this._loadSegmentDirect();case 30:e.next=36;break;case 32:throw e.prev=32,e.t1=e.catch(22),i.currentAudioStream=a,e.t1;case 36:return this._startTick(),e.abrupt("return",o);case 38:case"end":return e.stop()}}),e,this,[[10,18],[22,32]])}))),function(e){return k.apply(this,arguments)})},{key:"switchSubtitleStream",value:(S=o(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._playlist.switchSubtitle(t),e.next=3,this._manifestLoader.stopPoll();case 3:return e.next=5,this._refreshM3U8();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"detachMedia",value:(b=o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._bufferService){e.next=3;break}return e.next=3,this._bufferService.detachMedia();case 3:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"destroy",value:(_=o(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.media){e.next=2;break}return e.abrupt("return");case 2:return this.removeAllListeners(),this._playlist.reset(),this._segmentLoader.reset(),null===(t=this._seiService)||void 0===t||t.reset(),this.media.removeEventListener("loadeddata",this._onLoadeddata),this.media.removeEventListener("play",this._onPlay),this.media.removeEventListener("pause",this._onPause),this.media.removeEventListener("seeking",this._onSeeking),this.media.removeEventListener("timeupdate",this._onTimeupdate),e.next=13,Promise.all([this._clear(),this._bufferService.destroy()]);case 13:this.media=null;case 14:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"_loadM3U8",value:(p=o(n().mark((function e(t){var r,i,a,o,s,u,c;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(o=null===(i=this.config.manifestList)||void 0===i||null===(a=i.filter((function(e){return e.url===t}))[0])||void 0===a?void 0:a.manifest)){e.next=6;break}e.t0=this._manifestLoader.parseText(o,t),e.next=9;break;case 6:return e.next=8,this._manifestLoader.load(t);case 8:e.t0=e.sent;case 9:s=e.t0,u=y(s,1),r=u[0],e.next=17;break;case 14:throw e.prev=14,e.t1=e.catch(0),this._emitError(zy.create(e.t1));case 17:if(r){e.next=19;break}return e.abrupt("return");case 19:if(this._playlist.upsertPlaylist(r),!r.isMaster){e.next=24;break}return null!==(c=this._playlist.currentStream.subtitleStreams)&&void 0!==c&&c.length&&this.emit(ob.SUBTITLE_PLAYLIST,{list:this._playlist.currentStream.subtitleStreams}),e.next=24,this._refreshM3U8();case 24:return this.emit(ob.STREAM_PARSED),e.abrupt("return",r);case 26:case"end":return e.stop()}}),e,this,[[0,14]])}))),function(e){return p.apply(this,arguments)})},{key:"_refreshM3U8",value:function(){var e,t,r=this,n=this._playlist.currentStream;if(!n||!n.url)throw this._emitError(zy.create(null,null,new Error("m3u8 url is not defined")));var i=n.url,a=null===(e=n.currentAudioStream)||void 0===e?void 0:e.url,o=null===(t=n.currentSubtitleStream)||void 0===t?void 0:t.url;return this._manifestLoader.load(i,a,o).then((function(e){var t=y(e,3),n=t[0],s=t[1],u=t[2];n&&(r._playlist.upsertPlaylist(n,s,u),r.isLive&&r._pollM3U8(i,a,o))})).catch((function(e){throw r._emitError(zy.create(e))}))}},{key:"_pollM3U8",value:function(e,t,r){var n,i,a=this,o=this._playlist.isEmpty;this._playlist.lowLatency?n=1e3*(this._playlist.currentStream.partTargetDuration||0):n=1e3*((null===(i=this._playlist.lastSegment)||void 0===i?void 0:i.duration)||0);this._manifestLoader.poll(e,t,r,(function(e,t,r){a._playlist.upsertPlaylist(e,t,r),a._playlist.clearOldSegment(),(e&&o&&!a._playlist.isEmpty||!a._playlist.hadSegmentLoaded&&a._playlist.nbSegments>=a.config.minSegmentsStartPlay)&&a._loadSegment(),o&&(o=a._playlist.isEmpty)}),(function(e){a._emitError(zy.create(e))}),n)}},{key:"_loadSegmentDirect",value:(d=o(n().mark((function e(t){var r,i,a,o,s,u;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._playlist.nextSegment){e.next=3;break}return e.abrupt("return");case 3:return i=!1,a=null,e.prev=5,this._segmentProcessing=!0,zb.log("load segment, sn:".concat(r.sn,", [").concat(r.start,", ").concat(r.end,"], partIndex:").concat(r.partIndex)),e.next=10,this._reqAndBufferSegment(r,this._playlist.getAudioSegment(r));case 10:i=e.sent,e.next=16;break;case 13:e.prev=13,e.t0=e.catch(5),a=e.t0;case 16:return e.prev=16,this._segmentProcessing=!1,e.finish(16);case 19:if(!a){e.next=26;break}if(!this._bufferService.isFull()){e.next=25;break}return zb.log("load segment, sn:".concat(r.sn,", partIndex:").concat(r.partIndex)),this._segmentProcessing=!0,this._isProcessQuotaExceeded=!0,e.abrupt("return",!1);case 25:return e.abrupt("return",this._emitError(zy.create(a)));case 26:return i&&(s=this.bufferInfo().end,this.isLive&&!this.media.seeking&&s&&Math.abs(r.end-s)>1&&(zb.warn("segment: ".concat(r.sn," expected end=").concat(r.end,", real end=").concat(s)),this._playlist.feedbackLiveEdge(r,s)),u=(null===(o=this._playlist.currentStream)||void 0===o?void 0:o.url)===r.parentUrl,this._urlSwitching&&!u&&(zb.warn("pre playlist segment appended!"),this._bufferService.seamlessSwitch()),this.isLive&&this._urlSwitching&&u&&(this._urlSwitching=!1,this.emit(ob.SWITCH_URL_SUCCESS,{url:this.config.url})),this._playlist.moveSegmentPointer(),r.isLast?this._end():t||this._loadSegment()),e.abrupt("return",i);case 28:case"end":return e.stop()}}),e,this,[[5,13,16,19]])}))),function(e){return d.apply(this,arguments)})},{key:"_reqAndBufferSegment",value:(h=o(n().mark((function e(t,r){var i,a,o,s,u,c,l,f,h,d,p;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t?t.cc:r.cc,o=this._prevSegCc!==a,s=[],e.prev=3,e.next=6,this._segmentLoader.load(t,r,o);case 6:s=e.sent,e.next=14;break;case 9:throw e.prev=9,e.t0=e.catch(3),e.t0.fatal=!1,this._segmentLoader.error=e.t0,e.t0;case 14:if(s[0]){e.next=16;break}return e.abrupt("return");case 16:return e.next=18,(i=this._bufferService).decryptBuffer.apply(i,g(s));case 18:if(u=e.sent){e.next=21;break}return e.abrupt("return");case 21:return c=t?t.sn:r.sn,l=t?t.start:r.start,f=this._playlist.currentStream,this._bufferService.createSource(u[0],u[1],null==f?void 0:f.videoCodec,null==f?void 0:f.audioCodec),h=Date.now(),d=this._prevSegSn===c-1,this.isLive&&this._urlSwitching&&(p=this.bufferInfo().end,this._playlist.updateSegmentsRanges(c,p),zb.warn("update the new playlist liveEdge, segment id=".concat(c,", buffer start=").concat(p,", liveEdge=").concat(this._playlist.liveEdge)),l=p),e.next=30,this._bufferService.appendBuffer(t,r,u[0],u[1],o,d,l);case 30:return this.emit(ob.APPEND_COST,{elapsed:Date.now()-h,url:t.url}),e.next=33,this._bufferService.evictBuffer(this.config.bufferBehind);case 33:return this._prevSegCc=a,this._prevSegSn=c,e.abrupt("return",!0);case 36:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e,t){return h.apply(this,arguments)})},{key:"_onCheckQuotaExceeded",value:(u=o(n().mark((function e(){var t,r,i,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.media.currentTime,r=this.media.buffered,i=!1,a=0;case 4:if(!(a<r.length)){e.next=11;break}if(!(r.start(0)>=t&&t<r.end(a))){e.next=8;break}return i=!0,e.abrupt("break",11);case 8:a++,e.next=4;break;case 11:if(!this._bufferService.isFull()){e.next=17;break}if(o=i?this.config.bufferBehind:5,!((s=this.media.currentTime)-o>0)){e.next=17;break}return e.next=17,this._bufferService.removeBuffer(0,s-o);case 17:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"_checkStreamTrackChange",value:function(e){var t=this._playlist.checkSegmentTrackChange(e,this._bufferService.nbSb);t&&this.switchURL(this.config.url,t.start+.2)}},{key:"_clear",value:(a=o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._disconnectTimer),this._stopTick(),e.next=4,Promise.all([this._segmentLoader.cancel(),this._manifestLoader.stopPoll()]);case 4:this._segmentProcessing=!1;case 5:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"_reset",value:(t=o(n().mark((function e(){var t,r,i=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>0&&void 0!==i[0]&&i[0],this._reloadOnPlay=!1,this._prevSegSn=null,this._prevSegCc=null,this._switchUrlOpts=null,this._playlist.reset(),this._segmentLoader.reset(),null===(t=this._seiService)||void 0===t||t.reset(),this._stats.reset(),e.next=11,this._clear();case 11:return e.abrupt("return",this._bufferService.reset(r));case 12:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_end",value:function(){this._clear(),this._bufferService.endOfStream(),(this.media.readyState<=2||this.media.buffered.length>1)&&this._startTick()}},{key:"_stopTick",value:function(){this._tickTimer&&clearTimeout(this._tickTimer),this._tickTimer=null}},{key:"_startTick",value:function(){this._stopTick(),this._tickTimer=setTimeout(this._tick,this._tickInterval)}},{key:"_emitError",value:function(e){var t,r,n,i,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!1===(null===(t=e.originError)||void 0===t?void 0:t.fatal)?zb.warn(e):(zb.table(e),zb.error(e),zb.error(null===(r=this.media)||void 0===r?void 0:r.error),null!==(n=this.media)&&void 0!==n&&n.readyState&&this.media.pause(),this._stopTick(),this._urlSwitching&&(this._urlSwitching=!1,this.emit(ob.SWITCH_URL_FAILED,e)),this.emit(ob.ERROR,e),a&&this._end(),null===(i=this._seiService)||void 0===i||i.reset());return e}},{key:"_getSeamlessSwitchPoint",value:function(){var e=this.media,t=e.currentTime;if(!e.paused){var r,n=this._playlist.findSegmentIndexByTime(e.currentTime),i=this._playlist.getSegmentByIndex(n),a=null===(r=this._stats)||void 0===r?void 0:r.getStats().downloadSpeed;if(a&&i)t+=i.duration*this._playlist.currentStream.bitrate/a+1;else t+=5}return t}},{key:"_tryEos",value:function(){var e,t,r=this.media,n=this._playlist,i=n.nextSegment,a=n.lastSegment;if((!i||a&&Ay.isBuffered(r,a.start+a.duration/2))&&r.readyState&&r.duration>0&&(null===(e=this._bufferService)||void 0===e?void 0:e.msIsOpened)&&!(null!==(t=this._bufferService)&&void 0!==t&&t.msHasOpTasks)){var o=this.bufferInfo();r.paused&&!r.currentTime&&(o=this.bufferInfo(o.nextStart||.5)),(Math.abs(o.end-r.duration)<.1||!this.isLive&&a&&o.end>=a.start+a.duration)&&this._bufferService.endOfStream()}}}],[{key:"isSupported",value:function(e){return e&&"video"!==e&&"audio"!==e?"undefined"!=typeof WebAssembly:ig.isSupported()}},{key:"enableLogger",value:function(){Yy.enable(),p_.enable()}},{key:"disableLogger",value:function(){Yy.disable(),p_.disable()}}]),O}(Bp);l(Hb,"version","3.0.21-rc.2");try{localStorage.getItem("xgd")?Hb.enableLogger():Hb.disableLogger()}catch(Xb){}var qb=function(){function e(t,n){var i=this;s(this,e),l(this,"_opts",null),l(this,"_plugin",null),l(this,"_onLowDecode",(function(){var e,t,n,a,o=i._opts,s=o.media,u=o.innerDegrade;null===(e=i._plugin)||void 0===e||null===(t=e.player)||void 0===t||t.emit("lowdecode",s.degradeInfo),null===(n=i._plugin)||void 0===n||null===(a=n.player)||void 0===a||a.emit("core_event",r(r({},s.degradeInfo),{},{eventName:ob.LOWDECODE})),1===u&&i._degrade(s.src)})),l(this,"_degrade",(function(e){var t=i._plugin.player,r=t.video;if(!r||"MVideo"===r.TAG){var n=t.video.degradeVideo;t.video=n,r.degrade(e),e&&(t.config.url=e);var a=t.root.firstChild;"MVideo"===a.TAG&&t.root.replaceChild(n,a);var o=i._plugin.constructor.pluginName.toLowerCase();t.unRegisterPlugin(o),t.once("canplay",(function(){t.play()}))}})),l(this,"forceDegradeToVideo",(function(e){1===i._opts.innerDegrade&&i._degrade(e)})),this._opts=t,this._plugin=n,this._init()}return c(e,[{key:"_init",value:function(){var e=this._opts,t=e.media,r=e.preloadTime,n=e.innerDegrade,i=e.isLive;t&&(i||!t.setPlayMode?(n&&t.setAttribute("innerdegrade",n),r&&t.setAttribute("preloadtime",r),this._bindEvents()):t.setPlayMode("VOD"))}},{key:"_bindEvents",value:function(){this._opts.media.addEventListener("lowdecode",this._onLowDecode)}},{key:"destroy",value:function(){var e,t;null===(e=this._opts)||void 0===e||null===(t=e.media)||void 0===t||t.removeEventListener("lowdecode",this._onLowDecode),this._plugin=null}}]),e}(),Yb=["currentTime"];var Kb=function(e){f(n,e);var t=m(n);function n(){var e;s(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return l(v(e=t.call.apply(t,[this].concat(i))),"logger",zb),l(v(e),"hls",null),l(v(e),"pluginExtension",null),l(v(e),"getStats",(function(){var t;return null===(t=e.hls)||void 0===t?void 0:t.getStats()})),l(v(e),"_onSwitchSubtitle",(function(t){var r,n=t.lang;null===(r=e.hls)||void 0===r||r.switchSubtitleStream(n)})),l(v(e),"_keepPauseStatus",(function(){e.player.paused&&e.player.once("canplay",(function(){e.player.pause()}))})),e}return c(n,[{key:"core",get:function(){return this.hls}},{key:"version",get:function(){var e;return null===(e=this.hls)||void 0===e?void 0:e.version}},{key:"softDecode",get:function(){var e,t,r=null===(e=this.player)||void 0===e||null===(t=e.config)||void 0===t?void 0:t.mediaType;return!!r&&"video"!==r&&"audio"!==r}},{key:"beforePlayerInit",value:function(){var e=this,t=this.player.config,n=this.player.media||this.player.video,a=t.hls||{};if((t.url||t.__allowHlsEmptyUrl__)&&(a.preferMMS||!ig.isMMSOnly())){this.hls&&this.hls.destroy();var o=Object.getOwnPropertyDescriptor(this.player,"switchURL");o&&!o.writable||(this.player.switchURL=function(t,r){return new Promise((function(n,a){var o=e.player,s=e.hls;if(s){var u,c,l=function(e,t){var r={startTime:t.player.currentTime};switch(i(e)){case"boolean":r.seamless=e;break;case"object":var n=e.currentTime,a=p(e,Yb);Object.assign(r,a),"number"==typeof n&&(r.startTime=n)}return r}(r,e);o.config.url=t,s.switchURL(t,l).then((function(){return n(!0)})).catch(a),!l.seamless&&null!==(u=e.player.config)&&void 0!==u&&null!==(c=u.hls)&&void 0!==c&&c.keepStatusAfterSwitch&&e._keepPauseStatus()}else a()}))});var s,u=this.player.switchURL;if(this.player.handleSource=!1,a.innerDegrade=a.innerDegrade||t.innerDegrade,null!==a.disconnectTime&&void 0!==a.disconnectTime||(a.disconnectTime=0),this.hls=new Hb(r({softDecode:this.softDecode,isLive:t.isLive,media:n,startTime:t.startTime,url:t.url},a)),this.softDecode||ry.defineGetterOrSetter(this.player,{url:{get:function(){var t,r;return null===(t=e.hls)||void 0===t||null===(r=t.media)||void 0===r?void 0:r.src},configurable:!0}}),this.softDecode&&(this.pluginExtension=new qb(r({isLive:t.isLive,media:n},a),this),this.player.forceDegradeToVideo=function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return null===(t=e.pluginExtension)||void 0===t?void 0:t.forceDegradeToVideo.apply(t,n)}),t.isLive)null===(s=this.player)||void 0===s||s.useHooks("replay",(function(){var t;return null===(t=e.hls)||void 0===t?void 0:t.replay()}));this.on("urlchange",u),this.on("switch_subtitle",this._onSwitchSubtitle),this.on("destroy",this.destroy.bind(this)),this._transError(),this._transCoreEvent(gg.TTFB),this._transCoreEvent(gg.LOAD_START),this._transCoreEvent(gg.LOAD_RESPONSE_HEADERS),this._transCoreEvent(gg.LOAD_COMPLETE),this._transCoreEvent(gg.LOAD_RETRY),this._transCoreEvent(gg.SOURCEBUFFER_CREATED),this._transCoreEvent(gg.MEDIASOURCE_OPENED),this._transCoreEvent(gg.APPEND_BUFFER),this._transCoreEvent(gg.REMOVE_BUFFER),this._transCoreEvent(gg.BUFFEREOS),this._transCoreEvent(gg.KEYFRAME),this._transCoreEvent(gg.METADATA_PARSED),this._transCoreEvent(gg.DEMUXED_TRACK),this._transCoreEvent(gg.SEI),this._transCoreEvent(gg.SEI_IN_TIME),this._transCoreEvent(gg.SPEED),this._transCoreEvent(gg.HLS_MANIFEST_LOADED),this._transCoreEvent(gg.HLS_LEVEL_LOADED),this._transCoreEvent(gg.STREAM_EXCEPTION),this._transCoreEvent(gg.SWITCH_URL_SUCCESS),this._transCoreEvent(gg.SWITCH_URL_FAILED),this._transCoreEvent(ob.NO_AUDIO_TRACK),this._transCoreEvent(ob.STREAM_PARSED),this._transCoreEvent(ob.SUBTITLE_SEGMENTS),this._transCoreEvent(ob.SUBTITLE_PLAYLIST),this._transCoreEvent(ob.APPEND_COST),t.url&&this.hls.load(t.url,{reuseMse:!0}).catch((function(e){}))}}},{key:"destroy",value:function(){var e;this.hls&&(this.hls.destroy(),this.hls=null),null===(e=this.pluginExtension)||void 0===e||e.destroy(),this.pluginExtension=null}},{key:"_transError",value:function(){var e=this;this.hls.on(ob.ERROR,(function(t){e.player&&e.player.emit("error",new Xm(e.player,t))}))}},{key:"_transCoreEvent",value:function(e){var t=this;this.hls.on(e,(function(n){t.player&&(t.player.emit("core_event",r(r({},n),{},{eventName:e})),e===gg.SEI_IN_TIME&&t.hls.hasSubtitle&&t._emitSeiPaylodTime(n))}))}},{key:"_emitSeiPaylodTime",value:function(e){try{var t=JSON.parse(Array.from(e.data.payload).map((function(e){return String.fromCharCode(e)})).join("").slice(0,-1));if(!t.rtmp_dts)return;this.player.emit("core_event",{eventName:ob.SEI_PAYLOAD_TIME,time:t.rtmp_dts})}catch(r){}}}],[{key:"pluginName",get:function(){return"hls"}},{key:"isSupported",value:function(e,t){return Hb.isSupported(e,t)}}]),n}(ry);l(Kb,"Hls",Hb),l(Kb,"EVENT",ob);var Wb=window.VePlayer.DynamicModule;VePlayer.registerPlugin(Wb.PluginHls,{HlsPlugin:Kb}),e.HlsPlugin=Kb}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).__VEPLAYER_PLUGIN_HLS__={})}(this,(function(e){"use strict";function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function n(){n=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(O){c=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof d?t:d,o=Object.create(a.prototype),s=new T(n||[]);return i(o,"_invoke",{value:k(e,r,s)}),o}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(O){return{type:"throw",arg:O}}}e.wrap=l;var h={};function d(){}function p(){}function v(){}var m={};c(m,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(A([])));g&&g!==t&&r.call(g,o)&&(m=g);var _=v.prototype=d.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(i,a,o,s){var u=f(e[i],e,a);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,o,s)}),(function(e){n("throw",e,o,s)})):t.resolve(l).then((function(e){c.value=e,o(c)}),(function(e){return n("throw",e,o,s)}))}s(u.arg)}var a;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return a=a?a.then(i,i):i()}})}function k(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=E(o,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function E(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=f(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function A(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:D}}function D(){return{value:void 0,done:!0}}return p.prototype=v,i(_,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:p,configurable:!0}),p.displayName=c(v,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,c(e,u,"GeneratorFunction")),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},b(S.prototype),c(S.prototype,s,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new S(l(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(_),c(_,u,"Generator"),c(_,o,(function(){return this})),c(_,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=A,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:A(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(c){return void r(c)}s.done?t(u):Promise.resolve(u).then(n,i)}function o(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){a(o,n,i,s,u,"next",e)}function u(e){a(o,n,i,s,u,"throw",e)}s(void 0)}))}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,S(n.key),n)}}function c(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,r){return(t=S(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function p(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=h(e);if(t){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}(this,r)}}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(l){c=!0,i=l}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(e,t)||_(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,t){if(e){if("string"==typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,t):void 0}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function S(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var w=function(e){try{return!!e()}catch(t){return!0}},x=!w((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),T=x,A=Function.prototype,D=A.call,O=T&&A.bind.bind(D,D),L=T?O:function(e){return function(){return D.apply(e,arguments)}},C=L({}.isPrototypeOf),P=function(e){return e&&e.Math==Math&&e},R=P("object"==typeof globalThis&&globalThis)||P("object"==typeof window&&window)||P("object"==typeof self&&self)||P("object"==typeof k&&k)||function(){return this}()||k||Function("return this")(),I=x,M=Function.prototype,B=M.apply,U=M.call,N="object"==typeof Reflect&&Reflect.apply||(I?U.bind(B):function(){return U.apply(B,arguments)}),F=L,j=F({}.toString),V=F("".slice),G=function(e){return V(j(e),8,-1)},z=G,H=L,q=function(e){if("Function"===z(e))return H(e)},Y="object"==typeof document&&document.all,K={all:Y,IS_HTMLDDA:void 0===Y&&void 0!==Y},W=K.all,X=K.IS_HTMLDDA?function(e){return"function"==typeof e||e===W}:function(e){return"function"==typeof e},Q={},$=!w((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),J=x,Z=Function.prototype.call,ee=J?Z.bind(Z):function(){return Z.apply(Z,arguments)},te={},re={}.propertyIsEnumerable,ne=Object.getOwnPropertyDescriptor,ie=ne&&!re.call({1:2},1);te.f=ie?function(e){var t=ne(this,e);return!!t&&t.enumerable}:re;var ae,oe,se=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ue=w,ce=G,le=Object,fe=L("".split),he=ue((function(){return!le("z").propertyIsEnumerable(0)}))?function(e){return"String"==ce(e)?fe(e,""):le(e)}:le,de=function(e){return null==e},pe=de,ve=TypeError,me=function(e){if(pe(e))throw ve("Can't call method on "+e);return e},ye=he,ge=me,_e=function(e){return ye(ge(e))},be=X,Se=K.all,ke=K.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:be(e)||e===Se}:function(e){return"object"==typeof e?null!==e:be(e)},Ee={},we=Ee,xe=R,Te=X,Ae=function(e){return Te(e)?e:void 0},De=function(e,t){return arguments.length<2?Ae(we[e])||Ae(xe[e]):we[e]&&we[e][t]||xe[e]&&xe[e][t]},Oe="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Le=R,Ce=Oe,Pe=Le.process,Re=Le.Deno,Ie=Pe&&Pe.versions||Re&&Re.version,Me=Ie&&Ie.v8;Me&&(oe=(ae=Me.split("."))[0]>0&&ae[0]<4?1:+(ae[0]+ae[1])),!oe&&Ce&&(!(ae=Ce.match(/Edge\/(\d+)/))||ae[1]>=74)&&(ae=Ce.match(/Chrome\/(\d+)/))&&(oe=+ae[1]);var Be=oe,Ue=Be,Ne=w,Fe=R.String,je=!!Object.getOwnPropertySymbols&&!Ne((function(){var e=Symbol();return!Fe(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Ue&&Ue<41})),Ve=je&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ge=De,ze=X,He=C,qe=Object,Ye=Ve?function(e){return"symbol"==typeof e}:function(e){var t=Ge("Symbol");return ze(t)&&He(t.prototype,qe(e))},Ke=String,We=function(e){try{return Ke(e)}catch(t){return"Object"}},Xe=X,Qe=We,$e=TypeError,Je=function(e){if(Xe(e))return e;throw $e(Qe(e)+" is not a function")},Ze=Je,et=de,tt=function(e,t){var r=e[t];return et(r)?void 0:Ze(r)},rt=ee,nt=X,it=ke,at=TypeError,ot={exports:{}},st=R,ut=Object.defineProperty,ct=function(e,t){try{ut(st,e,{value:t,configurable:!0,writable:!0})}catch(r){st[e]=t}return t},lt="__core-js_shared__",ft=R[lt]||ct(lt,{}),ht=ft;(ot.exports=function(e,t){return ht[e]||(ht[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.30.2",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.30.2/LICENSE",source:"https://github.com/zloirock/core-js"});var dt=ot.exports,pt=me,vt=Object,mt=function(e){return vt(pt(e))},yt=mt,gt=L({}.hasOwnProperty),_t=Object.hasOwn||function(e,t){return gt(yt(e),t)},bt=L,St=0,kt=Math.random(),Et=bt(1..toString),wt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Et(++St+kt,36)},xt=dt,Tt=_t,At=wt,Dt=je,Ot=Ve,Lt=R.Symbol,Ct=xt("wks"),Pt=Ot?Lt.for||Lt:Lt&&Lt.withoutSetter||At,Rt=function(e){return Tt(Ct,e)||(Ct[e]=Dt&&Tt(Lt,e)?Lt[e]:Pt("Symbol."+e)),Ct[e]},It=ee,Mt=ke,Bt=Ye,Ut=tt,Nt=function(e,t){var r,n;if("string"===t&&nt(r=e.toString)&&!it(n=rt(r,e)))return n;if(nt(r=e.valueOf)&&!it(n=rt(r,e)))return n;if("string"!==t&&nt(r=e.toString)&&!it(n=rt(r,e)))return n;throw at("Can't convert object to primitive value")},Ft=TypeError,jt=Rt("toPrimitive"),Vt=function(e,t){if(!Mt(e)||Bt(e))return e;var r,n=Ut(e,jt);if(n){if(void 0===t&&(t="default"),r=It(n,e,t),!Mt(r)||Bt(r))return r;throw Ft("Can't convert object to primitive value")}return void 0===t&&(t="number"),Nt(e,t)},Gt=Ye,zt=function(e){var t=Vt(e,"string");return Gt(t)?t:t+""},Ht=ke,qt=R.document,Yt=Ht(qt)&&Ht(qt.createElement),Kt=function(e){return Yt?qt.createElement(e):{}},Wt=Kt,Xt=!$&&!w((function(){return 7!=Object.defineProperty(Wt("div"),"a",{get:function(){return 7}}).a})),Qt=$,$t=ee,Jt=te,Zt=se,er=_e,tr=zt,rr=_t,nr=Xt,ir=Object.getOwnPropertyDescriptor;Q.f=Qt?ir:function(e,t){if(e=er(e),t=tr(t),nr)try{return ir(e,t)}catch(r){}if(rr(e,t))return Zt(!$t(Jt.f,e,t),e[t])};var ar=w,or=X,sr=/#|\.prototype\./,ur=function(e,t){var r=lr[cr(e)];return r==hr||r!=fr&&(or(t)?ar(t):!!t)},cr=ur.normalize=function(e){return String(e).replace(sr,".").toLowerCase()},lr=ur.data={},fr=ur.NATIVE="N",hr=ur.POLYFILL="P",dr=ur,pr=Je,vr=x,mr=q(q.bind),yr=function(e,t){return pr(e),void 0===t?e:vr?mr(e,t):function(){return e.apply(t,arguments)}},gr={},_r=$&&w((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),br=ke,Sr=String,kr=TypeError,Er=function(e){if(br(e))return e;throw kr(Sr(e)+" is not an object")},wr=$,xr=Xt,Tr=_r,Ar=Er,Dr=zt,Or=TypeError,Lr=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,Pr="enumerable",Rr="configurable",Ir="writable";gr.f=wr?Tr?function(e,t,r){if(Ar(e),t=Dr(t),Ar(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Ir in r&&!r[Ir]){var n=Cr(e,t);n&&n[Ir]&&(e[t]=r.value,r={configurable:Rr in r?r[Rr]:n[Rr],enumerable:Pr in r?r[Pr]:n[Pr],writable:!1})}return Lr(e,t,r)}:Lr:function(e,t,r){if(Ar(e),t=Dr(t),Ar(r),xr)try{return Lr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw Or("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Mr=gr,Br=se,Ur=$?function(e,t,r){return Mr.f(e,t,Br(1,r))}:function(e,t,r){return e[t]=r,e},Nr=R,Fr=N,jr=q,Vr=X,Gr=Q.f,zr=dr,Hr=Ee,qr=yr,Yr=Ur,Kr=_t,Wr=function(e){var t=function(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return Fr(e,this,arguments)};return t.prototype=e.prototype,t},Xr=function(e,t){var r,n,i,a,o,s,u,c,l,f=e.target,h=e.global,d=e.stat,p=e.proto,v=h?Nr:d?Nr[f]:(Nr[f]||{}).prototype,m=h?Hr:Hr[f]||Yr(Hr,f,{})[f],y=m.prototype;for(a in t)n=!(r=zr(h?a:f+(d?".":"#")+a,e.forced))&&v&&Kr(v,a),s=m[a],n&&(u=e.dontCallGetSet?(l=Gr(v,a))&&l.value:v[a]),o=n&&u?u:t[a],n&&typeof s==typeof o||(c=e.bind&&n?qr(o,Nr):e.wrap&&n?Wr(o):p&&Vr(o)?jr(o):o,(e.sham||o&&o.sham||s&&s.sham)&&Yr(c,"sham",!0),Yr(m,a,c),p&&(Kr(Hr,i=f+"Prototype")||Yr(Hr,i,{}),Yr(Hr[i],a,o),e.real&&y&&(r||!y[a])&&Yr(y,a,o)))},Qr=Math.ceil,$r=Math.floor,Jr=Math.trunc||function(e){var t=+e;return(t>0?$r:Qr)(t)},Zr=function(e){var t=+e;return t!=t||0===t?0:Jr(t)},en=Zr,tn=Math.max,rn=Math.min,nn=function(e,t){var r=en(e);return r<0?tn(r+t,0):rn(r,t)},an=Zr,on=Math.min,sn=function(e){return e>0?on(an(e),9007199254740991):0},un=sn,cn=function(e){return un(e.length)},ln=_e,fn=nn,hn=cn,dn=function(e){return function(t,r,n){var i,a=ln(t),o=hn(a),s=fn(n,o);if(e&&r!=r){for(;o>s;)if((i=a[s++])!=i)return!0}else for(;o>s;s++)if((e||s in a)&&a[s]===r)return e||s||0;return!e&&-1}},pn={includes:dn(!0),indexOf:dn(!1)},vn=w,mn=function(e,t){var r=[][e];return!!r&&vn((function(){r.call(null,t||function(){return 1},1)}))},yn=Xr,gn=pn.indexOf,_n=mn,bn=q([].indexOf),Sn=!!bn&&1/bn([1],1,-0)<0;yn({target:"Array",proto:!0,forced:Sn||!_n("indexOf")},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Sn?bn(this,e,t)||0:gn(this,e,t)}});var kn=Ee,En=function(e){return kn[e+"Prototype"]},wn=En("Array").indexOf,xn=C,Tn=wn,An=Array.prototype,Dn=E((function(e){var t=e.indexOf;return e===An||xn(An,e)&&t===An.indexOf?Tn:t})),On=G,Ln=Array.isArray||function(e){return"Array"==On(e)},Cn={};Cn[Rt("toStringTag")]="z";var Pn="[object z]"===String(Cn),Rn=Pn,In=X,Mn=G,Bn=Rt("toStringTag"),Un=Object,Nn="Arguments"==Mn(function(){return arguments}()),Fn=Rn?Mn:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(r){}}(t=Un(e),Bn))?r:Nn?Mn(t):"Object"==(n=Mn(t))&&In(t.callee)?"Arguments":n},jn=X,Vn=ft,Gn=L(Function.toString);jn(Vn.inspectSource)||(Vn.inspectSource=function(e){return Gn(e)});var zn=Vn.inspectSource,Hn=L,qn=w,Yn=X,Kn=Fn,Wn=zn,Xn=function(){},Qn=[],$n=De("Reflect","construct"),Jn=/^\s*(?:class|function)\b/,Zn=Hn(Jn.exec),ei=!Jn.exec(Xn),ti=function(e){if(!Yn(e))return!1;try{return $n(Xn,Qn,e),!0}catch(t){return!1}},ri=function(e){if(!Yn(e))return!1;switch(Kn(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ei||!!Zn(Jn,Wn(e))}catch(t){return!0}};ri.sham=!0;var ni=!$n||qn((function(){var e;return ti(ti.call)||!ti(Object)||!ti((function(){e=!0}))||e}))?ri:ti,ii=Ln,ai=ni,oi=ke,si=Rt("species"),ui=Array,ci=function(e){var t;return ii(e)&&(t=e.constructor,(ai(t)&&(t===ui||ii(t.prototype))||oi(t)&&null===(t=t[si]))&&(t=void 0)),void 0===t?ui:t},li=function(e,t){return new(ci(e))(0===t?0:t)},fi=yr,hi=he,di=mt,pi=cn,vi=li,mi=L([].push),yi=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,a=6==e,o=7==e,s=5==e||a;return function(u,c,l,f){for(var h,d,p=di(u),v=hi(p),m=fi(c,l),y=pi(v),g=0,_=f||vi,b=t?_(u,y):r||o?_(u,0):void 0;y>g;g++)if((s||g in v)&&(d=m(h=v[g],g,p),e))if(t)b[g]=d;else if(d)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:mi(b,h)}else switch(e){case 4:return!1;case 7:mi(b,h)}return a?-1:n||i?i:b}},gi={forEach:yi(0),map:yi(1),filter:yi(2),some:yi(3),every:yi(4),find:yi(5),findIndex:yi(6),filterReject:yi(7)},_i=TypeError,bi=function(e){if(e>9007199254740991)throw _i("Maximum allowed index exceeded");return e},Si=zt,ki=gr,Ei=se,wi=function(e,t,r){var n=Si(t);n in e?ki.f(e,n,Ei(0,r)):e[n]=r},xi=w,Ti=Be,Ai=Rt("species"),Di=function(e){return Ti>=51||!xi((function(){var t=[];return(t.constructor={})[Ai]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Oi=Xr,Li=w,Ci=Ln,Pi=ke,Ri=mt,Ii=cn,Mi=bi,Bi=wi,Ui=li,Ni=Di,Fi=Be,ji=Rt("isConcatSpreadable"),Vi=Fi>=51||!Li((function(){var e=[];return e[ji]=!1,e.concat()[0]!==e})),Gi=function(e){if(!Pi(e))return!1;var t=e[ji];return void 0!==t?!!t:Ci(e)};Oi({target:"Array",proto:!0,arity:1,forced:!Vi||!Ni("concat")},{concat:function(e){var t,r,n,i,a,o=Ri(this),s=Ui(o,0),u=0;for(t=-1,n=arguments.length;t<n;t++)if(Gi(a=-1===t?o:arguments[t]))for(i=Ii(a),Mi(u+i),r=0;r<i;r++,u++)r in a&&Bi(s,u,a[r]);else Mi(u+1),Bi(s,u++,a);return s.length=u,s}});var zi,Hi,qi,Yi=En("Array").concat,Ki=C,Wi=Yi,Xi=Array.prototype,Qi=E((function(e){var t=e.concat;return e===Xi||Ki(Xi,e)&&t===Xi.concat?Wi:t})),$i={},Ji=X,Zi=R.WeakMap,ea=Ji(Zi)&&/native code/.test(String(Zi)),ta=wt,ra=dt("keys"),na=function(e){return ra[e]||(ra[e]=ta(e))},ia={},aa=ea,oa=R,sa=ke,ua=Ur,ca=_t,la=ft,fa=na,ha=ia,da="Object already initialized",pa=oa.TypeError,va=oa.WeakMap;if(aa||la.state){var ma=la.state||(la.state=new va);ma.get=ma.get,ma.has=ma.has,ma.set=ma.set,zi=function(e,t){if(ma.has(e))throw pa(da);return t.facade=e,ma.set(e,t),t},Hi=function(e){return ma.get(e)||{}},qi=function(e){return ma.has(e)}}else{var ya=fa("state");ha[ya]=!0,zi=function(e,t){if(ca(e,ya))throw pa(da);return t.facade=e,ua(e,ya,t),t},Hi=function(e){return ca(e,ya)?e[ya]:{}},qi=function(e){return ca(e,ya)}}var ga={set:zi,get:Hi,has:qi,enforce:function(e){return qi(e)?Hi(e):zi(e,{})},getterFor:function(e){return function(t){var r;if(!sa(t)||(r=Hi(t)).type!==e)throw pa("Incompatible receiver, "+e+" required");return r}}},_a=$,ba=_t,Sa=Function.prototype,ka=_a&&Object.getOwnPropertyDescriptor,Ea=ba(Sa,"name"),wa={EXISTS:Ea,PROPER:Ea&&"something"===function(){}.name,CONFIGURABLE:Ea&&(!_a||_a&&ka(Sa,"name").configurable)},xa={},Ta=_t,Aa=_e,Da=pn.indexOf,Oa=ia,La=L([].push),Ca=function(e,t){var r,n=Aa(e),i=0,a=[];for(r in n)!Ta(Oa,r)&&Ta(n,r)&&La(a,r);for(;t.length>i;)Ta(n,r=t[i++])&&(~Da(a,r)||La(a,r));return a},Pa=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ra=Ca,Ia=Pa,Ma=Object.keys||function(e){return Ra(e,Ia)},Ba=$,Ua=_r,Na=gr,Fa=Er,ja=_e,Va=Ma;xa.f=Ba&&!Ua?Object.defineProperties:function(e,t){Fa(e);for(var r,n=ja(t),i=Va(t),a=i.length,o=0;a>o;)Na.f(e,r=i[o++],n[r]);return e};var Ga,za=De("document","documentElement"),Ha=Er,qa=xa,Ya=Pa,Ka=ia,Wa=za,Xa=Kt,Qa="prototype",$a="script",Ja=na("IE_PROTO"),Za=function(){},eo=function(e){return"<"+$a+">"+e+"</"+$a+">"},to=function(e){e.write(eo("")),e.close();var t=e.parentWindow.Object;return e=null,t},ro=function(){try{Ga=new ActiveXObject("htmlfile")}catch(i){}var e,t,r;ro="undefined"!=typeof document?document.domain&&Ga?to(Ga):(t=Xa("iframe"),r="java"+$a+":",t.style.display="none",Wa.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(eo("document.F=Object")),e.close(),e.F):to(Ga);for(var n=Ya.length;n--;)delete ro[Qa][Ya[n]];return ro()};Ka[Ja]=!0;var no,io,ao,oo=Object.create||function(e,t){var r;return null!==e?(Za[Qa]=Ha(e),r=new Za,Za[Qa]=null,r[Ja]=e):r=ro(),void 0===t?r:qa.f(r,t)},so=!w((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),uo=_t,co=X,lo=mt,fo=so,ho=na("IE_PROTO"),po=Object,vo=po.prototype,mo=fo?po.getPrototypeOf:function(e){var t=lo(e);if(uo(t,ho))return t[ho];var r=t.constructor;return co(r)&&t instanceof r?r.prototype:t instanceof po?vo:null},yo=Ur,go=function(e,t,r,n){return n&&n.enumerable?e[t]=r:yo(e,t,r),e},_o=w,bo=X,So=ke,ko=oo,Eo=mo,wo=go,xo=Rt("iterator"),To=!1;[].keys&&("next"in(ao=[].keys())?(io=Eo(Eo(ao)))!==Object.prototype&&(no=io):To=!0);var Ao=!So(no)||_o((function(){var e={};return no[xo].call(e)!==e}));bo((no=Ao?{}:ko(no))[xo])||wo(no,xo,(function(){return this}));var Do={IteratorPrototype:no,BUGGY_SAFARI_ITERATORS:To},Oo=Fn,Lo=Pn?{}.toString:function(){return"[object "+Oo(this)+"]"},Co=Pn,Po=gr.f,Ro=Ur,Io=_t,Mo=Lo,Bo=Rt("toStringTag"),Uo=function(e,t,r,n){if(e){var i=r?e:e.prototype;Io(i,Bo)||Po(i,Bo,{configurable:!0,value:t}),n&&!Co&&Ro(i,"toString",Mo)}},No=Do.IteratorPrototype,Fo=oo,jo=se,Vo=Uo,Go=$i,zo=function(){return this},Ho=Xr,qo=ee,Yo=wa,Ko=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Fo(No,{next:jo(+!n,r)}),Vo(e,i,!1,!0),Go[i]=zo,e},Wo=mo,Xo=Uo,Qo=go,$o=$i,Jo=Do,Zo=Yo.PROPER,es=Jo.BUGGY_SAFARI_ITERATORS,ts=Rt("iterator"),rs="keys",ns="values",is="entries",as=function(){return this},os=function(e,t,r,n,i,a,o){Ko(r,t,n);var s,u,c,l=function(e){if(e===i&&v)return v;if(!es&&e in d)return d[e];switch(e){case rs:case ns:case is:return function(){return new r(this,e)}}return function(){return new r(this)}},f=t+" Iterator",h=!1,d=e.prototype,p=d[ts]||d["@@iterator"]||i&&d[i],v=!es&&p||l(i),m="Array"==t&&d.entries||p;if(m&&(s=Wo(m.call(new e)))!==Object.prototype&&s.next&&(Xo(s,f,!0,!0),$o[f]=as),Zo&&i==ns&&p&&p.name!==ns&&(h=!0,v=function(){return qo(p,this)}),i)if(u={values:l(ns),keys:a?v:l(rs),entries:l(is)},o)for(c in u)(es||h||!(c in d))&&Qo(d,c,u[c]);else Ho({target:t,proto:!0,forced:es||h},u);return o&&d[ts]!==v&&Qo(d,ts,v,{name:i}),$o[t]=v,u},ss=function(e,t){return{value:e,done:t}},us=_e,cs=$i,ls=ga;gr.f;var fs=os,hs=ss,ds="Array Iterator",ps=ls.set,vs=ls.getterFor(ds);fs(Array,"Array",(function(e,t){ps(this,{type:ds,target:us(e),index:0,kind:t})}),(function(){var e=vs(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,hs(void 0,!0)):hs("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),cs.Arguments=cs.Array;var ms={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},ys=R,gs=Fn,_s=Ur,bs=$i,Ss=Rt("toStringTag");for(var ks in ms){var Es=ys[ks],ws=Es&&Es.prototype;ws&&gs(ws)!==Ss&&_s(ws,Ss,ks),bs[ks]=bs.Array}var xs=gi.forEach,Ts=mn("forEach")?[].forEach:function(e){return xs(this,e,arguments.length>1?arguments[1]:void 0)};Xr({target:"Array",proto:!0,forced:[].forEach!=Ts},{forEach:Ts});var As=En("Array").forEach,Ds=Fn,Os=_t,Ls=C,Cs=As,Ps=Array.prototype,Rs={DOMTokenList:!0,NodeList:!0},Is=E((function(e){var t=e.forEach;return e===Ps||Ls(Ps,e)&&t===Ps.forEach||Os(Rs,Ds(e))?Cs:t})),Ms=mt,Bs=Ma;Xr({target:"Object",stat:!0,forced:w((function(){Bs(1)}))},{keys:function(e){return Bs(Ms(e))}});var Us=E(Ee.Object.keys),Ns=L([].slice),Fs=Xr,js=Ln,Vs=ni,Gs=ke,zs=nn,Hs=cn,qs=_e,Ys=wi,Ks=Rt,Ws=Ns,Xs=Di("slice"),Qs=Ks("species"),$s=Array,Js=Math.max;Fs({target:"Array",proto:!0,forced:!Xs},{slice:function(e,t){var r,n,i,a=qs(this),o=Hs(a),s=zs(e,o),u=zs(void 0===t?o:t,o);if(js(a)&&(r=a.constructor,(Vs(r)&&(r===$s||js(r.prototype))||Gs(r)&&null===(r=r[Qs]))&&(r=void 0),r===$s||void 0===r))return Ws(a,s,u);for(n=new(void 0===r?$s:r)(Js(u-s,0)),i=0;s<u;s++,i++)s in a&&Ys(n,i,a[s]);return n.length=i,n}});var Zs=En("Array").slice,eu=C,tu=Zs,ru=Array.prototype,nu=E((function(e){var t=e.slice;return e===ru||eu(ru,e)&&t===ru.slice?tu:t})),iu=$,au=Ln,ou=TypeError,su=Object.getOwnPropertyDescriptor,uu=iu&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}(),cu=We,lu=TypeError,fu=function(e,t){if(!delete e[t])throw lu("Cannot delete property "+cu(t)+" of "+cu(e))},hu=Xr,du=mt,pu=nn,vu=Zr,mu=cn,yu=uu?function(e,t){if(au(e)&&!su(e,"length").writable)throw ou("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},gu=bi,_u=li,bu=wi,Su=fu,ku=Di("splice"),Eu=Math.max,wu=Math.min;hu({target:"Array",proto:!0,forced:!ku},{splice:function(e,t){var r,n,i,a,o,s,u=du(this),c=mu(u),l=pu(e,c),f=arguments.length;for(0===f?r=n=0:1===f?(r=0,n=c-l):(r=f-2,n=wu(Eu(vu(t),0),c-l)),gu(c+r-n),i=_u(u,n),a=0;a<n;a++)(o=l+a)in u&&bu(i,a,u[o]);if(i.length=n,r<n){for(a=l;a<c-n;a++)s=a+r,(o=a+n)in u?u[s]=u[o]:Su(u,s);for(a=c;a>c-n+r;a--)Su(u,a-1)}else if(r>n)for(a=c-n;a>l;a--)s=a+r-1,(o=a+n-1)in u?u[s]=u[o]:Su(u,s);for(a=0;a<r;a++)u[a+l]=arguments[a+2];return yu(u,c-n+r),i}});var xu=En("Array").splice,Tu=C,Au=xu,Du=Array.prototype,Ou=E((function(e){var t=e.splice;return e===Du||Tu(Du,e)&&t===Du.splice?Au:t})),Lu={},Cu=Ca,Pu=Pa.concat("length","prototype");Lu.f=Object.getOwnPropertyNames||function(e){return Cu(e,Pu)};var Ru={};Ru.f=Object.getOwnPropertySymbols;var Iu=De,Mu=Lu,Bu=Ru,Uu=Er,Nu=L([].concat),Fu=Iu("Reflect","ownKeys")||function(e){var t=Mu.f(Uu(e)),r=Bu.f;return r?Nu(t,r(e)):t},ju=$i,Vu=Rt("iterator"),Gu=Array.prototype,zu=Fn,Hu=tt,qu=de,Yu=$i,Ku=Rt("iterator"),Wu=function(e){if(!qu(e))return Hu(e,Ku)||Hu(e,"@@iterator")||Yu[zu(e)]},Xu=ee,Qu=Je,$u=Er,Ju=We,Zu=Wu,ec=TypeError,tc=ee,rc=Er,nc=tt,ic=Fn,ac=String,oc=function(e){if("Symbol"===ic(e))throw TypeError("Cannot convert a Symbol value to a string");return ac(e)},sc=gr,uc=TypeError,cc=Rt("iterator"),lc=!1;try{var fc=0,hc={next:function(){return{done:!!fc++}},return:function(){lc=!0}};hc[cc]=function(){return this},Array.from(hc,(function(){throw 2}))}catch(Xb){}var dc=L,pc=Zr,vc=oc,mc=me,yc=dc("".charAt),gc=dc("".charCodeAt),_c=dc("".slice),bc=function(e){return function(t,r){var n,i,a=vc(mc(t)),o=pc(r),s=a.length;return o<0||o>=s?e?"":void 0:(n=gc(a,o))<55296||n>56319||o+1===s||(i=gc(a,o+1))<56320||i>57343?e?yc(a,o):n:e?_c(a,o,o+2):i-56320+(n-55296<<10)+65536}},Sc={codeAt:bc(!1),charAt:bc(!0)}.charAt,kc=oc,Ec=ga,wc=os,xc=ss,Tc="String Iterator",Ac=Ec.set,Dc=Ec.getterFor(Tc);wc(String,"String",(function(e){Ac(this,{type:Tc,string:kc(e),index:0})}),(function(){var e,t=Dc(this),r=t.string,n=t.index;return n>=r.length?xc(void 0,!0):(e=Sc(r,n),t.index+=e.length,xc(e,!1))}));var Oc="\t\n\v\f\r \u2028\u2029\ufeff",Lc=me,Cc=oc,Pc=Oc,Rc=L("".replace),Ic=RegExp("^["+Pc+"]+"),Mc=RegExp("(^|[^"+Pc+"])["+Pc+"]+$"),Bc=function(e){return function(t){var r=Cc(Lc(t));return 1&e&&(r=Rc(r,Ic,"")),2&e&&(r=Rc(r,Mc,"$1")),r}},Uc={start:Bc(1),end:Bc(2),trim:Bc(3)},Nc=R,Fc=w,jc=L,Vc=oc,Gc=Uc.trim,zc=Oc,Hc=Nc.parseInt,qc=Nc.Symbol,Yc=qc&&qc.iterator,Kc=/^[+-]?0x/i,Wc=jc(Kc.exec),Xc=8!==Hc(zc+"08")||22!==Hc(zc+"0x16")||Yc&&!Fc((function(){Hc(Object(Yc))}))?function(e,t){var r=Gc(Vc(e));return Hc(r,t>>>0||(Wc(Kc,r)?16:10))}:Hc;Xr({global:!0,forced:parseInt!=Xc},{parseInt:Xc});var Qc=E(Ee.parseInt),$c=gi.map;Xr({target:"Array",proto:!0,forced:!Di("map")},{map:function(e){return $c(this,e,arguments.length>1?arguments[1]:void 0)}});var Jc=En("Array").map,Zc=C,el=Jc,tl=Array.prototype,rl=E((function(e){var t=e.map;return e===tl||Zc(tl,e)&&t===tl.map?el:t}));Xr({target:"Array",stat:!0},{isArray:Ln});var nl=E(Ee.Array.isArray),il=gi.filter;Xr({target:"Array",proto:!0,forced:!Di("filter")},{filter:function(e){return il(this,e,arguments.length>1?arguments[1]:void 0)}});var al=En("Array").filter,ol=C,sl=al,ul=Array.prototype,cl=E((function(e){var t=e.filter;return e===ul||ol(ul,e)&&t===ul.filter?sl:t})),ll={},fl=nn,hl=cn,dl=wi,pl=Array,vl=Math.max,ml=function(e,t,r){for(var n=hl(e),i=fl(t,n),a=fl(void 0===r?n:r,n),o=pl(vl(a-i,0)),s=0;i<a;i++,s++)dl(o,s,e[i]);return o.length=s,o},yl=G,gl=_e,_l=Lu.f,bl=ml,Sl="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];ll.f=function(e){return Sl&&"Window"==yl(e)?function(e){try{return _l(e)}catch(Xb){return bl(Sl)}}(e):_l(gl(e))};var kl={},El=Rt;kl.f=El;var wl=Ee,xl=_t,Tl=kl,Al=gr.f,Dl=function(e){var t=wl.Symbol||(wl.Symbol={});xl(t,e)||Al(t,e,{value:Tl.f(e)})},Ol=ee,Ll=De,Cl=Rt,Pl=go,Rl=function(){var e=Ll("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=Cl("toPrimitive");t&&!t[n]&&Pl(t,n,(function(e){return Ol(r,this)}),{arity:1})},Il=Xr,Ml=R,Bl=ee,Ul=L,Nl=$,Fl=je,jl=w,Vl=_t,Gl=C,zl=Er,Hl=_e,ql=zt,Yl=oc,Kl=se,Wl=oo,Xl=Ma,Ql=Lu,$l=ll,Jl=Ru,Zl=Q,ef=gr,tf=xa,rf=te,nf=go,af=function(e,t,r){return sc.f(e,t,r)},of=dt,sf=ia,uf=wt,cf=Rt,lf=kl,ff=Dl,hf=Rl,df=Uo,pf=ga,vf=gi.forEach,mf=na("hidden"),yf="Symbol",gf="prototype",_f=pf.set,bf=pf.getterFor(yf),Sf=Object[gf],kf=Ml.Symbol,Ef=kf&&kf[gf],wf=Ml.TypeError,xf=Ml.QObject,Tf=Zl.f,Af=ef.f,Df=$l.f,Of=rf.f,Lf=Ul([].push),Cf=of("symbols"),Pf=of("op-symbols"),Rf=of("wks"),If=!xf||!xf[gf]||!xf[gf].findChild,Mf=Nl&&jl((function(){return 7!=Wl(Af({},"a",{get:function(){return Af(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Tf(Sf,t);n&&delete Sf[t],Af(e,t,r),n&&e!==Sf&&Af(Sf,t,n)}:Af,Bf=function(e,t){var r=Cf[e]=Wl(Ef);return _f(r,{type:yf,tag:e,description:t}),Nl||(r.description=t),r},Uf=function(e,t,r){e===Sf&&Uf(Pf,t,r),zl(e);var n=ql(t);return zl(r),Vl(Cf,n)?(r.enumerable?(Vl(e,mf)&&e[mf][n]&&(e[mf][n]=!1),r=Wl(r,{enumerable:Kl(0,!1)})):(Vl(e,mf)||Af(e,mf,Kl(1,{})),e[mf][n]=!0),Mf(e,n,r)):Af(e,n,r)},Nf=function(e,t){zl(e);var r=Hl(t),n=Xl(r).concat(Gf(r));return vf(n,(function(t){Nl&&!Bl(Ff,r,t)||Uf(e,t,r[t])})),e},Ff=function(e){var t=ql(e),r=Bl(Of,this,t);return!(this===Sf&&Vl(Cf,t)&&!Vl(Pf,t))&&(!(r||!Vl(this,t)||!Vl(Cf,t)||Vl(this,mf)&&this[mf][t])||r)},jf=function(e,t){var r=Hl(e),n=ql(t);if(r!==Sf||!Vl(Cf,n)||Vl(Pf,n)){var i=Tf(r,n);return!i||!Vl(Cf,n)||Vl(r,mf)&&r[mf][n]||(i.enumerable=!0),i}},Vf=function(e){var t=Df(Hl(e)),r=[];return vf(t,(function(e){Vl(Cf,e)||Vl(sf,e)||Lf(r,e)})),r},Gf=function(e){var t=e===Sf,r=Df(t?Pf:Hl(e)),n=[];return vf(r,(function(e){!Vl(Cf,e)||t&&!Vl(Sf,e)||Lf(n,Cf[e])})),n};Fl||(kf=function(){if(Gl(Ef,this))throw wf("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Yl(arguments[0]):void 0,t=uf(e),r=function(e){this===Sf&&Bl(r,Pf,e),Vl(this,mf)&&Vl(this[mf],t)&&(this[mf][t]=!1),Mf(this,t,Kl(1,e))};return Nl&&If&&Mf(Sf,t,{configurable:!0,set:r}),Bf(t,e)},nf(Ef=kf[gf],"toString",(function(){return bf(this).tag})),nf(kf,"withoutSetter",(function(e){return Bf(uf(e),e)})),rf.f=Ff,ef.f=Uf,tf.f=Nf,Zl.f=jf,Ql.f=$l.f=Vf,Jl.f=Gf,lf.f=function(e){return Bf(cf(e),e)},Nl&&af(Ef,"description",{configurable:!0,get:function(){return bf(this).description}})),Il({global:!0,constructor:!0,wrap:!0,forced:!Fl,sham:!Fl},{Symbol:kf}),vf(Xl(Rf),(function(e){ff(e)})),Il({target:yf,stat:!0,forced:!Fl},{useSetter:function(){If=!0},useSimple:function(){If=!1}}),Il({target:"Object",stat:!0,forced:!Fl,sham:!Nl},{create:function(e,t){return void 0===t?Wl(e):Nf(Wl(e),t)},defineProperty:Uf,defineProperties:Nf,getOwnPropertyDescriptor:jf}),Il({target:"Object",stat:!0,forced:!Fl},{getOwnPropertyNames:Vf}),hf(),df(kf,yf),sf[mf]=!0;var zf=je&&!!Symbol.for&&!!Symbol.keyFor,Hf=Xr,qf=De,Yf=_t,Kf=oc,Wf=dt,Xf=zf,Qf=Wf("string-to-symbol-registry"),$f=Wf("symbol-to-string-registry");Hf({target:"Symbol",stat:!0,forced:!Xf},{for:function(e){var t=Kf(e);if(Yf(Qf,t))return Qf[t];var r=qf("Symbol")(t);return Qf[t]=r,$f[r]=t,r}});var Jf=Xr,Zf=_t,eh=Ye,th=We,rh=zf,nh=dt("symbol-to-string-registry");Jf({target:"Symbol",stat:!0,forced:!rh},{keyFor:function(e){if(!eh(e))throw TypeError(th(e)+" is not a symbol");if(Zf(nh,e))return nh[e]}});var ih=Ln,ah=X,oh=G,sh=oc,uh=L([].push),ch=Xr,lh=De,fh=N,hh=ee,dh=L,ph=w,vh=X,mh=Ye,yh=Ns,gh=function(e){if(ah(e))return e;if(ih(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?uh(r,i):"number"!=typeof i&&"Number"!=oh(i)&&"String"!=oh(i)||uh(r,sh(i))}var a=r.length,o=!0;return function(e,t){if(o)return o=!1,t;if(ih(this))return t;for(var n=0;n<a;n++)if(r[n]===e)return t}}},_h=je,bh=String,Sh=lh("JSON","stringify"),kh=dh(/./.exec),Eh=dh("".charAt),wh=dh("".charCodeAt),xh=dh("".replace),Th=dh(1..toString),Ah=/[\uD800-\uDFFF]/g,Dh=/^[\uD800-\uDBFF]$/,Oh=/^[\uDC00-\uDFFF]$/,Lh=!_h||ph((function(){var e=lh("Symbol")();return"[null]"!=Sh([e])||"{}"!=Sh({a:e})||"{}"!=Sh(Object(e))})),Ch=ph((function(){return'"\\udf06\\ud834"'!==Sh("\udf06\ud834")||'"\\udead"'!==Sh("\udead")})),Ph=function(e,t){var r=yh(arguments),n=gh(t);if(vh(n)||void 0!==e&&!mh(e))return r[1]=function(e,t){if(vh(n)&&(t=hh(n,this,bh(e),t)),!mh(t))return t},fh(Sh,null,r)},Rh=function(e,t,r){var n=Eh(r,t-1),i=Eh(r,t+1);return kh(Dh,e)&&!kh(Oh,i)||kh(Oh,e)&&!kh(Dh,n)?"\\u"+Th(wh(e,0),16):e};Sh&&ch({target:"JSON",stat:!0,arity:3,forced:Lh||Ch},{stringify:function(e,t,r){var n=yh(arguments),i=fh(Lh?Ph:Sh,null,n);return Ch&&"string"==typeof i?xh(i,Ah,Rh):i}});var Ih=Ru,Mh=mt;Xr({target:"Object",stat:!0,forced:!je||w((function(){Ih.f(1)}))},{getOwnPropertySymbols:function(e){var t=Ih.f;return t?t(Mh(e)):[]}}),Dl("asyncIterator"),Dl("hasInstance"),Dl("isConcatSpreadable"),Dl("iterator"),Dl("match"),Dl("matchAll"),Dl("replace"),Dl("search"),Dl("species"),Dl("split");var Bh=Rl;Dl("toPrimitive"),Bh();var Uh=De,Nh=Uo;Dl("toStringTag"),Nh(Uh("Symbol"),"Symbol"),Dl("unscopables"),Uo(R.JSON,"JSON",!0);var Fh=Ee.Symbol;Dl("dispose");var jh=Fh;Dl("asyncDispose");var Vh=Xr,Gh=L,zh=De("Symbol"),Hh=zh.keyFor,qh=Gh(zh.prototype.valueOf);Vh({target:"Symbol",stat:!0},{isRegistered:function(e){try{return void 0!==Hh(qh(e))}catch(Xb){return!1}}});for(var Yh=Xr,Kh=dt,Wh=De,Xh=L,Qh=Ye,$h=Rt,Jh=Wh("Symbol"),Zh=Jh.isWellKnown,ed=Wh("Object","getOwnPropertyNames"),td=Xh(Jh.prototype.valueOf),rd=Kh("wks"),nd=0,id=ed(Jh),ad=id.length;nd<ad;nd++)try{var od=id[nd];Qh(Jh[od])&&$h(od)}catch(Xb){}Yh({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(e){if(Zh&&Zh(e))return!0;try{for(var t=td(e),r=0,n=ed(rd),i=n.length;r<i;r++)if(rd[n[r]]==t)return!0}catch(Xb){}return!1}}),Dl("matcher"),Dl("metadataKey"),Dl("observable"),Dl("metadata"),Dl("patternMatch"),Dl("replaceAll");var sd=jh,ud=E(sd),cd=kl.f("iterator"),ld=E(cd);function fd(e){return(fd="function"==typeof ud&&"symbol"==typeof ld?function(e){return typeof e}:function(e){return e&&"function"==typeof ud&&e.constructor===ud&&e!==ud.prototype?"symbol":typeof e})(e)}var hd=E(Ee.Object.getOwnPropertySymbols),dd={exports:{}},pd=Xr,vd=w,md=_e,yd=Q.f,gd=$;pd({target:"Object",stat:!0,forced:!gd||vd((function(){yd(1)})),sham:!gd},{getOwnPropertyDescriptor:function(e,t){return yd(md(e),t)}});var _d=Ee.Object,bd=dd.exports=function(e,t){return _d.getOwnPropertyDescriptor(e,t)};_d.getOwnPropertyDescriptor.sham&&(bd.sham=!0);var Sd=E(dd.exports),kd=Fu,Ed=_e,wd=Q,xd=wi;Xr({target:"Object",stat:!0,sham:!$},{getOwnPropertyDescriptors:function(e){for(var t,r,n=Ed(e),i=wd.f,a=kd(n),o={},s=0;a.length>s;)void 0!==(r=i(n,t=a[s++]))&&xd(o,t,r);return o}});var Td=E(Ee.Object.getOwnPropertyDescriptors),Ad={exports:{}},Dd=Xr,Od=$,Ld=xa.f;Dd({target:"Object",stat:!0,forced:Object.defineProperties!==Ld,sham:!Od},{defineProperties:Ld});var Cd=Ee.Object,Pd=Ad.exports=function(e,t){return Cd.defineProperties(e,t)};Cd.defineProperties.sham&&(Pd.sham=!0);var Rd=E(Ad.exports),Id={exports:{}},Md=Xr,Bd=$,Ud=gr.f;Md({target:"Object",stat:!0,forced:Object.defineProperty!==Ud,sham:!Bd},{defineProperty:Ud});var Nd=Ee.Object,Fd=Id.exports=function(e,t,r){return Nd.defineProperty(e,t,r)};Nd.defineProperty.sham&&(Fd.sham=!0);var jd=E(Id.exports),Vd=E(sd),Gd=E(cd);Xr({target:"Object",stat:!0,sham:!$},{create:oo});var zd=Ee.Object,Hd=E((function(e,t){return zd.create(e,t)})),qd=L,Yd=Je,Kd=ke,Wd=_t,Xd=Ns,Qd=x,$d=Function,Jd=qd([].concat),Zd=qd([].join),ep={},tp=Qd?$d.bind:function(e){var t=Yd(this),r=t.prototype,n=Xd(arguments,1),i=function(){var r=Jd(n,Xd(arguments));return this instanceof i?function(e,t,r){if(!Wd(ep,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";ep[t]=$d("C,a","return new C("+Zd(n,",")+")")}return ep[t](e,r)}(t,r.length,r):t.apply(e,r)};return Kd(r)&&(i.prototype=r),i},rp=tp;Xr({target:"Function",proto:!0,forced:Function.bind!==rp},{bind:rp});var np=En("Function").bind,ip=C,ap=np,op=Function.prototype,sp=E((function(e){var t=e.bind;return e===op||ip(op,e)&&t===op.bind?ap:t})),up=E(Wu),cp=Er,lp=function(e,t,r){var n,i;rc(e);try{if(!(n=nc(e,"return"))){if("throw"===t)throw r;return r}n=tc(n,e)}catch(Xb){i=!0,n=Xb}if("throw"===t)throw r;if(i)throw n;return rc(n),r},fp=yr,hp=ee,dp=mt,pp=function(e,t,r,n){try{return n?t(cp(r)[0],r[1]):t(r)}catch(Xb){lp(e,"throw",Xb)}},vp=function(e){return void 0!==e&&(ju.Array===e||Gu[Vu]===e)},mp=ni,yp=cn,gp=wi,_p=function(e,t){var r=arguments.length<2?Zu(e):t;if(Qu(r))return $u(Xu(r,e));throw ec(Ju(e)+" is not iterable")},bp=Wu,Sp=Array,kp=function(e){var t=dp(e),r=mp(this),n=arguments.length,i=n>1?arguments[1]:void 0,a=void 0!==i;a&&(i=fp(i,n>2?arguments[2]:void 0));var o,s,u,c,l,f,h=bp(t),d=0;if(!h||this===Sp&&vp(h))for(o=yp(t),s=r?new this(o):Sp(o);o>d;d++)f=a?i(t[d],d):t[d],gp(s,d,f);else for(l=(c=_p(t,h)).next,s=r?new this:[];!(u=hp(l,c)).done;d++)f=a?pp(c,i,[u.value,d],!0):u.value,gp(s,d,f);return s.length=d,s};Xr({target:"Array",stat:!0,forced:!function(e,t){if(!t&&!lc)return!1;var r=!1;try{var n={};n[cc]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(Xb){}return r}((function(e){Array.from(e)}))},{from:kp});var Ep=E(Ee.Array.from),wp=E(kl.f("toPrimitive"));function xp(e,t){var r=Us(e);if(hd){var n=hd(e);t&&(n=cl(n).call(n,(function(t){return Sd(e,t).enumerable}))),r.push.apply(r,n)}return r}function Tp(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?Is(r=xp(Object(i),!0)).call(r,(function(t){Cp(e,t,i[t])})):Td?Rd(e,Td(i)):Is(n=xp(Object(i))).call(n,(function(t){jd(e,t,Sd(i,t))}))}return e}function Ap(e){return(Ap="function"==typeof Vd&&"symbol"==typeof Gd?function(e){return typeof e}:function(e){return e&&"function"==typeof Vd&&e.constructor===Vd&&e!==Vd.prototype?"symbol":typeof e})(e)}function Dp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Op(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),jd(e,Ip(n.key),n)}}function Lp(e,t,r){return t&&Op(e.prototype,t),r&&Op(e,r),jd(e,"prototype",{writable:!1}),e}function Cp(e,t,r){return(t=Ip(t))in e?jd(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pp(e){return function(e){if(nl(e))return Rp(e)}(e)||function(e){if(void 0!==Vd&&null!=up(e)||null!=e["@@iterator"])return Ep(e)}(e)||function(e,t){var r;if(!e)return;if("string"==typeof e)return Rp(e,t);var n=nu(r=Object.prototype.toString.call(e)).call(r,8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Ep(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rp(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ip(e){var t=function(e,t){if("object"!==fd(e)||null===e)return e;var r=e[wp];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==fd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===fd(t)?t:String(t)}var Mp={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,n,a,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,a||e,o),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Hd&&(n.prototype=Hd(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?nu(n).call(n,1):n);return hd?Qi(i).call(i,hd(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=new Array(a);i<a;i++)o[i]=n[i].fn;return o},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],f=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,i),!0;case 5:return l.fn.call(l.context,t,n,i,a),!0;case 6:return l.fn.call(l.context,t,n,i,a,o),!0}for(c=1,u=new Array(f-1);c<f;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var h,d=l.length;for(c=0;c<d;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),f){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,i);break;default:if(!u)for(h=1,u=new Array(f-1);h<f;h++)u[h-1]=arguments[h];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||o(this,a);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==t||i&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[a]=1===c.length?c[0]:c:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&o(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(Mp);var Bp=E(Mp.exports),Up=gi.some;Xr({target:"Array",proto:!0,forced:!mn("some")},{some:function(e){return Up(this,e,arguments.length>1?arguments[1]:void 0)}});var Np=En("Array").some,Fp=C,jp=Np,Vp=Array.prototype,Gp=E((function(e){var t=e.some;return e===Vp||Fp(Vp,e)&&t===Vp.some?jp:t})),zp=Zr,Hp=oc,qp=me,Yp=RangeError,Kp=L,Wp=sn,Xp=oc,Qp=me,$p=Kp((function(e){var t=Hp(qp(this)),r="",n=zp(e);if(n<0||n==1/0)throw Yp("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r})),Jp=Kp("".slice),Zp=Math.ceil,ev=function(e){return function(t,r,n){var i,a,o=Xp(Qp(t)),s=Wp(r),u=o.length,c=void 0===n?" ":Xp(n);return s<=u||""==c?o:((a=$p(c,Zp((i=s-u)/c.length))).length>i&&(a=Jp(a,0,i)),e?o+a:a+o)}},tv={start:ev(!1),end:ev(!0)},rv=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Oe),nv=tv.start;Xr({target:"String",proto:!0,forced:rv},{padStart:function(e){return nv(this,e,arguments.length>1?arguments[1]:void 0)}});var iv,av=En("String").padStart,ov=C,sv=av,uv=String.prototype,cv=E((function(e){var t=e.padStart;return"string"==typeof e||e===uv||ov(uv,e)&&t===uv.padStart?sv:t})),lv="function"==typeof Bun&&Bun&&"string"==typeof Bun.version,fv=R,hv=N,dv=X,pv=lv,vv=Oe,mv=Ns,yv=function(e,t){if(e<t)throw uc("Not enough arguments");return e},gv=fv.Function,_v=/MSIE .\./.test(vv)||pv&&((iv=fv.Bun.version.split(".")).length<3||0==iv[0]&&(iv[1]<3||3==iv[1]&&0==iv[2])),bv=function(e,t){var r=t?2:1;return _v?function(n,i){var a=yv(arguments.length,1)>r,o=dv(n)?n:gv(n),s=a?mv(arguments,r):[],u=a?function(){hv(o,this,s)}:o;return t?e(u,i):e(u)}:e},Sv=Xr,kv=R,Ev=bv(kv.setInterval,!0);Sv({global:!0,bind:!0,forced:kv.setInterval!==Ev},{setInterval:Ev});var wv=Xr,xv=R,Tv=bv(xv.setTimeout,!0);wv({global:!0,bind:!0,forced:xv.setTimeout!==Tv},{setTimeout:Tv});var Av=E(Ee.setInterval),Dv=E(Ee.setTimeout),Ov=gi.every;Xr({target:"Array",proto:!0,forced:!mn("every")},{every:function(e){return Ov(this,e,arguments.length>1?arguments[1]:void 0)}});var Lv=En("Array").every,Cv=C,Pv=Lv,Rv=Array.prototype,Iv=E((function(e){var t=e.every;return e===Rv||Cv(Rv,e)&&t===Rv.every?Pv:t})),Mv=R,Bv=w,Uv=oc,Nv=Uc.trim,Fv=Oc,jv=L("".charAt),Vv=Mv.parseFloat,Gv=Mv.Symbol,zv=Gv&&Gv.iterator,Hv=1/Vv(Fv+"-0")!=-1/0||zv&&!Bv((function(){Vv(Object(zv))}))?function(e){var t=Nv(Uv(e)),r=Vv(t);return 0===r&&"-"==jv(t,0)?-0:r}:Vv;Xr({global:!0,forced:parseFloat!=Hv},{parseFloat:Hv});var qv=E(Ee.parseFloat),Yv=wa.PROPER,Kv=w,Wv=Oc,Xv=Uc.trim;Xr({target:"String",proto:!0,forced:function(e){return Kv((function(){return!!Wv[e]()||"
"!=="
"[e]()||Yv&&Wv[e].name!==e}))}("trim")},{trim:function(){return Xv(this)}});var Qv=En("String").trim,$v=C,Jv=Qv,Zv=String.prototype,em=E((function(e){var t=e.trim;return"string"==typeof e||e===Zv||$v(Zv,e)&&t===Zv.trim?Jv:t})),tm=ml,rm=Math.floor,nm=function(e,t){var r=e.length,n=rm(r/2);return r<8?im(e,t):am(e,nm(tm(e,0,n),t),nm(tm(e,n),t),t)},im=function(e,t){for(var r,n,i=e.length,a=1;a<i;){for(n=a,r=e[a];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==a++&&(e[n]=r)}return e},am=function(e,t,r,n){for(var i=t.length,a=r.length,o=0,s=0;o<i||s<a;)e[o+s]=o<i&&s<a?n(t[o],r[s])<=0?t[o++]:r[s++]:o<i?t[o++]:r[s++];return e},om=nm,sm=Oe.match(/firefox\/(\d+)/i),um=!!sm&&+sm[1],cm=/MSIE|Trident/.test(Oe),lm=Oe.match(/AppleWebKit\/(\d+)\./),fm=!!lm&&+lm[1],hm=Xr,dm=L,pm=Je,vm=mt,mm=cn,ym=fu,gm=oc,_m=w,bm=om,Sm=mn,km=um,Em=cm,wm=Be,xm=fm,Tm=[],Am=dm(Tm.sort),Dm=dm(Tm.push),Om=_m((function(){Tm.sort(void 0)})),Lm=_m((function(){Tm.sort(null)})),Cm=Sm("sort"),Pm=!_m((function(){if(wm)return wm<70;if(!(km&&km>3)){if(Em)return!0;if(xm)return xm<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)Tm.push({k:t+n,v:r})}for(Tm.sort((function(e,t){return t.v-e.v})),n=0;n<Tm.length;n++)t=Tm[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));hm({target:"Array",proto:!0,forced:Om||!Lm||!Cm||!Pm},{sort:function(e){void 0!==e&&pm(e);var t=vm(this);if(Pm)return void 0===e?Am(t):Am(t,e);var r,n,i=[],a=mm(t);for(n=0;n<a;n++)n in t&&Dm(i,t[n]);for(bm(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:gm(t)>gm(r)?1:-1}}(e)),r=mm(i),n=0;n<r;)t[n]=i[n++];for(;n<a;)ym(t,n++);return t}});var Rm,Im=En("Array").sort,Mm=C,Bm=Im,Um=Array.prototype,Nm=E((function(e){var t=e.sort;return e===Um||Mm(Um,e)&&t===Um.sort?Bm:t})),Fm="undefined"!=typeof window&&window.location&&Dn(Rm=window.location.href).call(Rm,"xgplayerdebugger=1")>-1,jm="color: #525252; background-color: #90ee90;",Vm="color: #525252; background-color: red;",Gm="color: #525252; background-color: yellow; ",zm="%c[xgplayer]",Hm={config:{debug:Fm?3:0},logInfo:function(e){for(var t,r,n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];this.config.debug>=3&&(r=console).log.apply(r,Qi(t=[zm,jm,e]).call(t,i))},logWarn:function(e){for(var t,r,n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];this.config.debug>=1&&(r=console).warn.apply(r,Qi(t=[zm,Gm,e]).call(t,i))},logError:function(e){var t,r;if(!(this.config.debug<1)){for(var n=this.config.debug>=2?"trace":"error",i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];(r=console)[n].apply(r,Qi(t=[zm,Vm,e]).call(t,a))}}},qm=function(){function e(t){Dp(this,e),this.bufferedList=t}return Lp(e,[{key:"start",value:function(e){return this.bufferedList[e].start}},{key:"end",value:function(e){return this.bufferedList[e].end}},{key:"length",get:function(){return this.bufferedList.length}}]),e}(),Ym={};Ym.createDom=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=document.createElement(t);return a.className=i,a.innerHTML=r,Is(e=Us(n)).call(e,(function(e){var r=e,i=n[e];"video"===t||"audio"===t||"live-video"===t?i&&a.setAttribute(r,i):a.setAttribute(r,i)})),a},Ym.createDomFromHtml=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var n=document.createElement("div");n.innerHTML=e;var i=n.children;if(n=null,i.length>0){var a;if(i=i[0],r&&Ym.addClass(i,r),t)Is(a=Us(t)).call(a,(function(e){i.setAttribute(e,t[e])}));return i}return null}catch(o){return Hm.logError("util.createDomFromHtml",o),null}},Ym.hasClass=function(e,t){if(!e||!t)return!1;try{return Gp(Array.prototype).call(e.classList,(function(e){return e===t}))}catch(n){var r=e.className&&"object"===Ap(e.className)?e.getAttribute("class"):e.className;return r&&!!r.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},Ym.addClass=function(e,t){if(e&&t)try{var r;Is(r=t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g)).call(r,(function(t){t&&e.classList.add(t)}))}catch(n){Ym.hasClass(e,t)||(e.className&&"object"===Ap(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},Ym.removeClass=function(e,t){if(e&&t)try{var r;Is(r=t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g)).call(r,(function(t){t&&e.classList.remove(t)}))}catch(i){var n;if(Ym.hasClass(e,t))Is(n=t.split(/\s+/g)).call(n,(function(t){var r=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===Ap(e.className)?e.setAttribute("class",e.getAttribute("class").replace(r," ")):e.className=e.className.replace(r," ")}))}},Ym.toggleClass=function(e,t){var r;e&&Is(r=t.split(/\s+/g)).call(r,(function(t){Ym.hasClass(e,t)?Ym.removeClass(e,t):Ym.addClass(e,t)}))},Ym.classNames=function(){for(var e=arguments,t=[],r=function(r){if("String"===Ym.typeOf(e[r]))t.push(e[r]);else if("Object"===Ym.typeOf(e[r])){var n;rl(n=Us(e[r])).call(n,(function(n){e[r][n]&&t.push(n)}))}},n=0;n<arguments.length;n++)r(n);return t.join(" ")},Ym.findDom=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,r=arguments.length>1?arguments[1]:void 0;try{e=t.querySelector(r)}catch(n){Hm.logError("util.findDom",n),0===Dn(r).call(r,"#")&&(e=t.getElementById(nu(r).call(r,1)))}return e},Ym.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},Ym.padStart=function(e,t,r){for(var n=String(r),i=t>>0,a=Math.ceil(i/n.length),o=[],s=String(e);a--;)o.push(n);return o.join("").substring(0,i-s.length)+s},Ym.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=cv(Ym).call(Ym,Math.floor(e/3600),2,0),r=cv(Ym).call(Ym,Math.floor((e-3600*t)/60),2,0),n=cv(Ym).call(Ym,Math.floor(e-3600*t-60*r),2,0);return("00"===t?[r,n]:[t,r,n]).join(":")},Ym.event=function(e){if(e.touches){var t=e.touches[0]||e.changedTouches[0];e.clientX=t.clientX||0,e.clientY=t.clientY||0,e.offsetX=t.pageX-t.target.offsetLeft,e.offsetY=t.pageY-t.target.offsetTop}e._target=e.target||e.srcElement},Ym.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},Ym.deepCopy=function(e,t){var r;if("Object"===Ym.typeOf(t)&&"Object"===Ym.typeOf(e))return Is(r=Us(t)).call(r,(function(r){if("Object"!==Ym.typeOf(t[r])||t[r]instanceof Node)if("Array"===Ym.typeOf(t[r])){var n;e[r]="Array"===Ym.typeOf(e[r])?Qi(n=e[r]).call(n,t[r]):t[r]}else e[r]=t[r];else void 0===e[r]||void 0===e[r]?e[r]=t[r]:Ym.deepCopy(e[r],t[r])})),e},Ym.deepMerge=function(e,t){var r;return rl(r=Us(t)).call(r,(function(r){var n;"Array"===Ym.typeOf(t[r])&&"Array"===Ym.typeOf(e[r])?"Array"===Ym.typeOf(e[r])&&(n=e[r]).push.apply(n,Pp(t[r])):Ym.typeOf(e[r])!==Ym.typeOf(t[r])||null===e[r]||"Object"!==Ym.typeOf(e[r])||t[r]instanceof window.Node?null!==t[r]&&(e[r]=t[r]):Ym.deepMerge(e[r],t[r])})),e},Ym.getBgImage=function(e){var t=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;if(!t||"none"===t)return"";var r=document.createElement("a");return r.href=t.replace(/url\("|"\)/g,""),r.href},Ym.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Is(Array.prototype).call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},Ym.setInterval=function(e,t,r,n){e._interval[t]||(e._interval[t]=Av(sp(r).call(r,e),n))},Ym.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},Ym.setTimeout=function(e,t,r){e._timers||(e._timers=[]);var n=Dv((function(){t(),Ym.clearTimeout(e,n)}),r);return e._timers.push(n),n},Ym.clearTimeout=function(e,t){var r=e._timers;if("Array"===Ym.typeOf(r)){for(var n=0;n<r.length;n++)if(r[n]===t){Ou(r).call(r,n,1),clearTimeout(t);break}}else clearTimeout(t)},Ym.clearAllTimers=function(e){var t=e._timers;"Array"===Ym.typeOf(t)&&(rl(t).call(t,(function(e){clearTimeout(e)})),e._timerIds=[])},Ym.createImgBtn=function(e,t,r,n){var i,a,o,s,u,c,l,f,h,d,p,v,m=Ym.createDom("xg-".concat(e),"",{},"xgplayer-".concat(e,"-img"));(m.style.backgroundImage='url("'.concat(t,'")'),r&&n)&&(Iv(i=["px","rem","em","pt","dp","vw","vh","vm","%"]).call(i,(function(e){var t,i;return!(Dn(r).call(r,e)>-1&&Dn(n).call(n,e)>-1)||(l=qv(em(t=nu(r).call(r,0,Dn(r).call(r,e))).call(t)),f=qv(em(i=nu(n).call(n,0,Dn(n).call(n,e))).call(i)),h=e,!1)})),m.style.width=Qi(a="".concat(l)).call(a,h),m.style.height=Qi(o="".concat(f)).call(o,h),m.style.backgroundSize=Qi(s=Qi(u=Qi(c="".concat(l)).call(c,h," ")).call(u,f)).call(s,h),m.style.margin="start"===e?Qi(d=Qi(p=Qi(v="-".concat(f/2)).call(v,h," auto auto -")).call(p,l/2)).call(d,h):"auto 5px auto 5px");return m},Ym.Hex2RGBA=function(e,t){var r,n=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var i="#";e.replace(/[0-9A-F]/gi,(function(e){i+=e+e})),e=i}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){n.push(Qc(e,16))})),Qi(r="rgba(".concat(n.join(","),", ")).call(r,t,")")):"rgba(255, 255, 255, 0.1)"},Ym.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},Ym.checkIsFunction=function(e){return e&&"function"==typeof e},Ym.checkIsObject=function(e){return null!==e&&"object"===Ap(e)},Ym.hide=function(e){e.style.display="none"},Ym.show=function(e,t){e.style.display=t||"block"},Ym.isUndefined=function(e){if(null==e)return!0},Ym.isNotNull=function(e){return!(null==e)},Ym.setStyleFromCsstext=function(e,t){if(t)if("String"===Ym.typeOf(t)){var r=t.replace(/\s+/g,"").split(";");rl(r).call(r,(function(t){if(t){var r=t.split(":");r.length>1&&(e.style[r[0]]=r[1])}}))}else{var n;rl(n=Us(t)).call(n,(function(r){e.style[r]=t[r]}))}},Ym.filterStyleFromText=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],n=e.style.cssText;if(!n)return{};var i=n.replace(/\s+/g,"").split(";"),a={},o={};return rl(i).call(i,(function(e){if(e){var t=e.split(":");t.length>1&&(!function(e,t){for(var r=0,n=t.length;r<n;r++)if(Dn(e).call(e,t[r])>-1)return!0;return!1}(t[0],r)?o[t[0]]=t[1]:a[t[0]]=t[1])}})),e.setAttribute("style",""),rl(t=Us(o)).call(t,(function(t){e.style[t]=o[t]})),a},Ym.getStyleFromCsstext=function(e){var t=e.style.cssText;if(!t)return{};var r=t.replace(/\s+/g,"").split(";"),n={};return rl(r).call(r,(function(e){if(e){var t=e.split(":");t.length>1&&(n[t[0]]=t[1])}})),n},Ym.preloadImg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){var n=new window.Image;n.onload=function(e){n=null,t&&t(e)},n.onerror=function(e){n=null,r&&r(e)},n.src=e}},Ym.stopPropagation=function(e){e&&e.stopPropagation()},Ym.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},Ym.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},Ym.checkTouchSupport=function(){return"ontouchstart"in window},Ym.getBuffered2=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,r=[],n=0;n<e.length;n++)r.push({start:e.start(n)<.5?0:e.start(n),end:e.end(n)});Nm(r).call(r,(function(e,t){var r=e.start-t.start;return r||t.end-e.end}));var i=[];if(t)for(var a=0;a<r.length;a++){var o=i.length;if(o){var s=i[o-1].end;r[a].start-s<t?r[a].end>s&&(i[o-1].end=r[a].end):i.push(r[a])}else i.push(r[a])}else i=r;return new qm(i)},Ym.getEventPos=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.touches&&e.touches.length>0&&(e=e.touches[0]),{x:e.x/t,y:e.y/t,clientX:e.clientX/t,clientY:e.clientY/t,offsetX:e.offsetX/t,offsetY:e.offsetY/t,pageX:e.pageX/t,pageY:e.pageY/t}},Ym.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},Ym.getHostFromUrl=function(e){if("String"!==Ym.typeOf(e))return"";var t=e.split("/"),r="";return t.length>3&&t[2]&&(r=t[2]),r},Ym.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},Ym.isMSE=function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},Ym.isBlob=function(e){return"string"==typeof e&&/^blob/.test(e)},Ym.generateSessionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=Qc(e)}catch(r){e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=Qc(window.performance.now())),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))},Ym.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},Ym.adjustTimeByDuration=function(e,t,r){return t&&e&&(e>t||r&&e<t)?t:e},Ym.createPositionBar=function(e,t){var r=Ym.createDom("xg-bar","",{"data-index":-1},e);return t.appendChild(r),r},Ym.getTransformStyle=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n={scale:"".concat(t.scale||1),translate:Qi(e="".concat(t.x||0,"%, ")).call(e,t.y||0,"%"),rotate:"".concat(t.rotate||0,"deg")},i=Us(n);return Is(i).call(i,(function(e){var t,i=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),a=Qi(t="".concat(e,"(")).call(t,n[e],")");i.test(r)?(i.lastIndex=-1,r=r.replace(i,a)):r+="".concat(a," ")})),r},Ym.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360},Ym.getIndexByTime=function(e,t){var r=t.length,n=-1;if(r<1)return n;if(e<=t[0].end||r<2)n=0;else if(e>t[r-1].end)n=r-1;else for(var i=1;i<r;i++)if(e>t[i-1].end&&e<=t[i].end){n=i;break}return n},Ym.getOffsetCurrentTime=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n=-1;if((n=r>=0&&r<t.length?r:Ym.getIndexByTime(e,t))<0)return-1;var i=t.length,a=t[n],o=a.start,s=a.end,u=a.cTime,c=a.offset;return e<o?u:e>=o&&e<=s?e-c:e>s&&n>=i-1?s:-1},Ym.getCurrentTimeByOffset=function(e,t){var r=-1;if(!t||t.length<0)return e;for(var n=0;n<t.length;n++)if(e<=t[n].duration){r=n;break}if(-1!==r){var i=t[r].start;return r-1<0?i+e:i+(e-t[r-1].duration)}return e};var Km="3.0.21-rc.5",Wm={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},Xm=Lp((function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};Dp(this,e);var n=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var i,a=r.mediaError?r.mediaError:t.media.error||{},o=t.duration,s=t.currentTime,u=t.ended,c=t.src,l=t.currentSrc,f=t.media,h=f.readyState,d=f.networkState,p=r.errorCode||a.code;Wm[p]&&(p=Wm[p]);var v={playerVersion:Km,currentTime:s,duration:o,ended:u,readyState:h,networkState:d,src:c||l,errorType:r.errorType,errorCode:p,message:r.errorMessage||a.message,mediaError:a,originError:r.originError?r.originError.stack:"",host:Ym.getHostFromUrl(c||l)};return r.ext&&rl(i=Us(r.ext)).call(i,(function(e){v[e]=r.ext[e]})),v}if(arguments.length>1){for(var m={playerVersion:Km,domain:document.domain},y=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],g=0;g<arguments.length;g++)m[y[g]]=arguments[g];return m.ex=n?(n[arguments[0]]||{}).msg:"",m}}));function Qm(e,t,r){for(var n,i=arguments.length,a=new Array(i>3?i-3:0),o=3;o<i;o++)a[o-3]=arguments[o];var s,u=t.call.apply(t,Qi(n=[e]).call(n,a));r&&"function"==typeof r&&(u&&u.then?u.then((function(){for(var t,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];r.call.apply(r,Qi(t=[e]).call(t,i))})):r.call.apply(r,Qi(s=[e]).call(s,a)))}function $m(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[e]&&(this.__hooks[e]=null),sp(r=function(){var r,i=arguments,a=this;if(n.pre)try{var o,s;(s=n.pre).call.apply(s,Qi(o=[this]).call(o,nu(Array.prototype).call(arguments)))}catch(v){var u,c;throw v.message=Qi(u=Qi(c="[pluginName: ".concat(this.pluginName,":")).call(c,e,":pre error] >> ")).call(u,v.message),v}if(this.__hooks&&this.__hooks[e])try{var l,f=function(e,t,r){for(var n=arguments.length,i=new Array(n>3?n-3:0),a=3;a<n;a++)i[a-3]=arguments[a];if(e.__hooks&&nl(e.__hooks[t])){var o,s=e.__hooks[t],u=-1,c=function e(t,r,n){for(var i,a,o=arguments.length,c=new Array(o>3?o-3:0),l=3;l<o;l++)c[l-3]=arguments[l];if(u++,0===s.length||u===s.length)return n.call.apply(n,Qi(a=[t,t]).call(a,c));var f,h=s[u],d=h.call.apply(h,Qi(i=[t,t]).call(i,c));return d&&d.then?d.then((function(i){var a;return!1===i?null:e.apply(void 0,Qi(a=[t,r,n]).call(a,c))})).catch((function(e){console.warn("[runHooks]".concat(r," reject"),e.message)})):!1!==d?e.apply(void 0,Qi(f=[t,r,n]).call(f,c)):void 0};return c.apply(void 0,Qi(o=[e,t,r]).call(o,i))}var l;return r.call.apply(r,Qi(l=[e,e]).call(l,i))}(this,e,t);if(f)if(f.then)f.then((function(e){var r;!1!==e&&Qm.apply(void 0,Qi(r=[a,t,n.next]).call(r,Pp(i)))})).catch((function(e){throw e}));else Qm.apply(void 0,Qi(l=[this,t,n.next]).call(l,nu(Array.prototype).call(arguments)));else if(void 0===f){var h;Qm.apply(void 0,Qi(h=[this,t,n.next]).call(h,nu(Array.prototype).call(arguments)))}}catch(v){var d,p;throw v.message=Qi(d=Qi(p="[pluginName: ".concat(this.pluginName,":")).call(p,e,"] >> ")).call(d,v.message),v}else Qm.apply(void 0,Qi(r=[this,t,n.next]).call(r,nu(Array.prototype).call(arguments)))}).call(r,this)}function Jm(e,t){var r=this.__hooks;if(!r||!nl(r[e]))return-1;for(var n=r[e],i=0;i<n.length;i++)if(n[i]===t)return i;return-1}function Zm(e,t){var r=this.__hooks;if(r)return r.hasOwnProperty(e)?(nl(r[e])||(r[e]=[]),-1===Jm.call(this,e,t)&&r[e].push(t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function ey(e,t){var r=this.__hooks;if(r){if(nl(r[e])){var n=r[e],i=Jm.call(this,e,t);-1!==i&&Ou(n).call(n,i,1)}delete r[e]}}function ty(e,t){var r;Hm.logError(Qi(r="[".concat(e,"] event or callback cant be undefined or null when call ")).call(r,t))}var ry=function(){function e(t){Dp(this,e),Ym.checkIsFunction(this.beforeCreate)&&this.beforeCreate(t),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.__hooks={},t&&rl(t).call(t,(function(t){e.__hooks[t]=null})),jd(e,"hooks",{get:function(){var t;return e.__hooks&&rl(t=Us(e.__hooks)).call(t,(function(t){if(e.__hooks[t])return t}))}})}(this),this.__args=t,this.__events={},this.__onceEvents={},this.config=t.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(t)}return Lp(e,[{key:"beforeCreate",value:function(e){}},{key:"afterCreate",value:function(){}},{key:"beforePlayerInit",value:function(){}},{key:"onPluginsReady",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"destroy",value:function(){}},{key:"__init",value:function(e){this.player=e.player,this.playerConfig=e.player&&e.player.config,this.pluginName=e.pluginName?e.pluginName.toLowerCase():this.constructor.pluginName.toLowerCase(),this.logger=e.player&&e.player.logger}},{key:"updateLang",value:function(e){e||(e=this.lang)}},{key:"lang",get:function(){return this.player.lang}},{key:"i18n",get:function(){return this.player.i18n}},{key:"i18nKeys",get:function(){return this.player.i18nKeys}},{key:"domEventType",get:function(){var e=Ym.checkTouchSupport()?"touch":"mouse";return!this.playerConfig||"touch"!==this.playerConfig.domEventType&&"mouse"!==this.playerConfig.domEventType||(e=this.playerConfig.domEventType),e}},{key:"on",value:function(e,t){var r=this;e&&t&&this.player?"string"==typeof e?(this.__events[e]=t,this.player.on(e,t)):nl(e)&&Is(e).call(e,(function(e){r.__events[e]=t,r.player.on(e,t)})):ty(this.pluginName,"plugin.on(event, callback)")}},{key:"once",value:function(e,t){var r=this;e&&t&&this.player?"string"==typeof e?(this.__onceEvents[e]=t,this.player.once(e,t)):nl(e)&&Is(e).call(e,(function(n){r.__onceEvents[n]=t,r.player.once(e,t)})):ty(this.pluginName,"plugin.once(event, callback)")}},{key:"off",value:function(e,t){var r=this;e&&t&&this.player?"string"==typeof e?(delete this.__events[e],this.player.off(e,t)):nl(e)&&Is(e).call(e,(function(n){delete r.__events[e],r.player.off(n,t)})):ty(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var e,t=this;Is(e=["__events","__onceEvents"]).call(e,(function(e){var r;Is(r=Us(t[e])).call(r,(function(r){t[e][r]&&t.off(r,t[e][r]),r&&delete t[e][r]}))})),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(e){var t,r;if(this.player){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];(r=this.player).emit.apply(r,Qi(t=[e]).call(t,i))}}},{key:"emitUserAction",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var n=Tp(Tp({},r),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,n)}}},{key:"hook",value:function(e,t){var r;return $m.call.apply($m,Qi(r=[this]).call(r,nu(Array.prototype).call(arguments)))}},{key:"useHooks",value:function(e,t){for(var r,n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];return Zm.call.apply(Zm,Qi(r=[this]).call(r,nu(Array.prototype).call(arguments)))}},{key:"removeHooks",value:function(e,t){for(var r,n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];return ey.call.apply(ey,Qi(r=[this]).call(r,nu(Array.prototype).call(arguments)))}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.player)return r&&(t.pluginName=r),this.player.registerPlugin({plugin:e,options:t})}},{key:"getPlugin",value:function(e){return this.player?this.player.getPlugin(e):null}},{key:"__destroy",value:function(){var e,t=this,r=this.player,n=this.pluginName;this.offAll(),Ym.clearAllTimers(this),Ym.checkIsFunction(this.destroy)&&this.destroy(),rl(e=["player","playerConfig","pluginName","logger","__args","__hooks"]).call(e,(function(e){t[e]=null})),r.unRegisterPlugin(n),this.__hooks=null}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&jd(e,r,t[r])}},{key:"defineMethod",value:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&"function"==typeof t[r]&&jd(e,r,{configurable:!0,value:t[r]})}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),e}();function ny(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function iy(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ny(Object(r),!0).forEach((function(t){hy(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ny(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ay(){ay=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(D){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new x(i||[]);return n(o,"_invoke",{value:S(e,r,s)}),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(D){return{type:"throw",arg:D}}}e.wrap=c;var f={};function h(){}function d(){}function p(){}var v={};u(v,a,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(T([])));y&&y!==t&&r.call(y,a)&&(v=y);var g=p.prototype=h.prototype=Object.create(v);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function i(n,a,o,s){var u=l(e[n],e,a);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(f).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function S(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=k(o,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function k(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function T(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return d.prototype=p,n(g,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:d,configurable:!0}),d.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},_(b.prototype),u(b.prototype,o,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new b(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},_(g),u(g,s,"Generator"),u(g,a,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=T,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;w(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function oy(e){return(oy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function sy(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(Xb){return void r(Xb)}s.done?t(u):Promise.resolve(u).then(n,i)}function uy(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){sy(a,n,i,o,s,"next",e)}function s(e){sy(a,n,i,o,s,"throw",e)}o(void 0)}))}}function cy(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ly(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,xy(n.key),n)}}function fy(e,t,r){return t&&ly(e.prototype,t),r&&ly(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function hy(e,t,r){return(t=xy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dy(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&vy(e,t)}function py(e){return(py=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function vy(e,t){return(vy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function my(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function yy(e,t,r){return(yy=my()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&vy(i,r.prototype),i}).apply(null,arguments)}function gy(e){var t="function"==typeof Map?new Map:void 0;return gy=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return yy(e,arguments,py(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),vy(n,e)},gy(e)}function _y(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function by(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Sy(e){var t=my();return function(){var r,n=py(e);if(t){var i=py(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return by(e)}(this,r)}}function ky(){return ky="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=py(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},ky.apply(this,arguments)}function Ey(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function wy(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Ey(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ey(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function xy(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var Ty,Ay=function(){function e(){cy(this,e)}return fy(e,null,[{key:"start",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0):0}},{key:"end",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(Xb){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var r=[],n=0,i=e.length;n<i;n++){var a=r.length;if(a&&t){var o=r[a-1],s=o[1];if(e.start(n)-s<=t){var u=e.end(n);u>s&&(o[1]=u)}else r.push([e.start(n),e.end(n)])}else r.push([e.start(n),e.end(n)])}return r}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce((function(e,t){return e+(t[1]-t[0])}),0):0}},{key:"info",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var i=0,a=0,o=0,s=0,u=0,c=0,l=0,f=e.buffers(t,n),h=0,d=f.length;h<d;h++){var p=f[h];if(r+n>=p[0]&&r<=p[1])i=p[0],a=p[1],o=h;else{if(r+n<p[0]){s=p[0],u=p[1];break}r+n>p[1]&&(c=p[0],l=p[1])}}return{start:i,end:a,index:o,buffers:f,nextStart:s,nextEnd:u,prevStart:c,prevEnd:l,currentTime:r,behind:r-i,remaining:a?a-r:0,length:e.totalLength&&e.totalLength(f)}}},{key:"isBuffered",value:function(t,r){if(t){var n=e.get(t);if(null!=n&&n.length)for(var i=0;i<n.length;i++)if(r>=n.start(i)&&r<=n.end(i))return!0}return!1}}]),e}(),Dy="undefined"!=typeof window,Oy="manifest",Ly="network",Cy="network_timeout",Py="network_forbidden",Ry="network_notfound",Iy="network_range_not_satisfiable",My="demux",By="remux",Uy="media",Ny="drm",Fy="other",jy="runtime",Vy={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"},Gy=(hy(Ty={},Oy,{HLS:1100,DASH:1200}),hy(Ty,Ly,2100),hy(Ty,Cy,2101),hy(Ty,Py,2103),hy(Ty,Ry,2104),hy(Ty,Iy,2116),hy(Ty,My,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),hy(Ty,By,{FMP4:4100,MP4:4200}),hy(Ty,Uy,{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}),hy(Ty,Ny,{LICENSE:7100,CUSTOM_LICENSE:7200}),hy(Ty,Fy,8e3),hy(Ty,jy,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003}),Ty),zy=function(e){dy(r,e);var t=Sy(r);function r(e,n,i,a,o){var s;return cy(this,r),(s=t.call(this,o||(null==i?void 0:i.message))).errorType=e===Cy?Ly:e,s.originError=i,s.ext=a,s.errorCode=Gy[e][n]||Gy[e],s.errorMessage=s.message,s.errorCode||(s.errorType=Fy,s.errorCode=Gy[s.errorType]),s}return fy(r,null,[{key:"create",value:function(e,t,n,i,a){return e instanceof r?e:(e instanceof Error&&(n=e,e=""),e||(e=Fy),new r(e,t,n,i,a))}},{key:"network",value:function(e){var t;return new r(null!=e&&e.isTimeout?Cy:Ly,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}]),r}(gy(Error)),Hy={DEBUG:1,LOG:2,WARN:3,ERROR:4},qy=["Boolean","Number","String","Undefined","Null","Date","Object"],Yy=function(){function e(t,r){cy(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),this.logCacheLevel=(null==r?void 0:r.logCacheLevel)||3,this.logMaxSize=(null==r?void 0:r.logMaxSize)||204800,this.logSize=0,this.logTextArray=[]}return fy(e,[{key:"debug",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[Hy.DEBUG].concat(n)),e.disabled||(t=console).debug.apply(t,["[".concat(Ky(),"]"),this._prefix].concat(n))}},{key:"log",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[Hy.LOG].concat(n)),e.disabled||(t=console).log.apply(t,["[".concat(Ky(),"]"),this._prefix].concat(n))}},{key:"warn",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[Hy.WARN].concat(n)),e.disabled||(t=console).warn.apply(t,["[".concat(Ky(),"]"),this._prefix].concat(n))}},{key:"error",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[Hy.ERROR].concat(n)),e.disabled||(t=console).error.apply(t,["[".concat(Ky(),"]"),this._prefix].concat(n))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var a=n.map((function(e){return Xy(e)}));t="[".concat(Ky(),"]")+this._prefix+JSON.stringify(a)}catch(s){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var o=this.logTextArray.shift();this.logSize-=o.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function Ky(){return(new Date).toLocaleString()}function Wy(e){if("object"!==oy(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function Xy(e,t,r){r||(r=1),t||(t=2);var n={};if(!e||"object"!==oy(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!qy.includes(i))return i;if(!(r>t)){for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r===t?n[a]=Wy(e[a]):"object"===oy(e[a])?n[a]=Xy(e[a],t,r+1):n[a]=e[a]);return n}}function Qy(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.used=!1,r.resolve=function(){return r.used=!0,e.apply(void 0,arguments)},r.reject=function(){return r.used=!0,t.apply(void 0,arguments)},r}function $y(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}hy(Yy,"disabled",!0);var Jy=function(e){try{return JSON.stringify(e)}catch(t){return""}};function Zy(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];try{return Dy?e&&"undefined"!=typeof ManagedMediaSource?ManagedMediaSource:window.MediaSource:null}catch(t){}}function eg(e){return/ManagedMediaSource/gi.test(Object.prototype.toString.call(e))}var tg="appendBuffer",rg="removeBuffer",ng="updateDuration",ig=function(){function e(t,r){var n=this;cy(this,e),hy(this,"media",null),hy(this,"mediaSource",null),hy(this,"_openPromise",Qy()),hy(this,"_queue",Object.create(null)),hy(this,"_sourceBuffer",Object.create(null)),hy(this,"_mseFullFlag",{}),hy(this,"_st",0),hy(this,"_opst",0),hy(this,"_logger",null),hy(this,"_config",null),hy(this,"_url",null),hy(this,"_onStartStreaming",(function(){n._logger.debug("startstreaming")})),hy(this,"_onEndStreaming",(function(){n._logger.debug("endstreaming")})),hy(this,"_onSBUpdateEnd",(function(e){var t=n._queue[e];if(t){var r=t[0];if((null==r?void 0:r.opName)!==ng&&t.shift(),r){var i,a,o=$y()-n._opst;n._logger.debug("UpdateEnd(".concat(e,"/").concat(r.opName,")"),Jy(function(e){var t=[];if(e instanceof TimeRanges)for(var r=0;r<e.length;r++)t.push({start:e.start(r),end:e.end(r)});return t}(null===(i=n._sourceBuffer[e])||void 0===i?void 0:i.buffered)),o,r.context),r.promise.resolve({name:r.opName,context:r.context,costtime:o});var s=null===(a=r.context)||void 0===a?void 0:a.callback;s&&"function"==typeof s&&s(r.context),n._startQueue(e)}}})),hy(this,"_onSBUpdateError",(function(e,t){var r=n._queue[e];if(r){var i=r[0];i&&(n._logger.error("UpdateError",e,i.opName,i.context),i.promise.reject(new zy(Uy,Vy.MSE_APPEND_BUFFER,t)))}})),this._config=Object.assign(e.getDefaultConfig(),r),t&&this.bindMedia(t),this._logger=new Yy("MSE"),this._config.openLog&&Yy.enable()}var t,r,n;return fy(e,[{key:"isOpened",get:function(){var e;return"open"===(null===(e=this.mediaSource)||void 0===e?void 0:e.readyState)}},{key:"hasOpTasks",get:function(){var e=this,t=!1;return Object.keys(this._queue).forEach((function(r){var n=e._queue[r];Array.isArray(n)&&(t||(t=n.length>0))})),t}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"streaming",get:function(){return!eg(this.mediaSource)||this.mediaSource.streaming}},{key:"isFull",value:function(t){return t?this._mseFullFlag[t]:this._mseFullFlag[e.VIDEO]}},{key:"updateDuration",value:function(e){var t=this,r=this.mediaSource&&this.mediaSource.duration>e;if(this.mediaSource&&this.mediaSource.duration>e){var n=0;if(Object.keys(this._sourceBuffer).forEach((function(e){try{n=Math.max(t.bufferEnd(e)||0,n)}catch(Xb){}})),e<n)return Promise.resolve()}return this._enqueueBlockingOp((function(){t.isEnded?t._logger.debug("setDuration but ended"):t.mediaSource&&(t.mediaSource.duration=e,t._logger.debug("setDuration",e))}),ng,{isReduceDuration:r})}},{key:"open",value:function(){var e=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var t=this.mediaSource;t.addEventListener("sourceopen",(function r(){var n=$y()-e._st;e._logger.debug("sourceopen",n),t.removeEventListener("sourceopen",r),e._openPromise.resolve({costtime:n})})),this._openPromise=Qy()}return this._openPromise}},{key:"bindMedia",value:(n=uy(ay().mark((function e(t){var r,n,i,a,o=this;return ay().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mediaSource&&!this.media){e.next=3;break}return e.next=3,this.unbindMedia();case 3:if(r=Zy(this._config.preferMMS),t&&r){e.next=6;break}throw new Error("Param media or MediaSource does not exist");case 6:return this.media=t,n=this.mediaSource=new r,i=eg(n),this._st=$y(),a=function e(){var r=$y()-o._st;o._logger.debug("sourceopen"),n.removeEventListener("sourceopen",e),URL.revokeObjectURL(t.src),o._openPromise.resolve({costtime:r})},n.addEventListener("sourceopen",a),i&&(n.addEventListener("startstreaming",this._onStartStreaming),n.addEventListener("endstreaming",this._onEndStreaming)),this._url=URL.createObjectURL(n),t.src=this._url,t.disableRemotePlayback=i,e.abrupt("return",this._openPromise);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"unbindMedia",value:(r=uy(ay().mark((function e(){var t,r,n,i=this;return ay().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),t=this.mediaSource){if(Object.keys(this._queue).forEach((function(e){var t=i._queue[e];t&&t.forEach((function(e){var t,r;return null===(t=e.promise)||void 0===t||null===(r=t.resolve)||void 0===r?void 0:r.call(t)}))})),r=!!this.media&&this.media.readyState>=1,n="open"===t.readyState,r&&n)try{t.endOfStream()}catch(Xb){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(i._sourceBuffer[e])}catch(Xb){}})),eg(t)&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming))}if(this.media){this.media.disableRemotePlayback=!1,this.media.removeAttribute("src");try{this.media.load()}catch(Xb){}this.media=null}this.mediaSource=null,this._openPromise=Qy(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var r;try{r=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(Xb){throw new zy(Uy,Vy.MSE_ADD_SB,Xb)}r.mimeType=t,r.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),r.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var r=this,n=this._sourceBuffer[e];return this.mediaSource&&n&&n.mimeType!==t?"function"!=typeof n.changeType?Promise.reject(new zy(Uy,Vy.MSE_CHANGE_TYPE,new Error("changeType is not a function"))):this._enqueueOp(e,(function(){try{n.changeType(t)}catch(i){throw new zy(Uy,Vy.MSE_CHANGE_TYPE,i)}n.mimeType=t,r._onSBUpdateEnd(e)}),"changeType",{mimeType:t}):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,r){var n=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(function(){var i;n.mediaSource&&!n.media.error&&(n._logger.debug("MSE APPEND START",r),n._opst=$y(),null===(i=n._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),tg,r):Promise.resolve()}},{key:"remove",value:function(e,t,r,n){var i=this,a=!1;return this._mseFullFlag[e]&&(a=!0),this._enqueueOp(e,(function(){if(i.mediaSource&&!i.media.error){var a=i._sourceBuffer[e];t>=r||!a?i._onSBUpdateEnd(e):(i._opst=$y(),i._logger.debug("MSE REMOVE START",e,t,r,n),a.remove(t,r))}}),rg,n,a)}},{key:"clearBuffer",value:function(e,t){var r,n=this;return Object.keys(this._sourceBuffer).forEach((function(i){r=n.remove(i,e,t)})),r||Promise.resolve()}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach((function(r){var n=t._sourceBuffer[r];e=t.remove(r,0,Ay.end(Ay.get(n)))})),e}},{key:"clearOpQueues",value:function(e,t){var r;this._logger.debug("MSE clearOpQueue START");var n=this._queue[e];if(t&&n)this._queue[e]=[];else if(n&&n[e]&&!(n.length<5)){var i=[];n.forEach((function(e){e.context&&e.context.isinit&&i.push(e)})),this._queue[e]=n.slice(0,2),i.length>0&&(r=this._queue[e]).push.apply(r,i)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((function(){var r=t.mediaSource;r&&"open"===r.readyState&&(t._logger.debug("MSE endOfStream START"),e?r.endOfStream(e):r.endOfStream())}),"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var r=this.mediaSource;e<0||t<e||null==r||!r.setLiveSeekableRange||"open"!==r.readyState||r.setLiveSeekableRange(e,t)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return Ay.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return Ay.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return Ay.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,r,n,i){var a=this;if(!this.mediaSource)return Promise.resolve();var o=this._queue[e]=this._queue[e]||[],s={exec:t,promise:Qy(),opName:r,context:n};return i?(o.splice(0,0,s),this._mseFullFlag[e]=!1,this._startQueue(e)):o.push(s),this.isOpened||this.isEnded?1===o.length&&this._startQueue(e):this._openPromise.then((function(){1===o.length&&a._startQueue(e)})),s.promise}},{key:"_enqueueBlockingOp",value:(t=uy(ay().mark((function e(t,r,n){var i,a,o=this;return ay().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:if((i=Object.keys(this._sourceBuffer)).length){e.next=5;break}return e.abrupt("return",t());case 5:return a=[],i.forEach((function(e){var t=o._queue[e],i=Qy();a.push(i),t.push({exec:function(){i.resolve()},promise:i,opName:r,context:n}),1===t.length&&o._startQueue(e)})),e.abrupt("return",Promise.all(a).then((function(){try{return t()}finally{i.forEach((function(e){var t=o._queue[e],r=o._sourceBuffer[e];null==t||t.shift(),r&&r.updating||o._startQueue(e)}))}})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})},{key:"_startQueue",value:function(e){var t=this._queue[e];if(t){var r=t[0];if(r&&!this._mseFullFlag[e])try{r.exec()}catch(Xb){Xb&&Xb.message&&Xb.message.indexOf("SourceBuffer is full")>=0?(this._mseFullFlag[e]=!0,r.context&&"object"===oy(r.context)&&(r.context.isFull=!0),this._logger.error("[MSE error], context,",r.context," ,name,",r.opName,",err,SourceBuffer is full"),r.promise.reject(new zy(Uy,Vy.MSE_FULL,Xb))):(this._logger.error(Xb),r.promise.reject(Xb.constructor===zy?Xb:new zy(Uy,Vy.MSE_OTHER,Xb)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,r){var n=this;return this._enqueueOp(e,(function(){t<0&&(t+=.001),n._sourceBuffer[e].timestampOffset=t,n._onSBUpdateEnd(e)}),"setTimeoffset",r)}},{key:"abort",value:function(e,t){var r=this;return this.isOpened?this._enqueueOp(e,(function(){r._sourceBuffer[e].abort(),r._onSBUpdateEnd(e)}),"abort",t):Promise.resolve()}}],[{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"',t=Zy();if(!t)return!1;try{return t.isTypeSupported(e)}catch(Xb){return this._logger.error(e,Xb),!1}}},{key:"isMMSOnly",value:function(){return"undefined"!=typeof ManagedMediaSource&&"undefined"==typeof MediaSource}},{key:"getDefaultConfig",value:function(){return{openLog:!1,preferMMS:!1}}}]),e}();hy(ig,"VIDEO","video"),hy(ig,"AUDIO","audio");var ag="fetch",og="xhr",sg="arraybuffer",ug="text",cg="json",lg=function(e){dy(r,e);var t=Sy(r);function r(e,n,i,a){var o;return cy(this,r),hy(by(o=t.call(this,a)),"retryCount",0),hy(by(o),"isTimeout",!1),hy(by(o),"loaderType",ag),hy(by(o),"startTime",0),hy(by(o),"endTime",0),hy(by(o),"options",{}),o.url=e,o.request=n,o.response=i,o}return fy(r)}(gy(Error)),fg=Object.prototype.toString;function hg(e){if("[object Object]"!==fg.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function dg(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function pg(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function vg(e,t){if(e){if(!t)return e;var r,n=Object.keys(t).map((function(e){if(null!=(r=t[e]))return Array.isArray(r)?e+="[]":r=[r],r.map((function(t){var r;return r=t,"[object Date]"===fg.call(r)?t=t.toISOString():function(e){return null!==e&&"object"===oy(e)}(t)&&(t=JSON.stringify(t)),"".concat(pg(e),"=").concat(pg(t))})).join("&")})).filter(Boolean).join("&");if(n){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}}function mg(e,t,r,n,i,a,o,s,u,c,l){return i=null!=i?parseFloat(i):null,n=parseInt(n||"0",10),Number.isNaN(n)&&(n=0),{data:e,done:t,options:{range:u,vid:c,index:s,contentLength:n,age:i,startTime:a,firstByteTime:o,endTime:Date.now(),priOptions:l},response:r}}function yg(e,t){return Math.round(8*e*1e3/t/1024)}var gg={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"},_g=2097152,bg=function(e){dy(n,e);var t,r=Sy(n);function n(){var e;return cy(this,n),hy(by(e=r.call(this)),"_abortController",null),hy(by(e),"_timeoutTimer",null),hy(by(e),"_reader",null),hy(by(e),"_response",null),hy(by(e),"_aborted",!1),hy(by(e),"_index",-1),hy(by(e),"_range",null),hy(by(e),"_receivedLength",0),hy(by(e),"_running",!1),hy(by(e),"_logger",null),hy(by(e),"_vid",""),hy(by(e),"_onProcessMinLen",0),hy(by(e),"_onCancel",null),hy(by(e),"_priOptions",null),e}return fy(n,[{key:"load",value:function(e){var t,r=this,n=e.url,i=e.vid,a=e.timeout,o=e.responseType,s=e.onProgress,u=e.index,c=e.onTimeout,l=e.onCancel,f=e.range,h=e.transformResponse,d=e.request,p=e.params,v=e.logger,m=e.method,y=e.headers,g=e.body,_=e.mode,b=e.credentials,S=e.cache,k=e.redirect,E=e.referrer,w=e.referrerPolicy,x=e.onProcessMinLen,T=e.priOptions;this._logger=v,this._aborted=!1,this._onProcessMinLen=x,this._onCancel=l,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=u,this._range=f||[0,0],this._vid=i||n,this._priOptions=T||{};var A={method:m,headers:y,body:g,mode:_,credentials:b,cache:S,redirect:k,referrer:E,referrerPolicy:w,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},D=!1;clearTimeout(this._timeoutTimer),n=vg(n,p);var O=dg(f);O&&(y=d?d.headers:A.headers=A.headers||(Headers?new Headers:{}),Headers&&y instanceof Headers?y.append("Range",O):y.Range=O),a&&(this._timeoutTimer=setTimeout((function(){if(D=!0,r.cancel(),c){var e=new lg(n,A,null,"timeout");e.isTimeout=!0,c(e,{index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions})}}),a));var L=Date.now();return this._logger.debug("[fetch load start], index,",u,",range,",f),new Promise((function(e,t){fetch(d||n,d?void 0:A).then(function(){var i=uy(ay().mark((function i(a){var c,l,d,p;return ay().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(r._timeoutTimer),r._response=a,!r._aborted&&r._running){i.next=4;break}return i.abrupt("return");case 4:if(h&&(a=h(a,n)||a),a.ok){i.next=7;break}throw new lg(n,A,a,"bad network response");case 7:if(c=Date.now(),o!==ug){i.next=15;break}return i.next=11,a.text();case 11:l=i.sent,r._running=!1,i.next=37;break;case 15:if(o!==cg){i.next=22;break}return i.next=18,a.json();case 18:l=i.sent,r._running=!1,i.next=37;break;case 22:if(!s){i.next=29;break}return r.resolve=e,r.reject=t,r._loadChunk(a,s,L,c),i.abrupt("return");case 29:return i.next=31,a.arrayBuffer();case 31:l=i.sent,l=new Uint8Array(l),r._running=!1,d=Date.now()-L,p=yg(l.byteLength,d),r.emit(gg.REAL_TIME_SPEED,{speed:p,len:l.byteLength,time:d,vid:r._vid,index:r._index,range:r._range,priOptions:r._priOptions});case 37:r._logger.debug("[fetch load end], index,",u,",range,",f),e(mg(l,!0,a,a.headers.get("Content-Length"),a.headers.get("age"),L,c,u,f,r._vid,r._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){var i;clearTimeout(r._timeoutTimer),r._running=!1,r._aborted&&!D||((e=e instanceof lg?e:new lg(n,A,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=L,e.endTime=Date.now(),e.isTimeout=D,e.options={index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions},t(e))}))}))}},{key:"cancel",value:(t=uy(ay().mark((function e(){return ay().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(Xb){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,r,n){var i=this;if(!e.body||!e.body.getReader){this._running=!1;var a=new lg(e.url,"",e,"onProgress of bad response.body.getReader");return a.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(a)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(_g),this._writeIdx=0);var o,s,u,c=this._reader=e.body.getReader(),l=function(){var a=uy(ay().mark((function a(){var f,h,d,p,v,m,y,g;return ay().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return s=Date.now(),a.prev=1,a.next=4,c.read();case 4:o=a.sent,u=Date.now(),a.next=13;break;case 8:return a.prev=8,a.t0=a.catch(1),u=Date.now(),i._aborted||(i._running=!1,a.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(a.t0)),a.abrupt("return");case 13:if(h=(null===(f=i._range)||void 0===f?void 0:f.length)>0?i._range[0]:0,d=h+i._receivedLength,!i._aborted){a.next=19;break}return i._running=!1,t(void 0,!1,{range:[d,d],vid:i._vid,index:i._index,startTime:s,endTime:u,st:r,firstByteTime:n,priOptions:i._priOptions},e),a.abrupt("return");case 19:p=o.value?o.value.byteLength:0,i._receivedLength+=p,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",d,", end,",h+i._receivedLength,", done,",o.done),i._onProcessMinLen>0?i._writeIdx+p>=i._onProcessMinLen||o.done?((v=new Uint8Array(i._writeIdx+p)).set(i._cache.slice(0,i._writeIdx),0),p>0&&v.set(o.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",o.done,",len,",v.byteLength,", writeIdx,",i._writeIdx)):p>0&&i._writeIdx+p<_g?(i._cache.set(o.value,i._writeIdx),i._writeIdx+=p,i._logger.debug("【fetchLoader,onProgress cache】,len,",p,", writeIdx,",i._writeIdx)):p>0&&(m=new Uint8Array(i._writeIdx+p+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+p+2048,", datalen,",p,", writeIdx,",i._writeIdx),m.set(i._cache.slice(0,i._writeIdx),0),p>0&&m.set(o.value,i._writeIdx),i._writeIdx+=p,delete i._cache,i._cache=m,i._logger.debug("【fetchLoader,onProgress extra end】,len,",p,", writeIdx,",i._writeIdx)):v=o.value,(v&&v.byteLength>0||o.done)&&t(v,o.done,{range:[i._range[0]+i._receivedLength-(v?v.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:s,endTime:u,st:r,firstByteTime:n,priOptions:i._priOptions},e),o.done?(y=Date.now()-r,g=yg(i._receivedLength,y),i.emit(gg.REAL_TIME_SPEED,{speed:g,len:i._receivedLength,time:y,vid:i._vid,index:i._index,range:i._range,priOptions:i._priOptions}),i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",o.done),i.resolve(mg(o,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),r,n,i._index,i._range,i._vid,i._priOptions))):l();case 25:case"end":return a.stop()}}),a,null,[[1,8]])})));return function(){return a.apply(this,arguments)}}();l()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),n}(Bp);var Sg=function(e){dy(r,e);var t=Sy(r);function r(){var e;return cy(this,r),hy(by(e=t.call(this)),"_xhr",null),hy(by(e),"_aborted",!1),hy(by(e),"_timeoutTimer",null),hy(by(e),"_range",null),hy(by(e),"_receivedLength",0),hy(by(e),"_url",null),hy(by(e),"_onProgress",null),hy(by(e),"_index",-1),hy(by(e),"_headers",null),hy(by(e),"_currentChunkSizeKB",384),hy(by(e),"_timeout",null),hy(by(e),"_xhr",null),hy(by(e),"_withCredentials",null),hy(by(e),"_startTime",-1),hy(by(e),"_loadCompleteResolve",null),hy(by(e),"_loadCompleteReject",null),hy(by(e),"_runing",!1),hy(by(e),"_logger",!1),hy(by(e),"_vid",""),hy(by(e),"_responseType",void 0),hy(by(e),"_credentials",void 0),hy(by(e),"_method",void 0),hy(by(e),"_transformResponse",void 0),hy(by(e),"_firstRtt",void 0),hy(by(e),"_onCancel",null),hy(by(e),"_priOptions",null),e}return fy(r,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=vg(e.url,e.params);var r=Date.now();return new Promise((function(e,r){t._loadCompleteResolve=e,t._loadCompleteReject=r,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof lg?e:new lg(t._url,t._request)).startTime=r,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===sg&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,r=this._range[0]+this._receivedLength,n=this._range[1];t<this._range[1]-r&&(n=r+t),e=[r,n],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var r=this._xhr=new XMLHttpRequest;r.open(this._method||"GET",this._url,!0),r.responseType=this._responseType,this._timeout&&(r.timeout=this._timeout),r.withCredentials=this._withCredentials,r.onload=this._onLoad.bind(this),r.onreadystatechange=this._onReadyStatechange.bind(this),r.onerror=function(e){var r,n,i;t._running=!1;var a=new lg(t._url,t._request,null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.response,"xhr.onerror.status:"+(null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));a.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(a)},r.ontimeout=function(e){t.cancel();var r=new lg(t._url,t._request,{status:408},"timeout");t._onTimeout&&(r.isTimeout=!0,t._onTimeout(r,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),r.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(r)};var n=this._headers||{},i=dg(e);i&&(n.Range=i),n&&Object.keys(n).forEach((function(e){r.setRequestHeader(e,n[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),r.send(this._body)}catch(a){a.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(a)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t,r=e.target.status;if(r<200||r>299){var n=new lg(this._url,null,iy(iy({},e.target.response),{},{status:r}),"bad response,status:"+r);return n.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(n)}var i,a=null,o=!1,s=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===sg){var u,c=new Uint8Array(e.target.response);if(i=s+this._receivedLength,c&&c.byteLength>0){this._receivedLength+=c.byteLength;var l=Date.now()-this._startTime,f=yg(this._receivedLength,l);this.emit(gg.REAL_TIME_SPEED,{speed:f,len:this._receivedLength,time:l,vid:this._vid,index:this._index,range:[i,s+this._receivedLength],priOptions:this._priOptions})}a=c,o=!((null===(u=this._range)||void 0===u?void 0:u.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",i,"end ",s+this._receivedLength,",dataLen,",c?c.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",o)}else o=!0,a=e.target.response;var h={ok:r>=200&&r<300,status:r,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(h=this._transformResponse(h,this._url)||h),this._onProgress&&this._onProgress(a,o,{index:this._index,vid:this._vid,range:[i,s+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},h),o?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(mg(this._onProgress?null:a,o,h,h.headers["content-length"],h.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,ky(py(r.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,r={},n=wy(e.getAllResponseHeaders().trim().split("\r\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value.split(": ");r[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(a){n.e(a)}finally{n.f()}return r}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),r}(Bp),kg=["retry","retryDelay","onRetryError","transformError"],Eg=function(){function e(t,r){cy(this,e),this.promise=Qy(),this.alive=!!r.onProgress,!r.logger&&(r.logger=new Yy("Loader")),this._loaderType=t,this._loader=t===ag&&"undefined"!=typeof fetch?new bg:new Sg,this._config=r,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=r.retryCheckFunc,this._logger=r.logger}var t;return fy(e,[{key:"exec",value:function(){var e=this,t=this._config,r=t.retry,n=t.retryDelay,i=t.onRetryError,a=t.transformError,o=_y(t,kg),s=function(){var t=uy(ay().mark((function t(){var u,c,l;return ay().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(o);case 3:u=t.sent,e.promise.resolve(u),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,a&&(c=a(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,{index:o.index,vid:o.vid,range:o.range,priOptions:o.priOptions}),e._retryCount++,l=!0,e._retryCheckFunc&&(l=e._retryCheckFunc(t.t0)),!(l&&e._retryCount<=r)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",o.range),e._retryTimer=setTimeout(s,n),t.abrupt("return");case 26:e.promise.reject(c);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return s(),this.promise}},{key:"cancel",value:(t=uy(ay().mark((function e(){return ay().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e}();function wg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if((t=t.filter(Boolean)).length<2)return t[0];var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}function xg(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var Tg=function(e){dy(n,e);var t,r=Sy(n);function n(e){var t;return cy(this,n),hy(by(t=r.call(this,e)),"type",ag),hy(by(t),"_queue",[]),hy(by(t),"_alive",[]),hy(by(t),"_currentTask",null),hy(by(t),"_finnalUrl",""),hy(by(t),"_config",void 0),t._config=function(e){return iy({loaderType:ag,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:ug,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e)}(e),t._config.loaderType!==og&&bg.isSupported()||(t.type=og),t.log=e.logger,t}return fy(n,[{key:"isFetch",value:function(){return this.type===ag}},{key:"load",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?r=e:r.url=e||r.url||this._config.url,(r=Object.assign({},this._config,r)).params&&(r.params=Object.assign({},r.params)),r.headers&&hg(r.headers)&&(r.headers=Object.assign({},r.headers)),r.body&&hg(r.body)&&(r.body=Object.assign({},r.body)),r.transformRequest&&(r=r.transformRequest(r)||r),r.logger=this.log;var n=new Eg(this.type,r);return n.loader.on(gg.REAL_TIME_SPEED,(function(e){t.emit(gg.REAL_TIME_SPEED,e)})),this._queue.push(n),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),n.promise}},{key:"cancel",value:(t=uy(ay().mark((function e(){var t;return ay().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,xg();case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,r;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(r=e._alive)||void 0===r?void 0:r.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return bg.isSupported()}}]),n}(Bp),Ag=function(){function e(){cy(this,e),hy(this,"_prevCurrentTime",0)}return fy(e,[{key:"do",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(e){var i=e.currentTime,a=0;if(this._prevCurrentTime===i){var o=Ay.info(Ay.get(e),i);if(!o.buffers.length)return;r&&o.nextStart||o.nextStart&&o.nextStart-i<t?a=o.nextStart+.1:o.end&&o.end-i>n&&!e.seeking&&(a=i+.1)}this._prevCurrentTime=i,a&&i!==a&&(e.currentTime=a)}}}]),e}(),Dg=function(){function e(t){var r=this;cy(this,e),hy(this,"_seiSet",new Set),this.emitter=t,t.on(gg.SEI,(function(e){e&&r._seiSet.add(e)}))}return fy(e,[{key:"throw",value:function(e,t){var r=this;if(null!=e&&this._seiSet.size){var n=e-.2,i=e+.2,a=[];this._seiSet.forEach((function(e){e.time>=n&&e.time<=i&&a.push(e)})),a.forEach((function(e){r._seiSet.delete(e),r.emitter.emit(gg.SEI_IN_TIME,e)})),t&&this._seiSet.forEach((function(t){t.time<e-5&&r._seiSet.delete(t)}))}}},{key:"reset",value:function(){this._seiSet.clear()}}]),e}(),Og=function(){function e(t){cy(this,e),hy(this,"_chunkSpeed",0),hy(this,"_chunkCache",[]),hy(this,"_speeds",[]),hy(this,"_totalSize",0),hy(this,"_totalCost",0),this._opts=t||{}}return fy(e,[{key:"addRecord",value:function(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}},{key:"addChunkRecord",value:function(e,t){var r,n;if(e&&t&&!(e<((null===(r=this._opts)||void 0===r?void 0:r.skipChunkSize)||1e3))){this._totalSize+=e,this._totalCost+=t,this._chunkSpeed=8e3*e/t,this._chunkCache.push({size:e,duration:t,timestamp:performance.now()});var i=(null===(n=this._opts)||void 0===n?void 0:n.chunkCountForSpeed)||50;this._chunkCache.length>i&&(this._chunkCache=this._chunkCache.slice(-i))}}},{key:"getAvgSpeed",value:function(){var e;if(!this._chunkCache.length&&!this._speeds.length)return 0;if(this._speeds.length)return this._speeds.reduce((function(e,t){return e+t}))/this._speeds.length;var t=this._chunkCache[this._chunkCache.length-1],r=performance.now()-t.timestamp;return r>((null===(e=this._opts)||void 0===e?void 0:e.longtimeNoReceived)||3e3)&&this._chunkCache.push({size:0,duration:r,timestamp:performance.now()}),8e3*this._chunkCache.reduce((function(e,t){return e+t.size}),0)/this._chunkCache.reduce((function(e,t){return e+t.duration}),0)}},{key:"getLatestSpeed",value:function(){return this._chunkCache.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeed:0}},{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}}]),e}(),Lg=function(){function e(t){cy(this,e),hy(this,"encodeType",""),hy(this,"audioCodec",""),hy(this,"videoCodec",""),hy(this,"domain",""),hy(this,"fps",0),hy(this,"bitrate",0),hy(this,"width",0),hy(this,"height",0),hy(this,"samplerate",0),hy(this,"channelCount",0),hy(this,"gop",0),hy(this,"_bitsAccumulateSize",0),hy(this,"_bitsAccumulateDuration",0),hy(this,"_startGopId",-1),this._timescale=t}return fy(e,[{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 t,r=e.data,n=null==r||null===(t=r.onMetaData)||void 0===t?void 0:t.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 t=e.fpsNum/e.fpsDen;t>0&&t<100&&(this.fps=t)}}},{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 t=this;if((!this.fps||this.fps>=100)&&e.length){var r=e.reduce((function(e,t){return e+t.duration}),0)/e.length;this.fps=Math.round(this._timescale/r)}e.forEach((function(e){-1===t._startGopId&&(t._startGopId=e.gopId),e.gopId===t._startGopId&&t.gop++,t._bitsAccumulateDuration+=e.duration/(t._timescale/1e3),t._bitsAccumulateSize+=e.units.reduce((function(e,t){return e+t.length}),0),t._bitsAccumulateDuration>=1e3&&(t.bitrate=8*t._bitsAccumulateSize,t._bitsAccumulateDuration=0,t._bitsAccumulateSize=0)}))}}]),e}(),Cg=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;cy(this,e),hy(this,"_core",null),hy(this,"_samples",[]),this._core=t,this._timescale=r,this._stats=new Lg(r),this._bindEvents()}return fy(e,[{key:"getStats",value:function(){var e,t,r,n,i,a,o,s,u,c,l,f=(null===(e=this._core)||void 0===e?void 0:e.media)||{},h=f.currentTime,d=void 0===h?0:h,p=f.decodeFps,v=void 0===p?0:p;return iy(iy({},this._stats.getStats()),{},{downloadSpeed:(null===(t=this._core)||void 0===t||null===(r=t.speedInfo)||void 0===r?void 0:r.call(t).speed)||0,avgSpeed:(null===(n=this._core)||void 0===n||null===(i=n.speedInfo)||void 0===i?void 0:i.call(n).avgSpeed)||0,totalReceivedByte:(null===(a=this._core)||void 0===a||null===(o=a.speedInfo)||void 0===o?void 0:o.call(a).totalSize)||0,totalReceivedCost:(null===(s=this._core)||void 0===s||null===(u=s.speedInfo)||void 0===u?void 0:u.call(s).totalCost)||0,currentTime:d,bufferEnd:(null===(c=this._core)||void 0===c||null===(l=c.bufferInfo())||void 0===l?void 0:l.remaining)||0,decodeFps:v})}},{key:"_bindEvents",value:function(){var e=this;this._core.on(gg.DEMUXED_TRACK,(function(t){var r=t.videoTrack;return e._stats.updateBitrate(r.samples)})),this._core.on(gg.FLV_SCRIPT_DATA,(function(t){e._stats.setFpsFromScriptData(t)})),this._core.on(gg.METADATA_PARSED,(function(t){"video"===t.type?e._stats.setVideoMeta(t.track):e._stats.setAudioMeta(t.track)})),this._core.on(gg.TTFB,(function(t){e._stats.setDomain(t.responseUrl)}))}},{key:"reset",value:function(){this._samples=[],this._stats=new Lg(this._timescale)}}]),e}();function Pg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rg(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Hg(n.key),n)}}function Ig(e,t,r){return t&&Rg(e.prototype,t),r&&Rg(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mg(e,t,r){return(t=Hg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bg(e){return(Bg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ug(e,t){return(Ug=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ng(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Fg(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Bg(e);if(t){var i=Bg(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ng(this,r)}}function jg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(l){c=!0,i=l}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(e,t)||Gg(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vg(e){return function(e){if(Array.isArray(e))return zg(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Gg(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gg(e,t){if(e){if("string"==typeof e)return zg(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?zg(e,t):void 0}}function zg(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Hg(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var qg="video",Yg="audio",Kg="metadata",Wg="av1",Xg="avc",Qg="hevc",$g="aac",Jg="g7110a",Zg="g7110m",e_="opus",t_="mp3",r_="LARGE_AV_SHIFT",n_="LARGE_VIDEO_GAP",i_="LARGE_VIDEO_GAP_BETWEEN_CHUNK",a_="LARGE_AUDIO_GAP",o_="AUDIO_FILLED",s_="AUDIO_DROPPED",u_=function(){function e(){Pg(this,e),Mg(this,"id",1),Mg(this,"type",qg),Mg(this,"codecType",Xg),Mg(this,"pid",-1),Mg(this,"hvcC",void 0),Mg(this,"codec",""),Mg(this,"timescale",0),Mg(this,"formatTimescale",0),Mg(this,"sequenceNumber",0),Mg(this,"baseMediaDecodeTime",0),Mg(this,"baseDts",0),Mg(this,"duration",0),Mg(this,"warnings",[]),Mg(this,"samples",[]),Mg(this,"pps",[]),Mg(this,"sps",[]),Mg(this,"vps",[]),Mg(this,"fpsNum",0),Mg(this,"fpsDen",0),Mg(this,"sarRatio",[]),Mg(this,"width",0),Mg(this,"height",0),Mg(this,"nalUnitSize",4),Mg(this,"present",!1),Mg(this,"isVideoEncryption",!1),Mg(this,"isAudioEncryption",!1),Mg(this,"isVideo",!0),Mg(this,"lastKeyFrameDts",0),Mg(this,"kid",null),Mg(this,"pssh",null),Mg(this,"ext",void 0)}return Ig(e,[{key:"reset",value:function(){this.sequenceNumber=this.width=this.height=this.fpsDen=this.fpsNum=this.duration=this.baseMediaDecodeTime=this.timescale=0,this.codec="",this.present=!1,this.pid=-1,this.pps=[],this.sps=[],this.vps=[],this.sarRatio=[],this.samples=[],this.warnings=[],this.hvcC=null}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}},{key:"exist",value:function(){return!!/av01/.test(this.codec)||!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}]),e}(),c_=function(){function e(){Pg(this,e),Mg(this,"id",2),Mg(this,"type",Yg),Mg(this,"codecType",$g),Mg(this,"pid",-1),Mg(this,"codec",""),Mg(this,"container",""),Mg(this,"sequenceNumber",0),Mg(this,"sampleDuration",0),Mg(this,"timescale",0),Mg(this,"formatTimescale",0),Mg(this,"baseMediaDecodeTime",0),Mg(this,"duration",0),Mg(this,"warnings",[]),Mg(this,"samples",[]),Mg(this,"baseDts",0),Mg(this,"sampleSize",16),Mg(this,"sampleRate",0),Mg(this,"channelCount",0),Mg(this,"objectType",0),Mg(this,"sampleRateIndex",0),Mg(this,"config",[]),Mg(this,"present",!1),Mg(this,"isVideoEncryption",!1),Mg(this,"isAudioEncryption",!1),Mg(this,"kid",null),Mg(this,"ext",void 0)}return Ig(e,[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!(!this.sampleRate||!this.channelCount||!this.codec&&!this.container||this.codecType!==$g&&this.codecType!==Jg&&this.codecType!==Zg&&this.codecType!==e_&&this.codecType!==t_)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}}]),e}(),l_=function(){function e(t,r,n){Pg(this,e),Mg(this,"flag",{}),Mg(this,"keyframe",!1),Mg(this,"gopId",0),Mg(this,"duration",0),Mg(this,"size",0),Mg(this,"units",[]),Mg(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=r,n&&(this.units=n)}return Ig(e,[{key:"cts",get:function(){return this.pts-this.dts}},{key:"setToKeyframe",value:function(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}]),e}(),f_=Ig((function e(t,r,n,i){Pg(this,e),Mg(this,"duration",1024),Mg(this,"flag",{dependsOn:2,isNonSyncSample:0}),Mg(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=r,this.size=r.byteLength,this.sampleOffset=i,n&&(this.duration=n)})),h_=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ug(e,t)}(r,e);var t=Fg(r);function r(){return Pg(this,r),t.apply(this,arguments)}return Ig(r)}(Ig((function e(t,r){Pg(this,e),Mg(this,"time",0),this.data=t,this.originPts=this.pts=r}))),d_=function(){function e(){Pg(this,e),Mg(this,"id",3),Mg(this,"type",Kg),Mg(this,"timescale",0),Mg(this,"flvScriptSamples",[]),Mg(this,"seiSamples",[])}return Ig(e,[{key:"exist",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length||!this.timescale)}},{key:"reset",value:function(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length)}}]),e}(),p_=function(){function e(t){Pg(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return Ig(e,[{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(n))}}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();Mg(p_,"disabled",!0);var v_="undefined"!=typeof window,m_=v_&&navigator.userAgent.toLocaleLowerCase(),y_=v_&&/^((?!chrome|android).)*safari/.test(m_),g_=v_&&m_.includes("firefox"),__=v_&&m_.includes("android"),b_=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"getRateIndexByRate",value:function(t){return e.FREQ.indexOf(t)}},{key:"parseADTS",value:function(t,r){for(var n=t.length,i=0;i+2<n&&(255!==t[i]||240!=(246&t[i+1]));)i++;if(!(i>=n)){var a=i,o=[],s=(60&t[i+2])>>>2,u=e.FREQ[s];if(!u)throw new Error("Invalid sampling index: ".concat(s));for(var c,l,f=1+((192&t[i+2])>>>6),h=(1&t[i+2])<<2|(192&t[i+3])>>>6,d=e._getConfig(s,h,f),p=d.config,v=d.codec,m=0,y=e.getFrameDuration(u);i+7<n;)if(255===t[i]&&240==(246&t[i+1])){if(!(l=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5)||n-i<l)break;c=2*(1&~t[i+1]),o.push({pts:r+m*y,data:t.subarray(i+7+c,i+l)}),m++,i+=l}else i++;return{skip:a,remaining:i>=n?void 0:t.subarray(i),frames:o,samplingFrequencyIndex:s,sampleRate:u,objectType:f,channelCount:h,codec:v,config:p,originCodec:"mp4a.40.".concat(f)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var r=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,a=e.FREQ[n];if(a){var o=e._getConfig(n,i,r);return{samplingFrequencyIndex:n,sampleRate:a,objectType:r,channelCount:i,config:o.config,codec:o.codec,originCodec:"mp4a.40.".concat(r)}}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,r){var n,i,a=[];return g_?e>=6?(n=5,i=e-3):(n=2,i=e):__?(n=2,i=e):(n=2===r||5===r?r:5,i=e,e>=6?i=e-3:1===t&&(n=2,i=e)),a[0]=n<<3,a[0]|=(14&e)>>1,a[1]=(1&e)<<7,a[1]|=t<<3,5===n&&(a[1]|=(14&i)>>1,a[2]=(1&i)<<7,a[2]|=8,a[3]=0),{config:a,codec:"mp4a.40.".concat(n)}}},{key:"getSilentFrame",value:function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}]),e}();function S_(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t=t.filter(Boolean);var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}Mg(b_,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var k_=Math.pow(2,32);function E_(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function w_(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function x_(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return w_(e,t)*k_+w_(e,t+4)}function T_(e){for(var t,r="avc1.",n=0;n<3;n++)(t=e[n].toString(16)).length<2&&(t="0".concat(t)),r+=t;return r}function A_(e){if(!Array.isArray(e)){for(var t=[],r="",n=0;n<e.length;n++)n%2&&(r=e[n-1]+e[n],t.push(parseInt(r,16)),r="");return t}return e.map((function(e){return parseInt(e,16)}))}function D_(e,t){return Number(e+"."+t)}var O_=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"parseAnnexB",value:function(e){for(var t=e.length,r=2,n=0;null!==e[r]&&void 0!==e[r]&&1!==e[r];)r++;if((n=++r+2)>=t)return[];for(var i=[];n<t;)switch(e[n]){case 0:if(0!==e[n-1]){n+=2;break}if(0!==e[n-2]){n++;break}r!==n-2&&i.push(e.subarray(r,n-2));do{n++}while(1!==e[n]&&n<t);n=(r=n+1)+2;break;case 1:if(0!==e[n-1]||0!==e[n-2]){n+=3;break}r!==n-2&&i.push(e.subarray(r,n-2)),n=(r=n+1)+2;break;default:n+=3}return r<t&&i.push(e.subarray(r)),i}},{key:"parseAvcC",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(!(e.length<4)){for(var r,n=e.length,i=[],a=0;a+t<n;)if(r=w_(e,a),3===t&&(r>>>=8),a+=t,r){if(a+r>n)break;i.push(e.subarray(a,a+r)),a+=r}return i}}},{key:"parseSEI",value:function(e,t){for(var r=e.length,n=t?2:1,i=0,a=0,o="";255===e[n];)i+=255,n++;for(i+=e[n++];255===e[n];)a+=255,n++;if(a+=e[n++],5===i&&r>n+16)for(var s=0;s<16;s++)o+=e[n].toString(16),n++;return{payload:e.subarray(n,n+a),type:i,size:a,uuid:o}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,r=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(!r.length)return e;var i=t-r.length,a=new Uint8Array(i),o=0;for(n=0;n<i;o++,n++)o===r[0]&&(o++,r.shift()),a[n]=e[o];return a}}]),e}(),L_=function(){function e(t){if(Pg(this,e),Mg(this,"_bytesAvailable",void 0),Mg(this,"_bitsAvailable",0),Mg(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return Ig(e,[{key:"bitsAvailable",get:function(){return this._bitsAvailable}},{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw new Error("No bytes available");var r=new Uint8Array(4);r.set(this._data.subarray(e,e+t)),this._word=new DataView(r.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{e-=this._bitsAvailable;var t=Math.floor(e/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw new Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),r=this._word>>>32-t;return this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),(t=e-t)>0&&this._bitsAvailable?r<<t|this.readBits(t):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this._bitsAvailable;++e)if(0!=(this._word&2147483648>>>e))return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,r=8,n=0;n<e;n++)0!==r&&(r=(t+this.readEG()+256)%256),t=0===r?t:r}}]),e}(),C_=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"parseAVCDecoderConfigurationRecord",value:function(t){if(!(t.length<7)){for(var r,n,i=1+(3&t[4]),a=[],o=[],s=6,u=31&t[5],c=0;c<u;c++)if(n=t[s]<<8|t[s+1],s+=2,n){var l=t.subarray(s,s+n);s+=n,a.push(l),r||(r=e.parseSPS(O_.removeEPB(l)))}var f,h=t[s];s++;for(var d=0;d<h;d++)f=t[s]<<8|t[s+1],s+=2,f&&(o.push(t.subarray(s,s+f)),s+=f);return{sps:r,spsArr:a,ppsArr:o,nalUnitSize:i}}}},{key:"parseSPS",value:function(e){var t=new L_(e);t.readUByte();var r=t.readUByte(),n=t.readUByte(),i=t.readUByte();t.skipUEG();var a=420;if(100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r){var o=t.readUEG();if(o<=3&&(a=[0,420,422,444][o]),3===o&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBool())for(var s=3!==o?8:12,u=0;u<s;u++)t.readBool()&&(u<6?t.skipScalingList(16):t.skipScalingList(64))}t.skipUEG();var c=t.readUEG();if(0===c)t.readUEG();else if(1===c){t.skipBits(1),t.skipUEG(),t.skipUEG();for(var l=t.readUEG(),f=0;f<l;f++)t.skipUEG()}t.skipUEG(),t.skipBits(1);var h=t.readUEG(),d=t.readUEG(),p=t.readBits(1);0===p&&t.skipBits(1),t.skipBits(1);var v,m,y,g,_,b=0,S=0,k=0,E=0;if(t.readBool()&&(b=t.readUEG(),S=t.readUEG(),k=t.readUEG(),E=t.readUEG()),t.readBool()){if(t.readBool())switch(t.readUByte()){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:v=[t.readUByte()<<8|t.readUByte(),t.readUByte()<<8|t.readUByte()]}if(t.readBool()&&t.readBool(),t.readBool()&&(t.readBits(4),t.readBool()&&t.readBits(24)),t.readBool()&&(t.readUEG(),t.readUEG()),t.readBool()){var w=t.readBits(32),x=t.readBits(32);m=t.readBool(),_=(y=x)/(g=2*w)}}return{codec:T_(e.subarray(1,4)),profileIdc:r,profileCompatibility:n,levelIdc:i,chromaFormat:a,width:Math.ceil(16*(h+1)-2*(b+S)),height:(2-p)*(d+1)*16-(p?2:4)*(k+E),sarRatio:v,fpsNum:y,fpsDen:g,fps:_,fixedFrame:m}}}]),e}(),P_=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"parseHEVCDecoderConfigurationRecord",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(t.length<23)){r=r||{};for(var n,i,a,o,s,u=1+(3&t[21]),c=[],l=[],f=[],h=23,d=t[22],p=0;p<d;p++){a=63&t[h],o=t[h+1]<<8|t[h+2],h+=3;for(var v=0;v<o;v++)if(s=t[h]<<8|t[h+1],h+=2,s){switch(a){case 32:var m=t.subarray(h,h+s);n||(n=e.parseVPS(O_.removeEPB(m),r)),f.push(m);break;case 33:var y=t.subarray(h,h+s);i||(i=e.parseSPS(O_.removeEPB(y),r)),c.push(y);break;case 34:l.push(t.subarray(h,h+s))}h+=s}}return{hvcC:r,sps:i,spsArr:c,ppsArr:l,vpsArr:f,nalUnitSize:u}}}},{key:"parseVPS",value:function(t,r){r=r||{};var n=new L_(t);n.readUByte(),n.readUByte(),n.readBits(12);var i=n.readBits(3);return r.numTemporalLayers=Math.max(r.numTemporalLayers||0,i+1),n.readBits(17),e._parseProfileTierLevel(n,i,r),r}},{key:"parseSPS",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r=r||{};var n=new L_(t);n.readUByte(),n.readUByte(),n.readBits(4);var i=n.readBits(3);r.numTemporalLayers=Math.max(i+1,r.numTemporalLayers||0),r.temporalIdNested=n.readBits(1),e._parseProfileTierLevel(n,i,r),n.readUEG();var a=r.chromaFormatIdc=n.readUEG(),o=420;a<=3&&(o=[0,420,422,444][a]);var s=0;3===a&&(s=n.readBits(1));var u,c,l,f,h=n.readUEG(),d=n.readUEG(),p=n.readBits(1);(1===p&&(u=n.readUEG(),c=n.readUEG(),l=n.readUEG(),f=n.readUEG()),r.bitDepthLumaMinus8=n.readUEG(),r.bitDepthChromaMinus8=n.readUEG(),1===p)&&(h-=(1!==a&&2!==a||0!==s?1:2)*(c+u),d-=(1===a&&0===s?2:1)*(f+l));return{codec:"hev1.1.6.L93.B0",width:h,height:d,chromaFormat:o,hvcC:r}}},{key:"_parseProfileTierLevel",value:function(e,t,r){var n=r.generalTierFlag||0;r.generalProfileSpace=e.readBits(2),r.generalTierFlag=Math.max(e.readBits(1),n),r.generalProfileIdc=Math.max(e.readBits(5),r.generalProfileIdc||0),r.generalProfileCompatibilityFlags=e.readBits(32),r.generalConstraintIndicatorFlags=[e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8)];var i=e.readBits(8);n<r.generalTierFlag?r.generalLevelIdc=i:r.generalLevelIdc=Math.max(i,r.generalLevelIdc||0);var a=[],o=[];if(t>e.bitsAvailable)throw new Error("maxSubLayersMinus inavlid size ".concat(t));for(var s=0;s<t;s++)a[s]=e.readBits(1),o[s]=e.readBits(1);t>0&&e.readBits(2*(8-t));for(var u=0;u<t;u++)0!==a[u]&&(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)),0!==o[u]&&e.readBits(8)}}]),e}(),R_=9e4,I_=45e4,M_=9e4,B_=function(){function e(t,r,n,i){Pg(this,e),this.videoTrack=t,this.audioTrack=r,this.metadataTrack=n,this._baseDts=-1,this._baseVideoDts=-1,this._baseAudioDts=-1,this._baseDtsInited=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._needForceFixLargeGap=null==i?void 0:i.forceFixLargeGap,this._largeGapThreshold=(null==i?void 0:i.largeGapThreshold)||45e4}return Ig(e,[{key:"fix",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t=Math.round(9e4*t);var i=this.videoTrack,a=this.audioTrack,o=i.samples,s=a.samples;if(o.length||s.length){var u=o[0],c=s[0],l=0;if(o.length&&s.length&&(l=u.dts-c.pts),this._baseDtsInited||this._calculateBaseDts(this.audioTrack,this.videoTrack),r&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=t,this._baseAudioDts-=t,this._baseVideoDts-=t),!n){this._videoNextDts=l>0?t+l:t,this._audioNextPts=l>0?t:t-l,this._needForceFixLargeGap&&(this._videoNextDts=0,this._audioNextPts=0);var f=u?u.dts-this._baseDts-this._videoNextDts:0,h=c?c.pts-this._baseDts-this._audioNextPts:0;Math.abs(f||h)>M_&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=t)}if(this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(a),this._fixVideo(i),this.metadataTrack.exist()){var d=this.metadataTrack.timescale;this.metadataTrack.seiSamples.forEach((function(t){t.pts=t.originPts-e._baseDts,t.time=Math.max(0,t.pts)/d}))}i.samples.length&&(i.baseMediaDecodeTime=i.samples[0].dts),a.samples.length&&(a.baseMediaDecodeTime=a.samples[0].pts*a.timescale/9e4)}}},{key:"_fixVideo",value:function(e){var t=this,r=e.samples;if(r.length){if(r.forEach((function(e){e.dts-=t._needForceFixLargeGap?t._baseVideoDts:t._baseDts,e.pts-=t._needForceFixLargeGap?t._baseVideoDts:t._baseDts})),void 0===this._videoNextDts){var n=r[0];this._videoNextDts=n.dts}var i,a,o=r.length,s=0,u=r[0],c=r[1],l=this._videoNextDts-u.dts;if(Math.abs(l)>45e3)if(e.warnings.push({type:i_,nextDts:this._videoNextDts/90,firstSampleDts:u.dts/90,nextSampleDts:((null===(i=r[1])||void 0===i?void 0:i.dts)||0)/90,sampleDuration:l/90}),u.dts+=l,u.pts+=l,c&&Math.abs(c.dts-u.dts)>M_)this._videoTimestampBreak=!0,r.forEach((function(e,t){0!==t&&(e.dts+=l,e.pts+=l)}));else for(var f=1;f<o-1;f++){var h,d=null===(h=r[f])||void 0===h?void 0:h.dts,p=r[f-1].dts;d&&d-p<0&&(r[f].dts+=l,r[f].pts+=l)}if(e.fpsNum&&e.fpsDen&&(a=e.timescale*(e.fpsDen/e.fpsNum)),a<900&&(a=0),!a){var v=e.samples[0],m=e.samples[1];a=1===o?9e3:Math.floor(m.dts-v.dts)}for(var y=0;y<o;y++){var g=r[y].dts,_=r[y+1];if((s=y<o-1?_.dts-g:r[y-1]?Math.min(g-r[y-1].dts,a):a)>M_||s<0){this._videoTimestampBreak=!0,s=this._audioTimestampBreak?a:Math.max(s,2700);var b=this._audioNextPts||0;_&&_.dts>b&&(s=a),e.warnings.push({type:n_,time:g/e.timescale,dts:g,originDts:r[y].originDts,nextDts:this._videoNextDts,sampleDuration:s,refSampleDuration:a})}r[y].duration=s,this._videoNextDts+=s}}}},{key:"_fixAudio",value:function(e){var t=this,r=e.samples;r.length&&(r.forEach((function(e){e.pts-=t._needForceFixLargeGap?t._baseAudioDts:t._baseDts,e.dts=e.pts})),this._doFixAudioInternal(e,r,9e4))}},{key:"_calculateBaseDts",value:function(e,t){var r=e.samples,n=t.samples;if(!r.length&&!n.length)return!1;var i=1/0,a=1/0;r.length&&(e.baseDts=i=r[0].pts,this._baseAudioDts=i),n.length&&(t.baseDts=a=n[0].dts,this._baseVideoDts=a),this._baseDts=Math.min(i,a);var o=a-i,s=!1;return Number.isFinite(o)&&Math.abs(o)>45e3&&t.warnings.push({type:r_,videoBaseDts:a,audioBasePts:i,baseDts:this._baseDts,delta:o}),Number.isFinite(o)&&Math.abs(o)>this._largeGapThreshold*R_&&(s=!0),this._baseDtsInited||(s&&this._needForceFixLargeGap?this._needForceFixLargeGap=!0:this._needForceFixLargeGap=!1),this._baseDtsInited=!0,!0}},{key:"_resetBaseDtsWhenStreamBreaked",value:function(){if(this._baseDtsInited&&this._videoTimestampBreak&&this._audioTimestampBreak){if(!this._calculateBaseDts(this.audioTrack,this.videoTrack))return;this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts),this._audioLastSample=null,this._videoLastSample=null,this._videoTimestampBreak=!1,this._audioTimestampBreak=!1}}},{key:"_doFixAudioInternal",value:function(e,t,r){e.sampleDuration||(e.sampleDuration=b_.getFrameDuration(e.timescale,r));var n=e.sampleDuration;if(void 0===this._audioNextPts){var i=t[0];this._audioNextPts=i.pts}for(var a=0;a<t.length;a++){var o=this._audioNextPts,s=t[a],u=s.pts-o;if(!this._audioTimestampBreak&&u>=3*n&&u<=R_&&!y_){var c=b_.getSilentFrame(e.codec,e.channelCount)||t[0].data.subarray(),l=Math.floor(u/n);Math.abs(s.pts-this._lastAudioExceptionGapDot)>I_&&(this._lastAudioExceptionGapDot=s.pts),e.warnings.push({type:o_,pts:s.pts/90,originPts:s.originPts,count:l,nextPts:o/90,refSampleDuration:n});for(var f=0;f<l;f++){var h=new f_(Math.floor(o),c);h.originPts=Math.floor(this._baseDts+o),t.splice(a,0,h),this._audioNextPts+=n,a++}a--}else u<=-3*n&&u>=-9e4?(Math.abs(s.pts-this._lastAudioExceptionOverlapDot)>I_&&(this._lastAudioExceptionOverlapDot=s.pts,e.warnings.push({type:s_,pts:s.pts/90,originPts:s.originPts,nextPts:o/90,refSampleDuration:n})),t.splice(a,1),a--):(Math.abs(u)>=R_&&(this._audioTimestampBreak=!0,Math.abs(s.pts-this._lastAudioExceptionLargeGapDot)>I_&&(this._lastAudioExceptionLargeGapDot=s.pts,e.warnings.push({type:a_,time:s.pts/1e3,pts:s.pts/90,originPts:s.originPts,nextPts:o/90,sampleDuration:u,refSampleDuration:n}))),s.dts=s.pts=o,this._audioNextPts+=n)}}}]),e}(),U_=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],N_=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],F_=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],j_=[0,1,1,4],V_=null,G_=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"isHeader",value:function(e,t){return t+1<e.length&&255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}},{key:"appendFrame",value:function(t,r,n,i,a){if(!(n+24>r.length)){var o=e.parseHeader(r,n);if(o&&n+o.frameLength<=r.length){var s=i+a*(9e4*o.samplesPerFrame/o.sampleRate),u={data:r.subarray(n,n+o.frameLength),pts:s,dts:s};return u.size=u.data.byteLength,t.config=[],t.channelCount=o.channelCount,t.sampleRate=o.sampleRate,g_?t.codec="mp3":t.container="audio/mpeg",t.samples.push(u),{length:o.frameLength}}}}},{key:"parseHeader",value:function(e,t){var r=e[t+1]>>3&3,n=e[t+1]>>1&3,i=e[t+2]>>4&15,a=e[t+2]>>2&3;if(1!==r&&0!==i&&15!==i&&3!==a){var o=e[t+2]>>1&1,s=e[t+3]>>6,u=1e3*U_[14*(3===r?3-n:3===n?3:4)+i-1],c=N_[3*(3===r?0:2===r?1:2)+a],l=3===s?1:2,f=F_[r][n],h=j_[n],d=8*f*h,p=Math.floor(f*u/c+o)*h;if(null===V_){var v=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);V_=v?parseInt(v[1]):0}return!!V_&&V_<=87&&2===n&&u>=224e3&&0===s&&(e[t+3]=128|e[t+3]),{sampleRate:c,channelCount:l,frameLength:p,samplesPerFrame:d}}}}]),e}(),z_=new p_("TsDemuxer"),H_=function(){function e(t,r,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Pg(this,e),Mg(this,"_pmtId",-1),Mg(this,"_remainingPacketData",null),Mg(this,"_videoPesData",[]),Mg(this,"_audioPesData",[]),Mg(this,"_gopId",0),this.videoTrack=t||new u_,this.audioTrack=r||new c_,this.metadataTrack=n||new d_,this._fixer=new B_(this.videoTrack,this.audioTrack,this.metadataTrack,i)}return Ig(e,[{key:"demux",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=this.audioTrack,i=this.videoTrack,a=this.metadataTrack;t&&(this._pmtId=-1,i.reset(),n.reset(),a.reset()),!r||t?(this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[]):(i.samples=[],n.samples=[],a.seiSamples=[],i.warnings=[],n.warnings=[],this._remainingPacketData&&(e=S_(this._remainingPacketData,e),this._remainingPacketData=null));var o=e.length,s=o%188;s&&(this._remainingPacketData=e.subarray(o-s),o-=s);for(var u=i.pid,c=n.pid,l=0;l<o;l+=188){if(71!==e[l])throw new Error("TS packet did not start with 0x47");var f=!!(64&e[l+1]),h=((31&e[l+1])<<8)+e[l+2],d=void 0;if((48&e[l+3])>>4>1){if((d=l+5+e[l+4])===l+188)continue}else d=l+4;switch(h){case 0:f&&(d+=e[d]+1),this._pmtId=(31&e[d+10])<<8|e[d+11];break;case this._pmtId:f&&(d+=e[d]+1);var p=d+3+((15&e[d+1])<<8|e[d+2])-4;for(d+=12+((15&e[d+10])<<8|e[d+11]);d<p;){var v=(31&e[d+1])<<8|e[d+2];switch(e[d]){case 15:n.pid=c=v;break;case 3:case 4:-1===n.pid&&(n.pid=c=v,n.codecType=t_);break;case 27:if(-1!==u)break;i.codecType=Xg,i.pid=u=v;break;case 36:if(-1!==u)break;i.codecType=Qg,i.pid=u=v;break;default:z_.warn("Unsupported stream. type: ".concat(e[d],", pid: ").concat(v))}d+=5+((15&e[d+3])<<8|e[d+4])}break;case u:f&&this._videoPesData.length&&this._parseVideoData(),this._videoPesData.push(e.subarray(d,l+188));break;case c:f&&this._audioPesData.length&&this._parseAudioData(),this._audioPesData.push(e.subarray(d,l+188));break;case 17:case 8191:break;default:z_.warn("Unknown pid: ".concat(h))}}return this._parseVideoData(),this._parseAudioData(),n.formatTimescale=i.formatTimescale=i.timescale=a.timescale=9e4,n.timescale=n.sampleRate||0,{videoTrack:i,audioTrack:n,metadataTrack:a}}},{key:"fix",value:function(e,t,r){return this._fixer.fix(e,t,r),{videoTrack:this.videoTrack,audioTrack:this.audioTrack,metadataTrack:this.metadataTrack}}},{key:"demuxAndFix",value:function(e,t,r,n){return this.demux(e,t,r),this.fix(n,t,r)}},{key:"_parseVideoData",value:function(){if(this._videoPesData.length){var t=e._parsePES(S_.apply(void 0,Vg(this._videoPesData)));if(t){var r=O_.parseAnnexB(t.data);r?this._createVideoSample(r,t.pts,t.dts):z_.warn("Cannot parse avc units",t),this._videoPesData=[]}else z_.warn("Cannot parse video pes",this._videoPesData)}}},{key:"_createVideoSample",value:function(e,t,r){var n=this;if(e.length){var i=this.videoTrack,a=i.codecType===Qg,o=new l_(t,r);e.forEach((function(e){var r=a?e[0]>>>1&63:31&e[0];switch(r){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!a&&5!==r||a&&5===r)break;o.setToKeyframe(),n._gopId++;break;case 6:case 39:case 40:if(!a&&6!==r||a&&6===r)break;return void n.metadataTrack.seiSamples.push(new h_(O_.parseSEI(O_.removeEPB(e),a),t));case 32:if(!a)break;if(!i.vps.length){var s=P_.parseVPS(O_.removeEPB(e),i.hvcC);i.hvcC=i.hvcC||s,i.vps=[e]}break;case 7:case 33:if(!a&&7!==r||a&&7===r)break;if(!i.sps.length){var u=O_.removeEPB(e),c=a?P_.parseSPS(u,i.hvcC):C_.parseSPS(u);i.sps=[e],i.hvcC=i.hvcC||c.hvcC,i.codec=c.codec,i.width=c.width,i.height=c.height,i.sarRatio=c.sarRatio,i.fpsNum=c.fpsNum,i.fpsDen=c.fpsDen}break;case 8:case 34:if(!a&&8!==r||a&&8===r)break;i.pps.length||(i.pps=[e]);break;case 9:case 35:break;case 38:if(a){for(var l=!1,f=2;f<e.byteLength;f++)if(255===e[f]){l=!0;break}if(!l)return}}o.units.push(e)})),o.gopId=this._gopId,this._pushVideoSample(i,o)}}},{key:"_pushVideoSample",value:function(e,t){if(t.units.length)if(null===t.pts||void 0===t.pts){z_.warn("Video sample no pts",t);var r=e.samples[e.samples.length-1];r?(t.pts=r.pts,t.dts=r.dts):z_.warn("Drop video sample",t)}else e.samples.push(t)}},{key:"_parseAudioData",value:function(){if(this._audioPesData.length){var t=e._parsePES(S_.apply(void 0,Vg(this._audioPesData)));if(t){switch(this.audioTrack.codecType){case $g:this._parseAacData(t);break;case t_:this._parseMPEG(t)}this._audioPesData=[]}else z_.warn("Cannot parse audio pes",this._audioPesData)}}},{key:"_parseAacData",value:function(e){var t=this.audioTrack,r=e.pts;if(null==r){if(z_.warn("AAC pes not pts",t),!t.samples.length||!t.sampleRate)return;r=t.samples[t.samples.length-1].pts+b_.getFrameDuration(t.sampleRate)}var n,i=b_.parseADTS(e.data,r);i?(t.codec=i.codec,t.channelCount=i.channelCount,t.sampleRate=i.sampleRate,t.objectType=i.objectType,t.sampleRateIndex=i.samplingFrequencyIndex,t.config=i.config,(n=t.samples).push.apply(n,Vg(i.frames.map((function(e){return new f_(e.pts,e.data)})))),i.skip&&z_.warn("Skip aac adts ".concat(i.skip," bits")),i.remaining&&z_.warn("Remaining aac adts ".concat(i.remaining," bits"))):z_.warn("Cannot parse aac adts",e)}},{key:"_parseMPEG",value:function(e){var t=e.data,r=t.length,n=0,i=0,a=e.pts;if(void 0!==a)for(;i<r;)if(G_.isHeader(t,i)){var o=G_.appendFrame(this.audioTrack,t,i,a,n);if(!o)break;i+=o.length,n++}else i++;else z_.warn("[tsdemuxer]: MPEG PES unknown PTS")}}],[{key:"probe",value:function(e){return!!e.length&&(71===e[0]&&71===e[188]&&71===e[376])}},{key:"_parsePES",value:function(e){var t=e[8];if(!(null==t||e.length<t+9)&&1===(e[0]<<16|e[1]<<8|e[2])){var r=(e[4]<<8)+e[5];if(!(r&&r>e.length-6)){var n,i,a=e[7];return 192&a&&(n=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&a?n-(i=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2)>54e5&&(n=i):i=n),{data:e.subarray(9+t),pts:n,dts:i}}}}}]),e}(),q_=function(){function e(t,r,n){Pg(this,e),this.dv=new DataView(t),this.start=this.offset=r||this.dv.byteOffset,this.end=n?this.start+n:this.start+this.dv.byteLength}return Ig(e,[{key:"buffer",get:function(){return this.dv.buffer}},{key:"unreadLength",get:function(){return Math.max(this.end-this.offset,0)}},{key:"size",get:function(){return this.end-this.start}},{key:"readFloat",value:function(e){var t=0;switch(e){case 4:t=this.dv.getFloat32(this.offset);break;case 8:t=this.dv.getFloat64(this.offset);break;default:throw new Error("read ".concat(e,"-byte float is not supported"))}return this.offset+=e,t}},{key:"back",value:function(e){this.offset-=e}},{key:"skip",value:function(e){this.offset+=e}},{key:"readInt",value:function(e){var t=this.offset;switch(this.offset+=e,e){case 1:return this.dv.getInt8(t);case 2:return this.dv.getInt16(t);case 4:return this.dv.getInt32(t);default:throw new Error("read ".concat(e,"-byte integers is not supported"))}}},{key:"read",value:function(e){var t=this.offset;switch(this.offset+=e,e){case 1:return this.dv.getUint8(t);case 2:return this.dv.getUint16(t);case 3:return(this.dv.getUint16(t)<<8)+this.dv.getUint8(t+2);case 4:return this.dv.getUint32(t);default:return this.back(e-4),this.read(e-4)+this.dv.getUint32(t)*Math.pow(256,e-4)}}},{key:"write",value:function(e,t){var r=this.offset;switch(this.offset+=e,e){case 1:return this.dv.setUint8(r,t);case 2:return this.dv.setUint16(r,t);case 3:return this.dv.setUint8(r,t>>>16),this.dv.setUint16(r+1,65535&t);case 4:return this.dv.setUint32(r,t);default:throw new Error("write ".concat(e,"-byte integers is not supported"))}}},{key:"readToBuffer",value:function(e){var t;return t=this.offset||e?this.dv.buffer.slice(this.offset,e?this.offset+e:this.end):this.dv.buffer,this.offset+=t.byteLength,t}},{key:"readToUint8",value:function(e){var t=new Uint8Array(this.dv.buffer,this.offset,e||this.unreadLength);return this.offset+=t.byteLength,t}},{key:"readString",value:function(e){for(var t=0,r="";t<e;t++)r+=String.fromCharCode(this.dv.getUint8(this.offset)),this.offset++;return r}}],[{key:"fromUint8",value:function(t){return new e(t.buffer,t.byteOffset,t.byteLength)}},{key:"concatUint8s",value:function(e){var t=new Uint8Array(e.reduce((function(e,t){return e+t.byteLength}),0)),r=0;return e.forEach((function(e){t.set(e,r),r+=e.byteLength})),t}},{key:"concatUint8",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.concatUint8s(t)}}]),e}(),Y_=function(){function e(t,r){Pg(this,e),this.offset=0,this.val=t,this.size=r}return Ig(e,[{key:"skip",value:function(e){this.offset+=e}},{key:"read",value:function(e){var t=this.size-this.offset-e;if(t>=0){var r=0,n=0;if(this.offset+=e,this.size>31){for(;n<e;n++)r+=Math.pow(2,n);return this.val/Math.pow(2,t)&r}for(;n<e;n++)r+=1<<n;return this.val>>>t&r}throw new Error("the number of the read operation exceeds the total length limit of bits")}}],[{key:"fromByte",value:function(t,r){return new e(t.read(r),r<<3)}}]),e}(),K_=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"findBox",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[];if(!t)return i;for(var a=0,o="",s=0;t.length>7;){if(a=w_(t),o=String.fromCharCode.apply(null,t.subarray(4,8)),s=8,1===a?(a=x_(t,8),s+=8):a||(a=t.length),!r[0]||o===r[0]){var u=t.subarray(0,a);if(!(r.length<2))return e.findBox(u.subarray(s),r.slice(1),n+s);i.push({start:n,size:a,headerSize:s,type:o,data:u})}n+=a,t=t.subarray(a)}return i}},{key:"tfhd",value:function(e){return $_(e,!0,(function(e,t){e.trackId=w_(t);var r=4,n=1&e.flags,i=2&e.flags,a=8&e.flags,o=16&e.flags,s=32&e.flags;n&&(r+=4,e.baseDataOffset=w_(t,r),r+=4),i&&(e.sampleDescriptionIndex=w_(t,r),r+=4),a&&(e.defaultSampleDuration=w_(t,r),r+=4),o&&(e.defaultSampleSize=w_(t,r),r+=4),s&&(e.defaultSampleFlags=w_(t,r))}))}},{key:"sidx",value:function(e){return $_(e,!0,(function(e,t){var r=0;e.reference_ID=w_(t,r),r+=4,e.timescale=w_(t,r),r+=4,0===e.version?(e.earliest_presentation_time=w_(t,r),r+=4,e.first_offset=w_(t,r),r+=4):(e.earliest_presentation_time=x_(t,r),r+=8,e.first_offset=x_(t,r),r+=8),r+=2,e.references=[];var n=E_(t,r);r+=2;for(var i=0;i<n;i++){var a={};e.references.push(a);var o=w_(t,r);r+=4,a.reference_type=o>>31&1,a.referenced_size=2147483647&o,a.subsegment_duration=w_(t,r),o=w_(t,r+=4),r+=4,a.starts_with_SAP=o>>31&1,a.SAP_type=o>>28&7,a.SAP_delta_time=268435455&o}}))}},{key:"moov",value:function(t){return $_(t,!1,(function(t,r,n){t.mvhd=e.mvhd(e.findBox(r,["mvhd"],n)[0]),t.trak=e.findBox(r,["trak"],n).map((function(t){return e.trak(t)})),t.pssh=e.pssh(e.findBox(r,["pssh"],n)[0])}))}},{key:"mvhd",value:function(e){return $_(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=w_(t,16),e.duration=x_(t,20),r+=28):(e.timescale=w_(t,8),e.duration=w_(t,12),r+=16),e.nextTrackId=w_(t,r+76)}))}},{key:"trak",value:function(t){return $_(t,!1,(function(t,r,n){t.tkhd=e.tkhd(e.findBox(r,["tkhd"],n)[0]),t.mdia=e.mdia(e.findBox(r,["mdia"],n)[0])}))}},{key:"tkhd",value:function(e){return $_(e,!0,(function(e,t){var r=q_.fromUint8(t);1===e.version?(r.read(8),r.read(8),e.trackId=r.read(4),r.read(4),e.duration=r.read(8)):(r.read(4),r.read(4),e.trackId=r.read(4),r.read(4),e.duration=r.read(4)),r.skip(16),e.matrix=[];for(var n=0;n<36;n++)e.matrix.push(r.read(1));r.back(36);for(var i,a=[],o=0;o<3;o++)a.push(D_(r.readInt(2),r.readInt(2))),a.push(D_(r.readInt(2),r.readInt(2))),i=r.readInt(4),a.push(D_(i>>30,1073741823&i));e.rotation=function(e){if(e.length<5)return 0;var t=Math.hypot(e[0],e[3]),r=Math.hypot(e[1],e[4]);return 0===t||0===r?0:180*Math.atan2(e[1]/r,e[0]/t)/Math.PI}(a),e.width=r.read(4),e.height=r.read(4)}))}},{key:"mdia",value:function(t){return $_(t,!1,(function(t,r,n){t.mdhd=e.mdhd(e.findBox(r,["mdhd"],n)[0]),t.hdlr=e.hdlr(e.findBox(r,["hdlr"],n)[0]),t.minf=e.minf(e.findBox(r,["minf"],n)[0])}))}},{key:"mdhd",value:function(e){return $_(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=w_(t,16),e.duration=x_(t,20),r+=28):(e.timescale=w_(t,8),e.duration=w_(t,12),r+=16);var n=E_(t,r);e.language=String.fromCharCode(96+(n>>10&31),96+(n>>5&31),96+(31&n))}))}},{key:"hdlr",value:function(e){return $_(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return $_(t,!1,(function(t,r,n){t.vmhd=e.vmhd(e.findBox(r,["vmhd"],n)[0]),t.smhd=e.smhd(e.findBox(r,["smhd"],n)[0]),t.stbl=e.stbl(e.findBox(r,["stbl"],n)[0])}))}},{key:"vmhd",value:function(e){return $_(e,!0,(function(e,t){e.graphicsmode=E_(t),e.opcolor=[E_(t,2),E_(t,4),E_(t,6)]}))}},{key:"smhd",value:function(e){return $_(e,!0,(function(e,t){e.balance=E_(t)}))}},{key:"stbl",value:function(t){return $_(t,!1,(function(t,r,n){var i,a,o;t.stsd=e.stsd(e.findBox(r,["stsd"],n)[0]),t.stts=e.stts(e.findBox(r,["stts"],n)[0]),t.ctts=e.ctts(e.findBox(r,["ctts"],n)[0]),t.stsc=e.stsc(e.findBox(r,["stsc"],n)[0]),t.stsz=e.stsz(e.findBox(r,["stsz"],n)[0]),t.stco=e.stco(e.findBox(r,["stco"],n)[0]),t.stco||(t.co64=e.co64(e.findBox(r,["co64"],n)[0]),t.stco=t.co64);var s=null===(i=t.stsd.entries[0])||void 0===i||null===(a=i.sinf)||void 0===a||null===(o=a.schi)||void 0===o?void 0:o.tenc.default_IV_size;t.stss=e.stss(e.findBox(r,["stss"],n)[0]),t.senc=e.senc(e.findBox(r,["senc"],n)[0],s)}))}},{key:"senc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return $_(e,!0,(function(e,r){var n=0,i=w_(r,n);n+=4,e.samples=[];for(var a=0;a<i;a++){for(var o={InitializationVector:[]},s=0;s<t;s++)o.InitializationVector[s]=r[n+s];if(n+=t,2&e.flags){o.subsamples=[];var u=E_(r,n);n+=2;for(var c=0;c<u;c++){var l={};l.BytesOfClearData=E_(r,n),n+=2,l.BytesOfProtectedData=w_(r,n),n+=4,o.subsamples.push(l)}}e.samples.push(o)}}))}},{key:"pssh",value:function(e){return $_(e,!0,(function(e,t){for(var r=[],n=[],i=0,a=0;a<16;a++)n.push(J_(t[i+a]));if(i+=16,e.version>0){var o=w_(t,i);i+=4;for(var s=0;s<(""+o).length;s++)for(var u=0;u<16;u++){var c=t[i];i+=1,r.push(J_(c))}}var l=w_(t,i);e.data_size=l,i+=4,e.kid=r,e.system_id=n,e.buffer=t}))}},{key:"stsd",value:function(t){return $_(t,!0,(function(t,r,n){t.entryCount=w_(r),t.entries=e.findBox(r.subarray(4),[],n+4).map((function(t){switch(t.type){case"av01":return e.av01(t);case"avc1":case"avc2":case"avc3":case"avc4":return e.avc1(t);case"hvc1":case"hev1":return e.hvc1(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return $_(t,!1,(function(t,r,n){t.channelCount=E_(r,16),t.samplesize=E_(r,18),t.sampleRate=w_(r,24)/65536,r=r.subarray(28),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.esds=e.esds(e.findBox(r,["esds"],n)[0])}));case"encv":return $_(t,!1,(function(t,r,n){t.width=E_(r,24),t.height=E_(r,26),t.horizresolution=w_(r,28),t.vertresolution=w_(r,32),r=r.subarray(78),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.avcC=e.avcC(e.findBox(r,["avcC"],n)[0]),t.hvcC=e.hvcC(e.findBox(r,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(r,["pasp"],n)[0])}))}})).filter(Boolean)}))}},{key:"tenc",value:function(e){return $_(e,!1,(function(e,t){var r=6;e.default_IsEncrypted=t[r],r+=1,e.default_IV_size=t[r],r+=1,e.default_KID=[];for(var n=0;n<16;n++)e.default_KID.push(J_(t[r])),r+=1}))}},{key:"schi",value:function(t){return $_(t,!1,(function(t,r,n){t.tenc=e.tenc(e.findBox(r,["tenc"],n)[0])}))}},{key:"sinf",value:function(t){return $_(t,!1,(function(t,r,n){t.schi=e.schi(e.findBox(r,["schi"],n)[0]),t.frma=e.frma(e.findBox(r,["frma"],n)[0])}))}},{key:"frma",value:function(e){return $_(e,!1,(function(e,t){e.data_format="";for(var r=0;r<4;r++)e.data_format+=String.fromCharCode(t[r])}))}},{key:"colr",value:function(e){return $_(e,!1,(function(t,r){var n=q_.fromUint8(r);t.data=e.data,t.colorType=n.readString(4),"nclx"===t.colorType?(t.colorPrimaries=n.read(2),t.transferCharacteristics=n.read(2),t.matrixCoefficients=n.read(2),t.fullRangeFlag=n.read(1)>>7):"rICC"!==t.colorType&&"prof"!==t.colorType||(t.iccProfile=r.readToUint8())}))}},{key:"av01",value:function(t){return $_(t,!1,(function(t,r,n){var i=X_(t,r),a=r.subarray(i);n+=i,t.av1C=e.av1C(e.findBox(a,["av1C"],n)[0]),t.colr=e.colr(e.findBox(a,["colr"],n)[0])}))}},{key:"av1C",value:function(e){return $_(e,!1,(function(t,r){t.data=e.data;var n,i=q_.fromUint8(r),a=Y_.fromByte(i,4);t.marker=a.read(1),t.version=a.read(7),t.seqProfile=a.read(3),t.seqLevelIdx0=a.read(5),t.seqTier0=a.read(1),t.highBitdepth=a.read(1),t.twelveBit=a.read(1),t.monochrome=a.read(1),t.chromaSubsamplingX=a.read(1),t.chromaSubsamplingY=a.read(1),t.chromaSamplePosition=a.read(2),t.reserved=a.read(3),t.initialPresentationDelayPresent=a.read(1),t.initialPresentationDelayPresent?t.initialPresentationDelayMinusOne=a.read(4):t.initialPresentationDelayMinusOne=0,t.configOBUs=i.readToUint8(),2===t.seqLevelIdx0&&1===t.highBitdepth?n=1===t.twelveBit?"12":"10":t.seqProfile<=2&&(n=1===t.highBitdepth?"10":"08"),t.codec=["av01",t.seqProfile,(t.seqLevelIdx0<10?"0"+t.seqLevelIdx0:t.seqLevelIdx0)+(t.seqTier0?"H":"M"),n].join(".")}))}},{key:"avc1",value:function(t){return $_(t,!1,(function(t,r,n){var i=X_(t,r),a=r.subarray(i);n+=i,t.avcC=e.avcC(e.findBox(a,["avcC"],n)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],n)[0])}))}},{key:"avcC",value:function(e){return $_(e,!1,(function(t,r){t.data=e.data,t.configurationVersion=r[0],t.AVCProfileIndication=r[1],t.profileCompatibility=r[2],t.AVCLevelIndication=r[3],t.codec=T_([r[1],r[2],r[3]]),t.lengthSizeMinusOne=3&r[4],t.spsLength=31&r[5],t.sps=[];for(var n=6,i=0;i<t.spsLength;i++){var a=E_(r,n);n+=2,t.sps.push(r.subarray(n,n+a)),n+=a}t.ppsLength=r[n],n+=1,t.pps=[];for(var o=0;o<t.ppsLength;o++){var s=E_(r,n);n+=2,t.pps.push(r.subarray(n,n+=s)),n+=s}}))}},{key:"hvc1",value:function(t){return $_(t,!1,(function(t,r,n){var i=X_(t,r),a=r.subarray(i);n+=i,t.hvcC=e.hvcC(e.findBox(a,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],n)[0])}))}},{key:"hvcC",value:function(e){return $_(e,!1,(function(t,r){t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=r[0];var n=r[1];t.generalProfileSpace=n>>6,t.generalTierFlag=(32&n)>>5,t.generalProfileIdc=31&n,t.generalProfileCompatibility=w_(r,2),t.generalConstraintIndicatorFlags=r.subarray(6,12),t.generalLevelIdc=r[12],t.avgFrameRate=E_(r,19),t.numOfArrays=r[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,a=0,o=0,s=0,u=0;u<t.numOfArrays;u++){a=63&r[i],o=E_(r,i+1),i+=3;for(var c,l=[],f=0;f<o;f++)s=E_(r,i),i+=2,l.push(r.subarray(i,i+s)),i+=s;if(32===a)(c=t.vps).push.apply(c,l);else if(33===a){var h;(h=t.sps).push.apply(h,l)}else if(34===a){var d;(d=t.pps).push.apply(d,l)}}}))}},{key:"pasp",value:function(e){return $_(e,!1,(function(e,t){e.hSpacing=w_(t),e.vSpacing=w_(t,4)}))}},{key:"mp4a",value:function(t){return $_(t,!1,(function(t,r,n){var i=Q_(t,r);t.esds=e.esds(e.findBox(r.subarray(i),["esds"],n+i)[0])}))}},{key:"esds",value:function(e){return $_(e,!0,(function(e,t){e.codec="mp4a.";for(var r=0,n=0,i=0,a=0;t.length;){for(a=t[r=0],n=t[r+1],r+=2;128&n;)i=(127&n)<<7,n=t[r],r+=1;if(i+=127&n,3===a)t=t.subarray(r+3);else{if(4!==a){if(5===a){var o=e.config=t.subarray(r,r+i),s=(248&o[0])>>3;return 31===s&&o.length>=2&&(s=32+((7&o[0])<<3)+((224&o[1])>>5)),e.objectType=s,e.codec+=s.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[r].toString(16)+".").padStart(3,"0"),t=t.subarray(r+13)}}}))}},{key:"alaw",value:function(e){return $_(e,!1,(function(e,t){Q_(e,t)}))}},{key:"stts",value:function(e){return $_(e,!0,(function(e,t){for(var r=w_(t),n=[],i=4,a=0;a<r;a++)n.push({count:w_(t,i),delta:w_(t,i+4)}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"ctts",value:function(e){return $_(e,!0,(function(e,t){var r=w_(t),n=[],i=4;if(1===e.version)for(var a=0;a<r;a++)n.push({count:w_(t,i),offset:w_(t,i+4)}),i+=8;else for(var o=0;o<r;o++)n.push({count:w_(t,i),offset:-(1+~w_(t,i+4))}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stsc",value:function(e){return $_(e,!0,(function(e,t){for(var r=w_(t),n=[],i=4,a=0;a<r;a++)n.push({firstChunk:w_(t,i),samplesPerChunk:w_(t,i+4),sampleDescriptionIndex:w_(t,i+8)}),i+=12;e.entryCount=r,e.entries=n}))}},{key:"stsz",value:function(e){return $_(e,!0,(function(e,t){var r=w_(t),n=w_(t,4),i=[];if(!r)for(var a=8,o=0;o<n;o++)i.push(w_(t,a)),a+=4;e.sampleSize=r,e.sampleCount=n,e.entrySizes=i}))}},{key:"stco",value:function(e){return $_(e,!0,(function(e,t){for(var r=w_(t),n=[],i=4,a=0;a<r;a++)n.push(w_(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"co64",value:function(e){return $_(e,!0,(function(e,t){for(var r=w_(t),n=[],i=4,a=0;a<r;a++)n.push(x_(t,i)),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stss",value:function(e){return $_(e,!0,(function(e,t){for(var r=w_(t),n=[],i=4,a=0;a<r;a++)n.push(w_(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"moof",value:function(t){return $_(t,!1,(function(t,r,n){t.mfhd=e.mfhd(e.findBox(r,["mfhd"],n)[0]),t.traf=e.findBox(r,["traf"],n).map((function(t){return e.traf(t)}))}))}},{key:"mfhd",value:function(e){return $_(e,!0,(function(e,t){e.sequenceNumber=w_(t)}))}},{key:"traf",value:function(t){return $_(t,!1,(function(t,r,n){t.tfhd=e.tfhd(e.findBox(r,["tfhd"],n)[0]),t.tfdt=e.tfdt(e.findBox(r,["tfdt"],n)[0]),t.trun=e.trun(e.findBox(r,["trun"],n)[0])}))}},{key:"trun",value:function(e){return $_(e,!0,(function(e,t){var r=e.version,n=e.flags,i=t.length,a=e.sampleCount=w_(t),o=4;if(i>o&&1&n&&(e.dataOffset=-(1+~w_(t,o)),o+=4),i>o&&4&n&&(e.firstSampleFlags=w_(t,o),o+=4),e.samples=[],i>o)for(var s,u=0;u<a;u++)s={},256&n&&(s.duration=w_(t,o),o+=4),512&n&&(s.size=w_(t,o),o+=4),1024&n&&(s.flags=w_(t,o),o+=4),2048&n&&(s.cts=r?-(1+~w_(t,o+4)):w_(t,o),o+=4),e.samples.push(s)}))}},{key:"tfdt",value:function(e){return $_(e,!0,(function(e,t){1===e.version?e.baseMediaDecodeTime=x_(t):e.baseMediaDecodeTime=w_(t)}))}},{key:"probe",value:function(t){return!!e.findBox(t,["ftyp"])}},{key:"parseSampleFlags",value:function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}},{key:"moovToTrack",value:function(e,t,r){var n,i,a=e.trak;if(a&&a.length){var o=a.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),s=a.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(o&&t){var u,c,l,f,h,d,p,v=t,m=null===(u=o.tkhd)||void 0===u?void 0:u.trackId;null!=m&&(v.id=o.tkhd.trackId),v.tkhdDuration=o.tkhd.duration,v.mvhdDurtion=e.mvhd.duration,v.mvhdTimecale=e.mvhd.timescale,v.timescale=v.formatTimescale=o.mdia.mdhd.timescale,v.duration=o.mdia.mdhd.duration||v.mvhdDurtion/v.mvhdTimecale*v.timescale,v.rotation=o.tkhd.rotation,v.matrix=o.tkhd.matrix;var y,g,_,b,S,k,E,w,x=o.mdia.minf.stbl.stsd.entries[0];if(v.width=x.width,v.height=x.height,x.pasp&&(v.sarRatio=[x.pasp.hSpacing,x.pasp.vSpacing]),x.av1C)v.codecType=Wg,v.codec=x.av1C.codec,v.av1C=x.av1C.data,v.colr=x.colr.data;else if(x.hvcC)v.codecType=Qg,v.codec=x.hvcC.codec,v.vps=x.hvcC.vps,v.sps=x.hvcC.sps,v.pps=x.hvcC.pps,v.hvcC=x.hvcC.data;else{if(!x.avcC)throw new Error("unknown video stsd entry");v.codec=x.avcC.codec,v.sps=x.avcC.sps,v.pps=x.avcC.pps}if(v.present=!0,v.ext={},v.ext.stss=null===(c=o.mdia)||void 0===c||null===(l=c.minf)||void 0===l||null===(f=l.stbl)||void 0===f?void 0:f.stss,v.ext.ctts=null===(h=o.mdia)||void 0===h||null===(d=h.minf)||void 0===d||null===(p=d.stbl)||void 0===p?void 0:p.ctts,x&&"encv"===x.type)v.isVideoEncryption=!0,x.default_KID=null===(y=x.sinf)||void 0===y||null===(g=y.schi)||void 0===g?void 0:g.tenc.default_KID,x.default_IsEncrypted=null===(_=x.sinf)||void 0===_||null===(b=_.schi)||void 0===b?void 0:b.tenc.default_IsEncrypted,x.default_IV_size=null===(S=x.sinf)||void 0===S||null===(k=S.schi)||void 0===k?void 0:k.tenc.default_IV_size,v.videoSenc=o.mdia.minf.stbl.senc&&o.mdia.minf.stbl.senc.samples,x.data_format=null===(E=x.sinf)||void 0===E||null===(w=E.frma)||void 0===w?void 0:w.data_format,v.useEME=e.useEME,v.kidValue=e.kidValue,v.pssh=e.pssh,v.encv=x}if(s&&r){var T,A,D,O,L,C,P,R,I,M=r,B=null===(T=s.tkhd)||void 0===T?void 0:T.trackId;null!=B&&(M.id=s.tkhd.trackId),M.tkhdDuration=s.tkhd.duration,M.mvhdDurtion=e.mvhd.duration,M.mvhdTimecale=e.mvhd.timescale,M.timescale=M.formatTimescale=s.mdia.mdhd.timescale,M.duration=s.mdia.mdhd.duration||M.mvhdDurtion/M.mvhdTimecale*M.timescale;var U,N,F,j,V,G,z,H,q=s.mdia.minf.stbl.stsd.entries[0];switch(M.sampleSize=q.sampleSize,M.sampleRate=q.sampleRate,M.channelCount=q.channelCount,M.present=!0,q.type){case"alaw":M.codecType=M.codec=Jg,M.sampleRate=8e3;break;case"ulaw":M.codecType=M.codec=Zg,M.sampleRate=8e3;break;default:M.sampleDuration=b_.getFrameDuration(M.sampleRate,M.timescale),M.sampleRateIndex=b_.getRateIndexByRate(M.sampleRate),M.objectType=(null===(n=q.esds)||void 0===n?void 0:n.objectType)||2,q.esds&&(M.config=Array.from(q.esds.config)),M.codec=(null===(i=q.esds)||void 0===i?void 0:i.codec)||"mp4a.40.2"}if(M.sampleDuration=b_.getFrameDuration(M.sampleRate,M.timescale),M.objectType=(null===(A=q.esds)||void 0===A?void 0:A.objectType)||2,q.esds&&(q.esds.config?M.config=Array.from(q.esds.config):console.warn("esds config is null")),M.codec=(null===(D=q.esds)||void 0===D?void 0:D.codec)||"mp4a.40.2",M.sampleRateIndex=b_.getRateIndexByRate(M.sampleRate),M.ext={},M.ext.stss=null===(O=s.mdia)||void 0===O||null===(L=O.minf)||void 0===L||null===(C=L.stbl)||void 0===C?void 0:C.stss,M.ext.ctts=null===(P=s.mdia)||void 0===P||null===(R=P.minf)||void 0===R||null===(I=R.stbl)||void 0===I?void 0:I.ctts,M.present=!0,q&&"enca"===q.type)M.isAudioEncryption=!0,q.data_format=null===(U=q.sinf)||void 0===U||null===(N=U.frma)||void 0===N?void 0:N.data_format,q.default_KID=null===(F=q.sinf)||void 0===F||null===(j=F.schi)||void 0===j?void 0:j.tenc.default_KID,q.default_IsEncrypted=null===(V=q.sinf)||void 0===V||null===(G=V.schi)||void 0===G?void 0:G.tenc.default_IsEncrypted,q.default_IV_size=null===(z=q.sinf)||void 0===z||null===(H=z.schi)||void 0===H?void 0:H.tenc.default_IV_size,M.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,M.useEME=e.useEME,M.kidValue=e.kidValue,M.enca=q}if(r&&(r.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!r&&r.isAudioEncryption),null!=t&&t.encv||null!=r&&r.enca){var Y,K,W=null==t||null===(Y=t.encv)||void 0===Y?void 0:Y.default_KID,X=null==r||null===(K=r.enca)||void 0===K?void 0:K.default_KID,Q=W||X?(W||X).join(""):null;t&&(t.kid=Q),r&&(r.kid=Q)}return t&&(t.flags=3841),r&&(r.flags=1793),{videoTrack:t,audioTrack:r}}}},{key:"evaluateDefaultDuration",value:function(e,t,r){var n,i=null==t||null===(n=t.samples)||void 0===n?void 0:n.length;return i?1024*i/t.timescale*e.timescale/r:1024}},{key:"moofToSamples",value:function(t,r,n){var i={};return t.mfhd&&(r&&(r.sequenceNumber=t.mfhd.sequenceNumber),n&&(n.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach((function(t){var a=t.tfhd,o=t.tfdt,s=t.trun;if(a&&s){o&&(r&&r.id===a.trackId&&(r.baseMediaDecodeTime=o.baseMediaDecodeTime),n&&n.id===a.trackId&&(n.baseMediaDecodeTime=o.baseMediaDecodeTime));var u=a.defaultSampleSize||0,c=a.defaultSampleDuration||e.evaluateDefaultDuration(r,n,s.samples.length||s.sampleCount),l=s.dataOffset||0,f=0,h=-1;if(!s.samples.length&&s.sampleCount){i[a.trackId]=[];for(var d=0;d<s.sampleCount;d++)i[a.trackId].push({offset:l,dts:f,duration:c,size:u}),f+=c,l+=u}else i[a.trackId]=s.samples.map((function(e,t){return(e={offset:l,dts:f,pts:f+(e.cts||0),duration:e.duration||c,size:e.size||u,gopId:h,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(h++,e.gopId=h),f+=e.duration,l+=e.size,e}))}})),i}},{key:"moovToSamples",value:function(e){var t=e.trak;if(t&&t.length){var r=t.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),n=t.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(r||n){var i,a;if(r){var o,s,u=null===(o=r.mdia)||void 0===o||null===(s=o.minf)||void 0===s?void 0:s.stbl;if(!u)return;var c=u.stts,l=u.stsc,f=u.stsz,h=u.stco,d=u.stss,p=u.ctts;if(!(c&&l&&f&&h&&d))return;i=W_(c,l,f,h,p,d)}if(n){var v,m,y,g=null===(v=n.mdia)||void 0===v||null===(m=v.minf)||void 0===m?void 0:m.stbl;if(!g)return;var _=null===(y=n.mdia.mdhd)||void 0===y?void 0:y.timescale,b=g.stts,S=g.stsc,k=g.stsz,E=g.stco;if(!(_&&b&&S&&k&&E))return;a=W_(b,S,k,E)}return{videoSamples:i,audioSamples:a}}}}}]),e}();function W_(e,t,r,n,i,a){var o,s,u,c=[],l=null==i?void 0:i.entries,f=t.entries,h=n.entries,d=r.entrySizes,p=null==a?void 0:a.entries;p&&(o={},p.forEach((function(e){o[e-1]=!0}))),l&&(s=[],l.forEach((function(e){for(var t=e.count,r=e.offset,n=0;n<t;n++)s.push(r)})));var v=-1,m=0,y=0,g=0,_=0,b=0,S=f[0].samplesPerChunk,k=f[1]?f[1].firstChunk-1:1/0;return e.entries.forEach((function(e){for(var t=e.count,n=e.delta,i=0;i<t;i++)u={dts:m,duration:n,size:d[y]||r.sampleSize,offset:h[g]+b,index:y},p&&(u.keyframe=o[y],u.keyframe&&v++,u.gopId=v),s&&y<s.length&&(u.pts=u.dts+s[y]),c.push(u),m+=n,++y<S?b+=u.size:(g++,b=0,g>=k&&(_++,k=f[_+1]?f[_+1].firstChunk-1:1/0),S+=f[_].samplesPerChunk)})),c}function X_(e,t){return e.dataReferenceIndex=E_(t,6),e.width=E_(t,24),e.height=E_(t,26),e.horizresolution=w_(t,28),e.vertresolution=w_(t,32),e.frameCount=E_(t,40),e.depth=E_(t,74),78}function Q_(e,t){return e.dataReferenceIndex=E_(t,6),e.channelCount=E_(t,16),e.sampleSize=E_(t,18),e.sampleRate=w_(t,24)/65536,28}function $_(e,t,r){if(e){if(e.size!==e.data.length)throw new Error("box ".concat(e.type," size !== data.length"));var n={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(n.version=e.data[e.headerSize],n.flags=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),n.headerSize+=4),r(n,e.data.subarray(n.headerSize),n.start+n.headerSize),n}}var J_=function(){for(var e=[],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.forEach((function(t){e.push(function(e,t,r){for(var n=String(r),i=t>>0,a=Math.ceil(i/n.length),o=[],s=String(e);a--;)o.push(n);return o.join("").substring(0,i-s.length)+s}(Number(t).toString(16),2,0))})),e[0]},Z_=function(){function e(t,r,n){Pg(this,e),Mg(this,"__loadedMoofWraps",[]),Mg(this,"__lastRemainData",null),Mg(this,"__lastRemainDataStart",0),Mg(this,"__nextMoofStart",-1),this.videoTrack=t||new u_,this.audioTrack=r||new c_,this.metadataTrack=n||new d_}return Ig(e,[{key:"demuxPart",value:function(e,t,r){var n=this,i=this.videoTrack,a=this.audioTrack,o=i.exist(),s=a.exist(),u=/av01/.test(i.codec);i.samples=[],a.samples=[];var c=e,l=t;if(this.__lastRemainData){var f=this.__lastRemainDataStart+this.__lastRemainData.byteLength;if(t<=f&&t>this.__lastRemainDataStart&&t+e.byteLength>f){var h=e.subarray(this.__lastRemainData.byteLength+this.__lastRemainDataStart-t);c=S_(this.__lastRemainData,h),l=this.__lastRemainDataStart,this.__lastRemainData=null}else this.__lastRemainData=null,this.__lastRemainDataStart=0,this.__nextMoofStart=-1}if(!r){var d=K_.findBox(c,["moov"])[0];if(!d)throw new Error("cannot found moov box");r=K_.moov(d)}if(c){var p=l+c.byteLength;o||s||K_.moovToTrack(r,i,a);var v=[];this.__nextMoofStart<0?K_.findBox(c,["moof"],l).forEach((function(e){return v.push(e)})):this.__nextMoofStart>=l&&this.__nextMoofStart<=p-8&&K_.findBox(c.subarray(this.__nextMoofStart-l),["moof"],this.__nextMoofStart).forEach((function(e){return v.push(e)})),v.filter((function(e){return e.size<=e.data.length})).forEach((function(e){var t=K_.moof(e);n.__nextMoofStart=t.start+Math.max.apply(Math,Vg(t.traf.map((function(e){return e.trun.samples.reduce((function(e,t){return e+t.size}),e.trun.dataOffset||0)})))),n.__loadedMoofWraps.push({start:t.start,nextMoofStart:n.__nextMoofStart,moof:t}),n.__loadedMoofWraps.sort((function(e,t){return e.start-t.start}))}));var m,y=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Gg(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}(this.__loadedMoofWraps);try{var g=function(){var e=m.value;if(e.start>p||e.nextMoofStart<l)return"continue";var t,r=e.start,o=K_.moofToSamples(e.moof,i,a),s=i.baseMediaDecodeTime,f=a.baseMediaDecodeTime;Object.keys(o).forEach((function(e){i.id==e?o[e].some((function(e){var a=e.offset+=r;if(!(a<l)){if(a+e.size>p)return!0;var o=new l_((e.pts||e.dts)+s,e.dts+s);o.duration=e.duration,o.gopId=e.gopId,e.keyframe&&o.setToKeyframe();var f=c.subarray(a-l,a-l+e.size);if(o.data=f,!u)for(var h=0,d=f.length-1;h<d;)t=w_(f,h),h+=4,o.units.push(f.subarray(h,h+t)),h+=t;n.__lastRemainDataStart=a+e.size,i.samples.push(o)}})):a.id==e&&o[e].some((function(e){var t=e.offset+r;if(!(t<l)){if(t+e.size>p)return!0;var i=c.subarray(t-l,t-l+e.size);a.samples.push(new f_(e.dts+f,i,e.duration)),n.__lastRemainDataStart=t+e.size}}))}))};for(y.s();!(m=y.n()).done;)g()}catch(_){y.e(_)}finally{y.f()}}return this.__lastRemainDataStart>l&&this.__lastRemainDataStart<c.byteLength+l?this.__lastRemainData=c.subarray(this.__lastRemainDataStart-l):(this.__lastRemainData=c,this.__lastRemainDataStart=l),i.samples.length&&(i.baseMediaDecodeTime=i.samples[0].pts),a.samples.length&&(a.baseMediaDecodeTime=a.samples[0].pts),{videoTrack:i,audioTrack:a,metadataTrack:this.metadataTrack}}},{key:"demux",value:function(e,t){var r=this.videoTrack,n=this.audioTrack,i=r.exist(),a=n.exist();if(r.samples=[],n.samples=[],t){if(!a){var o=K_.findBox(t,["moov"])[0];if(!o)throw new Error("cannot found moov box");K_.moovToTrack(K_.moov(o),null,n)}var s=K_.findBox(t,["moof"])[0];if(s){var u=K_.moofToSamples(K_.moof(s),null,n)[n.id],c=n.baseMediaDecodeTime;if(u){var l=s.start;u.map((function(e){e.offset+=l;var r=t.subarray(e.offset,e.offset+e.size);n.samples.push(new f_(e.dts+c,r,e.duration))}))}}}if(e){if(!i&&!a){var f=K_.findBox(e,["moov"])[0];if(!f)throw new Error("cannot found moov box");K_.moovToTrack(K_.moov(f),r,n)}var h=K_.findBox(e,["moof"])[0];if(h){var d,p=K_.moofToSamples(K_.moof(h),r,n),v=r.baseMediaDecodeTime,m=n.baseMediaDecodeTime,y=h.start;Object.keys(p).forEach((function(t){r.id==t?p[t].map((function(t){t.offset+=y;var n=new l_((t.pts||t.dts)+v,t.dts+v);n.duration=t.duration,n.gopId=t.gopId,t.keyframe&&n.setToKeyframe();var i=e.subarray(t.offset,t.offset+t.size);n.data=i;for(var a=0,o=i.length-1;a<o;)d=w_(i,a),a+=4,n.units.push(i.subarray(a,a+d)),a+=d;r.samples.push(n)})):n.id==t&&p[t].map((function(t){t.offset+=y;var r=e.subarray(t.offset,t.offset+t.size);n.samples.push(new f_(t.dts+m,r,t.duration))}))}))}}return{videoTrack:r,audioTrack:n,metadataTrack:this.metadataTrack}}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset(),this.metadataTrack.reset()}}],[{key:"probe",value:function(e){return K_.probe(e)}}]),e}();var eb=function(){function e(){Pg(this,e),this.buffer=new Uint8Array(0)}return Ig(e,[{key:"write",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach((function(t){t?e.buffer=function(e){for(var t=0,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];n.forEach((function(e){t+=e.length}));var a=new e(t),o=0;return n.forEach((function(e){a.set(e,o),o+=e.length})),a}(Uint8Array,e.buffer,t):window.console.warn(t)}))}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]),e}(),tb=Math.pow(2,32)-1,rb=function(){function e(){Pg(this,e)}return Ig(e,null,[{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=8+(r=r.filter(Boolean)).reduce((function(e,t){return e+t.byteLength}),0),a=new Uint8Array(i);a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=255&i,a.set(e,4);var o=8;return r.forEach((function(e){a.set(e,o),o+=e.byteLength})),a}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===qg&&e.codecType===Qg}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return S_(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var r=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],A_(t.kid),[0,0,0,0]));return e.box(e.types.pssh,r)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var r=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(Vg(t.map((function(t){return e.trak(t)}))),[r]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(Vg(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,t>>24&255,t>>16&255,t>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,i>>8&255,255&i,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===qg?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){var r=[];return t&&t.ext&&t.ext.stss&&r.push(e.stss(t.ext.stss.entries)),e.box(e.types.stbl,e.stsd(t),e.STTS,r[0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var r;return r="audio"===t.type?t.useEME&&t.enca?e.enca(t):t.codecType===e_?e.opus(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):t.av1C?e.av01(t):e.avc1hev1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),r)}},{key:"enca",value:function(t){var r=t.enca.channelCount,n=t.enca.sampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,n>>8&255,255&n,0,0]),a=e.esds(t.config),o=e.sinf(t.enca);return e.box(e.types.enca,i,a,o)}},{key:"encv",value:function(t){var r,n,i=t.sps.length>0?t.sps[0]:[],a=t.pps.length>0?t.pps[0]:[],o=t.width,s=t.height,u=t.sarRatio[0],c=t.sarRatio[1],l=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,s>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),f=new Uint8Array((r=(n=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,255&i.length]).concat.apply(n,Vg(i)).concat([1,a.length>>>8&255,255&a.length])).concat.apply(r,Vg(a))),h=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),d=e.sinf(t.encv),p=new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c]);return e.box(e.types.encv,l,e.box(e.types.avcC,f),e.box(e.types.btrt,h),d,e.box(e.types.pasp,p))}},{key:"schi",value:function(t){var r=new Uint8Array([]),n=e.tenc(t);return e.box(e.types.schi,r,n)}},{key:"tenc",value:function(t){var r=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(A_(t.default_KID)));return e.box(e.types.tenc,r)}},{key:"sinf",value:function(t){var r=new Uint8Array([]),n=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),a=e.schi(t);return e.box(e.types.sinf,r,e.box(e.types.frma,n),e.box(e.types.schm,i),a)}},{key:"av01",value:function(t){return e.box(e.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,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t.av1C,t.colr)}},{key:"avc1hev1",value:function(t){var r=t.codecType===Qg,n=r?e.types.hvc1:e.types.avc1,i=r?e.hvcC(t):e.avcC(t),a=[new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),i];return r?a.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&a.push(e.pasp(t.sarRatio)),e.box.apply(e,[n].concat(a))}},{key:"avcC",value:function(t){var r,n,i,a=[],o=[];return t.sps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,Vg(e))})),t.pps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,Vg(e))})),e.box(e.types.avcC,new Uint8Array((r=(n=[1,a[3],a[4],a[5],255,224|t.sps.length]).concat.apply(n,a).concat([t.pps.length])).concat.apply(r,o)))}},{key:"hvcC",value:function(t){var r=t.hvcC;if(r instanceof ArrayBuffer||r instanceof Uint8Array)return r;var n,i=t.vps,a=t.sps,o=t.pps;if(r){var s=r.generalProfileCompatibilityFlags,u=r.generalConstraintIndicatorFlags,c=(i.length&&1)+(a.length&&1)+(o.length&&1);n=[1,r.generalProfileSpace<<6|r.generalTierFlag<<5|r.generalProfileIdc,s>>>24,s>>>16,s>>>8,s,u[0],u[1],u[2],u[3],u[4],u[5],r.generalLevelIdc,240,0,252,252|r.chromaFormatIdc,248|r.bitDepthLumaMinus8,248|r.bitDepthChromaMinus8,0,0,r.numTemporalLayers<<3|r.temporalIdNested<<2|3,c];var l=function(e){var t;n.push(e.length>>8,e.length),(t=n).push.apply(t,Vg(e))};i.length&&(n.push(160,0,i.length),i.forEach(l)),a.length&&(n.push(161,0,a.length),a.forEach(l)),o.length&&(n.push(162,0,o.length),o.forEach(l))}else n=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(n))}},{key:"pasp",value:function(t){var r=jg(t,2),n=r[0],i=r[1];return e.box(e.types.pasp,new Uint8Array([n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var r=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+r,0,0,0,4,15+r,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([r]).concat(t).concat([6,1,2])))}},{key:"opus",value:function(t){var r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),n=t.config.length?e.dOps(t):[];return e.box(e.types.Opus,r,n)}},{key:"dOps",value:function(t){if(t.config)return t.config[4]=t.sampleRate>>>24&255,t.config[5]=t.sampleRate>>>16&255,t.config[6]=t.sampleRate>>>8&255,t.config[7]=255&t.sampleRate,e.box(e.types.dOps,t.config)}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(Vg(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(Vg(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var r=e.tfhd(t.id),n=e.tfdt(t,t.baseMediaDecodeTime),i=0;if(t.isVideo&&t.videoSenc&&t.videoSenc.forEach((function(e){i+=8,e.subsamples&&e.subsamples.length&&(i+=2,i+=6*e.subsamples.length)})),t.videoSencLength=i,t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(t.isVideo){var a=e.saiz(t),o=e.saio(t),s=e.trun1(t),u=e.senc(t);return e.box(e.types.traf,r,n,a,o,s,u)}if(t.isAudioEncryption){var c=e.sbgp(),l=e.saiz(t),f=e.saio(t),h=e.senc(t),d=e.trun1(t);return e.box(e.types.traf,r,n,c,l,f,h,d)}var p=e.sbgp(),v=e.trun1(t);return e.box(e.types.traf,r,n,p,v)}if(t.isVideo){var m=e.trun1(t);return e.box(e.types.traf,r,n,m)}var y=e.sbgp(),g=e.saiz(t),_=e.saio(t),b=e.senc(t),S=e.trun1(t);return e.box(e.types.traf,r,n,y,g,_,b,S)}var k=e.sdtp(t);return e.box(e.types.traf,r,n,k,e.trun(t.samples,k.byteLength+76))}},{key:"sdtp",value:function(t){var r=new eb;return t.samples.forEach((function(e){r.write(new Uint8Array(t.isVideo?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),r.buffer)}},{key:"trun1",value:function(t){var r=new eb,n=eb.writeUint32(t.samples.length),i=null;if(t.isVideo){var a=t.videoSencLength;i=eb.writeUint32(16*t.samples.length+a+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=eb.writeUint32(16*t.samples.length+92))}else{var o=12*t.samples.length+124;t.isAudioEncryption&&(o=12*t.samples.length+8*t.audioSenc.length+177),i=eb.writeUint32(o)}return t.samples.forEach((function(e){r.write(eb.writeUint32(e.duration)),r.write(eb.writeUint32(e.size)),r.write(eb.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&r.write(eb.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),n,i,r.buffer)}},{key:"senc",value:function(t){var r=new eb,n=t.samples.length,i=t.isVideo?16:8,a=t.isVideo?2:0,o=[],s=0;return t.isVideo?(o=t.videoSenc,s=t.videoSencLength):o=t.audioSenc,s=s||i*n,r.write(eb.writeUint32(16+s),e.types.senc,this.extension(0,a)),r.write(eb.writeUint32(n)),o.forEach((function(e){for(var t=0;t<e.InitializationVector.length;t++)r.write(new Uint8Array([e.InitializationVector[t]]));e.subsamples&&e.subsamples.length&&(r.write(eb.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){r.write(eb.writeUint16(e.BytesOfClearData)),r.write(eb.writeUint32(e.BytesOfProtectedData))})))})),r.buffer}},{key:"saio",value:function(t){var r=12*t.samples.length+141;!t.isVideo&&t.isAudioEncryption&&(r=149);var n=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saio,n)}},{key:"saiz",value:function(t){var r=t.samples.length,n=new Uint8Array([0,0,0,0,16,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saiz,n)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t,r){var n=Math.floor(r/(tb+1)),i=Math.floor(r%(tb+1));return t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)?e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])):e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"trun",value:function(t,r){var n=t.length,i=12+16*n;r+=8+i;var a=new Uint8Array(i);a.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0);for(var o=0;o<n;o++){var s=t[o],u=s.duration,c=s.size,l=s.flag,f=void 0===l?{}:l,h=s.cts,d=void 0===h?0:h;a.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,c>>>24&255,c>>>16&255,c>>>8&255,255&c,f.isLeading<<2|(null===f.dependsOn||void 0===f.dependsOn?1:f.dependsOn),f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|(null===f.isNonSyncSample||void 0===f.isNonSyncSample?1:f.isNonSyncSample),61440&f.degradationPriority,15&f.degradationPriority,d>>>24&255,d>>>16&255,d>>>8&255,255&d],12+16*o)}return e.box(e.types.trun,a)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(Vg(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===qg?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var r=t.ext,n=[e.stsd(t),e.stts(r.stts),e.stsc(r.stsc),e.stsz(r.stsz),e.stco(r.stco)];return r.stss.length&&n.push(e.stss(r.stss)),r.ctts.length&&n.push(e.ctts(r.ctts)),e.box.apply(e,[e.types.stbl].concat(n))}},{key:"stts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.stts,S_(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsc",value:function(t){var r=t.length,n=new Uint8Array(12*r),i=0;return t.forEach((function(e){var t=e.firstChunk,r=e.samplesPerChunk,a=e.sampleDescIndex;n.set([t>>24,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,a>>24,a>>16&255,a>>8&255,255&a],i),i+=12})),e.box(e.types.stsc,S_(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsz",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stsz,S_(new Uint8Array([0,0,0,0,0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stco",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stco,S_(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stss",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stss,S_(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"ctts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.ctts,S_(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var r=t.timescale,n=t.samples[0].duration,i=n*t.samples.length,a=t.samples[0].sampleOffset*n,o=8;t.samples.forEach((function(e){o+=e.size}));var s=0;if(t.isVideo){var u,c=0;t.videoSenc&&(u=t.videoSenc),t.isVideo&&u.forEach((function(e){c+=8,e.subsamples&&e.subsamples.length&&(c+=2,c+=6*e.subsamples.length)})),t.videoSencLength=c,s=o+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=o+16*t.samples.length+84)}else s=o+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=o+169+12*t.samples.length+8*t.audioSenc.length);var l=new Uint8Array([0,0,0,0,0,0,0,255&t.id,r>>24&255,r>>16&255,r>>8&255,255&r,a>>24&255,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,1,0,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,144,0,0,0]);return e.box(e.types.sidx,l)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();Mg(rb,"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(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),Mg(rb,"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])}),Mg(rb,"FTYPAVC1",rb.box(rb.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),Mg(rb,"FTYPHEV1",rb.box(rb.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),Mg(rb,"DINF",rb.box(rb.types.dinf,rb.box(rb.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),Mg(rb,"VMHD",rb.box(rb.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),Mg(rb,"SMHD",rb.box(rb.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),Mg(rb,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),Mg(rb,"STTS",rb.box(rb.types.stts,rb.StblTable)),Mg(rb,"STSC",rb.box(rb.types.stsc,rb.StblTable)),Mg(rb,"STSZ",rb.box(rb.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),Mg(rb,"STCO",rb.box(rb.types.stco,rb.StblTable));var nb=function(){function e(t,r){Pg(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=r}return Ig(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).debug.apply(t,[this._prefix].concat(n))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).log.apply(t,[this._prefix].concat(n))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(n))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).error.apply(t,[this._prefix].concat(n))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();Mg(nb,"disabled",!0);var ib=function(){function e(t,r,n){Pg(this,e),this.videoTrack=t,this.audioTrack=r;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new nb("FMP4Remuxer",!n||!n.openLog||!n.openLog)}return Ig(e,[{key:"remux",value:function(){var e,t,r,n,i,a=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),f=[];return a&&(o&&o.initMerge?(c&&f.push(this.videoTrack),l&&f.push(this.audioTrack),r=rb.initSegment(f)):(c&&(e=rb.initSegment([this.videoTrack])),l&&(t=rb.initSegment([this.audioTrack])))),c&&s.hasSample()&&(n=this._remuxVideo()),l&&u.hasSample()&&(i=this._remuxAudio()),s.samples=[],u.samples=[],{initSegment:r,videoInitSegment:e,audioInitSegment:t,videoSegment:n,audioSegment:i}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,r=/av01/.test(e.codec),n=0;r?t.forEach((function(e){n+=e.data.byteLength})):t.forEach((function(e){n+=e.units.reduce((function(e,t){return e+t.byteLength}),0),n+=4*e.units.length}));var i=new Uint8Array(n);if(r)for(var a,o=0,s=t.length,u=0;o<s;o++)a=t[o],i.set(a.data,u),a.size=a.data.byteLength,u+=a.size;else for(var c,l=new DataView(i.buffer),f=function(e,r){r=t[h];var n=0;r.units.forEach((function(t){l.setUint32(e,t.byteLength),e+=4,i.set(t,e),e+=t.byteLength,n+=4+t.byteLength})),r.size=n,p=e,c=r},h=0,d=t.length,p=0;h<d;h++)f(p,c);var v=rb.mdat(i);return S_(rb.moof([e]),v)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,t=new Uint8Array(e.samples.reduce((function(e,t){return e+t.size}),0));e.samples.reduce((function(e,r){return t.set(r.data,e),e+r.size}),0);var r=rb.mdat(t);return S_(rb.moof([e]),r)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}(),ab=function(){function e(){s(this,e);var t=window.crypto||window.msCrypto;this.subtle=t&&(t.subtle||t.webkitSubtle),this.externalDecryptor=null}var t,r;return c(e,[{key:"destroy",value:function(){var e;null!==(e=this.externalDecryptor)&&void 0!==e&&e.destroy&&this.externalDecryptor.destroy()}},{key:"decrypt",value:function(e,t){if(e||t){var r=[];return e&&(r[0]=this._decryptSegment(e)),t&&(r[1]=this._decryptSegment(t)),Promise.all(r)}}},{key:"_decryptSegment",value:(r=o(n().mark((function e(t){var r;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.data,!t.key){e.next=5;break}return e.next=4,this._decryptData(t.data,t.key,t.keyIv);case 4:r=e.sent;case 5:if(t.map){e.next=7;break}return e.abrupt("return",r);case 7:return e.abrupt("return",wg(t.map,r));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_decryptData",value:(t=o(n().mark((function e(t,r,i){var a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.externalDecryptor){e.next=6;break}return e.next=3,this.externalDecryptor.decrypt(t,r,i);case 3:return e.abrupt("return",e.sent);case 6:if(this.subtle){e.next=8;break}throw new Error("crypto is not defined");case 8:return e.next=10,this.subtle.importKey("raw",r,{name:"AES-CBC"},!1,["encrypt","decrypt"]);case 10:return a=e.sent,e.t0=Uint8Array,e.next=14,this.subtle.decrypt({name:"AES-CBC",iv:i},a,t);case 14:return e.t1=e.sent,e.abrupt("return",new e.t0(e.t1));case 16:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})}]),e}(),ob=r(r({},gg),{},{STREAM_PARSED:"core.streamparsed",NO_AUDIO_TRACK:"core.noaudiotrack",SUBTITLE_SEGMENTS:"core.subtitlesegments",SUBTITLE_PLAYLIST:"core.subtitleplaylist",SEI_PAYLOAD_TIME:"core.seipayloadtime",APPEND_COST:"core.appendcost"}),sb=new Yy("Transmuxer"),ub=function(){function e(t,r,n,i){s(this,e),l(this,"_initSegmentId",""),this.hls=t,this._demuxer=r?new Z_:new H_(null,null,null,i),this._isMP4=r,n&&(this._remuxer=new ib(this._demuxer.videoTrack,this._demuxer.audioTrack))}return c(e,[{key:"transmux",value:function(e,t,n,i,a,o){var s=this._demuxer;try{this._isMP4?s.demux(e,t):s.demuxAndFix(wg(e,t),n,i,a)}catch(Xb){throw new zy(My,Vy.HLS,Xb)}var u=s.videoTrack,c=s.audioTrack,l=s.metadataTrack,f={codec:u.codec,timescale:u.timescale,firstDts:u.firstDts/u.timescale,firstPts:u.firstPts/u.timescale,duration:u.samplesDuration/u.timescale},h={codec:c.codec,timescale:c.timescale,firstDts:c.firstDts/u.timescale,firstPts:c.firstPts/u.timescale,duration:c.samplesDuration/u.timescale,container:c.container},d="".concat(u.codec,"/").concat(u.width,"/").concat(u.height,"/").concat(c.codec,"/").concat(c.config);if(d!==this._initSegmentId&&(this._initSegmentId=d,o=!0),this._fireEvents(u,c,l,n||o),this.hls.emit(ob.DEMUXED_TRACK,{videoTrack:u,audioTrack:c}),!this._remuxer)return[u,c];o&&this.hls.isLive&&!this.hls.config.mseLowLatency&&(u.duration=this.hls.totalDuration*u.timescale,c.duration=this.hls.totalDuration*c.timescale);try{var p=this._remuxer.remux(o),v=p.videoInitSegment,m=p.videoSegment,y=p.audioInitSegment,g=p.audioSegment,_=wg(v,m),b=wg(y,g);return[_?r(r({},f),{},{data:_}):void 0,b?r(r({},h),{},{data:b}):void 0]}catch(Xb){throw new zy(By,Vy.FMP4,Xb)}}},{key:"_fireEvents",value:function(e,t,n,i){var a=this,o=[e,t],s="discontinuity: ".concat(i);o.forEach((function(e){var t;null!==(t=e.samples)&&void 0!==t&&t.length&&(s+="; ".concat(e.samples.length," ").concat(e.type===qg?"video":"audio"," samples, firstDts/firstPts/duration: ").concat((e.firstDts/e.timescale).toFixed(3),"/").concat((e.firstPts/e.timescale).toFixed(3),"/").concat((e.samplesDuration/e.timescale).toFixed(3))),i&&e.exist()&&a.hls.emit(ob.METADATA_PARSED,{type:e.type,track:e,meta:r({codec:e.codec,timescale:e.timescale,baseDts:e.baseDts},e.type===qg?{width:e.width,height:e.height,sarRatio:e.sarRatio}:{codec:e.codec,channelCount:e.channelCount,sampleRate:e.sampleRate})})})),sb.debug(s),e.warnings.forEach((function(e){var t;switch(e.type){case r_:t=ob.LARGE_AV_FIRST_FRAME_GAP_DETECT;break;case n_:t=ob.LARGE_VIDEO_DTS_GAP_DETECT;break;case i_:t=ob.MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT}t&&a.hls.emit(ob.STREAM_EXCEPTION,r(r({},e),{},{type:t})),sb.warn("video exception",e)})),t.warnings.forEach((function(e){var t;switch(e.type){case a_:t=ob.LARGE_AUDIO_DTS_GAP_DETECT;break;case o_:t=ob.AUDIO_GAP_DETECT;break;case s_:t=ob.AUDIO_OVERLAP_DETECT}t&&a.hls.emit(ob.STREAM_EXCEPTION,r(r({},e),{},{type:t})),sb.warn("audio exception",e)})),e.samples.forEach((function(e){e.keyframe&&a.hls.emit(ob.KEYFRAME,{pts:e.pts})})),n.seiSamples.forEach((function(e){a.hls.emit(ob.SEI,r(r({},e),{},{originPts:e.originPts/90,sei:{code:e.data.type,content:e.data.payload,dts:e.pts}}))}))}}]),e}(),cb=["data"],lb=["data"],fb=new Yy("BufferService"),hb=function(){function e(t){var r=this;s(this,e),l(this,"_decryptor",new ab),l(this,"_transmuxer",null),l(this,"_mse",null),l(this,"_softVideo",null),l(this,"_sourceCreated",!1),l(this,"_needInitSegment",!0),l(this,"_directAppend",!1),this.hls=t,t.config.softDecode?this._softVideo=t.media:(this._mse=new ig(null,{preferMMS:t.config.preferMMS}),t.config.url&&this._mse.bindMedia(t.media).then((function(e){r.hls.emit(gg.MEDIASOURCE_OPENED,e)}))),t.config.decryptor&&(this._decryptor.externalDecryptor=t.config.decryptor)}var t,r,i,a,u,f,h,d,v,m;return c(e,[{key:"baseDts",get:function(){var e,t,r;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t||null===(r=t._fixer)||void 0===r?void 0:r._baseDts}},{key:"nbSb",get:function(){var e;return null!==(e=this._mse)&&void 0!==e&&e._sourceBuffer?Object.keys(this._mse._sourceBuffer).length:0}},{key:"msIsOpened",get:function(){var e;return null===(e=this._mse)||void 0===e?void 0:e.isOpened}},{key:"msHasOpTasks",get:function(){var e;return null===(e=this._mse)||void 0===e?void 0:e.hasOpTasks}},{key:"msStreaming",get:function(){var e;return null===(e=this._mse)||void 0===e?void 0:e.streaming}},{key:"updateDuration",value:(m=o(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fb.debug("update duration",t),!this._mse){e.next=9;break}if(this._mse.isOpened){e.next=5;break}return e.next=5,this._mse.open();case 5:return e.next=7,this._mse.updateDuration(t);case 7:e.next=10;break;case 9:this._softVideo&&(this._softVideo.duration=t);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"createSource",value:function(e,t,r,n){if(!this._sourceCreated){var i=e||t;if(i){if(H_.probe(i))this._transmuxer||(this._transmuxer=new ub(this.hls,!1,!this._softVideo,this.hls.config.fixerConfig));else{if(!K_.probe(i))throw new zy(Fy,null,null,null,"unsupported stream");if(this._softVideo)this._transmuxer||(this._transmuxer=new ub(this.hls,!0,null,this.hls.config.fixerConfig));else{this._directAppend=!0;var a=!1;e&&!r&&K_.findBox(e,["moov","trak"]).forEach((function(e){var t=K_.findBox(e.data,["trak","mdia","minf","stbl","stsd"])[0];if(t){var i=K_.stsd(t).entries[0];if(i)if(i.hvcC)r=i.hvcC.codec||"hev1.1.6.L93.B0";else if(i.avcC)r=i.avcC.codec;else if(i.sampleRate||i.esds){var o;n=(null===(o=i.esds)||void 0===o?void 0:o.codec)||"mp4a.40.2",a=!0}}})),t&&!n&&K_.findBox(t,["moov","trak","mdia","minf","stbl","stsd"]).forEach((function(e){var t=K_.stsd(e).entries[0];t&&t.esds&&(n=t.esds.codec)})),e&&!r&&(r="avc1.42e01e"),t&&!n&&(n="mp4a.40.2"),a&&(r+=", ".concat(n),n=""),this._createMseSource(r,n)}}this._softVideo&&(this._sourceCreated=!0)}}}},{key:"appendBuffer",value:(v=o(n().mark((function e(t,r,i,a,o,s,u){var c,l,f,h,d,v,m,g,_,b,S,k,E,w,x=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=i&&i.length||null!=a&&a.length){e.next=2;break}return e.abrupt("return");case 2:if(c=function(){var e,r;null!==(e=x.hls)&&void 0!==e&&e.emit&&(null===(r=x.hls)||void 0===r||r.emit(gg.APPEND_BUFFER,{start:t.start,end:t.end}))},!this._directAppend){e.next=8;break}return l=[],i&&l.push(this._mse.append(ig.VIDEO,i)),a&&l.push(this._mse.append(ig.AUDIO,a)),e.abrupt("return",Promise.all(l).then(c));case 8:if(f=this._needInitSegment||o,h=this._transmuxer.transmux(i,a,f,s,u,this._needInitSegment||o),d=y(h,2),v=d[0],m=d[1],a&&r&&(null==r||r.setTrackExist(!1,!0)),a&&t&&(null==t||t.setTrackExist(!0,!1)),r||null==t||t.setTrackExist(!!v,!!m),v&&!m&&this.hls.emit(ob.NO_AUDIO_TRACK),!this._softVideo){e.next=20;break}this._softVideo.appendBuffer(v,m),this._needInitSegment=!1,c(),e.next=30;break;case 20:if(!this._mse){e.next=30;break}return(g=!this._sourceCreated)&&this._createMseSource(null==v?void 0:v.codec,null==m?void 0:m.codec,null==m?void 0:m.container),this._needInitSegment=!1,_=this._mse,b=[],f&&!g&&this._handleCodecChange(v,m).forEach((function(e){return b.push(e)})),v&&(S=v.data,k=p(v,cb),b.push(_.append(ig.VIDEO,S,k))),m&&(E=m.data,w=p(m,lb),b.push(_.append(ig.AUDIO,E,w))),e.abrupt("return",Promise.all(b).then(c));case 30:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i,a,o){return v.apply(this,arguments)})},{key:"removeBuffer",value:(d=o(n().mark((function e(){var t,r,i,a=this,o=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[0]:0,r=o.length>1&&void 0!==o[1]?o[1]:1/0,i=this.hls.media,!(!this._mse||!i||t<0||r<t||t>=this._mse.duration)){e.next=5;break}return e.abrupt("return");case 5:return e.abrupt("return",this._mse.clearBuffer(t,r).then((function(){return a.hls.emit(gg.REMOVE_BUFFER,{start:t,end:r,removeEnd:r})})));case 6:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"evictBuffer",value:(h=o(n().mark((function e(t){var r,i,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.hls.media,this._mse&&r&&t&&!(t<0)){e.next=3;break}return e.abrupt("return");case 3:if(i=r.currentTime,!((a=i-t)<=0)){e.next=7;break}return e.abrupt("return");case 7:if(!(Ay.start(Ay.get(r))+1>=a)){e.next=10;break}return e.abrupt("return");case 10:return e.abrupt("return",this.removeBuffer(0,a));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"clearAllBuffer",value:(f=o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=2;break}return e.abrupt("return",this._mse.clearAllBuffer());case 2:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"decryptBuffer",value:function(e,t){return this._decryptor.decrypt(e,t)}},{key:"reset",value:(u=o(n().mark((function e(){var t,r=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=r.length>0&&void 0!==r[0]&&r[0],!this._mse||t){e.next=8;break}return this._transmuxer=null,this._sourceCreated=!1,e.next=6,this._mse.unbindMedia();case 6:return e.next=8,this._mse.bindMedia(this.hls.media);case 8:this._needInitSegment=!0,this._directAppend=!1;case 10:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"endOfStream",value:(a=o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=5;break}if(!this._sourceCreated){e.next=5;break}return e.next=4,this._mse.endOfStream();case 4:this.hls.emit(gg.BUFFEREOS);case 5:this._softVideo&&this._softVideo.endOfStream();case 6:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"setLiveSeekableRange",value:(i=o(n().mark((function e(t,r){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._mse&&this._mse.setLiveSeekableRange(t,r);case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"detachMedia",value:(r=o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=3;break}return e.next=3,this._mse.unbindMedia();case 3:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"destroy",value:(t=o(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null===(t=this._decryptor)||void 0===t||t.destroy(),e.next=3,this.detachMedia();case 3:this._decryptor=null,this._mse=null,this._softVideo=null;case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_createMseSource",value:function(e,t,r){fb.debug("create mse source, videoCodec=".concat(e,", audioCodec=").concat(t));var n=this._mse;n&&(e&&(n.createSource(ig.VIDEO,"video/mp4;codecs=".concat(e)),this._sourceCreated=!0),t?(n.createSource(ig.AUDIO,"audio/mp4;codecs=".concat(t)),this._sourceCreated=!0):r&&(n.createSource(ig.AUDIO,"".concat(r,';codecs=""')),this._sourceCreated=!0),this.hls.emit(gg.SOURCEBUFFER_CREATED))}},{key:"_handleCodecChange",value:function(e,t){var r=[],n=this._mse;return[{type:ig.VIDEO,codecs:null==e?void 0:e.codec},{type:ig.AUDIO,codecs:null==t?void 0:t.codec}].filter((function(e){return!!e.codecs})).forEach((function(e){var t=e.type,i=e.codecs,a=n.getSourceBuffer(t);if(a){var o=i.split(",")[0];new RegExp(o,"ig").test(a.mimeType)||r.push(n.changeType(t,"".concat(t,"/mp4;codecs=").concat(i)))}})),r}},{key:"seamlessSwitch",value:function(){this._needInitSegment=!0}},{key:"isFull",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ig.VIDEO;return null===(e=this._mse)||void 0===e?void 0:e.isFull(t)}}]),e}();var db=c((function e(){s(this,e),l(this,"version",0),l(this,"streams",[]),l(this,"isMaster",!0)})),pb="AUDIO",vb="SUBTITLE",mb={CLEAR_KEY:"org.w3.clearkey",FAIRPLAY:["urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2","com.apple.streamingkeydelivery"],WIDEVINE:["urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine.alpha","com.widevine"],PLAYREADY:["urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95","com.microsoft.playready"]};function yb(e){for(var t=[],r=0;r<e.length;r++)Array.isArray(e[r])?t=t.concat(yb(e[r])):t.push(e[r]);return t}var gb=c((function e(){s(this,e),l(this,"id",0),l(this,"url",""),l(this,"default",!1),l(this,"autoSelect",!1),l(this,"forced",!1),l(this,"group",""),l(this,"name",""),l(this,"lang",""),l(this,"segments",[]),l(this,"endSN",0)})),_b=function(e){f(r,e);var t=m(r);function r(){var e;s(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return l(v(e=t.call.apply(t,[this].concat(i))),"mediaType",pb),l(v(e),"channels",0),e}return c(r)}(gb),bb=function(e){f(r,e);var t=m(r);function r(){var e;s(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return l(v(e=t.call.apply(t,[this].concat(i))),"mediaType",vb),e}return c(r)}(gb),Sb=c((function e(){s(this,e),l(this,"id",0),l(this,"bitrate",0),l(this,"width",0),l(this,"height",0),l(this,"name",""),l(this,"url",""),l(this,"audioCodec",""),l(this,"videoCodec",""),l(this,"textCodec",""),l(this,"audioGroup",""),l(this,"audioStreams",[]),l(this,"subtitleStreams",[]),l(this,"closedCaptionsStream",[])})),kb=c((function e(){s(this,e),l(this,"version",0),l(this,"url",""),l(this,"type",""),l(this,"startCC",0),l(this,"endCC",0),l(this,"startSN",0),l(this,"endSN",0),l(this,"totalDuration",0),l(this,"targetDuration",0),l(this,"partTargetDuration",0),l(this,"canSkipUntil",0),l(this,"canSkipDateRanges",!1),l(this,"skippedSegments",0),l(this,"canBlockReload",!1),l(this,"partHoldBack",0),l(this,"live",!0),l(this,"lowLatency",!1),l(this,"endPartIndex",0),l(this,"segments",[]),l(this,"dateRanges",{}),l(this,"skippedSegments",0)})),Eb=function(){function e(t){s(this,e),l(this,"sn",0),l(this,"cc",0),l(this,"url",""),l(this,"parentUrl",""),l(this,"title",""),l(this,"start",0),l(this,"duration",0),l(this,"dataTime",""),l(this,"key",null),l(this,"byteRange",null),l(this,"isInitSegment",!1),l(this,"initSegment",null),l(this,"isLast",!1),l(this,"hasAudio",!1),l(this,"hasVideo",!1),l(this,"independent",!1),l(this,"partIndex",0),this.parentUrl=t}return c(e,[{key:"end",get:function(){return this.start+this.duration}},{key:"setTrackExist",value:function(e,t){this.hasVideo=e,this.hasAudio=t}},{key:"setByteRange",value:function(e,t){this.byteRange=[0];var r=e.split("@");1===r.length&&t&&t.byteRange?(this.byteRange[0]=t.byteRange[1]||0,this.byteRange[0]&&(this.byteRange[0]+=1)):this.byteRange[0]=parseInt(r[1]),this.byteRange[1]=this.byteRange[0]+parseInt(r[0])-1}}]),e}(),wb=function(){function e(t){s(this,e),l(this,"method",""),l(this,"url",""),l(this,"iv",null),l(this,"keyFormat",""),l(this,"keyFormatVersions",""),t instanceof e&&(this.method=t.method,this.url=t.url,this.keyFormat=t.keyFormat,this.keyFormatVersions=t.keyFormatVersions,t.iv&&(this.iv=new Uint8Array(t.iv)))}return c(e,[{key:"clone",value:function(t){var r=new e(this);return null!=t&&r.setIVFromSN(t),r}},{key:"setIVFromSN",value:function(e){if(!this.iv&&"AES-128"===this.method&&"number"==typeof e&&this.url){this.iv=new Uint8Array(16);for(var t=12;t<16;t++)this.iv[t]=e>>8*(15-t)&255}}},{key:"isSegmentEncrypted",value:function(){return"AES-128"===this.method}},{key:"isValidKeySystem",value:function(){return yb([mb.CLEAR_KEY,mb.FAIRPLAY,mb.WIDEVINE,mb.PLAYREADY]).indexOf(this.keyFormat)>-1&&!!(["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)>-1)}},{key:"isSupported",value:function(){return!!this.method&&(!!this.isSegmentEncrypted()||!!this.isValidKeySystem())}}]),e}(),xb=function(){function e(t,r,n){s(this,e),this.msn=t,this.part=r,this.skip=n}return c(e,[{key:"addDirectives",value:function(e){var t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}]),e}(),Tb=/^#(EXT[^:]*)(?::(.*))?$/,Ab=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g,Db=/^(?:[a-zA-Z0-9+\-.]+:)?\/\//,Ob=/^((?:[a-zA-Z0-9+\-.]+:)?\/\/[^/?#]*)?([^?#]*\/)?/;function Lb(e){var t=e.match(Tb);if(t&&t[1])return[t[1].replace("EXT-X-",""),t[2]]}function Cb(e){for(var t={},r=Ab.exec(e);r;)t[r[1]]=r[2]||r[3],r=Ab.exec(e);return t}function Pb(e,t){if(!t||!e||Db.test(e))return e;var r=Ob.exec(t);return r?"/"===e[0]?r[1]+e:r[1]+r[2]+e:e}var Rb={audio:[/^mp4a/,/^vorbis$/,/^opus$/,/^flac$/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function Ib(e,t){var r=Rb[e];if(r&&t&&t.length)for(var n=0;n<r.length;n++)for(var i=0;i<t.length;i++)if(r[n].test(t[i]))return t[i]}function Mb(e,t){var r;if(t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e[n]!==t[n]){r=n;break}var i=null;e.DURATION&&(i=parseFloat(e.DURATION),Number.isFinite(i)?e._endDate&&(i=(e._endDate.getTime()-e._startDate.getTime())/1e3):i=null);var a,o,s=(a=e.CUE||e["X-CUE"],o={pre:!1,post:!1,once:!1},(a?a.split(/[ ,]+/):[]).reduce((function(e,t){return e[t.toLowerCase()]=!0,e}),o));return!!e.ID&&!r&&Number.isFinite(e._startDate.getTime())&&(null===i||i>=0)&&(!("YES"===e.END_ON_NEXT)||!!e.CLASS)&&(!e.CUE||!s.pre&&!s.post||s.pre!==s.post)&&(!("com.apple.hls.interstitial"===e.CLASS)||"X-ASSET-URI"in e||"X-ASSET-LIST"in e)}var Bb=function(){function e(){s(this,e)}return c(e,null,[{key:"parse",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(!t.includes("#EXTM3U"))throw new Error("Invalid m3u8 file");var i=function(e){return e.split(/[\r\n]/).map((function(e){return e.trim()})).filter(Boolean)}(t);return e.isMediaPlaylist(t)?function(e,t,r){var n=new kb;n.url=t;for(var i,a=new Eb(t),o=null,s=null,u=0,c=0,l=0,f=0,h=!1,d=0;i=e[f++];)if("#"===i[0]){var p=Lb(i);if(p){var v=y(p,2),m=v[0],g=v[1];switch(m){case"VERSION":n.version=parseInt(g);break;case"PLAYLIST-TYPE":n.type=null==g?void 0:g.toUpperCase();break;case"TARGETDURATION":n.targetDuration=parseFloat(g);break;case"PART-INF":r&&(n.lowLatency=!0);var _=Cb(g);_["PART-TARGET"]&&(n.partTargetDuration=parseFloat(_["PART-TARGET"]));break;case"SERVER-CONTROL":var b=Cb(g);n.canBlockReload="YES"===b["CAN-BLOCK-RELOAD"],n.partHoldBack=parseFloat(b["PART-HOLD-BACK"]||0),n.canSkipUntil=parseFloat(b["CAN-SKIP-UNTIL"]||0),n.canSkipDateRanges=n.canSkipUntil>0&&"YES"===b["CAN-SKIP-DATERANGES"];break;case"ENDLIST":h=!0;break;case"MEDIA-SEQUENCE":c=n.startSN=parseInt(g);break;case"DISCONTINUITY-SEQUENCE":l=n.startCC=parseInt(g);break;case"DISCONTINUITY":l++;break;case"BYTERANGE":a.setByteRange(g,n.segments[n.segments.length-1]);break;case"PART":if(!n.lowLatency)break;var S=Cb(g);a.duration=parseFloat(S.DURATION),a.independent="YES"===S.INDEPENDENT,a.sn=c,a.cc=l,a.partIndex=d,a.start=u,a.duration=parseFloat(S.DURATION),u+=a.duration,a.url=Pb(S.URI,t),s&&(a.key=s.clone(c)),o&&(a.initSegment=o),n.segments.push(a),a=new Eb(t),d++;break;case"PRELOAD-HINT":var k=Cb(g);if(n.preloadHint=k,"PART"===k.TYPE&&k.URI){var E=k.URI.split(".ts")[0].split("-");n.nextSN=E[3],n.nextIndex=E[E.length-1]}break;case"PROGRAM-DATE-TIME":a.dataTime=g;break;case"EXTINF":if(n.lowLatency){d=0;break}var w=y(g.split(","),2),x=w[0],T=w[1];a.start=u,a.duration=parseFloat(x),u+=a.duration,a.title=T;break;case"KEY":var A=Cb(g);if("NONE"===A.METHOD){s=null;break}if((s=new wb).method=A.METHOD,s.url=/^blob:/.test(A.URI)?A.URI:Pb(A.URI,t),s.keyFormat=A.KEYFORMAT||"identity",s.keyFormatVersions=A.KEYFORMATVERSIONS,!s.isSupported())throw new Error("encrypt ".concat(A.METHOD,"/").concat(A.KEYFORMAT," is not supported"));if(A.IV){var D=A.IV.slice(2);D=(1&D.length?"0":"")+D,s.iv=new Uint8Array(D.length/2);for(var O=0,L=D.length/2;O<L;O++)s.iv[O]=parseInt(D.slice(2*O,2*O+2),16)}break;case"MAP":var C=Cb(g);a.url=Pb(C.URI,t),C.BYTERANGE&&a.setByteRange(C.BYTERANGE),a.isInitSegment=!0,a.sn=0,s&&(a.key=s.clone(0)),o=a,a=new Eb(t);break;case"SKIP":var P=Cb(g),R=parseInt(P["SKIPPED-SEGMENTS"],10);R<=Number.MAX_SAFE_INTEGER&&(n.skippedSegments+=R,c+=R);break;case"DATERANGE":var I=Cb(g),M=n.dateRanges[I.ID];I._startDate=M?M._startDate:new Date(I["START-DATE"]);var B=(null==M?void 0:M._endDate)||new Date(I.END_DATE);Number.isFinite(B)&&(I._endDate=B),(Mb(I,M)||n.skippedSegments)&&(n.dateRanges[I.ID]=I)}}}else{if(n.lowLatency){c++;continue}a.sn=c,a.cc=l,a.url=Pb(i,t),s&&(a.key=s.clone(c)),o&&(a.initSegment=o),n.segments.push(a),a=new Eb(t),c++}n.segments=n.segments.filter((function(e){return 0!==e.duration}));var U=n.segments[n.segments.length-1];return U&&(h&&(U.isLast=!0),n.endSN=U.sn,n.endPartIndex=U.partIndex),h&&(n.live=!1),n.totalDuration=u,n.endCC=l,n}(i,r,n):function(e,t){for(var r,n=new db,i=0,a=[],o=[];r=e[i++];){var s=Lb(r);if(s){var u=y(s,2),c=u[0],l=u[1];if("VERSION"===c)n.version=parseInt(l);else if("MEDIA"===c&&l){var f=Cb(l),h=void 0;switch(f.TYPE){case"AUDIO":h=new _b;break;case"SUBTITLES":h=new bb;break;default:h=new gb}h.url=Pb(f.URI,t),h.default="YES"===f.DEFAULT,h.autoSelect="YES"===f.AUTOSELECT,h.group=f["GROUP-ID"],h.name=f.NAME,h.lang=f.LANGUAGE,f.CHANNELS&&(h.channels=Number(f.CHANNELS.split("/")[0]),Number.isNaN(h.channels)&&(h.channels=0)),"AUDIO"===f.TYPE&&f.URI&&a.push(h),"SUBTITLES"===f.TYPE&&o.push(h)}else if("STREAM-INF"===c&&l){var d=new Sb,p=Cb(l);if(d.bitrate=parseInt(p["AVERAGE-BANDWIDTH"]||p.BANDWIDTH),d.name=p.NAME,d.url=Pb(e[i++],t),p.RESOLUTION){var v=y(p.RESOLUTION.split("x"),2),m=v[0],g=v[1];d.width=parseInt(m),d.height=parseInt(g)}if(p.CODECS){var _=p.CODECS.split(/[ ,]+/).filter(Boolean);d.videoCodec=Ib("video",_),d.audioCodec=Ib("audio",_),d.textCodec=Ib("text",_)}d.audioGroup=p.AUDIO,d.subtitleGroup=p.SUBTITLES,n.streams.push(d)}}}return n.streams.forEach((function(e,t){e.id=t})),a.length&&(a.forEach((function(e,t){e.id=t})),n.streams.forEach((function(e){e.audioGroup&&(e.audioStreams=a.filter((function(t){return t.group===e.audioGroup})))}))),o.length&&(o.forEach((function(e,t){e.id=t})),n.streams.forEach((function(e){e.subtitleGroup&&(e.subtitleStreams=o.filter((function(t){return t.group===e.subtitleGroup})))}))),n}(i,r)}},{key:"isMediaPlaylist",value:function(e){return e.includes("#EXTINF:")||e.includes("#EXT-X-TARGETDURATION:")}}]),e}(),Ub=function(){function e(t){var n=this;s(this,e),l(this,"_emitOnLoaded",(function(e,t){var r=e.response,i=e.options||{},a=i.firstByteTime,o=i.startTime,s=i.endTime,u=i.contentLength,c=s-o;n.hls.emit(gg.SPEED,{time:c,byteLength:u,url:t}),n.hls.emit(gg.LOAD_COMPLETE,{url:t,elapsed:c||0}),n.hls.emit(gg.TTFB,{url:t,responseUrl:r.url,elapsed:a-o}),n.hls.emit(gg.LOAD_RESPONSE_HEADERS,{headers:r.headers,url:t})})),l(this,"_onLoaderRetry",(function(e,t){n.hls.emit(ob.LOAD_RETRY,{error:zy.network(e),retryTime:t})})),this.hls=t,this._timer=null,this._useLowLatency=t.config.useLowLatency;var i=this.hls.config,a=i.retryCount,o=i.retryDelay,u=i.manifestLoadTimeout,c=i.fetchOptions;this._loader=new Tg(r(r({},c),{},{responseType:"text",retry:a,retryDelay:o,timeout:u,onRetryError:this._onLoaderRetry})),this._audioLoader=new Tg(r(r({},c),{},{responseType:"text",retry:a,retryDelay:o,timeout:u,onRetryError:this._onLoaderRetry})),this._subtitleLoader=new Tg(r(r({},c),{},{responseType:"text",retry:a,retryDelay:o,timeout:u,onRetryError:this._onLoaderRetry}))}var t;return c(e,[{key:"load",value:(t=o(n().mark((function e(t,r,i){var a,o,s,u,c,l,f,h,d,p,v,m,g,_,b,S,k,E,w,x;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=[this._loader.load(t)],r&&a.push(this._audioLoader.load(r)),i&&a.push(this._subtitleLoader.load(i)),e.prev=3,e.next=6,Promise.all(a);case 6:if(h=e.sent,d=y(h,3),p=d[0],v=d[1],m=d[2],p){e.next=13;break}return e.abrupt("return",[]);case 13:this._emitOnLoaded(p,t),o=p.data,c=p.response.url||t,r?(s=null==v?void 0:v.data,u=null==m?void 0:m.data,l=(null==v||null===(g=v.response)||void 0===g?void 0:g.url)||r,f=(null==m||null===(_=m.response)||void 0===_?void 0:_.url)||i,s&&this._emitOnLoaded(v,r),u&&this._emitOnLoaded(m,i)):(u=null==v?void 0:v.data,f=(null==v||null===(b=v.response)||void 0===b?void 0:b.url)||i,u&&this._emitOnLoaded(v,i)),e.next=22;break;case 19:throw e.prev=19,e.t0=e.catch(3),zy.network(e.t0);case 22:if(S=this.hls.config.onPreM3U8Parse,e.prev=23,S&&(o=S(o)||o,s&&(s=S(s,!0)||s),u&&(u=S(u,!0)||u)),k=Bb.parse(o,c,this._useLowLatency),!1!==(null===(x=k)||void 0===x?void 0:x.live)||!k.segments||k.segments.length){e.next=28;break}throw new Error("empty segments list");case 28:s&&(E=Bb.parse(s,l,this._useLowLatency)),u&&(w=Bb.parse(u,f,this._useLowLatency)),e.next=35;break;case 32:throw e.prev=32,e.t1=e.catch(23),new zy(Oy,Vy.HLS,e.t1);case 35:return k&&(k.isMaster?this.hls.emit(ob.HLS_MANIFEST_LOADED,{playlist:k}):(this._useLowLatency&&(k.canBlockReload?this.deliveryDirectives=new xb(k.nextSN,k.nextIndex,""):this.deliveryDirectives=null),this.hls.emit(ob.HLS_LEVEL_LOADED,{playlist:k}))),e.abrupt("return",[k,E,w]);case 37:case"end":return e.stop()}}),e,this,[[3,19],[23,32]])}))),function(e,r,n){return t.apply(this,arguments)})},{key:"parseText",value:function(e,t){var r,n=this.hls.config.onPreM3U8Parse;try{var i;if(n&&(e=n(e)||e),!1===(null===(i=r=Bb.parse(e,t,this._useLowLatency))||void 0===i?void 0:i.live)&&r.segments&&!r.segments.length)throw new Error("empty segments list")}catch(Xb){throw new zy(Oy,Vy.HLS,Xb)}return r&&(r.isMaster?this.hls.emit(ob.HLS_MANIFEST_LOADED,{playlist:r}):this.hls.emit(ob.HLS_LEVEL_LOADED,{playlist:r})),[r]}},{key:"poll",value:function(e,t,r,i,a,s){var u=this;clearTimeout(this._timer),s=s||3e3;var c=this.hls.config.pollRetryCount,l=function(){var f=o(n().mark((function o(){var f,h;return n().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return clearTimeout(u._timer),f=e,n.prev=2,u.deliveryDirectives&&(f=u.deliveryDirectives.addDirectives(e)),n.next=6,u.load(f,t,r);case 6:if((h=n.sent)[0]){n.next=9;break}return n.abrupt("return");case 9:c=u.hls.config.pollRetryCount,i(h[0],h[1],h[2]),n.next=17;break;case 13:n.prev=13,n.t0=n.catch(2),--c<=0&&a(n.t0);case 17:u._timer=setTimeout(l,s);case 18:case"end":return n.stop()}}),o,null,[[2,13]])})));return function(){return f.apply(this,arguments)}}();this._timer=setTimeout(l,s)}},{key:"stopPoll",value:function(){return clearTimeout(this._timer),this.cancel()}},{key:"cancel",value:function(){return Promise.all([this._loader.cancel(),this._audioLoader.cancel()])}}]),e}();function Nb(e,t,r){return t>r&&(r=t),Math.min(Math.max(e,t),r)}var Fb=new Yy("playlist"),jb=function(){function e(t,r,n){s(this,e),l(this,"live",void 0),l(this,"id",0),l(this,"bitrate",0),l(this,"width",0),l(this,"height",0),l(this,"name",""),l(this,"url",""),l(this,"audioCodec",""),l(this,"videoCodec",""),l(this,"textCodec",""),l(this,"startCC",0),l(this,"endCC",0),l(this,"startSN",0),l(this,"endSN",-1),l(this,"totalDuration",0),l(this,"targetDuration",0),l(this,"partTargetDuration",0),l(this,"canSkipUntil",0),l(this,"canSkipDateRanges",!1),l(this,"skippedSegments",0),l(this,"canBlockReload",!1),l(this,"partHoldBack",0),l(this,"lowLatency",!1),l(this,"endPartIndex",0),l(this,"snDiff",null),l(this,"segments",[]),l(this,"audioStreams",[]),l(this,"subtitleStreams",[]),l(this,"closedCaptions",[]),l(this,"currentAudioStream",null),l(this,"currentSubtitleStream",null),this.update(this._setLLPlaybackPoint(t),r,n)}return c(e,[{key:"lastSegment",get:function(){return this.segments.length?this.segments[this.segments.length-1]:null}},{key:"segmentDuration",get:function(){var e;return this.targetDuration||(null===(e=this.segments[0])||void 0===e?void 0:e.duration)||0}},{key:"liveEdge",get:function(){return this.endTime},set:function(e){this.endTime=e}},{key:"endTime",get:function(){var e;return(null===(e=this.lastSegment)||void 0===e?void 0:e.end)||0},set:function(e){var t=this.lastSegment;t&&(t.duration=e-t.start)}},{key:"currentSubtitleEndSn",get:function(){var e;return(null===(e=this.currentSubtitleStream)||void 0===e?void 0:e.endSN)||0}},{key:"clearOldSegment",value:function(e,t){return this.currentAudioStream&&this._clearSegments(e,t),this._clearSegments(e,t)}},{key:"getAudioSegment",value:function(e){if(e&&this.currentAudioStream){var t=e.sn-this.snDiff;return this.currentAudioStream.segments.find((function(e){return e.sn===t}))}}},{key:"update",value:function(e,t){this.url=e.url,Array.isArray(e.segments)?(null!==this.live&&void 0!==this.live||(this.live=e.live),this._updateSegments(e,this),this.startCC=e.startCC,this.endCC=e.endCC,this.startSN=e.startSN,this.endSN=e.endSN||-1,this.totalDuration=e.totalDuration,this.targetDuration=e.targetDuration,this.live=e.live,this.lowLatency=e.lowLatency,this.canBlockReload=e.canBlockReload,this.canSkipDateRanges=e.canSkipDateRanges,this.canSkipUntil=e.canSkipUntil,this.partHoldBack=e.partHoldBack,this.partTargetDuration=e.partTargetDuration,this.skippedSegments=e.skippedSegments,this.endPartIndex=e.endPartIndex,t&&this.currentAudioStream&&Array.isArray(t.segments)&&(this._updateSegments(t,this.currentAudioStream),(null===this.snDiff||void 0===this.snDiff)&&e.segments.length&&t.segments.length&&(this.snDiff=e.segments[0].sn-t.segments[0].sn))):(this.id=e.id,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.name=e.name,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.textCodec=e.textCodec,this.audioStreams=e.audioStreams,this.subtitleStreams=e.subtitleStreams,!this.currentAudioStream&&this.audioStreams.length&&(this.currentAudioStream=this.audioStreams.find((function(e){return e.default}))||this.audioStreams[0]),!this.currentSubtitleStream&&this.subtitleStreams.length&&(this.currentSubtitleStream=this.subtitleStreams.find((function(e){return e.default}))||this.subtitleStreams[0]))}},{key:"updateSubtitle",value:function(e){var t=this;if(e&&this.currentSubtitleStream&&Array.isArray(e.segments)){var r=this._updateSegments(e,this.currentSubtitleStream),n=this.currentSubtitleStream.segments;if(n.length>100&&(this.currentSubtitleStream.segments=n.slice(100)),r)return r.map((function(e){return{sn:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end,lang:t.currentSubtitleStream.lang}}))}}},{key:"switchSubtitle",value:function(e){var t=this.subtitleStreams.find((function(t){return t.lang===e})),r=this.currentSubtitleStream;t&&(this.currentSubtitleStream=t,r.segments=[])}},{key:"_setLLPlaybackPoint",value:function(e){if(!e.lowLatency||!e.segments.length)return e;for(var t=e.totalDuration-e.partHoldBack,r=e.segments,n=0,i=0,a=r.length;i<a;i++)r[i].start<=t&&r[i].independent&&(n=i);var o=r.slice(n),s=0;return o.forEach((function(e){e.start=s,s=e.end})),e.segments=o,e.totalDuration=s,e.startSN=o[0].sn,e.startCC=o[0].cc,Fb.log("set ll-hls playback point: SN=".concat(e.startSN," partIndex=").concat(o[0].partIndex,", duration=").concat(s)),e}},{key:"_clearSegments",value:function(e,t){for(var r=0,n=this.segments,i=0,a=n.length;i<a;i++)if(n[i].end>=e){r=i;break}return r>t&&(r=t),r&&(this.segments=this.segments.slice(r),this.currentAudioStream&&(this.currentAudioStream.segments=this.currentAudioStream.segments.slice(r))),t-r}},{key:"_updateSegments",value:function(e,t){var r=t.segments;if(this.live){var n,i=e.lowLatency,a=r[r.length-1],o=null!==(n=null==a?void 0:a.sn)&&void 0!==n?n:-1,s=(null==a?void 0:a.partIndex)||0,u=o<e.endSN&&e.segments.length;if(i&&(u=u||s<e.endPartIndex),u){Fb.log("update segments: endSN:".concat(o,", partIndex:").concat(s," --\x3e endSN:").concat(e.endSN,", partIndex:").concat(e.endPartIndex));var c=e.segments.findIndex((function(e){return e.sn===o&&e.partIndex===s})),l=c<0?e.segments:e.segments.slice(c+1);if(r.length&&l.length){var f=a.end,h=f;l.forEach((function(e){e.start=f,f=e.end})),Fb.log("liveEdge: ".concat(h," -> ").concat(f));var d=(null==a?void 0:a.cc)||-1;d>l[0].cc&&l.forEach((function(e){return e.cc+=d}))}return t.endSN=e.endSN,t.segments=r.concat(l),l}}else t.segments=e.segments}}]),e}(),Vb=function(){function e(t){s(this,e),l(this,"streams",[]),l(this,"currentStream",null),l(this,"dvrWindow",0),l(this,"_segmentPointer",-1),this.hls=t}return c(e,[{key:"lowLatency",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lowLatency}},{key:"lastSegment",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lastSegment}},{key:"currentSegment",get:function(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer]}},{key:"nextSegment",get:function(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer+1]}},{key:"currentSegments",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.segments}},{key:"currentSubtitleEndSn",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.currentSubtitleEndSn}},{key:"liveEdge",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.liveEdge},set:function(e){this.currentStream&&(this.currentStream.liveEdge=e)}},{key:"totalDuration",get:function(){var e;return(null===(e=this.currentStream)||void 0===e?void 0:e.totalDuration)||0}},{key:"seekRange",get:function(){var e=this.currentSegments;if(e&&e.length)return[e[0].start,e[e.length-1].end]}},{key:"nbSegments",get:function(){var e;return(null===(e=this.currentSegments)||void 0===e?void 0:e.length)||0}},{key:"isEmpty",get:function(){var e;return!(null!==(e=this.currentSegments)&&void 0!==e&&e.length)}},{key:"isLive",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.live}},{key:"hadSegmentLoaded",get:function(){return-1!==this._segmentPointer}},{key:"hasSubtitle",get:function(){var e;return!(null===(e=this.currentStream)||void 0===e||!e.currentSubtitleStream)}},{key:"getAudioSegment",value:function(e){var t;return null===(t=this.currentStream)||void 0===t?void 0:t.getAudioSegment(e)}},{key:"moveSegmentPointer",value:function(e){var t;null==e&&(e=this._segmentPointer+1),this._segmentPointer=Nb(e,-1,null===(t=this.currentSegments)||void 0===t?void 0:t.length)}},{key:"reset",value:function(){this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1}},{key:"getSegmentByIndex",value:function(e){var t;return null===(t=this.currentSegments)||void 0===t?void 0:t[e]}},{key:"setNextSegmentByIndex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._segmentPointer=e-1}},{key:"setNextSegmentBySN",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=null===(e=this.currentSegments)||void 0===e?void 0:e.findIndex((function(e){return e.sn===t}));return-1!==r&&this.setNextSegmentByIndex(r+1),r}},{key:"findSegmentIndexByTime",value:function(e){var t=this.currentSegments;if(t){for(var r,n=0,i=t.length;n<i;n++)if(e>=(r=t[n]).start&&e<r.end)return n;var a=t[t.length-1];if(Math.abs(e-(null==a?void 0:a.end))<.2)return t.length-1}}},{key:"upsertPlaylist",value:function(e,t,r){var n=this;if(e){if(e.isMaster)this.streams.length=e.streams.length,e.streams.filter((function(e){return e.url})).forEach((function(e,t){n.streams[t]?n.streams[t].update(e):n.streams[t]=new jb(e)})),this.currentStream=this.streams[0];else if(Array.isArray(e.segments)){var i=this.currentStream;if(i){i.update(e,t,r);var a=i.updateSubtitle(r);a&&this.hls.emit(ob.SUBTITLE_SEGMENTS,{list:a})}else this.reset(),this.currentStream=this.streams[0]=new jb(e,t,r)}this.currentStream&&this.hls.isLive&&!this.dvrWindow&&(this.dvrWindow=this.currentSegments.reduce((function(e,t){return e+=t.duration}),0))}}},{key:"updateSegmentsRanges",value:function(e,t){var r;(null===(r=this.currentSegments)||void 0===r?void 0:r.filter((function(t){return t.sn>=e}))).forEach((function(e){e.start=t,t=e.end}))}},{key:"switchSubtitle",value:function(e){var t;null===(t=this.currentStream)||void 0===t||t.switchSubtitle(e)}},{key:"clearOldSegment",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.hls.config.maxPlaylistSize||50,t=this.currentStream;if(this.dvrWindow&&t){var r=t.endTime-this.dvrWindow;if(!(r<=0))t.segments.length<=e||(this._segmentPointer=t.clearOldSegment(r,this._segmentPointer))}}},{key:"checkSegmentTrackChange",value:function(e,t){var r=this.findSegmentIndexByTime(e),n=this.getSegmentByIndex(r);if(n&&(n.hasAudio||n.hasVideo)){if(2!==t&&n.hasAudio&&n.hasVideo)return n;if(!(n.end-e>.3)){var i=this.getSegmentByIndex(r+1);if(i&&(i.hasAudio||i.hasVideo))return i.hasAudio!==n.hasAudio||i.hasVideo!==n.hasVideo?i:void 0}}}},{key:"feedbackLiveEdge",value:function(e,t){var r;this.currentSegments&&((null===(r=this.lastSegment)||void 0===r?void 0:r.sn)===e.sn?this.liveEdge=t:this.updateSegmentsRanges(e.sn+1,t))}}]),e}(),Gb=function(){function e(t){var n=this;s(this,e),l(this,"error",null),l(this,"_emitOnLoaded",(function(e,t){var r=e.data,i=e.response,a=e.options||{},o=a.firstByteTime,s=a.startTime,u=a.endTime,c=a.contentLength,l=u-s;n._bandwidthService.addRecord(c||r.byteLength,l),n.hls.emit(gg.SPEED,{time:l,byteLength:c,url:t}),n.hls.emit(gg.LOAD_COMPLETE,{url:t,elapsed:l||0}),n.hls.emit(gg.TTFB,{url:t,responseUrl:i.url,elapsed:o-s}),n.hls.emit(gg.LOAD_RESPONSE_HEADERS,{headers:i.headers,url:t})})),l(this,"_onLoaderRetry",(function(e,t){n.hls.emit(gg.LOAD_RETRY,{error:zy.network(e),retryTime:t})})),this.hls=t,this._bandwidthService=new Og,this._mapCache={},this._keyCache={};var i=this.hls.config,a=i.retryCount,o=i.retryDelay,u=i.loadTimeout,c=i.fetchOptions;this._segmentLoader=new Tg(r(r({},c),{},{responseType:"arraybuffer",retry:a,retryDelay:o,timeout:u,onRetryError:this._onLoaderRetry})),this._audioSegmentLoader=new Tg(r(r({},c),{},{responseType:"arraybuffer",retry:a,retryDelay:o,timeout:u,onRetryError:this._onLoaderRetry})),this._keyLoader=new Tg(r(r({},c),{},{responseType:"arraybuffer",retry:a,retryDelay:o,timeout:u,onRetryError:this._onLoaderRetry}))}var t,i;return c(e,[{key:"speedInfo",value:function(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed()}}},{key:"load",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r,i=[];return e&&(i[0]=this.loadVideoSegment(e,r)),t&&(i[1]=this.loadAudioSegment(t,n)),Promise.all(i)}},{key:"loadVideoSegment",value:function(e,t){return this._loadSegment(this._segmentLoader,e,t)}},{key:"loadAudioSegment",value:function(e,t){return this._loadSegment(this._audioSegmentLoader,e,t)}},{key:"_loadSegment",value:(i=o(n().mark((function e(t,r,i){var a,o,s,u,c,l,f,h,d,p,v,m,g,_,b,S=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f=[],this.hls.emit(gg.LOAD_START,{url:r.url}),f[0]=t.load(r.url),i&&r.initSegment&&(d=r.initSegment.url,(o=this._mapCache[d])||(this.hls.emit(gg.LOAD_START,{url:d}),f[1]=t.load(d).then((function(e){e&&(Object.keys(S._mapCache)>30&&(S._mapCache={}),o=S._mapCache[d]=e.data,S._emitOnLoaded(e,d))}))),(p=null===(h=r.initSegment.key)||void 0===h?void 0:h.url)&&(l=r.initSegment.key.iv,(c=this._keyCache[p])||(this.hls.emit(gg.LOAD_START,{url:p}),f[2]=this._keyLoader.load(p).then((function(e){e&&(c=S._keyCache[p]=e.data,S._emitOnLoaded(e,p))}))))),(v=null===(a=r.key)||void 0===a?void 0:a.url)&&r.key.isSegmentEncrypted()&&(u=r.key.iv,(s=this._keyCache[v])||(this.hls.emit(gg.LOAD_START,{url:v}),f[3]=this._keyLoader.load(v).then((function(e){e&&(s=S._keyCache[v]=e.data,S._emitOnLoaded(e,v))})))),e.next=8,Promise.all(f);case 8:if(m=e.sent,g=y(m,1),_=g[0]){e.next=13;break}return e.abrupt("return");case 13:return b=_.data,this._emitOnLoaded(_,r.url),e.abrupt("return",{data:b,map:o,key:s,mapKey:c,keyIv:u,mapKeyIv:l});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return i.apply(this,arguments)})},{key:"reset",value:function(){this.error=null,this._mapCache={},this._keyCache={},this._bandwidthService.reset()}},{key:"cancel",value:(t=o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this._keyLoader.cancel(),this._segmentLoader.cancel(),this._audioSegmentLoader.cancel()]);case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),zb=new Yy("hls"),Hb=function(e){f(O,e);var t,a,u,h,d,p,_,b,S,k,E,w,x,T,A,D=m(O);function O(e){var t,i,a;return s(this,O),l(v(t=D.call(this)),"version",O.version),l(v(t),"media",null),l(v(t),"config",null),l(v(t),"_manifestLoader",null),l(v(t),"_segmentLoader",null),l(v(t),"_playlist",null),l(v(t),"_bufferService",null),l(v(t),"_gapService",null),l(v(t),"_seiService",null),l(v(t),"_stats",null),l(v(t),"_prevSegSn",null),l(v(t),"_prevSegCc",null),l(v(t),"_tickTimer",null),l(v(t),"_tickInterval",500),l(v(t),"_segmentProcessing",!1),l(v(t),"_reloadOnPlay",!1),l(v(t),"_switchUrlOpts",null),l(v(t),"_isProcessQuotaExceeded",!1),l(v(t),"_loadSegment",o(n().mark((function e(){var r,i,a,o,s,u,c,l;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t._segmentProcessing&&t.media){e.next=2;break}return e.abrupt("return");case 2:if(r=t._playlist,i=r.nextSegment,a=r.lastSegment,o=v(t),s=o.config,.016,u=Math.min(Math.max((null==a?void 0:a.duration)-.008||0,.016),.1),i){e.next=8;break}return e.abrupt("return");case 8:if(t.isLive){e.next=18;break}if(c=t.bufferInfo(),t.media.paused&&!t.media.currentTime&&(c=t.bufferInfo(c.nextStart||.5)),l=Math.abs(c.end-t.media.duration)<u,!(c.remaining>=s.preloadTime||l)){e.next=15;break}return t._tryEos(),e.abrupt("return");case 15:if(!s.preferMMSStreaming||t._bufferService.msStreaming){e.next=17;break}return e.abrupt("return");case 17:!t._urlSwitching&&t._prevSegSn!==i.sn-1&&c.end&&Math.abs(i.start-c.end)>1&&t._playlist.setNextSegmentByIndex(t._playlist.findSegmentIndexByTime(c.end+.1));case 18:return e.abrupt("return",t._loadSegmentDirect());case 19:case"end":return e.stop()}}),e)})))),l(v(t),"_onLoadeddata",(function(){t.isLive&&!t.config.mseLowLatency&&t.media.duration!==1/0&&t._bufferService.updateDuration(1/0).catch((function(e){}))})),l(v(t),"_onPlay",o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.media.seeking||0!==t.media.currentTime){e.next=3;break}return zb.debug("replay currentTime 0, return"),e.abrupt("return");case 3:if(clearTimeout(t._disconnectTimer),!t._reloadOnPlay){e.next=9;break}t._reloadOnPlay=!1,t.replay(!0),e.next=12;break;case 9:return e.next=11,t._loadSegment();case 11:t._startTick();case 12:case"end":return e.stop()}}),e)})))),l(v(t),"_onPause",(function(){if(t.isLive){if(!t._reloadOnPlay){var e=t.config.disconnectTime;if(null==e&&(e=t._playlist.dvrWindow),!Number.isFinite(e))return;clearTimeout(t._disconnectTimer),t._disconnectTimer=setTimeout((function(){t._reloadOnPlay=!0,t._clear()}),e||0)}}else t._stopTick()})),l(v(t),"_onSeeking",o(n().mark((function e(){var r,i,a,o,s,u,c;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.media){e.next=2;break}return e.abrupt("return");case 2:if(t._onCheckQuotaExceeded(),r=t.media.currentTime,!(i=t._playlist.seekRange)){e.next=10;break}if(!((a=Nb(r,i[0],t.isLive?i[1]:t.media.duration))>=0&&Math.abs(r-a)>=.1)){e.next=10;break}return t.media.currentTime=a,e.abrupt("return");case 10:if(o=t._playlist.currentSegment,s=Ay.info(Ay.get(t.media),r,.1),!o){e.next=17;break}if(!(s.end&&Math.abs(s.end-o.end)<.2)){e.next=15;break}return e.abrupt("return");case 15:if(!t.isLive||!s.end){e.next=17;break}return e.abrupt("return");case 17:if(u=t._playlist.findSegmentIndexByTime(r),c=t._playlist.getSegmentByIndex(u),null!=u&&c&&(!t._segmentProcessing||c!==t._playlist.nextSegment)){e.next=21;break}return e.abrupt("return");case 21:return zb.debug("seek to",r,c),t._playlist.setNextSegmentByIndex(u),t._stopTick(),e.next=26,t._segmentLoader.cancel();case 26:if(t._segmentProcessing=!1,s.end&&!t.isLive){e.next=30;break}return e.next=30,t._loadSegmentDirect(!0);case 30:t._startTick();case 31:case"end":return e.stop()}}),e)})))),l(v(t),"_onTimeupdate",(function(){if(t.media){var e,r=t.config;if(r.isLive&&r.maxLatency&&r.targetLatency&&t.media){var n=t._playlist.liveEdge;if(!n)return;var i=n-t.media.currentTime;i>=r.maxLatency&&(zb.debug("latency jump, currentTime:".concat(t.media.currentTime,", liveEdge:").concat(n,", latency=").concat(i)),t.media.currentTime=n-r.targetLatency)}if(r.seiInTime)null===(e=t._seiService)||void 0===e||e.throw(t.media.currentTime);t.config.allowedStreamTrackChange&&!t.config.softDecode&&t._checkStreamTrackChange(t.media.currentTime)}})),l(v(t),"_tick",(function(){if(t.media){t._startTick();var e=t.media,r=t._segmentLoader.error;if(t._onCheckQuotaExceeded(),t._isProcessQuotaExceeded&&(t._bufferService.isFull()||(t._isProcessQuotaExceeded=!1,t._segmentProcessing=!1)),r){(!e.readyState||t.bufferInfo(.5).remaining<1)&&(r.fatal=!0,t._emitError(zy.network(r)))}else e.readyState&&(!function(e){return e&&!e.paused&&!e.ended&&0!==e.playbackRate&&0!==e.readyState}(e)?e.readyState<2&&t._gapService&&t._gapService.do(e,t.config.maxJumpDistance,!e.currentTime||t.isLive):(t._loadSegment(),t._gapService&&t._gapService.do(e,t.config.maxJumpDistance,t.isLive))),t.isLive||t._tryEos()}})),t.config=(a=(null==(i=e)?void 0:i.media)||document.createElement("video"),e=r(r({maxPlaylistSize:50,retryCount:3,retryDelay:1e3,pollRetryCount:2,loadTimeout:1e4,manifestLoadTimeout:1e4,preloadTime:30,softDecode:!1,bufferBehind:10,maxJumpDistance:3,startTime:0,useLowLatency:!0,targetLatency:10,maxLatency:20,allowedStreamTrackChange:!0,seiInTime:!1,manifestList:[],minSegmentsStartPlay:3,preferMMS:!1,preferMMSStreaming:!1,mseLowLatency:!0,fixerConfig:{forceFixLargeGap:!1,largeGapThreshold:5}},i),{},{media:a})),t.media=t.config.media,t._manifestLoader=new Ub(v(t)),t._segmentLoader=new Gb(v(t)),t._playlist=new Vb(v(t)),t._bufferService=new hb(v(t)),e.seiInTime&&(t._seiService=new Dg(v(t))),e.softDecode||(t._gapService=new Ag),t._stats=new Cg(v(t),9e4),t.media.addEventListener("loadeddata",t._onLoadeddata),t.media.addEventListener("play",t._onPlay),t.media.addEventListener("pause",t._onPause),t.media.addEventListener("seeking",t._onSeeking),t.media.addEventListener("timeupdate",t._onTimeupdate),t}return c(O,[{key:"isLive",get:function(){return this._playlist.isLive}},{key:"streams",get:function(){return this._playlist.streams}},{key:"currentStream",get:function(){return this._playlist.currentStream}},{key:"hasSubtitle",get:function(){return this._playlist.hasSubtitle}},{key:"totalDuration",get:function(){return this._playlist.totalDuration}},{key:"baseDts",get:function(){var e;return null===(e=this._bufferService)||void 0===e?void 0:e.baseDts}},{key:"abrSwitchPoint",get:function(){var e=this._urlSwitching?this._playlist.currentSegment:this._playlist.nextSegment;return e?e.start+e.duration/2:null}},{key:"speedInfo",value:function(){return this._segmentLoader.speedInfo()}},{key:"bufferInfo",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.1;return Ay.info(Ay.get(this.media),null===(e=this.media)||void 0===e?void 0:e.currentTime,t)}},{key:"getStats",value:function(){return this._stats.getStats()}},{key:"playbackQuality",value:function(){return function(e){if(!e)return{};if("function"==typeof e.getVideoPlaybackQuality){var t=e.getVideoPlaybackQuality();return{droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}return{droppedVideoFrames:e.webkitDroppedFrameCount,totalVideoFrames:e.webkitDecodedFrameCount,creationTime:performance.now()}}(this.media)}},{key:"load",value:(A=o(n().mark((function e(){var t,r,a,o=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:"",a="boolean"==typeof(r=o.length>1&&void 0!==o[1]?o[1]:{})?r:!(null==r||!r.reuseMse),"object"===i(r)&&null!=r&&r.clearSwitchStatus&&(this._urlSwitching=!1,this._switchUrlOpts=null,this.config.startTime=void 0),t&&(this.config.url=t),t=this.config.url,e.next=8,this._reset(a);case 8:return e.next=10,this._loadData(t);case 10:this._startTick();case 11:case"end":return e.stop()}}),e,this)}))),function(){return A.apply(this,arguments)})},{key:"_loadData",value:(T=o(n().mark((function e(t){var r,i,a,o,s,u,c,l,f,h,d,p,v;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{t&&(t=t.trim())}catch(n){}if(t){e.next=3;break}throw this._emitError(new zy(Fy,Vy.OPTION,null,null,"m3u8 url is missing"));case 3:return e.next=5,this._loadM3U8(t);case 5:if(r=e.sent,i=this._playlist.currentStream,!this._urlSwitching){e.next=23;break}if(!this.isLive){e.next=14;break}a=this._playlist.setNextSegmentBySN(this._prevSegSn),zb.log("segment nb=".concat(this._prevSegSn," index of ").concat(a," in the new playlist")),-1===a&&(this._prevSegCc=null,this._prevSegSn=null),e.next=23;break;case 14:if(0===i.bitrate&&null!==(o=this._switchUrlOpts)&&void 0!==o&&o.bitrate&&(i.bitrate=null===(c=this._switchUrlOpts)||void 0===c?void 0:c.bitrate),l="number"==typeof(null===(s=this._switchUrlOpts)||void 0===s?void 0:s.startTime)?null===(u=this._switchUrlOpts)||void 0===u?void 0:u.startTime:this._getSeamlessSwitchPoint(),this.config.startTime=l,f=this._playlist.findSegmentIndexByTime(l),!(h=this._playlist.getSegmentByIndex(f+1))){e.next=23;break}return d=h.start,e.next=23,this._bufferService.removeBuffer(d);case 23:if(r){e.next=25;break}return e.abrupt("return");case 25:if(!this.isLive){e.next=36;break}if(this._bufferService.setLiveSeekableRange(0,4294967295),zb.log("totalDuration first time got:",this._playlist.totalDuration),zb.log("nb segments got:",this._playlist.nbSegments),this.config.targetLatency<this._playlist.totalDuration&&(this.config.targetLatency=this._playlist.totalDuration,this.config.maxLatency=1.5*this.config.targetLatency),r.isMaster||this._pollM3U8(t),!(this._playlist.nbSegments<this.config.minSegmentsStartPlay)){e.next=33;break}return e.abrupt("return");case 33:return e.next=35,this._loadSegment();case 35:return e.abrupt("return");case 36:return e.next=38,this._bufferService.updateDuration(i.totalDuration);case 38:return(p=this.config.startTime)&&(null!==(v=this._switchUrlOpts)&&void 0!==v&&v.seamless||(this.media.currentTime=p),this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(p)||0)),e.next=42,this._loadSegment();case 42:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"replay",value:(x=o(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.config.startTime=0,this._urlSwitching=!1,this._switchUrlOpts=null,e.next=5,this.load();case 5:return this._reloadOnPlay=!1,e.abrupt("return",this.media.play(!t));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"switchURL",value:(w=o(n().mark((function e(t){var r,a,o,s,u,c,l,f=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=f.length>1&&void 0!==f[1]?f[1]:{},a={seamless:!1,startTime:0,bitrate:0},e.t0=i(r),e.next="number"===e.t0?5:"boolean"===e.t0?7:"object"===e.t0?9:11;break;case 5:return r={startTime:r},e.abrupt("break",12);case 7:return r={seamless:r},e.abrupt("break",12);case 9:for(o in r)void 0!==r[o]&&null!==r[o]||delete r[o];return e.abrupt("break",12);case 11:throw"unsupported switchURL args: ".concat(r);case 12:if(r=Object.assign({},a,r),u=(s=r).seamless,c=s.startTime,this.config.url=t,this.config.startTime=c,this._switchUrlOpts=r,u){e.next=38;break}if(e.prev=18,!this.config.softDecode){e.next=23;break}e.t1=this.load(t),e.next=26;break;case 23:return e.next=25,this.load(t);case 25:e.t1=e.sent;case 26:l=e.t1,e.next=33;break;case 29:throw e.prev=29,e.t2=e.catch(18),this.emit(ob.SWITCH_URL_FAILED,e.t2),e.t2;case 33:return this._reloadOnPlay=!1,l&&this.emit(ob.SWITCH_URL_SUCCESS,{url:t}),e.abrupt("return",this.media.play(!0));case 38:return this._urlSwitching=!0,this.isLive||(this._prevSegSn=null,this._prevSegCc=null),this._playlist.reset(),this._bufferService.seamlessSwitch(),e.next=44,this._clear();case 44:return e.next=46,this._loadData(t);case 46:this._startTick();case 47:this._switchUrlOpts=null;case 48:case"end":return e.stop()}}),e,this,[[18,29]])}))),function(e){return w.apply(this,arguments)})},{key:"switchStream",value:(E=o(n().mark((function e(t){var r,i,a,o,s,u=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(u.length>1&&void 0!==u[1])||u[1],i=this.currentStream,a=this.streams,i&&i.id!==t&&a&&!(a.length<2)){e.next=5;break}return e.abrupt("return");case 5:if(o=a.find((function(e){return e.id===t}))){e.next=8;break}return e.abrupt("return");case 8:return e.prev=8,e.next=11,this._clear();case 11:if(!r){e.next=14;break}return e.next=14,this._bufferService.clearAllBuffer();case 14:e.next=19;break;case 16:throw e.prev=16,e.t0=e.catch(8),this._emitError(zy.create(e.t0));case 19:if(i.currentAudioStream&&o.audioStreams.length>2&&(s=i.currentAudioStream.id,o.currentAudioStream=o.audioStreams.find((function(e){return e.id===s}))||o.currentAudioStream),this._playlist.currentStream=o,e.prev=21,!this.isLive&&o.segments.length){e.next=25;break}return e.next=25,this._refreshM3U8();case 25:return this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(this.media.currentTime)||0),this._prevSegCc=null,e.next=29,this._loadSegmentDirect();case 29:e.next=35;break;case 31:throw e.prev=31,e.t1=e.catch(21),this._playlist.currentStream=i,e.t1;case 35:return this._startTick(),e.abrupt("return",o);case 37:case"end":return e.stop()}}),e,this,[[8,16],[21,31]])}))),function(e){return E.apply(this,arguments)})},{key:"switchAudioStream",value:(k=o(n().mark((function e(t){var r,i,a,o,s=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(s.length>1&&void 0!==s[1])||s[1],i=this.currentStream){e.next=4;break}return e.abrupt("return");case 4:if((a=i.currentAudioStream)&&a.id!==t&&!(i.audioStreams.length<2)){e.next=7;break}return e.abrupt("return");case 7:if(o=i.audioStreams.find((function(e){return e.id===t}))){e.next=10;break}return e.abrupt("return");case 10:return e.prev=10,e.next=13,this._clear();case 13:if(!r){e.next=16;break}return e.next=16,this._bufferService.clearAllBuffer();case 16:e.next=21;break;case 18:throw e.prev=18,e.t0=e.catch(10),this._emitError(zy.create(e.t0));case 21:if(i.currentAudioStream=o,e.prev=22,!this.isLive&&o.segments.length){e.next=26;break}return e.next=26,this._refreshM3U8();case 26:return this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(this.media.currentTime)||0),this._prevSegCc=null,e.next=30,this._loadSegmentDirect();case 30:e.next=36;break;case 32:throw e.prev=32,e.t1=e.catch(22),i.currentAudioStream=a,e.t1;case 36:return this._startTick(),e.abrupt("return",o);case 38:case"end":return e.stop()}}),e,this,[[10,18],[22,32]])}))),function(e){return k.apply(this,arguments)})},{key:"switchSubtitleStream",value:(S=o(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._playlist.switchSubtitle(t),e.next=3,this._manifestLoader.stopPoll();case 3:return e.next=5,this._refreshM3U8();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"detachMedia",value:(b=o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._bufferService){e.next=3;break}return e.next=3,this._bufferService.detachMedia();case 3:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"destroy",value:(_=o(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.media){e.next=2;break}return e.abrupt("return");case 2:return this.removeAllListeners(),this._playlist.reset(),this._segmentLoader.reset(),null===(t=this._seiService)||void 0===t||t.reset(),this.media.removeEventListener("loadeddata",this._onLoadeddata),this.media.removeEventListener("play",this._onPlay),this.media.removeEventListener("pause",this._onPause),this.media.removeEventListener("seeking",this._onSeeking),this.media.removeEventListener("timeupdate",this._onTimeupdate),e.next=13,Promise.all([this._clear(),this._bufferService.destroy()]);case 13:this.media=null;case 14:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"_loadM3U8",value:(p=o(n().mark((function e(t){var r,i,a,o,s,u,c;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(o=null===(i=this.config.manifestList)||void 0===i||null===(a=i.filter((function(e){return e.url===t}))[0])||void 0===a?void 0:a.manifest)){e.next=6;break}e.t0=this._manifestLoader.parseText(o,t),e.next=9;break;case 6:return e.next=8,this._manifestLoader.load(t);case 8:e.t0=e.sent;case 9:s=e.t0,u=y(s,1),r=u[0],e.next=17;break;case 14:throw e.prev=14,e.t1=e.catch(0),this._emitError(zy.create(e.t1));case 17:if(r){e.next=19;break}return e.abrupt("return");case 19:if(this._playlist.upsertPlaylist(r),!r.isMaster){e.next=24;break}return null!==(c=this._playlist.currentStream.subtitleStreams)&&void 0!==c&&c.length&&this.emit(ob.SUBTITLE_PLAYLIST,{list:this._playlist.currentStream.subtitleStreams}),e.next=24,this._refreshM3U8();case 24:return this.emit(ob.STREAM_PARSED),e.abrupt("return",r);case 26:case"end":return e.stop()}}),e,this,[[0,14]])}))),function(e){return p.apply(this,arguments)})},{key:"_refreshM3U8",value:function(){var e,t,r=this,n=this._playlist.currentStream;if(!n||!n.url)throw this._emitError(zy.create(null,null,new Error("m3u8 url is not defined")));var i=n.url,a=null===(e=n.currentAudioStream)||void 0===e?void 0:e.url,o=null===(t=n.currentSubtitleStream)||void 0===t?void 0:t.url;return this._manifestLoader.load(i,a,o).then((function(e){var t=y(e,3),n=t[0],s=t[1],u=t[2];n&&(r._playlist.upsertPlaylist(n,s,u),r.isLive&&r._pollM3U8(i,a,o))})).catch((function(e){throw r._emitError(zy.create(e))}))}},{key:"_pollM3U8",value:function(e,t,r){var n,i,a=this,o=this._playlist.isEmpty;this._playlist.lowLatency?n=1e3*(this._playlist.currentStream.partTargetDuration||0):n=1e3*((null===(i=this._playlist.lastSegment)||void 0===i?void 0:i.duration)||0);this._manifestLoader.poll(e,t,r,(function(e,t,r){a._playlist.upsertPlaylist(e,t,r),a._playlist.clearOldSegment(),(e&&o&&!a._playlist.isEmpty||!a._playlist.hadSegmentLoaded&&a._playlist.nbSegments>=a.config.minSegmentsStartPlay)&&a._loadSegment(),o&&(o=a._playlist.isEmpty)}),(function(e){a._emitError(zy.create(e))}),n)}},{key:"_loadSegmentDirect",value:(d=o(n().mark((function e(t){var r,i,a,o,s,u;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._playlist.nextSegment){e.next=3;break}return e.abrupt("return");case 3:return i=!1,a=null,e.prev=5,this._segmentProcessing=!0,zb.log("load segment, sn:".concat(r.sn,", [").concat(r.start,", ").concat(r.end,"], partIndex:").concat(r.partIndex)),e.next=10,this._reqAndBufferSegment(r,this._playlist.getAudioSegment(r));case 10:i=e.sent,e.next=16;break;case 13:e.prev=13,e.t0=e.catch(5),a=e.t0;case 16:return e.prev=16,this._segmentProcessing=!1,e.finish(16);case 19:if(!a){e.next=26;break}if(!this._bufferService.isFull()){e.next=25;break}return zb.log("load segment, sn:".concat(r.sn,", partIndex:").concat(r.partIndex)),this._segmentProcessing=!0,this._isProcessQuotaExceeded=!0,e.abrupt("return",!1);case 25:return e.abrupt("return",this._emitError(zy.create(a)));case 26:return i&&(s=this.bufferInfo().end,this.isLive&&!this.media.seeking&&s&&Math.abs(r.end-s)>1&&(zb.warn("segment: ".concat(r.sn," expected end=").concat(r.end,", real end=").concat(s)),this._playlist.feedbackLiveEdge(r,s)),u=(null===(o=this._playlist.currentStream)||void 0===o?void 0:o.url)===r.parentUrl,this._urlSwitching&&!u&&(zb.warn("pre playlist segment appended!"),this._bufferService.seamlessSwitch()),this.isLive&&this._urlSwitching&&u&&(this._urlSwitching=!1,this.emit(ob.SWITCH_URL_SUCCESS,{url:this.config.url})),this._playlist.moveSegmentPointer(),r.isLast?this._end():t||this._loadSegment()),e.abrupt("return",i);case 28:case"end":return e.stop()}}),e,this,[[5,13,16,19]])}))),function(e){return d.apply(this,arguments)})},{key:"_reqAndBufferSegment",value:(h=o(n().mark((function e(t,r){var i,a,o,s,u,c,l,f,h,d,p;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t?t.cc:r.cc,o=this._prevSegCc!==a,s=[],e.prev=3,e.next=6,this._segmentLoader.load(t,r,o);case 6:s=e.sent,e.next=14;break;case 9:throw e.prev=9,e.t0=e.catch(3),e.t0.fatal=!1,this._segmentLoader.error=e.t0,e.t0;case 14:if(s[0]){e.next=16;break}return e.abrupt("return");case 16:return e.next=18,(i=this._bufferService).decryptBuffer.apply(i,g(s));case 18:if(u=e.sent){e.next=21;break}return e.abrupt("return");case 21:return c=t?t.sn:r.sn,l=t?t.start:r.start,f=this._playlist.currentStream,this._bufferService.createSource(u[0],u[1],null==f?void 0:f.videoCodec,null==f?void 0:f.audioCodec),h=Date.now(),d=this._prevSegSn===c-1,this.isLive&&this._urlSwitching&&(p=this.bufferInfo().end,this._playlist.updateSegmentsRanges(c,p),zb.warn("update the new playlist liveEdge, segment id=".concat(c,", buffer start=").concat(p,", liveEdge=").concat(this._playlist.liveEdge)),l=p),e.next=30,this._bufferService.appendBuffer(t,r,u[0],u[1],o,d,l);case 30:return this.emit(ob.APPEND_COST,{elapsed:Date.now()-h,url:t.url}),e.next=33,this._bufferService.evictBuffer(this.config.bufferBehind);case 33:return this._prevSegCc=a,this._prevSegSn=c,e.abrupt("return",!0);case 36:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e,t){return h.apply(this,arguments)})},{key:"_onCheckQuotaExceeded",value:(u=o(n().mark((function e(){var t,r,i,a,o,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.media.currentTime,r=this.media.buffered,i=!1,a=0;case 4:if(!(a<r.length)){e.next=11;break}if(!(r.start(0)>=t&&t<r.end(a))){e.next=8;break}return i=!0,e.abrupt("break",11);case 8:a++,e.next=4;break;case 11:if(!this._bufferService.isFull()){e.next=17;break}if(o=i?this.config.bufferBehind:5,!((s=this.media.currentTime)-o>0)){e.next=17;break}return e.next=17,this._bufferService.removeBuffer(0,s-o);case 17:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"_checkStreamTrackChange",value:function(e){var t=this._playlist.checkSegmentTrackChange(e,this._bufferService.nbSb);t&&this.switchURL(this.config.url,t.start+.2)}},{key:"_clear",value:(a=o(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._disconnectTimer),this._stopTick(),e.next=4,Promise.all([this._segmentLoader.cancel(),this._manifestLoader.stopPoll()]);case 4:this._segmentProcessing=!1;case 5:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"_reset",value:(t=o(n().mark((function e(){var t,r,i=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>0&&void 0!==i[0]&&i[0],this._reloadOnPlay=!1,this._prevSegSn=null,this._prevSegCc=null,this._switchUrlOpts=null,this._playlist.reset(),this._segmentLoader.reset(),null===(t=this._seiService)||void 0===t||t.reset(),this._stats.reset(),e.next=11,this._clear();case 11:return e.abrupt("return",this._bufferService.reset(r));case 12:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_end",value:function(){this._clear(),this._bufferService.endOfStream(),(this.media.readyState<=2||this.media.buffered.length>1)&&this._startTick()}},{key:"_stopTick",value:function(){this._tickTimer&&clearTimeout(this._tickTimer),this._tickTimer=null}},{key:"_startTick",value:function(){this._stopTick(),this._tickTimer=setTimeout(this._tick,this._tickInterval)}},{key:"_emitError",value:function(e){var t,r,n,i,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!1===(null===(t=e.originError)||void 0===t?void 0:t.fatal)?zb.warn(e):(zb.table(e),zb.error(e),zb.error(null===(r=this.media)||void 0===r?void 0:r.error),null!==(n=this.media)&&void 0!==n&&n.readyState&&this.media.pause(),this._stopTick(),this._urlSwitching&&(this._urlSwitching=!1,this.emit(ob.SWITCH_URL_FAILED,e)),this.emit(ob.ERROR,e),a&&this._end(),null===(i=this._seiService)||void 0===i||i.reset());return e}},{key:"_getSeamlessSwitchPoint",value:function(){var e=this.media,t=e.currentTime;if(!e.paused){var r,n=this._playlist.findSegmentIndexByTime(e.currentTime),i=this._playlist.getSegmentByIndex(n),a=null===(r=this._stats)||void 0===r?void 0:r.getStats().downloadSpeed;if(a&&i)t+=i.duration*this._playlist.currentStream.bitrate/a+1;else t+=5}return t}},{key:"_tryEos",value:function(){var e,t,r=this.media,n=this._playlist,i=n.nextSegment,a=n.lastSegment;if((!i||a&&Ay.isBuffered(r,a.start+a.duration/2))&&r.readyState&&r.duration>0&&(null===(e=this._bufferService)||void 0===e?void 0:e.msIsOpened)&&!(null!==(t=this._bufferService)&&void 0!==t&&t.msHasOpTasks)){var o=this.bufferInfo();r.paused&&!r.currentTime&&(o=this.bufferInfo(o.nextStart||.5)),(Math.abs(o.end-r.duration)<.1||!this.isLive&&a&&o.end>=a.start+a.duration)&&this._bufferService.endOfStream()}}}],[{key:"isSupported",value:function(e){return e&&"video"!==e&&"audio"!==e?"undefined"!=typeof WebAssembly:ig.isSupported()}},{key:"enableLogger",value:function(){Yy.enable(),p_.enable()}},{key:"disableLogger",value:function(){Yy.disable(),p_.disable()}}]),O}(Bp);l(Hb,"version","3.0.21-rc.5");try{localStorage.getItem("xgd")?Hb.enableLogger():Hb.disableLogger()}catch(Xb){}var qb=function(){function e(t,n){var i=this;s(this,e),l(this,"_opts",null),l(this,"_plugin",null),l(this,"_onLowDecode",(function(){var e,t,n,a,o=i._opts,s=o.media,u=o.innerDegrade;null===(e=i._plugin)||void 0===e||null===(t=e.player)||void 0===t||t.emit("lowdecode",s.degradeInfo),null===(n=i._plugin)||void 0===n||null===(a=n.player)||void 0===a||a.emit("core_event",r(r({},s.degradeInfo),{},{eventName:ob.LOWDECODE})),1===u&&i._degrade(s.src)})),l(this,"_degrade",(function(e){var t=i._plugin.player,r=t.video;if(!r||"MVideo"===r.TAG){var n=t.video.degradeVideo;t.video=n,r.degrade(e),e&&(t.config.url=e);var a=t.root.firstChild;"MVideo"===a.TAG&&t.root.replaceChild(n,a);var o=i._plugin.constructor.pluginName.toLowerCase();t.unRegisterPlugin(o),t.once("canplay",(function(){t.play()}))}})),l(this,"forceDegradeToVideo",(function(e){1===i._opts.innerDegrade&&i._degrade(e)})),this._opts=t,this._plugin=n,this._init()}return c(e,[{key:"_init",value:function(){var e=this._opts,t=e.media,r=e.preloadTime,n=e.innerDegrade,i=e.isLive;t&&(i||!t.setPlayMode?(n&&t.setAttribute("innerdegrade",n),r&&t.setAttribute("preloadtime",r),this._bindEvents()):t.setPlayMode("VOD"))}},{key:"_bindEvents",value:function(){this._opts.media.addEventListener("lowdecode",this._onLowDecode)}},{key:"destroy",value:function(){var e,t;null===(e=this._opts)||void 0===e||null===(t=e.media)||void 0===t||t.removeEventListener("lowdecode",this._onLowDecode),this._plugin=null}}]),e}(),Yb=["currentTime"];var Kb=function(e){f(n,e);var t=m(n);function n(){var e;s(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return l(v(e=t.call.apply(t,[this].concat(i))),"logger",zb),l(v(e),"hls",null),l(v(e),"pluginExtension",null),l(v(e),"getStats",(function(){var t;return null===(t=e.hls)||void 0===t?void 0:t.getStats()})),l(v(e),"_onSwitchSubtitle",(function(t){var r,n=t.lang;null===(r=e.hls)||void 0===r||r.switchSubtitleStream(n)})),l(v(e),"_keepPauseStatus",(function(){e.player.paused&&e.player.once("canplay",(function(){e.player.pause()}))})),e}return c(n,[{key:"core",get:function(){return this.hls}},{key:"version",get:function(){var e;return null===(e=this.hls)||void 0===e?void 0:e.version}},{key:"softDecode",get:function(){var e,t,r=null===(e=this.player)||void 0===e||null===(t=e.config)||void 0===t?void 0:t.mediaType;return!!r&&"video"!==r&&"audio"!==r}},{key:"beforePlayerInit",value:function(){var e=this,t=this.player.config,n=this.player.media||this.player.video,a=t.hls||{};if((t.url||t.__allowHlsEmptyUrl__)&&(a.preferMMS||!ig.isMMSOnly())){this.hls&&this.hls.destroy();var o=Object.getOwnPropertyDescriptor(this.player,"switchURL");o&&!o.writable||(this.player.switchURL=function(t,r){return new Promise((function(n,a){var o=e.player,s=e.hls;if(s){var u,c,l=function(e,t){var r={startTime:t.player.currentTime};switch(i(e)){case"boolean":r.seamless=e;break;case"object":var n=e.currentTime,a=p(e,Yb);Object.assign(r,a),"number"==typeof n&&(r.startTime=n)}return r}(r,e);o.config.url=t,s.switchURL(t,l).then((function(){return n(!0)})).catch(a),!l.seamless&&null!==(u=e.player.config)&&void 0!==u&&null!==(c=u.hls)&&void 0!==c&&c.keepStatusAfterSwitch&&e._keepPauseStatus()}else a()}))});var s,u=this.player.switchURL;if(this.player.handleSource=!1,a.innerDegrade=a.innerDegrade||t.innerDegrade,null!==a.disconnectTime&&void 0!==a.disconnectTime||(a.disconnectTime=0),this.hls=new Hb(r({softDecode:this.softDecode,isLive:t.isLive,media:n,startTime:t.startTime,url:t.url},a)),this.softDecode||ry.defineGetterOrSetter(this.player,{url:{get:function(){var t,r;return null===(t=e.hls)||void 0===t||null===(r=t.media)||void 0===r?void 0:r.src},configurable:!0}}),this.softDecode&&(this.pluginExtension=new qb(r({isLive:t.isLive,media:n},a),this),this.player.forceDegradeToVideo=function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return null===(t=e.pluginExtension)||void 0===t?void 0:t.forceDegradeToVideo.apply(t,n)}),t.isLive)null===(s=this.player)||void 0===s||s.useHooks("replay",(function(){var t;return null===(t=e.hls)||void 0===t?void 0:t.replay()}));this.on("urlchange",u),this.on("switch_subtitle",this._onSwitchSubtitle),this.on("destroy",this.destroy.bind(this)),this._transError(),this._transCoreEvent(gg.TTFB),this._transCoreEvent(gg.LOAD_START),this._transCoreEvent(gg.LOAD_RESPONSE_HEADERS),this._transCoreEvent(gg.LOAD_COMPLETE),this._transCoreEvent(gg.LOAD_RETRY),this._transCoreEvent(gg.SOURCEBUFFER_CREATED),this._transCoreEvent(gg.MEDIASOURCE_OPENED),this._transCoreEvent(gg.APPEND_BUFFER),this._transCoreEvent(gg.REMOVE_BUFFER),this._transCoreEvent(gg.BUFFEREOS),this._transCoreEvent(gg.KEYFRAME),this._transCoreEvent(gg.METADATA_PARSED),this._transCoreEvent(gg.DEMUXED_TRACK),this._transCoreEvent(gg.SEI),this._transCoreEvent(gg.SEI_IN_TIME),this._transCoreEvent(gg.SPEED),this._transCoreEvent(gg.HLS_MANIFEST_LOADED),this._transCoreEvent(gg.HLS_LEVEL_LOADED),this._transCoreEvent(gg.STREAM_EXCEPTION),this._transCoreEvent(gg.SWITCH_URL_SUCCESS),this._transCoreEvent(gg.SWITCH_URL_FAILED),this._transCoreEvent(ob.NO_AUDIO_TRACK),this._transCoreEvent(ob.STREAM_PARSED),this._transCoreEvent(ob.SUBTITLE_SEGMENTS),this._transCoreEvent(ob.SUBTITLE_PLAYLIST),this._transCoreEvent(ob.APPEND_COST),t.url&&this.hls.load(t.url,{reuseMse:!0}).catch((function(e){}))}}},{key:"destroy",value:function(){var e;this.hls&&(this.hls.destroy(),this.hls=null),null===(e=this.pluginExtension)||void 0===e||e.destroy(),this.pluginExtension=null}},{key:"_transError",value:function(){var e=this;this.hls.on(ob.ERROR,(function(t){e.player&&e.player.emit("error",new Xm(e.player,t))}))}},{key:"_transCoreEvent",value:function(e){var t=this;this.hls.on(e,(function(n){t.player&&(t.player.emit("core_event",r(r({},n),{},{eventName:e})),e===gg.SEI_IN_TIME&&t.hls.hasSubtitle&&t._emitSeiPaylodTime(n))}))}},{key:"_emitSeiPaylodTime",value:function(e){try{var t=JSON.parse(Array.from(e.data.payload).map((function(e){return String.fromCharCode(e)})).join("").slice(0,-1));if(!t.rtmp_dts)return;this.player.emit("core_event",{eventName:ob.SEI_PAYLOAD_TIME,time:t.rtmp_dts})}catch(r){}}}],[{key:"pluginName",get:function(){return"hls"}},{key:"isSupported",value:function(e,t){return Hb.isSupported(e,t)}}]),n}(ry);l(Kb,"Hls",Hb),l(Kb,"EVENT",ob);var Wb=window.VePlayer.DynamicModule;VePlayer.registerPlugin(Wb.PluginHls,{HlsPlugin:Kb}),e.HlsPlugin=Kb}));
|