vendor: 4,116 bytes, line 1
1var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function l(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var u={},d=[],f=()=>{},p=()=>!1,m=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),h=e=>e.startsWith(`onUpdate:`),g=Object.assign,_=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},v=Object.prototype.hasOwnProperty,y=(e,t)=>v.call(e,t),b=Array.isArray,x=e=>A(e)===`[object Map]`,S=e=>A(e)===`[object Set]`,C=e=>A(e)===`[object Date]`,w=e=>typeof e==`function`,T=e=>typeof e==`string`,E=e=>typeof e==`symbol`,D=e=>typeof e==`object`&&!!e,O=e=>(D(e)||w(e))&&w(e.then)&&w(e.catch),k=Object.prototype.toString,A=e=>k.call(e),j=e=>A(e).slice(8,-1),M=e=>A(e)===`[object Object]`,N=e=>T(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,ee=l(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),P=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},F=/-\w/g,te=P(e=>e.replace(F,e=>e.slice(1).toUpperCase())),ne=/\B([A-Z])/g,re=P(e=>e.replace(ne,`-$1`).toLowerCase()),ie=P(e=>e.charAt(0).toUpperCase()+e.slice(1)),ae=P(e=>e?`on${ie(e)}`:``),oe=(e,t)=>!Object.is(e,t),se=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},ce=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},le=e=>{let t=parseFloat(e);return isNaN(t)?e:t},ue,de=()=>ue||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function fe(e){if(b(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=T(r)?ge(r):fe(r);if(i)for(let e in i)t[e]=i[e]}return t}else if(T(e)||D(e))return e}var pe=/;(?![^(]*\))/g,me=/:([^]+)/,he=/\/\*[^]*?\*\//g;function ge(e){let t={};return e.replace(he,``).split(pe).forEach(e=>{if(e){let n=e.split(me);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function _e(e){let t=``;if(T(e))t=e;else if(b(e))for(let n=0;n<e.length;n++){let r=_e(e[n]);r&&(t+=r+` `)}else if(D(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var ve=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,ye=l(ve);ve+``;function be(e){return!!e||e===``}function xe(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Se(e[r],t[r]);return n}function Se(e,t){if(e===t)return!0;let n=C(e),r=C(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=E(e),r=E(t),n||r)return e===t;if(n=b(e),r=b(t),n||r)return n&&r?xe(e,t):!1;if(n=D(e),r=D(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e){let r=e.hasOwnProperty(n),i=t.hasOwnProperty(n);if(r&&!i||!r&&i||!Se(e[n],t[n]))return!1}}return String(e)===String(t)}function Ce(e,t){return e.findIndex(e=>Se(e,t))}var we=e=>!!(e&&e.__v_isRef===!0),I=e=>T(e)?e:e==null?``:b(e)||D(e)&&(e.toString===k||!w(e.toString))?we(e)?I(e.value):JSON.stringify(e,Te,2):String(e),Te=(e,t)=>
vendor: 5,614 bytes, line 1
1we(t)?Te(e,t.value):x(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Ee(t,r)+` =>`]=n,e),{})}:S(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Ee(e))}:E(t)?Ee(t):D(t)&&!b(t)&&!M(t)?String(t):t,Ee=(e,t=``)=>E(e)?`Symbol(${e.description??t})`:e,De,Oe=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=De,!e&&De&&(this.index=(De.scopes||=[]).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){let t=De;try{return De=this,e()}finally{De=t}}}on(){++this._on===1&&(this.prevScope=De,De=this)}off(){this._on>0&&--this._on===0&&(De=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function ke(){return De}var Ae,je=new WeakSet,Me=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,De&&De.active&&De.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,je.has(this)&&(je.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ie(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Ye(this),ze(this);let e=Ae,t=Ge;Ae=this,Ge=!0;try{return this.fn()}finally{Be(this),Ae=e,Ge=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Ue(e);this.deps=this.depsTail=void 0,Ye(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?je.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ve(this)&&this.run()}get dirty(){return Ve(this)}},Ne=0,Pe,Fe;function Ie(e,t=!1){if(e.flags|=8,t){e.next=Fe,Fe=e;return}e.next=Pe,Pe=e}function Le(){Ne++}function Re(){if(--Ne>0)return;if(Fe){let e=Fe;for(Fe=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Pe;){let t=Pe;for(Pe=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function ze(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Be(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Ue(r),We(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Ve(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(He(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function He(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Xe)||(e.globalVersion=Xe,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ve(e))))return;e.flags|=2;let t=e.dep,n=Ae,r=Ge;Ae=e,Ge=!0;try{ze(e);let n=e.fn(e._value);(t.version===0||oe(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{Ae=n,Ge=r,Be(e),e.flags&=-3}}function Ue(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Ue(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function We(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var Ge=!0,Ke=[];function qe(){Ke.push(Ge),Ge=!1}function Je(){let e=Ke.pop();Ge=e===void 0?!0:e}function Ye(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=Ae;Ae=void 0;try{t()}finally{Ae=e}}}var Xe=0,Ze=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},Qe=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Ae||!Ge||Ae===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Ae)t=this.activeLink=new Ze(Ae,this),Ae.deps?(t.prevDep=Ae.depsTail,Ae.depsTail.nextDep=t,Ae.depsTail=t):Ae.deps=Ae.depsTail=t,$e(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=Ae.depsTail,t.nextDep=void 0,Ae.depsTail.nextDep=t,Ae.depsTail=t,Ae.deps===t&&(Ae.deps=e)}return t}trigger(e){this.version++,Xe++,this.notify(e)}notify(e){Le();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Re()}}};function $e(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)$e(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var et=new WeakMap,tt=Symbol(``),nt=Symbol(``),rt=Symbol(``);function it(e,t,n){if(Ge&&Ae){let t=et.get(e);t||et.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new Qe),r.map=t,r.key=n),r.track()}}function at(e,t,n,r,i,a){let o=et.get(e);if(!o){Xe++;return}let s=e=>{e&&e.trigger()};
vendor: 1,203 bytes, line 1
1if(Le(),t===`clear`)o.forEach(s);else{let i=b(e),a=i&&N(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===rt||!E(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(rt)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(tt)),x(e)&&s(o.get(nt)));break;case`delete`:i||(s(o.get(tt)),x(e)&&s(o.get(nt)));break;case`set`:x(e)&&s(o.get(tt));break}}Re()}function ot(e){let t=Jt(e);return t===e?t:(it(t,`iterate`,rt),Kt(e)?t:t.map(Xt))}function st(e){return it(e=Jt(e),`iterate`,rt),e}function ct(e,t){return Gt(e)?Zt(Wt(e)?Xt(t):t):Xt(t)}var lt={__proto__:null,[Symbol.iterator](){return ut(this,Symbol.iterator,e=>ct(this,e))},concat(...e){return ot(this).concat(...e.map(e=>b(e)?ot(e):e))},entries(){return ut(this,`entries`,e=>(e[1]=ct(this,e[1]),e))},every(e,t){return ft(this,`every`,e,t,void 0,arguments)},filter(e,t){return ft(this,`filter`,e,t,e=>e.map(e=>ct(this,e)),arguments)},find(e,t){return ft(this,`find`,e,t,e=>ct(this,e),arguments)},findIndex(e,t){return ft(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return ft(this,`findLast`,e,t,e=>ct(this,e),arguments)},findLastIndex(e,t){return ft(this,`findLastIndex`,e,t,void 0,arguments)}
vendor: 4,188 bytes, line 1
1,forEach(e,t){return ft(this,`forEach`,e,t,void 0,arguments)},includes(...e){return mt(this,`includes`,e)},indexOf(...e){return mt(this,`indexOf`,e)},join(e){return ot(this).join(e)},lastIndexOf(...e){return mt(this,`lastIndexOf`,e)},map(e,t){return ft(this,`map`,e,t,void 0,arguments)},pop(){return ht(this,`pop`)},push(...e){return ht(this,`push`,e)},reduce(e,...t){return pt(this,`reduce`,e,t)},reduceRight(e,...t){return pt(this,`reduceRight`,e,t)},shift(){return ht(this,`shift`)},some(e,t){return ft(this,`some`,e,t,void 0,arguments)},splice(...e){return ht(this,`splice`,e)},toReversed(){return ot(this).toReversed()},toSorted(e){return ot(this).toSorted(e)},toSpliced(...e){return ot(this).toSpliced(...e)},unshift(...e){return ht(this,`unshift`,e)},values(){return ut(this,`values`,e=>ct(this,e))}};function ut(e,t,n){let r=st(e),i=r[t]();return r!==e&&!Kt(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var dt=Array.prototype;function ft(e,t,n,r,i,a){let o=st(e),s=o!==e&&!Kt(e),c=o[t];if(c!==dt[t]){let t=c.apply(e,a);return s?Xt(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,ct(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function pt(e,t,n,r){let i=st(e),a=i!==e&&!Kt(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=ct(e,t)),n.call(this,t,ct(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?ct(e,c):c}function mt(e,t,n){let r=Jt(e);it(r,`iterate`,rt);let i=r[t](...n);return(i===-1||i===!1)&&qt(n[0])?(n[0]=Jt(n[0]),r[t](...n)):i}function ht(e,t,n=[]){qe(),Le();let r=Jt(e)[t].apply(e,n);return Re(),Je(),r}var gt=l(`__proto__,__v_isRef,__isVue`),_t=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(E));function vt(e){E(e)||(e=String(e));let t=Jt(this);return it(t,`has`,e),t.hasOwnProperty(e)}var yt=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Lt:It:i?Ft:Pt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=b(e);if(!r){let e;if(a&&(e=lt[t]))return e;if(t===`hasOwnProperty`)return vt}let o=Reflect.get(e,t,Qt(e)?e:n);if((E(t)?_t.has(t):gt(t))||(r||it(e,`get`,t),i))return o;if(Qt(o)){let e=a&&N(t)?o:o.value;return r&&D(e)?Ht(e):e}return D(o)?r?Ht(o):Bt(o):o}},bt=class extends yt{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=b(e)&&N(t);if(!this._isShallow){let e=Gt(i);if(!Kt(n)&&!Gt(n)&&(i=Jt(i),n=Jt(n)),!a&&Qt(i)&&!Qt(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:y(e,t),s=Reflect.set(e,t,n,Qt(e)?e:r);return e===Jt(r)&&(o?oe(n,i)&&at(e,`set`,t,n,i):at(e,`add`,t,n)),s}deleteProperty(e,t){let n=y(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&at(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!E(t)||!_t.has(t))&&it(e,`has`,t),n}ownKeys(e){return it(e,`iterate`,b(e)?`length`:tt),Reflect.ownKeys(e)}},xt=class extends yt{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},St=new bt,Ct=new xt,wt=new bt(!0),Tt=e=>e,Et=e=>Reflect.getPrototypeOf(e);function Dt(e,t,n){return function(...r){let i=this.__v_raw,a=Jt(i),o=x(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,l=i[e](...r),u=n?Tt:t?Zt:Xt;return!t&&it(a,`iterate`,c?nt:tt),g(Object.create(l),{next(){let{value:e,done:t}=l.next();return t?{value:e,done:t}:{value:s?[u(e[0]),u(e[1])]:u(e),done:t}}})}}function Ot(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function kt(e,t){let n={get(n){let r=this.__v_raw,i=Jt(r),a=Jt(n);e||(oe(n,a)&&it(i,`get`,n),it(i,`get`,a));let{has:o}=Et(i),s=t?Tt:e?Zt:Xt;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&it(Jt(t),`iterate`,tt),t.size},has(t){let n=this.__v_raw,r=Jt(n),i=Jt(t);return e||(oe(t,i)&&it(r,`has`,t),it(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)}
vendor: 13,531 bytes, line 1
1,forEach(n,r){let i=this,a=i.__v_raw,o=Jt(a),s=t?Tt:e?Zt:Xt;return!e&&it(o,`iterate`,tt),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return g(n,e?{add:Ot(`add`),set:Ot(`set`),delete:Ot(`delete`),clear:Ot(`clear`)}:{add(e){let n=Jt(this),r=Et(n),i=Jt(e),a=!t&&!Kt(e)&&!Gt(e)?i:e;return r.has.call(n,a)||oe(e,a)&&r.has.call(n,e)||oe(i,a)&&r.has.call(n,i)||(n.add(a),at(n,`add`,a,a)),this},set(e,n){!t&&!Kt(n)&&!Gt(n)&&(n=Jt(n));let r=Jt(this),{has:i,get:a}=Et(r),o=i.call(r,e);o||=(e=Jt(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?oe(n,s)&&at(r,`set`,e,n,s):at(r,`add`,e,n),this},delete(e){let t=Jt(this),{has:n,get:r}=Et(t),i=n.call(t,e);i||=(e=Jt(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&at(t,`delete`,e,void 0,a),o},clear(){let e=Jt(this),t=e.size!==0,n=e.clear();return t&&at(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=Dt(r,e,t)}),n}function At(e,t){let n=kt(e,t);return(t,r,i)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(y(n,r)&&r in t?n:t,r,i)}var jt={get:At(!1,!1)},Mt={get:At(!1,!0)},Nt={get:At(!0,!1)},Pt=new WeakMap,Ft=new WeakMap,It=new WeakMap,Lt=new WeakMap;function Rt(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function zt(e){return e.__v_skip||!Object.isExtensible(e)?0:Rt(j(e))}function Bt(e){return Gt(e)?e:Ut(e,!1,St,jt,Pt)}function Vt(e){return Ut(e,!1,wt,Mt,Ft)}function Ht(e){return Ut(e,!0,Ct,Nt,It)}function Ut(e,t,n,r,i){if(!D(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let a=zt(e);if(a===0)return e;let o=i.get(e);if(o)return o;let s=new Proxy(e,a===2?r:n);return i.set(e,s),s}function Wt(e){return Gt(e)?Wt(e.__v_raw):!!(e&&e.__v_isReactive)}function Gt(e){return!!(e&&e.__v_isReadonly)}function Kt(e){return!!(e&&e.__v_isShallow)}function qt(e){return e?!!e.__v_raw:!1}function Jt(e){let t=e&&e.__v_raw;return t?Jt(t):e}function Yt(e){return!y(e,`__v_skip`)&&Object.isExtensible(e)&&ce(e,`__v_skip`,!0),e}var Xt=e=>D(e)?Bt(e):e,Zt=e=>D(e)?Ht(e):e;function Qt(e){return e?e.__v_isRef===!0:!1}function L(e){return en(e,!1)}function $t(e){return en(e,!0)}function en(e,t){return Qt(e)?e:new tn(e,t)}var tn=class{constructor(e,t){this.dep=new Qe,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Jt(e),this._value=t?e:Xt(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Kt(e)||Gt(e);e=n?e:Jt(e),oe(e,t)&&(this._rawValue=e,this._value=n?e:Xt(e),this.dep.trigger())}};function nn(e){return Qt(e)?e.value:e}var rn={get:(e,t,n)=>t===`__v_raw`?e:nn(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return Qt(i)&&!Qt(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function an(e){return Wt(e)?e:new Proxy(e,rn)}var on=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Qe(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Xe-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Ae!==this)return Ie(this,!0),!0}get value(){let e=this.dep.track();return He(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function sn(e,t,n=!1){let r,i;return w(e)?r=e:(r=e.get,i=e.set),new on(r,i,n)}var cn={},ln=new WeakMap,un=void 0;function dn(e,t=!1,n=un){if(n){let t=ln.get(n);t||ln.set(n,t=[]),t.push(e)}}function fn(e,t,n=u){let{immediate:r,deep:i,once:a,scheduler:o,augmentJob:s,call:c}=n,l=e=>i?e:Kt(e)||i===!1||i===0?pn(e,1):pn(e),d,p,m,h,g=!1,v=!1;if(Qt(e)?(p=()=>e.value,g=Kt(e)):Wt(e)?(p=()=>l(e),g=!0):b(e)?(v=!0,g=e.some(e=>Wt(e)||Kt(e)),p=()=>e.map(e=>{if(Qt(e))return e.value;if(Wt(e))return l(e);if(w(e))return c?c(e,2):e()})):p=w(e)?t?c?()=>c(e,2):e:()=>{if(m){qe();try{m()}finally{Je()}}let t=un;un=d;try{return c?c(e,3,[h]):e(h)}finally{un=t}}:f,t&&i){let e=p,t=i===!0?1/0:i;p=()=>pn(e(),t)}let y=ke(),x=()=>{d.stop(),y&&y.active&&_(y.effects,d)};if(a&&t){let e=t;t=(...t)=>{e(...t),x()}}let S=v?Array(e.length).fill(cn):cn,C=e=>{if(!(!(d.flags&1)||!d.dirty&&!e))if(t){let e=d.run();if(i||g||(v?e.some((e,t)=>oe(e,S[t])):oe(e,S))){m&&m();let n=un;un=d;try{let n=[e,S===cn?void 0:v&&S[0]===cn?[]:S,h];S=e,c?c(t,3,n):t(...n)}finally{un=n}}}else d.run()};return s&&s(C),d=new Me(p),d.scheduler=o?()=>o(C,!1):C,h=e=>dn(e,!1,d),m=d.onStop=()=>{let e=ln.get(d);if(e){if(c)c(e,4);else for(let t of e)t();ln.delete(d)}},t?r?C(!0):S=d.run():o?o(C.bind(null,!0),!0):d.run(),x.pause=d.pause.bind(d),x.resume=d.resume.bind(d),x.stop=x,x}function pn(e,t=1/0,n){if(t<=0||!D(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Qt(e))pn(e.value,t,n);else if(b(e))for(let r=0;r<e.length;r++)pn(e[r],t,n);else if(S(e)||x(e))e.forEach(e=>{pn(e,t,n)});else if(M(e)){for(let r in e)pn(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&pn(e[r],t,n)}return e}function mn(e,t,n,r){try{return r?e(...r):e()}catch(e){gn(e,t,n)}}function hn(e,t,n,r){if(w(e)){let i=mn(e,t,n,r);return i&&O(i)&&i.catch(e=>{gn(e,t,n)}),i}if(b(e)){let i=[];for(let a=0;a<e.length;a++)i.push(hn(e[a],t,n,r));return i}}function gn(e,t,n,r=!0){let i=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||u;if(t){let r=t.parent,i=t.proxy,o=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,i,o)===!1)return}r=r.parent}if(a){qe(),mn(a,null,10,[e,i,o]),Je();return}}_n(e,n,i,r,o)}function _n(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var vn=[],yn=-1,bn=[],xn=null,Sn=0,Cn=Promise.resolve(),wn=null;function Tn(e){let t=wn||Cn;return e?t.then(this?e.bind(this):e):t}function En(e){let t=yn+1,n=vn.length;for(;t<n;){let r=t+n>>>1,i=vn[r],a=Mn(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function Dn(e){if(!(e.flags&1)){let t=Mn(e),n=vn[vn.length-1];!n||!(e.flags&2)&&t>=Mn(n)?vn.push(e):vn.splice(En(t),0,e),e.flags|=1,On()}}function On(){wn||=Cn.then(Nn)}function kn(e){b(e)?bn.push(...e):xn&&e.id===-1?xn.splice(Sn+1,0,e):e.flags&1||(bn.push(e),e.flags|=1),On()}function An(e,t,n=yn+1){for(;n<vn.length;n++){let t=vn[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;vn.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function jn(e){if(bn.length){let e=[...new Set(bn)].sort((e,t)=>Mn(e)-Mn(t));if(bn.length=0,xn){xn.push(...e);return}for(xn=e,Sn=0;Sn<xn.length;Sn++){let e=xn[Sn];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}xn=null,Sn=0}}var Mn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Nn(e){try{for(yn=0;yn<vn.length;yn++){let e=vn[yn];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),mn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;yn<vn.length;yn++){let e=vn[yn];e&&(e.flags&=-2)}yn=-1,vn.length=0,jn(e),wn=null,(vn.length||bn.length)&&Nn(e)}}var Pn=null,Fn=null;function In(e){let t=Pn;return Pn=e,Fn=e&&e.type.__scopeId||null,t}function Ln(e,t=Pn,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&Ji(-1);let i=In(t),a;try{a=e(...n)}finally{In(i),r._d&&Ji(1)}return a};return r._n=!0,r._c=!0,r._d=!0,r}function Rn(e,t){if(Pn===null)return e;let n=ja(Pn),r=e.dirs||=[];for(let e=0;e<t.length;e++){let[i,a,o,s=u]=t[e];i&&(w(i)&&(i={mounted:i,updated:i}),i.deep&&pn(a),r.push({dir:i,instance:n,value:a,oldValue:void 0,arg:o,modifiers:s}))}return e}function zn(e,t,n,r){let i=e.dirs,a=t&&t.dirs;for(let o=0;o<i.length;o++){let s=i[o];a&&(s.oldValue=a[o].value);let c=s.dir[r];c&&(qe(),hn(c,n,8,[e.el,s,e,t]),Je())}}function Bn(e,t){if(ha){let n=ha.provides,r=ha.parent&&ha.parent.provides;r===n&&(n=ha.provides=Object.create(r)),n[e]=t}}function Vn(e,t,n=!1){let r=ga();if(r||Zr){let i=Zr?Zr._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&w(t)?t.call(r&&r.proxy):t}}var Hn=Symbol.for(`v-scx`),Un=()=>Vn(Hn);function Wn(e,t,n){return Gn(e,t,n)}function Gn(e,t,n=u){let{immediate:r,deep:i,flush:a,once:o}=n,s=g({},n),c=t&&r||!t&&a!==`post`,l;if(Sa){if(a===`sync`){let e=Un();l=e.__watcherHandles||=[]}else if(!c){let e=()=>{};return e.stop=f,e.resume=f,e.pause=f,e}}let d=ha;s.call=(e,t,n)=>hn(e,d,t,n);let p=!1;a===`post`?s.scheduler=e=>{Oi(e,d&&d.suspense)}:a!==`sync`&&(p=!0,s.scheduler=(e,t)=>{t?e():Dn(e)}),s.augmentJob=e=>{t&&(e.flags|=4),p&&(e.flags|=2,d&&(e.id=d.uid,e.i=d))};let m=fn(e,t,s);return Sa&&(l?l.push(m):c&&m()),m}function Kn(e,t,n){let r=this.proxy,i=T(e)?e.includes(`.`)?qn(r,e):()=>r[e]:e.bind(r,r),a;w(t)?a=t:(a=t.handler,n=t);let o=ya(this),s=Gn(i,a.bind(r),n);return o(),s}function qn(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var Jn=Symbol(`_vte`),Yn=e=>e.__isTeleport,Xn=Symbol(`_leaveCb`);function Zn(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Zn(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Qn(e,t){return w(e)?g({name:e.name},t,{setup:e}):e}function $n(e){e.ids=[e.ids[0]+ e.ids[2]+++`-`,0,0]}function er(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var tr=new WeakMap;function nr(e,t,n,r,i=!1){if(b(e)){e.forEach((e,a)=>nr(e,t&&(b(t)?t[a]:t),n,r,i));return}if(ir(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&nr(e,t,n,r.component.subTree);return}let a=r.shapeFlag&4?ja(r.component):r.el,o=i?null:a,{i:s,r:c}=e,l=t&&t.r,d=s.refs===u?s.refs={}:s.refs,f=s.setupState,m=Jt(f),h=f===u?p:e=>er(d,e)?!1:y(m,e),g=(e,t)=>!(t&&er(d,t));if(l!=null&&l!==c){if(rr(t),T(l))d[l]=null,h(l)&&(f[l]=null);else if(Qt(l)){let e=t;g(l,e.k)&&(l.value=null),e.k&&(d[e.k]=null)}}if(w(c))mn(c,s,12,[o,d]);else{let t=T(c),r=Qt(c);if(t||r){let s=()=>{if(e.f){let n=t?h(c)?f[c]:d[c]:g(c)||!e.k?c.value:d[e.k];if(i)b(n)&&_(n,a);else if(b(n))n.includes(a)||n.push(a);else if(t)d[c]=[a],h(c)&&(f[c]=d[c]);else{let t=[a];g(c,e.k)&&(c.value=t),e.k&&(d[e.k]=t)}}else t?(d[c]=o,h(c)&&(f[c]=o)):r&&(g(c,e.k)&&(c.value=o),e.k&&(d[e.k]=o))};if(o){let t=()=>{s(),tr.delete(e)};t.id=-1,tr.set(e,t),Oi(t,n)}else rr(e),s()}}}function rr(e){let t=tr.get(e);t&&(t.flags|=8,tr.delete(e))}de().requestIdleCallback,de().cancelIdleCallback;var ir=e=>!!e.type.__asyncLoader,ar=e=>e.type.__isKeepAlive;function or(e,t){cr(e,`a`,t)}function sr(e,t){cr(e,`da`,t)}function cr(e,t,n=ha){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(ur(t,r,n),n){let e=n.parent;for(;e&&e.parent;)ar(e.parent.vnode)&&lr(r,t,n,e),e=e.parent}}function lr(e,t,n,r){let i=ur(t,e,r,!0);_r(()=>{_(r[t],i)},n)}function ur(e,t,n=ha,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{qe();let i=ya(n),a=hn(t,n,e,r);return i(),Je(),a};return r?i.unshift(a):i.push(a),a}}var dr=e=>(t,n=ha)=>{(!Sa||e===`sp`)&&ur(e,(...e)=>t(...e),n)},fr=dr(`bm`),pr=dr(`m`),mr=dr(`bu`),hr=dr(`u`),gr=dr(`bum`),_r=dr(`um`),vr=dr(`sp`),yr=dr(`rtg`),br=dr(`rtc`);function xr(e,t=ha){ur(`ec`,e,t)}var Sr=`components`;function Cr(e,t){return Tr(Sr,e,!0,t)||e}var wr=Symbol.for(`v-ndc`);function Tr(e,t,n=!0,r=!1){let i=Pn||ha;if(i){let n=i.type;if(e===Sr){let e=Ma(n,!1);if(e&&(e===t||e===te(t)||e===ie(te(t))))return n}let a=Er(i[e]||n[e],t)||Er(i.appContext[e],t);return!a&&r?n:a}}function Er(e,t){return e&&(e[t]||e[te(t)]||e[ie(te(t))])}function Dr(e,t,n,r){let i,a=n&&n[r],o=b(e);if(o||T(e)){let n=o&&Wt(e),r=!1,s=!1;n&&(r=!Kt(e),s=Gt(e),e=st(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?Zt(Xt(e[n])):Xt(e[n]):e[n],n,void 0,a&&a[n])}else if(typeof e==`number`){i=Array(e);for(let n=0;n<e;n++)i[n]=t(n+1,n,void 0,a&&a[n])}else if(D(e))if(e[Symbol.iterator])i=Array.from(e,(e,n)=>t(e,n,void 0,a&&a[n]));else{let n=Object.keys(e);i=Array(n.length);for(let r=0,o=n.length;r<o;r++){let o=n[r];i[r]=t(e[o],o,r,a&&a[r])}}else i=[];return n&&(n[r]=i),i}var Or=e=>e?xa(e)?ja(e):Or(e.parent):null,kr=g(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Or(e.parent),$root:e=>Or(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Rr(e),$forceUpdate:e=>e.f||=()=>{Dn(e.update)},$nextTick:e=>e.n||=Tn.bind(e.proxy),$watch:e=>Kn.bind(e)}),Ar=(e,t)=>e!==u&&!e.__isScriptSetup&&y(e,t),jr={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:r,data:i,props:a,accessCache:o,type:s,appContext:c}=e;if(t[0]!==`$`){let e=o[t];if(e!==void 0)switch(e){case 1:return r[t];case 2:return i[t];case 4:return n[t];case 3:return a[t]}else if(Ar(r,t))return o[t]=1,r[t];else if(i!==u&&y(i,t))return o[t]=2,i[t];else if(y(a,t))return o[t]=3,a[t];else if(n!==u&&y(n,t))return o[t]=4,n[t];else Nr&&(o[t]=0)}let l=kr[t],d,f;if(l)return t===`$attrs`&&it(e.attrs,`get`,``),l(e);if((d=s.__cssModules)&&(d=d[t]))return d;if(n!==u&&y(n,t))return o[t]=4,n[t];if(f=c.config.globalProperties,y(f,t))return f[t]},set({_:e},t,n){let{data:r,setupState:i,ctx:a}=e;return Ar(i,t)?(i[t]=n,!0):r!==u&&y(r,t)?(r[t]=n,!0):y(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:i,props:a,type:o}},s){let c;return!!(n[s]||e!==u&&s[0]!==`$`&&y(e,s)||Ar(t,s)||y(a,s)||y(r,s)||y(kr,s)||y(i.config.globalProperties,s)||(c=o.__cssModules)&&c[s])},defineProperty(e,t,n){return n.get==null?y(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function Mr(e){return b(e)?e.reduce((e,t)=>
vendor: 14,353 bytes, line 1
1(e[t]=null,e),{}):e}var Nr=!0;function Pr(e){let t=Rr(e),n=e.proxy,r=e.ctx;Nr=!1,t.beforeCreate&&Ir(t.beforeCreate,e,`bc`);let{data:i,computed:a,methods:o,watch:s,provide:c,inject:l,created:u,beforeMount:d,mounted:p,beforeUpdate:m,updated:h,activated:g,deactivated:_,beforeDestroy:v,beforeUnmount:y,destroyed:x,unmounted:S,render:C,renderTracked:T,renderTriggered:E,errorCaptured:O,serverPrefetch:k,expose:A,inheritAttrs:j,components:M,directives:N,filters:ee}=t;if(l&&Fr(l,r,null),o)for(let e in o){let t=o[e];w(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);D(t)&&(e.data=Bt(t))}if(Nr=!0,a)for(let e in a){let t=a[e],i=U({get:w(t)?t.bind(n,n):w(t.get)?t.get.bind(n,n):f,set:!w(t)&&w(t.set)?t.set.bind(n):f});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e})}if(s)for(let e in s)Lr(s[e],r,n,e);if(c){let e=w(c)?c.call(n):c;Reflect.ownKeys(e).forEach(t=>{Bn(t,e[t])})}u&&Ir(u,e,`c`);function P(e,t){b(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(P(fr,d),P(pr,p),P(mr,m),P(hr,h),P(or,g),P(sr,_),P(xr,O),P(br,T),P(yr,E),P(gr,y),P(_r,S),P(vr,k),b(A))if(A.length){let t=e.exposed||={};A.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={};C&&e.render===f&&(e.render=C),j!=null&&(e.inheritAttrs=j),M&&(e.components=M),N&&(e.directives=N),k&&$n(e)}function Fr(e,t,n=f){b(e)&&(e=Ur(e));for(let n in e){let r=e[n],i;i=D(r)?`default`in r?Vn(r.from||n,r.default,!0):Vn(r.from||n):Vn(r),Qt(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function Ir(e,t,n){hn(b(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function Lr(e,t,n,r){let i=r.includes(`.`)?qn(n,r):()=>n[r];if(T(e)){let n=t[e];w(n)&&Wn(i,n)}else if(w(e))Wn(i,e.bind(n));else if(D(e))if(b(e))e.forEach(e=>Lr(e,t,n,r));else{let r=w(e.handler)?e.handler.bind(n):t[e.handler];w(r)&&Wn(i,r,e)}}function Rr(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>zr(c,e,o,!0)),zr(c,t,o)),D(t)&&a.set(t,c),c}function zr(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&zr(e,a,n,!0),i&&i.forEach(t=>zr(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=Br[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var Br={data:Vr,props:Kr,emits:Kr,methods:Gr,computed:Gr,beforeCreate:Wr,created:Wr,beforeMount:Wr,mounted:Wr,beforeUpdate:Wr,updated:Wr,beforeDestroy:Wr,beforeUnmount:Wr,destroyed:Wr,unmounted:Wr,activated:Wr,deactivated:Wr,errorCaptured:Wr,serverPrefetch:Wr,components:Gr,directives:Gr,watch:qr,provide:Vr,inject:Hr};function Vr(e,t){return t?e?function(){return g(w(e)?e.call(this,this):e,w(t)?t.call(this,this):t)}:t:e}function Hr(e,t){return Gr(Ur(e),Ur(t))}function Ur(e){if(b(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Wr(e,t){return e?[...new Set([].concat(e,t))]:t}function Gr(e,t){return e?g(Object.create(null),e,t):t}function Kr(e,t){return e?b(e)&&b(t)?[...new Set([...e,...t])]:g(Object.create(null),Mr(e),Mr(t??{})):t}function qr(e,t){if(!e)return t;if(!t)return e;let n=g(Object.create(null),e);for(let r in t)n[r]=Wr(e[r],t[r]);return n}function Jr(){return{app:null,config:{isNativeTag:p,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var Yr=0;function Xr(e,t){return function(n,r=null){w(n)||(n=g({},n)),r!=null&&!D(r)&&(r=null);let i=Jr(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:Yr++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:Fa,get config(){return i.config},set config(e){},use(e,...t){return a.has(e)||(e&&w(e.install)?(a.add(e),e.install(c,...t)):w(e)&&(a.add(e),e(c,...t))),c},mixin(e){return i.mixins.includes(e)||i.mixins.push(e),c},component(e,t){return t?(i.components[e]=t,c):i.components[e]},directive(e,t){return t?(i.directives[e]=t,c):i.directives[e]},mount(a,o,l){if(!s){let u=c._ceVNode||H(n,r);return u.appContext=i,l===!0?l=`svg`:l===!1&&(l=void 0),o&&t?t(u,a):e(u,a,l),s=!0,c._container=a,a.__vue_app__=c,ja(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(hn(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(e,t){return i.provides[e]=t,c},runWithContext(e){let t=Zr;Zr=c;try{return e()}finally{Zr=t}}};return c}}var Zr=null,Qr=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${te(t)}Modifiers`]||e[`${re(t)}Modifiers`];function $r(e,t,...n){if(e.isUnmounted)return;let r=e.vnode.props||u,i=n,a=t.startsWith(`update:`),o=a&&Qr(r,t.slice(7));o&&(o.trim&&(i=n.map(e=>T(e)?e.trim():e)),o.number&&(i=n.map(le)));let s,c=r[s=ae(t)]||r[s=ae(te(t))];!c&&a&&(c=r[s=ae(re(t))]),c&&hn(c,e,6,i);let l=r[s+`Once`];if(l){if(!e.emitted)e.emitted={};else if(e.emitted[s])return;e.emitted[s]=!0,hn(l,e,6,i)}}var ei=new WeakMap;function ti(e,t,n=!1){let r=n?ei:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!w(e)){let r=e=>{let n=ti(e,t,!0);n&&(s=!0,g(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(D(e)&&r.set(e,null),null):(b(a)?a.forEach(e=>o[e]=null):g(o,a),D(e)&&r.set(e,o),o)}function ni(e,t){return!e||!m(t)?!1:(t=t.slice(2).replace(/Once$/,``),y(e,t[0].toLowerCase()+t.slice(1))||y(e,re(t))||y(e,t))}function ri(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:s,emit:c,render:l,renderCache:u,props:d,data:f,setupState:p,ctx:m,inheritAttrs:g}=e,_=In(e),v,y;try{if(n.shapeFlag&4){let e=i||r,t=e;v=sa(l.call(t,e,u,d,p,f,m)),y=s}else{let e=t;v=sa(e.length>1?e(d,{attrs:s,slots:o,emit:c}):e(d,null)),y=t.props?s:ii(s)}}catch(t){Wi.length=0,gn(t,e,1),v=H(Hi)}let b=v;if(y&&g!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(h)&&(y=ai(y,a)),b=ra(b,y,!1,!0))}return n.dirs&&(b=ra(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&Zn(b,n.transition),v=b,In(_),v}var ii=e=>{let t;for(let n in e)(n===`class`||n===`style`||m(n))&&((t||={})[n]=e[n]);return t},ai=(e,t)=>{let n={};for(let r in e)(!h(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function oi(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?si(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(ci(o,r,n)&&!ni(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?o?si(r,o,l):!0:!!o;return!1}function si(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){let a=r[i];if(ci(t,e,a)&&!ni(n,a))return!0}return!1}function ci(e,t,n){let r=e[n],i=t[n];return n===`style`&&D(r)&&D(i)?!Se(r,i):r!==i}function li({vnode:e,parent:t,suspense:n},r){for(;t;){let n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}var ui={},di=()=>Object.create(ui),fi=e=>Object.getPrototypeOf(e)===ui;function pi(e,t,n,r=!1){let i={},a=di();e.propsDefaults=Object.create(null),hi(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);n?e.props=r?i:Vt(i):e.type.props?e.props=i:e.props=a,e.attrs=a}function mi(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=Jt(i),[c]=e.propsOptions,l=!1;if((r||o>0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let o=n[r];if(ni(e.emitsOptions,o))continue;let u=t[o];if(c)if(y(a,o))u!==a[o]&&(a[o]=u,l=!0);else{let t=te(o);i[t]=gi(c,s,t,u,e,!1)}else u!==a[o]&&(a[o]=u,l=!0)}}}else{hi(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!y(t,a)&&((r=re(a))===a||!y(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=gi(c,s,a,void 0,e,!0)):delete i[a]);if(a!==s)for(let e in a)(!t||!y(t,e))&&(delete a[e],l=!0)}l&&at(e.attrs,`set`,``)}function hi(e,t,n,r){let[i,a]=e.propsOptions,o=!1,s;if(t)for(let c in t){if(ee(c))continue;let l=t[c],u;i&&y(i,u=te(c))?!a||!a.includes(u)?n[u]=l:(s||={})[u]=l:ni(e.emitsOptions,c)||(!(c in r)||l!==r[c])&&(r[c]=l,o=!0)}if(a){let t=Jt(n),r=s||u;for(let o=0;o<a.length;o++){let s=a[o];n[s]=gi(i,t,s,r[s],e,!y(r,s))}}return o}function gi(e,t,n,r,i,a){let o=e[n];if(o!=null){let e=y(o,`default`);if(e&&r===void 0){let e=o.default;if(o.type!==Function&&!o.skipFactory&&w(e)){let{propsDefaults:a}=i;if(n in a)r=a[n];else{let o=ya(i);r=a[n]=e.call(null,t),o()}}else r=e;i.ce&&i.ce._setProp(n,r)}o[0]&&(a&&!e?r=!1:o[1]&&(r===``||r===re(n))&&(r=!0))}return r}var _i=new WeakMap;function vi(e,t,n=!1){let r=n?_i:t.propsCache,i=r.get(e);if(i)return i;let a=e.props,o={},s=[],c=!1;if(!w(e)){let r=e=>{c=!0;let[n,r]=vi(e,t,!0);g(o,n),r&&s.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!a&&!c)return D(e)&&r.set(e,d),d;if(b(a))for(let e=0;e<a.length;e++){let t=te(a[e]);yi(t)&&(o[t]=u)}else if(a)for(let e in a){let t=te(e);if(yi(t)){let n=a[e],r=o[t]=b(n)||w(n)?{type:n}:g({},n),i=r.type,c=!1,l=!0;if(b(i))for(let e=0;e<i.length;++e){let t=i[e],n=w(t)&&t.name;if(n===`Boolean`){c=!0;break}else n===`String`&&(l=!1)}else c=w(i)&&i.name===`Boolean`;r[0]=c,r[1]=l,(c||y(r,`default`))&&s.push(t)}}let l=[o,s];return D(e)&&r.set(e,l),l}function yi(e){return e[0]!==`$`&&!ee(e)}var bi=e=>e===`_`||e===`_ctx`||e===`$stable`,xi=e=>b(e)?e.map(sa):[sa(e)],Si=(e,t,n)=>{if(t._n)return t;let r=Ln((...e)=>xi(t(...e)),n);return r._c=!1,r},Ci=(e,t,n)=>{let r=e._ctx;for(let n in e){if(bi(n))continue;let i=e[n];if(w(i))t[n]=Si(n,i,r);else if(i!=null){let e=xi(i);t[n]=()=>e}}},wi=(e,t)=>{let n=xi(t);e.slots.default=()=>n},Ti=(e,t,n)=>{for(let r in t)(n||!bi(r))&&(e[r]=t[r])},Ei=(e,t,n)=>{let r=e.slots=di();if(e.vnode.shapeFlag&32){let e=t._;e?(Ti(r,t,n),n&&ce(r,`_`,e,!0)):Ci(t,r)}else t&&wi(e,t)},Di=(e,t,n)=>{let{vnode:r,slots:i}=e,a=!0,o=u;if(r.shapeFlag&32){let e=t._;e?n&&e===1?a=!1:Ti(i,t,n):(a=!t.$stable,Ci(t,i)),o=t}else t&&(wi(e,t),o={default:1});if(a)for(let e in i)!bi(e)&&o[e]==null&&delete i[e]},Oi=Bi;function ki(e){return Ai(e)}function Ai(e,t){let n=de();n.__VUE__=!0;let{insert:r,remove:i,patchProp:a,createElement:o,createText:s,createComment:c,setText:l,setElementText:p,parentNode:m,nextSibling:h,setScopeId:g=f,insertStaticContent:_}=e,v=(e,t,n,r=null,i=null,a=null,o=void 0,s=null,c=!!t.dynamicChildren)=>{if(e===t)return;e&&!Qi(e,t)&&(r=pe(e),oe(e,i,a,!0),e=null),t.patchFlag===-2&&(c=!1,t.dynamicChildren=null);let{type:l,ref:u,shapeFlag:d}=t;switch(l){case Vi:y(e,t,n,r);break;case Hi:b(e,t,n,r);break;case Ui:e??x(t,n,r,o);break;case R:j(e,t,n,r,i,a,o,s,c);break;default:d&1?w(e,t,n,r,i,a,o,s,c):d&6?M(e,t,n,r,i,a,o,s,c):(d&64||d&128)&&l.process(e,t,n,r,i,a,o,s,c,ge)}u!=null&&i?nr(u,e&&e.ref,a,t||e,!t):u==null&&e&&e.ref!=null&&nr(e.ref,null,a,e,!0)},y=(e,t,n,i)=>{if(e==null)r(t.el=s(t.children),n,i);else{let n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},b=(e,t,n,i)=>{e==null?r(t.el=c(t.children||``),n,i):t.el=e.el},x=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},S=({el:e,anchor:t},n,i)=>{let a;for(;e&&e!==t;)a=h(e),r(e,n,i),e=a;r(t,n,i)},C=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=h(e),i(e),e=n;i(t)},w=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)T(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),O(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},T=(e,t,n,i,s,c,l,u)=>{let d,f,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(d=e.el=o(e.type,c,m&&m.is,m),h&8?p(d,e.children):h&16&&D(e.children,d,null,i,s,ji(e,c),l,u),_&&zn(e,null,i,`created`),E(d,e,e.scopeId,l,i),m){for(let e in m)e!==`value`&&!ee(e)&&a(d,e,null,m[e],c,i);`value`in m&&a(d,`value`,null,m.value,c),(f=m.onVnodeBeforeMount)&&da(f,i,e)}_&&zn(e,null,i,`beforeMount`);let v=Ni(s,g);v&&g.beforeEnter(d),r(d,t,n),((f=m&&m.onVnodeMounted)||v||_)&&Oi(()=>{try{f&&da(f,i,e),v&&g.enter(d),_&&zn(e,null,i,`mounted`)}finally{}},s)},E=(e,t,n,r,i)=>{if(n&&g(e,n),r)for(let t=0;t<r.length;t++)g(e,r[t]);if(i){let n=i.subTree;if(t===n||zi(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;E(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},D=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++)v(null,e[l]=s?ca(e[l]):sa(e[l]),t,n,r,i,a,o,s)},O=(e,t,n,r,i,o,s)=>{let c=t.el=e.el,{patchFlag:l,dynamicChildren:d,dirs:f}=t;l|=e.patchFlag&16;let m=e.props||u,h=t.props||u,g;if(n&&Mi(n,!1),(g=h.onVnodeBeforeUpdate)&&da(g,n,t,e),f&&zn(t,e,n,`beforeUpdate`),n&&Mi(n,!0),(m.innerHTML&&h.innerHTML==null||m.textContent&&h.textContent==null)&&p(c,``),d?k(e.dynamicChildren,d,c,n,r,ji(t,i),o):s||ne(e,t,c,null,n,r,ji(t,i),o,!1),l>0){if(l&16)A(c,m,h,n,i);else if(l&2&&m.class!==h.class&&a(c,`class`,null,h.class,i),l&4&&a(c,`style`,m.style,h.style,i),l&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],o=m[r],s=h[r];(s!==o||r===`value`)&&a(c,r,o,s,i,n)}}l&1&&e.children!==t.children&&p(c,t.children)}else !s&&d==null&&A(c,m,h,n,i);((g=h.onVnodeUpdated)||f)&&Oi(()=>{g&&da(g,n,t,e),f&&zn(t,e,n,`updated`)},r)},k=(e,t,n,r,i,a,o)=>{for(let s=0;s<t.length;s++){let c=e[s],l=t[s];v(c,l,c.el&&(c.type===R||!Qi(c,l)||c.shapeFlag&198)?m(c.el):n,null,r,i,a,o,!0)}},A=(e,t,n,r,i)=>{if(t!==n){if(t!==u)for(let o in t)!ee(o)&&!(o in n)&&a(e,o,t[o],null,i,r);for(let o in n){if(ee(o))continue;let s=n[o],c=t[o];s!==c&&o!==`value`&&a(e,o,c,s,i,r)}`value`in n&&a(e,`value`,t.value,n.value,i)}},j=(e,t,n,i,a,o,c,l,u)=>{let d=t.el=e?e.el:s(``),f=t.anchor=e?e.anchor:s(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(l=l?l.concat(h):h),e==null?(r(d,n,i),r(f,n,i),D(t.children||[],n,f,a,o,c,l,u)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(k(e.dynamicChildren,m,n,a,o,c,l),(t.key!=null||a&&t===a.subTree)&&Pi(e,t,!0)):ne(e,t,n,f,a,o,c,l,u)},M=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):N(t,n,r,i,a,o,c):P(e,t,c)},N=(e,t,n,r,i,a,o)=>{let s=e.component=ma(e,r,i);if(ar(e)&&(s.ctx.renderer=ge),Ca(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,F,o),!e.el){let r=s.subTree=H(Hi);b(null,r,t,n),e.placeholder=r.el}}else F(s,e,t,n,i,a,o)},P=(e,t,n)=>{let r=t.component=e.component;if(oi(e,t,n))if(r.asyncDep&&!r.asyncResolved){te(r,t,n);return}
vendor: 7,227 bytes, line 1
1else r.next=t,r.update();else t.el=e.el,r.vnode=t},F=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=Ii(e);if(n){t&&(t.el=c.el,te(e,t,o)),n.asyncDep.then(()=>{Oi(()=>{e.isUnmounted||l()},i)});return}}let u=t,d;Mi(e,!1),t?(t.el=c.el,te(e,t,o)):t=c,n&&se(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&da(d,s,t,c),Mi(e,!0);let f=ri(e),p=e.subTree;e.subTree=f,v(p,f,m(p.el),pe(p),e,i,a),t.el=f.el,u===null&&li(e,f.el),r&&Oi(r,i),(d=t.props&&t.props.onVnodeUpdated)&&Oi(()=>da(d,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=ir(t);if(Mi(e,!1),l&&se(l),!m&&(o=c&&c.onVnodeBeforeMount)&&da(o,d,t),Mi(e,!0),s&&ve){let t=()=>{e.subTree=ri(e),ve(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p,e.parent?e.parent.type:void 0);let o=e.subTree=ri(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&Oi(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;Oi(()=>da(o,d,e),i)}(t.shapeFlag&256||d&&ir(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&Oi(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new Me(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>Dn(u),Mi(e,!0),l()},te=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,mi(e,t.props,r,n),Di(e,t.children,n),qe(),An(e),Je()},ne=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,u=e?e.shapeFlag:0,d=t.children,{patchFlag:f,shapeFlag:m}=t;if(f>0){if(f&128){ie(l,d,n,r,i,a,o,s,c);return}else if(f&256){re(l,d,n,r,i,a,o,s,c);return}}m&8?(u&16&&fe(l,i,a),d!==l&&p(n,d)):u&16?m&16?ie(l,d,n,r,i,a,o,s,c):fe(l,i,a,!0):(u&8&&p(n,``),m&16&&D(d,n,r,i,a,o,s,c))},re=(e,t,n,r,i,a,o,s,c)=>{e||=d,t||=d;let l=e.length,u=t.length,f=Math.min(l,u),p;for(p=0;p<f;p++){let r=t[p]=c?ca(t[p]):sa(t[p]);v(e[p],r,n,null,i,a,o,s,c)}l>u?fe(e,i,a,!0,!1,f):D(t,n,r,i,a,o,s,c,f)},ie=(e,t,n,r,i,a,o,s,c)=>{let l=0,u=t.length,f=e.length-1,p=u-1;for(;l<=f&&l<=p;){let r=e[l],u=t[l]=c?ca(t[l]):sa(t[l]);if(Qi(r,u))v(r,u,n,null,i,a,o,s,c);else break;l++}for(;l<=f&&l<=p;){let r=e[f],l=t[p]=c?ca(t[p]):sa(t[p]);if(Qi(r,l))v(r,l,n,null,i,a,o,s,c);else break;f--,p--}if(l>f){if(l<=p){let e=p+1,d=e<u?t[e].el:r;for(;l<=p;)v(null,t[l]=c?ca(t[l]):sa(t[l]),n,d,i,a,o,s,c),l++}}else if(l>p)for(;l<=f;)oe(e[l],i,a,!0),l++;else{let m=l,h=l,g=new Map;for(l=h;l<=p;l++){let e=t[l]=c?ca(t[l]):sa(t[l]);e.key!=null&&g.set(e.key,l)}let _,y=0,b=p-h+1,x=!1,S=0,C=Array(b);for(l=0;l<b;l++)C[l]=0;for(l=m;l<=f;l++){let r=e[l];if(y>=b){oe(r,i,a,!0);continue}let u;if(r.key!=null)u=g.get(r.key);else for(_=h;_<=p;_++)if(C[_-h]===0&&Qi(r,t[_])){u=_;break}u===void 0?oe(r,i,a,!0):(C[u-h]=l+1,u>=S?S=u:x=!0,v(r,t[u],n,null,i,a,o,s,c),y++)}let w=x?Fi(C):d;for(_=w.length-1,l=b-1;l>=0;l--){let e=h+l,d=t[e],f=t[e+1],p=e+1<u?f.el||Ri(f):r;C[l]===0?v(null,d,n,p,i,a,o,s,c):x&&(_<0||l!==w[_]?ae(d,n,p,2):_--)}}},ae=(e,t,n,a,o=null)=>{let{el:s,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6){ae(e.component.subTree,t,n,a);return}if(d&128){e.suspense.move(t,n,a);return}if(d&64){c.move(e,t,n,ge);return}if(c===R){r(s,t,n);for(let e=0;e<u.length;e++)ae(u[e],t,n,a);r(e.anchor,t,n);return}if(c===Ui){S(e,t,n);return}if(a!==2&&d&1&&l)if(a===0)l.beforeEnter(s),r(s,t,n),Oi(()=>l.enter(s),o);else{let{leave:a,delayLeave:o,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?i(s):r(s,t,n)},d=()=>{s._isLeaving&&s[Xn](!0),a(s,()=>{u(),c&&c()})};o?o(s,u,d):d()}else r(s,t,n)},oe=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p,memo:m}=e;if(d===-2&&(i=!1),s!=null&&(qe(),nr(s,null,n,e,!0),Je()),p!=null&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let h=u&1&&f,g=!ir(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&da(_,t,e),u&6)ue(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}h&&zn(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,ge,r):l&&!l.hasOnce&&(a!==R||d>0&&d&64)?fe(l,t,n,!1,!0):(a===R&&d&384||!i&&u&16)&&fe(c,t,n),r&&ce(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&Oi(()=>{_&&da(_,t,e),h&&zn(e,null,t,`unmounted`),v&&(e.el=null)},n)},ce=e=>{let{type:t,el:n,anchor:r,transition:a}=e;if(t===R){le(n,r);return}if(t===Ui){C(e);return}let o=()=>{i(n),a&&!a.persisted&&a.afterLeave&&a.afterLeave()};if(e.shapeFlag&1&&a&&!a.persisted){let{leave:t,delayLeave:r}=a,i=()=>t(n,o);r?r(e.el,o,i):i()}else o()},le=(e,t)=>{let n;for(;e!==t;)n=h(e),i(e),e=n;i(t)},ue=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;Li(c),Li(l),r&&se(r),i.stop(),a&&(a.flags|=8,oe(o,e,t,n)),s&&Oi(s,t),Oi(()=>{e.isUnmounted=!0},t)},fe=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)oe(e[o],t,n,r,i)},pe=e=>{if(e.shapeFlag&6)return pe(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=h(e.anchor||e.el),n=t&&t[Jn];return n?h(n):t},me=!1,he=(e,t,n)=>{let r;e==null?t._vnode&&(oe(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,me||=(me=!0,An(r),jn(),!1)},ge={p:v,um:oe,m:ae,r:ce,mt:N,mc:D,pc:ne,pbc:k,n:pe,o:e},_e,ve;return t&&([_e,ve]=t(ge)),{render:he,hydrate:_e,createApp:Xr(he,_e)}}function ji({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function Mi({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Ni(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Pi(e,t,n=!1){let r=e.children,i=t.children;if(b(r)&&b(i))for(let e=0;e<r.length;e++){let t=r[e],a=i[e];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[e]=ca(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&Pi(t,a)),a.type===Vi&&(a.patchFlag===-1&&(a=i[e]=ca(a)),a.el=t.el),a.type===Hi&&!a.el&&(a.el=t.el)}}function Fi(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-- >0;)n[a]=o,o=t[o];return n}function Ii(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Ii(t)}function Li(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Ri(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?Ri(t.subTree):null}var zi=e=>e.__isSuspense;function Bi(e,t){t&&t.pendingBranch?b(e)?t.effects.push(...e):t.effects.push(e):kn(e)}var R=Symbol.for(`v-fgt`),Vi=Symbol.for(`v-txt`),Hi=Symbol.for(`v-cmt`),Ui=Symbol.for(`v-stc`),Wi=[],Gi=null;function z(e=!1){Wi.push(Gi=e?null:[])}function Ki(){Wi.pop(),Gi=Wi[Wi.length-1]||null}var qi=1;function Ji(e,t=!1){qi+=e,e<0&&Gi&&t&&(Gi.hasOnce=!0)}function Yi(e){return e.dynamicChildren=qi>0?Gi||d:null,Ki(),qi>0&&Gi&&Gi.push(e),e}function B(e,t,n,r,i,a){return Yi(V(e,t,n,r,i,a,!0))}function Xi(e,t,n,r,i){return Yi(H(e,t,n,r,i,!0))}function Zi(e){return e?e.__v_isVNode===!0:!1}function Qi(e,t){return e.type===t.type&&e.key===t.key}var $i=({key:e})=>e??null,ea=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:T(e)||Qt(e)||w(e)?{i:Pn,r:e,k:t,f:!!n}:e);function V(e,t=null,n=null,r=0,i=null,a=e===R?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,t
vendor: 4,618 bytes, line 1
1ype:e,props:t,key:t&&$i(t),ref:t&&ea(t),scopeId:Fn,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Pn};return s?(la(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=T(n)?8:16),qi>0&&!o&&Gi&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&Gi.push(c),c}var H=ta;function ta(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===wr)&&(e=Hi),Zi(e)){let r=ra(e,t,!0);return n&&la(r,n),qi>0&&!a&&Gi&&(r.shapeFlag&6?Gi[Gi.indexOf(e)]=r:Gi.push(r)),r.patchFlag=-2,r}if(Na(e)&&(e=e.__vccOpts),t){t=na(t);let{class:e,style:n}=t;e&&!T(e)&&(t.class=_e(e)),D(n)&&(qt(n)&&!b(n)&&(n=g({},n)),t.style=fe(n))}let o=T(e)?1:zi(e)?128:Yn(e)?64:D(e)?4:w(e)?2:0;return V(e,t,n,r,i,o,a,!0)}function na(e){return e?qt(e)||fi(e)?g({},e):e:null}function ra(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?ua(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&$i(l),ref:t&&t.ref?n&&a?b(a)?a.concat(ea(t)):[a,ea(t)]:ea(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==R?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ra(e.ssContent),ssFallback:e.ssFallback&&ra(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&r&&Zn(u,c.clone(u)),u}function ia(e=` `,t=0){return H(Vi,null,e,t)}function aa(e,t){let n=H(Ui,null,e);return n.staticCount=t,n}function oa(e=``,t=!1){return t?(z(),Xi(Hi,null,e)):H(Hi,null,e)}function sa(e){return e==null||typeof e==`boolean`?H(Hi):b(e)?H(R,null,e.slice()):Zi(e)?ca(e):H(Vi,null,String(e))}function ca(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ra(e)}function la(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(b(t))n=16;else if(typeof t==`object`)if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),la(e,n()),n._c&&(n._d=!0));return}else{n=32;let r=t._;!r&&!fi(t)?t._ctx=Pn:r===3&&Pn&&(Pn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else w(t)?(t={default:t,_ctx:Pn},n=32):(t=String(t),r&64?(n=16,t=[ia(t)]):n=8);e.children=t,e.shapeFlag|=n}function ua(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=_e([t.class,r.class]));else if(e===`style`)t.style=fe([t.style,r.style]);else if(m(e)){let n=t[e],i=r[e];i&&n!==i&&!(b(n)&&n.includes(i))?t[e]=n?[].concat(n,i):i:i==null&&n==null&&!h(e)&&(t[e]=i)}else e!==``&&(t[e]=r[e])}return t}function da(e,t,n,r=null){hn(e,t,7,[n,r])}var fa=Jr(),pa=0;function ma(e,t,n){let r=e.type,i=(t?t.appContext:e.appContext)||fa,a={uid:pa++,vnode:e,type:r,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Oe(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:vi(r,i),emitsOptions:ti(r,i),emit:null,emitted:null,propsDefaults:u,inheritAttrs:r.inheritAttrs,ctx:u,data:u,props:u,attrs:u,slots:u,refs:u,setupState:u,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=$r.bind(null,a),e.ce&&e.ce(a),a}var ha=null,ga=()=>ha||Pn,_a,va;{let e=de(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};_a=t(`__VUE_INSTANCE_SETTERS__`,e=>ha=e),va=t(`__VUE_SSR_SETTERS__`,e=>Sa=e)}var ya=e=>{let t=ha;return _a(e),e.scope.on(),()=>{e.scope.off(),_a(t)}},ba=()=>{ha&&ha.scope.off(),_a(null)};function xa(e){return e.vnode.shapeFlag&4}var Sa=!1;function Ca(e,t=!1,n=!1){t&&va(t);let{props:r,children:i}=e.vnode,a=xa(e);pi(e,r,a,t),Ei(e,i,n||t);let o=a?wa(e,t):void 0;return t&&va(!1),o}function wa(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,jr);let{setup:r}=n;if(r){qe();let n=e.setupContext=r.length>1?Aa(e):null,i=ya(e),a=mn(r,e,0,[e.props,n]),o=O(a);if(Je(),i(),(o||e.sp)&&!ir(e)&&$n(e),o){if(a.then(ba,ba),t)return a.then(n=>{Ta(e,n,t)}).catch(t=>{gn(t,e,0)});e.asyncDep=a}else Ta(e,a,t)}else Oa(e,t)}
vendor: 1,912 bytes, line 1
1function Ta(e,t,n){w(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:D(t)&&(e.setupState=an(t)),Oa(e,n)}var Ea,Da;function Oa(e,t,n){let r=e.type;if(!e.render){if(!t&&Ea&&!r.render){let t=r.template||Rr(e).template;if(t){let{isCustomElement:n,compilerOptions:i}=e.appContext.config,{delimiters:a,compilerOptions:o}=r;r.render=Ea(t,g(g({isCustomElement:n,delimiters:a},i),o))}}e.render=r.render||f,Da&&Da(e)}{let t=ya(e);qe();try{Pr(e)}finally{Je(),t()}}}var ka={get(e,t){return it(e,`get`,``),e[t]}};function Aa(e){return{attrs:new Proxy(e.attrs,ka),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function ja(e){return e.exposed?e.exposeProxy||=new Proxy(an(Yt(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in kr)return kr[n](e)},has(e,t){return t in e||t in kr}}):e.proxy}function Ma(e,t=!0){return w(e)?e.displayName||e.name:e.name||t&&e.__name}function Na(e){return w(e)&&`__vccOpts`in e}var U=(e,t)=>sn(e,t,Sa);function Pa(e,t,n){try{Ji(-1);let r=arguments.length;return r===2?D(t)&&!b(t)?Zi(t)?H(e,null,[t]):H(e,t):H(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Zi(n)&&(n=[n]),H(e,t,n))}finally{Ji(1)}}var Fa=`3.5.32`,Ia=void 0,La=typeof window<`u`&&window.trustedTypes;if(La)try{Ia=La.createPolicy(`vue`,{createHTML:e=>e})}catch{}var Ra=Ia?e=>Ia.createHTML(e):e=>e,za=`http://www.w3.org/2000/svg`,Ba=`http://www.w3.org/1998/Math/MathML`,Va=typeof document<`u`?document:null,Ha=Va&&Va.createElement(`template`),Ua={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?Va.createElementNS(za,e):t===`mathml`?Va.createElementNS(Ba,e):n?Va.createElement(e,{is:n}):Va.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>Va.createTextNode(e),createComment:e=>Va.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>
vendor: 7,289 bytes, line 1
1{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Va.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),!(i===a||!(i=i.nextSibling)););else{Ha.innerHTML=Ra(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=Ha.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Wa=Symbol(`_vtc`);function Ga(e,t,n){let r=e[Wa];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var Ka=Symbol(`_vod`),qa=Symbol(`_vsh`),Ja=Symbol(``),Ya=/(?:^|;)\s*display\s*:/;function Xa(e,t,n){let r=e.style,i=T(n),a=!1;if(n&&!i){if(t)if(T(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??Qa(r,t,``)}else for(let e in t)n[e]??Qa(r,e,``);for(let e in n)e===`display`&&(a=!0),Qa(r,e,n[e])}else if(i){if(t!==n){let e=r[Ja];e&&(n+=`;`+e),r.cssText=n,a=Ya.test(n)}}else t&&e.removeAttribute(`style`);Ka in e&&(e[Ka]=a?r.display:``,e[qa]&&(r.display=`none`))}var Za=/\s*!important$/;function Qa(e,t,n){if(b(n))n.forEach(n=>Qa(e,t,n));else if(n??=``,t.startsWith(`--`))e.setProperty(t,n);else{let r=to(e,t);Za.test(n)?e.setProperty(re(r),n.replace(Za,``),`important`):e[r]=n}}var $a=[`Webkit`,`Moz`,`ms`],eo={};function to(e,t){let n=eo[t];if(n)return n;let r=te(t);if(r!==`filter`&&r in e)return eo[t]=r;r=ie(r);for(let n=0;n<$a.length;n++){let i=$a[n]+r;if(i in e)return eo[t]=i}return t}var no=`http://www.w3.org/1999/xlink`;function ro(e,t,n,r,i,a=ye(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(no,t.slice(6,t.length)):e.setAttributeNS(no,t,n):n==null||a&&!be(n)?e.removeAttribute(t):e.setAttribute(t,a?``:E(n)?String(n):n)}function io(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?Ra(n):n);return}let a=e.tagName;if(t===`value`&&a!==`PROGRESS`&&!a.includes(`-`)){let r=a===`OPTION`?e.getAttribute(`value`)||``:e.value,i=n==null?e.type===`checkbox`?`on`:``:String(n);(r!==i||!(`_value`in e))&&(e.value=i),n??e.removeAttribute(t),e._value=n;return}let o=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=be(n):n==null&&r===`string`?(n=``,o=!0):r===`number`&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(i||t)}function ao(e,t,n,r){e.addEventListener(t,n,r)}function oo(e,t,n,r){e.removeEventListener(t,n,r)}var so=Symbol(`_vei`);function co(e,t,n,r,i=null){let a=e[so]||(e[so]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=uo(t);r?ao(e,n,a[t]=ho(r,i),s):o&&(oo(e,n,o,s),a[t]=void 0)}}var lo=/(?:Once|Passive|Capture)$/;function uo(e){let t;if(lo.test(e)){t={};let n;for(;n=e.match(lo);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===`:`?e.slice(3):re(e.slice(2)),t]}var fo=0,po=Promise.resolve(),mo=()=>fo||=(po.then(()=>fo=0),Date.now());function ho(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;hn(go(e,n.value),t,5,[e])};return n.value=e,n.attached=mo(),n}function go(e,t){if(b(t)){let n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}else return t}var _o=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,vo=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?Ga(e,r,o):t===`style`?Xa(e,n,r):m(t)?h(t)||co(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),!0):t[0]===`^`?(t=t.slice(1),!1):yo(e,t,r,o))?(io(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&ro(e,t,r,o,a,t!==`value`)):e._isVueCE&&(bo(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!T(r)))?io(e,te(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),ro(e,t,r,o))};function yo(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&_o(t)&&w(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return _o(t)&&T(n)?!1:t in e}function bo(e,t){let n=e._def.props;if(!n)return!1;let r=te(t);return Array.isArray(n)?n.some(e=>te(e)===r):Object.keys(n).some(e=>te(e)===r)}var xo=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return b(t)?e=>se(t,e):t};function So(e){e.target.composing=!0}function Co(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var wo=Symbol(`_assign`);function To(e,t,n){return t&&(e=e.trim()),n&&(e=le(e)),e}var Eo={created(e,{modifiers:{lazy:t,trim:n,number:r}},i){e[wo]=xo(i);let a=r||i.props&&i.props.type===`number`;ao(e,t?`change`:`input`,t=>{t.target.composing||e[wo](To(e.value,n,a))}),(n||a)&&ao(e,`change`,()=>{e.value=To(e.value,n,a)}),t||(ao(e,`compositionstart`,So),ao(e,`compositionend`,Co),ao(e,`change`,Co))},mounted(e,{value:t}){e.value=t??``},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[wo]=xo(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?le(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Do={deep:!0,created(e,t,n){e[wo]=xo(n),ao(e,`change`,()=>{let t=e._modelValue,n=ko(e),r=e.checked,i=e[wo];if(b(t)){let e=Ce(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(S(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(Ao(e,r))})},mounted:Oo,beforeUpdate(e,t,n){e[wo]=xo(n),Oo(e,t,n)}};function Oo(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(b(t))i=Ce(t,r.props.value)>-1;else if(S(t))i=t.has(r.props.value);else{if(t===n)return;i=Se(t,Ao(e,!0))}e.checked!==i&&(e.checked=i)}function ko(e){return`_value`in e?e._value:e.value}function Ao(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var jo={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Mo=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=re(n.key);if(t.some(e=>e===r||jo[e]===r))return e(n)}))},No=g({patchProp:vo},Ua),Po;function Fo(){return Po||=ki(No)}var Io=((...e)=>{let t=Fo().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Ro(e);if(!r)return;let i=t._component;!w(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,Lo(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function Lo(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function Ro(e){return T(e)?document.querySelector(e):e}var zo=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Bo={};function Vo(e,t){let n=Cr(`RouterView`);return z(),Xi(n)}var Ho=zo(Bo,[[`render`,Vo]]),Uo=typeof document<`u`;function Wo(e){return typeof e==`object`||`displayName`in e||`props`in e||`__vccOpts`in e}
1function Go(e){return e.__esModule||e[Symbol.toStringTag]===`Module`||e.default&&Wo(e.default)}var Ko=Object.assign;function qo(e,t){let n={};for(let r in t){let i=t[r];n[r]=Yo(i)?i.map(e):e(i)}return n}var Jo=()=>{},Yo=Array.isArray;function Xo(e,t){let n={};for(let r in e)n[r]=r in t?t[r]:e[r];return n}var Zo=function(e){return e[e.MATCHER_NOT_FOUND=1]=`MATCHER_NOT_FOUND`,e[e.NAVIGATION_GUARD_REDIRECT=2]=`NAVIGATION_GUARD_REDIRECT`,e[e.NAVIGATION_ABORTED=4]=`NAVIGATION_ABORTED`,e[e.NAVIGATION_CANCELLED=8]=`NAVIGATION_CANCELLED`,e[e.NAVIGATION_DUPLICATED=16]=`NAVIGATION_DUPLICATED`,e}({}),Qo=Symbol(``);Zo.MATCHER_NOT_FOUND,Zo.NAVIGATION_GUARD_REDIRECT,Zo.NAVIGATION_ABORTED,Zo.NAVIGATION_CANCELLED,Zo.NAVIGATION_DUPLICATED;function $o(e,t){return Ko(Error(),{type:e,[Qo]:!0},t)}function es(e,t){return e instanceof Error&&Qo in e&&(t==null||!!(e.type&t))}var ts=Symbol(``),ns=Symbol(``),rs=Symbol(``),is=Symbol(``),as=Symbol(``);function os(){return Vn(rs)}function ss(e){return Vn(is)}var cs=/#/g,ls=/&/g,us=/\//g,ds=/=/g,fs=/\?/g,ps=/\+/g,ms=/%5B/g,hs=/%5D/g,gs=/%5E/g,_s=/%60/g,vs=/%7B/g,ys=/%7C/g,bs=/%7D/g,xs=/%20/g;function Ss(e){return e==null?``:encodeURI(``+e).replace(ys,`|`).replace(ms,`[`).replace(hs,`]`)}function Cs(e){return Ss(e).replace(vs,`{`).replace(bs,`}`).replace(gs,`^`)}function ws(e){return Ss(e).replace(ps,`%2B`).replace(xs,`+`).replace(cs,`%23`).replace(ls,`%26`).replace(_s,"`").replace(vs,`{`).replace(bs,`}`).replace(gs,`^`)}function Ts(e){return ws(e).replace(ds,`%3D`)}function Es(e){return Ss(e).replace(cs,`%23`).replace(fs,`%3F`)}function Ds(e){return Es(e).replace(us,`%2F`)}function Os(e){if(e==null)return null;try{return decodeURIComponent(``+e)}catch{}return``+e}var ks=/\/$/,As=e=>e.replace(ks,``);function js(e,t,n=`/`){let r,i={},a=``,o=``,s=t.indexOf(`#`),c=t.indexOf(`?`);return c=s>=0&&c>s?-1:c,c>=0&&(r=t.slice(0,c),a=t.slice(c,s>0?s:t.length),i=e(a.slice(1))),s>=0&&(r||=t.slice(0,s),o=t.slice(s,t.length)),r=zs(r??t,n),{fullPath:r+a+o,path:r,query:i,hash:Os(o)}}function Ms(e,t){let n=t.query?e(t.query):``;return t.path+(n&&`?`)+n+(t.hash||``)}function Ns(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||`/`}function Ps(e,t,n){let r=t.matched.length-1,i=n.matched.length-1;return r>-1&&r===i&&Fs(t.matched[r],n.matched[i])&&Is(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Fs(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Is(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Ls(e[n],t[n]))return!1;return!0}function Ls(e,t){return Yo(e)?Rs(e,t):Yo(t)?Rs(t,e):(e&&e.valueOf())===(t&&t.valueOf())}function Rs(e,t){return Yo(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e.length===1&&e[0]===t}function zs(e,t){if(e.startsWith(`/`))return e;if(!e)return t;let n=t.split(`/`),r=e.split(`/`),i=r[r.length-1];(i===`..`||i===`.`)&&r.push(``);let a=n.length-1,o,s;for(o=0;o<r.length;o++)if(s=r[o],s!==`.`)if(s===`..`)a>1&&a--;else break;return n.slice(0,a).join(`/`)+`/`+r.slice(o).join(`/`)}var Bs={path:`/`,name:void 0,params:{},query:{},hash:``,fullPath:`/`,matched:[],meta:{},redirectedFrom:void 0},Vs=function(e){return e.pop=`pop`,e.push=`push`,e}({}),Hs=function(e){return e.back=`back`,e.forward=`forward`,e.unknown=``,e}({});function Us(e){if(!e)if(Uo){let t=document.querySelector(`base`);e=t&&t.getAttribute(`href`)||`/`,e=e.replace(/^\w+:\/\/[^\/]+/,``)}else e=`/`;return e[0]!==`/`&&e[0]!==`#`&&(e=`/`+e),As(e)}var Ws=/^[^#]+#/;function Gs(e,t){return e.replace(Ws,`#`)+t}function Ks(e,t){let n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}var qs=()=>({left:window.scrollX,top:window.scrollY});function Js(e){let t;if(`el`in e){let n=e.el,r=typeof n==`string`&&n.startsWith(`#`),i=typeof n==`string`?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!i)return;t=Ks(i,e)}else t=e;`scrollBehavior`in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left==null?window.scrollX:t.left,t.top==null?window.scrollY:t.top)}
vendor: 5,534 bytes, line 1
1function Ys(e,t){return(history.state?history.state.position-t:-1)+e}var Xs=new Map;function Zs(e,t){Xs.set(e,t)}function Qs(e){let t=Xs.get(e);return Xs.delete(e),t}function $s(e){return typeof e==`string`||e&&typeof e==`object`}function ec(e){return typeof e==`string`||typeof e==`symbol`}function tc(e){let t={};if(e===``||e===`?`)return t;let n=(e[0]===`?`?e.slice(1):e).split(`&`);for(let e=0;e<n.length;++e){let r=n[e].replace(ps,` `),i=r.indexOf(`=`),a=Os(i<0?r:r.slice(0,i)),o=i<0?null:Os(r.slice(i+1));if(a in t){let e=t[a];Yo(e)||(e=t[a]=[e]),e.push(o)}else t[a]=o}return t}function nc(e){let t=``;for(let n in e){let r=e[n];if(n=Ts(n),r==null){r!==void 0&&(t+=(t.length?`&`:``)+n);continue}(Yo(r)?r.map(e=>e&&ws(e)):[r&&ws(r)]).forEach(e=>{e!==void 0&&(t+=(t.length?`&`:``)+n,e!=null&&(t+=`=`+e))})}return t}function rc(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=Yo(r)?r.map(e=>e==null?null:``+e):r==null?r:``+r)}return t}function ic(){let e=[];function t(t){return e.push(t),()=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function ac(e,t,n,r,i,a=e=>e()){let o=r&&(r.enterCallbacks[i]=r.enterCallbacks[i]||[]);return()=>new Promise((s,c)=>{let l=e=>{e===!1?c($o(Zo.NAVIGATION_ABORTED,{from:n,to:t})):e instanceof Error?c(e):$s(e)?c($o(Zo.NAVIGATION_GUARD_REDIRECT,{from:t,to:e})):(o&&r.enterCallbacks[i]===o&&typeof e==`function`&&o.push(e),s())},u=a(()=>e.call(r&&r.instances[i],t,n,l)),d=Promise.resolve(u);e.length<3&&(d=d.then(l)),d.catch(e=>c(e))})}function oc(e,t,n,r,i=e=>e()){let a=[];for(let o of e)for(let e in o.components){let s=o.components[e];if(!(t!==`beforeRouteEnter`&&!o.instances[e]))if(Wo(s)){let c=(s.__vccOpts||s)[t];c&&a.push(ac(c,n,r,o,e,i))}else{let c=s();a.push(()=>c.then(a=>{if(!a)throw Error(`Couldn't resolve component "${e}" at "${o.path}"`);let s=Go(a)?a.default:a;o.mods[e]=a,o.components[e]=s;let c=(s.__vccOpts||s)[t];return c&&ac(c,n,r,o,e,i)()}))}}return a}function sc(e,t){let n=[],r=[],i=[],a=Math.max(t.matched.length,e.matched.length);for(let o=0;o<a;o++){let a=t.matched[o];a&&(e.matched.find(e=>Fs(e,a))?r.push(a):n.push(a));let s=e.matched[o];s&&(t.matched.find(e=>Fs(e,s))||i.push(s))}return[n,r,i]}var cc=()=>location.protocol+`//`+location.host;function lc(e,t){let{pathname:n,search:r,hash:i}=t,a=e.indexOf(`#`);if(a>-1){let t=i.includes(e.slice(a))?e.slice(a).length:1,n=i.slice(t);return n[0]!==`/`&&(n=`/`+n),Ns(n,``)}return Ns(n,e)+r+i}function uc(e,t,n,r){let i=[],a=[],o=null,s=({state:a})=>{let s=lc(e,location),c=n.value,l=t.value,u=0;if(a){if(n.value=s,t.value=a,o&&o===c){o=null;return}u=l?a.position-l.position:0}else r(s);i.forEach(e=>{e(n.value,c,{delta:u,type:Vs.pop,direction:u?u>0?Hs.forward:Hs.back:Hs.unknown})})};function c(){o=n.value}function l(e){i.push(e);let t=()=>{let t=i.indexOf(e);t>-1&&i.splice(t,1)};return a.push(t),t}function u(){if(document.visibilityState===`hidden`){let{history:e}=window;if(!e.state)return;e.replaceState(Ko({},e.state,{scroll:qs()}),``)}}function d(){for(let e of a)e();a=[],window.removeEventListener(`popstate`,s),window.removeEventListener(`pagehide`,u),document.removeEventListener(`visibilitychange`,u)}return window.addEventListener(`popstate`,s),window.addEventListener(`pagehide`,u),document.addEventListener(`visibilitychange`,u),{pauseListeners:c,listen:l,destroy:d}}function dc(e,t,n,r=!1,i=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:i?qs():null}}function fc(e){let{history:t,location:n}=window,r={value:lc(e,n)},i={value:t.state};i.value||a(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(r,a,o){let s=e.indexOf(`#`),c=s>-1?(n.host&&document.querySelector(`base`)?e:e.slice(s))+r:cc()+e+r;try{t[o?`replaceState`:`pushState`](a,``,c),i.value=a}catch(e){console.error(e),n[o?`replace`:`assign`](c)}}function o(e,n){a(e,Ko({},t.state,dc(i.value.back,e,i.value.forward,!0),n,{position:i.value.position}),!0),r.value=e}function s(e,n){let o=Ko({},i.value,t.state,{forward:e,scroll:qs()});a(o.current,o,!0),a(e,Ko({},dc(r.value,e,null),{position:o.position+1},n),!1),r.value=e}return{location:r,state:i,push:s,replace:o}}function pc(e){e=Us(e);let t=fc(e),n=uc(e,t.state,t.location,t.replace);function r(e,t=!0){t||n.pauseListeners(),history.go(e)}let i=Ko({location:``,base:e,go:r,createHref:Gs.bind(null,e)},t,n);return Object.defineProperty(i,`location`,{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(i,`state`,{enumerable:!0,get:()=>t.state.value}),i}var mc=function(e){return e[e.Static=0]=`Static`,e[e.Param=1]=`Param`,e[e.Group=2]=`Group`,e}({}),hc=function(e){return e[e.Static=0]=`Static`,e[e.Param=1]=`Param`,e[e.ParamRegExp=2]=`ParamRegExp`,e[e.ParamRegExpEnd=3]=`ParamRegExpEnd`,e[e.EscapeNext=4]=`EscapeNext`,e}(hc||{}),gc={type:mc.Static,value:``},_c=/[a-zA-Z0-9_]/;function vc(e){if(!e)return[[]];if(e===`/`)return[[gc]];if(!e.startsWith(`/`))throw Error(`Invalid path "${e}"`);function t(e){throw Error(`ERR (${n})/"${l}": ${e}`)}let n=hc.Static,r=n,i=[],a;function o(){a&&i.push(a),a=[]}let s=0,c,l=``,u=``;function d(){l&&=(n===hc.Static?a.push({type:mc.Static,value:l}):n===hc.Param||n===hc.ParamRegExp||n===hc.ParamRegExpEnd?(a.length>1&&(c===`*`||c===`+`)&&t(`A repeatable param (${l}) must be alone in its segment. eg: '/:ids+.`),a.push({type:mc.Param,value:l,regexp:u,repeatable:c===`*`||c===`+`,optional:c===`*`||c===`?`})):t(`Invalid state to consume buffer`),``)}function f(){l+=c}for(;s<e.length;
1){if(c=e[s++],c===`\\`&&n!==hc.ParamRegExp){r=n,n=hc.EscapeNext;continue}switch(n){case hc.Static:c===`/`?(l&&d(),o()):c===`:`?(d(),n=hc.Param):f();break;case hc.EscapeNext:f(),n=r;break;case hc.Param:c===`(`?n=hc.ParamRegExp:_c.test(c)?f():(d(),n=hc.Static,c!==`*`&&c!==`?`&&c!==`+`&&s--);break;case hc.ParamRegExp:c===`)`?u[u.length-1]==`\\`?u=u.slice(0,-1)+c:n=hc.ParamRegExpEnd:u+=c;break;case hc.ParamRegExpEnd:d(),n=hc.Static,c!==`*`&&c!==`?`&&c!==`+`&&s--,u=``;break;default:t(`Unknown state`);break}}return n===hc.ParamRegExp&&t(`Unfinished custom RegExp for param "${l}"`),d(),o(),i}var yc=`[^/]+?`,bc={sensitive:!1,strict:!1,start:!0,end:!0},xc=function(e){return e[e._multiplier=10]=`_multiplier`,e[e.Root=90]=`Root`,e[e.Segment=40]=`Segment`,e[e.SubSegment=30]=`SubSegment`,e[e.Static=40]=`Static`,e[e.Dynamic=20]=`Dynamic`,e[e.BonusCustomRegExp=10]=`BonusCustomRegExp`,e[e.BonusWildcard=-50]=`BonusWildcard`,e[e.BonusRepeatable=-20]=`BonusRepeatable`,e[e.BonusOptional=-8]=`BonusOptional`,e[e.BonusStrict=.7000000000000001]=`BonusStrict`,e[e.BonusCaseSensitive=.25]=`BonusCaseSensitive`,e}(xc||{}),Sc=/[.+*?^${}()[\]/\\]/g;function Cc(e,t){let n=Ko({},bc,t),r=[],i=n.start?`^`:``,a=[];for(let t of e){let e=t.length?[]:[xc.Root];n.strict&&!t.length&&(i+=`/`);for(let r=0;r<t.length;r++){let o=t[r],s=xc.Segment+(n.sensitive?xc.BonusCaseSensitive:0);if(o.type===mc.Static)r||(i+=`/`),i+=o.value.replace(Sc,`\\$&`),s+=xc.Static;else if(o.type===mc.Param){let{value:e,repeatable:n,optional:c,regexp:l}=o;a.push({name:e,repeatable:n,optional:c});let u=l||yc;if(u!==yc){s+=xc.BonusCustomRegExp;try{RegExp(`(${u})`)}catch(t){throw Error(`Invalid custom RegExp for param "${e}" (${u}): `+t.message)}}let d=n?`((?:${u})(?:/(?:${u}))*)`:`(${u})`;r||(d=c&&t.length<2?`(?:/${d})`:`/`+d),c&&(d+=`?`),i+=d,s+=xc.Dynamic,c&&(s+=xc.BonusOptional),n&&(s+=xc.BonusRepeatable),u===`.*`&&(s+=xc.BonusWildcard)}e.push(s)}r.push(e)}if(n.strict&&n.end){let e=r.length-1;r[e][r[e].length-1]+=xc.BonusStrict}n.strict||(i+=`/?`),n.end?i+=`$`:n.strict&&!i.endsWith(`/`)&&(i+=`(?:/|$)`);let o=new RegExp(i,n.sensitive?``:`i`);function s(e){let t=e.match(o),n={};if(!t)return null;for(let e=1;e<t.length;e++){let r=t[e]||``,i=a[e-1];n[i.name]=r&&i.repeatable?r.split(`/`):r}return n}function c(t){let n=``,r=!1;for(let i of e){(!r||!n.endsWith(`/`))&&(n+=`/`),r=!1;for(let e of i)if(e.type===mc.Static)n+=e.value;else if(e.type===mc.Param){let{value:a,repeatable:o,optional:s}=e,c=a in t?t[a]:``;
vendor: 9,994 bytes, line 1
1if(Yo(c)&&!o)throw Error(`Provided param "${a}" is an array but it is not repeatable (* or + modifiers)`);let l=Yo(c)?c.join(`/`):c;if(!l)if(s)i.length<2&&(n.endsWith(`/`)?n=n.slice(0,-1):r=!0);else throw Error(`Missing required param "${a}"`);n+=l}}return n||`/`}return{re:o,score:r,keys:a,parse:s,stringify:c}}function wc(e,t){let n=0;for(;n<e.length&&n<t.length;){let r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===xc.Static+xc.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===xc.Static+xc.Segment?1:-1:0}function Tc(e,t){let n=0,r=e.score,i=t.score;for(;n<r.length&&n<i.length;){let e=wc(r[n],i[n]);if(e)return e;n++}if(Math.abs(i.length-r.length)===1){if(Ec(r))return 1;if(Ec(i))return-1}return i.length-r.length}function Ec(e){let t=e[e.length-1];return e.length>0&&t[t.length-1]<0}var Dc={strict:!1,end:!0,sensitive:!1};function Oc(e,t,n){let r=Ko(Cc(vc(e.path),n),{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function kc(e,t){let n=[],r=new Map;t=Xo(Dc,t);function i(e){return r.get(e)}function a(e,n,r){let i=!r,s=jc(e);s.aliasOf=r&&r.record;let l=Xo(t,e),u=[s];if(`alias`in e){let t=typeof e.alias==`string`?[e.alias]:e.alias;for(let e of t)u.push(jc(Ko({},s,{components:r?r.record.components:s.components,path:e,aliasOf:r?r.record:s})))}let d,f;for(let t of u){let{path:u}=t;if(n&&u[0]!==`/`){let e=n.record.path,r=e[e.length-1]===`/`?``:`/`;t.path=n.record.path+(u&&r+u)}if(d=Oc(t,n,l),r?r.alias.push(d):(f||=d,f!==d&&f.alias.push(d),i&&e.name&&!Nc(d)&&o(e.name)),Lc(d)&&c(d),s.children){let e=s.children;for(let t=0;t<e.length;t++)a(e[t],d,r&&r.children[t])}r||=d}return f?()=>{o(f)}:Jo}function o(e){if(ec(e)){let t=r.get(e);t&&(r.delete(e),n.splice(n.indexOf(t),1),t.children.forEach(o),t.alias.forEach(o))}else{let t=n.indexOf(e);t>-1&&(n.splice(t,1),e.record.name&&r.delete(e.record.name),e.children.forEach(o),e.alias.forEach(o))}}function s(){return n}function c(e){let t=Fc(e,n);n.splice(t,0,e),e.record.name&&!Nc(e)&&r.set(e.record.name,e)}function l(e,t){let i,a={},o,s;if(`name`in e&&e.name){if(i=r.get(e.name),!i)throw $o(Zo.MATCHER_NOT_FOUND,{location:e});s=i.record.name,a=Ko(Ac(t.params,i.keys.filter(e=>!e.optional).concat(i.parent?i.parent.keys.filter(e=>e.optional):[]).map(e=>e.name)),e.params&&Ac(e.params,i.keys.map(e=>e.name))),o=i.stringify(a)}else if(e.path!=null)o=e.path,i=n.find(e=>e.re.test(o)),i&&(a=i.parse(o),s=i.record.name);else{if(i=t.name?r.get(t.name):n.find(e=>e.re.test(t.path)),!i)throw $o(Zo.MATCHER_NOT_FOUND,{location:e,currentLocation:t});s=i.record.name,a=Ko({},t.params,e.params),o=i.stringify(a)}let c=[],l=i;for(;l;)c.unshift(l.record),l=l.parent;return{name:s,path:o,params:a,matched:c,meta:Pc(c)}}e.forEach(e=>a(e));function u(){n.length=0,r.clear()}return{addRoute:a,resolve:l,removeRoute:o,clearRoutes:u,getRoutes:s,getRecordMatcher:i}}function Ac(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function jc(e){let t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Mc(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:`components`in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,`mods`,{value:{}}),t}function Mc(e){let t={},n=e.props||!1;if(`component`in e)t.default=n;else for(let r in e.components)t[r]=typeof n==`object`?n[r]:n;return t}function Nc(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Pc(e){return e.reduce((e,t)=>Ko(e,t.meta),{})}function Fc(e,t){let n=0,r=t.length;for(;n!==r;){let i=n+r>>1;Tc(e,t[i])<0?r=i:n=i+1}let i=Ic(e);return i&&(r=t.lastIndexOf(i,r-1)),r}function Ic(e){let t=e;for(;t=t.parent;)if(Lc(t)&&Tc(e,t)===0)return t}function Lc({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Rc(e){let t=Vn(rs),n=Vn(is),r=U(()=>{let n=nn(e.to);return t.resolve(n)}),i=U(()=>{let{matched:e}=r.value,{length:t}=e,i=e[t-1],a=n.matched;if(!i||!a.length)return-1;let o=a.findIndex(Fs.bind(null,i));if(o>-1)return o;let s=Uc(e[t-2]);return t>1&&Uc(i)===s&&a[a.length-1].path!==s?a.findIndex(Fs.bind(null,e[t-2])):o}),a=U(()=>i.value>-1&&Hc(n.params,r.value.params)),o=U(()=>i.value>-1&&i.value===n.matched.length-1&&Is(n.params,r.value.params));function s(n={}){if(Vc(n)){let n=t[nn(e.replace)?`replace`:`push`](nn(e.to)).catch(Jo);return e.viewTransition&&typeof document<`u`&&`startViewTransition`in document&&document.startViewTransition(()=>n),n}return Promise.resolve()}return{route:r,href:U(()=>r.value.href),isActive:a,isExactActive:o,navigate:s}}function zc(e){return e.length===1?e[0]:e}var Bc=Qn({name:`RouterLink`,compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:`page`},viewTransition:Boolean},useLink:Rc,setup(e,{slots:t}){let n=Bt(Rc(e)),{options:r}=Vn(rs),i=U(()=>({[Wc(e.activeClass,r.linkActiveClass,`router-link-active`)]:n.isActive,[Wc(e.exactActiveClass,r.linkExactActiveClass,`router-link-exact-active`)]:n.isExactActive}));return()=>{let r=t.default&&zc(t.default(n));return e.custom?r:Pa(`a`,{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:i.value},r)}}});function Vc(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){let t=e.currentTarget.getAttribute(`target`);if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Hc(e,t){for(let n in t){let r=t[n],i=e[n];if(typeof r==`string`){if(r!==i)return!1}else if(!Yo(i)||i.length!==r.length||r.some((e,t)=>e.valueOf()!==i[t].valueOf()))return!1}return!0}function Uc(e){return e?e.aliasOf?e.aliasOf.path:e.path:``}var Wc=(e,t,n)=>e??t??n,Gc=Qn({name:`RouterView`,inheritAttrs:!1,props:{name:{type:String,default:`default`},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){let r=Vn(as),i=U(()=>e.route||r.value),a=Vn(ns,0),o=U(()=>{let e=nn(a),{matched:t}=i.value,n;for(;(n=t[e])&&!n.components;)e++;return e}),s=U(()=>i.value.matched[o.value]);Bn(ns,U(()=>o.value+1)),Bn(ts,s),Bn(as,i);let c=L();return Wn(()=>[c.value,s.value,e.name],([e,t,n],[r,i,a])=>{t&&(t.instances[n]=e,i&&i!==t&&e&&e===r&&(t.leaveGuards.size||(t.leaveGuards=i.leaveGuards),t.updateGuards.size||(t.updateGuards=i.updateGuards))),e&&t&&(!i||!Fs(t,i)||!r)&&(t.enterCallbacks[n]||[]).forEach(t=>t(e))},{flush:`post`}),()=>{let r=i.value,a=e.name,o=s.value,l=o&&o.components[a];if(!l)return Kc(n.default,{Component:l,route:r});let u=o.props[a],d=Pa(l,Ko({},u?u===!0?r.params:typeof u==`function`?u(r):u:null,t,{onVnodeUnmounted:e=>{e.component.isUnmounted&&(o.instances[a]=null)},ref:c}));return Kc(n.default,{Component:d,route:r})||d}}});function Kc(e,t){if(!e)return null;let n=e(t);return n.length===1?n[0]:n}var qc=Gc;function Jc(e){let t=kc(e.routes,e),n=e.parseQuery||tc,r=e.stringifyQuery||nc,i=e.history,a=ic(),o=ic(),s=ic(),c=$t(Bs),l=Bs;Uo&&e.scrollBehavior&&`scrollRestoration`in history&&(history.scrollRestoration=`manual`);let u=qo.bind(null,e=>``+e),d=qo.bind(null,Ds),f=qo.bind(null,Os);function p(e,n){let r,i;return ec(e)?(r=t.getRecordMatcher(e),i=n):i=e,t.addRoute(i,r)}function m(e){let n=t.getRecordMatcher(e);n&&t.removeRoute(n)}function h(){return t.getRoutes().map(e=>e.record)}function g(e){return!!t.getRecordMatcher(e)}function _(e,a){if(a=Ko({},a||c.value),typeof e==`string`){let r=js(n,e,a.path),o=t.resolve({path:r.path},a),s=i.createHref(r.fullPath);return Ko(r,o,{params:f(o.params),hash:Os(r.hash),redirectedFrom:void 0,href:s})}let o;if(e.path!=null)o=Ko({},e,{path:js(n,e.path,a.path).path});else{let t=Ko({},e.params);for(let e in t)t[e]??delete t[e];o=Ko({},e,{params:d(t)}),a.params=d(a.params)}let s=t.resolve(o,a),l=e.hash||``;s.params=u(f(s.params));let p=Ms(r,Ko({},e,{hash:Cs(l),path:s.path})),m=i.createHref(p);return Ko({fullPath:p,hash:l,query:r===nc?rc(e.query):e.query||{}},s,{redirectedFrom:void 0,href:m})}function v(e){return typeof e==`string`?js(n,e,c.value.path):Ko({},e)}function y(e,t){if(l!==e)return $o(Zo.NAVIGATION_CANCELLED,{from:t,to:e})}function b(e){return C(e)}function x(e){return b(Ko(v(e),{replace:!0}))}function S(e,t){let n=e.matched[e.matched.length-1];if(n&&n.redirect){let{redirect:r}=n,i=typeof r==`function`?r(e,t):r;return typeof i==`string`&&(i=i.includes(`?`)||i.includes(`#`)?i=v(i):{path:i},i.params={}),Ko({query:e.query,hash:e.hash,params:i.path==null?e.params:{}},i)}}function C(e,t){let n=l=_(e),i=c.value,a=e.state,o=e.force,s=e.replace===!0,u=S(n,i);if(u)return C(Ko(v(u),{state:typeof u==`object`?Ko({},a,u.state):a,force:o,replace:s}),t||n);let d=n;d.redirectedFrom=t;let f;return!o&&Ps(r,i,n)&&(f=$o(Zo.NAVIGATION_DUPLICATED,{to:d,from:i}),te(i,i,!0,!1)),(f?Promise.resolve(f):E(d,i)).catch(e=>es(e)?es(e,Zo.NAVIGATION_GUARD_REDIRECT)?e:F(e):ee(e,d,i)).then(e=>{if(e){if(es(e,Zo.NAVIGATION_GUARD_REDIRECT))return C(Ko({replace:s},v(e.to),{state:typeof e.to==`object`?Ko({},a,e.to.state):a,force:o}),t||d)}else e=O(d,i,!0,s,a);return D(d,i,e),e})}function w(e,t){let n=y(e,t);return n?Promise.reject(n):Promise.resolve()}function T(e){let t=ie.values().next().value;return t&&typeof t.runWithContext==`function`?t.runWithContext(e):e()}function E(e,t){let n,[r,i,s]=sc(e,t);n=oc(r.reverse(),`beforeRouteLeave`,e,t);for(let i of r)i.leaveGuards.forEach(r=>{n.push(ac(r,e,t))});let c=w.bind(null,e,t);return n.push(c),oe(n).then(()=>{n=[];for(let r of a.list())n.push(ac(r,e,t));return n.push(c),oe(n)}).then(()=>{n=oc(i,`beforeRouteUpdate`,e,t);for(let r of i)r.updateGuards.forEach(r=>{n.push(ac(r,e,t))});return n.push(c),oe(n)}).then(()=>{n=[];for(let r of s)if(r.beforeEnter)if(Yo(r.beforeEnter))for(let i of r.beforeEnter)n.push(ac(i,e,t));else n.push(ac(r.beforeEnter,e,t));return n.push(c),oe(n)}).then(()=>
1(e.matched.forEach(e=>e.enterCallbacks={}),n=oc(s,`beforeRouteEnter`,e,t,T),n.push(c),oe(n))).then(()=>{n=[];for(let r of o.list())n.push(ac(r,e,t));return n.push(c),oe(n)}).catch(e=>es(e,Zo.NAVIGATION_CANCELLED)?e:Promise.reject(e))}function D(e,t,n){s.list().forEach(r=>T(()=>r(e,t,n)))}function O(e,t,n,r,a){let o=y(e,t);if(o)return o;let s=t===Bs,l=Uo?history.state:{};n&&(r||s?i.replace(e.fullPath,Ko({scroll:s&&l&&l.scroll},a)):i.push(e.fullPath,a)),c.value=e,te(e,t,n,s),F()}let k;function A(){k||=i.listen((e,t,n)=>{if(!ae.listening)return;let r=_(e),a=S(r,ae.currentRoute.value);if(a){C(Ko(a,{replace:!0,force:!0}),r).catch(Jo);return}l=r;let o=c.value;Uo&&Zs(Ys(o.fullPath,n.delta),qs()),E(r,o).catch(e=>es(e,Zo.NAVIGATION_ABORTED|Zo.NAVIGATION_CANCELLED)?e:es(e,Zo.NAVIGATION_GUARD_REDIRECT)?(C(Ko(v(e.to),{force:!0}),r).then(e=>{es(e,Zo.NAVIGATION_ABORTED|Zo.NAVIGATION_DUPLICATED)&&!n.delta&&n.type===Vs.pop&&i.go(-1,!1)}).catch(Jo),Promise.reject()):(n.delta&&i.go(-n.delta,!1),ee(e,r,o))).then(e=>{e||=O(r,o,!1),e&&(n.delta&&!es(e,Zo.NAVIGATION_CANCELLED)?i.go(-n.delta,!1):n.type===Vs.pop&&es(e,Zo.NAVIGATION_ABORTED|Zo.NAVIGATION_DUPLICATED)&&i.go(-1,!1)),D(r,o,e)}).catch(Jo)})}let j=ic(),M=ic(),N;function ee(e,t,n){F(e);let r=M.list();return r.length?r.forEach(r=>r(e,t,n)):console.error(e),Promise.reject(e)}function P(){return N&&c.value!==Bs?Promise.resolve():new Promise((e,t)=>{j.add([e,t])})}function F(e){return N||(N=!e,A(),j.list().forEach(([t,n])=>e?n(e):t()),j.reset()),e}function te(t,n,r,i){let{scrollBehavior:a}=e;if(!Uo||!a)return Promise.resolve();let o=!r&&Qs(Ys(t.fullPath,0))||(i||!r)&&history.state&&history.state.scroll||null;return Tn().then(()=>a(t,n,o)).then(e=>e&&Js(e)).catch(e=>ee(e,t,n))}let ne=e=>i.go(e),re,ie=new Set,ae={currentRoute:c,listening:!0,addRoute:p,removeRoute:m,clearRoutes:t.clearRoutes,hasRoute:g,getRoutes:h,resolve:_,options:e,push:b,replace:x,go:ne,back:()=>ne(-1),forward:()=>ne(1),beforeEach:a.add,beforeResolve:o.add,afterEach:s.add,onError:M.add,isReady:P,install(e){e.component(`RouterLink`,Bc),e.component(`RouterView`,qc),e.config.globalProperties.$router=ae,Object.defineProperty(e.config.globalProperties,`$route`,{enumerable:!0,get:()=>nn(c)}),Uo&&!re&&c.value===Bs&&(re=!0,b(i.location).catch(e=>{}));let t={};for(let e in Bs)Object.defineProperty(t,e,{get:()=>c.value[e],enumerable:!0});e.provide(rs,ae),e.provide(is,Vt(t)),e.provide(as,c);let n=e.unmount;ie.add(e),e.unmount=function(){ie.delete(e),ie.size<1&&(l=Bs,k&&k(),k=null,c.value=Bs,re=!1,N=!1),n()}}};function oe(e){return e.reduce((e,t)=>e.then(()=>T(t)),Promise.resolve())}return ae}var Yc=async(e,t)=>{try{let n=new URLSearchParams({categoryId:String(e),row:String(t)}),r=await fetch(`/gjmsWeb/articles/queryFullByCategoryId?${n.toString()}`);if(!r.ok)throw Error(`HTTP ${r.status}`);let i=await r.json();return Array.isArray(i?.data)?i.data:[]}catch(e){throw console.error(`è·å头æ¡å表失败:`,e),e}},Xc=async(e,t,n)=>{try{let r=new URLSearchParams({categoryId:String(e),rows:String(t),page:String(n)}),i=await fetch(`/gjmsWeb/articles/queryPageByCategoryId?${r.toString()}`);if(!i.ok)throw Error(`HTTP ${i.status}`);let a=(await i.json())?.data;return Array.isArray(a)?a:Array.isArray(a?.records)?a.records:Array.isArray(a?.list)?a.list:Array.isArray(a?.rows)?a.rows:[]}catch(e){throw console.error(`è·åçç¹æ°é»å页å表失败:`,e),e}},Zc=async(e,t,n,r)=>{try{let i=new URLSearchParams({categoryId:String(e),rows:String(t),page:String(n)});r!=null&&r!==``&&i.set(`currentId`,String(r));let a=await fetch(`/gjmsWeb/articles/queryPageByRelation?${i.toString()}`);if(!a.ok)throw Error(`HTTP ${a.status}`);let o=(await a.json())?.data;return Array.isArray(o)?o:Array.isArray(o?.list)?o.list:[]}catch(e){throw console.error(`è·åçç¹æ°é»å页å表失败:`,e),e}},Qc=async()=>{try{let e=await fetch(`/gjmsWeb/articles/queryHotArticlesList`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=(await e.json())?.data;return Array.isArray(t)?t:Array.isArray(t?.records)?t.records:Array.isArray(t?.list)?t.list:Array.isArray(t?.rows)?t.rows:[]}catch(e){throw console.error(`è·åçç¹æ°é»ç½®é¡¶å表失败:`,e),e}},$c=async()=>{try{let e=await fetch(`/gjmsWeb/articles/queryClickCountHotRankTop10`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=(await e.json())?.data??{};return{todayTop10:Array.isArray(t?.todayTop10)?t.todayTop10:[],weekTop10:Array.isArray(t?.weekTop10)?t.weekTop10:[]}}catch(e){throw console.error(`è·åæ°é»æè¡æ¦å¤±è´¥:`,e),e}},el=async(e,t=20,n=1)=>{try{let r=new URLSearchParams({keyword:String(e??``).trim(),rows:String(t),page:String(n)}),i=await fetch(`/gjmsWeb/articles/queryArticlesByKeyword?${r.toString()}`);if(!i.ok)throw Error(`HTTP ${i.status}`);let a=(await i.json())?.data;return Array.isArray(a)?a:Array.isArray(a?.records)?a.records:Array.isArray(a?.list)?a.list:Array.isArray(a?.rows)?a.rows:[]}catch(e){throw console.error(`æ ¹æ®å
³é®è¯æ¥è¯¢ç¨¿ä»¶å¤±è´¥:`,e),e}},tl=async(e,t)=>{try{let n=new URLSearchParams({id:String(e)});t&&n.append(`key`,String(t));let r=await fetch(`/gjmsWeb/articles/queryArticleVo?${n.toString()}`);if(!r.ok)throw Error(`HTTP ${r.status}`);return(await r.json())?.data??{}}catch(e){throw console.error(`è·åæ°é»è¯¦æ
失败:`,e),e}},nl=async e=>{try{let t=new URLSearchParams({id:String(e)}),n=await fetch(`/gjmsWeb/articles/queryPublishedWithKeyword?${t.toString()}`);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=(await n.json())?.data;return Array.isArray(r)?r:Array.isArray(r?.list)?r.list:[]}catch(e){throw console.error(`æ¥è¯¢å·²åå¸å
³é®è¯ç¨¿ä»¶å¤±è´¥:`,e),e}},rl=async(e,t)=>{try{let n=new URLSearchParams;e&&n.append(`id`,String(e)),t&&n.append(`key`,String(t));let r=n.toString(),i=r?`/gjmsWeb/articles/queryLiveArticleVo?${r}`:`/gjmsWeb/articles/queryLiveArticleVo`,a=await fetch(i);if(!a.ok)throw Error(`HTTP ${a.status}`);return(await a.json())?.data??{}}catch(e){throw console.error(`è·åç´æè¯¦æ
失败:`,e),e}},il=async(e,t)=>{try{let n=new URLSearchParams({articleId:String(e)});t&&n.append(`key`,String(t));let r=await fetch(`/gjmsWeb/articles/querySpecialCategoriesByArticleId?${n.toString()}`);if(!r.ok)throw Error(`HTTP ${r.status}`);return(await r.json())?.data??{}}catch(e){throw console.error(`è·åä¸é¢åç±»æ°æ®å¤±è´¥:`,e),e}},al=async e=>{try{return(await fetch(`/gjmsWeb/articles/addContentReadRequestLog`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`*/*`},body:JSON.stringify({contentId:Number(e)})})).ok}catch(e){return console.error(`è®°å½å
容é
è¯»è¯·æ±æ¥å¿å¤±è´¥:`,e),!1}},ol=async e=>{try{let t=new URLSearchParams({key:String(e)}),n=await fetch(`/gjmsWeb/articles/queryArticleVoByTempKey?${t.toString()}`);if(!n.ok)throw Error(`HTTP ${n.status}`);return(await n.json())?.data??{}}catch(e){throw console.error(`è·åä¸´æ¶æç« è¯¦æ
失败:`,e),e}},sl=async(e,t=`gjms`)=>{try{let n=await fetch(`/camel-gateway/gjmsAdmin/blackWord/checkContent`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`*/*`},body:JSON.stringify({platform:String(t??`gjms`),content:String(e??``)})});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();return r?.data??r}catch(e){throw console.error(`å
容é»è¯æ£æ¥å¤±è´¥:`,e),e}},cl={class:`search`},ll={class:`rankbox`},ul={class:`rank_menu`},dl={class:`rank_ul`},fl={class:`rankLeft`},pl={key:0,class:`rankNum`},ml={key:1,class:`rankNum color333`},hl={class:`text`},gl=[`href`,`target`],_l={class:`rankLeft`},vl={key:0,class:`rankNum`},yl={key:1,class:`rankNum color333`},bl={class:`text`},xl=[`href`,`target`],Sl={class:`copy`},Cl=[`src`],wl={class:`m20 fm br1px`},Tl=[`href`],El=[`href`],Dl=`https://wap.scsjb.cn/main/main`,Ol=zo(Qn({__name:`RightTab`,props:{dailyNewsList:{},weeklyNewsList:{}},setup(e){let t=os(),n=L(``),r=e,i=L(`week`),a=L([]),o=L([]),s=e=>String(e+1).padStart(2,`0`),c=e=>e.map((e,t)=>({rank:s(t),id:Number(e?.id??0),title:String(e?.title??``),type:Number(e?.type??1),external_link:String(e?.external_link??e?.externalLink??``)})),l=e=>{let t=Number(e?.type??1);if(t===5)return String(e?.external_link??e?.externalLink??``);let n=Number(e?.id??0);return n?t===2?`/topic/${n}`:t===3?`/live/${n}`:`/news/${n}`:`#`},u=()=>{let e=t.resolve({name:`smsplan`});window.open(e.href,`_blank`)},d=e=>Number(e?.type??0)===5,f=U(()=>a.value.length>0?a.value:r.dailyNewsList??[]),p=U(()=>o.value.length>0?o.value:r.weeklyNewsList??[]),m=async()=>{try{let e=await $c();a.value=c(e?.todayTop10??[]),o.value=c(e?.weekTop10??[])}catch(e){console.error(`å è½½æ°é»æè¡æ¦å¤±è´¥:`,e),a.value=[],o.value=[]}},h=()=>{let e=n.value.trim();if(!e)return;let r=t.resolve({name:`search`,params:{keyword:e}});window.open(r.href,`_blank`)},g=()=>{let e=t.resolve({name:`news`,params:{articleid:`13111`}});window.open(e.href,`_blank`)};return pr(()=>{m()}),(e,t)=>(z(),B(R,null,[V(`div`,cl,[Rn(V(`input`,{"onUpdate:modelValue":t[0]||=e=>n.value=e,placeholder:`è¾å
¥å
³é®è¯`,class:`sipt`,onKeydown:Mo(h,[`enter`])},null,544),[[Eo,n.value]]),V(`i`,{class:`iconfont icon-sousuo`,onClick:h})]),V(`div`,{class:`default_btn`,onClick:g}
1,[...t[3]||=[V(`i`,{class:`iconfont icon-fabu`},null,-1),V(`span`,null,`æè¦çæ`,-1)]]),t[11]||=V(`div`,{class:`boxtitle rank-boxtitle`},[V(`span`,{class:`rank-boxtitle__dot`,"aria-hidden":`true`}),V(`span`,{class:`rank-boxtitle__text`},`æ°é»æè¡æ¦`)],-1),V(`div`,ll,[V(`div`,ul,[V(`div`,{class:_e({cur:i.value===`today`}),onMouseenter:t[1]||=e=>i.value=`today`},` ä»å¤© `,34),V(`div`,{class:_e({cur:i.value===`week`}),onMouseenter:t[2]||=e=>i.value=`week`},` ä¸å¨ `,34)]),V(`div`,dl,[V(`ul`,{class:`hot-news-ul`,id:`daily-news`,style:fe({display:i.value===`today`?`block`:`none`})},[(z(!0),B(R,null,Dr(f.value,e=>(z(),B(`li`,{key:`d-`+e.id},[V(`span`,fl,[[`01`,`02`,`03`].includes(e.rank)?(z(),B(`span`,pl,I(e.rank),1)):(z(),B(`span`,ml,I(e.rank),1)),t[4]||=V(`span`,{class:`slash`},null,-1)]),V(`span`,hl,[V(`a`,{href:l(e),target:d(e)?`_blank`:void 0},I(e.title),9,gl)])]))),128))],4),V(`ul`,{class:`hot-news-ul`,id:`weekly-news`,style:fe({display:i.value===`week`?`block`:`none`})},[(z(!0),B(R,null,Dr(p.value,e=>(z(),B(`li`,{key:`w-`+e.id},[V(`span`,_l,[[`01`,`02`,`03`].includes(e.rank)?(z(),B(`span`,vl,I(e.rank),1)):(z(),B(`span`,yl,I(e.rank),1)),t[5]||=V(`span`,{class:`slash`},null,-1)]),V(`span`,bl,[V(`a`,{href:l(e),target:d(e)?`_blank`:void 0},I(e.title),9,xl)])]))),128))],4)])]),V(`div`,Sl,[V(`div`,{class:`ad m20`,onClick:u},[V(`img`,{src:`${Dl}/imgs/ad_dzck.jpg`,alt:`ad`},null,8,Cl)]),V(`div`,wl,[t[6]||=V(`i`,{class:`iconfont icon-lianxi1`},null,-1),V(`p`,null,[V(`a`,{href:`${Dl}/imgs/menu.pdf`,target:`_blank`},`åå·ææºæ¥åä¾ä»·PDF`,8,Tl)]),V(`p`,null,[V(`a`,{href:`${Dl}/imgs/menu.jpg`,target:`_blank`},`åå·ææºæ¥åä¾ä»·JPG`,8,El)]),t[7]||=V(`p`,null,`åå·ææºæ¥èç³»æ¹å¼`,-1),t[8]||=V(`p`,null,`广åé¨ç线ï¼028-83206299`,-1),t[9]||=V(`p`,null,[V(`a`,{href:`https://beian.miit.gov.cn/`,target:`_blank`,style:{color:`#999`,"font-weight":`normal`}},`èICPå¤12003267å·-1`)],-1),t[10]||=V(`p`,{style:{color:`#999`,"font-weight":`normal`}},` äºèç½æ°é»ä¿¡æ¯æå¡è®¸å¯è¯ç¼å·ï¼51120170002 `,-1)])])],64))}}),[[`__scopeId`,`data-v-01f33d38`]]),kl=`gjms_navbar_channels_cache`,Al=e=>{try{let t=JSON.stringify({timestamp:Date.now(),data:e});window.localStorage.setItem(kl,t)}catch(e){console.error(`åå
¥å¯¼èªæ ç¼å失败:`,e)}},jl=async()=>{try{let e=await fetch(`/gjmsWeb/categories/queryNavbarList`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json(),n=(Array.isArray(t?.data)?t.data:[]).filter(e=>e?.showInNavbar!==0).map(e=>{let t=(e?.outlinkUrl||``).trim();return{channel_id:e.id,channel_name:e.name,link:e.type===2?t:`/channels/${e.id}`,isExternal:e.type===2,isHomepage:e.isHomepage===1,fullwidth_top_num:Number(e.fullwidth_top_num??e.fullwidthTopNum??3)}});return Al(n),n}catch(e){throw console.error(`è·åå¯¼èªæ é¢é失败:`,e),e}},Ml=async()=>{try{return(await(await fetch(`/gjmsWeb/carousel/queryList`)).json()).data}catch(e){throw console.error(`è·åè½®æå¾å表失败:`,e),e}},Nl={class:`index-page`},Pl={class:`container`},Fl={key:0,class:`main-logo`},Il={class:`main`},Ll=[`href`],Rl=[`src`,`alt`],zl={key:1,class:`carousel`},Bl={class:`carousel-inner`},Vl=[`href`],Hl=[`src`,`alt`],Ul={class:`main-logo`},Wl={class:`main`},Gl={class:`logo`},Kl=[`src`],ql=[`src`],Jl={class:`fix-header`},Yl={class:`main header-warp`},Xl={class:`menu`},Zl=[`href`,`onClick`],Ql={class:`main row`},$l={class:`col-7`},eu={class:`banner`},tu={class:`left-banner`},nu={class:`swiper`},ru=[`href`,`target`],iu=[`src`],au={class:`title`},ou={class:`right-banner`},su=[`href`,`target`],cu=[`src`],lu={class:`mask`},uu={class:`title`},du=[`href`,`target`],fu=[`src`],pu={class:`mask`},mu={class:`title`},hu={class:`newsList`},gu=[`href`,`target`],_u=[`src`],vu={class:`right-content`},yu=[`href`,`target`],bu=[`href`,`target`],xu={class:`info`},Su={class:`createformat`},Cu={class:`by`},wu={class:`news-item`},Tu={key:0,class:`loadingMoreText`,val:`1000211`},Eu={key:1,class:`loadingMoreText`,val:`1000211`},Du={key:2,class:`loadingMoreText`,val:`1000211`},Ou={class:`col-3`},ku=`https://msmp.scsjb.cn/gjms_pic/`,Au=`https://wap.scsjb.cn/main/main`,ju=5,Mu=Qn({__name:`Index`,setup(e){let t=os(),n=L([]),r=L(null),i=L([]),a=L([]),o=L(1),s=L(!1),c=L(!0),l=L([]),u=L([]),d=L([{rank:`01`,id:50566,title:`åå·å¤å°æè¿ä»å¹´é¦ä¸ª30â`}
1,{rank:`02`,id:50554,title:`è¯·è¢«å®³äººéæ¥æ¡ï¼æé½è¦æ¹æè·ä¸åéªé±çâåæ¿ä¸â`},{rank:`03`,id:50555,title:`2026å¹´4æ8æ¥ ä¸å快讯`},{rank:`04`,id:50559,title:`彿¼«ç²¾åãé®å¤©ãå§åºçä¸çº¿ï¼æé½é«æ°åºæ°åæåIPåæ æ æ`},{rank:`05`,id:50563,title:`å½éæé½å±âæ¥æ¸¸âéè·¯è¿è¾æ¶å®ï¼ç´¯è®¡åéæ
客è¶
1281ä¸äººæ¬¡`},{rank:`06`,id:50558,title:`å·´å·å¥³æ§æ³¨æï¼ç¬¦åæ¡ä»¶è¯·éæ¥`},{rank:`07`,id:50565,title:`ç¾è½½äººç»æé£è¹å¼å§è¿åå°ç乿
`},{rank:`08`,id:50557,title:`æéï¼ä¹å±±è¿æ®µé«éå车åºå°é管å¶`},{rank:`09`,id:50560,title:`严æ©âæºé¹âçç¯ç½ª 两é«åå¸å¸æ³è§£é`},{rank:`10`,id:50556,title:`åå
«èå¿ï¼å¤§ä»»å§æ¿ï¼åäºä¸å¦ä¸¾è¡é«2023级æäººç¤¼`}]),f=L([{rank:`01`,id:50542,title:`ä¼çå¸1.8ä¸äº©å¬æ´èå°å¨åæåºéæ¶ä¸å¸`},{rank:`02`,id:50566,title:`åå·å¤å°æè¿ä»å¹´é¦ä¸ª30â`},{rank:`03`,id:50486,title:`2026å¹´åå·ç计éèä¸æè½æ¯æ¦æ¨ç¬¬ä¸å±å
¨å½è®¡éè䏿è½å¤§èµéææ´»å¨å¨æé½ä¸¾è¡`},{rank:`04`,id:50497,title:`æé½æ¦ä¾¯ï¼ç«¥ç¼çå管ï¼å°æç»ææï¼æ¦ä¾¯åºâå°å管âä¸å²è®°`},{rank:`05`,id:50501,title:`94å²æç¾æ´æèå
µäº²ä¸´ 300å¦åä¹åæèµ è´æ¬é©å½åè¾`},{rank:`06`,id:50539,title:`2026å¹´4æ7æ¥ ä¸å快讯`},{rank:`07`,id:50508,title:`2026å¹´4æ3æ¥ ä¸å快讯`},{rank:`08`,id:50554,title:`è¯·è¢«å®³äººéæ¥æ¡ï¼æé½è¦æ¹æè·ä¸åéªé±çâåæ¿ä¸â`},{rank:`09`,id:50555,title:`2026å¹´4æ8æ¥ ä¸å快讯`},{rank:`10`,id:50559,title:`彿¼«ç²¾åãé®å¤©ãå§åºçä¸çº¿ï¼æé½é«æ°åºæ°åæåIPåæ æ æ`}]),p=[],m=null,h=()=>{Tn(()=>{let e=document.querySelectorAll(`.carousel-inner`),t=[5500,3600];e.forEach((e,n)=>{let r=e,i=Array.from(r.querySelectorAll(`a`));if(i.length===0)return;i.forEach(e=>r.appendChild(e.cloneNode(!0)));let a=0,o=i.length,s=i[0]?.offsetWidth==null?300:i[0].offsetWidth+8,c=window.setInterval(()=>{a++,a>=o?(r.style.transition=`none`,r.style.transform=`translateX(0)`,a=1,setTimeout(()=>{r.style.transition=`transform 0.5s ease-in-out`,r.style.transform=`translateX(-${a*s}px)`},10)):r.style.transform=`translateX(-${a*s}px)`},t[n]||5500);p.push(c)})})},g=()=>{let e=window.jQuery;e&&document.getElementById(`wcqrcode`)&&(e(`#wcqrcode`).empty(),e(`#wcqrcode`).qrcode({width:100,height:100,text:`https://5g.scsjb.cn`}))},_=()=>{window.scrollTo({top:0,behavior:`smooth`})},v=async()=>{try{n.value=await jl(),r.value=n.value[0]?.channel_id??null,r.value!=null&&await y(r.value)}catch(e){console.error(`Failed to fetch channels:`,e)}},y=async e=>{try{let t=n.value.find(t=>t.channel_id===e);a.value=(await Yc(e,Number(t?.fullwidth_top_num??3))).map(e=>({id:Number(e?.id??0),title:e?.title??``,fullwidthTopUrl:e?.fullwidthTopUrl??e?.pc_top_img_url??e?.pcTopImgUrl??``,type:Number(e?.type??1),external_link:e?.external_link??e?.externalLink??``}))}catch(e){console.error(`Failed to fetch headlines:`,e),a.value=[]}},b=e=>e?/^https?:\/\//i.test(e)?e:`${ku}${e}`:``,x=e=>{let t=Number(e?.type??1);if(t===5)return String(e?.external_link??e?.externalLink??``);let n=Number(e?.id??0);return n?t===2?`/topic/${n}`:t===3?`/live/${n}`:`/news/${n}`:`#`},S=e=>Number(e?.type??0)===5,C=()=>{let e=t.resolve({name:`smsplan`});window.open(e.href,`_blank`)},w=async(e,t)=>{if(e.isExternal&&!e.isHomepage){t.preventDefault(),window.open(e.link,`_blank`);return}r.value!==e.channel_id&&(r.value=e.channel_id,await y(e.channel_id))},T=async()=>{try{let e=await Ml(),t=new Map;for(let n of e){let e=n.lineNumber??0;t.has(e)||t.set(e,[]),t.get(e).push({href:n.linkUrl??`#`,img:n.bannerUrl??``,alt:``})}i.value=Array.from(t.entries()).sort(([e],[t])=>e-t).map(([e,t])=>({lineNumber:e,items:t}))}catch(e){console.error(`Failed to fetch carousels:`,e)}},E=e=>{if(!e)return``;let t=new Date(String(e));if(Number.isNaN(t.getTime()))return``;let n=new Date,r=n.getFullYear()===t.getFullYear(),i=r&&n.getMonth()===t.getMonth();if(i&&n.getDate()===t.getDate()){let e=Math.max(n.getTime()-t.getTime(),0),r=Math.floor(e/(3600*1e3));return`${Math.max(r,1)}å°æ¶å`}if(i){let e=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();return`${Math.max(Math.floor((e-r)/(1440*60*1e3)),1)}天å`}return r?`${Math.max(n.getMonth()-t.getMonth(),1)}æå`:`${t.getFullYear()}å¹´${t.getMonth()+1}æ${t.getDate()}æ¥`},D=e=>{let t=e?.categories,n=t?.name??(Array.isArray(t)?t.find(e=>e?.name)?.name:``)??``;return{id:Number(e?.id??0),title:e?.title??``,simple_desc:e?.summary??``,thumbnail:e?.thumbnail??``,createformat:E(e.publishedDate),by:n||e?.by||`头æ¡ç²¾é`,type:Number(e?.type??1),external_link:e?.external_link??e?.externalLink??``}},O=()=>new Set(a.value.map(e=>e.id).filter(e=>e>0)),k=(e,t=!0)=>{let n=O();
1return t&&u.value.forEach(e=>n.add(e.id)),e.filter(e=>!n.has(e.id))},A=U(()=>[...u.value,...l.value]),j=async()=>{try{u.value=k((await Qc()).map(e=>D(e)),!1)}catch(e){console.error(`Failed to fetch hot news list:`,e),u.value=[]}},M=async e=>{if(!(s.value||!c.value)){s.value=!0;try{let t=await Xc(Number(r.value??0),ju,e),n=k(t.map(e=>D(e)));e===1?l.value=n:l.value=[...l.value,...n],t.length<ju?c.value=!1:o.value=e+1}catch(e){console.error(`Failed to fetch news list:`,e)}finally{s.value=!1}}};function N(e){return e.isExternal?e.link||``:`/channels/${e.channel_id}`}let ee=e=>e?/^https?:\/\//i.test(e)?e:`${ku}${e}`:``;return pr(async()=>{await Promise.all([v(),T()]),await j(),await M(1),h(),Tn(()=>{g()});let e=document.getElementById(`top`);m=()=>{if(!e)return;document.documentElement.scrollTop>120||document.body.scrollTop>120?e.style.display=`flex`:e.style.display=`none`;let t=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop,n=window.innerHeight||document.documentElement.clientHeight,r=document.documentElement.scrollHeight||document.body.scrollHeight;t+n>=r-60&&M(o.value)},window.addEventListener(`scroll`,m,{passive:!0}),m()}),gr(()=>{p.forEach(e=>window.clearInterval(e)),p=[],m&&window.removeEventListener(`scroll`,m)}),(e,t)=>(z(),B(`main`,Nl,[t[3]||=V(`a`,{class:`piaohong-link`,href:`https://spzt.newssc.org/index.html?id=3047`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`å½åºä¸é¢`},null,-1),V(`div`,Pl,[t[2]||=aa(`<div class="top-header"><div class="main"><div class="site"><a href="https://wap.scsjb.cn/">åå·ææºæ¥é¦é¡µ</a><a href="https://www.mala.cn" target="_blank">麻辣社åº</a><a href="http://www.newssc.org/" target="_blank">åå·æ°é»ç½</a></div><div class="tools"><div class="drop open"><div class="t"><i class="iconfont icon-erweima1"></i>ææºç</div><div class="qrcode"><div id="wcqrcode"></div></div></div></div></div></div>`,1),(z(!0),B(R,null,Dr(i.value,e=>(z(),B(R,{key:`group-`+e.lineNumber},[e.items.length===1?(z(),B(`div`,Fl,[V(`div`,Il,[V(`a`,{href:e.items[0].href,target:`_blank`},[V(`img`,{src:e.items[0].img,alt:e.items[0].alt,width:`1200`},null,8,Rl)],8,Ll)])])):(z(),B(`div`,zl,[V(`div`,Bl,[(z(!0),B(R,null,Dr(e.items,(t,n)=>(z(),B(`a`,{key:e.lineNumber+`-`+n,href:t.href,target:`_blank`},[V(`img`,{src:t.img,alt:t.alt},null,8,Hl)],8,Vl))),128))])]))],64))),128)),V(`div`,Ul,[V(`div`,Wl,[V(`div`,Gl,[V(`img`,{src:`${Au}/imgs/logo.png`,alt:``},null,8,Kl)]),V(`div`,{class:`ad`,style:{width:`700px`},onClick:C},[V(`img`,{src:`${Au}/imgs/1000.jpg`,alt:``},null,8,ql)])])]),V(`div`,Jl,[V(`div`,Yl,[V(`div`,Xl,[(z(!0),B(R,null,Dr(n.value,e=>(z(),B(`div`,{key:e.channel_id,class:_e([`li`,{cur:e.channel_id===r.value}])},[V(`a`,{href:N(e),class:`bn_a`,onClick:t=>w(e,t)},I(e.channel_name),9,Zl)],2))),128))])])]),V(`div`,Ql,[V(`div`,$l,[V(`section`,eu,[V(`div`,tu,[V(`div`,nu,[V(`a`,{class:`item`,href:x(a.value[0]??{}),target:S(a.value[0]??{})?`_blank`:void 0,rel:`noopener noreferrer`},[V(`img`,{src:b(a.value[0]?.fullwidthTopUrl),alt:``},null,8,iu),V(`div`,au,I(a.value[0]?.title),1)],8,ru)])]),V(`div`,ou,[V(`a`,{class:`item`,href:x(a.value[1]??{}),target:S(a.value[1]??{})?`_blank`:void 0,rel:`noopener noreferrer`},[V(`img`,{src:b(a.value[1]?.fullwidthTopUrl),alt:``},null,8,cu),V(`div`,lu,[V(`div`,uu,I(a.value[1]?.title),1)])],8,su),V(`a`,{href:x(a.value[2]??{}),target:S(a.value[2]??{})?`_blank`:void 0,rel:`noopener noreferrer`},[V(`img`,{src:b(a.value[2]?.fullwidthTopUrl),alt:``},null,8,fu),V(`div`,pu,[V(`div`,mu,I(a.value[2]?.title),1)])],8,du)])]),V(`section`,hu,[t[0]||=V(`div`,{class:`readtitle`},[V(`span`,null,[V(`i`,{class:`iconfont icon-zuixing-47`}),ia(` çç¹æ°é»`)]),V(`span`,null,`Hot`)],-1),(z(!0),B(R,null,Dr(A.value,e=>(z(),B(`div`,{key:e.id,class:`news-item`},[V(`a`,{class:`thumb`,href:x(e),target:S(e)?`_blank`:void 0,rel:`noopener noreferrer`},[V(`img`,{src:ee(e.thumbnail),alt:``},null,8,_u)],8,gu),V(`div`,vu,[V(`a`,{class:`subject`,href:x(e),target:S(e)?`_blank`:void 0,rel:`noopener noreferrer`},I(e.title),9,yu),V(`a`,{class:`simple-desc`,href:x(e),target:S(e)?`_blank`:void 0,rel:`noopener noreferrer`},I(e.simple_desc),9,bu),V(`div`,xu,[V(`span`,Su,I(e.createformat),1),V(`span`,Cu,I(e.by),1)])])]))),128))]),V(`section`,null,[V(`div`,wu,[s.value?(z(),B(`div`,Tu,` å è½½ä¸... `)):c.value?(z(),B(`div`,Du,` å è½½æ´å¤... `)):(z(),B(`div`,Eu,` æ²¡ææ´å¤äº `))])])]),V(`div`,Ou,[H(Ol,{"daily-news-list":d.value,"weekly-news-list":f.value},null,8,[`daily-news-list`,`weekly-news-list`])])]),V(`div`,{class:`footer`},[V(`div`,{id:`top`,style:{display:`none`},onClick:_},[...t[1]||=[V(`i`,{class:`iconfont icon-fanhuidingbu`},null,-1)]])])])]))}}),Nu=c(o(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.flvjs=r():n.flvjs=r()})(self,function(){return(function(){var e={
vendor: 6,346 bytes, line 1
1"./node_modules/es6-promise/dist/es6-promise.js":(function(e,t,n){(function(t,n){e.exports=n()})(this,(function(){function e(e){var t=typeof e;return e!==null&&(t===`object`||t===`function`)}function t(e){return typeof e==`function`}var r=void 0;r=Array.isArray?Array.isArray:function(e){return Object.prototype.toString.call(e)===`[object Array]`};var i=r,a=0,o=void 0,s=void 0,c=function(e,t){x[a]=e,x[a+1]=t,a+=2,a===2&&(s?s(S):w())};function l(e){s=e}function u(e){c=e}var d=typeof window<`u`?window:void 0,f=d||{},p=f.MutationObserver||f.WebKitMutationObserver,m=typeof self>`u`&&typeof process<`u`&&{}.toString.call(process)===`[object process]`,h=typeof Uint8ClampedArray<`u`&&typeof importScripts<`u`&&typeof MessageChannel<`u`;function g(){return function(){return process.nextTick(S)}}function _(){return o===void 0?b():function(){o(S)}}function v(){var e=0,t=new p(S),n=document.createTextNode(``);return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function y(){var e=new MessageChannel;return e.port1.onmessage=S,function(){return e.port2.postMessage(0)}}function b(){var e=setTimeout;return function(){return e(S,1)}}var x=Array(1e3);function S(){for(var e=0;e<a;e+=2){var t=x[e],n=x[e+1];t(n),x[e]=void 0,x[e+1]=void 0}a=0}function C(){try{var e=Function(`return this`)().require(`vertx`);return o=e.runOnLoop||e.runOnContext,_()}catch{return b()}}var w=void 0;w=m?g():p?v():h?y():d===void 0?C():b();function T(e,t){var n=this,r=new this.constructor(O);r[D]===void 0&&fe(r);var i=n._state;if(i){var a=arguments[i-1];c(function(){return ce(i,r,a,n._result)})}else oe(n,r,e,t);return r}function E(e){var t=this;if(e&&typeof e==`object`&&e.constructor===t)return e;var n=new t(O);return ne(n,e),n}var D=Math.random().toString(36).substring(2);function O(){}var k=void 0,A=1,j=2;function M(){return TypeError(`You cannot resolve a promise with itself`)}function N(){return TypeError(`A promises callback cannot return that same promise.`)}function ee(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}function P(e,t,n){c(function(e){var r=!1,i=ee(n,t,function(n){r||(r=!0,t===n?ie(e,n):ne(e,n))},function(t){r||(r=!0,ae(e,t))},`Settle: `+(e._label||` unknown promise`));!r&&i&&(r=!0,ae(e,i))},e)}function F(e,t){t._state===A?ie(e,t._result):t._state===j?ae(e,t._result):oe(t,void 0,function(t){return ne(e,t)},function(t){return ae(e,t)})}function te(e,n,r){n.constructor===e.constructor&&r===T&&n.constructor.resolve===E?F(e,n):r===void 0?ie(e,n):t(r)?P(e,n,r):ie(e,n)}function ne(t,n){if(t===n)ae(t,M());else if(e(n)){var r=void 0;try{r=n.then}catch(e){ae(t,e);return}te(t,n,r)}else ie(t,n)}function re(e){e._onerror&&e._onerror(e._result),se(e)}function ie(e,t){e._state===k&&(e._result=t,e._state=A,e._subscribers.length!==0&&c(se,e))}function ae(e,t){e._state===k&&(e._state=j,e._result=t,c(re,e))}function oe(e,t,n,r){var i=e._subscribers,a=i.length;e._onerror=null,i[a]=t,i[a+A]=n,i[a+j]=r,a===0&&e._state&&c(se,e)}function se(e){var t=e._subscribers,n=e._state;if(t.length!==0){for(var r=void 0,i=void 0,a=e._result,o=0;o<t.length;o+=3)r=t[o],i=t[o+n],r?ce(n,r,i,a):i(a);e._subscribers.length=0}}function ce(e,n,r,i){var a=t(r),o=void 0,s=void 0,c=!0;if(a){try{o=r(i)}catch(e){c=!1,s=e}if(n===o){ae(n,N());return}}else o=i;n._state!==k||(a&&c?ne(n,o):c===!1?ae(n,s):e===A?ie(n,o):e===j&&ae(n,o))}function le(e,t){try{t(function(t){ne(e,t)},function(t){ae(e,t)})}catch(t){ae(e,t)}}var ue=0;function de(){return ue++}function fe(e){e[D]=ue++,e._state=void 0,e._result=void 0,e._subscribers=[]}function pe(){return Error(`Array Methods must be provided an Array`)}var me=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(O),this.promise[D]||fe(this.promise),i(t)?(this.length=t.length,this._remaining=t.length,this._result=Array(this.length),this.length===0?ie(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),this._remaining===0&&ie(this.promise,this._result))):ae(this.promise,pe())}return e.prototype._enumerate=function(e){for(var t=0;this._state===k&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===E){var i=void 0,a=void 0,o=!1;try{i=e.then}catch(e){o=!0,a=e}if(i===T&&e._state!==k)this._settledAt(e._state,t,e._result);else if(typeof i!=`function`)this._remaining--,this._result[t]=e;else if(n===be){var s=new n(O);o?ae(s,a):te(s,e,i),this._willSettleAt(s,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},e.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===k&&(this._remaining--,e===j?ae(r,n):this._result[t]=n),this._remaining===0&&ie(r,this._result)},e.prototype._willSettleAt=function(e,t){var n=this;oe(e,void 0,function(e){return n._settledAt(A,t,e)},function(e){return n._settledAt(j,t,e)})},e}();function he(e){return new me(this,e).promise}function ge(e){var t=this;return i(e)?new t(function(n,r){for(var i=e.length,a=0;a<i;a++)t.resolve(e[a]).then(n,r)}):new t(function(e,t){return t(TypeError(`You must pass an array to race.`))})}function _e(e){var t=new this(O);return ae(t,e),t}function ve(){throw TypeError(`You must pass a resolver function as the first argument to the promise constructor`)}function ye(){throw TypeError(`Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.`)}var be=function(){function e(t){this[D]=de(),this._result=this._state=void 0,this._subscribers=[],O!==t&&(typeof t!=`function`&&ve(),this instanceof e?le(this,t):ye())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var n=this,r=n.constructor;return t(e)?n.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})}):n.then(e,e)},e}();be.prototype.then=T,be.all=he,be.race=ge,be.resolve=E,be.reject=_e,be._setScheduler=l,be._setAsap=u,be._asap=c;function xe(){var e=void 0;if(n.g!==void 0)e=n.g;else if(typeof self<`u`)e=self;else try{e=Function(`return this`)()}catch{throw Error(`polyfill failed because global object is unavailable in this environment`)}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch{}if(r===`[object Promise]`&&!t.cast)return}e.Promise=be}return be.polyfill=xe,be.Promise=be,be}))}),
vendor: 6,030 bytes, line 1
1"./node_modules/events/events.js":(function(e){var t=typeof Reflect==`object`?Reflect:null,n=t&&typeof t.apply==`function`?t.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},r=t&&typeof t.ownKeys==`function`?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function i(e){console&&console.warn&&console.warn(e)}var a=Number.isNaN||function(e){return e!==e};function o(){o.init.call(this)}e.exports=o,e.exports.once=v,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function c(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(o,`defaultMaxListeners`,{enumerable:!0,get:function(){return s},set:function(e){if(typeof e!=`number`||e<0||a(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);s=e}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||a(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function l(e){return e._maxListeners===void 0?o.defaultMaxListeners:e._maxListeners}o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)n(c,this,t);else for(var l=c.length,u=h(c,l),r=0;r<l;++r)n(u[r],this,t);return!0};function u(e,t,n,r){var a,o,s;if(c(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),a=l(e),a>0&&s.length>a&&!s.warned){s.warned=!0;var u=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);u.name=`MaxListenersExceededWarning`,u.emitter=e,u.type=t,u.count=s.length,i(u)}return e}o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}o.prototype.once=function(e,t){return c(t),this.on(e,f(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,f(this,e,t)),this},o.prototype.removeListener=function(e,t){var n,r,i,a,o;if(c(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():g(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function p(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?_(i):h(i,i.length)}o.prototype.listeners=function(e){return p(this,e,!0)},o.prototype.rawListeners=function(e){return p(this,e,!1)},o.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):m.call(e,t)},o.prototype.listenerCount=m;function m(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function h(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function g(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function _(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function v(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}b(e,t,a,{once:!0}),t!==`error`&&y(e,i,{once:!0})})}function y(e,t,n){typeof e.on==`function`&&b(e,`error`,t,n)}function b(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}}),
vendor: 2,674 bytes, lines 1-2
1"./node_modules/webworkify-webpack/index.js":(function(e,t,n){function r(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,`__esModule`,{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=`/`,n.oe=function(e){throw console.error(e),e};var r=n(n.s=ENTRY_MODULE);return r.default||r}var i=`[\\.|\\-|\\+|\\w|/|@]+`,a=`\\(\\s*(/\\*.*?\\*/)?\\s*.*?(`+i+`).*?\\)`;function o(e){return(e+``).replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}function s(e){return!isNaN(1*e)}function c(e,t,r){var c={};c[r]=[];var l=t.toString(),u=l.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return c;for(var d=u[1],f=RegExp(`(\\\\n|\\W)`+o(d)+a,`g`),p;p=f.exec(l);)p[3]!==`dll-reference`&&c[r].push(p[3]);for(f=RegExp(`\\(`+o(d)+`\\("(dll-reference\\s(`+i+`))"\\)\\)`+a,`g`);p=f.exec(l);)e[p[2]]||(c[r].push(p[1]),e[p[2]]=n(p[1]).m),c[p[2]]=c[p[2]]||[],c[p[2]].push(p[4]);for(var m=Object.keys(c),h=0;h<m.length;h++)for(var g=0;g<c[m[h]].length;g++)s(c[m[h]][g])&&(c[m[h]][g]=1*c[m[h]][g]);return c}function l(e){return Object.keys(e).reduce(function(t,n){return t||e[n].length>0},!1)}function u(e,t){for(var n={main:[t]},r={main:[]},i={main:{}};l(n);)for(var a=Object.keys(n),o=0;o<a.length;o++){var s=a[o],u=n[s].pop();if(i[s]=i[s]||{},!(i[s][u]||!e[s][u])){i[s][u]=!0,r[s]=r[s]||[],r[s].push(u);for(var d=c(e,e[s][u],s),f=Object.keys(d),p=0;p<f.length;p++)n[f[p]]=n[f[p]]||[],n[f[p]]=n[f[p]].concat(d[f[p]])}}return r}e.exports=function(e,t){t||={};var i={main:n.m},a=t.all?{main:Object.keys(i.main)}:u(i,e),o=``;Object.keys(a).filter(function(e){return e!==`main`}).forEach(function(e){for(var t=0;a[e][t];)t++;a[e].push(t),i[e][t]=`(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })`,o=o+`var `+e+` = (`+r.toString().replace(`ENTRY_MODULE`,JSON.stringify(t))+`)({`+a[e].map(function(t){return``+JSON.stringify(t)+`: `+i[e][t].toString()}).join(`,`)+`}); 2`}),o=o+`new ((`+r.toString().replace(`ENTRY_MODULE`,JSON.stringify(e))+`)({`+a.main.map(function(e){return``+JSON.stringify(e)+`: `+i.main[e].toString()}).join(`,`)+`}))(self);`;var s=new window.Blob([o],{type:`text/javascript`});if(t.bare)return s;var c=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(s),l=new window.Worker(c);return l.objectURL=c,l}}),
2"./src/config.js":(function(e,t,n){n.r(t),n.d(t,{defaultConfig:function(){return r},createDefaultConfig:function(){return i}});var r={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:`range`,seekParamStart:`bstart`,seekParamEnd:`bend`,rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function i(){return Object.assign({},r)}}),
2"./src/core/features.js":(function(e,t,n){n.r(t);var r=n(`./src/io/io-controller.js`),i=n(`./src/config.js`);t.default=function(){function e(){}return e.supportMSEH264Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported(`video/mp4; codecs="avc1.42E01E,mp4a.40.2"`)},e.supportNetworkStreamIO=function(){var e=new r.default({},(0,i.createDefaultConfig)()),t=e.loaderType;return e.destroy(),t==`fetch-stream-loader`||t==`xhr-moz-chunked-loader`},e.getNetworkLoaderTypeName=function(){var e=new r.default({},(0,i.createDefaultConfig)()),t=e.loaderType;return e.destroy(),t},e.supportNativeMediaPlayback=function(t){e.videoElement??=window.document.createElement(`video`);var n=e.videoElement.canPlayType(t);return n===`probably`||n==`maybe`},e.getFeatureList=function(){var t={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:``,nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.mseFlvPlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLiveFlvPlayback=t.mseFlvPlayback&&t.networkStreamIO,t.nativeMP4H264Playback=e.supportNativeMediaPlayback(`video/mp4; codecs="avc1.42001E, mp4a.40.2"`),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback(`video/webm; codecs="vp8.0, vorbis"`),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback(`video/webm; codecs="vp9"`),t},e}()}),
2"./src/core/media-info.js":(function(e,t,n){n.r(t),t.default=function(){function e(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return e.prototype.isComplete=function(){var e=this.hasAudio===!1||this.hasAudio===!0&&this.audioCodec!=null&&this.audioSampleRate!=null&&this.audioChannelCount!=null,t=this.hasVideo===!1||this.hasVideo===!0&&this.videoCodec!=null&&this.width!=null&&this.height!=null&&this.fps!=null&&this.profile!=null&&this.level!=null&&this.refFrames!=null&&this.chromaFormat!=null&&this.sarNum!=null&&this.sarDen!=null;return this.mimeType!=null&&this.duration!=null&&this.metadata!=null&&this.hasKeyframesIndex!=null&&e&&t},e.prototype.isSeekable=function(){return this.hasKeyframesIndex===!0},e.prototype.getNearestKeyframe=function(e){if(this.keyframesIndex==null)return null;var t=this.keyframesIndex,n=this._search(t.times,e);return{index:n,milliseconds:t.times[n],fileposition:t.filepositions[n]}},e.prototype._search=function(e,t){var n=0,r=e.length-1,i=0,a=0,o=r;for(t<e[0]&&(n=0,a=o+1);a<=o;)if(i=a+Math.floor((o-a)/2),i===r||t>=e[i]&&t<e[i+1]){n=i;break}else e[i]<t?a=i+1:o=i-1;return n},e}()}),
2"./src/core/media-segment-info.js":(function(e,t,n){n.r(t),n.d(t,{SampleInfo:function(){return r},MediaSegmentInfo:function(){return i},IDRSampleList:function(){return a},MediaSegmentInfoList:function(){return o}});var r=function(){function e(e,t,n,r,i){this.dts=e,this.pts=t,this.duration=n,this.originalDts=r,this.isSyncPoint=i,this.fileposition=null}return e}(),i=function(){function e(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return e.prototype.appendSyncPoint=function(e){e.isSyncPoint=!0,this.syncPoints.push(e)},e}(),a=function(){function e(){this._list=[]}return e.prototype.clear=function(){this._list=[]},e.prototype.appendArray=function(e){var t=this._list;e.length!==0&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))},e.prototype.getLastSyncPointBeforeDts=function(e){if(this._list.length==0)return null;var t=this._list,n=0,r=t.length-1,i=0,a=0,o=r;for(e<t[0].dts&&(n=0,a=o+1);a<=o;)if(i=a+Math.floor((o-a)/2),i===r||e>=t[i].dts&&e<t[i+1].dts){n=i;break}else t[i].dts<e?a=i+1:o=i-1;return this._list[n]},e}(),o=function(){function e(e){this._type=e,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(e.prototype,`type`,{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`length`,{get:function(){return this._list.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return this._list.length===0},e.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},e.prototype._searchNearestSegmentBefore=function(e){var t=this._list;if(t.length===0)return-2;var n=t.length-1,r=0,i=0,a=n,o=0;if(e<t[0].originalBeginDts)return o=-1,o;for(;i<=a;)if(r=i+Math.floor((a-i)/2),r===n||e>t[r].lastSample.originalDts&&e<t[r+1].originalBeginDts){o=r;break}else t[r].originalBeginDts<e?i=r+1:a=r-1;return o},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t=this._list,n=e,r=this._lastAppendLocation,i=0;r!==-1&&r<t.length&&n.originalBeginDts>=t[r].lastSample.originalDts&&(r===t.length-1||r<t.length-1&&n.originalBeginDts<t[r+1].originalBeginDts)?i=r+1:t.length>0&&(i=this._searchNearestSegmentBefore(n.originalBeginDts)+1),this._lastAppendLocation=i,this._list.splice(i,0,n)},e.prototype.getLastSegmentBefore=function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null},e.prototype.getLastSampleBefore=function(e){var t=this.getLastSegmentBefore(e);return t==null?null:t.lastSample},e.prototype.getLastSyncPointBefore=function(e){for(var t=this._searchNearestSegmentBefore(e),n=this._list[t].syncPoints;n.length===0&&t>0;)t--,n=this._list[t].syncPoints;return n.length>0?n[n.length-1]:null},e}()}),
2"./src/core/mse-controller.js":(function(e,t,n){n.r(t);var r=n(`./node_modules/events/events.js`),i=n.n(r),a=n(`./src/utils/logger.js`),o=n(`./src/utils/browser.js`),s=n(`./src/core/mse-events.js`),c=n(`./src/core/media-segment-info.js`),l=n(`./src/utils/exception.js`);t.default=function(){function e(e){this.TAG=`MSEController`,this._config=e,this._emitter=new(i()),this._config.isLive&&this._config.autoCleanupSourceBuffer==null&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new c.IDRSampleList}return e.prototype.destroy=function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaSource)throw new l.IllegalStateException(`MediaSource has been attached to an HTMLMediaElement!`);var t=this._mediaSource=new window.MediaSource;t.addEventListener(`sourceopen`,this.e.onSourceOpen),t.addEventListener(`sourceended`,this.e.onSourceEnded),t.addEventListener(`sourceclose`,this.e.onSourceClose),this._mediaElement=e,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),e.src=this._mediaSourceObjectURL},e.prototype.detachMediaElement=function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var n=this._pendingSegments[t];n.splice(0,n.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var r=this._sourceBuffers[t];if(r){if(e.readyState!==`closed`){try{e.removeSourceBuffer(r)}catch(e){a.default.e(this.TAG,e.message)}r.removeEventListener(`error`,this.e.onSourceBufferError),r.removeEventListener(`updateend`,this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if(e.readyState===`open`)try{e.endOfStream()}catch(e){a.default.e(this.TAG,e.message)}e.removeEventListener(`sourceopen`,this.e.onSourceOpen),e.removeEventListener(`sourceended`,this.e.onSourceEnded),e.removeEventListener(`sourceclose`,this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&=(this._mediaElement.src=``,this._mediaElement.removeAttribute(`src`),null),this._mediaSourceObjectURL&&=(window.URL.revokeObjectURL(this._mediaSourceObjectURL),null)},e.prototype.appendInitSegment=function(e,t){if(!this._mediaSource||this._mediaSource.readyState!==`open`){this._pendingSourceBufferInit.push(e),this._pendingSegments[e.type].push(e);return}var n=e,r=``+n.container;n.codec&&n.codec.length>0&&(r+=`;codecs=`+n.codec);var i=!1;if(a.default.v(this.TAG,`Received Initialization Segment, mimeType: `+r),this._lastInitSegments[n.type]=n,r!==this._mimeTypes[n.type]){if(this._mimeTypes[n.type])a.default.v(this.TAG,`Notice: `+n.type+` mimeType changed, origin: `+this._mimeTypes[n.type]+`, target: `+r);else{i=!0;try{var c=this._sourceBuffers[n.type]=this._mediaSource.addSourceBuffer(r);c.addEventListener(`error`,this.e.onSourceBufferError),c.addEventListener(`updateend`,this.e.onSourceBufferUpdateEnd)}catch(e){a.default.e(this.TAG,e.message),this._emitter.emit(s.default.ERROR,{code:e.code,msg:e.message});return}}this._mimeTypes[n.type]=r}t||this._pendingSegments[n.type].push(n),i||this._sourceBuffers[n.type]&&!this._sourceBuffers[n.type].updating&&this._doAppendSegments(),o.default.safari&&n.container===`audio/mpeg`&&n.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=n.mediaDuration/1e3,this._updateMediaSourceDuration())},e.prototype.appendMediaSegment=function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var n=this._sourceBuffers[t.type];n&&!n.updating&&!this._hasPendingRemoveRanges()&&this._doAppendSegments()},e.prototype.seek=function(e){for(var t in this._sourceBuffers)if(this._sourceBuffers[t]){var n=this._sourceBuffers[t];if(this._mediaSource.readyState===`open`)try{n.abort()}catch(e){a.default.e(this.TAG,e.message)}this._idrList.clear();
2var r=this._pendingSegments[t];if(r.splice(0,r.length),this._mediaSource.readyState!==`closed`){for(var i=0;i<n.buffered.length;i++){var s=n.buffered.start(i),c=n.buffered.end(i);this._pendingRemoveRanges[t].push({start:s,end:c})}if(n.updating||this._doRemoveRanges(),o.default.safari){var l=this._lastInitSegments[t];l&&(this._pendingSegments[t].push(l),n.updating||this._doAppendSegments())}}}},e.prototype.endOfStream=function(){var e=this._mediaSource,t=this._sourceBuffers;if(!e||e.readyState!==`open`){e&&e.readyState===`closed`&&this._hasPendingSegments()&&(this._hasPendingEos=!0);return}t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream())},e.prototype.getNearestKeyframe=function(e){return this._idrList.getLastSyncPointBeforeDts(e)},e.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var n=this._sourceBuffers[t];if(n){var r=n.buffered;if(r.length>=1&&e-r.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},e.prototype._doCleanupSourceBuffer=function(){var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var n=this._sourceBuffers[t];if(n){for(var r=n.buffered,i=!1,a=0;a<r.length;a++){var o=r.start(a),s=r.end(a);if(o<=e&&e<s+3){if(e-o>=this._config.autoCleanupMaxBackwardDuration){i=!0;var c=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:o,end:c})}}else s<e&&(i=!0,this._pendingRemoveRanges[t].push({start:o,end:s}))}i&&!n.updating&&this._doRemoveRanges()}}},e.prototype._updateMediaSourceDuration=function(){var e=this._sourceBuffers;if(!(this._mediaElement.readyState===0||this._mediaSource.readyState!==`open`)&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,n=this._pendingMediaDuration;n>0&&(isNaN(t)||n>t)&&(a.default.v(this.TAG,`Update MediaSource duration from `+t+` to `+n),this._mediaSource.duration=n),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},e.prototype._doRemoveRanges=function(){for(var e in this._pendingRemoveRanges)if(!(!this._sourceBuffers[e]||this._sourceBuffers[e].updating))for(var t=this._sourceBuffers[e],n=this._pendingRemoveRanges[e];n.length&&!t.updating;){var r=n.shift();t.remove(r.start,r.end)}}
2,e.prototype._doAppendSegments=function(){var e=this._pendingSegments;for(var t in e)if(!(!this._sourceBuffers[t]||this._sourceBuffers[t].updating)&&e[t].length>0){var n=e[t].shift();if(n.timestampOffset){var r=this._sourceBuffers[t].timestampOffset,i=n.timestampOffset/1e3;Math.abs(r-i)>.1&&(a.default.v(this.TAG,`Update MPEG audio timestampOffset from `+r+` to `+i),this._sourceBuffers[t].timestampOffset=i),delete n.timestampOffset}if(!n.data||n.data.byteLength===0)continue;try{this._sourceBuffers[t].appendBuffer(n.data),this._isBufferFull=!1,t===`video`&&n.hasOwnProperty(`info`)&&this._idrList.appendArray(n.info.syncPoints)}catch(e){this._pendingSegments[t].unshift(n),e.code===22?(this._isBufferFull||this._emitter.emit(s.default.BUFFER_FULL),this._isBufferFull=!0):(a.default.e(this.TAG,e.message),this._emitter.emit(s.default.ERROR,{code:e.code,msg:e.message}))}}},e.prototype._onSourceOpen=function(){if(a.default.v(this.TAG,`MediaSource onSourceOpen`),this._mediaSource.removeEventListener(`sourceopen`,this.e.onSourceOpen),this._pendingSourceBufferInit.length>
vendor: 1,263 bytes, line 2
20)for(var e=this._pendingSourceBufferInit;e.length;){var t=e.shift();this.appendInitSegment(t,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(s.default.SOURCE_OPEN)},e.prototype._onSourceEnded=function(){a.default.v(this.TAG,`MediaSource onSourceEnded`)},e.prototype._onSourceClose=function(){a.default.v(this.TAG,`MediaSource onSourceClose`),this._mediaSource&&this.e!=null&&(this._mediaSource.removeEventListener(`sourceopen`,this.e.onSourceOpen),this._mediaSource.removeEventListener(`sourceended`,this.e.onSourceEnded),this._mediaSource.removeEventListener(`sourceclose`,this.e.onSourceClose))},e.prototype._hasPendingSegments=function(){var e=this._pendingSegments;return e.video.length>0||e.audio.length>0},e.prototype._hasPendingRemoveRanges=function(){var e=this._pendingRemoveRanges;return e.video.length>0||e.audio.length>0},e.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(s.default.UPDATE_END)},e.prototype._onSourceBufferError=function(e){a.default.e(this.TAG,`SourceBuffer Error: `+e)},e}()}),
2"./src/core/mse-events.js":(function(e,t,n){n.r(t),t.default={ERROR:`error`,SOURCE_OPEN:`source_open`,UPDATE_END:`update_end`,BUFFER_FULL:`buffer_full`}}),
2"./src/core/transmuxer.js":(function(e,t,n){n.r(t);var r=n(`./node_modules/events/events.js`),i=n.n(r),a=n(`./node_modules/webworkify-webpack/index.js`),o=n.n(a),s=n(`./src/utils/logger.js`),c=n(`./src/utils/logging-control.js`),l=n(`./src/core/transmuxing-controller.js`),u=n(`./src/core/transmuxing-events.js`),d=n(`./src/core/media-info.js`);t.default=function(){function e(e,t){if(this.TAG=`Transmuxer`,this._emitter=new(i()),t.enableWorker&&typeof Worker<`u`)try{this._worker=o()(`./src/core/transmuxing-worker.js`),this._workerDestroying=!1,this._worker.addEventListener(`message`,this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:`init`,param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},c.default.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:`logging_config`,param:c.default.getConfig()})}catch{s.default.e(this.TAG,`Error while initialize transmuxing worker, fallback to inline transmuxing`),this._worker=null,this._controller=new l.default(e,t)}else this._controller=new l.default(e,t);if(this._controller){var n=this._controller;n.on(u.default.IO_ERROR,this._onIOError.bind(this)),n.on(u.default.DEMUX_ERROR,this._onDemuxError.bind(this)),n.on(u.default.INIT_SEGMENT,this._onInitSegment.bind(this)),n.on(u.default.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),n.on(u.default.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),n.on(u.default.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),n.on(u.default.MEDIA_INFO,this._onMediaInfo.bind(this)),n.on(u.default.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),n.on(u.default.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),n.on(u.default.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),n.on(u.default.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return e.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:`destroy`}),c.default.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.hasWorker=function(){return this._worker!=null},e.prototype.open=function(){this._worker?this._worker.postMessage({cmd:`start`}):this._controller.start()},e.prototype.close=function(){this._worker?this._worker.postMessage({cmd:`stop`}):this._controller.stop()},e.prototype.seek=function(e){this._worker?this._worker.postMessage({cmd:`seek`,param:e}):this._controller.seek(e)},e.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:`pause`}):this._controller.pause()},e.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:`resume`}):this._controller.resume()},e.prototype._onInitSegment=function(e,t){var n=this;Promise.resolve().then(function(){n._emitter.emit(u.default.INIT_SEGMENT,e,t)})},e.prototype._onMediaSegment=function(e,t){var n=this;Promise.resolve().then(function(){n._emitter.emit(u.default.MEDIA_SEGMENT,e,t)})},e.prototype._onLoadingComplete=function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(u.default.LOADING_COMPLETE)})},e.prototype._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(u.default.RECOVERED_EARLY_EOF)})},e.prototype._onMediaInfo=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(u.default.MEDIA_INFO,e)})},e.prototype._onMetaDataArrived=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(u.default.METADATA_ARRIVED,e)})},e.prototype._onScriptDataArrived=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(u.default.SCRIPTDATA_ARRIVED,e)})},e.prototype._onStatisticsInfo=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(u.default.STATISTICS_INFO,e)})},e.prototype._onIOError=function(e,t){var n=this;Promise.resolve().then(function(){n._emitter.emit(u.default.IO_ERROR,e,t)})},e.prototype._onDemuxError=function(e,t){var n=this;Promise.resolve().then(function(){n._emitter.emit(u.default.DEMUX_ERROR,e,t)})},e.prototype._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(u.default.RECOMMEND_SEEKPOINT,e)})},e.prototype._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:`logging_config`,param:e})},e.prototype._onWorkerMessage=function(e){var t=e.data,n=t.data;if(t.msg===`destroyed`||this._workerDestroying){this._workerDestroying=!1,this._worker.terminate(),this._worker=null;return}switch(t.msg){case u.default.INIT_SEGMENT:case u.default.MEDIA_SEGMENT:this._emitter.emit(t.msg,n.type,n.data);break;case u.default.LOADING_COMPLETE:case u.default.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case u.default.MEDIA_INFO:Object.setPrototypeOf(n,d.default.prototype),this._emitter.emit(t.msg,n);break;case u.default.METADATA_ARRIVED:case u.default.SCRIPTDATA_ARRIVED:case u.default.STATISTICS_INFO:this._emitter.emit(t.msg,n);break;case u.default.IO_ERROR:case u.default.DEMUX_ERROR:this._emitter.emit(t.msg,n.type,n.info);break;case u.default.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,n);break;case`logcat_callback`:s.default.emitter.emit(`log`,n.type,n.logcat);break;default:break}},e}()}),
2"./src/core/transmuxing-controller.js":(function(e,t,n){n.r(t);var r=n(`./node_modules/events/events.js`),i=n.n(r),a=n(`./src/utils/logger.js`),o=n(`./src/utils/browser.js`),s=n(`./src/core/media-info.js`),c=n(`./src/demux/flv-demuxer.js`),l=n(`./src/remux/mp4-remuxer.js`),u=n(`./src/demux/demux-errors.js`),d=n(`./src/io/io-controller.js`),f=n(`./src/core/transmuxing-events.js`);t.default=function(){function e(e,t){this.TAG=`TransmuxingController`,this._emitter=new(i()),this._config=t,e.segments||=[{duration:e.duration,filesize:e.filesize,url:e.url}],typeof e.cors!=`boolean`&&(e.cors=!0),typeof e.withCredentials!=`boolean`&&(e.withCredentials=!1),this._mediaDataSource=e,this._currentSegmentIndex=0;var n=0;this._mediaDataSource.segments.forEach(function(r){r.timestampBase=n,n+=r.duration,r.cors=e.cors,r.withCredentials=e.withCredentials,t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy)}),!isNaN(n)&&this._mediaDataSource.duration!==n&&(this._mediaDataSource.duration=n),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return e.prototype.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&=(this._ioctl.destroy(),null),this._demuxer&&=(this._demuxer.destroy(),null),this._remuxer&&=(this._remuxer.destroy(),null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},e.prototype._loadSegment=function(e,t){this._currentSegmentIndex=e;var n=this._mediaDataSource.segments[e],r=this._ioctl=new d.default(n,this._config,e);r.onError=this._onIOException.bind(this),r.onSeeked=this._onIOSeeked.bind(this),r.onComplete=this._onIOComplete.bind(this),r.onRedirect=this._onIORedirect.bind(this),r.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):r.onDataArrival=this._onInitChunkArrival.bind(this),r.open(t)},e.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},e.prototype._internalAbort=function(){this._ioctl&&=(this._ioctl.destroy(),null)},e.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},e.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},e.prototype.seek=function(e){if(!(this._mediaInfo==null||!this._mediaInfo.isSeekable())){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var n=this._mediaInfo.segments[t];if(n==null)this._pendingSeekTime=e;else{var r=n.getNearestKeyframe(e);this._remuxer.seek(r.milliseconds),this._ioctl.seek(r.fileposition),this._pendingResolveSeekPoint=r.milliseconds}}else{var i=this._mediaInfo.segments[t];if(i==null)this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t);else{var r=i.getNearestKeyframe(e);this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,r.fileposition),this._pendingResolveSeekPoint=r.milliseconds,this._reportSegmentMediaInfo(t)}}this._enableStatisticsReporter()}},e.prototype._searchSegmentIndexContains=function(e){for(var t=this._mediaDataSource.segments,n=t.length-1,r=0;r<t.length;r++)if(e<t[r].timestampBase){n=r-1;break}return n},e.prototype._onInitChunkArrival=function(e,t){var n=this,r=null,i=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,i=this._demuxer.parseChunks(e,t);else if((r=c.default.probe(e)).match){this._demuxer=new c.default(r,this._config),this._remuxer||=new l.default(this._config);var o=this._mediaDataSource;o.duration!=null&&!isNaN(o.duration)&&(this._demuxer.overridedDuration=o.duration),typeof o.hasAudio==`boolean`&&(this._demuxer.overridedHasAudio=o.hasAudio),typeof o.hasVideo==`boolean`&&(this._demuxer.overridedHasVideo=o.hasVideo),this._demuxer.timestampBase=o.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),i=this._demuxer.parseChunks(e,t)}else r=null,a.default.e(this.TAG,`Non-FLV, Unsupported media type!`),Promise.resolve().then(function(){n._internalAbort()}),this._emitter.emit(f.default.DEMUX_ERROR,u.default.FORMAT_UNSUPPORTED,`Non-FLV, Unsupported media type`),i=0;return i},e.prototype._onMediaInfo=function(e){var t=this;this._mediaInfo??(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,s.default.prototype));var n=Object.assign({},e);Object.setPrototypeOf(n,s.default.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=n,this._reportSegmentMediaInfo(this._currentSegmentIndex),this._pendingSeekTime!=null&&Promise.resolve().then(function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)})},e.prototype._onMetaDataArrived=function(e){this._emitter.emit(f.default.METADATA_ARRIVED,e)},e.prototype._onScriptDataArrived=function(e){this._emitter.emit(f.default.SCRIPTDATA_ARRIVED,e)},e.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},e.prototype._onIOComplete=function(e){var t=e+1;t<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer.flushStashedSamples(),this._loadSegment(t)):(this._remuxer.flushStashedSamples(),this._emitter.emit(f.default.LOADING_COMPLETE),this._disableStatisticsReporter())},e.prototype._onIORedirect=function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e},e.prototype._onIORecoveredEarlyEof=function(){this._emitter.emit(f.default.RECOVERED_EARLY_EOF)},e.prototype._onIOException=function(e,t){a.default.e(this.TAG,`IOException: type = `+e+`, code = `+t.code+`, msg = `+t.msg),this._emitter.emit(f.default.IO_ERROR,e,t),this._disableStatisticsReporter()},e.prototype._onDemuxException=function(e,t){a.default.e(this.TAG,`DemuxException: type = `+e+`, info = `+t),this._emitter.emit(f.default.DEMUX_ERROR,e,t)},e.prototype._onRemuxerInitSegmentArrival=function(e,t){this._emitter.emit(f.default.INIT_SEGMENT,e,t)},e.prototype._onRemuxerMediaSegmentArrival=function(e,t){if(this._pe
2ndingSeekTime==null&&(this._emitter.emit(f.default.MEDIA_SEGMENT,e,t),this._pendingResolveSeekPoint!=null&&e===`video`)){var n=t.info.syncPoints,r=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,o.default.safari&&n.length>0&&n[0].originalDts===r&&(r=n[0].pts),this._emitter.emit(f.default.RECOMMEND_SEEKPOINT,r)}},e.prototype._enableStatisticsReporter=function(){this._statisticsReporter??=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},e.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&=(self.clearInterval(this._statisticsReporter),null)},e.prototype._reportSegmentMediaInfo=function(e){var t=this._mediaInfo.segments[e],n=Object.assign({},t);n.duration=this._mediaInfo.duration,n.segmentCount=this._mediaInfo.segmentCount,delete n.segments,delete n.keyframesIndex,this._emitter.emit(f.default.MEDIA_INFO,n)},e.prototype._reportStatisticsInfo=function(){var e={};e.url=this._ioctl.currentURL,e.hasRedirect=this._ioctl.hasRedirect,e.hasRedirect&&(e.redirectedURL=this._ioctl.currentRedirectedURL),e.speed=this._ioctl.currentSpeed,e.loaderType=this._ioctl.loaderType,e.currentSegmentIndex=this._currentSegmentIndex,e.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(f.default.STATISTICS_INFO,e)},e}()}),
2"./src/core/transmuxing-events.js":(function(e,t,n){n.r(t),t.default={IO_ERROR:`io_error`,DEMUX_ERROR:`demux_error`,INIT_SEGMENT:`init_segment`,MEDIA_SEGMENT:`media_segment`,LOADING_COMPLETE:`loading_complete`,RECOVERED_EARLY_EOF:`recovered_early_eof`,MEDIA_INFO:`media_info`,METADATA_ARRIVED:`metadata_arrived`,SCRIPTDATA_ARRIVED:`scriptdata_arrived`,STATISTICS_INFO:`statistics_info`,RECOMMEND_SEEKPOINT:`recommend_seekpoint`}}),
2"./src/core/transmuxing-worker.js":(function(e,t,n){n.r(t);var r=n(`./src/utils/logging-control.js`),i=n(`./src/utils/polyfill.js`),a=n(`./src/core/transmuxing-controller.js`),o=n(`./src/core/transmuxing-events.js`);t.default=function(e){var t=null,n=v.bind(this);i.default.install(),e.addEventListener(`message`,function(i){switch(i.data.cmd){case`init`:t=new a.default(i.data.param[0],i.data.param[1]),t.on(o.default.IO_ERROR,h.bind(this)),t.on(o.default.DEMUX_ERROR,g.bind(this)),t.on(o.default.INIT_SEGMENT,s.bind(this)),t.on(o.default.MEDIA_SEGMENT,c.bind(this)),t.on(o.default.LOADING_COMPLETE,l.bind(this)),t.on(o.default.RECOVERED_EARLY_EOF,u.bind(this)),t.on(o.default.MEDIA_INFO,d.bind(this)),t.on(o.default.METADATA_ARRIVED,f.bind(this)),t.on(o.default.SCRIPTDATA_ARRIVED,p.bind(this)),t.on(o.default.STATISTICS_INFO,m.bind(this)),t.on(o.default.RECOMMEND_SEEKPOINT,_.bind(this));break;case`destroy`:t&&=(t.destroy(),null),e.postMessage({msg:`destroyed`});break;case`start`:t.start();break;case`stop`:t.stop();break;case`seek`:t.seek(i.data.param);break;case`pause`:t.pause();break;case`resume`:t.resume();break;case`logging_config`:var v=i.data.param;r.default.applyConfig(v),v.enableCallback===!0?r.default.addLogListener(n):r.default.removeLogListener(n);break}});function s(t,n){var r={msg:o.default.INIT_SEGMENT,data:{type:t,data:n}};e.postMessage(r,[n.data])}function c(t,n){var r={msg:o.default.MEDIA_SEGMENT,data:{type:t,data:n}};e.postMessage(r,[n.data])}function l(){var t={msg:o.default.LOADING_COMPLETE};e.postMessage(t)}function u(){var t={msg:o.default.RECOVERED_EARLY_EOF};e.postMessage(t)}function d(t){var n={msg:o.default.MEDIA_INFO,data:t};e.postMessage(n)}function f(t){var n={msg:o.default.METADATA_ARRIVED,data:t};e.postMessage(n)}function p(t){var n={msg:o.default.SCRIPTDATA_ARRIVED,data:t};e.postMessage(n)}function m(t){var n={msg:o.default.STATISTICS_INFO,data:t};e.postMessage(n)}function h(t,n){e.postMessage({msg:o.default.IO_ERROR,data:{type:t,info:n}})}function g(t,n){e.postMessage({msg:o.default.DEMUX_ERROR,data:{type:t,info:n}})}function _(t){e.postMessage({msg:o.default.RECOMMEND_SEEKPOINT,data:t})}function v(t,n){e.postMessage({msg:`logcat_callback`,data:{type:t,logcat:n}})}}}),
2"./src/demux/amf-parser.js":(function(e,t,n){n.r(t);var r=n(`./src/utils/logger.js`),i=n(`./src/utils/utf8-conv.js`),a=n(`./src/utils/exception.js`),o=(function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();t.default=function(){function e(){}return e.parseScriptData=function(t,n,i){var a={};try{var o=e.parseValue(t,n,i),s=e.parseValue(t,n+o.size,i-o.size);a[o.data]=s.data}catch(e){r.default.e(`AMF`,e.toString())}return a},e.parseObject=function(t,n,r){if(r<3)throw new a.IllegalStateException(`Data not enough when parse ScriptDataObject`);var i=e.parseString(t,n,r),o=e.parseValue(t,n+i.size,r-i.size),s=o.objectEnd;return{data:{name:i.data,value:o.data},size:i.size+o.size,objectEnd:s}},e.parseVariable=function(t,n,r){return e.parseObject(t,n,r)},e.parseString=function(e,t,n){if(n<2)throw new a.IllegalStateException(`Data not enough when parse String`);var r=new DataView(e,t,n).getUint16(0,!o);return{data:r>0?(0,i.default)(new Uint8Array(e,t+2,r)):``,size:2+r}},e.parseLongString=function(e,t,n){if(n<4)throw new a.IllegalStateException(`Data not enough when parse LongString`);var r=new DataView(e,t,n).getUint32(0,!o);return{data:r>0?(0,i.default)(new Uint8Array(e,t+4,r)):``,size:4+r}},e.parseDate=function(e,t,n){if(n<10)throw new a.IllegalStateException(`Data size invalid when parse Date`);var r=new DataView(e,t,n),i=r.getFloat64(0,!o),s=r.getInt16(8,!o);return i+=s*60*1e3,{data:new Date(i),size:10}},e.parseValue=function(t,n,i){if(i<1)throw new a.IllegalStateException(`Data not enough when parse Value`);var s=new DataView(t,n,i),c=1,l=s.getUint8(0),u,d=!1;try{switch(l){case 0:u=s.getFloat64(1,!o),c+=8;break;case 1:u=!!s.getUint8(1),c+=1;break;case 2:var f=e.parseString(t,n+1,i-1);u=f.data,c+=f.size;break;case 3:u={};var p=0;for((s.getUint32(i-4,!o)&16777215)==9&&(p=3);c<i-4;){var m=e.parseObject(t,n+c,i-c-p);if(m.objectEnd)break;u[m.data.name]=m.data.value,c+=m.size}if(c<=i-3){var h=s.getUint32(c-1,!o)&16777215;h===9&&(c+=3)}break;case 8:u={},c+=4;var p=0;for((s.getUint32(i-4,!o)&16777215)==9&&(p=3);c<i-8;){var g=e.parseVariable(t,n+c,i-c-p);if(g.objectEnd)break;u[g.data.name]=g.data.value,c+=g.size}if(c<=i-3){var h=s.getUint32(c-1,!o)&16777215;h===9&&(c+=3)}break;case 9:u=void 0,c=1,d=!0;break;case 10:u=[];var _=s.getUint32(1,!o);c+=4;for(var v=0;v<_;v++){var y=e.parseValue(t,n+c,i-c);u.push(y.data),c+=y.size}break;case 11:var b=e.parseDate(t,n+1,i-1);u=b.data,c+=b.size;break;case 12:var x=e.parseString(t,n+1,i-1);u=x.data,c+=x.size;break;default:c=i,r.default.w(`AMF`,`Unsupported AMF value type `+l)}}catch(e){r.default.e(`AMF`,e.toString())}return{data:u,size:c,objectEnd:d}},e}()}),
2"./src/demux/demux-errors.js":(function(e,t,n){n.r(t),t.default={OK:`OK`,FORMAT_ERROR:`FormatError`,FORMAT_UNSUPPORTED:`FormatUnsupported`,CODEC_UNSUPPORTED:`CodecUnsupported`}}),
2"./src/demux/exp-golomb.js":(function(e,t,n){n.r(t);var r=n(`./src/utils/exception.js`);t.default=function(){function e(e){this.TAG=`ExpGolomb`,this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=e.byteLength*8,this._current_word=0,this._current_word_bits_left=0}return e.prototype.destroy=function(){this._buffer=null},e.prototype._fillCurrentWord=function(){var e=this._total_bytes-this._buffer_index;if(e<=0)throw new r.IllegalStateException(`ExpGolomb: _fillCurrentWord() but no bytes available`);var t=Math.min(4,e),n=new Uint8Array(4);n.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(n.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=t*8},e.prototype.readBits=function(e){if(e>32)throw new r.InvalidArgumentException(`ExpGolomb: readBits() bits exceeded max 32bits!`);if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var n=this._current_word_bits_left?this._current_word:0;n>>>=32-this._current_word_bits_left;var i=e-this._current_word_bits_left;this._fillCurrentWord();var a=Math.min(i,this._current_word_bits_left),o=this._current_word>>>32-a;return this._current_word<<=a,this._current_word_bits_left-=a,n=n<<a|o,n},e.prototype.readBool=function(){return this.readBits(1)===1},e.prototype.readByte=function(){return this.readBits(8)},e.prototype._skipLeadingZero=function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(this._current_word&2147483648>>>e)return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()},e.prototype.readUEG=function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1},e.prototype.readSEG=function(){var e=this.readUEG();return e&1?e+1>>>1:-1*(e>>>1)},e}()}),
2"./src/demux/flv-demuxer.js":(function(e,t,n){n.r(t);var r=n(`./src/utils/logger.js`),i=n(`./src/demux/amf-parser.js`),a=n(`./src/demux/sps-parser.js`),o=n(`./src/demux/demux-errors.js`),s=n(`./src/core/media-info.js`),c=n(`./src/utils/exception.js`);function l(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}t.default=function(){function e(e,t){this.TAG=`FLVDemuxer`,this._config=t,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=e.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=e.hasAudioTrack,this._hasVideo=e.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new s.default,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:`video`,id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:`audio`,id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=(function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})()}return e.prototype.destroy=function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null},e.probe=function(e){var t=new Uint8Array(e),n={match:!1};if(t[0]!==70||t[1]!==76||t[2]!==86||t[3]!==1)return n;var r=(t[4]&4)>>>2!=0,i=(t[4]&1)!=0,a=l(t,5);return a<9?n:{match:!0,consumed:a,dataOffset:a,hasAudioTrack:r,hasVideoTrack:i}},e.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(e.prototype,`onTrackMetadata`,{get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onMediaInfo`,{get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onMetaDataArrived`,{get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onScriptDataArrived`,{get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onError`,{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onDataAvailable`,{get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`timestampBase`,{get:function(){return this._timestampBase},set:function(e){this._timestampBase=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`overridedDuration`,{get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`overridedHasAudio`,{set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e}
2,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`overridedHasVideo`,{set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e},enumerable:!1,configurable:!0}),e.prototype.resetMediaInfo=function(){this._mediaInfo=new s.default},e.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!this._hasAudio&&this._hasVideo?this._videoInitialMetadataDispatched:!1},e.prototype.parseChunks=function(t,n){if(!this._onError||!this._onMediaInfo||!this._onTrackMetadata||!this._onDataAvailable)throw new c.IllegalStateException(`Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified`);var i=0,a=this._littleEndian;if(n===0)if(t.byteLength>13)i=e.probe(t).dataOffset;else return 0;if(this._firstParse){this._firstParse=!1,n+i!==this._dataOffset&&r.default.w(this.TAG,`First time parsing but chunk byteStart invalid!`);var o=new DataView(t,i);o.getUint32(0,!a)!==0&&r.default.w(this.TAG,`PrevTagSize0 !== 0 !!!`),i+=4}for(;i<t.byteLength;){this._dispatch=!0;var o=new DataView(t,i);if(i+11+4>t.byteLength)break;var s=o.getUint8(0),l=o.getUint32(0,!a)&16777215;if(i+11+l+4>t.byteLength)break;if(s!==8&&s!==9&&s!==18){r.default.w(this.TAG,`Unsupported tag type `+s+`, skipped`),i+=11+l+4;continue}var u=o.getUint8(4),d=o.getUint8(5),f=o.getUint8(6),p=o.getUint8(7),m=f|d<<8|u<<16|p<<24;o.getUint32(7,!a)&16777215&&r.default.w(this.TAG,`Meet tag which has StreamID != 0!`);var h=i+11;switch(s){case 8:this._parseAudioData(t,h,l,m);break;case 9:this._parseVideoData(t,h,l,m,n+i);break;case 18:this._parseScriptData(t,h,l);break}var g=o.getUint32(11+l,!a);g!==11+l&&r.default.w(this.TAG,`Invalid PrevTagSize `+g),i+=11+l+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),i},e.prototype._parseScriptData=function(e,t,n){var a=i.default.parseScriptData(e,t,n);if(a.hasOwnProperty(`onMetaData`)){if(a.onMetaData==null||typeof a.onMetaData!=`object`){r.default.w(this.TAG,`Invalid onMetaData structure!`);return}this._metadata&&r.default.w(this.TAG,`Found another onMetaData tag!`),this._metadata=a;var o=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},o)),typeof o.hasAudio==`boolean`&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=o.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),typeof o.hasVideo==`boolean`&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=o.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),typeof o.audiodatarate==`number`&&(this._mediaInfo.audioDataRate=o.audiodatarate),typeof o.videodatarate==`number`&&(this._mediaInfo.videoDataRate=o.videodatarate),typeof o.width==`number`&&(this._mediaInfo.width=o.width),typeof o.height==`number`&&(this._mediaInfo.height=o.height),typeof o.duration==`number`){if(!this._durationOverrided){var s=Math.floor(o.duration*this._timescale);this._duration=s,this._mediaInfo.duration=s}}else this._mediaInfo.duration=0;if(typeof o.framerate==`number`){var c=Math.floor(o.framerate*1e3);if(c>0){var l=c/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=l,this._referenceFrameRate.fps_num=c,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=l}}if(typeof o.keyframes==`object`){this._mediaInfo.hasKeyframesIndex=!0;var u=o.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(u),o.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=o,r.default.v(this.TAG,`Parsed onMetaData`),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(a).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},a))},e.prototype._parseKeyframesIndex=function(e){for(var t=[],n=[],r=1;r<e.times.length;r++){var i=this._timestampBase+Math.floor(e.times[r]*1e3);t.push(i),n.push(e.filepositions[r])}return{times:t,filepositions:n}},e.prototype._parseAudioData=function(e,t,n,i){if(n<=1){r.default.w(this.TAG,`Flv: Invalid audio packet, missing SoundData payload!`);return}if(!(this._hasAudioFlagOverrided===!0&&this._hasAudio===!1)){this._littleEndian;var a=new DataView(e,t,n).getUint8(0),s=a>>>4;if(s!==2&&s!==10){this._onError(o.default.CODEC_UNSUPPORTED,`Flv: Unsupported audio codec idx: `+s);return}var c=0,l=(a&12)>>>2;if(l>=0&&l<=4)c=this._flvSoundRateTable[l];else{this._onError(o.default.FORMAT_ERROR,`Flv: Invalid audio sample rate idx: `+l);return}(a&2)>>>1;var u=a&1,d=this._audioMetadata,f=this._audioTrack;if(d||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),d=this._audioMetadata={},d.type=`audio`,d.id=f.id,d.timescale=this._timescale,d.duration=this._duration,d.audioSampleRate=c,d.channelCount=u===0?1:2),s===10){var p=this._parseAACAudioData(e,t+1,n-1);if(p==null)return;if(p.packetType===0){d.config&&r.default.w(this.TAG,`Found another AudioSpecificConfig!`);var m=p.data;d.audioSampleRate=m.samplingRate,d.channelCount=m.channelCount,d.co
2dec=m.codec,d.originalCodec=m.originalCodec,d.config=m.config,d.refSampleDuration=1024/d.audioSampleRate*d.timescale,r.default.v(this.TAG,`Parsed AudioSpecificConfig`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`audio`,d);var h=this._mediaInfo;h.audioCodec=d.originalCodec,h.audioSampleRate=d.audioSampleRate,h.audioChannelCount=d.channelCount,h.hasVideo?h.videoCodec!=null&&(h.mimeType=`video/x-flv; codecs="`+h.videoCodec+`,`+h.audioCodec+`"`):h.mimeType=`video/x-flv; codecs="`+h.audioCodec+`"`,h.isComplete()&&this._onMediaInfo(h)}else if(p.packetType===1){var g=this._timestampBase+i,_={unit:p.data,length:p.data.byteLength,dts:g,pts:g};f.samples.push(_),f.length+=p.data.length}else r.default.e(this.TAG,`Flv: Unsupported AAC data type `+p.packetType)}else if(s===2){if(!d.codec){var m=this._parseMP3AudioData(e,t+1,n-1,!0);if(m==null)return;d.audioSampleRate=m.samplingRate,d.channelCount=m.channelCount,d.codec=m.codec,d.originalCodec=m.originalCodec,d.refSampleDuration=1152/d.audioSampleRate*d.timescale,r.default.v(this.TAG,`Parsed MPEG Audio Frame Header`),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata(`audio`,d);var h=this._mediaInfo;h.audioCodec=d.codec,h.audioSampleRate=d.audioSampleRate,h.audioChannelCount=d.channelCount,h.audioDataRate=m.bitRate,h.hasVideo?h.videoCodec!=null&&(h.mimeType=`video/x-flv; codecs="`+h.videoCodec+`,`+h.audioCodec+`"`):h.mimeType=`video/x-flv; codecs="`+h.audioCodec+`"`,h.isComplete()&&this._onMediaInfo(h)}var v=this._parseMP3AudioData(e,t+1,n-1,!1);if(v==null)return;var g=this._timestampBase+i,y={unit:v,length:v.byteLength,dts:g,pts:g};f.samples.push(y),f.length+=v.length}}},e.prototype._parseAACAudioData=function(e,t,n){if(n<=1){r.default.w(this.TAG,`Flv: Invalid AAC packet, missing AACPacketType or/and Data!`);return}var i={},a=new Uint8Array(e,t,n);return i.packetType=a[0],a[0]===0?i.data=this._parseAACAudioSpecificConfig(e,t+1,n-1):i.data=a.subarray(1),i},e.prototype._parseAACAudioSpecificConfig=function(e,t,n){var r=new Uint8Array(e,t,n),i=null,a=0,s=0,c=0,l=null;if(a=s=r[0]>>>3,c=(r[0]&7)<<1|r[1]>>>7,c<0||c>=this._mpegSamplingRates.length){this._onError(o.default.FORMAT_ERROR,`Flv: AAC invalid sampling frequency index!`);return}var u=this._mpegSamplingRates[c],d=(r[1]&120)>>>3;if(d<0||d>=8){this._onError(o.default.FORMAT_ERROR,`Flv: AAC invalid channel configuration`);return}a===5&&(l=(r[1]&7)<<1|r[2]>>>7,(r[2]&124)>>>2);var f=self.navigator.userAgent.toLowerCase();return f.indexOf(`firefox`)===-1?f.indexOf(`android`)===-1?(a=5,l=c,i=[,,,,],c>=6?l=c-3:d===1&&(a=2,i=[,,],l=c)):(a=2,i=[,,],l=c):c>=6?(a=5,i=[,,,,],l=c-3):(a=2,i=[,,],l=c),i[0]=a<<3,i[0]|=(c&15)>>>1,i[1]=(c&15)<<7,i[1]|=(d&15)<<3,a===5&&(i[1]|=(l&15)>>>1,i[2]=(l&1)<<7,i[2]|=8,i[3]=0),{config:i,samplingRate:u,channelCount:d,codec:`mp4a.40.`+a,originalCodec:`mp4a.40.`+s}},e.prototype._parseMP3AudioData=function(e,t,n,i){if(n<4){r.default.w(this.TAG,`Flv: Invalid MP3 packet, header missing!`);return}this._littleEndian;var a=new Uint8Array(e,t,n),o=null;if(i){if(a[0]!==255)return;var s=a[1]>>>3&3,c=(a[1]&6)>>1,l=(a[2]&240)>>>4,u=(a[2]&12)>>>2,d=(a[3]>>>6&3)==3?1:2,f=0,p=0,m=`mp3`;switch(s){case 0:f=this._mpegAudioV25SampleRateTable[u];break;case 2:f=this._mpegAudioV20SampleRateTable[u];break;case 3:f=this._mpegAudioV10SampleRateTable[u];break}switch(c){case 1:l<this._mpegAudioL3BitRateTable.length&&(p=this._mpegAudioL3BitRateTable[l]);break;case 2:l<this._mpegAudioL2BitRateTable.length&&(p=this._mpegAudioL2BitRateTable[l]);break;case 3:l<this._mpegAudioL1BitRateTable.length&&(p=this._mpegAudioL1BitRateTable[l]);break}o={bitRate:p,samplingRate:f,channelCount:d,codec:m,originalCodec:m}}else o=a;return o},e.prototype._parseVideoData=function(e,t,n,i,a){if(n<=1){r.default.w(this.TAG,`Flv: Invalid video packet, missing VideoData payload!`);return}if(!(this._hasVideoFlagOverrided===!0&&this._hasVideo===!1)){var s=new Uint8Array(e,t,n)[0],c=(s&240)>>>4,l=s&15;if(l!==7){this._onError(o.default.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: `+l);return}this._parseAVCVideoPacket(e,t+1,n-1,i,a,c)}}
2,e.prototype._parseAVCVideoPacket=function(e,t,n,i,a,s){if(n<4){r.default.w(this.TAG,`Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime`);return}var c=this._littleEndian,l=new DataView(e,t,n),u=l.getUint8(0),d=(l.getUint32(0,!c)&16777215)<<8>>8;if(u===0)this._parseAVCDecoderConfigurationRecord(e,t+4,n-4);else if(u===1)this._parseAVCVideoData(e,t+4,n-4,i,a,s,d);else if(u!==2){this._onError(o.default.FORMAT_ERROR,`Flv: Invalid video packet type `+u);return}},e.prototype._parseAVCDecoderConfigurationRecord=function(e,t,n){if(n<7){r.default.w(this.TAG,`Flv: Invalid AVCDecoderConfigurationRecord, lack of data!`);return}var i=this._videoMetadata,s=this._videoTrack,c=this._littleEndian,l=new DataView(e,t,n);i?i.avcc!==void 0&&r.default.w(this.TAG,`Found another AVCDecoderConfigurationRecord!`):(this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),i=this._videoMetadata={},i.type=`video`,i.id=s.id,i.timescale=this._timescale,i.duration=this._duration);var u=l.getUint8(0),d=l.getUint8(1);if(l.getUint8(2),l.getUint8(3),u!==1||d===0){this._onError(o.default.FORMAT_ERROR,`Flv: Invalid AVCDecoderConfigurationRecord`);return}if(this._naluLengthSize=(l.getUint8(4)&3)+1,this._naluLengthSize!==3&&this._naluLengthSize!==4){this._onError(o.default.FORMAT_ERROR,`Flv: Strange NaluLengthSizeMinusOne: `+(this._naluLengthSize-1));return}var f=l.getUint8(5)&31;if(f===0){this._onError(o.default.FORMAT_ERROR,`Flv: Invalid AVCDecoderConfigurationRecord: No SPS`);return}else f>1&&r.default.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: SPS Count = `+f);for(var p=6,m=0;m<f;m++){var h=l.getUint16(p,!c);if(p+=2,h!==0){var g=new Uint8Array(e,t+p,h);p+=h;var _=a.default.parseSPS(g);if(m===0){i.codecWidth=_.codec_size.width,i.codecHeight=_.codec_size.height,i.presentWidth=_.present_size.width,i.presentHeight=_.present_size.height,i.profile=_.profile_string,i.level=_.level_string,i.bitDepth=_.bit_depth,i.chromaFormat=_.chroma_format,i.sarRatio=_.sar_ratio,i.frameRate=_.frame_rate,(_.frame_rate.fixed===!1||_.frame_rate.fps_num===0||_.frame_rate.fps_den===0)&&(i.frameRate=this._referenceFrameRate);var v=i.frameRate.fps_den,y=i.frameRate.fps_num;i.refSampleDuration=i.timescale*(v/y);for(var b=g.subarray(1,4),x=`avc1.`,S=0;S<3;S++){var C=b[S].toString(16);C.length<2&&(C=`0`+C),x+=C}i.codec=x;var w=this._mediaInfo;w.width=i.codecWidth,w.height=i.codecHeight,w.fps=i.frameRate.fps,w.profile=i.profile,w.level=i.level,w.refFrames=_.ref_frames,w.chromaFormat=_.chroma_format_string,w.sarNum=i.sarRatio.width,w.sarDen=i.sarRatio.height,w.videoCodec=x,w.hasAudio?w.audioCodec!=null&&(w.mimeType=`video/x-flv; codecs="`+w.videoCodec+`,`+w.audioCodec+`"`):w.mimeType=`video/x-flv; codecs="`+w.videoCodec+`"`,w.isComplete()&&this._onMediaInfo(w)}}}var T=l.getUint8(p);if(T===0){this._onError(o.default.FORMAT_ERROR,`Flv: Invalid AVCDecoderConfigurationRecord: No PPS`);return}else T>1&&r.default.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: PPS Count = `+T);p++;for(var m=0;m<T;m++){var h=l.getUint16(p,!c);p+=2,h!==0&&(p+=h)}i.avcc=new Uint8Array(n),i.avcc.set(new Uint8Array(e,t,n),0),r.default.v(this.TAG,`Parsed AVCDecoderConfigurationRecord`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`video`,i)},e.prototype._parseAVCVideoData=function(e,t,n,i,a,o,s){for(var c=this._littleEndian,l=new DataView(e,t,n),u=[],d=0,f=0,p=this._naluLengthSize,m=this._timestampBase+i,h=o===1;f<n;){if(f+4>=n){r.default.w(this.TAG,`Malformed Nalu near timestamp `+m+`, offset = `+f+`, dataSize = `+n);break}var g=l.getUint32(f,!c);if(p===3&&(g>>>=8),g>n-p){r.default.w(this.TAG,`Malformed Nalus near timestamp `+m+`, NaluSize > DataSize!`);return}var _=l.getUint8(f+p)&31;_===5&&(h=!0);var v=new Uint8Array(e,t+f,p+g),y={type:_,data:v};u.push(y),d+=v.byteLength,f+=p+g}if(u.length){var b=this._videoTrack,x={units:u,length:d,isKeyframe:h,dts:m,cts:s,pts:m+s};h&&(x.fileposition=a),b.samples.push(x),b.length+=d}},e}()}),
2"./src/demux/sps-parser.js":(function(e,t,n){n.r(t);var r=n(`./src/demux/exp-golomb.js`);t.default=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,n=t.byteLength,r=new Uint8Array(n),i=0,a=0;a<n;a++)a>=2&&t[a]===3&&t[a-1]===0&&t[a-2]===0||(r[i]=t[a],i++);return new Uint8Array(r.buffer,0,i)},e.parseSPS=function(t){var n=e._ebsp2rbsp(t),i=new r.default(n);i.readByte();var a=i.readByte();i.readByte();var o=i.readByte();i.readUEG();var s=e.getProfileString(a),c=e.getLevelString(o),l=1,u=420,d=[0,420,422,444],f=8;if((a===100||a===110||a===122||a===244||a===44||a===83||a===86||a===118||a===128||a===138||a===144)&&(l=i.readUEG(),l===3&&i.readBits(1),l<=3&&(u=d[l]),f=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool()))for(var p=l===3?12:8,m=0;m<p;m++)i.readBool()&&(m<6?e._skipScalingList(i,16):e._skipScalingList(i,64));i.readUEG();var h=i.readUEG();if(h===0)i.readUEG();else if(h===1){i.readBits(1),i.readSEG(),i.readSEG();for(var g=i.readUEG(),m=0;m<g;m++)i.readSEG()}var _=i.readUEG();i.readBits(1);var v=i.readUEG(),y=i.readUEG(),b=i.readBits(1);b===0&&i.readBits(1),i.readBits(1);var x=0,S=0,C=0,w=0;i.readBool()&&(x=i.readUEG(),S=i.readUEG(),C=i.readUEG(),w=i.readUEG());var T=1,E=1,D=0,O=!0,k=0,A=0;if(i.readBool()){if(i.readBool()){var j=i.readByte();j>0&&j<16?(T=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][j-1],E=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][j-1]):j===255&&(T=i.readByte()<<8|i.readByte(),E=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){var M=i.readBits(32),N=i.readBits(32);O=i.readBool(),k=N,A=M*2,D=k/A}}var ee=1;(T!==1||E!==1)&&(ee=T/E);var P=0,F=0;if(l===0)P=1,F=2-b;else{var te=l===3?1:2,ne=l===1?2:1;P=te,F=ne*(2-b)}var re=(v+1)*16,ie=(2-b)*((y+1)*16);re-=(x+S)*P,ie-=(C+w)*F;var ae=Math.ceil(re*ee);return i.destroy(),i=null,{profile_string:s,level_string:c,bit_depth:f,ref_frames:_,chroma_format:u,chroma_format_string:e.getChromaFormatString(u),frame_rate:{fixed:O,fps:D,fps_den:A,fps_num:k},sar_ratio:{width:T,height:E},codec_size:{width:re,height:ie},present_size:{width:ae,height:ie}}},e._skipScalingList=function(e,t){for(var n=8,r=8,i=0,a=0;a<t;a++)r!==0&&(i=e.readSEG(),r=(n+i+256)%256),n=r===0?n:r},e.getProfileString=function(e){switch(e){case 66:return`Baseline`;case 77:return`Main`;case 88:return`Extended`;case 100:return`High`;case 110:return`High10`;case 122:return`High422`;case 244:return`High444`;default:return`Unknown`}},e.getLevelString=function(e){return(e/10).toFixed(1)},e.getChromaFormatString=function(e){switch(e){case 420:return`4:2:0`;case 422:return`4:2:2`;case 444:return`4:4:4`;default:return`Unknown`}},e}()}),
2"./src/flv.js":(function(e,t,n){n.r(t);var r=n(`./src/utils/polyfill.js`),i=n(`./src/core/features.js`),a=n(`./src/io/loader.js`),o=n(`./src/player/flv-player.js`),s=n(`./src/player/native-player.js`),c=n(`./src/player/player-events.js`),l=n(`./src/player/player-errors.js`),u=n(`./src/utils/logging-control.js`),d=n(`./src/utils/exception.js`);r.default.install();function f(e,t){var n=e;if(typeof n!=`object`||!n)throw new d.InvalidArgumentException(`MediaDataSource must be an javascript object!`);if(!n.hasOwnProperty(`type`))throw new d.InvalidArgumentException(`MediaDataSource must has type field to indicate video file type!`);switch(n.type){case`flv`:return new o.default(n,t);default:return new s.default(n,t)}}function p(){return i.default.supportMSEH264Playback()}function m(){return i.default.getFeatureList()}var h={};h.createPlayer=f,h.isSupported=p,h.getFeatureList=m,h.BaseLoader=a.BaseLoader,h.LoaderStatus=a.LoaderStatus,h.LoaderErrors=a.LoaderErrors,h.Events=c.default,h.ErrorTypes=l.ErrorTypes,h.ErrorDetails=l.ErrorDetails,h.FlvPlayer=o.default,h.NativePlayer=s.default,h.LoggingControl=u.default,Object.defineProperty(h,`version`,{enumerable:!0,get:function(){return`1.6.2`}}),t.default=h}),
2"./src/index.js":(function(e,t,n){e.exports=n(`./src/flv.js`).default}),
2"./src/io/fetch-stream-loader.js":(function(e,t,n){n.r(t);var r=n(`./src/utils/browser.js`),i=n(`./src/io/loader.js`),a=n(`./src/utils/exception.js`),o=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();t.default=function(e){o(t,e);function t(t,n){var r=e.call(this,`fetch-stream-loader`)||this;return r.TAG=`FetchStreamLoader`,r._seekHandler=t,r._config=n,r._needStash=!0,r._requestAbort=!1,r._contentLength=null,r._receivedLength=0,r}return t.isSupported=function(){try{var e=r.default.msedge&&r.default.version.minor>=15048,t=r.default.msedge?e:!0;return self.fetch&&self.ReadableStream&&t}catch{return!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){var n=this;this._dataSource=e,this._range=t;var r=e.url;this._config.reuseRedirectedURL&&e.redirectedURL!=null&&(r=e.redirectedURL);var o=this._seekHandler.getConfig(r,t),s=new self.Headers;if(typeof o.headers==`object`){var c=o.headers;for(var l in c)c.hasOwnProperty(l)&&s.append(l,c[l])}var u={method:`GET`,headers:s,mode:`cors`,cache:`default`,referrerPolicy:`no-referrer-when-downgrade`};if(typeof this._config.headers==`object`)for(var l in this._config.headers)s.append(l,this._config.headers[l]);e.cors===!1&&(u.mode=`same-origin`),e.withCredentials&&(u.credentials=`include`),e.referrerPolicy&&(u.referrerPolicy=e.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,u.signal=this._abortController.signal),this._status=i.LoaderStatus.kConnecting,self.fetch(o.url,u).then(function(e){if(n._requestAbort){n._status=i.LoaderStatus.kIdle,e.body.cancel();return}if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==o.url&&n._onURLRedirect){var t=n._seekHandler.removeURLParameters(e.url);n._onURLRedirect(t)}var r=e.headers.get(`Content-Length`);return r!=null&&(n._contentLength=parseInt(r),n._contentLength!==0&&n._onContentLengthKnown&&n._onContentLengthKnown(n._contentLength)),n._pump.call(n,e.body.getReader())}else if(n._status=i.LoaderStatus.kError,n._onError)n._onError(i.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText});else throw new a.RuntimeException(`FetchStreamLoader: Http code invalid, `+e.status+` `+e.statusText)}).catch(function(e){if(!(n._abortController&&n._abortController.signal.aborted))if(n._status=i.LoaderStatus.kError,n._onError)n._onError(i.LoaderErrors.EXCEPTION,{code:-1,msg:e.message});else throw e})},t.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==i.LoaderStatus.kBuffering||!r.default.chrome)&&this._abortController)try{this._abortController.abort()}catch{}},t.prototype._pump=function(e){var t=this;return e.read().then(function(n){if(n.done)if(t._contentLength!==null&&t._receivedLength<t._contentLength){t._status=i.LoaderStatus.kError;var r=i.LoaderErrors.EARLY_EOF,o={code:-1,msg:`Fetch stream meet Early-EOF`};if(t._onError)t._onError(r,o);else throw new a.RuntimeException(o.msg)}else t._status=i.LoaderStatus.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(t._abortController&&t._abortController.signal.aborted){t._status=i.LoaderStatus.kComplete;return}else if(t._requestAbort===!0)return t._status=i.LoaderStatus.kComplete,e.cancel();t._status=i.LoaderStatus.kBuffering;var s=n.value.buffer,c=t._range.from+t._receivedLength;t._receivedLength+=s.byteLength,t._onDataArrival&&t._onDataArrival(s,c,t._receivedLength),t._pump(e)}}).catch(function(e){if(t._abortController&&t._abortController.signal.aborted){t._status=i.LoaderStatus.kComplete;return}if(!(e.code===11&&r.default.msedge)){t._status=i.LoaderStatus.kError;var n=0,o=null;if((e.code===19||e.message===`network error`)&&(t._contentLength===null||t._contentLength!==null&&t._receivedLength<t._contentLength)?(n=i.LoaderErrors.EARLY_EOF,o={code:e.code,msg:`Fetch stream meet Early-EOF`}):(n=i.LoaderErrors.EXCEPTION,o={code:e.code,msg:e.message}),t._onError)t._onError(n,o);else throw new a.RuntimeException(o.msg)}})},t}(i.BaseLoader)}),
2"./src/io/io-controller.js":(function(e,t,n){n.r(t);var r=n(`./src/utils/logger.js`),i=n(`./src/io/speed-sampler.js`),a=n(`./src/io/loader.js`),o=n(`./src/io/fetch-stream-loader.js`),s=n(`./src/io/xhr-moz-chunked-loader.js`),c=n(`./src/io/xhr-range-loader.js`),l=n(`./src/io/websocket-loader.js`),u=n(`./src/io/range-seek-handler.js`),d=n(`./src/io/param-seek-handler.js`),f=n(`./src/utils/exception.js`);t.default=function(){function e(e,t,n){this.TAG=`IOController`,this._config=t,this._extraData=n,this._stashInitialSize=1024*384,t.stashInitialSize!=null&&t.stashInitialSize>0&&(this._stashInitialSize=t.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=1024*1024*3,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,t.enableStashBuffer===!1&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url),this._refTotalLength=e.filesize?e.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new i.default,this._speedNormalizeList=[64,128,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return e.prototype.destroy=function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null},e.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},e.prototype.isPaused=function(){return this._paused},Object.defineProperty(e.prototype,`status`,{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`extraData`,{get:function(){return this._extraData},set:function(e){this._extraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onDataArrival`,{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onSeeked`,{get:function(){return this._onSeeked},set:function(e){this._onSeeked=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onError`,{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onComplete`,{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onRedirect`,{get:function(){return this._onRedirect},set:function(e){this._onRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onRecoveredEarlyEof`,{get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`currentURL`,{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`hasRedirect`,{get:function(){return this._redirectedURL!=null||this._dataSource.redirectedURL!=null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`currentRedirectedURL`,{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`currentSpeed`,{get:function(){return this._loaderClass===c.default?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`loaderType`,{get:function(){return this._loader.type}
2,enumerable:!1,configurable:!0}),e.prototype._selectSeekHandler=function(){var e=this._config;if(e.seekType===`range`)this._seekHandler=new u.default(this._config.rangeLoadZeroStart);else if(e.seekType===`param`){var t=e.seekParamStart||`bstart`,n=e.seekParamEnd||`bend`;this._seekHandler=new d.default(t,n)}else if(e.seekType===`custom`){if(typeof e.customSeekHandler!=`function`)throw new f.InvalidArgumentException(`Custom seekType specified in config but invalid customSeekHandler!`);this._seekHandler=new e.customSeekHandler}else throw new f.InvalidArgumentException(`Invalid seekType in config: `+e.seekType)},e.prototype._selectLoader=function(){if(this._config.customLoader!=null)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=l.default;else if(o.default.isSupported())this._loaderClass=o.default;else if(s.default.isSupported())this._loaderClass=s.default;else if(c.default.isSupported())this._loaderClass=c.default;else throw new f.RuntimeException(`Your browser doesn't support xhr with arraybuffer responseType!`)},e.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),this._loader.needStashBuffer===!1&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)},e.prototype.open=function(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},e.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},e.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),this._stashUsed===0?this._resumeFrom=this._currentRange.to+1:(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1),this._stashUsed=0,this._stashByteStart=0,this._paused=!0)},e.prototype.resume=function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}},e.prototype.seek=function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)},e.prototype._internalSeek=function(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var n={from:e,to:-1};this._currentRange={from:n.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,n),this._onSeeked&&this._onSeeked()},e.prototype.updateUrl=function(e){if(!e||typeof e!=`string`||e.length===0)throw new f.InvalidArgumentException(`Url must be a non-empty string!`);this._dataSource.url=e},e.prototype._expandBuffer=function(e){for(var t=this._stashSize;t+1024*1024*1<e;)t*=2;if(t+=1024*1024*1,t!==this._bufferSize){var n=new ArrayBuffer(t);if(this._stashUsed>0){var r=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(n,0,t).set(r,0)}this._stashBuffer=n,this._bufferSize=t}},e.prototype._normalizeSpeed=function(e){var t=this._speedNormalizeList,n=t.length-1,r=0,i=0,a=n;if(e<t[0])return t[0];for(;i<=a;){if(r=i+Math.floor((a-i)/2),r===n||e>=t[r]&&e<t[r+1])return t[r];t[r]<e?i=r+1:a=r-1}},e.prototype._adjustStashSize=function(e){var t=0;t=this._config.isLive||e<512?e:e>=512&&e<=1024?Math.floor(e*1.5):e*2,t>8192&&(t=8192);var n=t*1024+1024*1024*1;this._bufferSize<n&&this._expandBuffer(n),this._stashSize=t*1024},e.prototype._dispatchChunks=function(e,t){return this._currentRange.to=t+e.byteLength-1,this._onDataArrival(e,t)},e.prototype._onURLRedirect=function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)},e.prototype._onContentLengthKnown=function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)},e.prototype._onLoaderChunkArrival=function(e,t,n){if(!this._onDataArrival)throw new f.IllegalStateException(`IOController: No existing consumer (onDataArrival) callback!`);if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(e.byteLength);var r=this._speedSampler.lastSecondKBps;if(r!==0){var i=this._normalizeSpeed(r);this._speedNormalized!==i&&(this._speedNormalized=i,this._adjustStashSize(i))}if(!this._enableStash)if(this._stashUsed===0){var a=this._dispatchChunks(e,t);if(a<e.byteLength){var o=e.byteLength-a;o>this._bufferSize&&this._expandBuffer(o);var s=new Uint8Array(this._stashBuffer,0,this._bufferSize);s.set(new Uint8Array(e,a),0),this._stashUsed+=o,this._stashByteStart=t+a}}else{this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength);var s=new Uint8Array(this._stashBuffer,0,this._bufferSize);s.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;var a=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(a<this._stashUsed&&a>0){var c=new Uint8Array(this._stashBuffer,a);s.set(c,0)}this._stashUsed-=a,this._stashByteStart+=a}else if(this._stashUsed===0&&this._stashByteStart===0&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize){var s=new Uint8Array(this._stashBuffer,0,this._stashSize);s.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else{var s=new Uint8Array(this._stashBuffer,0,this._bufferSize);
2if(this._stashUsed>0){var l=this._stashBuffer.slice(0,this._stashUsed),a=this._dispatchChunks(l,this._stashByteStart);if(a<l.byteLength){if(a>0){var c=new Uint8Array(l,a);s.set(c,0),this._stashUsed=c.byteLength,this._stashByteStart+=a}}else this._stashUsed=0,this._stashByteStart+=a;this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),s=new Uint8Array(this._stashBuffer,0,this._bufferSize)),s.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else{var a=this._dispatchChunks(e,t);if(a<e.byteLength){var o=e.byteLength-a;o>this._bufferSize&&(this._expandBuffer(o),s=new Uint8Array(this._stashBuffer,0,this._bufferSize)),s.set(new Uint8Array(e,a),0),this._stashUsed+=o,this._stashByteStart=t+a}}}}},e.prototype._flushStashBuffer=function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),n=this._dispatchChunks(t,this._stashByteStart),i=t.byteLength-n;if(n<t.byteLength)if(e)r.default.w(this.TAG,i+` bytes unconsumed data remain when flush buffer, dropped`);else{if(n>0){var a=new Uint8Array(this._stashBuffer,0,this._bufferSize),o=new Uint8Array(t,n);a.set(o,0),this._stashUsed=o.byteLength,this._stashByteStart+=n}return 0}return this._stashUsed=0,this._stashByteStart=0,i}return 0},e.prototype._onLoaderComplete=function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},e.prototype._onLoaderError=function(e,t){switch(r.default.e(this.TAG,`Loader error, code = `+t.code+`, msg = `+t.msg),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=a.LoaderErrors.UNRECOVERABLE_EARLY_EOF),e){case a.LoaderErrors.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var n=this._currentRange.to+1;n<this._totalLength&&(r.default.w(this.TAG,`Connection lost, trying reconnect...`),this._isEarlyEofReconnecting=!0,this._internalSeek(n,!1));return}e=a.LoaderErrors.UNRECOVERABLE_EARLY_EOF;break;case a.LoaderErrors.UNRECOVERABLE_EARLY_EOF:case a.LoaderErrors.CONNECTING_TIMEOUT:case a.LoaderErrors.HTTP_STATUS_CODE_INVALID:case a.LoaderErrors.EXCEPTION:break}if(this._onError)this._onError(e,t);else throw new f.RuntimeException(`IOException: `+t.msg)},e}()}),
vendor: 2,315 bytes, line 2
2"./src/io/loader.js":(function(e,t,n){n.r(t),n.d(t,{LoaderStatus:function(){return i},LoaderErrors:function(){return a},BaseLoader:function(){return o}});var r=n(`./src/utils/exception.js`),i={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},a={OK:`OK`,EXCEPTION:`Exception`,HTTP_STATUS_CODE_INVALID:`HttpStatusCodeInvalid`,CONNECTING_TIMEOUT:`ConnectingTimeout`,EARLY_EOF:`EarlyEof`,UNRECOVERABLE_EARLY_EOF:`UnrecoverableEarlyEof`},o=function(){function e(e){this._type=e||`undefined`,this._status=i.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return e.prototype.destroy=function(){this._status=i.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},e.prototype.isWorking=function(){return this._status===i.kConnecting||this._status===i.kBuffering},Object.defineProperty(e.prototype,`type`,{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`status`,{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`needStashBuffer`,{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onContentLengthKnown`,{get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onURLRedirect`,{get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onDataArrival`,{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onError`,{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onComplete`,{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),e.prototype.open=function(e,t){throw new r.NotImplementedException(`Unimplemented abstract function!`)},e.prototype.abort=function(){throw new r.NotImplementedException(`Unimplemented abstract function!`)},e}()}),
2"./src/io/param-seek-handler.js":(function(e,t,n){n.r(t),t.default=function(){function e(e,t){this._startName=e,this._endName=t}return e.prototype.getConfig=function(e,t){var n=e;if(t.from!==0||t.to!==-1){var r=!0;n.indexOf(`?`)===-1&&(n+=`?`,r=!1),r&&(n+=`&`),n+=this._startName+`=`+t.from.toString(),t.to!==-1&&(n+=`&`+this._endName+`=`+t.to.toString())}return{url:n,headers:{}}},e.prototype.removeURLParameters=function(e){var t=e.split(`?`)[0],n=void 0,r=e.indexOf(`?`);r!==-1&&(n=e.substring(r+1));var i=``;if(n!=null&&n.length>0)for(var a=n.split(`&`),o=0;o<a.length;o++){var s=a[o].split(`=`),c=o>0;s[0]!==this._startName&&s[0]!==this._endName&&(c&&(i+=`&`),i+=a[o])}return i.length===0?t:t+`?`+i},e}()}),
2"./src/io/range-seek-handler.js":(function(e,t,n){n.r(t),t.default=function(){function e(e){this._zeroStart=e||!1}return e.prototype.getConfig=function(e,t){var n={};if(t.from!==0||t.to!==-1){var r=void 0;r=t.to===-1?`bytes=`+t.from.toString()+`-`:`bytes=`+t.from.toString()+`-`+t.to.toString(),n.Range=r}else this._zeroStart&&(n.Range=`bytes=0-`);return{url:e,headers:n}},e.prototype.removeURLParameters=function(e){return e},e}()}),
2"./src/io/speed-sampler.js":(function(e,t,n){n.r(t),t.default=function(){function e(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return e.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},e.prototype.addBytes=function(e){this._firstCheckpoint===0?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())},Object.defineProperty(e.prototype,`currentKBps`,{get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return e==0&&(e=1),this._intervalBytes/e/1024},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`lastSecondKBps`,{get:function(){return this.addBytes(0),this._lastSecondBytes===0?this._now()-this._lastCheckpoint>=500?this.currentKBps:0:this._lastSecondBytes/1024},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`averageKBps`,{get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024},enumerable:!1,configurable:!0}),e}()}),
2"./src/io/websocket-loader.js":(function(e,t,n){n.r(t);var r=n(`./src/io/loader.js`),i=n(`./src/utils/exception.js`),a=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();t.default=function(e){a(t,e);function t(){var t=e.call(this,`websocket-loader`)||this;return t.TAG=`WebSocketLoader`,t._needStash=!0,t._ws=null,t._requestAbort=!1,t._receivedLength=0,t}return t.isSupported=function(){try{return self.WebSocket!==void 0}catch{return!1}},t.prototype.destroy=function(){this._ws&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e){try{var t=this._ws=new self.WebSocket(e.url);t.binaryType=`arraybuffer`,t.onopen=this._onWebSocketOpen.bind(this),t.onclose=this._onWebSocketClose.bind(this),t.onmessage=this._onWebSocketMessage.bind(this),t.onerror=this._onWebSocketError.bind(this),this._status=r.LoaderStatus.kConnecting}catch(e){this._status=r.LoaderStatus.kError;var n={code:e.code,msg:e.message};if(this._onError)this._onError(r.LoaderErrors.EXCEPTION,n);else throw new i.RuntimeException(n.msg)}},t.prototype.abort=function(){var e=this._ws;e&&(e.readyState===0||e.readyState===1)&&(this._requestAbort=!0,e.close()),this._ws=null,this._status=r.LoaderStatus.kComplete},t.prototype._onWebSocketOpen=function(e){this._status=r.LoaderStatus.kBuffering},t.prototype._onWebSocketClose=function(e){if(this._requestAbort===!0){this._requestAbort=!1;return}this._status=r.LoaderStatus.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)},t.prototype._onWebSocketMessage=function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var n=new FileReader;n.onload=function(){t._dispatchArrayBuffer(n.result)},n.readAsArrayBuffer(e.data)}else{this._status=r.LoaderStatus.kError;var a={code:-1,msg:`Unsupported WebSocket message type: `+e.data.constructor.name};if(this._onError)this._onError(r.LoaderErrors.EXCEPTION,a);else throw new i.RuntimeException(a.msg)}},t.prototype._dispatchArrayBuffer=function(e){var t=e,n=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,n,this._receivedLength)},t.prototype._onWebSocketError=function(e){this._status=r.LoaderStatus.kError;var t={code:e.code,msg:e.message};if(this._onError)this._onError(r.LoaderErrors.EXCEPTION,t);else throw new i.RuntimeException(t.msg)},t}(r.BaseLoader)}),
2"./src/io/xhr-moz-chunked-loader.js":(function(e,t,n){n.r(t);var r=n(`./src/utils/logger.js`),i=n(`./src/io/loader.js`),a=n(`./src/utils/exception.js`),o=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();t.default=function(e){o(t,e);function t(t,n){var r=e.call(this,`xhr-moz-chunked-loader`)||this;return r.TAG=`MozChunkedLoader`,r._seekHandler=t,r._config=n,r._needStash=!0,r._xhr=null,r._requestAbort=!1,r._contentLength=null,r._receivedLength=0,r}return t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open(`GET`,`https://example.com`,!0),e.responseType=`moz-chunked-arraybuffer`,e.responseType===`moz-chunked-arraybuffer`}catch(e){return r.default.w(`MozChunkedLoader`,e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&=(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,null),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){this._dataSource=e,this._range=t;var n=e.url;this._config.reuseRedirectedURL&&e.redirectedURL!=null&&(n=e.redirectedURL);var r=this._seekHandler.getConfig(n,t);this._requestURL=r.url;var a=this._xhr=new XMLHttpRequest;if(a.open(`GET`,r.url,!0),a.responseType=`moz-chunked-arraybuffer`,a.onreadystatechange=this._onReadyStateChange.bind(this),a.onprogress=this._onProgress.bind(this),a.onloadend=this._onLoadEnd.bind(this),a.onerror=this._onXhrError.bind(this),e.withCredentials&&(a.withCredentials=!0),typeof r.headers==`object`){var o=r.headers;for(var s in o)o.hasOwnProperty(s)&&a.setRequestHeader(s,o[s])}if(typeof this._config.headers==`object`){var o=this._config.headers;for(var s in o)o.hasOwnProperty(s)&&a.setRequestHeader(s,o[s])}this._status=i.LoaderStatus.kConnecting,a.send()},t.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=i.LoaderStatus.kComplete},t.prototype._onReadyStateChange=function(e){var t=e.target;if(t.readyState===2){if(t.responseURL!=null&&t.responseURL!==this._requestURL&&this._onURLRedirect){var n=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(n)}if(t.status!==0&&(t.status<200||t.status>299))if(this._status=i.LoaderStatus.kError,this._onError)this._onError(i.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText});else throw new a.RuntimeException(`MozChunkedLoader: Http code invalid, `+t.status+` `+t.statusText);else this._status=i.LoaderStatus.kBuffering}},t.prototype._onProgress=function(e){if(this._status!==i.LoaderStatus.kError){this._contentLength===null&&e.total!==null&&e.total!==0&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,n=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,n,this._receivedLength)}},t.prototype._onLoadEnd=function(e){if(this._requestAbort===!0){this._requestAbort=!1;return}else if(this._status===i.LoaderStatus.kError)return;this._status=i.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)},t.prototype._onXhrError=function(e){this._status=i.LoaderStatus.kError;var t=0,n=null;if(this._contentLength&&e.loaded<this._contentLength?(t=i.LoaderErrors.EARLY_EOF,n={code:-1,msg:`Moz-Chunked stream meet Early-Eof`}):(t=i.LoaderErrors.EXCEPTION,n={code:-1,msg:e.constructor.name+` `+e.type}),this._onError)this._onError(t,n);else throw new a.RuntimeException(n.msg)},t}(i.BaseLoader)}),
2"./src/io/xhr-range-loader.js":(function(e,t,n){n.r(t);var r=n(`./src/utils/logger.js`),i=n(`./src/io/speed-sampler.js`),a=n(`./src/io/loader.js`),o=n(`./src/utils/exception.js`),s=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();t.default=function(e){s(t,e);function t(t,n){var r=e.call(this,`xhr-range-loader`)||this;return r.TAG=`RangeLoader`,r._seekHandler=t,r._config=n,r._needStash=!1,r._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],r._currentChunkSizeKB=384,r._currentSpeedNormalized=0,r._zeroSpeedChunkCount=0,r._xhr=null,r._speedSampler=new i.default,r._requestAbort=!1,r._waitForTotalLength=!1,r._totalLengthReceived=!1,r._currentRequestURL=null,r._currentRedirectedURL=null,r._currentRequestRange=null,r._totalLength=null,r._contentLength=null,r._receivedLength=0,r._lastTimeLoaded=0,r}return t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open(`GET`,`https://example.com`,!0),e.responseType=`arraybuffer`,e.responseType===`arraybuffer`}catch(e){return r.default.w(`RangeLoader`,e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&=(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,null),e.prototype.destroy.call(this)},Object.defineProperty(t.prototype,`currentSpeed`,{get:function(){return this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),t.prototype.open=function(e,t){this._dataSource=e,this._range=t,this._status=a.LoaderStatus.kConnecting;var n=!1;this._dataSource.filesize!=null&&this._dataSource.filesize!==0&&(n=!0,this._totalLength=this._dataSource.filesize),!this._totalLengthReceived&&!n?(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1})):this._openSubRange()},t.prototype._openSubRange=function(){var e=this._currentChunkSizeKB*1024,t=this._range.from+this._receivedLength,n=t+e;this._contentLength!=null&&n-this._range.from>=this._contentLength&&(n=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:n},this._internalOpen(this._dataSource,this._currentRequestRange)},t.prototype._internalOpen=function(e,t){this._lastTimeLoaded=0;var n=e.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL==null?e.redirectedURL!=null&&(n=e.redirectedURL):n=this._currentRedirectedURL);var r=this._seekHandler.getConfig(n,t);this._currentRequestURL=r.url;var i=this._xhr=new XMLHttpRequest;if(i.open(`GET`,r.url,!0),i.responseType=`arraybuffer`,i.onreadystatechange=this._onReadyStateChange.bind(this),i.onprogress=this._onProgress.bind(this),i.onload=this._onLoad.bind(this),i.onerror=this._onXhrError.bind(this),e.withCredentials&&(i.withCredentials=!0),typeof r.headers==`object`){var a=r.headers;for(var o in a)a.hasOwnProperty(o)&&i.setRequestHeader(o,a[o])}if(typeof this._config.headers==`object`){var a=this._config.headers;for(var o in a)a.hasOwnProperty(o)&&i.setRequestHeader(o,a[o])}i.send()},t.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=a.LoaderStatus.kComplete},t.prototype._internalAbort=function(){this._xhr&&=(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),null)},t.prototype._onReadyStateChange=function(e){var t=e.target;if(t.readyState===2){if(t.responseURL!=null){var n=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&n!==this._currentRedirectedURL&&(this._currentRedirectedURL=n,this._onURLRedirect&&this._onURLRedirect(n))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=a.LoaderStatus.kBuffering}else if(this._status=a.LoaderStatus.kError,this._onError)this._onError(a.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText});else throw new o.RuntimeException(`RangeLoader: Http code invalid, `+t.status+` `+t.statusText)}},t.prototype._onProgress=function(e){if(this._status!==a.LoaderStatus.kError){if(this._contentLength===null){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var n=e.total;this._internalAbort(),n!=null&n!==0&&(this._totalLength=n)}if(this._range.to===-1?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t){this._openSubRange();return}this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}
2var r=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(r)}},t.prototype._normalizeSpeed=function(e){var t=this._chunkSizeKBList,n=t.length-1,r=0,i=0,a=n;if(e<t[0])return t[0];for(;i<=a;){if(r=i+Math.floor((a-i)/2),r===n||e>=t[r]&&e<t[r+1])return t[r];t[r]<e?i=r+1:a=r-1}},t.prototype._onLoad=function(e){if(this._status!==a.LoaderStatus.kError){if(this._waitForTotalLength){this._waitForTotalLength=!1;return}this._lastTimeLoaded=0;var t=this._speedSampler.lastSecondKBps;if(t===0&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(t=this._speedSampler.currentKBps)),t!==0){var n=this._normalizeSpeed(t);this._currentSpeedNormalized!==n&&(this._currentSpeedNormalized=n,this._currentChunkSizeKB=n)}var r=e.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=r.byteLength;var o=!1;this._contentLength!=null&&this._receivedLength<this._contentLength?this._openSubRange():o=!0,this._onDataArrival&&this._onDataArrival(r,i,this._receivedLength),o&&(this._status=a.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},t.prototype._onXhrError=function(e){this._status=a.LoaderStatus.kError;var t=0,n=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=a.LoaderErrors.EARLY_EOF,n={code:-1,msg:`RangeLoader meet Early-Eof`}):(t=a.LoaderErrors.EXCEPTION,n={code:-1,msg:e.constructor.name+` `+e.type}),this._onError)this._onError(t,n);else throw new o.RuntimeException(n.msg)},t}(a.BaseLoader)}),
2"./src/player/flv-player.js":(function(e,t,n){n.r(t);var r=n(`./node_modules/events/events.js`),i=n.n(r),a=n(`./src/utils/logger.js`),o=n(`./src/utils/browser.js`),s=n(`./src/player/player-events.js`),c=n(`./src/core/transmuxer.js`),l=n(`./src/core/transmuxing-events.js`),u=n(`./src/core/mse-controller.js`),d=n(`./src/core/mse-events.js`),f=n(`./src/player/player-errors.js`),p=n(`./src/config.js`),m=n(`./src/utils/exception.js`);t.default=function(){function e(e,t){if(this.TAG=`FlvPlayer`,this._type=`FlvPlayer`,this._emitter=new(i()),this._config=(0,p.createDefaultConfig)(),typeof t==`object`&&Object.assign(this._config,t),e.type.toLowerCase()!==`flv`)throw new m.InvalidArgumentException(`FlvPlayer requires an flv MediaDataSource input!`);e.isLive===!0&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=e,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null,this._alwaysSeekKeyframe=!!(o.default.chrome&&(o.default.version.major<50||o.default.version.major===50&&o.default.version.build<2661)||o.default.msedge||o.default.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return e.prototype.destroy=function(){this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var n=this;e===s.default.MEDIA_INFO?this._mediaInfo!=null&&Promise.resolve().then(function(){n._emitter.emit(s.default.MEDIA_INFO,n.mediaInfo)}):e===s.default.STATISTICS_INFO&&this._statisticsInfo!=null&&Promise.resolve().then(function(){n._emitter.emit(s.default.STATISTICS_INFO,n.statisticsInfo)}),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){var t=this;if(this._mediaElement=e,e.addEventListener(`loadedmetadata`,this.e.onvLoadedMetadata),e.addEventListener(`seeking`,this.e.onvSeeking),e.addEventListener(`canplay`,this.e.onvCanPlay),e.addEventListener(`stalled`,this.e.onvStalled),e.addEventListener(`progress`,this.e.onvProgress),this._msectl=new u.default(this._config),this._msectl.on(d.default.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(d.default.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(d.default.SOURCE_OPEN,function(){t._mseSourceOpened=!0,t._hasPendingLoad&&(t._hasPendingLoad=!1,t.load())}),this._msectl.on(d.default.ERROR,function(e){t._emitter.emit(s.default.ERROR,f.ErrorTypes.MEDIA_ERROR,f.ErrorDetails.MEDIA_MSE_ERROR,e)}),this._msectl.attachMediaElement(e),this._pendingSeekTime!=null)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch{}},e.prototype.detachMediaElement=function(){this._mediaElement&&=(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener(`loadedmetadata`,this.e.onvLoadedMetadata),this._mediaElement.removeEventListener(`seeking`,this.e.onvSeeking),this._mediaElement.removeEventListener(`canplay`,this.e.onvCanPlay),this._mediaElement.removeEventListener(`stalled`,this.e.onvStalled),this._mediaElement.removeEventListener(`progress`,this.e.onvProgress),null),this._msectl&&=(this._msectl.destroy(),null)},e.prototype.load=function(){var e=this;if(!this._mediaElement)throw new m.IllegalStateException(`HTMLMediaElement must be attached before load()!`);if(this._transmuxer)throw new m.IllegalStateException(`FlvPlayer.load() has been called, please call unload() first!`);if(!this._hasPendingLoad){if(this._config.deferLoadAfterSourceOpen&&this._mseSourceOpened===!1){this._hasPendingLoad=!0;return}this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new c.default(this._mediaDataSource,this._config),this._transmuxer.on(l.default.INIT_SEGMENT,function(t,n){e._msectl.appendInitSegment(n)}),this._transmuxer.on(l.default.MEDIA_SEGMENT,function(t,n){if(e._msectl.appendMediaSegment(n),e._config.lazyLoad&&!e._config.isLive){var r=e._mediaElement.currentTime;n.info.endDts>=(r+e._config.lazyLoadMaxDuration)*1e3&&(e._progressChecker??(a.default.v(e.TAG,`Maximum buffering duration exceeded, suspend transmuxing task`),e._suspendTransmuxer()))}}),this._transmuxer.on(l.default.LOADING_COMPLETE,function(){e._msectl.endOfStream(),e._emitter.emit(s.default.LOADING_COMPLETE)}),this._transmuxer.on(l.default.RECOVERED_EARLY_EOF,function(){e._emitter.emit(s.default.RECOVERED_EARLY_EOF)}),this._transmuxer.on(l.default.IO_ERROR,function(t,n){e._emitter.emit(s.default.ERROR,f.ErrorTypes.NETWORK_E
2RROR,t,n)}),this._transmuxer.on(l.default.DEMUX_ERROR,function(t,n){e._emitter.emit(s.default.ERROR,f.ErrorTypes.MEDIA_ERROR,t,{code:-1,msg:n})}),this._transmuxer.on(l.default.MEDIA_INFO,function(t){e._mediaInfo=t,e._emitter.emit(s.default.MEDIA_INFO,Object.assign({},t))}),this._transmuxer.on(l.default.METADATA_ARRIVED,function(t){e._emitter.emit(s.default.METADATA_ARRIVED,t)}),this._transmuxer.on(l.default.SCRIPTDATA_ARRIVED,function(t){e._emitter.emit(s.default.SCRIPTDATA_ARRIVED,t)}),this._transmuxer.on(l.default.STATISTICS_INFO,function(t){e._statisticsInfo=e._fillStatisticsInfo(t),e._emitter.emit(s.default.STATISTICS_INFO,Object.assign({},e._statisticsInfo))}),this._transmuxer.on(l.default.RECOMMEND_SEEKPOINT,function(t){e._mediaElement&&!e._config.accurateSeek&&(e._requestSetTime=!0,e._mediaElement.currentTime=t/1e3)}),this._transmuxer.open()}},e.prototype.unload=function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&=(this._transmuxer.close(),this._transmuxer.destroy(),null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,`type`,{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`buffered`,{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`duration`,{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`volume`,{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`muted`,{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`currentTime`,{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._internalSeek(e):this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`mediaInfo`,{get:function(){return Object.assign({},this._mediaInfo)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`statisticsInfo`,{get:function(){return this._statisticsInfo??={},this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)},enumerable:!1,configurable:!0}),e.prototype._fillStatisticsInfo=function(e){if(e.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,n=0,r=0;if(this._mediaElement.getVideoPlaybackQuality){var i=this._mediaElement.getVideoPlaybackQuality();n=i.totalVideoFrames,r=i.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount==null?t=!1:(n=this._mediaElement.webkitDecodedFrameCount,r=this._mediaElement.webkitDroppedFrameCount);return t&&(e.decodedFrames=n,e.droppedFrames=r),e},e.prototype._onmseUpdateEnd=function(){if(!(!this._config.lazyLoad||this._config.isLive)){for(var e=this._mediaElement.buffered,t=this._mediaElement.currentTime,n=0,r=0;r<e.length;r++){var i=e.start(r),o=e.end(r);if(i<=t&&t<o){n=o;break}}n>=t+this._config.lazyLoadMaxDuration&&this._progressChecker==null&&(a.default.v(this.TAG,`Maximum buffering duration exceeded, suspend transmuxing task`),this._suspendTransmuxer())}},e.prototype._onmseBufferFull=function(){a.default.v(this.TAG,`MSE SourceBuffer is full, suspend transmuxing task`),this._progressChecker??this._suspendTransmuxer()},e.prototype._suspendTransmuxer=function(){this._transmuxer&&(this._transmuxer.pause(),this._progressChecker??=window.setInterval(this._checkProgressAndResume.bind(this),1e3))},e.prototype._checkProgressAndResume=function(){for(var e=this._mediaElement.currentTime,t=this._mediaElement.buffered,n=!1,r=0;r<t.length;r++){var i=t.start(r),o=t.end(r);if(e>=i&&e<o){e>=o-this._config.lazyLoadRecoverDuration&&(n=!0);break}}n&&(window.clearInterval(this._progressChecker),this._progressChecker=null,n&&(a.default.v(this.TAG,`Continue loading from paused position`),this._transmuxer.resume()))},e.prototype._isTimepointBuffered=function(e){for(var t=this._mediaElement.buffered,n=0;n<t.length;n++){var r=t.start(n),i=t.end(n);if(e>=r&&e<i)return!0}return!1},e.prototype._internalSeek=function(e){var t=this._isTimepointBuffered(e),n=!1,r=0;if(e<1&&this._mediaElement.buffered.length>0){var i=this._mediaElement.buffered.start(0);(i<1&&e<i||o.default.safari)&&(n=!0,r=o.default.safari?.1:i)}if(n)this._requestSetTime=!0,this._mediaElement.currentTime=r;else if(t){if(!this._alwaysSeekKeyframe)this._requestSetTime=!0,this._mediaElement.currentTime=e;else{var a=this._msectl.getNearestKeyframe(Math.floor(e*1e3));this._requestSetTime=!0,a==null?this._mediaElement.currentTime=e:this._mediaElement.currentTime=a.dts/1e3}this._progressChecker!=null&&this._checkProgressAndResume()}else this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(e*1e3)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e)},e.prototype._checkAndApplyUnbufferedSeekpoint=function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var e=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(e)||(this._progressChecker!=null&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(e*1e3)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)},e.prototype._checkAndResumeStuckPlayback=function(e){var t=this._mediaElement;if(e||!this._receivedCanPlay||t.readyState<2){var n=t.buffered;n.length>0&&t.currentTime<n.start(0)&&(a.default.w(this.TAG,`Playback seems stuck at `+t.currentTime+`, seek to `+n.start(0)),this._requestSetTime=!0,this._mediaElement.currentTime=n.start(0),this._mediaElement.removeEventListener(`progress`,this.e.onvProgress))}else this._mediaElement.removeEventListener(`progress`,this.e.onvProgress)},e.prototype._onvLoadedMetadata=function(e){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pe
2ndingSeekTime,this._pendingSeekTime=null)},e.prototype._onvSeeking=function(e){var t=this._mediaElement.currentTime,n=this._mediaElement.buffered;if(this._requestSetTime){this._requestSetTime=!1;return}if(t<1&&n.length>0){var r=n.start(0);if(r<1&&t<r||o.default.safari){this._requestSetTime=!0,this._mediaElement.currentTime=o.default.safari?.1:r;return}}if(this._isTimepointBuffered(t)){if(this._alwaysSeekKeyframe){var i=this._msectl.getNearestKeyframe(Math.floor(t*1e3));i!=null&&(this._requestSetTime=!0,this._mediaElement.currentTime=i.dts/1e3)}this._progressChecker!=null&&this._checkProgressAndResume();return}this._seekpointRecord={seekPoint:t,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)},e.prototype._onvCanPlay=function(e){this._receivedCanPlay=!0,this._mediaElement.removeEventListener(`canplay`,this.e.onvCanPlay)},e.prototype._onvStalled=function(e){this._checkAndResumeStuckPlayback(!0)},e.prototype._onvProgress=function(e){this._checkAndResumeStuckPlayback()},e}()}),
2"./src/player/native-player.js":(function(e,t,n){n.r(t);var r=n(`./node_modules/events/events.js`),i=n.n(r),a=n(`./src/player/player-events.js`),o=n(`./src/config.js`),s=n(`./src/utils/exception.js`);t.default=function(){function e(e,t){if(this.TAG=`NativePlayer`,this._type=`NativePlayer`,this._emitter=new(i()),this._config=(0,o.createDefaultConfig)(),typeof t==`object`&&Object.assign(this._config,t),e.type.toLowerCase()===`flv`)throw new s.InvalidArgumentException(`NativePlayer does't support flv MediaDataSource input!`);if(e.hasOwnProperty(`segments`))throw new s.InvalidArgumentException(`NativePlayer(`+e.type+`) doesn't support multipart playback!`);this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=e,this._mediaElement=null}return e.prototype.destroy=function(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var n=this;e===a.default.MEDIA_INFO?this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(function(){n._emitter.emit(a.default.MEDIA_INFO,n.mediaInfo)}):e===a.default.STATISTICS_INFO&&this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(function(){n._emitter.emit(a.default.STATISTICS_INFO,n.statisticsInfo)}),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaElement=e,e.addEventListener(`loadedmetadata`,this.e.onvLoadedMetadata),this._pendingSeekTime!=null)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch{}},e.prototype.detachMediaElement=function(){this._mediaElement&&=(this._mediaElement.src=``,this._mediaElement.removeAttribute(`src`),this._mediaElement.removeEventListener(`loadedmetadata`,this.e.onvLoadedMetadata),null),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.load=function(){if(!this._mediaElement)throw new s.IllegalStateException(`HTMLMediaElement must be attached before load()!`);this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload=`auto`,this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},e.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src=``,this._mediaElement.removeAttribute(`src`)),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,`type`,{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`buffered`,{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`duration`,{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`volume`,{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`muted`,{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`currentTime`,{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`mediaInfo`,{get:function(){var e={mimeType:(this._mediaElement instanceof HTMLAudioElement?`audio/`:`video/`)+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(this._mediaElement.duration*1e3),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e}
2,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`statisticsInfo`,{get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,n=0,r=0;if(this._mediaElement.getVideoPlaybackQuality){var i=this._mediaElement.getVideoPlaybackQuality();n=i.totalVideoFrames,r=i.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount==null?t=!1:(n=this._mediaElement.webkitDecodedFrameCount,r=this._mediaElement.webkitDroppedFrameCount);return t&&(e.decodedFrames=n,e.droppedFrames=r),e},enumerable:!1,configurable:!0}),e.prototype._onvLoadedMetadata=function(e){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(a.default.MEDIA_INFO,this.mediaInfo)},e.prototype._reportStatisticsInfo=function(){this._emitter.emit(a.default.STATISTICS_INFO,this.statisticsInfo)},e}()}),
2"./src/player/player-errors.js":(function(e,t,n){n.r(t),n.d(t,{ErrorTypes:function(){return a},ErrorDetails:function(){return o}});var r=n(`./src/io/loader.js`),i=n(`./src/demux/demux-errors.js`),a={NETWORK_ERROR:`NetworkError`,MEDIA_ERROR:`MediaError`,OTHER_ERROR:`OtherError`},o={NETWORK_EXCEPTION:r.LoaderErrors.EXCEPTION,NETWORK_STATUS_CODE_INVALID:r.LoaderErrors.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:r.LoaderErrors.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:r.LoaderErrors.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:`MediaMSEError`,MEDIA_FORMAT_ERROR:i.default.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:i.default.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:i.default.CODEC_UNSUPPORTED}}),
2"./src/player/player-events.js":(function(e,t,n){n.r(t),t.default={ERROR:`error`,LOADING_COMPLETE:`loading_complete`,RECOVERED_EARLY_EOF:`recovered_early_eof`,MEDIA_INFO:`media_info`,METADATA_ARRIVED:`metadata_arrived`,SCRIPTDATA_ARRIVED:`scriptdata_arrived`,STATISTICS_INFO:`statistics_info`}}),
2"./src/remux/aac-silent.js":(function(e,t,n){n.r(t),t.default=function(){function e(){}return e.getSilentFrame=function(e,t){if(e===`mp4a.40.2`){if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);else if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);else if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);return null},e}()}),
2"./src/remux/mp4-generator.js":(function(e,t,n){n.r(t);var r=function(){function e(){}return e.init=function(){for(var t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var n=e.constants={};n.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),n.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),n.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),n.STSC=n.STCO=n.STTS,n.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),n.HDLR_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]),n.HDLR_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]),n.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),n.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},e.box=function(e){for(var t=8,n=null,r=Array.prototype.slice.call(arguments,1),i=r.length,a=0;a<i;a++)t+=r[a].byteLength;n=new Uint8Array(t),n[0]=t>>>24&255,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=t&255,n.set(e,4);for(var o=8,a=0;a<i;a++)n.set(r[a],o),o+=r[a].byteLength;return n},e.generateInitSegment=function(t){var n=e.box(e.types.ftyp,e.constants.FTYP),r=e.moov(t),i=new Uint8Array(n.byteLength+r.byteLength);return i.set(n,0),i.set(r,n.byteLength),i},e.moov=function(t){var n=e.mvhd(t.timescale,t.duration),r=e.trak(t),i=e.mvex(t);return e.box(e.types.moov,n,r,i)},e.mvhd=function(t,n){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,t&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))},e.trak=function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.tkhd=function(t){var n=t.id,r=t.duration,i=t.presentWidth,a=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,n&255,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,r&255,0,0,0,0,0,0,0,0,0,0,0,0,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,i>>>8&255,i&255,0,0,a>>>8&255,a&255,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))},e.mdhd=function(t){var n=t.timescale,r=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,n&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,85,196,0,0]))},e.hdlr=function(t){var n=null;return n=t.type===`audio`?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,n)},e.minf=function(t){var n=null;return n=t.type===`audio`?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,n,e.dinf(),e.stbl(t))},e.dinf=function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))},e.stsd=function(t){return t.type===`audio`?t.codec===`mp3`?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))},e.mp3=function(t){var n=t.channelCount,r=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,r&255,0,0]);return e.box(e.types[`.mp3`],i)},e.mp4a=function(t){var n=t.channelCount,r=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,r&255,0,0]);return e.box(e.types.mp4a,i,e.esds(t))},e.esds=function(t){var n=t.config||[],r=n.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5,r].concat(n,[6,1,2]));return e.box(e.types.esds,i)},e.avc1=function(t){var n=t.avcc,r=t.codecWidth,i=t.codecHeight,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,r>>>8&255,r&255,i>>>8&255,i&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,a,e.box(e.types.avcC,n))},e.mvex=function(t){return e.box(e.types.mvex,e.trex(t))}
2,e.trex=function(t){var n=t.id,r=new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,n&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,r)},e.moof=function(t,n){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,n))},e.mfhd=function(t){var n=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,t&255]);return e.box(e.types.mfhd,n)},e.traf=function(t,n){var r=t.id,i=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,r&255])),a=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,n&255])),o=e.sdtp(t),s=e.trun(t,o.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,i,a,s,o)},e.sdtp=function(t){for(var n=t.samples||[],r=n.length,i=new Uint8Array(4+r),a=0;a<r;a++){var o=n[a].flags;i[a+4]=o.isLeading<<6|o.dependsOn<<4|o.isDependedOn<<2|o.hasRedundancy}return e.box(e.types.sdtp,i)},e.trun=function(t,n){var r=t.samples||[],i=r.length,a=12+16*i,o=new Uint8Array(a);n+=8+a,o.set([0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255],0);for(var s=0;s<i;s++){var c=r[s].duration,l=r[s].size,u=r[s].flags,d=r[s].cts;o.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.isNonSync,0,0,d>>>24&255,d>>>16&255,d>>>8&255,d&255],12+16*s)}return e.box(e.types.trun,o)},e.mdat=function(t){return e.box(e.types.mdat,t)},e}();r.init(),t.default=r}),
2"./src/remux/mp4-remuxer.js":(function(e,t,n){n.r(t);var r=n(`./src/utils/logger.js`),i=n(`./src/remux/mp4-generator.js`),a=n(`./src/remux/aac-silent.js`),o=n(`./src/utils/browser.js`),s=n(`./src/core/media-segment-info.js`),c=n(`./src/utils/exception.js`);t.default=function(){function e(e){this.TAG=`MP4Remuxer`,this._config=e,this._isLive=e.isLive===!0,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new s.MediaSegmentInfoList(`audio`),this._videoSegmentInfoList=new s.MediaSegmentInfoList(`video`),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!!(o.default.chrome&&(o.default.version.major<50||o.default.version.major===50&&o.default.version.build<2661)),this._fillSilentAfterSeek=o.default.msedge||o.default.msie,this._mp3UseMpegAudio=!o.default.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return e.prototype.destroy=function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null},e.prototype.bindDataSource=function(e){return e.onDataAvailable=this.remux.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(e.prototype,`onInitSegment`,{get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onMediaSegment`,{get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e},enumerable:!1,configurable:!0}),e.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},e.prototype.seek=function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},e.prototype.remux=function(e,t){if(!this._onMediaSegment)throw new c.IllegalStateException(`MP4Remuxer: onMediaSegment callback must be specificed!`);this._dtsBaseInited||this._calculateDtsBase(e,t),this._remuxVideo(t),this._remuxAudio(e)},e.prototype._onTrackMetadataReceived=function(e,t){var n=null,r=`mp4`,a=t.codec;if(e===`audio`)this._audioMeta=t,t.codec===`mp3`&&this._mp3UseMpegAudio?(r=`mpeg`,a=``,n=new Uint8Array):n=i.default.generateInitSegment(t);else if(e===`video`)this._videoMeta=t,n=i.default.generateInitSegment(t);else return;if(!this._onInitSegment)throw new c.IllegalStateException(`MP4Remuxer: onInitSegment callback must be specified!`);this._onInitSegment(e,{type:e,data:n.buffer,codec:a,container:e+`/`+r,mediaDuration:t.duration})},e.prototype._calculateDtsBase=function(e,t){this._dtsBaseInited||=(e.samples&&e.samples.length&&(this._audioDtsBase=e.samples[0].dts),t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),!0)},e.prototype.flushStashedSamples=function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,n={type:`video`,id:1,sequenceNumber:0,samples:[],length:0};e!=null&&(n.samples.push(e),n.length=e.length);var r={type:`audio`,id:2,sequenceNumber:0,samples:[],length:0};t!=null&&(r.samples.push(t),r.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(n,!0),this._remuxAudio(r,!0)},e.prototype._remuxAudio=function(e,t){if(this._audioMeta!=null){var n=e,c=n.samples,l=void 0,u=-1,d=-1,f=this._audioMeta.refSampleDuration,p=this._audioMeta.codec===`mp3`&&this._mp3UseMpegAudio,m=this._dtsBaseInited&&this._audioNextDts===void 0,h=!1;if(!(!c||c.length===0)&&!(c.length===1&&!t)){var g=0,_=null,v=0;p?(g=0,v=n.length):(g=8,v=8+n.length);var y=null;if(c.length>1&&(y=c.pop(),v-=y.length),this._audioStashedLastSample!=null){var b=this._audioStashedLastSample;this._audioStashedLastSample=null,c.unshift(b),v+=b.length}y!=null&&(this._audioStashedLastSample=y);var x=c[0].dts-this._dtsBase;if(this._audioNextDts)l=x-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())l=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&this._audioMeta.originalCodec!==`mp3`&&(h=!0);else{var S=this._audioSegmentInfoList.getLastSampleBefore(x);if(S!=null){var C=x-(S.originalDts+S.duration);C<=3&&(C=0),l=x-(S.dts+S.duration+C)}else l=0}if(h){var w=x-l,T=this._videoSegmentInfoList.getLastSegmentBefore(x);if(T!=null&&T.beginDts<w){var E=a.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(E){var D=T.beginDts,O=w-T.beginDts;r.default.v(this.TAG,`InsertPrefixSilentAudio: dts: `+D+`, duration: `+O),c.unshift({unit:E,dts:D,pts:D}),v+=E.byteLength}}else h=!1}for(var k=[],A=0;A<c.length;A++){var b=c[A],j=b.unit,M=b.dts-this._dtsBase,D=M,N=!1,ee=null,P=0;if(!(M<-.001)){if(this._audioMeta.codec!==`mp3`){var F=M,te=3;if(this._audioNextDts&&(F=this._audioNextDts),l=M-F,l<=-te*f){r.default.w(this.TAG,`Dropping 1 audio frame (originalDts: `+M+` ms ,curRefDts: `+F+` ms) due to dtsCorrection: `+l+` ms overlap.`);continue}else if(l>=te*f&&this._fillAudioTimestampGap&&!o.default.safari){N=!0;var ne=Math.floor(l/f);r.default.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync. 3`+(`originalDts: `+M+` ms, curRefDts: `+F+` ms, `)+(`dtsCorrection: `+Math.round(l)+` ms, generate: `+ne+` frames`)),D=Math.floor(F),P=Math.floor(F+f)-D;var E=a.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);E??=(r.default.w(this.TAG,`Unable to generate silent frame for `+(this._audioMeta.originalCodec+` with `+this._audioMeta.channelCount+` channels, repeat last frame`)),j),ee=[];for(var re=0;re<ne;re++){F+=f;var ie=Math.floor(F),ae=Math.floor(F+f)-ie,oe={dts:ie,pts:ie,cts:0,unit:E,size:E.byteLength,duration:ae,originalDts:M,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};ee.push(oe),v+=oe.size}this._audioNextDts=F+f}else D=Math.floor(F),P=Math.floor(F+f)-D,this._audioNextDts=F+f}else{if(D=M-l,A!==c.length-1){var se=c[A+1].dts-this._dtsBase-l;P=se-D}else if(y!=null){var se=y.dts-this._dtsBase-l;P=se-D}else P=k.length>=1?k[k.length-1].duration:Math.floor(f);this._audioNextDts=D+P}u===-1&&(u=D),k.push({dts:D,pts:D,cts:0,unit:b.unit,size:b.unit.byteLength,duration:P,originalDts:M,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),N&&k.push.apply(k,ee)}}if(k.length===0){n.samples=[],n.length=0;return}p?_=new Uint8Array(v):(_=new Uint8Array(v),_[0]=v>>>24&255,_[1]=v>>>16&255,_[2]=v>>>8&255,_[3]=v&255,_.set(i.default.types.mdat,4));for(var A=0;A<k.length;A++){var j=k[A].unit;_.set(j,g),g+=j.byteLength}var ce=k[k.length-1];d=ce.dts+ce.duration;var le=new s.MediaSegmentInfo;le.beginDts=u,le.endDts=d,le.beginPts=u,le.endPts=d,le.originalBeginDts=k[0].originalDts,le.originalEndDts=ce.originalDts+ce.duration,le.firstSample=ne
3w s.SampleInfo(k[0].dts,k[0].pts,k[0].duration,k[0].originalDts,!1),le.lastSample=new s.SampleInfo(ce.dts,ce.pts,ce.duration,ce.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(le),n.samples=k,n.sequenceNumber++;var ue=null;ue=p?new Uint8Array:i.default.moof(n,u),n.samples=[],n.length=0;var de={type:`audio`,data:this._mergeBoxes(ue,_).buffer,sampleCount:k.length,info:le};p&&m&&(de.timestampOffset=u),this._onMediaSegment(`audio`,de)}}},e.prototype._remuxVideo=function(e,t){if(this._videoMeta!=null){var n=e,r=n.samples,a=void 0,o=-1,c=-1,l=-1,u=-1;if(!(!r||r.length===0)&&!(r.length===1&&!t)){var d=8,f=null,p=8+e.length,m=null;if(r.length>1&&(m=r.pop(),p-=m.length),this._videoStashedLastSample!=null){var h=this._videoStashedLastSample;this._videoStashedLastSample=null,r.unshift(h),p+=h.length}m!=null&&(this._videoStashedLastSample=m);var g=r[0].dts-this._dtsBase;if(this._videoNextDts)a=g-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())a=0;else{var _=this._videoSegmentInfoList.getLastSampleBefore(g);if(_!=null){var v=g-(_.originalDts+_.duration);v<=3&&(v=0),a=g-(_.dts+_.duration+v)}else a=0}for(var y=new s.MediaSegmentInfo,b=[],x=0;x<r.length;x++){var h=r[x],S=h.dts-this._dtsBase,C=h.isKeyframe,w=S-a,T=h.cts,E=w+T;o===-1&&(o=w,l=E);var D=0;if(x!==r.length-1){var O=r[x+1].dts-this._dtsBase-a;D=O-w}else if(m!=null){var O=m.dts-this._dtsBase-a;D=O-w}else D=b.length>=1?b[b.length-1].duration:Math.floor(this._videoMeta.refSampleDuration);if(C){var k=new s.SampleInfo(w,E,D,h.dts,!0);k.fileposition=h.fileposition,y.appendSyncPoint(k)}b.push({dts:w,pts:E,cts:T,units:h.units,size:h.length,isKeyframe:C,duration:D,originalDts:S,flags:{isLeading:0,dependsOn:C?2:1,isDependedOn:C?1:0,hasRedundancy:0,isNonSync:C?0:1}})}f=new Uint8Array(p),f[0]=p>>>24&255,f[1]=p>>>16&255,f[2]=p>>>8&255,f[3]=p&255,f.set(i.default.types.mdat,4);for(var x=0;x<b.length;x++)for(var A=b[x].units;A.length;){var j=A.shift().data;f.set(j,d),d+=j.byteLength}var M=b[b.length-1];if(c=M.dts+M.duration,u=M.pts+M.duration,this._videoNextDts=c,y.beginDts=o,y.endDts=c,y.beginPts=l,y.endPts=u,y.originalBeginDts=b[0].originalDts,y.originalEndDts=M.originalDts+M.duration,y.firstSample=new s.SampleInfo(b[0].dts,b[0].pts,b[0].duration,b[0].originalDts,b[0].isKeyframe),y.lastSample=new s.SampleInfo(M.dts,M.pts,M.duration,M.originalDts,M.isKeyframe),this._isLive||this._videoSegmentInfoList.append(y),n.samples=b,n.sequenceNumber++,this._forceFirstIDR){var N=b[0].flags;N.dependsOn=2,N.isNonSync=0}var ee=i.default.moof(n,o);n.samples=[],n.length=0,this._onMediaSegment(`video`,{type:`video`,data:this._mergeBoxes(ee,f).buffer,sampleCount:b.length,info:y})}}},e.prototype._mergeBoxes=function(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e,0),n.set(t,e.byteLength),n},e}()}),
vendor: 1,586 bytes, line 3
3"./src/utils/browser.js":(function(e,t,n){n.r(t);var r={};function i(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf(`trident`)>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf(`compatible`)<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],n=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],i={browser:t[5]||t[3]||t[1]||``,version:t[2]||t[4]||`0`,majorVersion:t[4]||t[2]||`0`,platform:n[0]||``},a={};if(i.browser){a[i.browser]=!0;var o=i.majorVersion.split(`.`);a.version={major:parseInt(i.majorVersion,10),string:i.version},o.length>1&&(a.version.minor=parseInt(o[1],10)),o.length>2&&(a.version.build=parseInt(o[2],10))}if(i.platform&&(a[i.platform]=!0),(a.chrome||a.opr||a.safari)&&(a.webkit=!0),a.rv||a.iemobile){a.rv&&delete a.rv;var s=`msie`;i.browser=s,a[s]=!0}if(a.edge){delete a.edge;var c=`msedge`;i.browser=c,a[c]=!0}if(a.opr){var l=`opera`;i.browser=l,a[l]=!0}if(a.safari&&a.android){var u=`android`;i.browser=u,a[u]=!0}for(var d in a.name=i.browser,a.platform=i.platform,r)r.hasOwnProperty(d)&&delete r[d];Object.assign(r,a)}i(),t.default=r}),
3"./src/utils/exception.js":(function(e,t,n){n.r(t),n.d(t,{RuntimeException:function(){return i},IllegalStateException:function(){return a},InvalidArgumentException:function(){return o},NotImplementedException:function(){return s}});var r=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=function(){function e(e){this._message=e}return Object.defineProperty(e.prototype,`name`,{get:function(){return`RuntimeException`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`message`,{get:function(){return this._message},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.name+`: `+this.message},e}(),a=function(e){r(t,e);function t(t){return e.call(this,t)||this}return Object.defineProperty(t.prototype,`name`,{get:function(){return`IllegalStateException`},enumerable:!1,configurable:!0}),t}(i),o=function(e){r(t,e);function t(t){return e.call(this,t)||this}return Object.defineProperty(t.prototype,`name`,{get:function(){return`InvalidArgumentException`},enumerable:!1,configurable:!0}),t}(i),s=function(e){r(t,e);function t(t){return e.call(this,t)||this}return Object.defineProperty(t.prototype,`name`,{get:function(){return`NotImplementedException`},enumerable:!1,configurable:!0}),t}(i)}),
3"./src/utils/logger.js":(function(e,t,n){n.r(t);var r=n(`./node_modules/events/events.js`),i=n.n(r),a=function(){function e(){}return e.e=function(t,n){(!t||e.FORCE_GLOBAL_TAG)&&(t=e.GLOBAL_TAG);var r=`[`+t+`] > `+n;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`error`,r),e.ENABLE_ERROR&&(console.error?console.error(r):console.warn?console.warn(r):console.log(r))},e.i=function(t,n){(!t||e.FORCE_GLOBAL_TAG)&&(t=e.GLOBAL_TAG);var r=`[`+t+`] > `+n;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`info`,r),e.ENABLE_INFO&&(console.info?console.info(r):console.log(r))},e.w=function(t,n){(!t||e.FORCE_GLOBAL_TAG)&&(t=e.GLOBAL_TAG);var r=`[`+t+`] > `+n;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`warn`,r),e.ENABLE_WARN&&(console.warn?console.warn(r):console.log(r))},e.d=function(t,n){(!t||e.FORCE_GLOBAL_TAG)&&(t=e.GLOBAL_TAG);var r=`[`+t+`] > `+n;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`debug`,r),e.ENABLE_DEBUG&&(console.debug?console.debug(r):console.log(r))},e.v=function(t,n){(!t||e.FORCE_GLOBAL_TAG)&&(t=e.GLOBAL_TAG);var r=`[`+t+`] > `+n;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`verbose`,r),e.ENABLE_VERBOSE&&console.log(r)},e}();a.GLOBAL_TAG=`flv.js`,a.FORCE_GLOBAL_TAG=!1,a.ENABLE_ERROR=!0,a.ENABLE_INFO=!0,a.ENABLE_WARN=!0,a.ENABLE_DEBUG=!0,a.ENABLE_VERBOSE=!0,a.ENABLE_CALLBACK=!1,a.emitter=new(i()),t.default=a}),
vendor: 3,055 bytes, line 3
3"./src/utils/logging-control.js":(function(e,t,n){n.r(t);var r=n(`./node_modules/events/events.js`),i=n.n(r),a=n(`./src/utils/logger.js`),o=function(){function e(){}return Object.defineProperty(e,`forceGlobalTag`,{get:function(){return a.default.FORCE_GLOBAL_TAG},set:function(t){a.default.FORCE_GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`globalTag`,{get:function(){return a.default.GLOBAL_TAG},set:function(t){a.default.GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableAll`,{get:function(){return a.default.ENABLE_VERBOSE&&a.default.ENABLE_DEBUG&&a.default.ENABLE_INFO&&a.default.ENABLE_WARN&&a.default.ENABLE_ERROR},set:function(t){a.default.ENABLE_VERBOSE=t,a.default.ENABLE_DEBUG=t,a.default.ENABLE_INFO=t,a.default.ENABLE_WARN=t,a.default.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableDebug`,{get:function(){return a.default.ENABLE_DEBUG},set:function(t){a.default.ENABLE_DEBUG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableVerbose`,{get:function(){return a.default.ENABLE_VERBOSE},set:function(t){a.default.ENABLE_VERBOSE=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableInfo`,{get:function(){return a.default.ENABLE_INFO},set:function(t){a.default.ENABLE_INFO=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableWarn`,{get:function(){return a.default.ENABLE_WARN},set:function(t){a.default.ENABLE_WARN=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableError`,{get:function(){return a.default.ENABLE_ERROR},set:function(t){a.default.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),e.getConfig=function(){return{globalTag:a.default.GLOBAL_TAG,forceGlobalTag:a.default.FORCE_GLOBAL_TAG,enableVerbose:a.default.ENABLE_VERBOSE,enableDebug:a.default.ENABLE_DEBUG,enableInfo:a.default.ENABLE_INFO,enableWarn:a.default.ENABLE_WARN,enableError:a.default.ENABLE_ERROR,enableCallback:a.default.ENABLE_CALLBACK}},e.applyConfig=function(e){a.default.GLOBAL_TAG=e.globalTag,a.default.FORCE_GLOBAL_TAG=e.forceGlobalTag,a.default.ENABLE_VERBOSE=e.enableVerbose,a.default.ENABLE_DEBUG=e.enableDebug,a.default.ENABLE_INFO=e.enableInfo,a.default.ENABLE_WARN=e.enableWarn,a.default.ENABLE_ERROR=e.enableError,a.default.ENABLE_CALLBACK=e.enableCallback},e._notifyChange=function(){var t=e.emitter;if(t.listenerCount(`change`)>0){var n=e.getConfig();t.emit(`change`,n)}},e.registerListener=function(t){e.emitter.addListener(`change`,t)},e.removeListener=function(t){e.emitter.removeListener(`change`,t)},e.addLogListener=function(t){a.default.emitter.addListener(`log`,t),a.default.emitter.listenerCount(`log`)>0&&(a.default.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){a.default.emitter.removeListener(`log`,t),a.default.emitter.listenerCount(`log`)===0&&(a.default.ENABLE_CALLBACK=!1,e._notifyChange())},e}();o.emitter=new(i()),t.default=o}),
3"./src/utils/polyfill.js":(function(e,t,n){n.r(t);var r=function(){function e(){}return e.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(e==null)throw TypeError(`Cannot convert undefined or null to object`);for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(r!=null)for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])}return t},typeof self.Promise!=`function`&&n(`./node_modules/es6-promise/dist/es6-promise.js`).polyfill()},e}();r.install(),t.default=r}),
3"./src/utils/utf8-conv.js":(function(e,t,n){n.r(t);function r(e,t,n){var r=e;if(t+n<r.length){for(;n--;)if((r[++t]&192)!=128)return!1;return!0}else return!1}function i(e){for(var t=[],n=e,i=0,a=e.length;i<a;){if(n[i]<128){t.push(String.fromCharCode(n[i])),++i;continue}else if(!(n[i]<192)){if(n[i]<224){if(r(n,i,1)){var o=(n[i]&31)<<6|n[i+1]&63;if(o>=128){t.push(String.fromCharCode(o&65535)),i+=2;continue}}}else if(n[i]<240){if(r(n,i,2)){var o=(n[i]&15)<<12|(n[i+1]&63)<<6|n[i+2]&63;if(o>=2048&&(o&63488)!=55296){t.push(String.fromCharCode(o&65535)),i+=3;continue}}}else if(n[i]<248&&r(n,i,3)){var o=(n[i]&7)<<18|(n[i+1]&63)<<12|(n[i+2]&63)<<6|n[i+3]&63;if(o>65536&&o<1114112){o-=65536,t.push(String.fromCharCode(o>>>10|55296)),t.push(String.fromCharCode(o&1023|56320)),i+=4;continue}}}t.push(`�`),++i}return t.join(``)}t.default=i})
3},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}return n.m=e,(function(){n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t}})(),(function(){n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(function(){n.g=(function(){if(typeof globalThis==`object`)return globalThis;try{return this||Function(`return this`)()}catch{if(typeof window==`object`)return window}})()})(),(function(){n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}})(),(function(){n.r=function(e){typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,`__esModule`,{value:!0})}})(),n(`./src/index.js`)})()})}))(),1),W=Number.isFinite||function(e){return typeof e==`number`&&isFinite(e)},Pu=Number.isSafeInteger||function(e){return typeof e==`number`&&Math.abs(e)<=Fu},Fu=2**53-1||9007199254740991,G=function(e){return e.NETWORK_ERROR=`networkError`,e.MEDIA_ERROR=`mediaError`,e.KEY_SYSTEM_ERROR=`keySystemError`,e.MUX_ERROR=`muxError`,e.OTHER_ERROR=`otherError`,e}({}),K=function(e){return e.KEY_SYSTEM_NO_KEYS=`keySystemNoKeys`,e.KEY_SYSTEM_NO_ACCESS=`keySystemNoAccess`,e.KEY_SYSTEM_NO_SESSION=`keySystemNoSession`,e.KEY_SYSTEM_NO_CONFIGURED_LICENSE=`keySystemNoConfiguredLicense`,e.KEY_SYSTEM_LICENSE_REQUEST_FAILED=`keySystemLicenseRequestFailed`,e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED=`keySystemServerCertificateRequestFailed`,e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED=`keySystemServerCertificateUpdateFailed`,e.KEY_SYSTEM_SESSION_UPDATE_FAILED=`keySystemSessionUpdateFailed`,e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED=`keySystemStatusOutputRestricted`,e.KEY_SYSTEM_STATUS_INTERNAL_ERROR=`keySystemStatusInternalError`,e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR=`keySystemDestroyMediaKeysError`,e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR=`keySystemDestroyCloseSessionError`,e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR=`keySystemDestroyRemoveSessionError`,e.MANIFEST_LOAD_ERROR=`manifestLoadError`,e.MANIFEST_LOAD_TIMEOUT=`manifestLoadTimeOut`,e.MANIFEST_PARSING_ERROR=`manifestParsingError`,e.MANIFEST_INCOMPATIBLE_CODECS_ERROR=`manifestIncompatibleCodecsError`,e.LEVEL_EMPTY_ERROR=`levelEmptyError`,e.LEVEL_LOAD_ERROR=`levelLoadError`,e.LEVEL_LOAD_TIMEOUT=`levelLoadTimeOut`,e.LEVEL_PARSING_ERROR=`levelParsingError`,e.LEVEL_SWITCH_ERROR=`levelSwitchError`,e.AUDIO_TRACK_LOAD_ERROR=`audioTrackLoadError`,e.AUDIO_TRACK_LOAD_TIMEOUT=`audioTrackLoadTimeOut`,e.SUBTITLE_LOAD_ERROR=`subtitleTrackLoadError`,e.SUBTITLE_TRACK_LOAD_TIMEOUT=`subtitleTrackLoadTimeOut`,e.FRAG_LOAD_ERROR=`fragLoadError`,e.FRAG_LOAD_TIMEOUT=`fragLoadTimeOut`,e.FRAG_DECRYPT_ERROR=`fragDecryptError`,e.FRAG_PARSING_ERROR=`fragParsingError`,e.FRAG_GAP=`fragGap`,e.REMUX_ALLOC_ERROR=`remuxAllocError`,e.KEY_LOAD_ERROR=`keyLoadError`,e.KEY_LOAD_TIMEOUT=`keyLoadTimeOut`,e.BUFFER_ADD_CODEC_ERROR=`bufferAddCodecError`,e.BUFFER_INCOMPATIBLE_CODECS_ERROR=`bufferIncompatibleCodecsError`,e.BUFFER_APPEND_ERROR=`bufferAppendError`,e.BUFFER_APPENDING_ERROR=`bufferAppendingError`,e.BUFFER_STALLED_ERROR=`bufferStalledError`,e.BUFFER_FULL_ERROR=`bufferFullError`,e.BUFFER_SEEK_OVER_HOLE=`bufferSeekOverHole`,e.BUFFER_NUDGE_ON_STALL=`bufferNudgeOnStall`,e.ASSET_LIST_LOAD_ERROR=`assetListLoadError`,e.ASSET_LIST_LOAD_TIMEOUT=`assetListLoadTimeout`,e.ASSET_LIST_PARSING_ERROR=`assetListParsingError`,e.INTERSTITIAL_ASSET_ITEM_ERROR=`interstitialAssetItemError`,e.INTERNAL_EXCEPTION=`internalException`,e.INTERNAL_ABORTED=`aborted`,e.ATTACH_MEDIA_ERROR=`attachMediaError`,e.UNKNOWN=`unknown`,e}({}),q=function(e){return e.MEDIA_ATTACHING=`hlsMediaAttaching`,e.MEDIA_ATTACHED=`hlsMediaAttached`,e.MEDIA_DETACHING=`hlsMediaDetaching`,e.MEDIA_DETACHED=`hlsMediaDetached`,e.MEDIA_ENDED=`hlsMediaEnded`,e.STALL_RESOLVED=`hlsStallResolved`,e.BUFFER_RESET=`hlsBufferReset`,e.BUFFER_CODECS=`hlsBufferCodecs`,e.BUFFER_CREATED=`hlsBufferCreated`,e.BUFFER_APPENDING=`hlsBufferAppending`,e.BUFFER_APPENDED=`hlsBufferAppended`,e.BUFFER_EOS=`hlsBufferEos`,e.BUFFERED_TO_END=`hlsBufferedToEnd`,e.BUFFER_FLUSHING=`hlsBufferFlushing`,e.BUFFER_FLUSHED=`hlsBufferFlushed`,e.MANIFEST_LOADING=`hlsManifestLoading`,e.MANIFEST_LOADED=`hlsManifestLoaded`,e.MANIFEST_PARSED=`hlsManifestParsed`,e.LEVEL_SWITCHING=`hlsLevelSwitching`,e.LEVEL_SWITCHED=`hlsLevelSwitched`,e.LEVEL_LOADING=`hlsLevelLoading`,e.LEVEL_LOADED=`hlsLevelLoaded`,e.LEVEL_UPDATED=`hlsLevelUpdated`,e.LEVEL_PTS_UPDATED=`hlsLevelPtsUpdated`,e.LEVELS_UPDATED=`hlsLevelsUpdated`,e.AUDIO_TRACKS_UPDATED=`hlsAudioTracksUpdated`,e.AUDIO_TRACK_SWITCHING=`hlsAudioTrackSwitching`,e.AUDIO_TRACK_SWITCHED=`hlsAudioTrackSwitched`,e.AUDIO_TRACK_LOADING=`hlsAudioTrackLoading`,e.AUDIO_TRACK_LOADED=`hlsAudioTrackLoaded`,e.AUDIO_TRACK_UPDATED=`hlsAudioTrackUpdated`,e.SUBTITLE_TRACKS_UPDATED=`hlsSubtitleTracksUp
3dated`,e.SUBTITLE_TRACKS_CLEARED=`hlsSubtitleTracksCleared`,e.SUBTITLE_TRACK_SWITCH=`hlsSubtitleTrackSwitch`,e.SUBTITLE_TRACK_LOADING=`hlsSubtitleTrackLoading`,e.SUBTITLE_TRACK_LOADED=`hlsSubtitleTrackLoaded`,e.SUBTITLE_TRACK_UPDATED=`hlsSubtitleTrackUpdated`,e.SUBTITLE_FRAG_PROCESSED=`hlsSubtitleFragProcessed`,e.CUES_PARSED=`hlsCuesParsed`,e.NON_NATIVE_TEXT_TRACKS_FOUND=`hlsNonNativeTextTracksFound`,e.INIT_PTS_FOUND=`hlsInitPtsFound`,e.FRAG_LOADING=`hlsFragLoading`,e.FRAG_LOAD_EMERGENCY_ABORTED=`hlsFragLoadEmergencyAborted`,e.FRAG_LOADED=`hlsFragLoaded`,e.FRAG_DECRYPTED=`hlsFragDecrypted`,e.FRAG_PARSING_INIT_SEGMENT=`hlsFragParsingInitSegment`,e.FRAG_PARSING_USERDATA=`hlsFragParsingUserdata`,e.FRAG_PARSING_METADATA=`hlsFragParsingMetadata`,e.FRAG_PARSED=`hlsFragParsed`,e.FRAG_BUFFERED=`hlsFragBuffered`,e.FRAG_CHANGED=`hlsFragChanged`,e.FPS_DROP=`hlsFpsDrop`,e.FPS_DROP_LEVEL_CAPPING=`hlsFpsDropLevelCapping`,e.MAX_AUTO_LEVEL_UPDATED=`hlsMaxAutoLevelUpdated`,e.ERROR=`hlsError`,e.DESTROYING=`hlsDestroying`,e.KEY_LOADING=`hlsKeyLoading`,e.KEY_LOADED=`hlsKeyLoaded`,e.LIVE_BACK_BUFFER_REACHED=`hlsLiveBackBufferReached`,e.BACK_BUFFER_REACHED=`hlsBackBufferReached`,e.STEERING_MANIFEST_LOADED=`hlsSteeringManifestLoaded`,e.ASSET_LIST_LOADING=`hlsAssetListLoading`,e.ASSET_LIST_LOADED=`hlsAssetListLoaded`,e.INTERSTITIALS_UPDATED=`hlsInterstitialsUpdated`,e.INTERSTITIALS_BUFFERED_TO_BOUNDARY=`hlsInterstitialsBufferedToBoundary`,e.INTERSTITIAL_ASSET_PLAYER_CREATED=`hlsInterstitialAssetPlayerCreated`,e.INTERSTITIAL_STARTED=`hlsInterstitialStarted`,e.INTERSTITIAL_ASSET_STARTED=`hlsInterstitialAssetStarted`,e.INTERSTITIAL_ASSET_ENDED=`hlsInterstitialAssetEnded`,e.INTERSTITIAL_ASSET_ERROR=`hlsInterstitialAssetError`,e.INTERSTITIAL_ENDED=`hlsInterstitialEnded`,e.INTERSTITIALS_PRIMARY_RESUMED=`hlsInterstitialsPrimaryResumed`,e.PLAYOUT_LIMIT_REACHED=`hlsPlayoutLimitReached`,e.EVENT_CUE_ENTER=`hlsEventCueEnter`,e}({}),J={MANIFEST:`manifest`,LEVEL:`level`,AUDIO_TRACK:`audioTrack`,SUBTITLE_TRACK:`subtitleTrack`},Y={MAIN:`main`,AUDIO:`audio`,SUBTITLE:`subtitle`},Iu=class{constructor(e,t=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=n}sample(e,t){let n=this.alpha_**+e;this.estimate_=t*(1-n)+n*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){let e=1-this.alpha_**+this.totalWeight_;if(e)return this.estimate_/e}return this.estimate_}},Lu=class{constructor(e,t,n,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_
vendor: 43,966 bytes, lines 3-13
3=new Iu(e),this.fast_=new Iu(t),this.defaultTTFB_=r,this.ttfb_=new Iu(e)}update(e,t){let{slow_:n,fast_:r,ttfb_:i}=this;n.halfLife!==e&&(this.slow_=new Iu(e,n.getEstimate(),n.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Iu(t,r.getEstimate(),r.getTotalWeight())),i.halfLife!==e&&(this.ttfb_=new Iu(e,i.getEstimate(),i.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);let n=8*t,r=e/1e3,i=n/r;this.fast_.sample(r,i),this.slow_.sample(r,i)}sampleTTFB(e){let t=e/1e3,n=Math.sqrt(2)*Math.exp(-(t**2)/2);this.ttfb_.sample(n,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}};function Ru(e,t,n){return(t=Uu(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zu(){return zu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zu.apply(null,arguments)}function Bu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Bu(Object(n),!0).forEach(function(t){Ru(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hu(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Uu(e){var t=Hu(e,`string`);return typeof t==`symbol`?t:t+``}var Wu=class{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;let n=`[${e}]:`;this.trace=Gu,this.debug=t.debug.bind(null,n),this.log=t.log.bind(null,n),this.warn=t.warn.bind(null,n),this.info=t.info.bind(null,n),this.error=t.error.bind(null,n)}},Gu=function(){},Ku={trace:Gu,debug:Gu,log:Gu,warn:Gu,info:Gu,error:Gu};function qu(){return zu({},Ku)}function Ju(e,t){let n=self.console[e];return n?n.bind(self.console,`${t?`[`+t+`] `:``}[${e}] >`):Gu}function Yu(e,t,n){return t[e]?t[e].bind(t):Ju(e,n)}var Xu=qu();function Zu(e,t,n){let r=qu();if(typeof console==`object`&&e===!0||typeof e==`object`){let i=[`debug`,`log`,`info`,`warn`,`error`];i.forEach(t=>{r[t]=Yu(t,e,n)});try{r.log(`Debug logs enabled for "${t}" in hls.js version 1.6.16`)}catch{return qu()}i.forEach(t=>{Xu[t]=Yu(t,e)})}else zu(Xu,r);return r}var Qu=Xu;function $u(e=!0){if(!(typeof self>`u`))return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function ed(e){return typeof self<`u`&&e===self.ManagedMediaSource}function td(e,t){let n=Object.keys(e),r=Object.keys(t),i=n.length,a=r.length;return!i||!a||i===a&&!n.some(e=>r.indexOf(e)===-1)}function nd(e,t=!1){if(typeof TextDecoder<`u`){let n=new TextDecoder(`utf-8`).decode(e);if(t){let e=n.indexOf(`\0`);return e===-1?n:n.substring(0,e)}return n.replace(/\0/g,``)}let n=e.length,r,i,a,o=``,s=0;for(;s<n;){if(r=e[s++],r===0&&t)return o;if(!(r===0||r===3))switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(r);break;case 12:case 13:i=e[s++],o+=String.fromCharCode((r&31)<<6|i&63);break;case 14:i=e[s++],a=e[s++],o+=String.fromCharCode((r&15)<<12|(i&63)<<6|(a&63)<<0);break}}return o}function rd(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n].toString(16);r.length<2&&(r=`0`+r),t+=r}return t}function id(e){return Uint8Array.from(e.replace(/^0x/,``).replace(/([\da-fA-F]{2}) ?/g,`0x$1 `).replace(/ +$/,``).split(` `)).buffer}function ad(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var od={exports:{}},sd;function cd(){return sd?od.exports:(sd=1,(function(e,t){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,n){if(n||={},e=e.trim(),t=t.trim(),!t){if(!n.alwaysNormalize)return e;var i=o.parseURL(e);if(!i)throw Error(`Error trying to parse base URL.`);return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var a=o.parseURL(t);if(!a)throw Error(`Error trying to parse relative URL.`);if(a.scheme)return n.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):t;var s=o.parseURL(e);if(!s)throw Error(`Error trying to parse base URL.`);if(!s.netLoc&&s.path&&s.path[0]!==`/`){var c=r.exec(s.path);s.netLoc=c[1],s.path=c[2]}s.netLoc&&!s.path&&(s.path=`/`);var l={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(l.netLoc=s.netLoc,a.path[0]!==`/`))if(!a.path)l.path=s.path,a.params||(l.params=s.params,a.query||(l.query=s.query));else{var u=s.path,d=u.substring(0,u.lastIndexOf(`/`)+1)+a.path;l.path=o.normalizePath(d)}return l.path===null&&(l.path=n.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(l)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||``,netLoc:t[2]||``,path:t[3]||``,params:t[4]||``,query:t[5]||``,fragment:t[6]||``}:null},normalizePath:function(e){for(e=e.split(``).reverse().join(``).replace(i,``);e.length!==(e=e.replace(a,``)).length;);return e.split(``).reverse().join(``)},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=o})()})(od),od.exports)}var ld=cd(),ud=class{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},dd={AUDIO:`audio`,VIDEO:`video`,AUDIOVIDEO:`audiovideo`},fd=class{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e==`string`&&(e={url:e}),this.base=e,_d(this,`stats`)}setByteRange(e,t){let n=e.split(`@`,2),r;r=n.length===1?t?.byteRangeEndOffset||0:parseInt(n[1]),this._byteRange=[r,parseInt(n[0])+r]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[dd.AUDIO]:null,[dd.VIDEO]:null,[dd.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new ud),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=ld.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||``}set url(e){this._url=e}clearElementaryStreamInfo(){let{elementaryStreams:e}=this;e[dd.AUDIO]=null,e[dd.VIDEO]=null,e[dd.AUDIOVIDEO]=null}};function pd(e){return e.sn!==`initSegment`}var md=class extends fd{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){let e=this.stats.total;if(e)return e}if(this.byteRange.length){let e=this.byteRange[0],t=this.byteRange[1];if(W(e)&&W(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;let{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||=t.identity.getDecryptData(this.sn);else if(!((e=this._decryptdata)!=null&&e.keyId)){let e=Object.keys(t);if(e.length===1){let n=this._decryptdata=t[e[0]]||null;n&&(this._decryptdata=n.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;let e=W(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;let e=Object.keys(this.levelkeys),n=e.length;if(n>1||n===1&&(t=this.levelkeys[e[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!W(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return pd(this)?(this._ref||={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime},this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){let t=this.levelkeys;if(t){var n;let r=t[e];r&&!((n=this._decryptdata)!=null&&n.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,n,r,i,a=!1){let{elementaryStreams:o}=this,s=o[e];if(!s){o[e]={startPTS:t,endPTS:n,startDTS:r,endDTS:i,partial:a};return}s.startPTS=Math.min(s.startPTS,t),s.endPTS=Math.max(s.endPTS,n),s.startDTS=Math.min(s.startDTS,r),s.endDTS=Math.max(s.endDTS,i)}},hd=class extends fd{constructor(e,t,n,r,i){super(n),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint(`DURATION`),this.gap=e.bool(`GAP`),this.independent=e.bool(`INDEPENDENT`),this.relurl=e.enumeratedString(`URI`),this.fragment=t,this.index=r;let a=e.enumeratedString(`BYTERANGE`);a&&this.setByteRange(a,i),i&&(this.fragOffset=i.fragOffset+i.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){let{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}};function gd(e,t){let n=Object.getPrototypeOf(e);if(n)return Object.getOwnPropertyDescriptor(n,t)||gd(n,t)}function _d(e,t){let n=gd(e,t);n&&(n.enumerable=!0,Object.defineProperty(e,t,n))}var vd=2**32-1,yd=[].push,bd={video:1,audio:2,id3:3,text:4};function xd(e){return String.fromCharCode.apply(null,e)}function Sd(e,t){let n=e[t]<<8|e[t+1];return n<0?65536+n:n}function X(e,t){let n=wd(e,t);return n<0?4294967296+n:n}function Cd(e,t){let n=X(e,t);return n*=2**32,n+=X(e,t+4),n}function wd(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function Td(e){let t=e.byteLength;for(let n=0;n<t;){let r=X(e,n);if(r>8&&e[n+4]===109&&e[n+5]===111&&e[n+6]===111&&e[n+7]===102)return!0;n=r>1?n+r:t}return!1}function Z(e,t){let n=[];if(!t.length)return n;let r=e.byteLength;for(let i=0;i<r;){let a=X(e,i),o=xd(e.subarray(i+4,i+8)),s=a>1?i+a:r;if(o===t[0])if(t.length===1)n.push(e.subarray(i+8,s));else{let r=Z(e.subarray(i+8,s),t.slice(1));r.length&&yd.apply(n,r)}i=s}return n}function Ed(e){let t=[],n=e[0],r=8,i=X(e,r);r+=4;let a=0,o=0;n===0?(a=X(e,r),o=X(e,r+4),r+=8):(a=Cd(e,r),o=Cd(e,r+8),r+=16),r+=2;let s=e.length+o,c=Sd(e,r);r+=2;for(let n=0;n<c;n++){let n=r,a=X(e,n);n+=4;let o=a&2147483647;if((a&2147483648)>>>31==1)return Qu.warn(`SIDX has hierarchical references (not supported)`),null;let c=X(e,n);n+=4,t.push({referenceSize:o,subsegmentDuration:c,info:{duration:c/i,start:s,end:s+o-1}}),s+=o,n+=4,r=n}return{earliestPresentationTime:a,timescale:i,version:n,referencesCount:c,references:t}}function Dd(e){let t=[],n=Z(e,[`moov`,`trak`]);for(let e=0;e<n.length;e++){let r=n[e],i=Z(r,[`tkhd`])[0];if(i){let e=i[0],n=X(i,e===0?12:20),a=Z(r,[`mdia`,`mdhd`])[0];if(a){e=a[0];let i=X(a,e===0?12:20),o=Z(r,[`mdia`,`hdlr`])[0];if(o){let e=xd(o.subarray(8,12)),a={soun:dd.AUDIO,vide:dd.VIDEO}[e],s=Z(r,[`mdia`,`minf`,`stbl`,`stsd`])[0],c=Od(s);a?(t[n]={timescale:i,type:a,stsd:c},t[a]=Vu({timescale:i,id:n},c)):t[n]={timescale:i,type:e,stsd:c}}}}}return Z(e,[`moov`,`mvex`,`trex`]).forEach(e=>{let n=t[X(e,4)];n&&(n.default={duration:X(e,12),flags:X(e,20)})}),t}function Od(e){let t=e.subarray(8),n=t.subarray(86),r=xd(t.subarray(4,8)),i=r,a,o=r===`enca`||r===`encv`;o&&Z(Z(t,[r])[0].subarray(r===`enca`?28:78),[`sinf`]).forEach(e=>{let t=Z(e,[`schm`])[0];if(t){let n=xd(t.subarray(4,8));if(n===`cbcs`||n===`cenc`){let t=Z(e,[`frma`])[0];t&&(i=xd(t))}}});let s=i;switch(i){case`avc1`:case`avc2`:case`avc3`:case`avc4`:{let e=Z(n,[`avcC`])[0];e&&e.length>3&&(i+=`.`+Md(e[1])+Md(e[2])+Md(e[3]),a=kd(s===`avc1`?`dva1`:`dvav`,n));break}case`mp4a`:{let e=Z(t,[r])[0],n=Z(e.subarray(28),[`esds`])[0];if(n&&n.length>7){let e=4;if(n[e++]!==3)break;e=jd(n,e),e+=2;let t=n[e++];if(t&128&&(e+=2),t&64&&(e+=n[e++]),n[e++]!==4)break;e=jd(n,e);let r=n[e++];if(r===64)i+=`.`+Md(r);else break;if(e+=12,n[e++]!==5)break;e=jd(n,e);let a=n[e++],o=(a&248)>>3;o===31&&(o+=1+((a&7)<<3)+((n[e]&224)>>5)),i+=`.`+o}break}case`hvc1`:case`hev1`:{let e=Z(n,[`hvcC`])[0];if(e&&e.length>12){let t=e[1],n=[``,`A`,`B`,`C`][t>>6],r=t&31,a=X(e,2),o=(t&32)>>5?`H`:`L`,s=e[12],c=e.subarray(6,12);i+=`.`+n+r,i+=`.`+Ad(a).toString(16).toUpperCase(),i+=`.`+o+s;let l=``;for(let e=c.length;e--;){let t=c[e];(t||l)&&(l=`.`+t.toString(16).toUpperCase()+l)}i+=l}a=kd(s==`hev1`?`dvhe`:`dvh1`,n);break}case`dvh1`:case`dvhe`:case`dvav`:case`dva1`:case`dav1`:i=kd(i,n)||i;break;case`vp09`:{let e=Z(n,[`vpcC`])[0];if(e&&e.length>6){let t=e[4],n=e[5],r=e[6]>>4&15;i+=`.`+Nd(t)+`.`+Nd(n)+`.`+Nd(r)}break}case`av01`:{let e=Z(n,[`av1C`])[0];if(e&&e.length>2){let t=e[1]>>>5,r=e[1]&31,o=e[2]>>>7?`H`:`M`,s=(e[2]&64)>>6,c=(e[2]&32)>>5,l=t===2&&s?c?12:10:s?10:8,u=(e[2]&16)>>4,d=(e[2]&8)>>3,f=(e[2]&4)>>2,p=e[2]&3;i+=`.`+t+`.`+Nd(r)+o+`.`+Nd(l)+`.`+u+`.`+d+f+p+`.`+Nd(1)+`.`+Nd(1)+`.`+Nd(1)+`.0`,a=kd(`dav1`,n)}break}}return{codec:i,encrypted:o,supplemental:a}}function kd(e,t){let n=Z(t,[`dvvC`]),r=n.length?n[0]:Z(t,[`dvcC`])[0];if(r){let t=r[2]>>1&127,n=r[2]<<5&32|r[3]>>3&31;return e+`.`+Nd(t)+`.`+Nd(n)}}function Ad(e){let t=0;for(let n=0;n<32;n++)t|=(e>>n&1)<<31-n;return t>>>0}function jd(e,t){let n=t+5;for(;e[t++]&128&&t<n;);return t}function Md(e){return(`0`+e.toString(16).toUpperCase()).slice(-2)}function Nd(e){return(e<10?`0`:``)+e}function Pd(e,t){if(!e||!t)return;let n=t.keyId;n&&t.isCommonEncryption&&Id(e,(e,t)=>{let r=e.subarray(8,24);r.some(e=>e!==0)||(Qu.log(`[eme] Patching keyId in 'enc${t?`a`:`v`}>sinf>>tenc' box: ${rd(r)} -> ${rd(n)}`),e.set(n,8))})}function Fd(e){let t=[];return Id(e,e=>t.push(e.subarray(8,24))),t}function Id(e,t){Z(e,[`moov`,`trak`]).forEach(e=>{let n=Z(e,[`mdia`,`minf`,`stbl`,`stsd`])[0];if(!n)return;let r=n.subarray(8),i=Z(r,[`enca`]),a=i.length>0;a||(i=Z(r,[`encv`])),i.forEach(e=>{Z(a?e.subarray(28):e.subarray(78),[`sinf`]).forEach(e=>{let n=Ld(e);n&&t(n,a)})})})}function Ld(e){let t=Z(e,[`schm`])[0];if(t){let n=xd(t.subarray(4,8));if(n===`cbcs`||n===`cenc`){let t=Z(e,[`schi`,`tenc`])[0];if(t)return t}}}function Rd(e,t,n){let r={},i=Z(e,[`moof`,`traf`]);for(let e=0;e<i.length;e++){let a=i[e],o=Z(a,[`tfhd`])[0],s=X(o,4),c=t[s];if(!c)continue;r[s]||(r[s]={start:NaN,duration:0,sampleCount:0,timescale:c.timescale,type:c.type});let l=r[s],u=Z(a,[`tfdt`])[0];if(u){let e=u[0],t=X(u,4);e===1&&(t===vd?n.warn(`[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time`):(t*=vd+1,t+=X(u,8))),W(t)&&(!W(l.start)||t<l.start)&&(l.start=t)}let d=c.default,f=X(o,0)|d?.flags,p=d?.duration||0;f&8&&(p=f&2?X(o,12):X(o,8));let m=Z(a,[`trun`]),h=l.start||0,g=0,_=p;for(let e=0;e<m.length;e++){let t=m[e],n=X(t,4),r=l.sampleCount;l.sampleCount+=n;let i=t[3]&1,a=t[3]&4,o=t[2]&1,s=t[2]&2,c=t[2]&4,u=t[2]&8,d=8,f=n;for(i&&(d+=4),a&&n&&(!(t[d+1]&1)&&l.keyFrameIndex===void 0&&(l.keyFrameIndex=r),d+=4,o?(_=X(t,d),d+=4):_=p,s&&(d+=4),u&&(d+=4),h+=_,g+=_,f--);f--;)o?(_=X(t,d),d+=4):_=p,s&&(d+=4),c&&(t[d+1]&1||l.keyFrameIndex===void 0&&(l.keyFrameIndex=l.sampleCount-(f+1),l.keyFrameStart=h),d+=4),u&&(d+=4),h+=_,g+=_;!g&&p&&(g+=p*n)}l.duration+=g}if(!Object.keys(r).some(e=>r[e].duration)){let t=1/0,n=0,i=Z(e,[`sidx`]);for(let e=0;e<i.length;e++){let r=Ed(i[e]);if(r!=null&&r.references){t=Math.min(t,r.earliestPresentationTime/r.timescale);let e=r.references.reduce((e,t)=>e+t.info.duration||0,0);n=Math.max(n,e+r.earliestPresentationTime/r.timescale)}}n&&W(n)&&Object.keys(r).forEach(e=>{r[e].duration||(r[e].duration=n*r[e].timescale-r[e].start)})}return r}function zd(e){let t={valid:null,remainder:null},n=Z(e,[`moof`]);if(n.length<2)return t.remainder=e,t;let r=n[n.length-1];return t.valid=e.slice(0,r.byteOffset-8),t.remainder=e.slice(r.byteOffset-8),t}function Bd(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function Vd(e,t){let n=[],r=t.samples,i=t.timescale,a=t.id,o=!1;return Z(r,[`moof`]).map(s=>{let c=s.byteOffset-8;Z(s,[`traf`]).map(s=>{let l=Z(s,[`tfdt`]).map(e=>{let t=e[0],n=X(e,4);return t===1&&(n*=2**32,n+=X(e,8)),n/i})[0];return l!==void 0&&(e=l),Z(s,[`tfhd`]).map(l=>{let u=X(l,4),d=X(l,0)&16777215,f=(d&1)!=0,p=(d&2)!=0,m=(d&8)!=0,h=0,g=(d&16)!=0,_=0,v=(d&32)!=0,y=8;u===a&&(f&&(y+=8),p&&(y+=4),m&&(h=X(l,y),y+=4),g&&(_=X(l,y),y+=4),v&&(y+=4),t.type===`video`&&(o=Hd(t.codec)),Z(s,[`trun`]).map(a=>{let s=a[0],l=X(a,0)&16777215,u=(l&1)!=0,d=0,f=(l&4)!=0,p=(l&256)!=0,m=0,g=(l&512)!=0,v=0,y=(l&1024)!=0,b=(l&2048)!=0,x=0,S=X(a,4),C=8;u&&(d=X(a,C),C+=4),f&&(C+=4);let w=d+c;for(let c=0;c<S;c++){if(p?(m=X(a,C),C+=4):m=h,g?(v=X(a,C),C+=4):v=_,y&&(C+=4),b&&(x=s===0?X(a,C):wd(a,C),C+=4),t.type===dd.VIDEO){let t=0;for(;t<v;){let a=X(r,w);w+=4,Ud(o,r[w])&&Wd(r.subarray(w,w+a),o?2:1,e+x/i,n),w+=a,t+=a+4}}e+=m/i}}))})})}),n}function Hd(e){if(!e)return!1;let t=e.substring(0,4);return t===`hvc1`||t===`hev1`||t===`dvh1`||t===`dvhe`}function Ud(e,t){if(e){let e=t>>1&63;return e===39||e===40}else return(t&31)==6}function Wd(e,t,n,r){let i=Gd(e),a=0;a+=t;let o=0,s=0,c=0;for(;a<i.length;){o=0;do{if(a>=i.length)break;c=i[a++],o+=c}while(c===255);s=0;do{if(a>=i.length)break;c=i[a++],s+=c}while(c===255);let e=i.length-a,t=a;if(s<e)a+=s;else if(s>e){Qu.error(`Malformed SEI payload. ${s} is too small, only ${e} bytes left to parse.`);break}if(o===4){if(i[t++]===181){let e=Sd(i,t);if(t+=2,e===49){let e=X(i,t);if(t+=4,e===1195456820){let e=i[t++];if(e===3){let a=i[t++],s=31&a,c=64&a,l=c?2+s*3:0,u=new Uint8Array(l);if(c){u[0]=a;for(let e=1;e<l;e++)u[e]=i[t++]}r.push({type:e,payloadType:o,pts:n,bytes:u})}}}}}else if(o===5&&s>16){let e=[];for(let n=0;n<16;n++){let r=i[t++].toString(16);e.push(r.length==1?`0`+r:r),(n===3||n===5||n===7||n===9)&&e.push(`-`)}let a=s-16,c=new Uint8Array(a);for(let e=0;e<a;e++)c[e]=i[t++];r.push({payloadType:o,pts:n,uuid:e.join(``),userData:nd(c),userDataBytes:c})}}}function Gd(e){let t=e.byteLength,n=[],r=1;for(;r<t-2;)e[r]===0&&e[r+1]===0&&e[r+2]===3?(n.push(r+2),r+=2):r++;if(n.length===0)return e;let i=t-n.length,a=new Uint8Array(i),o=0;for(r=0;r<i;o++,r++)o===n[0]&&(o++,n.shift()),a[r]=e[o];return a}function Kd(e){let t=e[0],n=``,r=``,i=0,a=0,o=0,s=0,c=0,l=0;if(t===0){for(;xd(e.subarray(l,l+1))!==`\0`;)n+=xd(e.subarray(l,l+1)),l+=1;for(n+=xd(e.subarray(l,l+1)),l+=1;xd(e.subarray(l,l+1))!==`\0`;)r+=xd(e.subarray(l,l+1)),l+=1;r+=xd(e.subarray(l,l+1)),l+=1,i=X(e,12),a=X(e,16),s=X(e,20),c=X(e,24),l=28}else if(t===1){l+=4,i=X(e,l),l+=4;let t=X(e,l);l+=4;let a=X(e,l);for(l+=4,o=2**32*t+a,Pu(o)||(o=2**53-1,Qu.warn(`Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box`)),s=X(e,l),l+=4,c=X(e,l),l+=4;xd(e.subarray(l,l+1))!==`\0`;)n+=xd(e.subarray(l,l+1)),l+=1;for(n+=xd(e.subarray(l,l+1)),l+=1;xd(e.subarray(l,l+1))!==`\0`;)r+=xd(e.subarray(l,l+1)),l+=1;r+=xd(e.subarray(l,l+1)),l+=1}let u=e.subarray(l,e.byteLength);return{schemeIdUri:n,value:r,timeScale:i,presentationTime:o,presentationTimeDelta:a,eventDuration:s,id:c,payload:u}}function qd(e,...t){let n=t.length,r=8,i=n;for(;i--;)r+=t[i].byteLength;let a=new Uint8Array(r);for(a[0]=r>>24&255,a[1]=r>>16&255,a[2]=r>>8&255,a[3]=r&255,a.set(e,4),i=0,r=8;i<n;i++)a.set(t[i],r),r+=t[i].byteLength;return a}function Jd(e,t,n){if(e.byteLength!==16)throw RangeError(`Invalid system id`);let r,i;r=0,i=new Uint8Array;let a;r>0?(a=new Uint8Array(4),t.length>0&&new DataView(a.buffer).setUint32(0,t.length,!1)):a=new Uint8Array;let o=new Uint8Array(4);return n.byteLength>0&&new DataView(o.buffer).setUint32(0,n.byteLength,!1),qd([112,115,115,104],new Uint8Array([r,0,0,0]),e,a,i,o,n)}function Yd(e){let t=[];if(e instanceof ArrayBuffer){let n=e.byteLength,r=0;for(;r+32<n;){let n=Xd(new DataView(e,r));t.push(n),r+=n.size}}return t}function Xd(e){let t=e.getUint32(0),n=e.byteOffset,r=e.byteLength;if(r<t)return{offset:n,size:r};if(e.getUint32(4)!==1886614376)return{offset:n,size:t};let i=e.getUint32(8)>>>24;if(i!==0&&i!==1)return{offset:n,size:t};let a=e.buffer,o=rd(new Uint8Array(a,n+12,16)),s=null,c=null,l=0;if(i===0)l=28;else{let i=e.getUint32(28);if(!i||r<32+i*16)return{offset:n,size:t};s=[];for(let e=0;e<i;e++)s.push(new Uint8Array(a,n+32+e*16,16));l=32+i*16}if(!l)return{offset:n,size:t};let u=e.getUint32(l);return t-32<u?{offset:n,size:t}:(c=new Uint8Array(a,n+l+4,u),{version:i,systemId:o,kids:s,data:c,offset:n,size:t})}var Zd=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Qd={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function $d(e,t){let n=Qd[t];return!!n&&!!n[e.slice(0,4)]}function ef(e,t,n=!0){return!e.split(`,`).some(e=>!tf(e,t,n))}function tf(e,t,n=!0){return $u(n)?.isTypeSupported(nf(e,t))??!1}function nf(e,t){return`${t}/mp4;codecs=${e}`}function rf(e){if(e){let t=e.substring(0,4);return Qd.video[t]}return 2}function af(e){let t=Zd();return e.split(`,`).reduce((e,n)=>{let r=t&&Hd(n)?9:Qd.video[n];return r?(r*2+e)/(e?3:2):(Qd.audio[n]+e)/(e?2:1)},0)}var of={};function sf(e,t=!0){if(of[e])return of[e];let n={flac:[`flac`,`fLaC`,`FLAC`],opus:[`opus`,`Opus`],"mp4a.40.34":[`mp3`]}[e];for(let i=0;i<n.length;i++){var r;if(tf(n[i],`audio`,t))return of[e]=n[i],n[i];if(n[i]===`mp3`&&(r=$u(t))!=null&&r.isTypeSupported(`audio/mpeg`))return``}return e}var cf=/flac|opus|mp4a\.40\.34/i;function lf(e,t=!0){return e.replace(cf,e=>sf(e.toLowerCase(),t))}function uf(e,t){let n=[];if(e){let t=e.split(`,`);for(let e=0;e<t.length;e++)$d(t[e],`video`)||n.push(t[e])}return t&&n.push(t),n.join(`,`)}function df(e,t){if(e&&(e.length>4||[`ac-3`,`ec-3`,`alac`,`fLaC`,`Opus`].indexOf(e)!==-1)&&(ff(e,`audio`)||ff(e,`video`)))return e;if(t){let n=t.split(`,`);if(n.length>1){if(e){for(let t=n.length;t--;)if(n[t].substring(0,4)===e.substring(0,4))return n[t]}return n[0]}}return t||e}function ff(e,t){return $d(e,t)&&tf(e,t)}function pf(e){let t=e.split(`,`);for(let e=0;e<t.length;e++){let n=t[e].split(`.`);n.length>2&&n[0]===`avc1`&&(t[e]=`avc1.${parseInt(n[1]).toString(16)}${(`000`+parseInt(n[2]).toString(16)).slice(-4)}`)}return t.join(`,`)}function mf(e){if(e.startsWith(`av01.`)){let t=e.split(`.`),n=[`0`,`111`,`01`,`01`,`01`,`0`];for(let e=t.length;e>4&&e<10;e++)t[e]=n[e-4];return t.join(`.`)}return e}function hf(e){let t=$u(e)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported(`audio/mpeg`),mp3:t.isTypeSupported(`audio/mp4; codecs="mp3"`),ac3:t.isTypeSupported(`audio/mp4; codecs="ac-3"`)}}function gf(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,`$1`)}var _f={supported:!0,powerEfficient:!0,smooth:!0},vf={supported:!1,smooth:!1,powerEfficient:!1},yf={supported:!0,configurations:[],decodingInfoResults:[_f]};function bf(e,t){return{supported:!1,configurations:t,decodingInfoResults:[vf],error:e}}function xf(e,t,n,r,i,a){let o=e.videoCodec,s=e.audioCodec?e.audioGroups:null,c=a?.audioCodec,l=a?.channels,u=l?parseInt(l):c?1/0:2,d=null;if(s!=null&&s.length)try{d=s.length===1&&s[0]?t.groups[s[0]].channels:s.reduce((e,n)=>{if(n){let r=t.groups[n];if(!r)throw Error(`Audio track group ${n} not found`);Object.keys(r.channels).forEach(t=>{e[t]=(e[t]||0)+r.channels[t]})}return e},{2:0})}catch{return!0}return o!==void 0&&(o.split(`,`).some(e=>Hd(e))||e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(r,30)||e.videoRange!==`SDR`&&e.videoRange!==n||e.bitrate>Math.max(i,8e6))||!!d&&W(u)&&Object.keys(d).some(e=>parseInt(e)>u)}function Sf(e,t,n,r={}){let i=e.videoCodec;if(!i&&!e.audioCodec||!n)return Promise.resolve(yf);let a=[],o=Cf(e),s=o.length,c=wf(e,t,s>0),l=c.length;for(let e=s||1*l||1;e--;){let t={type:`media-source`};if(s&&(t.video=o[e%s]),l){t.audio=c[e%l];let n=t.audio.bitrate;t.video&&n&&(t.video.bitrate-=n)}a.push(t)}if(i){let e=navigator.userAgent;if(i.split(`,`).some(e=>Hd(e))&&Zd())return Promise.resolve(bf(Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${e})`),a))}return Promise.all(a.map(e=>{let t=Df(e);return r[t]||(r[t]=n.decodingInfo(e))})).then(e=>({supported:!e.some(e=>!e.supported),configurations:a,decodingInfoResults:e})).catch(e=>({supported:!1,configurations:a,decodingInfoResults:[],error:e}))}function Cf(e){let t=e.videoCodec?.split(`,`),n=Ef(e),r=e.width||640,i=e.height||480,a=e.frameRate||30,o=e.videoRange.toLowerCase();return t?t.map(e=>{let t={contentType:nf(mf(e),`video`),width:r,height:i,bitrate:n,framerate:a};return o!==`sdr`&&(t.transferFunction=o),t}):[]}function wf(e,t,n){let r=e.audioCodec?.split(`,`),i=Ef(e);return r&&e.audioGroups?e.audioGroups.reduce((e,a)=>{let o=a?t.groups[a]?.tracks:null;return o?o.reduce((e,t)=>{if(t.groupId===a){let a=parseFloat(t.channels||``);r.forEach(t=>{let r={contentType:nf(t,`audio`),bitrate:n?Tf(t,i):i};a&&(r.channels=``+a),e.push(r)})}return e},e):e},[]):[]}function Tf(e,t){if(t<=1)return 1;let n=128e3;return e===`ec-3`?n=768e3:e===`ac-3`&&(n=64e4),Math.min(t/2,n)}function Ef(e){return Math.ceil(Math.max(e.bitrate*.9,e.averageBitrate)/1e3)*1e3||1}function Df(e){let t=``,{audio:n,video:r}=e;if(r){let e=gf(r.contentType);t+=`${e}_r${r.height}x${r.width}f${Math.ceil(r.framerate)}${r.transferFunction||`sd`}_${Math.ceil(r.bitrate/1e5)}`}if(n){let e=gf(n.contentType);t+=`${r?`_`:``}${e}_c${n.channels}`}return t}var Of=[`NONE`,`TYPE-0`,`TYPE-1`,null];function kf(e){return Of.indexOf(e)>-1}var Af=[`SDR`,`PQ`,`HLG`];function jf(e){return!!e&&Af.indexOf(e)>-1}var Mf={No:``,Yes:`YES`,v2:`v2`};function Nf(e){let{canSkipUntil:t,canSkipDateRanges:n,age:r}=e,i=r<t/2;return t&&i?n?Mf.v2:Mf.Yes:Mf.No}var Pf=class{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}addDirectives(e){let t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set(`_HLS_msn`,this.msn.toString()),this.part!==void 0&&t.searchParams.set(`_HLS_part`,this.part.toString()),this.skip&&t.searchParams.set(`_HLS_skip`,this.skip),t.href}},Ff=class{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat(`FRAME-RATE`,0),this._avgBitrate=e.attrs.decimalInteger(`AVERAGE-BANDWIDTH`),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(e=>!!e).map(e=>e.substring(0,4)).join(`,`),`supplemental`in e){this.supplemental=e.supplemental;let t=e.supplemental?.videoCodec;t&&t!==e.videoCodec&&(this.codecSet+=`,${t.substring(0,4)}`)}this.addGroupId(`audio`,e.attrs.AUDIO),this.addGroupId(`text`,e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||``}get pathwayId(){return this.attrs[`PATHWAY-ID`]||`.`}get videoRange(){return this.attrs[`VIDEO-RANGE`]||`SDR`}get score(){return this.attrs.optionalFloat(`SCORE`,0)}get uri(){return this.url[0]||``}hasAudioGroup(e){return If(this._audioGroups,e)}hasSubtitleGroup(e){return If(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e===`audio`){let e=this._audioGroups;e||=this._audioGroups=[],e.indexOf(t)===-1&&e.push(t)}else if(e===`text`){let e=this._subtitleGroups;e||=this._subtitleGroups=[],e.indexOf(t)===-1&&e.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){return this.audioGroups?.[0]}get textGroupId(){return this.subtitleGroups?.[0]}addFallback(){}};function If(e,t){return!t||!e?!1:e.indexOf(t)!==-1}function Lf(){if(typeof matchMedia==`function`){let e=matchMedia(`(dynamic-range: high)`),t=matchMedia(`bad query`);if(e.media!==t.media)return e.matches===!0}return!1}function Rf(e,t){let n=!1,r=[];if(e&&(n=e!==`SDR`,r=[e]),t){r=t.allowedVideoRanges||Af.slice(0);let e=r.join(``)!==`SDR`&&!t.videoCodec;n=t.preferHDR===void 0?e&&Lf():t.preferHDR,n||(r=[`SDR`])}return{preferHDR:n,allowedVideoRanges:r}}var zf=e=>{let t=new WeakSet;return(n,r)=>{if(e&&(r=e(n,r)),typeof r==`object`&&r){if(t.has(r))return;t.add(r)}return r}},Bf=(e,t)=>JSON.stringify(e,zf(t));function Vf(e,t,n,r,i){let a=Object.keys(e),o=r?.channels,s=r?.audioCodec,c=i?.videoCodec,l=o&&parseInt(o)===2,u=!1,d=!1,f=1/0,p=1/0,m=1/0,h=1/0,g=0,_=[],{preferHDR:v,allowedVideoRanges:y}=Rf(t,i);for(let t=a.length;t--;){let n=e[a[t]];u||=n.channels[2]>0,f=Math.min(f,n.minHeight),p=Math.min(p,n.minFramerate),m=Math.min(m,n.minBitrate),y.filter(e=>n.videoRanges[e]>0).length>0&&(d=!0)}f=W(f)?f:0,p=W(p)?p:0;let b=Math.max(1080,f),x=Math.max(30,p);m=W(m)?m:n,n=Math.max(m,n),d||(t=void 0);let S=a.length>1;return{codecSet:a.reduce((t,r)=>{let i=e[r];if(r===t)return t;if(_=d?y.filter(e=>i.videoRanges[e]>0):[],S){if(i.minBitrate>n)return Hf(r,`min bitrate of ${i.minBitrate} > current estimate of ${n}`),t;if(!i.hasDefaultAudio)return Hf(r,`no renditions with default or auto-select sound found`),t;if(s&&r.indexOf(s.substring(0,4))%5!=0)return Hf(r,`audio codec preference "${s}" not found`),t;if(o&&!l){if(!i.channels[o])return Hf(r,`no renditions with ${o} channel sound found (channels options: ${Object.keys(i.channels)})`),t}else if((!s||l)&&u&&i.channels[2]===0)return Hf(r,`no renditions with stereo sound found`),t;if(i.minHeight>b)return Hf(r,`min resolution of ${i.minHeight} > maximum of ${b}`),t;if(i.minFramerate>x)return Hf(r,`min framerate of ${i.minFramerate} > maximum of ${x}`),t;if(!_.some(e=>i.videoRanges[e]>0))return Hf(r,`no variants with VIDEO-RANGE of ${Bf(_)} found`),t;if(c&&r.indexOf(c.substring(0,4))%5!=0)return Hf(r,`video codec preference "${c}" not found`),t;if(i.maxScore<g)return Hf(r,`max score of ${i.maxScore} < selected max of ${g}`),t}return t&&(af(r)>=af(t)||i.fragmentError>e[t].fragmentError)?t:(h=i.minIndex,g=i.maxScore,r)},void 0),videoRanges:_,preferHDR:v,minFramerate:p,minBitrate:m,minIndex:h}}function Hf(e,t){Qu.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function Uf(e){return e.reduce((e,t)=>{let n=e.groups[t.groupId];n||=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1},n.tracks.push(t);let r=t.channels||`2`;return n.channels[r]=(n.channels[r]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Wf(e,t,n,r){return e.slice(n,r+1).reduce((e,n,r)=>{if(!n.codecSet)return e;let i=n.audioGroups,a=e[n.codecSet];a||(e[n.codecSet]=a={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!i,fragmentError:0}),a.minBitrate=Math.min(a.minBitrate,n.bitrate);let o=Math.min(n.height,n.width);return a.minHeight=Math.min(a.minHeight,o),a.minFramerate=Math.min(a.minFramerate,n.frameRate),a.minIndex=Math.min(a.minIndex,r),a.maxScore=Math.max(a.maxScore,n.score),a.fragmentError+=n.fragmentError,a.videoRanges[n.videoRange]=(a.videoRanges[n.videoRange]||0)+1,i&&i.forEach(e=>{if(!e)return;let n=t.groups[e];n&&(a.hasDefaultAudio=a.hasDefaultAudio||t.hasDefaultAudio?n.hasDefault:n.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(n.channels).forEach(e=>{a.channels[e]=(a.channels[e]||0)+n.channels[e]}))}),e},{})}function Gf(e){if(!e)return e;let{lang:t,assocLang:n,characteristics:r,channels:i,audioCodec:a}=e;return{lang:t,assocLang:n,characteristics:r,channels:i,audioCodec:a}}function Kf(e,t,n){if(`attrs`in e){let n=t.indexOf(e);if(n!==-1)return n}for(let r=0;r<t.length;r++){let i=t[r];if(qf(e,i,n))return r}return-1}function qf(e,t,n){let{groupId:r,name:i,lang:a,assocLang:o,default:s}=e,c=e.forced;return(r===void 0||t.groupId===r)&&(i===void 0||t.name===i)&&(a===void 0||Jf(a,t.lang))&&(a===void 0||t.assocLang===o)&&(s===void 0||t.default===s)&&(c===void 0||t.forced===c)&&(!(`characteristics`in e)||Yf(e.characteristics||``,t.characteristics))&&(n===void 0||n(e,t))}function Jf(e,t=`--`){return e.length===t.length?e===t:e.startsWith(t)||t.startsWith(e)}function Yf(e,t=``){let n=e.split(`,`),r=t.split(`,`);return n.length===r.length&&!n.some(e=>r.indexOf(e)===-1)}function Xf(e,t){let{audioCodec:n,channels:r}=e;return(n===void 0||(t.audioCodec||``).substring(0,4)===n.substring(0,4))&&(r===void 0||r===(t.channels||`2`))}function Zf(e,t,n,r,i){let a=t[r],o=t.reduce((e,t,n)=>{let r=t.uri;return(e[r]||(e[r]=[])).push(n),e},{})[a.uri];o.length>1&&(r=Math.max.apply(Math,o));let s=a.videoRange,c=a.frameRate,l=a.codecSet.substring(0,4),u=Qf(t,r,t=>{if(t.videoRange!==s||t.frameRate!==c||t.codecSet.substring(0,4)!==l)return!1;let r=t.audioGroups;return Kf(e,n.filter(e=>!r||r.indexOf(e.groupId)!==-1),i)>-1});return u>-1?u:Qf(t,r,t=>{let r=t.audioGroups;return Kf(e,n.filter(e=>!r||r.indexOf(e.groupId)!==-1),i)>-1})}function Qf(e,t,n){for(let r=t;r>-1;r--)if(n(e[r]))return r;for(let r=t+1;r<e.length;r++)if(n(e[r]))return r;return-1}function $f(e,t){return!!e&&e!==t.loadLevelObj?.uri}var ep=class extends Wu{constructor(e){super(`abr`,e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey=``,this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=e=>{let{fragCurrent:t,partCurrent:n,hls:r}=this,{autoLevelEnabled:i,media:a}=r;if(!t||!a)return;let o=performance.now(),s=n?n.stats:t.stats,c=n?n.duration:t.duration,l=o-s.loading.start,u=r.minAutoLevel,d=t.level,f=this._nextAutoLevel;if(s.aborted||s.loaded&&s.loaded===s.total||d<=u){this.clearTimer(),this._nextAutoLevel=-1;return}if(!i)return;let p=f>-1&&f!==d,m=!!e||p;if(!m&&(a.paused||!a.playbackRate||!a.readyState))return;let h=r.mainForwardBufferInfo;if(!m&&h===null)return;let g=this.bwEstimator.getEstimateTTFB(),_=Math.abs(a.playbackRate);if(l<=Math.max(g,1e3*(c/(_*2))))return;let v=h?h.len/_:0,y=s.loading.first?s.loading.first-s.loading.start:-1,b=s.loaded&&y>-1,x=this.getBwEstimate(),S=r.levels,C=S[d],w=Math.max(s.loaded,Math.round(c*(t.bitrate||C.averageBitrate)/8)),T=b?l-y:l;T<1&&b&&(T=Math.min(l,s.loaded*8/x));let E=b?s.loaded*1e3/T:0,D=g/1e3,O=E?(w-s.loaded)/E:w*8/x+D;if(O<=v)return;let k=E?E*8:x,A=(e?.details||this.hls.latestLevelDetails)?.live===!0,j=this.hls.config.abrBandWidthUpFactor,M=1/0,N;for(N=d-1;N>u;N--){let e=S[N].maxBitrate,t=!S[N].details||A;if(M=this.getTimeToLoadFrag(D,k,c*e,t),M<Math.min(v,c+D))break}if(M>=O||M>c*10)return;b?this.bwEstimator.sample(l-Math.min(g,y),s.loaded):this.bwEstimator.sampleTTFB(l);let ee=S[N].maxBitrate;this.getBwEstimate()*j>ee&&this.resetEstimator(ee);let P=this.findBestLevel(ee,u,N,0,v,1,1);P>-1&&(N=P),this.warn(`Fragment ${t.sn}${n?` part `+n.index:``} of level ${d} is loading too slowly; 4 Fragment duration: ${t.duration.toFixed(3)} 5 Time to underbuffer: ${v.toFixed(3)} s 6 Estimated load time for current fragment: ${O.toFixed(3)} s 7 Estimated load time for down switch fragment: ${M.toFixed(3)} s 8 TTFB estimate: ${y|0} ms 9 Current BW estimate: ${W(x)?x|0:`Unknown`} bps 10 New BW estimate: ${this.getBwEstimate()|0} bps 11 Switching to level ${N} @ ${ee|0} bps`),r.nextLoadLevel=r.nextAutoLevel=N,this.clearTimer();let F=()=>{if(this.clearTimer(),this.fragCurrent===t&&this.hls.loadLevel===N&&N>0){let e=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${N>0?`and switching down`:``} 12 Fragment duration: ${t.duration.toFixed(3)} s 13 Time to underbuffer: ${e.toFixed(3)} s`),t.abortRequests(),this.fragCurrent=this.partCurrent=null,N>u){let t=this.findBestLevel(this.hls.levels[u].bitrate,u,N,0,e,1,1);t===-1&&(t=u),this.hls.nextLoadLevel=this.hls.nextAutoLevel=t,this.resetEstimator(this.hls.levels[t].bitrate)}}};p||O>M*2?F():this.timer=self.setInterval(F,M*1e3),r.trigger(q.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:n,stats:s})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){let e=this.hls.config;return new Lu(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){let{hls:e}=this;e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.FRAG_LOADING,this.onFragLoading,this),e.on(q.FRAG_LOADED,this.onFragLoaded,this),e.on(q.FRAG_BUFFERED,this.onFragBuffered,this),e.on(q.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(q.LEVEL_LOADED,this.onLevelLoaded,this),e.on(q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(q.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(q.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e&&(e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.FRAG_LOADING,this.onFragLoading,this),e.off(q.FRAG_LOADED,this.onFragLoaded,this),e.off(q.FRAG_BUFFERED,this.onFragBuffered,this),e.off(q.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(q.LEVEL_LOADED,this.onLevelLoaded,this),e.off(q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(q.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(q.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=``}onFragLoading(e,t){let n=t.frag;this.ignoreFragment(n)||(n.bitrateTest||(this.fragCurrent=n,this.partCurrent=t.part??null),this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100))}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case K.BUFFER_ADD_CODEC_ERROR:case K.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case K.FRAG_LOAD_TIMEOUT:{let e=t.frag,{fragCurrent:n,partCurrent:r}=this;if(e&&n&&e.sn===n.sn&&e.level===n.level){let t=performance.now(),n=r?r.stats:e.stats,i=t-n.loading.start,a=n.loading.first?n.loading.first-n.loading.start:-1;if(n.loaded&&a>-1){let e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(i-Math.min(e,a),n.loaded)}else this.bwEstimator.sampleTTFB(i)}break}}}getTimeToLoadFrag(e,t,n,r){return e+n/t+(r?e+this.lastLevelLoadSec:0)}onLevelLoaded(e,t){let n=this.hls.config,{loading:r}=t.stats,i=r.end-r.first;W(i)&&(this.lastLevelLoadSec=i/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:n}){let r=n?n.stats:t.stats;if(t.type===Y.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){let e=n?n.duration:t.duration,i=this.hls.levels[t.level],a=(i.loaded?i.loaded.bytes:0)+r.loaded,o=(i.loaded?i.loaded.duration:0)+e;i.loaded={bytes:a,duration:o},i.realBitrate=Math.round(8*a/o)}if(t.bitrateTest){let e={stats:r,frag:t,part:n,id:t.type};this.onFragBuffered(q.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){let{frag:n,part:r}=t,i=r!=null&&r.stats.loaded?r.stats:n.stats;if(i.aborted||this.ignoreFragment(n))return;let a=i.parsing.end-i.loading.start-Math.min(i.loading.first-i.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,i.loaded),i.bwEstimate=this.getBwEstimate(),n.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Y.MAIN||e.sn===`initSegment`}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){let{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,i=this.findBestLevel(n,t,e,0,r,1,1);if(i>-1)return i;let a=this.hls.firstLevel,o=Math.min(Math.max(a,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){let e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),n=this.lastLoadedFragLevel>-1;if(e!==-1&&(!t||!n||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;let r=t&&n?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){let t=this.hls.levels;if(t.length>Math.max(e,r)&&t[e].loadError<=t[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}
13_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){let{fragCurrent:e,partCurrent:t,hls:n}=this;if(n.levels.length<=1)return n.loadLevel;let{maxAutoLevel:r,config:i,minAutoLevel:a}=n,o=t?t.duration:e?e.duration:0,s=this.getBwEstimate(),c=this.getStarvationDelay(),l=i.abrBandWidthFactor,u=i.abrBandWidthUpFactor;if(c){let e=this.findBestLevel(s,a,r,c,0,l,u);if(e>=0)return this.rebufferNotice=-1,e}let d=o?Math.min(o,i.maxStarvationDelay):i.maxStarvationDelay;if(!c){let e=this.bitrateTestDelay;e&&(d=(o?Math.min(o,i.maxLoadingDelay):i.maxLoadingDelay)-e,this.info(`bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*d)} ms`),l=u=1)}let f=this.findBestLevel(s,a,r,c,d,l,u);if(this.rebufferNotice!==f&&(this.rebufferNotice=f,this.info(`${c?`rebuffering expected`:`buffer is empty`}, optimal quality level ${f}`)),f>-1)return f;let p=n.levels[a],m=n.loadLevelObj;return m&&p?.bitrate<m.bitrate?a:n.loadLevel}getStarvationDelay(){let e=this.hls,t=e.media;if(!t)return 1/0;let n=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,r,i,a,o){var s;let c=r+i,l=this.lastLoadedFragLevel,u=l===-1?this.hls.firstLevel:l,{fragCurrent:d,partCurrent:f}=this,{levels:p,allAudioTracks:m,loadLevel:h,config:g}=this.hls;if(p.length===1)return 0;let _=p[u],v=!!((s=this.hls.latestLevelDetails)!=null&&s.live),y=h===-1||l===-1,b,x=`SDR`,S=_?.frameRate||0,{audioPreference:C,videoPreference:w}=g,T=this.audioTracksByGroup||=Uf(m),E=-1;if(y){if(this.firstSelection!==-1)return this.firstSelection;let r=Vf(this.codecTiers||=Wf(p,T,t,n),x,e,C,w),{codecSet:i,videoRanges:a,minFramerate:o,minBitrate:s,minIndex:c,preferHDR:l}=r;E=c,b=i,x=l?a[a.length-1]:a[0],S=o,e=Math.max(e,s),this.log(`picked start tier ${Bf(r)}`)}else b=_?.codecSet,x=_?.videoRange;let D=f?f.duration:d?d.duration:0,O=this.bwEstimator.getEstimateTTFB()/1e3,k=[];for(let s=n;s>=t;s--){var A;let t=p[s],d=s>u;if(!t)continue;if(g.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){let n=navigator.mediaCapabilities;typeof n?.decodingInfo==`function`&&xf(t,T,x,S,e,C)?(t.supportedPromise=Sf(t,T,n,this.supportedCache),t.supportedPromise.then(e=>{if(!this.hls)return;t.supportedResult=e;let n=this.hls.levels,r=n.indexOf(t);e.error?this.warn(`MediaCapabilities decodingInfo error: "${e.error}" for level ${r} ${Bf(e)}`):e.supported?e.decodingInfoResults.some(e=>e.smooth===!1||e.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${r} not smooth or powerEfficient: ${Bf(e)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${r} ${Bf(e)}`),r>-1&&n.length>1&&(this.log(`Removing unsupported level ${r}`),this.hls.removeLevel(r),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(e=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${e}`)})):t.supportedResult=yf}if((b&&t.codecSet!==b||x&&t.videoRange!==x||d&&S>t.frameRate||!d&&S>
vendor: 2,430 bytes, line 13
130&&S<t.frameRate||(A=t.supportedResult)!=null&&(A=A.decodingInfoResults)!=null&&A.some(e=>e.smooth===!1))&&(!y||s!==E)){k.push(s);continue}let m=t.details,_=(f?m?.partTarget:m?.averagetargetduration)||D,w;w=d?o*e:a*e;let j=D&&r>=D*2&&i===0?t.averageBitrate:t.maxBitrate,M=this.getTimeToLoadFrag(O,w,j*_,m===void 0);if(w>=j&&(s===l||t.loadError===0&&t.fragmentError===0)&&(M<=O||!W(M)||v&&!this.bitrateTestDelay||M<c)){let e=this.forcedAutoLevel;return s!==h&&(e===-1||e!==h)&&(k.length&&this.trace(`Skipped level(s) ${k.join(`,`)} of ${n} max with CODECS and VIDEO-RANGE:"${p[k[0]].codecs}" ${p[k[0]].videoRange}; not compatible with "${b}" ${x}`),this.info(`switch candidate:${u}->${s} adjustedbw(${Math.round(w)})-bitrate=${Math.round(w-j)} ttfb:${O.toFixed(1)} avgDuration:${_.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${M.toFixed(1)} firstSelection:${y} codecSet:${t.codecSet} videoRange:${t.videoRange} hls.loadLevel:${h}`)),y&&(this.firstSelection=s),s}}return-1}set nextAutoLevel(e){let t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey=``,this._nextAutoLevel=t)}deriveNextAutoLevel(e){let{maxAutoLevel:t,minAutoLevel:n}=this.hls;return Math.min(Math.max(e,n),t)}},tp={search:function(e,t){let n=0,r=e.length-1,i=null,a=null;for(;n<=r;){i=(n+r)/2|0,a=e[i];let o=t(a);if(o>0)n=i+1;else if(o<0)r=i-1;else return a}return null}};function np(e,t,n){if(t===null||!Array.isArray(e)||!e.length||!W(t)||t<(e[0].programDateTime||0)||t>=(e[e.length-1].endProgramDateTime||0))return null;for(let r=0;r<e.length;++r){let i=e[r];if(op(t,n,i))return i}return null}function rp(e,t,n=0,r=0,i=.005){let a=null;if(e){a=t[1+e.sn-t[0].sn]||null;let r=e.endDTS-n;r>0&&r<15e-7&&(n+=15e-7),a&&e.level!==a.level&&a.end<=e.end&&(a=t[2+e.sn-t[0].sn]||null)}else n===0&&t[0].start===0&&(a=t[0]);if(a&&((!e||e.level===a.level)&&ap(n,r,a)===0||ip(a,e,Math.min(i,r))))return a;let o=tp.search(t,ap.bind(null,n,r));return o&&(o!==e||!a)?o:a}function ip(e,t,n){if(t&&t.start===0&&t.level<e.level&&(t.endPTS||0)>0){let r=t.tagList.reduce((e,t)=>(t[0]===`INF`&&(e+=parseFloat(t[1])),e),n);return e.start<=r}return!1}function ap(e=0,t=0,n){if(n.start<=e&&n.start+n.duration>e)return 0;let r=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-r<=e?1:n.start-r>e&&n.start?-1:0}function op(e,t,n){let r=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0))*1e3;return(n.endProgramDateTime||0)-r>e}
vendor: 4,945 bytes, line 13
13function sp(e,t,n){if(e&&e.startCC<=t&&e.endCC>=t){let r=e.fragments,{fragmentHint:i}=e;i&&(r=r.concat(i));let a;return tp.search(r,e=>e.cc<t?1:e.cc>t?-1:(a=e,e.end<=n?1:e.start>n?-1:0)),a||null}return null}function cp(e){switch(e.details){case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_TIMEOUT:case K.LEVEL_LOAD_TIMEOUT:case K.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function lp(e){return e.details.startsWith(`key`)}function up(e){return lp(e)&&!!e.frag&&!e.frag.decryptdata}function dp(e,t){let n=cp(t);return e.default[`${n?`timeout`:`error`}Retry`]}function fp(e,t){let n=e.backoff===`linear`?1:2**t;return Math.min(n*e.retryDelayMs,e.maxRetryDelayMs)}function pp(e){return Vu(Vu({},e),{errorRetry:null,timeoutRetry:null})}function mp(e,t,n,r){if(!e)return!1;let i=r?.code,a=t<e.maxNumRetry&&(hp(i)||!!n);return e.shouldRetry?e.shouldRetry(e,t,n,r,a):a}function hp(e){return gp(e)||!!e&&(e<400||e>499)}function gp(e){return e===0&&navigator.onLine===!1}var _p={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},vp={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8},yp=class extends Wu{constructor(e){super(`error-controller`,e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){let e=this.hls;e.on(q.ERROR,this.onError,this),e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){let e=this.hls;e&&(e.off(q.ERROR,this.onError,this),e.off(q.ERROR,this.onErrorOut,this),e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===Y.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;let t=this.hls,n=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||n===-1?t.loadLevel:n}variantHasKey(e,t){if(e){var n;if((n=e.details)!=null&&n.hasKey(t))return!0;let r=e.audioGroups;if(r)return this.hls.allAudioTracks.filter(e=>r.indexOf(e.groupId)>=0).some(e=>e.details?.hasKey(t))}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var n;if(t.fatal)return;let r=this.hls,i=t.context;switch(t.details){case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case K.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap){t.errorAction=bp();return}case K.FRAG_GAP:case K.FRAG_DECRYPT_ERROR:t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=_p.SendAlternateToPenaltyBox;return;case K.LEVEL_EMPTY_ERROR:case K.LEVEL_PARSING_ERROR:{var a;let e=t.parent===Y.MAIN?t.level:r.loadLevel;t.details===K.LEVEL_EMPTY_ERROR&&(a=t.context)!=null&&(a=a.levelDetails)!=null&&a.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case K.LEVEL_LOAD_ERROR:case K.LEVEL_LOAD_TIMEOUT:typeof i?.level==`number`&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.level));return;case K.AUDIO_TRACK_LOAD_ERROR:case K.AUDIO_TRACK_LOAD_TIMEOUT:case K.SUBTITLE_LOAD_ERROR:case K.SUBTITLE_TRACK_LOAD_TIMEOUT:if(i){let e=r.loadLevelObj;if(e&&(i.type===J.AUDIO_TRACK&&e.hasAudioGroup(i.groupId)||i.type===J.SUBTITLE_TRACK&&e.hasSubtitleGroup(i.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=_p.SendAlternateToPenaltyBox,t.errorAction.flags=vp.MoveAllAlternatesMatchingHost;return}}return;case K.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:_p.SendAlternateToPenaltyBox,flags:vp.MoveAllAlternatesMatchingHDCP};return;case K.KEY_SYSTEM_SESSION_UPDATE_FAILED:case K.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case K.KEY_SYSTEM_NO_SESSION:t.errorAction={action:_p.SendAlternateToPenaltyBox,flags:vp.MoveAllAlternatesMatchingKey};return;case K.BUFFER_ADD_CODEC_ERROR:case K.REMUX_ALLOC_ERROR:case K.BUFFER_APPEND_ERROR:t.errorAction||=this.getLevelSwitchAction(t,t.level??r.loadLevel);return;case K.INTERNAL_EXCEPTION:case K.BUFFER_APPENDING_ERROR:case K.BUFFER_FULL_ERROR:case K.LEVEL_SWITCH_ERROR:case K.BUFFER_STALLED_ERROR:case K.BUFFER_SEEK_OVER_HOLE:case K.BUFFER_NUDGE_ON_STALL:t.errorAction=bp();return}t.type===G.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=bp())}getPlaylistRetryOrSwitchAction(e,t){let n=this.hls,r=dp(n.config.playlistLoadPolicy,e),i=this.playlistError++;if(mp(r,i,cp(e),e.response))return{action:_p.RetryRequest,flags:vp.None,retryConfig:r,retryCount:i};let a=this.getLevelSwitchAction(e,t);return r&&(a.retryConfig=r,a.retryCount=i),a}getFragRetryOrSwitchAction(e){let t=this.hls,n=this.getVariantLevelIndex(e.frag),r=t.levels[n],{fragLoadPolicy:i,keyLoadPolicy:a}=t.config,o=dp(lp(e)?a:i,e),s=t.levels.reduce((e,t)=>
13e+t.fragmentError,0);if(r&&(e.details!==K.FRAG_GAP&&r.fragmentError++,!up(e)&&mp(o,s,cp(e),e.response)))return{action:_p.RetryRequest,flags:vp.None,retryConfig:o,retryCount:s};let c=this.getLevelSwitchAction(e,n);return o&&(c.retryConfig=o,c.retryCount=s),c}getLevelSwitchAction(e,t){let n=this.hls;t??=n.loadLevel;let r=this.hls.levels[t];if(r){let t=e.details;r.loadError++,t===K.BUFFER_APPEND_ERROR&&r.fragmentError++;let o=-1,{levels:s,loadLevel:c,minAutoLevel:l,maxAutoLevel:u}=n;!n.autoLevelEnabled&&!n.config.preserveManualLevelOnError&&(n.loadLevel=-1);let d=e.frag?.type,f=(d===Y.AUDIO&&t===K.FRAG_PARSING_ERROR||e.sourceBufferName===`audio`&&(t===K.BUFFER_ADD_CODEC_ERROR||t===K.BUFFER_APPEND_ERROR))&&s.some(({audioCodec:e})=>r.audioCodec!==e),p=e.sourceBufferName===`video`&&(t===K.BUFFER_ADD_CODEC_ERROR||t===K.BUFFER_APPEND_ERROR)&&s.some(({codecSet:e,audioCodec:t})=>r.codecSet!==e&&r.audioCodec===t),{type:m,groupId:h}=e.context??{};for(let n=s.length;n--;){let g=(n+c)%s.length;if(g!==c&&g>=l&&g<=u&&s[g].loadError===0){var i,a;let n=s[g];if(t===K.FRAG_GAP&&d===Y.MAIN&&e.frag){let t=s[g].details;if(t){let n=rp(e.frag,t.fragments,e.frag.start);if(n!=null&&n.gap)continue}}else if(m===J.AUDIO_TRACK&&n.hasAudioGroup(h)||m===J.SUBTITLE_TRACK&&n.hasSubtitleGroup(h))continue;else if(d===Y.AUDIO&&(i=r.audioGroups)!=null&&i.some(e=>n.hasAudioGroup(e))||d===Y.SUBTITLE&&(a=r.subtitleGroups)!=null&&a.some(e=>n.hasSubtitleGroup(e))||f&&r.audioCodec===n.audioCodec||p&&r.codecSet===n.codecSet||!f&&r.codecSet!==n.codecSet)continue;o=g;break}}if(o>-1&&n.loadLevel!==o)return e.levelRetry=!0,this.playlistError=0,{action:_p.SendAlternateToPenaltyBox,flags:vp.None,nextAutoLevel:o}}return{action:_p.SendAlternateToPenaltyBox,flags:vp.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){switch(t.errorAction?.action){case _p.DoNothing:break;case _p.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==K.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break;case _p.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){let t=this.hls,n=e.errorAction;if(!n)return;let{flags:r}=n,i=n.nextAutoLevel;switch(r){case vp.None:this.switchLevel(e,i);break;case vp.MoveAllAlternatesMatchingHDCP:{let r=this.getVariantLevelIndex(e.frag),i=t.levels[r]?.attrs[`HDCP-LEVEL`];if(n.hdcpLevel=i,i===`NONE`)this.warn(`HDCP policy resticted output with HDCP-LEVEL=NONE`);else if(i){t.maxHdcpLevel=Of[Of.indexOf(i)-1],n.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case vp.MoveAllAlternatesMatchingKey:{let t=e.decryptdata;if(t){let r=this.hls.levels,i=r.length;for(let n=i;n--;)this.variantHasKey(r[n],t)&&(this.log(`Banned key found in level ${n} (${r[n].bitrate}bps) or audio group "${r[n].audioGroups?.join(`,`)}" (${e.frag?.type} fragment) ${rd(t.keyId||[])}`),r[n].fragmentError++,r[n].loadError++,this.log(`Removing level ${n} with key error (${e.error})`),this.hls.removeLevel(n));let a=e.frag;if(this.hls.levels.length<i)n.resolved=!0;else if(a&&a.type!==Y.MAIN){let e=a.decryptdata;e&&!t.matches(e)&&(n.resolved=!0)}}break}}n.resolved||this.switchLevel(e,i)}switchLevel(e,t){if(t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===K.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!==`audiovideo`)){let t=gf(e.mimeType),n=this.hls.levels;for(let r=n.length;r--;)n[r][`${e.sourceBufferName}Codec`]===t&&(this.log(`Removing level ${r} for ${e.details} ("${t}" not supported)`),this.hls.removeLevel(r))}}};function bp(e){let t={action:_p.DoNothing,flags:vp.None};return e&&(t.resolved=!0),t}var xp={NOT_LOADED:`NOT_LOADED`,APPENDING:`APPENDING`,PARTIAL:`PARTIAL`,OK:`OK`},Sp=class{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){let{hls:e}=this;e&&(e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.BUFFER_APPENDED,this.onBufferAppended,this),e.on(q.FRAG_BUFFERED,this.onFragBuffered,this),e.on(q.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){let{hls:e}=this;e&&(e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.BUFFER_APPENDED,this.onBufferAppended,this),e.off(q.FRAG_BUFFERED,this.onFragBuffered,this),e.off(q.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){let n=this.activePartLists[t];if(n)for(let t=n.length;t--;){let r=n[t];if(!r)break;
vendor: 4,264 bytes, line 13
13if(r.start<=e&&e<=r.end&&r.loaded)return r}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,n){let{fragments:r}=this,i=Object.keys(r);for(let a=i.length;a--;){let o=r[i[a]];if(o?.body.type===t&&(!n||o.buffered)){let t=o.body;if(t.start<=e&&e<=t.end)return t}}return null}detectEvictedFragments(e,t,n,r,i){this.timeRanges&&(this.timeRanges[e]=t);let a=r?.fragment.sn||-1;Object.keys(this.fragments).forEach(r=>{let o=this.fragments[r];if(!o||a>=o.body.sn)return;if(!o.buffered&&(!o.loaded||i)){o.body.type===n&&this.removeFragment(o.body);return}let s=o.range[e];if(s){if(s.time.length===0){this.removeFragment(o.body);return}s.time.some(e=>{let n=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return n&&this.removeFragment(o.body),n})}})}detectPartialFragments(e){let t=this.timeRanges;if(!t||e.frag.sn===`initSegment`)return;let n=e.frag,r=wp(n),i=this.fragments[r];if(!i||i.buffered&&n.gap)return;let a=!n.relurl;Object.keys(t).forEach(r=>{let o=n.elementaryStreams[r];if(!o)return;let s=t[r],c=a||o.partial===!0;i.range[r]=this.getBufferedTimes(n,e.part,c,s)}),i.loaded=null,Object.keys(i.range).length?(this.bufferedEnd(i,n),Cp(i)||this.removeParts(n.sn-1,n.type)):this.removeFragment(i.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){let n=this.activePartLists[t];n&&(this.activePartLists[t]=Tp(n,t=>t.fragment.sn>=e))}fragBuffered(e,t){let n=wp(e),r=this.fragments[n];!r&&t&&(r=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,this.bufferedEnd(r,e))}getBufferedTimes(e,t,n,r){let i={time:[],partial:n},a=e.start,o=e.end,s=e.minEndPTS||o,c=e.maxStartPTS||a;for(let e=0;e<r.length;e++){let t=r.start(e)-this.bufferPadding,n=r.end(e)+this.bufferPadding;if(c>=t&&s<=n){i.time.push({startPTS:Math.max(a,r.start(e)),endPTS:Math.min(o,r.end(e))});break}else if(a<n&&o>t){let t=Math.max(a,r.start(e)),n=Math.min(o,r.end(e));n>t&&(i.partial=!0,i.time.push({startPTS:t,endPTS:n}))}else if(o<=t)break}return i}getPartialFragment(e){let t=null,n,r,i,a=0,{bufferPadding:o,fragments:s}=this;return Object.keys(s).forEach(c=>{let l=s[c];l&&Cp(l)&&(r=l.body.start-o,i=l.body.end+o,e>=r&&e<=i&&(n=Math.min(e-r,i-e),a<=n&&(t=l.body,a=n)))}),t}isEndListAppended(e){let t=this.endListFragments[e];return t!==void 0&&(t.buffered||Cp(t))}getState(e){let t=wp(e),n=this.fragments[t];return n?n.buffered?Cp(n)?xp.PARTIAL:xp.OK:xp.APPENDING:xp.NOT_LOADED}isTimeBuffered(e,t,n){let r,i;for(let a=0;a<n.length;a++){if(r=n.start(a)-this.bufferPadding,i=n.end(a)+this.bufferPadding,e>=r&&t<=i)return!0;if(t<=r)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn===`initSegment`||t.frag.bitrateTest)return;let n=t.frag,r=t.part?null:t,i=wp(n);this.fragments[i]={body:n,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){let{frag:n,part:r,timeRanges:i,type:a}=t;if(n.sn===`initSegment`)return;let o=n.type;if(r){let e=this.activePartLists[o];e||(this.activePartLists[o]=e=[]),e.push(r)}this.timeRanges=i;let s=i[a];this.detectEvictedFragments(a,s,o,r)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){let t=wp(e);return!!this.fragments[t]}hasFragments(e){let{fragments:t}=this,n=Object.keys(t);if(!e)return n.length>0;for(let r=n.length;r--;)if(t[n[r]]?.body.type===e)return!0;return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,n,r,i){r&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{let o=this.fragments[a];if(!o)return;let s=o.body;s.type!==n||r&&!s.gap||s.start<t&&s.end>e&&(o.buffered||i)&&this.removeFragment(s)})}removeFragment(e){let t=wp(e);e.clearElementaryStreamInfo();let n=this.activePartLists[e.type];if(n){let t=e.sn;this.activePartLists[e.type]=Tp(n,e=>e.fragment.sn!==t)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;let t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;
vendor: 8,621 bytes, line 13
13t&&t.forEach(e=>e.clearElementaryStreamInfo())}};function Cp(e){var t,n,r;return e.buffered&&!!(e.body.gap||(t=e.range.video)!=null&&t.partial||(n=e.range.audio)!=null&&n.partial||(r=e.range.audiovideo)!=null&&r.partial)}function wp(e){return`${e.type}_${e.level}_${e.sn}`}function Tp(e,t){return e.filter(e=>{let n=t(e);return n||e.clearElementaryStreamInfo(),n})}var Ep={cbc:0,ctr:1},Dp=class{constructor(e,t,n){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=n}decrypt(e,t){switch(this.aesMode){case Ep.cbc:return this.subtle.decrypt({name:`AES-CBC`,iv:this.aesIV},t,e);case Ep.ctr:return this.subtle.decrypt({name:`AES-CTR`,counter:this.aesIV,length:64},t,e);default:throw Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}};function Op(e){let t=e.byteLength,n=t&&new DataView(e.buffer).getUint8(t-1);return n?e.slice(0,t-n):e}var kp=class{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array,this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){let t=new DataView(e),n=new Uint32Array(4);for(let e=0;e<4;e++)n[e]=t.getUint32(e*4);return n}initTable(){let e=this.sBox,t=this.invSBox,n=this.subMix,r=n[0],i=n[1],a=n[2],o=n[3],s=this.invSubMix,c=s[0],l=s[1],u=s[2],d=s[3],f=new Uint32Array(256),p=0,m=0,h=0;for(h=0;h<256;h++)h<128?f[h]=h<<1:f[h]=h<<1^283;for(h=0;h<256;h++){let n=m^m<<1^m<<2^m<<3^m<<4;n=n>>>8^n&255^99,e[p]=n,t[n]=p;let s=f[p],h=f[s],g=f[h],_=f[n]*257^n*16843008;r[p]=_<<24|_>>>8,i[p]=_<<16|_>>>16,a[p]=_<<8|_>>>24,o[p]=_,_=g*16843009^h*65537^s*257^p*16843008,c[n]=_<<24|_>>>8,l[n]=_<<16|_>>>16,u[n]=_<<8|_>>>24,d[n]=_,p?(p=s^f[f[f[g^s]]],m^=f[f[m]]):p=m=1}}expandKey(e){let t=this.uint8ArrayToUint32Array_(e),n=!0,r=0;for(;r<t.length&&n;)n=t[r]===this.key[r],r++;if(n)return;this.key=t;let i=this.keySize=t.length;if(i!==4&&i!==6&&i!==8)throw Error(`Invalid aes key size=`+i);let a=this.ksRows=(i+6+1)*4,o,s,c=this.keySchedule=new Uint32Array(a),l=this.invKeySchedule=new Uint32Array(a),u=this.sBox,d=this.rcon,f=this.invSubMix,p=f[0],m=f[1],h=f[2],g=f[3],_,v;for(o=0;o<a;o++){if(o<i){_=c[o]=t[o];continue}v=_,o%i===0?(v=v<<8|v>>>24,v=u[v>>>24]<<24|u[v>>>16&255]<<16|u[v>>>8&255]<<8|u[v&255],v^=d[o/i|0]<<24):i>6&&o%i===4&&(v=u[v>>>24]<<24|u[v>>>16&255]<<16|u[v>>>8&255]<<8|u[v&255]),c[o]=_=(c[o-i]^v)>>>0}for(s=0;s<a;s++)o=a-s,v=s&3?c[o]:c[o-4],s<4||o<=4?l[s]=v:l[s]=p[u[v>>>24]]^m[u[v>>>16&255]]^h[u[v>>>8&255]]^g[u[v&255]],l[s]=l[s]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,n){let r=this.keySize+6,i=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,s=o[0],c=o[1],l=o[2],u=o[3],d=this.uint8ArrayToUint32Array_(n),f=d[0],p=d[1],m=d[2],h=d[3],g=new Int32Array(e),_=new Int32Array(g.length),v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=this.networkToHostOrderSwap;for(;t<g.length;){for(E=M(g[t]),D=M(g[t+1]),O=M(g[t+2]),k=M(g[t+3]),S=E^i[0],C=k^i[1],w=O^i[2],T=D^i[3],A=4,j=1;j<r;j++)v=s[S>>>24]^c[C>>16&255]^l[w>>8&255]^u[T&255]^i[A],y=s[C>>>24]^c[w>>16&255]^l[T>>8&255]^u[S&255]^i[A+1],b=s[w>>>24]^c[T>>16&255]^l[S>>8&255]^u[C&255]^i[A+2],x=s[T>>>24]^c[S>>16&255]^l[C>>8&255]^u[w&255]^i[A+3],S=v,C=y,w=b,T=x,A+=4;v=a[S>>>24]<<24^a[C>>16&255]<<16^a[w>>8&255]<<8^a[T&255]^i[A],y=a[C>>>24]<<24^a[w>>16&255]<<16^a[T>>8&255]<<8^a[S&255]^i[A+1],b=a[w>>>24]<<24^a[T>>16&255]<<16^a[S>>8&255]<<8^a[C&255]^i[A+2],x=a[T>>>24]<<24^a[S>>16&255]<<16^a[C>>8&255]<<8^a[w&255]^i[A+3],_[t]=M(v^f),_[t+1]=M(x^p),_[t+2]=M(b^m),_[t+3]=M(y^h),f=E,p=D,m=O,h=k,t+=4}return _.buffer}},Ap=class{constructor(e,t,n){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=n}expandKey(){let e=jp(this.aesMode);return this.subtle.importKey(`raw`,this.key,{name:e},!1,[`encrypt`,`decrypt`])}};function jp(e){switch(e){case Ep.cbc:return`AES-CBC`;case Ep.ctr:return`AES-CTR`;default:throw Error(`[FastAESKey] invalid aes mode ${e}`)}}var Mp=16,Np=class{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{let e=self.crypto;e&&(this.subtle=e.subtle||e.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){let{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;let n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Op(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&=null}decrypt(e,t,n,r){return this.useSoftware?new Promise((i,a)=>{let o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,n,r);let s=this.flush();s?i(s.buffer):a(Error(`[softwareDecrypt] Failed to decrypt data`))}):this.webCryptoDecrypt(new Uint8Array(e),t,n,r)}softwareDecrypt(e,t,n,r){let{currentIV:i,currentResult:a,remainderData:o}=this;if(r!==Ep.cbc||t.byteLength!==16)return Qu.warn(`SoftwareDecrypt: can only handle AES-128-CBC`),null;this.logOnce(`JS AES decrypt`),o&&(e=Bd(o,e),this.remainderData=null);let s=this.getValidChunk(e);if(!s.length)return null;i&&(n=i);let c=this.softwareDecrypter;c||=this.softwareDecrypter=new kp,c.expandKey(t);let l=a;return this.currentResult=c.decrypt(s.buffer,0,n),this.currentIV=s.slice(-16).buffer,l||null}webCryptoDecrypt(e,t,n,r){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n,r));this.key=t,this.fastAesKey=new Ap(this.subtle,t,r)}return this.fastAesKey.expandKey().then(t=>this.subtle?(this.logOnce(`WebCrypto AES decrypt`),new Dp(this.subtle,new Uint8Array(n),r).decrypt(e.buffer,t)):Promise.reject(Error(`web crypto not initialized`))).catch(i=>(Qu.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,t,n,r)))}onWebCryptoError(e,t,n,r){let i=this.enableSoftwareAES;if(i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n,r);let i=this.flush();if(i)return i.buffer}throw Error(`WebCrypto`+(i?` and softwareDecrypt`:``)+`: failed to decrypt data`)}getValidChunk(e){let t=e,n=e.length-e.length%Mp;return n!==e.length&&(t=e.slice(0,n),this.remainderData=e.slice(n)),t}logOnce(e){this.logEnabled&&=(Qu.log(`[decrypter]: ${e}`),!1)}},Pp=2**17,Fp=class{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&=(this.loader.destroy(),null)}abort(){this.loader&&this.loader.abort()}load(e,t){let n=e.url;if(!n)return Promise.reject(new zp({type:G.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:Error(`Fragment does not have a ${n?`part list`:`url`}`),networkDetails:null}));this.abort();let r=this.config,i=r.fLoader,a=r.loader;return new Promise((o,s)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(e=>e[0]===`GAP`)){s(Lp(e));return}else e.gap=!1;let c=this.loader=i?new i(r):new a(r),l=Ip(e);e.loader=c;let u=pp(r.fragLoadPolicy.default),d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn===`initSegment`?1/0:Pp};e.stats=c.stats;let f={onSuccess:(t,n,r,i)=>{this.resetLoader(e,c);let a=t.data;r.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(a.slice(0,16)),a=a.slice(16)),o({frag:e,part:null,payload:a,networkDetails:i})},onError:(t,r,i,a)=>{this.resetLoader(e,c),s(new zp({type:G.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Vu({url:n,data:void 0},t),error:Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:i,stats:a}))},onAbort:(t,n,r)=>{this.resetLoader(e,c),s(new zp({type:G.NETWORK_ERROR,details:K.INTERNAL_ABORTED,fatal:!1,frag:e,error:Error(`Aborted`),networkDetails:r,stats:t}))},onTimeout:(t,n,r)=>{this.resetLoader(e,c),s(new zp({type:G.NETWORK_ERROR,details:K.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:Error(`Timeout after ${d.timeout}ms`),networkDetails:r,stats:t}))}};t&&(f.onProgress=(n,r,i,a)=>t({frag:e,part:null,payload:i,networkDetails:a})),c.load(l,d,f)})}loadPart(e,t,n){this.abort();
vendor: 4,255 bytes, line 13
13let r=this.config,i=r.fLoader,a=r.loader;return new Promise((o,s)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){s(Lp(e,t));return}let c=this.loader=i?new i(r):new a(r),l=Ip(e,t);e.loader=c;let u=pp(r.fragLoadPolicy.default),d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Pp};t.stats=c.stats,c.load(l,d,{onSuccess:(r,i,a,s)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);let l={frag:e,part:t,payload:r.data,networkDetails:s};n(l),o(l)},onError:(n,r,i,a)=>{this.resetLoader(e,c),s(new zp({type:G.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Vu({url:l.url,data:void 0},n),error:Error(`HTTP Error ${n.code} ${n.text}`),networkDetails:i,stats:a}))},onAbort:(n,r,i)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),s(new zp({type:G.NETWORK_ERROR,details:K.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:Error(`Aborted`),networkDetails:i,stats:n}))},onTimeout:(n,r,i)=>{this.resetLoader(e,c),s(new zp({type:G.NETWORK_ERROR,details:K.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:Error(`Timeout after ${d.timeout}ms`),networkDetails:i,stats:n}))}})})}updateStatsFromPart(e,t){let n=e.stats,r=t.stats,i=r.total;if(n.loaded+=r.loaded,i){let r=Math.round(e.duration/t.duration),a=Math.min(Math.round(n.loaded/i),r),o=(r-a)*Math.round(n.loaded/a);n.total=n.loaded+o}else n.total=Math.max(n.loaded,n.total);let a=n.loading,o=r.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}};function Ip(e,t=null){let n=t||e,r={frag:e,part:t,responseType:`arraybuffer`,url:n.url,headers:{},rangeStart:0,rangeEnd:0},i=n.byteRangeStartOffset,a=n.byteRangeEndOffset;if(W(i)&&W(a)){let t=i,n=a;if(e.sn===`initSegment`&&Rp(e.decryptdata?.method)){let e=a-i;e%16&&(n=a+(16-e%16)),i!==0&&(r.resetIV=!0,t=i-16)}r.rangeStart=t,r.rangeEnd=n}return r}function Lp(e,t){let n=Error(`GAP ${e.gap?`tag`:`attribute`} found`),r={type:G.MEDIA_ERROR,details:K.FRAG_GAP,fatal:!1,frag:e,error:n,networkDetails:null};return t&&(r.part=t),(t||e).stats.aborted=!0,new zp(r)}function Rp(e){return e===`AES-128`||e===`AES-256`}var zp=class extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}},Bp=class extends Wu{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}},Vp=class{constructor(e,t,n,r=0,i=-1,a=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Hp(),this.buffering={audio:Hp(),video:Hp(),audiovideo:Hp()},this.level=e,this.sn=t,this.id=n,this.size=r,this.part=i,this.partial=a}};function Hp(){return{start:0,executeStart:0,executeEnd:0,end:0}}var Up={length:0,start:()=>0,end:()=>0},Q=class e{static isBuffered(t,n){if(t){let r=e.getBuffered(t);for(let e=r.length;e--;)if(n>=r.start(e)&&n<=r.end(e))return!0}return!1}static bufferedRanges(t){if(t){let n=e.getBuffered(t);return e.timeRangesToArray(n)}return[]}static timeRangesToArray(e){let t=[];for(let n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}static bufferInfo(t,n,r){if(t){let i=e.bufferedRanges(t);if(i.length)return e.bufferedInfo(i,n,r)}return{len:0,start:n,end:n,bufferedIndex:-1}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.length>1&&e.sort((e,t)=>
vendor: 6,749 bytes, line 13
13e.start-t.start||t.end-e.end);let r=-1,i=[];if(n)for(let a=0;a<e.length;a++){t>=e[a].start&&t<=e[a].end&&(r=a);let o=i.length;if(o){let t=i[o-1].end;e[a].start-t<n?e[a].end>t&&(i[o-1].end=e[a].end):i.push(e[a])}else i.push(e[a])}else i=e;let a=0,o,s=t,c=t;for(let e=0;e<i.length;e++){let l=i[e].start,u=i[e].end;if(r===-1&&t>=l&&t<=u&&(r=e),t+n>=l&&t<u)s=l,c=u,a=c-t;else if(t+n<l){o=l;break}}return{len:a,start:s||0,end:c||0,nextStart:o,buffered:e,bufferedIndex:r}}static getBuffered(e){try{return e.buffered||Up}catch(e){return Qu.log(`failed to get media.buffered`,e),Up}}},Wp=/\{\$([a-zA-Z0-9-_]+)\}/g;function Gp(e){return Wp.test(e)}function Kp(e,t){if(e.variableList!==null||e.hasVariableRefs){let n=e.variableList;return t.replace(Wp,t=>{let r=t.substring(2,t.length-1),i=n?.[r];return i===void 0?(e.playlistParsingError||=Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`),t):i})}return t}function qp(e,t,n){let r=e.variableList;r||(e.variableList=r={});let i,a;if(`QUERYPARAM`in t){i=t.QUERYPARAM;try{let e=new self.URL(n).searchParams;if(e.has(i))a=e.get(i);else throw Error(`"${i}" does not match any query parameter in URI: "${n}"`)}catch(t){e.playlistParsingError||=Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`)}}else i=t.NAME,a=t.VALUE;i in r?e.playlistParsingError||=Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`):r[i]=a||``}function Jp(e,t,n){let r=t.IMPORT;if(n&&r in n){let t=e.variableList;t||(e.variableList=t={}),t[r]=n[r]}else e.playlistParsingError||=Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${r}"`)}var Yp=/^(\d+)x(\d+)$/,Xp=/(.+?)=(".*?"|.*?)(?:,|$)/g,Zp=class e{constructor(t,n){typeof t==`string`&&(t=e.parseAttrList(t,n)),zu(this,t)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)===`X-`)}decimalInteger(e){let t=parseInt(this[e],10);return t>2**53-1?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||`0x`).slice(2);t=(t.length&1?`0`:``)+t;let n=new Uint8Array(t.length/2);for(let e=0;e<t.length/2;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return n}return null}hexadecimalIntegerAsNumber(e){let t=parseInt(this[e],16);return t>2**53-1?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){let n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){let n=this[e];return(n?n.split(/[ ,]+/):[]).reduce((e,t)=>(e[t.toLowerCase()]=!0,e),t)}bool(e){return this[e]===`YES`}decimalResolution(e){let t=Yp.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let n,r={};for(Xp.lastIndex=0;(n=Xp.exec(e))!==null;){let i=n[1].trim(),a=n[2],o=a.indexOf(`"`)===0&&a.lastIndexOf(`"`)===a.length-1,s=!1;if(o)a=a.slice(1,-1);else switch(i){case`IV`:case`SCTE35-CMD`:case`SCTE35-IN`:case`SCTE35-OUT`:s=!0}if(t&&(o||s))a=Kp(t,a);else if(!s&&!o)switch(i){case`CLOSED-CAPTIONS`:if(a===`NONE`)break;case`ALLOWED-CPC`:case`CLASS`:case`ASSOC-LANGUAGE`:case`AUDIO`:case`BYTERANGE`:case`CHANNELS`:case`CHARACTERISTICS`:case`CODECS`:case`DATA-ID`:case`END-DATE`:case`GROUP-ID`:case`ID`:case`IMPORT`:case`INSTREAM-ID`:case`KEYFORMAT`:case`KEYFORMATVERSIONS`:case`LANGUAGE`:case`NAME`:case`PATHWAY-ID`:case`QUERYPARAM`:case`RECENTLY-REMOVED-DATERANGES`:case`SERVER-URI`:case`STABLE-RENDITION-ID`:case`STABLE-VARIANT-ID`:case`START-DATE`:case`SUBTITLES`:case`SUPPLEMENTAL-CODECS`:case`URI`:case`VALUE`:case`VIDEO`:case`X-ASSET-LIST`:case`X-ASSET-URI`:Qu.warn(`${e}: attribute ${i} is missing quotes`)}r[i]=a}return r}},Qp=`com.apple.hls.interstitial`;function $p(e){return e!==`ID`&&e!==`CLASS`&&e!==`CUE`&&e!==`START-DATE`&&e!==`DURATION`&&e!==`END-DATE`&&e!==`END-ON-NEXT`}function em(e){return e===`SCTE35-OUT`||e===`SCTE35-IN`||e===`SCTE35-CMD`}var tm=class{constructor(e,t,n=0){if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=t?.tagOrder??n,t){let n=t.attr;for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==n[t]){Qu.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=zu(new Zp({}),n,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e[`START-DATE`]),`END-DATE`in this.attr){let e=t?.endDate||new Date(this.attr[`END-DATE`]);W(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){let e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?`CUE`:`X-CUE`,{pre:!1,post:!1,once:!1}):e}get startTime(){let{tagAnchor:e}=this;return e===null||e.programDateTime===null?(Qu.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){let e=this._endDate||this._dateAtEnd;if(e)return e;let t=this.duration;return t===null?null:this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3)}get duration(){if(`DURATION`in this.attr){let e=this.attr.decimalFloatingPoint(`DURATION`);if(W(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return`PLANNED-DURATION`in this.attr?this.attr.decimalFloatingPoint(`PLANNED-DURATION`):null}get endOnNext(){return this.attr.bool(`END-ON-NEXT`)}get isInterstitial(){return this.class===Qp}get isValid(){return!!this.id&&!this._badValueForSameId&&W(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||`X-ASSET-URI`in this.attr||`X-ASSET-LIST`in this.attr)}},nm=10,rm=class{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8=``,this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.drift
vendor: 5,708 bytes, line 13
13StartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}let t=this.lastPartSn-e.lastPartSn,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&n>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let n=t.decryptdata;return n||=(t.setKeyFormat(e.keyFormat),t.decryptdata),!!n&&e.matches(n)})}get hasProgramDateTime(){return this.fragments.length?W(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||nm}get drift(){let e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){let e=this.partList;if(e){let t=this.lastPartIndex;if(t!==-1){for(let n=e.length;n--;)if(e[n].index>t)return e[n].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){let e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}};function im(e,t){return e.length===t.length?!e.some((e,n)=>e!==t[n]):!1}function am(e,t){return!e&&!t?!0:!e||!t?!1:im(e,t)}function om(e){return e===`AES-128`||e===`AES-256`||e===`AES-256-CTR`}function sm(e){switch(e){case`AES-128`:case`AES-256`:return Ep.cbc;case`AES-256-CTR`:return Ep.ctr;default:throw Error(`invalid full segment method ${e}`)}}function cm(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function lm(e){return Uint8Array.from(unescape(encodeURIComponent(e)),e=>e.charCodeAt(0))}function um(e){let t=lm(e).subarray(0,16),n=new Uint8Array(16);return n.set(t,16-t.length),n}function dm(e){let t=function(e,t,n){let r=e[t];e[t]=e[n],e[n]=r};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}function fm(e){let t=e.split(`:`),n=null;if(t[0]===`data`&&t.length===2){let e=t[1].split(`;`),r=e[e.length-1].split(`,`);if(r.length===2){let t=r[0]===`base64`,i=r[1];t?(e.splice(-1,1),n=cm(i)):n=um(i)}}return n}var pm=typeof self<`u`?self:void 0,mm={CLEARKEY:`org.w3.clearkey`,FAIRPLAY:`com.apple.fps`,PLAYREADY:`com.microsoft.playready`,WIDEVINE:`com.widevine.alpha`},hm={CLEARKEY:`org.w3.clearkey`,FAIRPLAY:`com.apple.streamingkeydelivery`,PLAYREADY:`com.microsoft.playready`,WIDEVINE:`urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed`};function gm(e){switch(e){case hm.FAIRPLAY:return mm.FAIRPLAY;case hm.PLAYREADY:return mm.PLAYREADY;case hm.WIDEVINE:return mm.WIDEVINE;case hm.CLEARKEY:return mm.CLEARKEY}}function _m(e){switch(e){case mm.FAIRPLAY:return hm.FAIRPLAY;case mm.PLAYREADY:return hm.PLAYREADY;case mm.WIDEVINE:return hm.WIDEVINE;case mm.CLEARKEY:return hm.CLEARKEY}}function vm(e){let{drmSystems:t,widevineLicenseUrl:n}=e,r=t?[mm.FAIRPLAY,mm.WIDEVINE,mm.PLAYREADY,mm.CLEARKEY].filter(e=>!!t[e]):[];return!r[mm.WIDEVINE]&&n&&r.push(mm.WIDEVINE),r}var ym=function(e){return pm!=null&&(e=pm.navigator)!=null&&e.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function bm(e,t,n,r){let i;switch(e){case mm.FAIRPLAY:i=[`cenc`,`sinf`];break;case mm.WIDEVINE:case mm.PLAYREADY:i=[`cenc`];break;case mm.CLEARKEY:i=[`cenc`,`keyids`];break;default:throw Error(`Unknown key-system: ${e}`)}return xm(i,t,n,r)}function xm(e,t,n,r){return[{initDataTypes:e,persistentState:r.persistentState||`optional`,distinctiveIdentifier:r.distinctiveIdentifier||`optional`,sessionTypes:r.sessionTypes||[r.sessionType||`temporary`],audioCapabilities:t.map(e=>({contentType:`audio/mp4; codecs=${e}`,robustness:r.audioRobustness||``,encryptionScheme:r.audioEncryptionScheme||null})),videoCapabilities:n.map(e=>({contentType:`video/mp4; codecs=${e}`,robustness:r.videoRobustness||``,encryptionScheme:r.videoEncryptionScheme||null}))}]}function Sm(e){var t;return!!e&&(e.sessionType===`persistent-license`||!!((t=e.sessionTypes)!=null&&t.some(e=>e===`persistent-license`)))}function Cm(e){let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),n=String.fromCharCode.apply(null,Array.from(t)),r=n.substring(n.indexOf(`<`),n.length),i=new DOMParser().parseFromString(r,`text/xml`).getElementsByTagName(`KID`)[0];if(i){let e=i.childNodes[0]?i.childNodes[0].nodeValue:i.getAttribute(`VALUE`);if(e){let t=cm(e).subarray(0,16);return dm(t),t}}return null}var wm={},Tm=class e{static clearKeyUriToKeyIdMap(){wm={}}static setKeyIdForUri(e,t){wm[e]=t}static addKeyIdForUri(e){let t=Object.keys(wm).length%(2**53-1),n=new Uint8Array(16);return new DataView(n.buffer,12,4).setUint32(0,t),wm[e]=n,n}constructor(e,t,n,r=[1],i=null,a){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pss
13h=null,this.method=e,this.uri=t,this.keyFormat=n,this.keyFormatVersions=r,this.iv=i,this.encrypted=e?e!==`NONE`:!1,this.isCommonEncryption=this.encrypted&&!om(e),a!=null&&a.startsWith(`0x`)&&(this.keyId=new Uint8Array(id(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&im(e.keyFormatVersions,this.keyFormatVersions)&&am(e.iv,this.iv)&&am(e.keyId,this.keyId)}isSupported(){if(this.method){if(om(this.method)||this.method===`NONE`)return!0;if(this.keyFormat===`identity`)return this.method===`SAMPLE-AES`;switch(this.keyFormat){case hm.FAIRPLAY:case hm.WIDEVINE:case hm.PLAYREADY:case hm.CLEARKEY:return[`SAMPLE-AES`,`SAMPLE-AES-CENC`,`SAMPLE-AES-CTR`].indexOf(this.method)!==-1}}return!1}getDecryptData(t,n){if(!this.encrypted||!this.uri)return null;if(om(this.method)){let n=this.iv;return n||=(typeof t!=`number`&&(Qu.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),t=0),Om(t)),new e(this.method,this.uri,`identity`,this.keyFormatVersions,n)}if(this.keyId){let t=wm[this.uri];if(t&&!im(this.keyId,t)&&e.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}let r=fm(this.uri);if(r)switch(this.keyFormat){case hm.WIDEVINE:if(this.pssh=r,!this.keyId){let e=Yd(r.buffer);if(e.length){var i;let t=e[0];this.keyId=(i=t.kids)!=null&&i.length?t.kids[0]:null}}this.keyId||=Dm(n);break;case hm.PLAYREADY:this.pssh=Jd(new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),null,r),this.keyId=Cm(r);break;default:{let e=r.subarray(0,16);if(e.length!==16){let t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||this.keyId.byteLength!==16){let t;t=Em(n),t||(t=Dm(n),t||=wm[this.uri]),t&&(this.keyId=t,e.setKeyIdForUri(this.uri,t))}return this}};function Em(e){let t=e?.[hm.WIDEVINE];return t?t.keyId:null}function Dm(e){let t=e?.[hm.PLAYREADY];if(t){let e=fm(t.uri);if(e)return Cm(e)}return null}function Om(e){let t=new Uint8Array(16);for(let n=12;n<16;n++)t[n]=e>>8*(15-n)&255;return t}var km=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Am=/#EXT-X-MEDIA:(.*)/g,jm=/^#EXT(?:INF|-X-TARGETDURATION):/m,Mm=new RegExp([`#EXTINF:\\s*(\\d*(?:\\.\\d+)?)(?:,(.*)\\s+)?`,`(?!#) *(\\S[^\\r\\n]*)`,`#.*`].join(`|`),`g`),Nm=new RegExp([`#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)`,`#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\\d+)`,`#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)`,`(#)([^:]*):(.*)`,`(#)(.*)(?:.*)\\r?\\n?`].join(`|`)),Pm=class e{static findGroup(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r.id===t)return r}}static resolve(e,t){return ld.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return jm.test(e)}static parseMasterPlaylist(t,n){let r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:Gp(t)},i=[];if(km.lastIndex=0,!t.startsWith(`#EXTM3U`))return r.playlistParsingError=Error(`no EXTM3U delimiter`),r;let a;for(;(a=km.exec(t))!=null;)if(a[1]){var o;let t=new Zp(a[1],r),s=Kp(r,a[2]),c={attrs:t,bitrate:t.decimalInteger(`BANDWIDTH`)||t.decimalInteger(`AVERAGE-BANDWIDTH`),name:t.NAME,url:e.resolve(s,n)},l=t.decimalResolution(`RESOLUTION`);l&&(c.width=l.width,c.height=l.height),zm(t.CODECS,c);let u=t[`SUPPLEMENTAL-CODECS`];u&&(c.supplemental={},zm(u,c.supplemental)),(o=c.unknownCodecs)!=null&&o.length||i.push(c),r.levels.push(c)}else if(a[3]){let t=a[3],i=a[4];switch(t){case`SESSION-DATA`:{let e=new Zp(i,r),t=e[`DATA-ID`];t&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[t]=e);break}case`SESSION-KEY`:{let e=Lm(i,n,r);e.encrypted&&e.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(e)):Qu.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${i}"`);break}case`DEFINE`:qp(r,new Zp(i,r),n);break;case`CONTENT-STEERING`:{let t=new Zp(i,r);r.contentSteering={uri:e.resolve(t[`SERVER-URI`],n),pathwayId:t[`PATHWAY-ID`]||`.`};break}case`START`:r.startTimeOffset=Rm(i);break}}return r.levels=i.length>0&&i.length<r.levels.length?i:r.levels,r.levels.length===0&&(r.playlistParsingError=Error(`no levels found in manifest`)),r}static parseMasterPlaylistMedia(t,n,r){let i,a={},o=r.levels,s={AUDIO:o.map(e=>({id:e.attrs.AUDIO,audioCodec:e.audioCodec})),SUBTITLES:o.map(e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec})),"CLOSED-CAPTIONS":[]},c=0;for(Am.lastIndex=0;(i=Am.exec(t))!==null;){let t=new Zp(i[1],r),o=t.TYPE;if(o){let r=s[o],i=a[o]||[];a[o]=i;let l=t.LANGUAGE,u=t[`ASSOC-LANGUAGE`],d=t.CHANNELS,f=t.CHARACTERISTICS,p=t[`INSTREAM-ID`],m={attrs:t,bitrate:0,id:c++,groupId:t[`GROUP-ID`]||``,name:t.NAME||l||``,type:o,default:t.bool(`DEFAULT`),autoselect:t.bool(`AUTOSELECT`),forced:t.bool(`FORCED`),lang:l,url:t.URI?e.resolve(t.URI,n):``};if(u&&(m.assocLang=u),d&&(m.channels=d),f&&(m.characteristics=f),p&&(m.instreamId=p),r!=null&&r.length){let t=e.findGroup(r,m.groupId)||r[0];Bm(m,t,`audioCodec`),Bm(m,t,`textCodec`)}i.push(m)}}return a}static parseLevelPlaylist(e,t,n,r,i,a){let o={url:t},s=new rm(t),c=s.fragments,l=[],u=null,d=0,f=0,p=0,m=0,h=0,g=null,_=new md(r,o),v,y,b,x=-1,S=!1,C=null,w;if(Mm.lastIndex=0,s.m3u8=e,s.hasVariableRefs=Gp(e),Mm.exec(e)?.[0]!==`#EXTM3U`)return s.playlistParsingError=Error(`Missing format identifier #EXTM3U`),s;for(;(v=Mm.exec(e))!==null;
vendor: 29,624 bytes, lines 13-18
13){S&&(S=!1,_=new md(r,o),_.playlistOffset=p,_.setStart(p),_.sn=d,_.cc=m,h&&(_.bitrate=h),_.level=n,u&&(_.initSegment=u,u.rawProgramDateTime&&(_.rawProgramDateTime=u.rawProgramDateTime,u.rawProgramDateTime=null),C&&=(_.setByteRange(C),null)));let e=v[1];if(e){_.duration=parseFloat(e);let t=(` `+v[2]).slice(1);_.title=t||null,_.tagList.push(t?[`INF`,e,t]:[`INF`,e])}else if(v[3]){if(W(_.duration)){_.playlistOffset=p,_.setStart(p),b&&Wm(_,b,s),_.sn=d,_.level=n,_.cc=m,c.push(_);let e=(` `+v[3]).slice(1);_.relurl=Kp(s,e),Hm(_,g,l),g=_,p+=_.duration,d++,f=0,S=!0}}else{if(v=v[0].match(Nm),!v){Qu.warn(`No matches on slow regex match for level playlist!`);continue}for(y=1;y<v.length&&v[y]===void 0;y++);let e=(` `+v[y]).slice(1),i=(` `+v[y+1]).slice(1),l=v[y+2]?(` `+v[y+2]).slice(1):null;switch(e){case`BYTERANGE`:g?_.setByteRange(i,g):_.setByteRange(i);break;case`PROGRAM-DATE-TIME`:_.rawProgramDateTime=i,_.tagList.push([`PROGRAM-DATE-TIME`,i]),x===-1&&(x=c.length);break;case`PLAYLIST-TYPE`:s.type&&Gm(s,e,v),s.type=i.toUpperCase();break;case`MEDIA-SEQUENCE`:s.startSN===0?c.length>0&&Km(s,e,v):Gm(s,e,v),d=s.startSN=parseInt(i);break;case`SKIP`:{s.skippedSegments&&Gm(s,e,v);let t=new Zp(i,s),n=t.decimalInteger(`SKIPPED-SEGMENTS`);if(W(n)){s.skippedSegments+=n;for(let e=n;e--;)c.push(null);d+=n}let r=t.enumeratedString(`RECENTLY-REMOVED-DATERANGES`);r&&(s.recentlyRemovedDateranges=(s.recentlyRemovedDateranges||[]).concat(r.split(` `)));break}case`TARGETDURATION`:s.targetduration!==0&&Gm(s,e,v),s.targetduration=Math.max(parseInt(i),1);break;case`VERSION`:s.version!==null&&Gm(s,e,v),s.version=parseInt(i);break;case`INDEPENDENT-SEGMENTS`:break;case`ENDLIST`:s.live||Gm(s,e,v),s.live=!1;break;case`#`:(i||l)&&_.tagList.push(l?[i,l]:[i]);break;case`DISCONTINUITY`:m++,_.tagList.push([`DIS`]);break;case`GAP`:_.gap=!0,_.tagList.push([e]);break;case`BITRATE`:_.tagList.push([e,i]),h=parseInt(i)*1e3,W(h)?_.bitrate=h:h=0;break;case`DATERANGE`:{let e=new Zp(i,s),t=new tm(e,s.dateRanges[e.ID],s.dateRangeTagCount);s.dateRangeTagCount++,t.isValid||s.skippedSegments?s.dateRanges[t.id]=t:Qu.warn(`Ignoring invalid DATERANGE tag: "${i}"`),_.tagList.push([`EXT-X-DATERANGE`,i]);break}case`DEFINE`:{let e=new Zp(i,s);`IMPORT`in e?Jp(s,e,a):qp(s,e,t)}break;case`DISCONTINUITY-SEQUENCE`:s.startCC===0?c.length>0&&Km(s,e,v):Gm(s,e,v),s.startCC=m=parseInt(i);break;case`KEY`:{let e=Lm(i,t,s);if(e.isSupported()){if(e.method===`NONE`){b=void 0;break}b||={};let t=b[e.keyFormat];t!=null&&t.matches(e)||(t&&(b=zu({},b)),b[e.keyFormat]=e)}else Qu.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${i}"`);break}case`START`:s.startTimeOffset=Rm(i);break;case`MAP`:{let e=new Zp(i,s);if(_.duration){let t=new md(r,o);Um(t,e,n,b),u=t,_.initSegment=u,u.rawProgramDateTime&&!_.rawProgramDateTime&&(_.rawProgramDateTime=u.rawProgramDateTime)}else{let t=_.byteRangeEndOffset;if(t){let e=_.byteRangeStartOffset;C=`${t-e}@${e}`}else C=null;Um(_,e,n,b),u=_,S=!0}u.cc=m;break}case`SERVER-CONTROL`:w&&Gm(s,e,v),w=new Zp(i),s.canBlockReload=w.bool(`CAN-BLOCK-RELOAD`),s.canSkipUntil=w.optionalFloat(`CAN-SKIP-UNTIL`,0),s.canSkipDateRanges=s.canSkipUntil>0&&w.bool(`CAN-SKIP-DATERANGES`),s.partHoldBack=w.optionalFloat(`PART-HOLD-BACK`,0),s.holdBack=w.optionalFloat(`HOLD-BACK`,0);break;case`PART-INF`:s.partTarget&&Gm(s,e,v),s.partTarget=new Zp(i).decimalFloatingPoint(`PART-TARGET`);break;case`PART`:{let e=s.partList;e||=s.partList=[];let t=f>0?e[e.length-1]:void 0,n=f++,r=new hd(new Zp(i,s),_,o,n,t);e.push(r),_.duration+=r.duration;break}case`PRELOAD-HINT`:s.preloadHint=new Zp(i,s);break;case`RENDITION-REPORT`:{let e=new Zp(i,s);s.renditionReports=s.renditionReports||[],s.renditionReports.push(e);break}default:Qu.warn(`line parsed but not handled: ${v}`);break}}}g&&!g.relurl?(c.pop(),p-=g.duration,s.partList&&(s.fragmentHint=g)):s.partList&&(Hm(_,g,l),_.cc=m,s.fragmentHint=_,b&&Wm(_,b,s)),s.targetduration||(s.playlistParsingError=Error(`Missing Target Duration`));let T=c.length,E=c[0],D=c[T-1];if(p+=s.skippedSegments*s.targetduration,p>0&&T&&D){s.averagetargetduration=p/T;let e=D.sn;s.endSN=e===`initSegment`?0:e,s.live||(D.endList=!0),x>0&&(Vm(c,x),E&&l.unshift(E))}return s.fragmentHint&&(p+=s.fragmentHint.duration),s.totalduration=p,l.length&&s.dateRangeTagCount&&E&&Fm(l,s),s.endCC=m,s}};function Fm(e,t){let n=e.length;if(!n)if(t.hasProgramDateTime){let r=t.fragments[t.fragments.length-1];e.push(r),n++}else return;let r=e[n-1],i=t.live?1/0:t.totalduration,a=Object.keys(t.dateRanges);for(let o=a.length;o--;){let s=t.dateRanges[a[o]],c=s.startDate.getTime();s.tagAnchor=r.ref;for(let r=n;r--&&!(e[r]?.sn<t.startSN);){let n=Im(t,c,e,r,i);if(n!==-1){s.tagAnchor=t.fragments[n].ref;break}}}}function Im(e,t,n,r,i){let a=n[r];if(a){let o=a.programDateTime;if((t>=o||r===0)&&t<=o+((n[r+1]?.start||i)-a.start)*1e3){let i=n[r].sn-e.startSN;if(i<0)return-1;let a=e.fragments;if(a.length>n.length){let o=(n[r+1]||a[a.length-1]).sn-e.startSN;for(let e=o;e>i;e--){let n=a[e].programDateTime;if(t>=n&&t<n+a[e].duration*1e3)return e}}return i}}return-1}function Lm(e,t,n){let r=new Zp(e,n),i=r.METHOD??``,a=r.URI,o=r.hexadecimalInteger(`IV`),s=r.KEYFORMATVERSIONS,c=r.KEYFORMAT??`identity`;return a&&r.IV&&!o&&Qu.error(`Invalid IV: ${r.IV}`),new Tm(i,a?Pm.resolve(a,t):``,c,(s||`1`).split(`/`).map(Number).filter(Number.isFinite),o,r.KEYID)}function Rm(e){let t=new Zp(e).decimalFloatingPoint(`TIME-OFFSET`);return W(t)?t:null}function zm(e,t){let n=(e||``).split(/[ ,]+/).filter(e=>e);[`video`,`audio`,`text`].forEach(e=>{let r=n.filter(t=>$d(t,e));r.length&&(t[`${e}Codec`]=r.map(e=>e.split(`/`)[0]).join(`,`),n=n.filter(e=>r.indexOf(e)===-1))}),t.unknownCodecs=n}function Bm(e,t,n){let r=t[n];r&&(e[n]=r)}function Vm(e,t){let n=e[t];for(let r=t;r--;){let t=e[r];if(!t)return;t.programDateTime=n.programDateTime-t.duration*1e3,n=t}}function Hm(e,t,n){e.rawProgramDateTime?n.push(e):t!=null&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function Um(e,t,n,r){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=n,e.sn=`initSegment`,r&&(e.levelkeys=r),e.initSegment=null}function Wm(e,t,n){e.levelkeys=t;let{encryptedFragments:r}=n;(!r.length||r[r.length-1].levelkeys!==t)&&Object.keys(t).some(e=>t[e].isCommonEncryption)&&r.push(e)}function Gm(e,t,n){e.playlistParsingError=Error(`#EXT-X-${t} must not appear more than once (${n[0]})`)}function Km(e,t,n){e.playlistParsingError=Error(`#EXT-X-${t} must appear before the first Media Segment (${n[0]})`)}function qm(e,t){let n=t.startPTS;if(W(n)){let r=0,i;t.sn>e.sn?(r=n-e.start,i=e):(r=e.start-n,i=t),i.duration!==r&&i.setDuration(r)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.setStart(e.start+(e.minEndPTS-e.start)):t.setStart(e.start+e.duration):t.setStart(Math.max(e.start-t.duration,0))}function Jm(e,t,n,r,i,a,o){r-n<=0&&(o.warn(`Fragment should have a positive duration`,t),r=n+t.duration,a=i+t.duration);let s=n,c=r,l=t.startPTS,u=t.endPTS;if(W(l)){let d=Math.abs(l-n);e&&d>e.totalduration?o.warn(`media timestamps and playlist times differ by ${d}s for level ${t.level} ${e.url}`):W(t.deltaPTS)?t.deltaPTS=Math.max(d,t.deltaPTS):t.deltaPTS=d,s=Math.max(n,l),n=Math.min(n,l),i=t.startDTS===void 0?i:Math.min(i,t.startDTS),c=Math.min(r,u),r=Math.max(r,u),a=t.endDTS===void 0?a:Math.max(a,t.endDTS)}let d=n-t.start;t.start!==0&&t.setStart(n),t.setDuration(r-t.start),t.startPTS=n,t.maxStartPTS=s,t.startDTS=i,t.endPTS=r,t.minEndPTS=c,t.endDTS=a;let f=t.sn;if(!e||f<e.startSN||f>e.endSN)return 0;let p,m=f-e.startSN,h=e.fragments;for(h[m]=t,p=m;p>0;p--)qm(h[p],h[p-1]);for(p=m;p<h.length-1;p++)qm(h[p],h[p+1]);return e.fragmentHint&&qm(h[h.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,d}function Ym(e,t,n){if(e===t)return;let r=null,i=e.fragments;for(let e=i.length-1;e>=0;e--){let t=i[e].initSegment;if(t){r=t;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;let a;Qm(e,t,(e,n,i,o)=>{if((!t.startCC||t.skippedSegments)&&n.cc!==e.cc){let r=e.cc-n.cc;for(let e=i;e<o.length;e++)o[e].cc+=r;t.endCC=o[o.length-1].cc}W(e.startPTS)&&W(e.endPTS)&&(n.setStart(n.startPTS=e.startPTS),n.startDTS=e.startDTS,n.maxStartPTS=e.maxStartPTS,n.endPTS=e.endPTS,n.endDTS=e.endDTS,n.minEndPTS=e.minEndPTS,n.setDuration(e.endPTS-e.startPTS),n.duration&&(a=n),t.PTSKnown=t.alignedSliding=!0),e.hasStreams&&(n.elementaryStreams=e.elementaryStreams),n.loader=e.loader,e.hasStats&&(n.stats=e.stats),e.initSegment&&(n.initSegment=e.initSegment,r=e.initSegment)});let o=t.fragments,s=t.fragmentHint?o.concat(t.fragmentHint):o;if(r&&s.forEach(e=>{e&&(!e.initSegment||e.initSegment.relurl===r?.relurl)&&(e.initSegment=r)}),t.skippedSegments){if(t.deltaUpdateFailed=o.some(e=>!e),t.deltaUpdateFailed){n.warn(`[level-helper] Previous playlist missing segments skipped in delta playlist`);for(let e=t.skippedSegments;e--;)o.shift();t.startSN=o[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=Xm(e.dateRanges,t,n));let r=e.fragments.filter(e=>e.rawProgramDateTime);if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(let e=1;e<s.length;e++)s[e].programDateTime===null&&Hm(s[e],s[e-1],r);Fm(r,t)}t.endCC=o[o.length-1].cc}t.startCC||=rh(e,t.startSN-1)?.cc??o[0].cc,Zm(e.partList,t.partList,(e,t)=>{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats}),a?Jm(t,a,a.startPTS,a.endPTS,a.startDTS,a.endDTS,n):eh(e,t),o.length&&(t.totalduration=t.edge-o[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;let c=t.advancedDateTime;if(t.advanced&&c){let e=t.edge;t.driftStart||=(t.driftStartTime=c,e),t.driftEndTime=c,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;t.requestScheduled===-1&&(t.requestScheduled=e.requestScheduled)}function Xm(e,t,n){let{dateRanges:r,recentlyRemovedDateranges:i}=t,a=zu({},e);i&&i.forEach(e=>{delete a[e]});let o=Object.keys(a).length;return o?(Object.keys(r).forEach(e=>{let t=a[e],i=new tm(r[e].attr,t);i.isValid?(a[e]=i,t||(i.tagOrder+=o)):n.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Bf(r[e].attr)}"`)}),a):r}function Zm(e,t,n){if(e&&t){let r=0;for(let i=0,a=e.length;i<=a;i++){let a=e[i],o=t[i+r];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?n(a,o):r--}}}function Qm(e,t,n){let r=t.skippedSegments,i=Math.max(e.startSN,t.startSN)-t.startSN,a=(e.fragmentHint?1:0)+(r?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,o=t.startSN-e.startSN,s=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,c=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let l=i;l<=a;l++){let i=c[o+l],a=s[l];if(r&&!a&&i&&(a=t.fragments[l]=i),i&&a){n(i,a,l,s);let r=i.relurl,o=a.relurl;if(r&&sh(r,o)){t.playlistParsingError=$m(`media sequence mismatch ${a.sn}:`,e,t,i,a);return}else if(i.cc!==a.cc){t.playlistParsingError=$m(`discontinuity sequence mismatch (${i.cc}!=${a.cc})`,e,t,i,a);return}}}}function $m(e,t,n,r,i){return Error(`${e} ${i.url} 14Playlist starting @${t.startSN} 15${t.m3u8} 16 17Playlist starting @${n.startSN} 18${n.m3u8}`)}function eh(e,t,n=!0){let r=t.startSN+t.skippedSegments-e.startSN,i=e.fragments,a=r>=0,o=0;if(a&&r<i.length)o=i[r].start;else if(a&&t.startSN===e.endSN+1)o=e.fragmentEnd;else if(a&&n)o=e.fragmentStart+r*t.levelTargetDuration;else if(!t.skippedSegments&&t.fragmentStart===0)o=e.fragmentStart;else return;th(t,o)}function th(e,t){if(t){let n=e.fragments;for(let r=e.skippedSegments;r<n.length;r++)n[r].addStart(t);e.fragmentHint&&e.fragmentHint.addStart(t)}}function nh(e,t=1/0){let n=1e3*e.targetduration;if(e.updated){let r=e.fragments;if(r.length&&n*4>t){let e=r[r.length-1].duration*1e3;e<n&&(n=e)}}else n/=2;return Math.round(n)}function rh(e,t,n){if(!e)return null;let r=e.fragments[t-e.startSN];return r||(r=e.fragmentHint,r&&r.sn===t)?r:t<e.startSN&&n&&n.sn===t?n:null}function ih(e,t,n){return e?ah(e.partList,t,n):null}function ah(e,t,n){if(e)for(let r=e.length;r--;){let i=e[r];if(i.index===n&&i.fragment.sn===t)return i}return null}function oh(e){e.forEach((e,t)=>{var n;(n=e.details)==null||n.fragments.forEach(e=>{e.level=t,e.initSegment&&(e.initSegment.level=t)})})}function sh(e,t){return e!==t&&t?ch(e)!==ch(t):!1}function ch(e){return e.replace(/\?[^?]*$/,``)}function lh(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n]?.cc===t)return e[n];return null}function uh(e,t){return!!(e&&t.startCC<e.endCC&&t.endCC>e.startCC)}function dh(e,t){let n=e.start+t;e.startPTS=n,e.setStart(n),e.endPTS=n+e.duration}function fh(e,t){let n=t.fragments;for(let t=0,r=n.length;t<r;t++)dh(n[t],e);t.fragmentHint&&dh(t.fragmentHint,e),t.alignedSliding=!0}function ph(e,t){e&&(mh(t,e),t.alignedSliding||hh(t,e),!t.alignedSliding&&!t.skippedSegments&&eh(e,t,!1))}function mh(e,t){if(!uh(t,e))return;let n=Math.min(t.endCC,e.endCC),r=lh(t.fragments,n),i=lh(e.fragments,n);!r||!i||(Qu.log(`Aligning playlist at start of dicontinuity sequence ${n}`),fh(r.start-i.start,e))}function hh(e,t){if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;let n=e.fragments,r=t.fragments;if(!n.length||!r.length)return;let i,a,o=Math.min(t.endCC,e.endCC);t.startCC<o&&e.startCC<o&&(i=lh(r,o),a=lh(n,o)),(!i||!a)&&(i=r[Math.floor(r.length/2)],a=lh(n,i.cc)||n[Math.floor(n.length/2)]);let s=i.programDateTime,c=a.programDateTime;!s||!c||fh((c-s)/1e3-(a.start-i.start),e)}function gh(e,t,n){_h(e,t,n),e.addEventListener(t,n)}function _h(e,t,n){e.removeEventListener(t,n)}var vh={toString:function(e){let t=``,n=e.length;for(let r=0;r<n;r++)t+=`[${e.start(r).toFixed(3)}-${e.end(r).toFixed(3)}]`;return t}},$={STOPPED:`STOPPED`,IDLE:`IDLE`,KEY_LOADING:`KEY_LOADING`,FRAG_LOADING:`FRAG_LOADING`,FRAG_LOADING_WAITING_RETRY:`FRAG_LOADING_WAITING_RETRY`,WAITING_TRACK:`WAITING_TRACK`,PARSING:`PARSING`,PARSED:`PARSED`,ENDED:`ENDED`,ERROR:`ERROR`,WAITING_INIT_PTS:`WAITING_INIT_PTS`,WAITING_LEVEL:`WAITING_LEVEL`},yh=class extends Bp{constructor(e,t,n,r,i){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=$.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{let{config:e,fragCurrent:t,media:n,mediaBuffer:r,state:i}=this,a=n?n.currentTime:0,o=Q.bufferInfo(r||n,a,e.maxBufferHole),s=!o.len;if(this.log(`Media seeking to ${W(a)?a.toFixed(3):a}, state: ${i}, ${s?`out of`:`in`} buffer`),this.state===$.ENDED)this.resetLoadingState();else if(t){let n=e.maxFragLookUpTolerance,r=t.start-n,i=t.start+t.duration+n;if(s||i<o.start||r>o.end){let e=a>i;(a<r||e)&&(e&&t.loader&&(this.log(`Cancelling fragment load for seek (sn: ${t.sn})`),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(n&&(this.fragmentTracker.removeFragmentsInRange(a,1/0,this.playlistType,!0),a>this.lastCurrentTime&&(this.lastCurrentTime=a),!this.loadingParts)){let e=Math.max(o.end,a),t=this.shouldLoadParts(this.getLevelDetails(),e);t&&(this.log(`LL-Part loading ON after seeking to ${a.toFixed(2)} with buffer @${e.toFixed(2)}`),this.loadingParts=t)}this.hls.hasEnoughToStart||(this.log(`Setting ${s?`startPosition`:`nextLoadPosition`} to ${a} for seek without enough to start`),this.nextLoadPosition=a,s&&(this.startPosition=a)),s&&this.state===$.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log(`setting startPosition to 0 because media ended`),this.startPosition=this.lastCurrentTime=0},this.playlistType=i,this.hls=e,this.fragmentLoader=new Fp(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Np(e.config)}registerListeners(){let{hls:e}=this;e.on(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(q.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(q.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===$.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);let e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=$.STOPPED}get startPositionValue(){let{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;let n=e.end||0,r=this.config.timelineOffset||0;if(n<=r)return!1;let i=e.buffered;this.config.maxBufferHole&&i&&i.length>1&&(e=Q.bufferedInfo(i,e.start,0));let a=e.nextStart;if(a&&a>r&&a<t.edge||this.media.currentTime<e.start)return!1;let o=t.partList;if(o!=null&&o.length){let e=o[o.length-1];return Q.isBuffered(this.media,e.start+e.duration/2)}let s=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(s)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){let e=this.config.timelineOffset;return e?this.getLevelDetails()?.appliedTimelineOffset||e:0}onMediaAttached(e,t){let n=this.media=this.mediaBuffer=t.media;gh(n,`seeking`,this.onMediaSeeking),gh(n,`ended`,this.onMediaEnded);let r=this.config;this.levels&&r.autoStartLoad&&this.state===$.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(e,t){let n=!!t.transferMedia,r=this.media;if(r!==null){if(r.ended&&(this.log(`MSE detaching and video ended, reset startPosition`),this.startPosition=this.lastCurrentTime=0),_h(r,`seeking`,this.onMediaSeeking),_h(r,`ended`,this.onMediaEnded),this.keyLoader&&!n&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,n){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&=(this.transmuxer.destroy(),null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=$.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,n){this.startFragRequested=!0,this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){this._doFragLoad(e,t,n,e=>{let t=e.frag;if(this.fragContextChanged(t)){this.warn(`${t.type} sn: ${t.sn}${e.part?` part: `+e.part.index:``} of ${this.fragInfo(t,!1,e.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(t);return}t.stats.chunkCount++,this._handleFragmentLoadProgress(e)}).then(e=>{if(!e)return;let t=this.state,n=e.frag;if(this.fragContextChanged(n)){(t===$.FRAG_LOADING||!this.fragCurrent&&t===$.PARSING)&&(this.fragmentTracker.removeFragment(n),this.state=$.IDLE);return}`payload`in e&&(this.log(`Loaded ${n.type} sn: ${n.sn} of ${this.playlistLabel()} ${n.level}`),this.hls.trigger(q.FRAG_LOADED,e)),this._handleFragmentLoadComplete(e)}).catch(t=>{this.state===$.STOPPED||this.state===$.ERROR||(this.warn(`Frag error: ${t?.message||t}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){let{fragmentTracker:t}=this;if(t.getState(e)===xp.APPENDING){let n=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,n),i=Math.max(e.duration,r?r.len:this.config.maxBufferLength),a=this.backtrackFragment;((a?e.sn-a.sn:0)===1||this.reduceMaxBufferLength(i,e.duration))&&t.removeFragment(e)}else this.mediaBuffer?.buffered.length===0?t.removeAllFragments():t.hasParts(e.type)&&(t.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),t.getState(e)===xp.PARTIAL&&t.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){let t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){let t=e.details;return t?.live&&t.type!==`EVENT`&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,n=null){if(!(e-t))return;let r={startOffset:e,endOffset:t,type:n};this.hls.trigger(q.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(e=>{let t=e?.frag;if(!t||this.fragContextChanged(t)||!this.levels)throw Error(`init load aborted`);return e}).then(e=>{let{hls:t}=this,{frag:n,payload:r}=e,i=n.decryptdata;if(r&&r.byteLength>0&&i!=null&&i.key&&i.iv&&om(i.method)){let a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),i.key.buffer,i.iv.buffer,sm(i.method)).catch(e=>{throw t.trigger(q.ERROR,{type:G.MEDIA_ERROR,details:K.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:n}),e}).then(r=>{let i=self.performance.now();return t.trigger(q.FRAG_DECRYPTED,{frag:n,payload:r,stats:{tstart:a,tdecrypt:i}}),e.payload=r,this.completeInitSegmentLoad(e)})}return this.completeInitSegmentLoad(e)}).catch(t=>{this.state===$.STOPPED||this.state===$.ERROR||(this.warn(t),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){let{levels:t}=this;if(!t)throw Error(`init load aborted, missing levels`);let n=e.frag.stats;this.state!==$.STOPPED&&(this.state=$.IDLE),e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var n,r;let i=e.tracks;if(i&&!t.encrypted&&((n=i.audio)!=null&&n.encrypted||(r=i.video)!=null&&r.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){let e=this.media,n=Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${e?`attached mediaKeys: `+e.mediaKeys:`detached`})`);return this.warn(n.message),!e||e.mediaKeys?!1:(this.hls.trigger(q.ERROR,{type:G.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_KEYS,fatal:!1,error:n,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){let{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){let n=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?` part: `+t.index:``} of ${this.fragInfo(e,!1,t)} > buffer:${n?vh.toString(Q.getBuffered(n)):`(detached)`})`),pd(e)){if(e.type!==Y.SUBTITLE){let t=e.elementaryStreams;if(!Object.keys(t).some(e=>!!t[e])){this.state=$.IDLE;return}}let t=this.levels?.[e.level];t!=null&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=$.IDLE}_handleFragmentLoadComplete(e){let{transmuxer:t}=this;if(!t)return;let{frag:n,part:r,partsLoaded:i}=e,a=!i||i.length===0||i.some(e=>!e),o=new Vp(n.level,n.sn,n.stats.chunkCount+1,0,r?r.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,r){var i;this.fragCurrent=e;let a=t.details;if(!this.levels||!a)throw Error(`frag load aborted, missing level${a?``:` detail`}s`);let o=null;if(e.encrypted&&!((i=e.decryptdata)!=null&&i.key)){if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=$.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(q.KEY_LOADED,e),this.state===$.KEY_LOADING&&(this.state=$.IDLE),e}),this.hls.trigger(q.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log(`context changed in KEY_LOADING`),Promise.resolve(null)}else e.encrypted||(o=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),o&&this.log(`[eme] blocking frag load until media-keys acquired`));let s=this.fragPrevious;if(pd(e)&&(!s||e.sn!==s.sn)){let n=this.shouldLoadParts(t.details,e.end);n!==this.loadingParts&&(this.log(`LL-Part loading ${n?`ON`:`OFF`} loading sn ${s?.sn}->${e.sn}`),this.loadingParts=n)}if(n=Math.max(e.start,n||0),this.loadingParts&&pd(e)){let i=a.partList;if(i&&r){n>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);let s=this.getNextPart(i,e,n);if(s>-1){let c=i[s];e=this.fragCurrent=c.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${c.index} (${s}/${i.length-1}) of ${this.fragInfo(e,!1,c)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(n.toFixed(3))}`),this.nextLoadPosition=c.start+c.duration,this.state=$.FRAG_LOADING;let l;return l=o?o.then(n=>!n||this.fragContextChanged(n.frag)?null:this.doFragPartsLoad(e,c,t,r)).catch(e=>this.handleFragLoadError(e)):this.doFragPartsLoad(e,c,t,r).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(q.FRAG_LOADING,{frag:e,part:c,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(Error(`frag load aborted, context changed in FRAG_LOADING parts`)):l}else if(!e.url||this.loadedEndOfParts(i,n))return Promise.resolve(null)}}if(pd(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${n.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${a.partList?.filter(e=>e.loaded).map(e=>`[${e.start}-${e.end}]`)}`),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${`[`+a.startSN+`-`+a.endSN+`]`}, target: ${parseFloat(n.toFixed(3))}`),W(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=$.FRAG_LOADING;let c=this.config.progressive&&e.type!==Y.SUBTITLE,l;return l=c&&o?o.then(t=>!t||this.fragContextChanged(t.frag)?null:this.fragmentLoader.load(e,r)).catch(e=>this.handleFragLoadError(e)):Promise.all([this.fragmentLoader.load(e,c?r:void 0),o]).then(([e])=>(!c&&r&&r(e),e)).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(q.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(Error(`frag load aborted, context changed in FRAG_LOADING`)):l}doFragPartsLoad(e,t,n,r){return new Promise((i,a)=>{let o=[],s=n.details?.partList,c=t=>{this.fragmentLoader.loadPart(e,t,r).then(r=>{o[t.index]=r;let a=r.part;this.hls.trigger(q.FRAG_LOADED,r);let l=ih(n.details,e.sn,t.index+1)||ah(s,e.sn,t.index+1);if(l)c(l);else return i({frag:e,part:a,partsLoaded:o})}).catch(a)};c(t)})}handleFragLoadError(e){if(`data`in e){let t=e.data;t.frag&&t.details===K.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===G.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(q.ERROR,t)}else this.hls.trigger(q.ERROR,{type:G.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){let t=this.getCurrentContext(e);if(!t||this.state!==$.PARSING){!this.fragCurrent&&this.state!==$.STOPPED&&this.state!==$.ERROR&&(this.state=$.IDLE);return}let{frag:n,part:r,level:i}=t,a=self.performance.now();n.stats.parsing.end=a,r&&(r.stats.parsing.end=a);let o=this.getLevelDetails(),s=o&&n.sn>o.endSN||this.shouldLoadParts(o,n.end);s!==this.loadingParts&&(this.log(`LL-Part loading ${s?`ON`:`OFF`} after parsing segment ending @${n.end.toFixed(2)}`),this.loadingParts=s),this.updateLevelTiming(n,r,i,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){let n=e.partList[0];if(n.fragment.type===Y.SUBTITLE)return!1;if(t>=n.end+(e.fragmentHint?.duration||0)&&(this.hls.hasEnoughToStart?this.media?.currentTime||this.lastCurrentTime:this.getLoadPosition())>n.start-n.fragment.duration)return!0}}return!1}getCurrentContext(e){let{levels:t,fragCurrent:n}=this,{level:r,sn:i,part:a}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${i} of ${this.playlistLabel()} ${r}. The current chunk will not be buffered.`),null;let o=t[r],s=o.details,c=a>-1?ih(s,i,a):null,l=c?c.fragment:rh(s,i,n);return l?(n&&n!==l&&(l.stats=n.stats),{frag:l,part:c,level:o}):null}bufferFragmentData(e,t,n,r,i){if(this.state!==$.PARSING)return;let{data1:a,data2:o}=e,s=a;if(o&&(s=Bd(a,o)),!s.length)return;let c=this.initPTS[t.cc],l=c?-c.baseTime/c.timescale:void 0,u={type:e.type,frag:t,part:n,chunkMeta:r,offset:l,parent:t.type,data:s};if(this.hls.trigger(q.BUFFER_APPENDING,u),e.dropped&&e.independent&&!n){if(i)return;this.flushBufferGap(t)}}flushBufferGap(e){let t=this.media;if(!t)return;if(!Q.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}let n=t.currentTime,r=Q.bufferInfo(t,n,0),i=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,i*.25),o=Math.max(Math.min(e.start-a,r.end-a),n+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var n;let r=this.getLoadPosition();if(!W(r))return null;let i=this.lastCurrentTime>r||(n=this.media)!=null&&n.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,t,i)}getFwdBufferInfoAtPos(e,t,n,r){let i=Q.bufferInfo(e,t,r);if(i.len===0&&i.nextStart!==void 0){let a=this.fragmentTracker.getBufferedFrag(t,n);if(a&&(i.nextStart<=a.end||a.gap)){let n=Math.max(Math.min(i.nextStart,a.end)-t,r);return Q.bufferInfo(e,t,n)}}return i}
18getMaxBufferLength(e){let{config:t}=this,n;return n=e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}exceedsMaxBuffer(e,t,n){let r=e.nextStart;if(r&&n.start>r){let r=e.buffered;if(r){let i=e.len,a=e.bufferedIndex;for(let e=r.length-1;e>a;e--)r[e].start<n.start&&(i+=r[e].end-r[e].start);return i>=t}}return!1}reduceMaxBufferLength(e,t){let n=this.config,r=Math.max(Math.min(e-t,n.maxBufferLength),t),i=Math.max(e-t*3,n.maxMaxBufferLength/2,r);return i>=r?(n.maxMaxBufferLength=i,this.warn(`Reduce max buffer length to ${i}s`),!0):!1}getAppendedFrag(e,t=Y.MAIN){let n=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return n&&`fragment`in n?n.fragment:n}getNextFragment(e,t){let n=t.fragments,r=n.length;if(!r)return null;let{config:i}=this,a=t.fragmentStart,o=i.lowLatencyMode&&!!t.partList,s=null;if(t.live){let n=i.initialLiveManifestSize;if(r<n)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${n})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a){o&&!this.loadingParts&&(this.log(`LL-Part loading ON for initial live fragment`),this.loadingParts=!0),s=this.getInitialLiveFragment(t);let n=this.config.startPosition,r=this.hls.startPosition,i=this.hls.liveSyncPosition,c=s?.start||0,l,u;r!==-1&&r>=a?(l=r,u=r===n?`config`:`next load start`):i===null?(l=e,u=`buffer pos`):(l=i,u=`live edge`),l<c&&(l=c,u=`live frag start`),l<a&&(l=a,u=`playlist start`),(this.startPosition!=l||this.nextLoadPosition!=l)&&(this.log(`Setting startPosition to ${l.toFixed(3)} ${r===-1?``:`(from ${n}) `}based on ${u}. live edge: ${i} live frag start: ${c.toFixed(3)} playlist start: ${a.toFixed(3)} buffer pos: ${e}`),this.startPosition=this.nextLoadPosition=l)}}else e<=a&&(s=n[0]);if(!s){let n=this.loadingParts?t.partEnd:t.fragmentEnd;s=this.getFragmentAtPosition(e,n,t)}let c=this.filterReplacedPrimary(s,t);if(!c&&s){let e=s.sn-t.startSN;c=this.filterReplacedPrimary(n[e+1]||null,t)}return this.mapToInitFragWhenRequired(c)}isLoopLoading(e,t){if(this.nextLoadPosition<=t)return!1;let n=this.fragmentTracker.getState(e);return n===xp.OK||n===xp.PARTIAL&&!!e.gap}getNextFragmentLoopLoading(e,t,n,r,i){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t),a&&!a.gap&&n.nextStart)){let e=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,r,0);if(e!==null&&n.len+e.len>=i){let e=a.sn;return this.loopSn!==e&&(this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${e}`),this.loopSn=e),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(bh(this.config)){var e;if(!((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null)&&e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(bh(this.config)&&e.type!==Y.SUBTITLE){let n=this.hls.interstitialsManager,r=n?.bufferingItem;if(r){let n=r.event;if(n){if(n.appendInPlace||Math.abs(e.start-r.start)>1||r.start===0)return null}else if(e.end<=r.start&&t?.live===!1||e.start>r.end&&r.nextEvent&&(r.nextEvent.appendInPlace||e.start-r.end>1))return null}let i=n?.playerQueue;if(i)for(let t=i.length;t--;){let n=i[t].interstitial;if(n.appendInPlace&&e.start>=n.startTime&&e.end<=n.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,n){let r=-1,i=!1,a=!0;for(let o=0,s=e.length;o<s;o++){let s=e[o];if(a&&=!s.independent,r>-1&&n<s.start)break;let c=s.loaded;c?r=-1:(i||(s.independent||a)&&s.fragment===t)&&(s.fragment!==t&&this.warn(`Need buffer at ${n} but next unloaded part starts at ${s.start}`),r=o),i=c}return r}loadedEndOfParts(e,t){let n;for(let r=e.length;r--;){if(n=e[r],!n.loaded)return!1;if(t>n.start)return!0}return!1}getInitialLiveFragment(e){let t=e.fragments,n=this.fragPrevious,r=null;if(n){if(e.hasProgramDateTime&&(r=np(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance),r&&this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`)),!r){let i=n.sn+1;if(i>=e.startSN&&i<=e.endSN){let a=t[i-e.startSN];n.cc===a.cc&&(r=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=sp(e,n.cc,n.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{let t=this.hls.liveSyncPosition;t!==null&&(r=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,n){let{config:r}=this,{fragPrevious:i}=this,{fragments:a,endSN:o}=n,{fragmentHint:s}=n,{maxFragLookUpTolerance:c}=r,l=n.partList,u=!!(this.loadingParts&&l!=null&&l.length&&s);u&&!this.bitrateTest&&l[l.length-1].fragment.sn===s.sn&&(a=a.concat(s),o=s.sn);let d;if(e<t){var f;let n=e<this.lastCurrentTime||e>t-c||(f=this.media)!=null&&f.paused||!this.startFragRequested?0:c;
vendor: 4,312 bytes, line 18
18d=rp(i,a,e,n)}else d=a[a.length-1];if(d){let e=d.sn-n.startSN,t=this.fragmentTracker.getState(d);if((t===xp.OK||t===xp.PARTIAL&&d.gap)&&(i=d),i&&d.sn===i.sn&&(!u||l[0].fragment.sn>d.sn||!n.live)&&d.level===i.level){let t=a[e+1];d=d.sn<o&&this.fragmentTracker.getState(t)!==xp.OK?t:null}}return d}alignPlaylists(e,t,n){let r=e.fragments.length;if(!r)return this.warn(`No fragments in live playlist`),0;let i=e.fragmentStart,a=!t,o=e.alignedSliding&&W(i);if(a||!o&&!i){ph(n,e);let i=e.fragmentStart;return this.log(`Live playlist sliding: ${i.toFixed(2)} start-sn: ${t?t.startSN:`na`}->${e.startSN} fragments: ${r}`),i}return i}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let n=this.startPosition;n<t&&(n=-1);let r=this.timelineOffset;if(n===-1){let i=this.startTimeOffset!==null,a=i?this.startTimeOffset:e.startTimeOffset;a!==null&&W(a)?(n=t+a,a<0&&(n+=e.edge),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Setting startPosition to ${n} for start time offset ${a} found in ${i?`multivariant`:`media`} playlist`),this.startPosition=n):e.live?(n=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${n}`),this.startPosition=-1):(this.log(`setting startPosition to 0 by default`),this.startPosition=n=0),this.lastCurrentTime=n+r}this.nextLoadPosition=n+r}getLoadPosition(){var e;let{media:t}=this,n=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?n=t.currentTime:this.nextLoadPosition>=0&&(n=this.nextLoadPosition),n}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&pd(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?` part `+t.index:``} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==$.FRAG_LOADING_WAITING_RETRY)&&(this.state=$.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){let e=this.getCurrentContext(t.chunkMeta);e&&(t.frag=e.frag)}let n=t.frag;if(!n||n.type!==e||!this.levels)return;if(this.fragContextChanged(n)){this.warn(`Frag load error must match current frag to retry ${n.url} > ${this.fragCurrent?.url}`);return}let r=t.details===K.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(n,!0);let i=t.errorAction;if(!i){this.state=$.ERROR;return}let{action:a,flags:o,retryCount:s=0,retryConfig:c}=i,l=!!c,u=l&&a===_p.RetryRequest,d=l&&!i.resolved&&o===vp.MoveAllAlternatesMatchingHost,f=this.hls.latestLevelDetails?.live;if(!u&&d&&pd(n)&&!n.endList&&f&&!up(t))this.resetFragmentErrors(e),this.treatAsGap(n),i.resolved=!0;else if((u||d)&&s<c.maxNumRetry){let r=gp(t.response?.code),a=fp(c,s);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+a,this.state=$.FRAG_LOADING_WAITING_RETRY,i.resolved=!0,r){this.log(`Waiting for connection (offline)`),this.retryDate=1/0,t.reason=`offline`;return}this.warn(`Fragment ${n.sn} of ${e} ${n.level} errored with ${t.details}, retrying loading ${s+1}/${c.maxNumRetry} in ${a}ms`)}else if(c)if(this.resetFragmentErrors(e),s<c.maxNumRetry)!r&&a!==_p.RemoveAlternatePermanently&&(i.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${s})`);return}else a===_p.SendAlternateToPenaltyBox?this.state=$.WAITING_LEVEL:this.state=$.ERROR;this.tickImmediate()}checkRetryDate(){let e=self.performance.now(),t=this.retryDate,n=t===1/0;(!t||e>=t||n&&!gp(0))&&(n&&this.log(`Connection restored (online)`),this.resetStartWhenNotLoaded(),this.state=$.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===$.PARSING||this.state===$.PARSED){let t=e.frag,n=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,n),i=r&&r.len>.5;i&&this.reduceMaxBufferLength(r.len,t?.duration||10);let a=!i;return a&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${n} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===Y.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==$.STOPPED&&(this.state=$.IDLE)}afterBufferFlushed(e,t,n){if(!e)return;let r=Q.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,n),this.state===$.ENDED&&this.resetLoadingState()}
vendor: 34,479 bytes, line 18
18resetLoadingState(){this.log(`Reset loading state`),this.fragCurrent=null,this.fragPrevious=null,this.state!==$.STOPPED&&(this.state=$.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;let e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log(`resetting startPosition for live start`),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?`<removed>`:e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,n,r){let i=n.details;if(!i){this.warn(`level.details undefined`);return}if(!Object.keys(e.elementaryStreams).reduce((t,a)=>{let o=e.elementaryStreams[a];if(o){let s=o.endPTS-o.startPTS;if(s<=0)return this.warn(`Could not parse fragment ${e.sn} ${a} duration reliably (${s})`),t||!1;let c=r?0:Jm(i,e,o.startPTS,o.endPTS,o.startDTS,o.endDTS,this);return this.hls.trigger(q.LEVEL_PTS_UPDATED,{details:i,level:n,drift:c,type:a,frag:e,start:o.startPTS,end:o.endPTS}),!0}return t},!1)){let t=this.transmuxer?.error===null;if((n.fragmentError===0||t&&(n.fragmentError<2||e.endList))&&this.treatAsGap(e,n),t){let t=Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(t.message),this.hls.trigger(q.ERROR,{type:G.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=$.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?` part: `+t.index:``} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(q.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===Y.MAIN?`level`:`track`}fragInfo(e,t=!0,n){return`${this.playlistLabel()} ${e.level} (${n?`part`:`frag`}:[${((t&&!n?e.startPTS:(n||e).start)??NaN).toFixed(3)}-${((t&&!n?e.endPTS:(n||e).end)??NaN).toFixed(3)}]${n&&e.type===`main`?`INDEPENDENT=`+(n.independent?`YES`:`NO`):``}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event===`demuxerWorker`&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&=(this.transmuxer.destroy(),null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){let t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}};function bh(e){return!!e.interstitialsController&&e.enableInterstitialPlayback!==!1}var xh=class{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){let{chunks:e,dataLength:t}=this,n;if(e.length)n=e.length===1?e[0]:Sh(e,t);else return new Uint8Array;return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}};function Sh(e,t){let n=new Uint8Array(t),r=0;for(let t=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}var Ch={exports:{}},wh;function Th(){return wh?Ch.exports:(wh=1,(function(e){var t=Object.prototype.hasOwnProperty,n=`~`;function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if(typeof r!=`function`)throw TypeError(`The listener must be a function`);var s=new i(r,a||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){--e._eventsCount===0?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}s.prototype.eventNames=function(){var e=[],r,i;if(this._eventsCount===0)return e;for(i in r=this._events)t.call(r,i)&&e.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,i),!0;case 5:return c.fn.call(c.context,t,r,i,a),!0;case 6:return c.fn.call(c.context,t,r,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,r);break;case 4:c[d].fn.call(c[d].context,t,r,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var a=n?n+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)&&(!r||s.context===r)&&o(this,a);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&l.push(s[c]);l.length?this._events[a]=l.length===1?l[0]:l:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})(Ch),Ch.exports)}var Eh=ad(Th()),Dh=`1.6.16`,Oh={};function kh(){return typeof __HLS_WORKER_BUNDLE__==`function`}function Ah(){let e=Oh[Dh];if(e)return e.clientCount++,e;let t=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:`text/javascript`}),n=self.URL.createObjectURL(t),r={worker:new self.Worker(n),objectURL:n,clientCount:1};return Oh[Dh]=r,r}function jh(e){let t=Oh[e];if(t)return t.clientCount++,t;let n=new self.URL(e,self.location.href).href,r={worker:new self.Worker(n),scriptURL:n,clientCount:1};return Oh[e]=r,r}function Mh(e){let t=Oh[e||Dh];if(t&&t.clientCount--===1){let{worker:n,objectURL:r}=t;delete Oh[e||Dh],r&&self.URL.revokeObjectURL(r),n.terminate()}}function Nh(e,t){return t+10<=e.length&&e[t]===51&&e[t+1]===68&&e[t+2]===73&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function Ph(e,t){return t+10<=e.length&&e[t]===73&&e[t+1]===68&&e[t+2]===51&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function Fh(e,t){let n=0;return n=(e[t]&127)<<21,n|=(e[t+1]&127)<<14,n|=(e[t+2]&127)<<7,n|=e[t+3]&127,n}function Ih(e,t){let n=t,r=0;for(;Ph(e,t);){r+=10;let n=Fh(e,t+6);r+=n,Nh(e,t+10)&&(r+=10),t+=r}if(r>0)return e.subarray(n,n+r)}function Lh(e,t,n,r){let i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],a=t[n+2],o=a>>2&15;if(o>12){let t=Error(`invalid ADTS sampling index:${o}`);e.emit(q.ERROR,q.ERROR,{type:G.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message});return}let s=(a>>6&3)+1,c=t[n+3]>>6&3|(a&1)<<2,l=`mp4a.40.`+s,u=i[o],d=o;(s===5||s===29)&&(d-=3);let f=[s<<3|(d&14)>>1,(d&1)<<7|c<<3];return Qu.log(`manifest codec:${r}, parsed codec:${l}, channels:${c}, rate:${u} (ADTS object type:${s} sampling index:${o})`),{config:f,samplerate:u,channelCount:c,codec:l,parsedCodec:l,manifestCodec:r}}function Rh(e,t){return e[t]===255&&(e[t+1]&246)==240}function zh(e,t){return e[t+1]&1?7:9}function Bh(e,t){return(e[t+3]&3)<<11|e[t+4]<<3|(e[t+5]&224)>>>5}function Vh(e,t){return t+5<e.length}function Hh(e,t){return t+1<e.length&&Rh(e,t)}function Uh(e,t){return Vh(e,t)&&Rh(e,t)&&Bh(e,t)<=e.length-t}function Wh(e,t){if(Hh(e,t)){let n=zh(e,t);if(t+n>=e.length)return!1;let r=Bh(e,t);if(r<=n)return!1;let i=t+r;return i===e.length||Hh(e,i)}return!1}function Gh(e,t,n,r,i){if(!e.samplerate){let a=Lh(t,n,r,i);if(!a)return;zu(e,a)}}function Kh(e){return 1024*9e4/e}function qh(e,t){let n=zh(e,t);if(t+n<=e.length){let r=Bh(e,t)-n;if(r>0)return{headerLength:n,frameLength:r}}}function Jh(e,t,n,r,i){let a=r+i*Kh(e.samplerate),o=qh(t,n),s;if(o){let{frameLength:r,headerLength:i}=o,c=i+r,l=Math.max(0,n+c-t.length);l?(s=new Uint8Array(c-i),s.set(t.subarray(n+i,t.length),0)):s=t.subarray(n+i,n+c);let u={unit:s,pts:a};return l||e.samples.push(u),{sample:u,length:c,missing:l}}let c=t.length-n;return s=new Uint8Array(c),s.set(t.subarray(n,t.length),0),{sample:{unit:s,pts:a},length:c,missing:-1}}function Yh(e,t){return Ph(e,t)&&Fh(e,t+6)+10<=e.length-t}function Xh(e){return e instanceof ArrayBuffer?e:e.byteOffset==0&&e.byteLength==e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function Zh(e,t=0,n=1/0){return Qh(e,t,n,Uint8Array)}function Qh(e,t,n,r){let i=$h(e),a=1;`BYTES_PER_ELEMENT`in r&&(a=r.BYTES_PER_ELEMENT);let o=eg(e)?e.byteOffset:0,s=(o+e.byteLength)/a,c=(o+t)/a,l=Math.floor(Math.max(0,Math.min(c,s)));return new r(i,l,Math.floor(Math.min(l+Math.max(n,0),s))-l)}function $h(e){return e instanceof ArrayBuffer?e:e.buffer}function eg(e){return e&&e.buffer instanceof ArrayBuffer&&e.byteLength!==void 0&&e.byteOffset!==void 0}function tg(e){let t={key:e.type,description:``,data:``,mimeType:null,pictureType:null};if(e.size<2)return;if(e.data[0]!==3){console.log(`Ignore frame with unrecognized character encoding`);return}let n=e.data.subarray(1).indexOf(0);if(n===-1)return;let r=nd(Zh(e.data,1,n)),i=e.data[2+n],a=e.data.subarray(3+n).indexOf(0);if(a===-1)return;let o=nd(Zh(e.data,3+n,a)),s;return s=r===`-->`?nd(Zh(e.data,4+n+a)):Xh(e.data.subarray(4+n+a)),t.mimeType=r,t.pictureType=i,t.description=o,t.data=s,t}function ng(e){if(e.size<2)return;let t=nd(e.data,!0),n=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:n.buffer}}function rg(e){if(e.size<2)return;if(e.type===`TXXX`){let t=1,n=nd(e.data.subarray(t),!0);t+=n.length+1;let r=nd(e.data.subarray(t));return{key:e.type,info:n,data:r}}let t=nd(e.data.subarray(1));return{key:e.type,info:``,data:t}}function ig(e){if(e.type===`WXXX`){if(e.size<2)return;let t=1,n=nd(e.data.subarray(t),!0);t+=n.length+1;let r=nd(e.data.subarray(t));return{key:e.type,info:n,data:r}}let t=nd(e.data);return{key:e.type,info:``,data:t}}function ag(e){return e.type===`PRIV`?ng(e):e.type[0]===`W`?ig(e):e.type===`APIC`?tg(e):rg(e)}function og(e){let t=String.fromCharCode(e[0],e[1],e[2],e[3]),n=Fh(e,4);return{type:t,size:n,data:e.subarray(10,10+n)}}var sg=10,cg=10;function lg(e){let t=0,n=[];for(;Ph(e,t);){let r=Fh(e,t+6);e[t+5]>>6&1&&(t+=sg),t+=sg;let i=t+r;for(;t+cg<i;){let r=og(e.subarray(t)),i=ag(r);i&&n.push(i),t+=r.size+sg}Nh(e,t)&&(t+=sg)}return n}function ug(e){return e&&e.key===`PRIV`&&e.info===`com.apple.streaming.transportStreamTimestamp`}function dg(e){if(e.data.byteLength===8){let t=new Uint8Array(e.data),n=t[3]&1,r=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return r/=45,n&&(r+=47721858.84),Math.round(r)}}function fg(e){let t=lg(e);for(let e=0;e<t.length;e++){let n=t[e];if(ug(n))return dg(n)}}var pg=function(e){return e.audioId3=`org.id3`,e.dateRange=`com.apple.quicktime.HLS`,e.emsg=`https://aomedia.org/emsg/ID3`,e.misbklv=`urn:misb:KLV:bin:1910.1`,e}({});function mg(e=``,t=9e4){return{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}var hg=class{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,n,r){this._id3Track={type:`id3`,id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,n){}demux(e,t){this.cachedData&&=(e=Bd(this.cachedData,e),null);let n=Ih(e,0),r=n?n.length:0,i,a=this._audioTrack,o=this._id3Track,s=n?fg(n):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&W(s))&&(this.basePTS=gg(s,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:pg.audioId3,duration:1/0});r<c;){if(this.canParse(e,r)){let t=this.appendFrame(a,e,r);t?(this.frameIndex++,this.lastPTS=t.sample.pts,r+=t.length,i=r):r=c}else Yh(e,r)?(n=Ih(e,r),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:pg.audioId3,duration:1/0}),r+=n.length,i=r):r++;if(r===c&&i!==c){let t=e.slice(i);this.cachedData?this.cachedData=Bd(this.cachedData,t):this.cachedData=t}}return{audioTrack:a,videoTrack:mg(),id3Track:o,textTrack:mg()}}demuxSampleAes(e,t,n){return Promise.reject(Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){let t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:mg(),id3Track:this._id3Track,textTrack:mg()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}},gg=(e,t,n)=>{if(W(e))return e*90;let r=n?n.baseTime*9e4/n.timescale:0;return t*9e4+r},_g=null,vg=[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],yg=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],bg=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],xg=[0,1,1,4];function Sg(e,t,n,r,i){if(n+24>t.length)return;let a=Cg(t,n);if(a&&n+a.frameLength<=t.length){let o=r+i*(a.samplesPerFrame*9e4/a.sampleRate),s={unit:t.subarray(n,n+a.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(s),{sample:s,length:a.frameLength,missing:0}}}function Cg(e,t){let n=e[t+1]>>3&3,r=e[t+1]>>1&3,i=e[t+2]>>4&15,a=e[t+2]>>2&3;if(n!==1&&i!==0&&i!==15&&a!==3){let o=e[t+2]>>1&1,s=e[t+3]>>6,c=vg[(n===3?3-r:r===3?3:4)*14+i-1]*1e3,l=yg[(n===3?0:n===2?1:2)*3+a],u=s===3?1:2,d=bg[n][r],f=xg[r],p=d*8*f,m=Math.floor(d*c/l+o)*f;if(_g===null){let e=(navigator.userAgent||``).match(/Chrome\/(\d+)/i);_g=e?parseInt(e[1]):0}return _g&&_g<=87&&r===2&&c>=224e3&&s===0&&(e[t+3]=e[t+3]|128),{sampleRate:l,channelCount:u,frameLength:m,samplesPerFrame:p}}}function wg(e,t){return e[t]===255&&(e[t+1]&224)==224&&(e[t+1]&6)!=0}function Tg(e,t){return t+1<e.length&&wg(e,t)}function Eg(e,t){return wg(e,t)&&4<=e.length-t}function Dg(e,t){if(t+1<e.length&&wg(e,t)){let n=Cg(e,t),r=4;n!=null&&n.frameLength&&(r=n.frameLength);let i=t+r;return i===e.length||Tg(e,i)}return!1}var Og=class extends hg{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:`audio/adts`,type:`audio`,id:2,pid:-1,sequenceNumber:0,segmentCodec:`aac`,samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;let n=Ih(e,0)?.length||0;if(Dg(e,n))return!1;for(let r=e.length;n<r;n++)if(Wh(e,n))return t.log(`ADTS sync word found !`),!0;return!1}canParse(e,t){return Uh(e,t)}appendFrame(e,t,n){Gh(e,this.observer,t,n,e.manifestCodec);let r=Jh(e,t,n,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}},kg=(e,t)=>{let n=0,r=5;t+=r;let i=new Uint32Array(1),a=new Uint32Array(1),o=new Uint8Array(1);for(;r>0;){o[0]=e[t];let s=Math.min(r,8),c=8-s;a[0]=4278190080>>>24+c<<c,i[0]=(o[0]&a[0])>>c,n=n?n<<s|i[0]:i[0],t+=1,r-=s}return n},Ag=class extends hg{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:`audio/ac-3`,type:`audio`,id:2,pid:-1,sequenceNumber:0,segmentCodec:`ac3`,samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){let r=jg(e,t,n,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;let t=Ih(e,0);if(!t)return!1;let n=t.length;return e[n]===11&&e[n+1]===119&&fg(t)!==void 0&&kg(e,n)<16}};function jg(e,t,n,r,i){if(n+8>t.length||t[n]!==11||t[n+1]!==119)return-1;let a=t[n+4]>>6;if(a>=3)return-1;let o=[48e3,44100,32e3][a],s=t[n+4]&63,c=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][s*3+a]*2;if(n+c>t.length)return-1;let l=t[n+6]>>5,u=0;l===2?u+=2:(l&1&&l!==1&&(u+=2),l&4&&(u+=2));let d=(t[n+6]<<8|t[n+7])>>12-u&1,f=[2,1,2,3,3,4,4,5][l]+d,p=t[n+5]>>3,m=t[n+5]&7,h=new Uint8Array([a<<6|p<<1|m>>2,(m&3)<<6|l<<3|d<<2|s>>4,s<<4&224]),g=r+i*(1536/o*9e4),_=t.subarray(n,n+c);return e.config=h,e.channelCount=f,e.samplerate=o,e.samples.push({unit:_,pts:g}),c}var Mg=class extends hg{resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:`audio/mpeg`,type:`audio`,id:2,pid:-1,sequenceNumber:0,segmentCodec:`mp3`,samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let t=Ih(e,0),n=t?.length||0;if(t&&e[n]===11&&e[n+1]===119&&fg(t)!==void 0&&kg(e,n)<=16)return!1;for(let t=e.length;n<t;n++)if(Dg(e,n))return Qu.log(`MPEG Audio sync word found !`),!0;return!1}canParse(e,t){return Eg(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return Sg(e,t,n,this.basePTS,this.frameIndex)}},Ng=/\/emsg[-/]ID3/i,Pg=class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,n,r){let i=this.videoTrack=mg(`video`,1),a=this.audioTrack=mg(`audio`,1),o=this.txtTrack=mg(`text`,1);if(this.id3Track=mg(`id3`,1),this.timeOffset=0,!(e!=null&&e.byteLength))return;let s=Dd(e);if(s.video){let{id:e,timescale:t,codec:n,supplemental:r}=s.video;i.id=e,i.timescale=o.timescale=t,i.codec=n,i.supplemental=r}if(s.audio){let{id:e,timescale:t,codec:n}=s.audio;a.id=e,a.timescale=t,a.codec=n}o.id=bd.text,i.sampleDuration=0,i.duration=a.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return Td(e)}demux(e,t){this.timeOffset=t;let n=e,r=this.videoTrack,i=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=Bd(this.remainderData,e));let t=zd(n);this.remainderData=t.remainder,r.samples=t.valid||new Uint8Array}else r.samples=n;let a=this.extractID3Track(r,t);return i.samples=Vd(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){let e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;let r=this.extractID3Track(t,this.timeOffset);return n.samples=Vd(e,t),{videoTrack:t,audioTrack:mg(),id3Track:r,textTrack:mg()}}extractID3Track(e,t){let n=this.id3Track;if(e.samples.length){let r=Z(e.samples,[`emsg`]);r&&r.forEach(e=>{let r=Kd(e);if(Ng.test(r.schemeIdUri)){let e=Fg(r,t),i=r.eventDuration===4294967295?1/0:r.eventDuration/r.timeScale;i<=.001&&(i=1/0);let a=r.payload;n.samples.push({data:a,len:a.byteLength,dts:e,pts:e,type:pg.emsg,duration:i})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith(`urn:misb:KLV:bin:1910.1`)){let e=Fg(r,t);n.samples.push({data:r.payload,len:r.payload.byteLength,dts:e,pts:e,type:pg.misbklv,duration:1/0})}})}return n}demuxSampleAes(e,t,n){return Promise.reject(Error(`The MP4 demuxer does not support SAMPLE-AES decryption`))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}};function Fg(e,t){return W(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale}var Ig=class{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new Np(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Ep.cbc)}decryptAacSample(e,t,n){let r=e[t].unit;if(r.length<=16)return;let i=r.subarray(16,r.length-r.length%16),a=i.buffer.slice(i.byteOffset,i.byteOffset+i.length);this.decryptBuffer(a).then(i=>{let a=new Uint8Array(i);r.set(a,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,n)}).catch(n)}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length){n();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){let t=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(t),r=0;for(let t=32;t<e.length-16;t+=160,r+=16)n.set(e.subarray(t,t+16),r);return n}getAvcDecryptedUnit(e,t){let n=new Uint8Array(t),r=0;for(let t=32;t<e.length-16;t+=160,r+=16)e.set(n.subarray(r,r+16),t);return e}decryptAvcSample(e,t,n,r,i){let a=Gd(i.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then(o=>{i.data=this.getAvcDecryptedUnit(a,o),this.decrypter.isSync()||this.decryptAvcSamples(e,t,n+1,r)}).catch(r)}decryptAvcSamples(e,t,n,r){if(e instanceof Uint8Array)throw Error(`Cannot decrypt samples of type Uint8Array`);for(;;t++,n=0){if(t>=e.length){r();return}let i=e[t].units;for(;!(n>=i.length);n++){let a=i[n];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,n,r,a),!this.decrypter.isSync()))return}}}},Lg=class{constructor(){this.VideoSample=null}createVideoSample(e,t,n){return{key:e,frame:!1,pts:t,dts:n,units:[],length:0}}getLastNalUnit(e){var t;let n=this.VideoSample,r;if((!n||n.units.length===0)&&(n=e[e.length-1]),(t=n)!=null&&t.units){let e=n.units;r=e[e.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){let n=t.samples,r=n.length;if(r){let t=n[r-1];e.pts=t.pts,e.dts=t.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,n){let r=t.byteLength,i=e.naluState||0,a=i,o=[],s=0,c,l,u,d=-1,f=0;for(i===-1&&(d=0,f=this.getNALuType(t,0),i=0,s=1);s<r;){if(c=t[s++],!i){i=c?0:1;continue}if(i===1){i=c?0:2;continue}if(!c)i=3;else if(c===1){if(l=s-i-1,d>=0){let e={data:t.subarray(d,l),type:f};o.push(e)}else{let n=this.getLastNalUnit(e.samples);n&&(a&&s<=4-a&&n.state&&(n.data=n.data.subarray(0,n.data.byteLength-a)),l>0&&(n.data=Bd(n.data,t.subarray(0,l)),n.state=0))}s<r?(u=this.getNALuType(t,s),d=s,f=u,i=0):i=-1}else i=0}if(d>=0&&i>=0){let e={data:t.subarray(d,r),type:f,state:i};o.push(e)}if(o.length===0){let n=this.getLastNalUnit(e.samples);n&&(n.data=Bd(n.data,t))}return e.naluState=i,o}},Rg=class{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){let e=this.data,t=this.bytesAvailable,n=e.byteLength-t,r=new Uint8Array(4),i=Math.min(4,t);if(i===0)throw Error(`no bytes available`);r.set(e.subarray(n,n+i)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=i*8,this.bytesAvailable-=i}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e),n=this.word>>>32-t;if(e>32&&Qu.error(`Cannot read more than 32 bits at a time`),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw Error(`no bits available`);return t=e-t,t>0&&this.bitsAvailable?n<<t|this.readBits(t):n}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){let e=this.skipLZ();return this.readBits(e+1)-1}readEG(){let e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}},zg=class extends Lg{parsePES(e,t,n,r){let i=this.parseNALu(e,n.data,r),a=this.VideoSample,o,s=!1;n.data=null,a&&i.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),i.forEach(r=>{var i,c;switch(r.type){case 1:{let t=!1;o=!0;let i=r.data;if(s&&i.length>4){let e=this.readSliceType(i);(e===2||e===4||e===7||e===9)&&(t=!0)}if(t){var l;(l=a)!=null&&l.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts),a.frame=!0,a.key=t;break}case 5:o=!0,(i=a)!=null&&i.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts),a.key=!0,a.frame=!0;break;case 6:o=!0,Wd(r.data,1,n.pts,t.samples);break;case 7:{o=!0,s=!0;let t=r.data,n=this.readSPS(t);if(!e.sps||e.width!==n.width||e.height!==n.height||e.pixelRatio?.[0]!==n.pixelRatio[0]||e.pixelRatio?.[1]!==n.pixelRatio[1]){e.width=n.width,e.height=n.height,e.pixelRatio=n.pixelRatio,e.sps=[t];let r=t.subarray(1,4),i=`avc1.`;for(let e=0;e<3;e++){let t=r[e].toString(16);t.length<2&&(t=`0`+t),i+=t}e.codec=i}break}case 8:o=!0,e.pps=[r.data];break;case 9:o=!0,e.audFound=!0,(c=a)!=null&&c.frame&&(this.pushAccessUnit(a,e),a=null),a||=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts);break;case 12:o=!0;break;default:o=!1;break}a&&o&&a.units.push(r)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){let t=new Rg(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let n=8,r=8,i;for(let a=0;a<e;a++)r!==0&&(i=t.readEG(),r=(n+i+256)%256),n=r===0?n:r}readSPS(e){let t=new Rg(e),n=0,r=0,i=0,a=0,o,s,c,l=t.readUByte.bind(t),u=t.readBits.bind(t),d=t.readUEG.bind(t),f=t.readBoolean.bind(t),p=t.skipBits.bind(t),m=t.skipEG.bind(t),h=t.skipUEG.bind(t),g=this.skipScalingList.bind(this);l();let _=l();if(u(5),p(3),l(),h(),_===100||_===110||_===122||_===244||_===44||_===83||_===86||_===118||_===128){let e=d();if(e===3&&p(1),h(),h(),p(1),f())for(s=e===3?12:8,c=0;c<s;c++)f()&&g(c<6?16:64,t)}h();let v=d();if(v===0)d();else if(v===1)for(p(1),m(),m(),o=d(),c=0;c<o;c++)m();h(),p(1);let y=d(),b=d(),x=u(1);x===0&&p(1),p(1),f()&&(n=d(),r=d(),i=d(),a=d());let S=[1,1];if(f()&&f())switch(l()){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:S=[l()<<8|l(),l()<<8|l()];break}return{width:Math.ceil((y+1)*16-n*2-r*2),height:(2-x)*(b+1)*16-(x?2:4)*(i+a),pixelRatio:S}}},Bg=class extends Lg{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,n,r){let i=this.parseNALu(e,n.data,r),a=this.VideoSample,o,s=!1;n.data=null,a&&i.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),i.forEach(r=>{var i,c;switch(r.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts),a.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,s){var l;(l=a)!=null&&l.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts),a.key=!0,a.frame=!0;break;case 19:case 20:o=!0,(i=a)!=null&&i.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts),a.key=!0,a.frame=!0;break;case 39:o=!0,Wd(r.data,2,n.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!=`object`&&(e.params={}),e.params=zu(e.params,this.readVPS(r.data)),this.initVPS=r.data),e.vps=[r.data];break;case 33:if(o=!0,s=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],r.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){let t=this.readSPS(r.data);e.width=t.width,e.height=t.height,e.pixelRatio=t.pixelRatio,e.codec=t.codecString,e.sps=[],typeof e.params!=`object`&&(e.params={});for(let n in t.params)e.params[n]=t.params[n]}this.pushParameterSet(e.sps,r.data,e.vps),a||=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts),a.key=!0;break;case 34:if(o=!0,typeof e.params==`object`){if(!e.pps){e.pps=[];let t=this.readPPS(r.data);for(let n in t)e.params[n]=t[n]}this.pushParameterSet(e.pps,r.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(c=a)!=null&&c.frame&&(this.pushAccessUnit(a,e),a=null),a||=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts);break;default:o=!1;break}a&&o&&a.units.push(r)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,t,n){(n&&n[0]===this.initVPS||!n&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){let t=new Uint8Array(e.byteLength),n=0;for(let r=0;r<e.byteLength;r++)r>=2&&e[r]===3&&e[r-1]===0&&e[r-2]===0||(t[n]=e[r],n++);return new Uint8Array(t.buffer,0,n)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&=null}readVPS(e){let t=new Rg(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);let n=t.readBits(3),r=t.readBoolean();return{numTemporalLayers:n+1,temporalIdNested:r}}readSPS(e){let t=new Rg(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);let n=t.readBits(3);t.readBoolean();let r=t.readBits(2),i=t.readBoolean(),a=t.readBits(5),o=t.readUByte(),s=t.readUByte(),c=t.readUByte(),l=t.readUByte(),u=t.readUByte(),d=t.readUByte(),f=t.readUByte(),p=t.readUByte(),m=t.readUByte(),h=t.readUByte(),g=t.readUByte(),_=[],v=[];for(let e=0;e<n;e++)_.push(t.readBoolean()),v.push(t.readBoolean());if(n>0)for(let e=n;e<8;e++)t.readBits(2);for(let e=0;e<n;e++)_[e]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),v[e]&&t.readUByte();t.readUEG();let y=t.readUEG();y==3&&t.skipBits(1);let b=t.readUEG(),x=t.readUEG(),S=t.readBoolean(),C=0,w=0,T=0,E=0;S&&(C+=t.readUEG(),w+=t.readUEG(),T+=t.readUEG(),E+=t.readUEG());let D=t.readUEG(),O=t.readUEG(),k=t.readUEG(),A=t.readBoolean();for(let e=A?0:n;e<=n;e++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let e=0;e<4;e++)for(let n=0;n<(e===3?2:6);n++)if(!t.readBoolean())t.readUEG();else{let n=Math.min(64,1<<4+(e<<1));e>1&&t.readEG();for(let e=0;e<n;e++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());let j=t.readUEG(),M=0;for(let e=0;e<j;e++){let n=!1;if(e!==0&&(n=t.readBoolean()),n){e===j&&t.readUEG(),t.readBoolean(),t.readUEG();let n=0;for(let e=0;e<=M;e++){let e=t.readBoolean(),r=!1;e||(r=t.readBoolean()),(e||r)&&n++}M=n}else{let e=t.readUEG(),n=t.readUEG();M=e+n;for(let n=0;n<e;n++)t.readUEG(),t.readBoolean();for(let e=0;e<n;e++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){let e=t.readUEG();for(let n=0;n<e;n++){for(let e=0;e<k+4;e++)t.readBits(1);t.readBits(1)}}let N=0,ee=1,P=1,F=!0,te=1,ne=0;t.readBoolean(),t.readBoolean();let re=!1;if(t.readBoolean()){if(t.readBoolean()){let e=t.readUByte();e>0&&e<16?(ee=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][e-1],P=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][e-1]):e===255&&(ee=t.readBits(16),P=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),re=t.readBoolean(),re&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(te=t.readBits(32),ne=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){let e=t.readBoolean(),r=t.readBoolean(),i=!1;(e||r)&&(i=t.readBoolean(),i&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),i&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let a=0;a<=n;a++){F=t.readBoolean();let n=F||t.readBoolean(),a=!1;n?t.readEG():a=t.readBoolean();let o=a?1:t.readUEG()+1;if(e)for(let e=0;e<o;e++)t.readUEG(),t.readUEG(),i&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(r)for(let e=0;e<o;e++)t.readUEG(),t.readUEG(),i&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),N=t.readUEG())}let ie=b,ae=x;if(S){let e=1,t=1;y===1?e=t=2:y==2&&(e=2),ie=b-e*w-e*C,ae=x-t*E-t*T}let oe=r?[`A`,`B`,`C`][r]:``,se=o<<24|s<<16|c<<8|l,ce=0;for(let e=0;e<32;e++)ce=(ce|(se>>e&1)<<31-e)>>>0;let le=ce.toString(16);return a===1&&le===`2`&&(le=`6`),{codecString:`hvc1.${oe}${a}.${le}.${i?`H`:`L`}${g}.B0`,params:{general_tier_flag:i,general_profile_idc:a,general_profile_space:r,general_profile_compatibility_flags:[o,s,c,l],general_constraint_indicator_flags:[u,d,f,p,m,h],general_level_idc:g,bit_depth:D+8,bit_depth_luma_minus8:D,bit_depth_chroma_minus8:O,min_spatial_segmentation_idc:N,chroma_format_idc:y,frame_rate:{fixed:F,fps:ne/te}},width:ie,height:ae,pixelRatio:[ee,P]}}readPPS(e){let t=new Rg(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);let n=t.readBoolean(),r=t.readBoolean(),i=1;return r&&n?i=0:r?i=3:n&&(i=2),{parallelismType:i}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}},Vg=188,Hg=class e{constructor(e,t,n,r){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupp
vendor: 4,563 bytes, line 18
18orted=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.logger=r,this.videoParser=null}static probe(t,n){let r=e.syncOffset(t);return r>0&&n.warn(`MPEG2-TS detected but first sync word found @ offset ${r}`),r!==-1}static syncOffset(e){let t=e.length,n=Math.min(Vg*5,t-Vg)+1,r=0;for(;r<n;){let i=!1,a=-1,o=0;for(let s=r;s<t;s+=Vg)if(e[s]===71&&(t-s===Vg||e[s+Vg]===71)){if(o++,a===-1&&(a=s,a!==0&&(n=Math.min(a+Vg*99,e.length-Vg)+1)),i||=Ug(e,s)===0,i&&o>1&&(a===0&&o>2||s+Vg>n))return a}else if(o)return-1;else break;r++}return-1}static createTrack(e,t){return{container:e===`video`||e===`audio`?`video/mp2t`:void 0,type:e,id:bd[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e===`audio`?t:void 0}}resetInitSegment(t,n,r,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack(`video`),this._videoTrack.duration=i,this._audioTrack=e.createTrack(`audio`,i),this._id3Track=e.createTrack(`id3`),this._txtTrack=e.createTrack(`text`),this._audioTrack.segmentCodec=`aac`,this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=n,this.videoCodec=r}resetTimeStamp(){}resetContiguity(){let{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(t,n,r=!1,i=!1){r||(this.sampleAes=null);let a,o=this._videoTrack,s=this._audioTrack,c=this._id3Track,l=this._txtTrack,u=o.pid,d=o.pesData,f=s.pid,p=c.pid,m=s.pesData,h=c.pesData,g=null,_=this.pmtParsed,v=this._pmtId,y=t.length;if(this.remainderData&&=(t=Bd(this.remainderData,t),y=t.length,null),y<Vg&&!i)return this.remainderData=t,{audioTrack:s,videoTrack:o,id3Track:c,textTrack:l};let b=Math.max(0,e.syncOffset(t));y-=(y-b)%Vg,y<t.byteLength&&!i&&(this.remainderData=new Uint8Array(t.buffer,y,t.buffer.byteLength-y));let x=0;for(let e=b;e<y;e+=Vg)if(t[e]===71){let n=!!(t[e+1]&64),i=Ug(t,e),y=(t[e+3]&48)>>4,x;if(y>1){if(x=e+5+t[e+4],x===e+Vg)continue}else x=e+4;switch(i){case u:n&&(d&&(a=Jg(d,this.logger))&&(this.readyVideoParser(o.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(o,l,a,!1)),d={data:[],size:0}),d&&(d.data.push(t.subarray(x,e+Vg)),d.size+=e+Vg-x);break;case f:if(n){if(m&&(a=Jg(m,this.logger)))switch(s.segmentCodec){case`aac`:this.parseAACPES(s,a);break;case`mp3`:this.parseMPEGPES(s,a);break;case`ac3`:this.parseAC3PES(s,a);break}m={data:[],size:0}}m&&(m.data.push(t.subarray(x,e+Vg)),m.size+=e+Vg-x);break;case p:n&&(h&&(a=Jg(h,this.logger))&&this.parseID3PES(c,a),h={data:[],size:0}),h&&(h.data.push(t.subarray(x,e+Vg)),h.size+=e+Vg-x);break;case 0:n&&(x+=t[x]+1),v=this._pmtId=Wg(t,x);break;case v:{n&&(x+=t[x]+1);let i=Gg(t,x,this.typeSupported,r,this.observer,this.logger);u=i.videoPid,u>0&&(o.pid=u,o.segmentCodec=i.segmentVideoCodec),f=i.audioPid,f>0&&(s.pid=f,s.segmentCodec=i.segmentAudioCodec),p=i.id3Pid,p>0&&(c.pid=p),g!==null&&!_&&(this.logger.warn(`MPEG-TS PMT found at ${e} after unknown PID '${g}'. Backtracking to sync byte @${b} to parse all TS packets.`),g=null,e=b-188),_=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=i;break}}else x++;x>0&&Kg(this.observer,Error(`Found ${x} TS packet/s that do not start with 0x47`),void 0,this.logger),o.pesData=d,s.pesData=m,c.pesData=h;let S={audioTrack:s,videoTrack:o,id3Track:c,textTrack:l};return i&&this.extractRemainingSamples(S),S}flush(){let{remainderData:e}=this;this.remainderData=null;let t;return t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){let{audioTrack:t,videoTrack:n,id3Track:r,textTrack:i}=e,a=n.pesData,o=t.pesData,s=r.pesData,c;if(a&&(c=Jg(a,this.logger))?(this.readyVideoParser(n.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(n,i,c,!0),n.pesData=null)):n.pesData=a,o&&(c=Jg(o,this.logger))){switch(t.segmentCodec){case`aac`:this.parseAACPES(t,c);break;case`mp3`:this.parseMPEGPES(t,c);break;case`ac3`:this.parseAC3PES(t,c);break}t.pesData=null}else o!=null&&o.size&&this.logger.log(`last AAC PES packet truncated,might overlap between fragments`),t.pesData=o;s&&(c=Jg(s,this.logger))?(this.parseID3PES(r,c),r.pesData=null):r.pesData=s}
vendor: 24,430 bytes, line 18
18demuxSampleAes(e,t,n){let r=this.demux(e,n,!0,!this.config.progressive),i=this.sampleAes=new Ig(this.observer,this.config,t);return this.decrypt(r,i)}readyVideoParser(e){this.videoParser===null&&(e===`avc`?this.videoParser=new zg:e===`hevc`&&(this.videoParser=new Bg))}decrypt(e,t){return new Promise(n=>{let{audioTrack:r,videoTrack:i}=e;r.samples&&r.segmentCodec===`aac`?t.decryptAacSamples(r.samples,0,()=>{i.samples?t.decryptAvcSamples(i.samples,0,0,()=>{n(e)}):n(e)}):i.samples&&t.decryptAvcSamples(i.samples,0,0,()=>{n(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let n=0,r=this.aacOverFlow,i=t.data;if(r){this.aacOverFlow=null;let t=r.missing,a=r.sample.unit.byteLength;if(t===-1)i=Bd(r.sample.unit,i);else{let o=a-t;r.sample.unit.set(i.subarray(0,t),o),e.samples.push(r.sample),n=r.missing}}let a,o;for(a=n,o=i.length;a<o-1&&!Hh(i,a);a++);if(a!==n){let e,t=a<o-1;if(e=t?`AAC PES did not start with ADTS header,offset:${a}`:`No ADTS header found in AAC PES`,Kg(this.observer,Error(e),t,this.logger),!t)return}Gh(e,this.observer,i,a,this.audioCodec);let s;if(t.pts!==void 0)s=t.pts;else if(r){let t=Kh(e.samplerate);s=r.sample.pts+t}else{this.logger.warn(`[tsdemuxer]: AAC PES unknown PTS`);return}let c=0,l;for(;a<o;)if(l=Jh(e,i,a,s,c),a+=l.length,l.missing){this.aacOverFlow=l;break}else for(c++;a<o-1&&!Hh(i,a);a++);}parseMPEGPES(e,t){let n=t.data,r=n.length,i=0,a=0,o=t.pts;if(o===void 0){this.logger.warn(`[tsdemuxer]: MPEG PES unknown PTS`);return}for(;a<r;)if(Tg(n,a)){let t=Sg(e,n,a,o,i);if(t)a+=t.length,i++;else break}else a++}parseAC3PES(e,t){{let n=t.data,r=t.pts;if(r===void 0){this.logger.warn(`[tsdemuxer]: AC3 PES unknown PTS`);return}let i=n.length,a=0,o=0,s;for(;o<i&&(s=jg(e,n,o,r,a++))>0;)o+=s}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn(`[tsdemuxer]: ID3 PES unknown PTS`);return}let n=zu({},t,{type:this._videoTrack?pg.emsg:pg.audioId3,duration:1/0});e.samples.push(n)}};function Ug(e,t){return((e[t+1]&31)<<8)+e[t+2]}function Wg(e,t){return(e[t+10]&31)<<8|e[t+11]}function Gg(e,t,n,r,i,a){let o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:`avc`,segmentAudioCodec:`aac`},s=(e[t+1]&15)<<8|e[t+2],c=t+3+s-4,l=(e[t+10]&15)<<8|e[t+11];for(t+=12+l;t<c;){let s=Ug(e,t),c=(e[t+3]&15)<<8|e[t+4];switch(e[t]){case 207:if(!r){qg(`ADTS AAC`,a);break}case 15:o.audioPid===-1&&(o.audioPid=s);break;case 21:o.id3Pid===-1&&(o.id3Pid=s);break;case 219:if(!r){qg(`H.264`,a);break}case 27:o.videoPid===-1&&(o.videoPid=s);break;case 3:case 4:!n.mpeg&&!n.mp3?a.log(`MPEG audio found, not supported in this browser`):o.audioPid===-1&&(o.audioPid=s,o.segmentAudioCodec=`mp3`);break;case 193:if(!r){qg(`AC-3`,a);break}case 129:n.ac3?o.audioPid===-1&&(o.audioPid=s,o.segmentAudioCodec=`ac3`):a.log(`AC-3 audio found, not supported in this browser`);break;case 6:if(o.audioPid===-1&&c>0){let r=t+5,i=c;for(;i>2;){switch(e[r]){case 106:n.ac3===!0?(o.audioPid=s,o.segmentAudioCodec=`ac3`):a.log(`AC-3 audio found, not supported in this browser for now`);break}let t=e[r+1]+2;r+=t,i-=t}}break;case 194:case 135:return Kg(i,Error(`Unsupported EC-3 in M2TS found`),void 0,a),o;case 36:o.videoPid===-1&&(o.videoPid=s,o.segmentVideoCodec=`hevc`,a.log(`HEVC in M2TS found`));break}t+=c+5}return o}function Kg(e,t,n,r){r.warn(`parsing error: ${t.message}`),e.emit(q.ERROR,q.ERROR,{type:G.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,levelRetry:n,error:t,reason:t.message})}function qg(e,t){t.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function Jg(e,t){let n=0,r,i,a,o,s,c=e.data;if(!e||e.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=Bd(c[0],c[1]),c.splice(1,1);if(r=c[0],(r[0]<<16)+(r[1]<<8)+r[2]===1){if(i=(r[4]<<8)+r[5],i&&i>e.size-6)return null;let l=r[7];l&192&&(o=(r[9]&14)*536870912+(r[10]&255)*4194304+(r[11]&254)*16384+(r[12]&255)*128+(r[13]&254)/2,l&64?(s=(r[14]&14)*536870912+(r[15]&255)*4194304+(r[16]&254)*16384+(r[17]&255)*128+(r[18]&254)/2,o-s>60*9e4&&(t.warn(`${Math.round((o-s)/9e4)}s delta between PTS and DTS, align them`),o=s)):s=o),a=r[8];let u=a+9;if(e.size<=u)return null;e.size-=u;let d=new Uint8Array(e.size);for(let e=0,t=c.length;e<t;e++){r=c[e];let t=r.byteLength;if(u)if(u>t){u-=t;continue}else r=r.subarray(u),t-=u,u=0;d.set(r,n),n+=t}return i&&(i-=a+3),{data:d,pts:o,dts:s,len:i}}return null}var Yg=class{static getSilentFrame(e,t){switch(e){case`mp4a.40.2`:if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2||t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}},Xg=2**32-1,Zg=class e{static init(){e.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let t;for(t in e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);e.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])};let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);e.STTS=e.STSC=e.STCO=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);let r=new Uint8Array([105,115,111,109]),i=new Uint8Array([97,118,99,49]),a=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,r,a,r,i),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,n))}static box(e,...t){let n=8,r=t.length,i=r;for(;r--;)n+=t[r].byteLength;let a=new Uint8Array(n);for(a[0]=n>>24&255,a[1]=n>>16&255,a[2]=n>>8&255,a[3]=n&255,a.set(e,4),r=0,n=8;r<i;r++)a.set(t[r],n),n+=t[r].byteLength;return a}static hdlr(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}static mdat(t){return e.box(e.types.mdat,t)}static mdhd(t,n){n*=t;let r=Math.floor(n/(Xg+1)),i=Math.floor(n%(Xg+1));return e.box(e.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,r>>24,r>>16&255,r>>8&255,r&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(t){return e.box(e.types.mdia,e.mdhd(t.timescale||0,t.duration||0),e.hdlr(t.type),e.minf(t))}static mfhd(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255]))}static minf(t){return t.type===`audio`?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}static moof(t,n,r){return e.box(e.types.moof,e.mfhd(t),e.traf(r,n))}static moov(t){let n=t.length,r=[];for(;n--;)r[n]=e.trak(t[n]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale||0,t[0].duration||0)].concat(r,e.mvex(t)))}static mvex(t){let n=t.length,r=[];for(;n--;)r[n]=e.trex(t[n]);return e.box.apply(null,[e.types.mvex,...r])}static mvhd(t,n){n*=t;let r=Math.floor(n/(Xg+1)),i=Math.floor(n%(Xg+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,r>>24,r>>16&255,r>>8&255,r&255,i>>24,i>>16&255,i>>8&255,i&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,a)}static sdtp(t){let n=t.samples||[],r=new Uint8Array(4+n.length),i,a;for(i=0;i<n.length;i++)a=n[i].flags,r[i+4]=a.dependsOn<<4|a.isDependedOn<<2|a.hasRedundancy;return e.box(e.types.sdtp,r)}static stbl(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))}static avc1(t){let n=[],r=[],i,a,o;for(i=0;i<t.sps.length;i++)a=t.sps[i],o=a.byteLength,n.push(o>>>8&255),n.push(o&255),n=n.concat(Array.prototype.slice.call(a));for(i=0;i<t.pps.length;i++)a=t.pps[i],o=a.byteLength,r.push(o>>>8&255),r.push(o&255),r=r.concat(Array.prototype.slice.call(a));let s=e.box(e.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|t.sps.length].concat(n,[t.pps.length],r))),c=t.width,l=t.height,u=t.pixelRatio[0],d=t.pixelRatio[1];return e.box(e.types.avc1,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,c>>8&255,c&255,l>>8&255,l&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),s,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,d>>24,d>>16&255,d>>8&255,d&255])))}static esds(e){let t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){let t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(t){return e.box(e.types.mp4a,e.audioStsd(t),e.box(e.types.esds,e.esds(t)))}static mp3(t){return e.box(e.types[`.mp3`],e.audioStsd(t))}static ac3(t){return e.box(e.types[`ac-3`],e.audioStsd(t),e.box(e.types.dac3,t.config))}static stsd(t){let{segmentCodec:n}=t;if(t.type===`audio`){if(n===`aac`)return e.box(e.types.stsd,e.STSD,e.mp4a(t));if(n===`ac3`&&t.config)return e.box(e.types.stsd,e.STSD,e.ac3(t));if(n===`mp3`&&t.codec===`mp3`)return e.box(e.types.stsd,e.STSD,e.mp3(t))}else if(t.pps&&t.sps){if(n===`avc`)return e.box(e.types.stsd,e.STSD,e.avc1(t));if(n===`hevc`&&t.vps)return e.box(e.types.stsd,e.STSD,e.hvc1(t))}else throw Error(`video track missing pps or sps`);throw Error(`unsupported ${t.type} segment codec (${n}/${t.codec})`)}static tkhd(t){let n=t.id,r=(t.duration||0)*(t.timescale||0),i=t.width||0,a=t.height||0,o=Math.floor(r/(Xg+1)),s=Math.floor(r%(Xg+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,n&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,s>>24,s>>16&255,s>>8&255,s&255,0,0,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,i&255,0,0,a>>8&255,a&255,0,0]))}static traf(t,n){let r=e.sdtp(t),i=t.id,a=Math.floor(n/(Xg+1)),o=Math.floor(n%(Xg+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255])),e.trun(t,r.length+16+20+8+16+8+8),r)}static trak(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}static trex(t){let n=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(t,n){let r=t.samples||[],i=r.length,a=12+16*i,o=new Uint8Array(a),s,c,l,u,d,f;for(n+=8+a,o.set([t.type===`video`?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255],0),s=0;s<i;s++)c=r[s],l=c.duration,u=c.size,d=c.flags,f=c.cts,o.set([l>>>24&255,l>>>16&255,l>>>8&255,l&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,d.degradPrio&61440,d.degradPrio&15,f>>>24&255,f>>>16&255,f>>>8&255,f&255],12+16*s);return e.box(e.types.trun,o)}static initSegment(t){e.types||e.init();let n=e.moov(t);return Bd(e.FTYP,n)}static hvc1(t){let n=t.params,r=[t.vps,t.sps,t.pps],i=new Uint8Array([1,n.general_profile_space<<6|(n.general_tier_flag?32:0)|n.general_profile_idc,n.general_profile_compatibility_flags[0],n.general_profile_compatibility_flags[1],n.general_profile_compatibility_flags[2],n.general_profile_compatibility_flags[3],n.general_constraint_indicator_flags[0],n.general_constraint_indicator_flags[1],n.general_constraint_indicator_flags[2],n.general_constraint_indicator_flags[3],n.general_constraint_indicator_flags[4],n.general_constraint_indicator_flags[5],n.general_level_idc,240|n.min_spatial_segmentation_idc>>8,255&n.min_spatial_segmentation_idc,252|n.parallelismType,252|n.chroma_format_idc,248|n.bit_depth_luma_minus8,248|n.bit_depth_chroma_minus8,0,parseInt(n.frame_rate.fps),3|n.temporal_id_nested<<2|n.num_temporal_layers<<3|(n.frame_rate.fixed?64:0),r.length]),a=i.length;for(let e=0;e<r.length;e+=1){a+=3;for(let t=0;t<r[e].length;t+=1)a+=2+r[e][t].length}let o=new Uint8Array(a);o.set(i,0),a=i.length;let s=r.length-1;for(let e=0;e<r.length;e+=1){o.set(new Uint8Array([32+e|(e===s?128:0),0,r[e].length]),a),a+=3;for(let t=0;t<r[e].length;t+=1)o.set(new Uint8Array([r[e][t].length>>8,r[e][t].length&255]),a),a+=2,o.set(r[e][t],a),a+=r[e][t].length}let c=e.box(e.types.hvcC,o),l=t.width,u=t.height,d=t.pixelRatio[0],f=t.pixelRatio[1];return e.box(e.types.hvc1,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,l>>8&255,l&255,u>>8&255,u&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),c,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,f>>24,f>>16&255,f>>8&255,f&255])))}};Zg.types=void 0,Zg.HDLR_TYPES=void 0,Zg.STTS=void 0,Zg.STSC=void 0,Zg.STCO=void 0,Zg.STSZ=void 0,Zg.VMHD=void 0,Zg.SMHD=void 0,Zg.STSD=void 0,Zg.FTYP=void 0,Zg.DINF=void 0;var Qg=9e4;function $g(e,t,n=1,r=!1){let i=e*t*n;return r?Math.round(i):i}function e_(e,t,n=1,r=!1){return $g(e,t,1/n,r)}function t_(e,t=!1){return $g(e,1e3,1/Qg,t)}function n_(e,t=1){return $g(e,Qg,1/t)}function r_(e){let{baseTime:t,timescale:n,trackId:r}=e;return`${t/n} (${t}/${n}) trackId: ${r}`}var i_=10*1e3,a_=1024,o_=1152,s_=1536,c_=null,l_=null;function u_(e,t,n,r){return{duration:t,size:n,cts:r,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}var d_=class extends Wu{constructor(e,t,n,r){if(super(`mp4-remuxer`,r),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.ISGenerated=!1,c_===null){let e=(navigator.userAgent||``).match(/Chrome\/(\d+)/i);c_=e?parseInt(e[1]):0}if(l_===null){let e=navigator.userAgent.match(/Safari\/(\d+)/i);l_=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){let t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&r_(t)} > ${e&&r_(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log(`reset next timestamp`),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log(`ISGenerated flag reset`),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1,n=e[0].pts,r=e.reduce((e,r)=>{let i=r.pts,a=i-e;return a<-4294967296&&(t=!0,i=f_(i,n),a=i-e),a>0?e:i},n);return t&&this.debug(`PTS rollover detected`),r}remux(e,t,n,r,i,a,o,s){let c,l,u,d,f,p,m=i,h=i,g=e.pid>-1,_=t.pid>-1,v=t.samples.length,y=e.samples.length>0,b=o&&v>0||v>1;if((!g||y)&&(!_||b)||this.ISGenerated||o){if(this.ISGenerated){let e=this.videoTrackConfig;(e&&(t.width!==e.width||t.height!==e.height||t.pixelRatio?.[0]!==e.pixelRatio?.[0]||t.pixelRatio?.[1]!==e.pixelRatio?.[1])||!e&&b||this.nextAudioTs===null&&y)&&this.resetInitSegment()}this.ISGenerated||(u=this.generateIS(e,t,i,a));let n=this.isVideoContiguous,r=-1,o;if(b&&(r=p_(t.samples),!n&&this.config.forceKeyFrameOnDiscontinuity))if(p=!0,r>0){this.warn(`Dropped ${r} out of ${v} video samples due to a missing keyframe`);let e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(r),t.dropped+=r,h+=(t.samples[0].pts-e)/t.inputTimeScale,o=h}else r===-1&&(this.warn(`No keyframe found out of ${v} video samples`),p=!1);if(this.ISGenerated){if(y&&b){let n=this.getVideoStartPts(t.samples),r=(f_(e.samples[0].pts,n)-n)/t.inputTimeScale;m+=Math.max(0,r),h+=Math.max(0,-r)}if(y){if(e.samplerate||(this.warn(`regenerate InitSegment as audio detected`),u=this.generateIS(e,t,i,a)),l=this.remuxAudio(e,m,this.isAudioContiguous,a,_||b||s===Y.AUDIO?h:void 0),b){let r=l?l.endPTS-l.startPTS:0;t.inputTimeScale||(this.warn(`regenerate InitSegment as video detected`),u=this.generateIS(e,t,i,a)),c=this.remuxVideo(t,h,n,r)}}else b&&(c=this.remuxVideo(t,h,n,0));c&&(c.firstKeyFrame=r,c.independent=r!==-1,c.firstKeyFramePTS=o)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(f=m_(n,i,this._initPTS,this._initDTS)),r.samples.length&&(d=h_(r,i,this._initPTS))),{audio:l,video:c,initSegment:u,independent:p,text:d,id3:f}}computeInitPts(e,t,n,r){let i=Math.round(n*t),a=f_(e,i);if(a<i+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(i-a)/t} ${r}`);a<i+t;)a+=8589934592;return a-i}generateIS(e,t,n,r){let i=e.samples,a=t.samples,o=this.typeSupported,s={},c=this._initPTS,l=!c||r,u=`audio/mp4`,d,f,p,m=-1;if(l&&(d=f=1/0),e.config&&i.length){switch(e.timescale=e.samplerate,e.segmentCodec){case`mp3`:o.mpeg?(u=`audio/mpeg`,e.codec=``):o.mp3&&(e.codec=`mp3`);break;case`ac3`:e.codec=`ac-3`;break}s.audio={id:`audio`,container:u,codec:e.codec,initSegment:e.segmentCodec===`mp3`&&o.mpeg?new Uint8Array:Zg.initSegment([e]),metadata:{channelCount:e.channelCount}},l&&(m=e.id,p=e.inputTimeScale,!c||p!==c.timescale?d=f=this.computeInitPts(i[0].pts,p,n,`audio`):l=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,s.video={id:`main`,container:`video/mp4`,codec:t.codec,initSegment:Zg.initSegment([t]),metadata:{width:t.width,height:t.height}},l)if(m=t.id,p=t.inputTimeScale,!c||p!==c.timescale){let e=this.getVideoStartPts(a),t=f_(a[0].dts,e),r=this.computeInitPts(t,p,n,`video`),i=this.computeInitPts(e,p,n,`video`);f=Math.min(f,r),d=Math.min(d,i)}else l=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(s).length)return this.ISGenerated=!0,l?(c&&this.warn(`Timestamps at playlist time: ${r?``:`~`}${n} ${d/p} != initPTS: ${c.baseTime/c.timescale} (${c.baseTime}/${c.timescale}) trackId: ${c.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${d/p} (${d}/${p}) trackId: ${m}`),this._initPTS={baseTime:d,timescale:p,trackId:m},this._initDTS={baseTime:f,timescale:p,trackId:m}):d=p=void 0,{tracks:s,initPTS:d,timescale:p,trackId:m}}remuxVideo(e,t,n,r){let i=e.inputTimeScale,a=e.samples,o=[],s=a.length,c=this._initPTS,l=c.baseTime*i/c.timescale,u=this.nextVideoTs,d=8,f=this.videoSampleDuration,p,m,h=1/0,g=-1/0,_=!1;if(!n||u===null){let e=l+t*i,r=a[0].pts-f_(a[0].dts,a[0].pts);c_&&u!==null&&Math.abs(e-r-(u+l))<15e3?n=!0:u=e-r-l}let v=u+l;for(let e=0;e<s;e++){let t=a[e];t.pts=f_(t.pts,v),t.dts=f_(t.dts,v),t.dts<a[e>0?e-1:e].dts&&(_=!0)}_&&a.sort(function(e,t){let n=e.dts-t.dts,r=e.pts-t.pts;return n||r}),p=a[0].dts,m=a[a.length-1].dts;let y=m-p,b=y?Math.round(y/(s-1)):f||e.inputTimeScale/30;if(n){let n=p-v,r=n>b,i=n<-1;if((r||i)&&(r?this.warn(`${(e.segmentCodec||``).toUpperCase()}: ${t_(n,!0)} ms (${n}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||``).toUpperCase()}: ${t_(-n,!0)} ms (${n}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!i||v>=a[0].pts||c_)){p=v;let e=a[0].pts-n;if(r)a[0].dts=p,a[0].pts=e;else{let t=!0;for(let r=0;r<a.length&&!(a[r].dts>e&&t);r++){let e=a[r].pts;if(a[r].dts-=n,a[r].pts-=n,r<a.length-1){let n=a[r+1].pts;t=n<=a[r].pts==n<=e}}}this.log(`Video: Initial PTS/DTS adjusted: ${t_(e,!0)}/${t_(p,!0)}, delta: ${t_(n,!0)} ms`)}}p=Math.max(0,p);let x=0,S=0,C=p;for(let e=0;e<s;e++){let t=a[e],n=t.units,r=n.length,i=0;for(let e=0;e<r;e++)i+=n[e].data.length;S+=i,x+=r,t.length=i,t.dts<C?(t.dts=C,C+=b/4|0||1):C=t.dts,h=Math.min(t.pts,h),g=Math.max(t.pts,g)}m=a[s-1].dts;let w=S+4*x+8,T;try{T=new Uint8Array(w)}catch(e){this.observer.emit(q.ERROR,q.ERROR,{type:G.MUX_ERROR,details:K.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:w,reason:`fail allocating video mdat ${w}`});return}let E=new DataView(T.buffer);E.setUint32(0,w),T.set(Zg.types.mdat,4);let D=!1,O=1/0,k=1/0,A=-1/0,j=-1/0;for(let e=0;e<s;e++){let t=a[e],n=t.units,c=0;for(let e=0,t=n.length;e<t;e++){let t=n[e],r=t.data,i=t.data.byteLength;E.setUint32(d,i),d+=4,T.set(r,d),d+=i,c+=4+i}let u;if(e<s-1)f=a[e+1].dts-t.dts,u=a[e+1].pts-t.pts;else{let n=this.config,o=e>0?t.dts-a[e-1].dts:b;if(u=e>0?t.pts-a[e-1].pts:b,n.stretchShortVideoTrack&&this.nextAudioTs!==null){let e=Math.floor(n.maxBufferHole*i),a=(r?h+r*i:this.nextAudioTs+l)-t.pts;a>e?(f=a-o,f<0?f=o:D=!0,this.log(`It is approximately ${a/90} ms to the next segment; using duration ${f/90} ms for the last video frame.`)):f=o}else f=o}let p=Math.round(t.pts-t.dts);O=Math.min(O,f),A=Math.max(A,f),k=Math.min(k,u),j=Math.max(j,u),o.push(u_(t.key,f,c,p))}if(o.length){if(c_){if(c_<70){let e=o[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(l_&&j-k<A-O&&b/A<.025&&o[0].cts===0){this.warn(`Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.`);let e=p;for(let t=0,n=o.length;t<n;t++){let r=e+o[t].duration,i=e+o[t].cts;if(t<n-1){let e=r+o[t+1].cts;o[t].duration=e-i}else o[t].duration=t?o[t-1].duration:b;o[t].cts=0,e=r}}}f=D||!f?b:f,this.nextVideoTs=u=m+f-l,this.videoSampleDuration=f,this.isVideoContiguous=!0;let M={data1:Zg.moof(e.sequenceNumber++,p,zu(e,{samples:o})),data2:T,startPTS:(h-l)/i,endPTS:(g+f-l)/i,startDTS:(p-l)/i,endDTS:u/i,type:`video`,hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,M}getSamplesPerFrame(e){switch(e.segmentCodec){case`mp3`:return o_;case`ac3`:return s_;default:return a_}}remuxAudio(e,t,n,r,i){let a=e.inputTimeScale,o=a/(e.samplerate?e.samplerate:a),s=this.getSamplesPerFrame(e),c=s*o,l=this._initPTS,u=e.segmentCodec===`mp3`&&this.typeSupported.mpeg,d=[],f=i!==void 0,p=e.samples,m=u?0:8,h=this.nextAudioTs||-1,g=l.baseTime*a/l.timescale,_=g+t*a;if(this.isAudioContiguous=n||=p.length&&h>0&&(r&&Math.abs(_-(h+g))<9e3||Math.abs(f_(p[0].pts,_)-(h+g))<20*c),p.forEach(function(e){e.pts=f_(e.pts,_)}),!n||h<0){let e=p.length;if(p=p.filter(e=>e.pts>=0),e!==p.length&&this.warn(`Removed ${p.length-e} of ${e} samples (initPTS ${g} / ${a})`),!p.length)return;h=i===0?0:r&&!f?Math.max(0,_-g):p[0].pts-g}if(e.segmentCodec===`aac`){let t=this.config.maxAudioFramesDrift;for(let n=0,r=h+g;n<p.length;n++){let i=p[n],o=i.pts,s=o-r,l=Math.abs(1e3*s/a);if(s<=-t*c&&f)n===0&&(this.warn(`Audio frame @ ${(o/a).toFixed(3)}s overlaps marker by ${Math.round(1e3*s/a)} ms.`),this.nextAudioTs=h=o-g,r=o);else if(s>=t*c&&l<i_&&f){let t=Math.round(s/c);for(r=o-t*c;r<0&&t&&c;)t--,r+=c;n===0&&(this.nextAudioTs=h=r-g),this.warn(`Injecting ${t} audio frames @ ${((r-g)/a).toFixed(3)}s due to ${Math.round(1e3*s/a)} ms gap.`);for(let a=0;a<t;a++){let t=Yg.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);t||=(this.log(`Unable to get silent frame for given audio codec; duplicating last frame instead.`),i.unit.subarray()),p.splice(n,0,{unit:t,pts:r}),r+=c,n++}}i.pts=r,r+=c}}let v=null,y=null,b,x=0,S=p.length;for(;S--;)x+=p[S].unit.byteLength;for(let t=0,r=p.length;t<r;t++){let r=p[t],i=r.unit,a=r.pts;if(y!==null){let e=d[t-1];e.duration=Math.round((a-y)/o)}else if(n&&e.segmentCodec===`aac`&&(a=h+g),v=a,x>0){x+=m;
18try{b=new Uint8Array(x)}catch(e){this.observer.emit(q.ERROR,q.ERROR,{type:G.MUX_ERROR,details:K.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:x,reason:`fail allocating audio mdat ${x}`});return}u||(new DataView(b.buffer).setUint32(0,x),b.set(Zg.types.mdat,4))}else return;b.set(i,m);let c=i.byteLength;m+=c,d.push(u_(!0,s,c,0)),y=a}let C=d.length;if(!C)return;let w=d[d.length-1];h=y-g,this.nextAudioTs=h+o*w.duration;let T=u?new Uint8Array:Zg.moof(e.sequenceNumber++,v/o,zu({},e,{samples:d}));e.samples=[];let E=(v-g)/a,D=this.nextAudioTs/a,O={data1:T,data2:b,startPTS:E,endPTS:D,startDTS:E,endDTS:D,type:`audio`,hasAudio:!0,hasVideo:!1,nb:C};return this.isAudioContiguous=!0,O}};function f_(e,t){let n;if(t===null)return e;for(n=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=n;return e}function p_(e){for(let t=0;t<e.length;t++)if(e[t].key)return t;return-1}function m_(e,t,n,r){let i=e.samples.length;if(!i)return;let a=e.inputTimeScale;for(let o=0;o<i;o++){let i=e.samples[o];i.pts=f_(i.pts-n.baseTime*a/n.timescale,t*a)/a,i.dts=f_(i.dts-r.baseTime*a/r.timescale,t*a)/a}let o=e.samples;return e.samples=[],{samples:o}}function h_(e,t,n){let r=e.samples.length;if(!r)return;let i=e.inputTimeScale;for(let a=0;a<r;a++){let r=e.samples[a];r.pts=f_(r.pts-n.baseTime*i/n.timescale,t*i)/i}e.samples.sort((e,t)=>e.pts-t.pts);let a=e.samples;return e.samples=[],{samples:a}}var g_=class extends Wu{constructor(e,t,n,r){super(`passthrough-remuxer`,r),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;let t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,n,r){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(e,r),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:n,videoCodec:r}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}let{audio:i,video:a}=this.initData=Dd(e);if(t)Pd(e,t);else{let e=i||a;e!=null&&e.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${e.codec}")!`)}i&&(n=y_(i,dd.AUDIO,this)),a&&(r=y_(a,dd.VIDEO,this));let o={};i&&a?o.audiovideo={container:`video/mp4`,codec:n+`,`+r,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:`main`}:i?o.audio={container:`audio/mp4`,codec:n,encrypted:i.encrypted,initSegment:e,id:`audio`}:a?o.video={container:`video/mp4`,codec:r,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:`main`}:this.warn(`initSegment does not contain moov or trak boxes.`),this.initTracks=o}remux(e,t,n,r,i,a){var o,s;let{initPTS:c,lastEndTime:l}=this,u={audio:void 0,video:void 0,text:r,id3:n,initSegment:void 0};W(l)||(l=this.lastEndTime=i||0);let d=t.samples;if(!d.length)return u;let f={initPTS:void 0,timescale:void 0,trackId:void 0},p=this.initData;if((o=p)!=null&&o.length||(this.generateInitSegment(d),p=this.initData),!((s=p)!=null&&s.length))return this.warn(`Failed to generate initSegment.`),u;this.emitInitSegment&&=(f.tracks=this.initTracks,!1);let m=Rd(d,p,this),h=p.audio?m[p.audio.id]:null,g=p.video?m[p.video.id]:null,_=__(g,1/0),v=__(h,1/0),y=__(g,0,!0),b=__(h,0,!0),x=i,S=0,C=h&&(!g||!c&&v<_||c&&c.trackId===p.audio.id),w=C?h:g;if(w){let e=w.timescale,t=w.start-i*e,n=C?p.audio.id:p.video.id;x=w.start/e,S=C?b-v:y-_,(a||!c)&&(v_(c,x,i,S)||e!==c.timescale)&&(c&&this.warn(`Timestamps at playlist time: ${a?``:`~`}${i} ${t/e} != initPTS: ${c.baseTime/c.timescale} (${c.baseTime}/${c.timescale}) trackId: ${c.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${x-i} (${t}/${e}) trackId: ${n}`),c=null,f.initPTS=t,f.timescale=e,f.trackId=n)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${i}`);c?(f.initPTS=c.baseTime,f.timescale=c.timescale,f.trackId=c.trackId):((!f.timescale||f.trackId===void 0||f.initPTS===void 0)&&(this.warn(`Could not set initPTS`),f.initPTS=x,f.timescale=1,f.trackId=-1),this.initPTS=c={baseTime:f.initPTS,timescale:f.timescale,trackId:f.trackId});let T=x-c.baseTime/c.timescale,E=T+S;S>0?this.lastEndTime=E:(this.warn(`Duration parsed from mp4 should be greater than zero`),this.resetNextTimestamp());let D=!!p.audio,O=!!p.video,k=``;D&&(k+=`audio`),O&&(k+=`video`);let A=(p.audio?p.audio.encrypted:!1)||(p.video?p.video.encrypted:!1),j={data1:d,startPTS:T,startDTS:T,endPTS:E,endDTS:E,type:k,hasAudio:D,hasVideo:O,nb:1,dropped:0,encrypted:A};u.audio=D&&!O?j:void 0,u.video=O?j:void 0;
vendor: 13,610 bytes, lines 18-24
18let M=g?.sampleCount;if(M){let e=g.keyFrameIndex,t=e!==-1;j.nb=M,j.dropped=e===0||this.isVideoContiguous?0:t?e:M,j.independent=t,j.firstKeyFrame=e,t&&g.keyFrameStart&&(j.firstKeyFramePTS=(g.keyFrameStart-c.baseTime)/c.timescale),this.isVideoContiguous||(u.independent=t),this.isVideoContiguous||=t,j.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${e}/${M} dropped: ${j.dropped} start: ${j.firstKeyFramePTS||`NA`}`)}return u.initSegment=f,u.id3=m_(n,i,c,c),r.samples.length&&(u.text=h_(r,i,c)),u}};function __(e,t,n=!1){return e?.start===void 0?t:(e.start+(n?e.duration:0))/e.timescale}function v_(e,t,n,r){if(e===null)return!0;let i=Math.max(r,1),a=t-e.baseTime/e.timescale;return Math.abs(a-n)>i}function y_(e,t,n){let r=e.codec;return r&&r.length>4?r:t===dd.AUDIO?r===`ec-3`||r===`ac-3`||r===`alac`?r:r===`fLaC`||r===`Opus`?lf(r,!1):(n.warn(`Unhandled audio codec "${r}" in mp4 MAP`),r||`mp4a`):(n.warn(`Unhandled video codec "${r}" in mp4 MAP`),r||`avc1`)}var b_;try{b_=self.performance.now.bind(self.performance)}catch{b_=Date.now}var x_=[{demux:Pg,remux:g_},{demux:Hg,remux:d_},{demux:Og,remux:d_},{demux:Mg,remux:d_}];x_.splice(2,0,{demux:Ag,remux:d_});var S_=class{constructor(e,t,n,r,i,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=n,this.id=i,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,r){let i=n.transmuxing;i.executeStart=b_();let a=new Uint8Array(e),{currentTransmuxState:o,transmuxConfig:s}=this;r&&(this.currentTransmuxState=r);let{contiguous:c,discontinuity:l,trackSwitch:u,accurateTimeOffset:d,timeOffset:f,initSegmentChange:p}=r||o,{audioCodec:m,videoCodec:h,defaultInitPts:g,duration:_,initSegmentData:v}=s,y=C_(a,t);if(y&&om(y.method)){let e=this.getDecrypter(),t=sm(y.method);if(e.isSync()){let r=e.softwareDecrypt(a,y.key.buffer,y.iv.buffer,t);if(n.part>-1){let t=e.flush();r=t&&t.buffer}if(!r)return i.executeEnd=b_(),w_(n);a=new Uint8Array(r)}else return this.asyncResult=!0,this.decryptionPromise=e.webCryptoDecrypt(a,y.key.buffer,y.iv.buffer,t).then(e=>{let t=this.push(e,null,n);return this.decryptionPromise=null,t}),this.decryptionPromise}let b=this.needsProbing(l,u);if(b){let e=this.configureTransmuxer(a);if(e)return this.logger.warn(`[transmuxer] ${e.message}`),this.observer.emit(q.ERROR,q.ERROR,{type:G.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),i.executeEnd=b_(),w_(n)}(l||u||p||b)&&this.resetInitSegment(v,m,h,_,t),(l||p||b)&&this.resetInitialTimestamp(g),c||this.resetContiguity();let x=this.transmux(a,y,f,d,n);this.asyncResult=T_(x);let S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,i.executeEnd=b_(),x}flush(e){let t=e.transmuxing;t.executeStart=b_();let{decrypter:n,currentTransmuxState:r,decryptionPromise:i}=this;if(i)return this.asyncResult=!0,i.then(()=>this.flush(e));let a=[],{timeOffset:o}=r;if(n){let t=n.flush();t&&a.push(this.push(t.buffer,null,e))}let{demuxer:s,remuxer:c}=this;if(!s||!c){t.executeEnd=b_();let n=[w_(e)];return this.asyncResult?Promise.resolve(n):n}let l=s.flush(o);return T_(l)?(this.asyncResult=!0,l.then(t=>(this.flushRemux(a,t,e),a))):(this.flushRemux(a,l,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,n){let{audioTrack:r,videoTrack:i,id3Track:a,textTrack:o}=t,{accurateTimeOffset:s,timeOffset:c}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${n.sn}${n.part>-1?` part: `+n.part:``} of ${this.id===Y.MAIN?`level`:`track`} ${n.level}`);let l=this.remuxer.remux(r,i,a,o,c,s,!0,this.id);e.push({remuxResult:l,chunkMeta:n}),n.transmuxing.executeEnd=b_()}resetInitialTimestamp(e){let{demuxer:t,remuxer:n}=this;!t||!n||(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){let{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,r,i){let{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,t,n,r),o.resetInitSegment(e,t,n,i))}destroy(){this.demuxer&&=(this.demuxer.destroy(),void 0),this.remuxer&&=(this.remuxer.destroy(),void 0)}transmux(e,t,n,r,i){let a;return a=t&&t.method===`SAMPLE-AES`?this.transmuxSampleAes(e,t,n,r,i):this.transmuxUnencrypted(e,n,r,i),a}transmuxUnencrypted(e,t,n,r){let{audioTrack:i,videoTrack:a,id3Track:o,textTrack:s}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(i,a,o,s,t,n,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,n,r,i){return this.demuxer.demuxSampleAes(e,t,n).then(e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,n,r,!1,this.id),chunkMeta:i}))}configureTransmuxer(e){let{config:t,observer:n,typeSupported:r}=this,i;for(let t=0,n=x_.length;t<n;t++){var a;if((a=x_[t].demux)!=null&&a.probe(e,this.logger)){i=x_[t];break}}if(!i)return Error(`Failed to find demuxer by probing fragment data`);let o=this.demuxer,s=this.remuxer,c=i.remux,l=i.demux;(!s||!(s instanceof c))&&(this.remuxer=new c(n,t,r,this.logger)),(!o||!(o instanceof l))&&(this.demuxer=new l(n,t,r,this.logger),this.probe=l.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||=this.decrypter=new Np(this.config),e}};function C_(e,t){let n=null;return e.byteLength>0&&t?.key!=null&&t.iv!==null&&t.method!=null&&(n=t),n}var w_=e=>({remuxResult:{},chunkMeta:e});function T_(e){return`then`in e&&e.then instanceof Function}var E_=class{constructor(e,t,n,r,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=n,this.duration=r,this.defaultInitPts=i||null}},D_=class{constructor(e,t,n,r,i,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=n,this.trackSwitch=r,this.timeOffset=i,this.initSegmentChange=a}},O_=0,k_=class{constructor(e,t,n,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=O_++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=e=>{let t=e.data,n=this.hls;if(!(!n||!(t!=null&&t.event)||t.instanceNo!==this.instanceNo))switch(t.event){case`init`:{let e=this.workerContext?.objectURL;e&&self.URL.revokeObjectURL(e);break}case`transmuxComplete`:this.handleTransmuxComplete(t.data);break;case`flush`:this.onFlush(t.data);break;case`workerLog`:n.logger[t.data.logType]&&n.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.part=this.part,t.data.id=this.id,n.trigger(t.event,t.data);break}},this.onWorkerError=e=>{if(!this.hls)return;let t=Error(`${e.message} (${e.filename}:${e.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(q.ERROR,{type:G.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,fatal:!1,event:`demuxerWorker`,error:t})};let i=e.config;this.hls=e,this.id=t,this.useWorker=!!i.enableWorker,this.onTransmuxComplete=n,this.onFlush=r;let a=(e,t)=>{t||={},t.frag=this.frag||void 0,e===q.ERROR&&(t=t,t.parent=this.id,t.part=this.part,this.error=t.error),this.hls.trigger(e,t)};this.observer=new Eh,this.observer.on(q.FRAG_DECRYPTED,a),this.observer.on(q.ERROR,a);let o=hf(i.preferManagedMediaSource);if(this.useWorker&&typeof Worker<`u`){let n=this.hls.logger;if(i.workerPath||kh()){try{i.workerPath?(n.log(`loading Web Worker ${i.workerPath} for "${t}"`),this.workerContext=jh(i.workerPath)):(n.log(`injecting Web Worker for "${t}"`),this.workerContext=Ah());let{worker:e}=this.workerContext;e.addEventListener(`message`,this.onWorkerMessage),e.addEventListener(`error`,this.onWorkerError),e.postMessage({instanceNo:this.instanceNo,cmd:`init`,typeSupported:o,id:t,config:Bf(i)})}catch(r){n.warn(`Error setting up "${t}" Web Worker, fallback to inline`,r),this.terminateWorker(),this.error=null,this.transmuxer=new S_(this.observer,o,i,``,t,e.logger)}return}}this.transmuxer=new S_(this.observer,o,i,``,t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){let e=this.instanceNo;this.instanceNo=O_++;let t=this.hls.config,n=hf(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:`reset`,resetNo:e,typeSupported:n,id:this.id,config:Bf(t)})}}terminateWorker(){if(this.workerContext){let{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener(`message`,this.onWorkerMessage),e.removeEventListener(`error`,this.onWorkerError),Mh(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{let e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}let e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,n,r,i,a,o,s,c,l){c.transmuxing.start=self.performance.now();let{instanceNo:u,transmuxer:d}=this,f=a?a.start:i.start,p=i.decryptdata,m=this.frag,h=!(m&&i.cc===m.cc),g=!(m&&c.level===m.level),_=m?c.sn-m.sn:-1,v=this.part?c.part-this.part.index:-1,y=_===0&&c.id>1&&c.id===m?.stats.chunkCount,b=!g&&(_===1||_===0&&(v===1||y&&v<=0)),x=self.performance.now();(g||_||i.stats.parsing.start===0)&&(i.stats.parsing.start=x),a&&(v||!b)&&(a.stats.parsing.start=x);let S=!(m&&i.initSegment?.url===m.initSegment?.url),C=new D_(h,b,s,g,f,S);if(!b||h||S){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${i.type} sn: ${c.sn}${c.part>-1?` part: `+c.part:``} ${this.id===Y.MAIN?`level`:`track`}: ${c.level} id: ${c.id} 19 discontinuity: ${h} 20 trackSwitch: ${g} 21 contiguous: ${b} 22 accurateTimeOffset: ${s} 23 timeOffset: ${f} 24 initSegmentChange: ${S}`);let e=new E_(n,r,t,o,l);this.configureTransmuxer(e)}if(this.frag=i,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:u,cmd:`demux`,data:e,decryptdata:p,chunkMeta:c,state:C},e instanceof ArrayBuffer?[e]:[]);else if(d){let t=d.push(e,p,c,C);T_(t)?t.then(e=>{this.handleTransmuxComplete(e)}).catch(e=>{this.transmuxerError(e,c,`transmuxer-interface push error`)}):this.handleTransmuxComplete(t)}}flush(e){e.transmuxing.start=self.performance.now();let{instanceNo:t,transmuxer:n}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:`flush`,chunkMeta:e});else if(n){let t=n.flush(e);T_(t)?t.then(t=>{this.handleFlushResult(t,e)}).catch(t=>{this.transmuxerError(t,e,`transmuxer-interface flush error`)}):this.handleFlushResult(t,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(q.ERROR,{type:G.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach(e=>{this.handleTransmuxComplete(e)}),this.onFlush(t)}configureTransmuxer(e){let{instanceNo:t,transmuxer:n}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:`configure`,config:e}):n&&n.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}},A_=100,j_=class extends yh{constructor(e,t,n){super(e,t,n,`audio-stream-controller`,Y.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(q.LEVEL_LOADED,this.onLevelLoaded,this),e.on(q.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(q.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(q.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(q.BUFFER_RESET,this.onBufferReset,this),e.on(q.BUFFER_CREATED,this.onBufferCreated,this),e.on(q.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(q.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(q.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(q.FRAG_LOADING,this.onFragLoading,this),e.on(q.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){let{hls:e}=this;e&&(super.unregisterListeners(),e.off(q.LEVEL_LOADED,this.onLevelLoaded,this),e.off(q.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(q.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(q.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(q.BUFFER_RESET,this.onBufferReset,this),e.off(q.BUFFER_CREATED,this.onBufferCreated,this),e.off(q.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(q.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(q.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(q.FRAG_LOADING,this.onFragLoading,this),e.off(q.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:n,initPTS:r,timescale:i,trackId:a}){if(n===Y.MAIN){let e=t.cc,n=this.fragCurrent;if(this.initPTS[e]={baseTime:r,timescale:i,trackId:a},this.log(`InitPTS for cc: ${e}
24 found from main: ${r/i} (${r}/${i}) trackId: ${a}`),this.mainAnchor=t,this.state===$.WAITING_INIT_PTS){let n=this.waitingData;(!n&&!this.loadingParts||n&&n.frag.cc!==e)&&this.syncWithAnchor(t,n?.frag)}else !this.hls.hasEnoughToStart&&n&&n.cc!==e?(n.abortRequests(),this.syncWithAnchor(t,n)):this.state===$.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){let n=this.mainFragLoading?.frag||null;if(t&&n?.cc===t.cc)return;let r=(n||e).cc,i=sp(this.getLevelDetails(),r,this.getLoadPosition());i&&(this.log(`Syncing with main frag at ${i.start} cc ${i.cc}`),this.startFragRequested=!1,this.nextLoadPosition=i.start,this.resetLoadingState(),this.state===$.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=$.STOPPED;return}let n=this.lastCurrentTime;this.stopLoad(),this.setInterval(A_),n>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n,this.state=$.IDLE):this.state=$.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case $.IDLE:this.doTickIdle();break;case $.WAITING_TRACK:{let{levels:e,trackId:t}=this,n=e?.[t],r=n?.details;if(r&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(r))break;this.state=$.WAITING_INIT_PTS}break}case $.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break;case $.WAITING_INIT_PTS:{let e=this.waitingData;if(e){let{frag:t,part:n,cache:r,complete:i}=e,a=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=$.FRAG_LOADING;let e={frag:t,part:n,payload:r.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(e),i&&super._handleFragmentLoadComplete(e)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=$.IDLE}}this.onTickEnd()}resetLoadingState(){let e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){let{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){let{hls:e,levels:t,media:n,trackId:r}=this,i=e.config;if(!this.buffering||!n&&!this.primaryPrefetch&&(this.startFragRequested||!i.startFragPrefetch)||!(t!=null&&t[r]))return;let a=t[r],o=a.details;if(!o||this.waitForLive(a)||this.waitForCdnTuneIn(o)){this.state=$.WAITING_TRACK,this.startFragRequested=!1;return}let s=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&s&&(this.bufferFlushed=!1,this.afterBufferFlushed(s,dd.AUDIO,Y.AUDIO));let c=this.getFwdBufferInfo(s,Y.AUDIO);if(c===null)return;if(!this.switchingTrack&&this._streamEnded(c,o)){e.trigger(q.BUFFER_EOS,{type:`audio`}),this.state=$.ENDED;return}let l=c.len,u=e.maxBufferLength,d=o.fragments,f=d[0].start,p=this.getLoadPosition(),m=this.flushing?p:c.end;if(this.switchingTrack&&n){let e=p;o.PTSKnown&&e<f&&(c.end>f||c.nextStart)&&(this.log(`Alt audio track ahead of main track, seek to start of alt audio track`),n.currentTime=f+.05)}if(l>=u&&!this.switchingTrack&&m<d[d.length-1].start)return;let h=this.getNextFragment(m,o);if(h&&this.isLoopLoading(h,m)&&(h=this.getNextFragmentLoopLoading(h,o,c,Y.MAIN,u)),!h){this.bufferFlushed=!0;return}if(this.exceedsMaxBuffer(c,u,h))return;let g=this.mainFragLoading?.frag||null;if(!this.audioOnly&&this.startFragRequested&&g&&pd(h)&&!h.endList&&(!o.live||!this.loadingParts&&m<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(g)===xp.OK&&(this.mainFragLoading=g=null),g&&pd(g))){if(h.start>g.end){let e=this.fragmentTracker.getFragAtPos(m,Y.MAIN);e&&e.end>g.end&&(g=e,this.mainFragLoading={frag:e,targetBufferTime:null})}if(h.start>g.end)return}this.loadFragment(h,a,m)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(e=>new Ff(e))}onAudioTrackSwitching(e,t){let n=!!t.url;this.trackId=t.id;let{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),n?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==$.STOPPED&&(this.setInterval(A_),this.state=$.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;let n=this.cachedTrackLoadedData;n&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(q.AUDIO_TRACK_LOADED,n))}onAudioTrackLoaded(e,t){var n;let{levels:r}=this,{details:i,id:a,groupId:o,track:s}=t;if(!r){this.warn(`Audio tracks reset while loading track ${a} "${s.name}" of "${o}"`);return}let c=this.mainDetails;if(!c||i.endCC>c.endCC||c.expired){this.cachedTrackLoadedData=t,this.state!==$.STOPPED&&(this.state=$.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${s.name}" of "${o}" loaded [${i.startSN},${i.endSN}]${i.lastPartSn?`[part-${i.lastPartSn}-${i.lastPartIndex}]`:``},duration:${i.totalduration}`);let l=r[a],u=0;if(i.live||(n=l.details)!=null&&n.live){if(this.checkLiveUpdate(i),i.deltaUpdateFailed)return;l.details&&(u=this.alignPlaylists(i,l.details,this.levelLastLoaded?.details)),i.alignedSliding||(mh(i,c),i.alignedSliding||hh(i,c),u=i.fragmentStart)}l.details=i,this.levelLastLoaded=l,this.startFragRequested||this.setStartPosition(c,u),this.hls.trigger(q.AUDIO_TRACK_UPDATED,{details:i,id:a,groupId:t.groupId}),this.state===$.WAITING_TRACK&&!this.waitForCdnTuneIn(i)&&(this.state=$.IDLE),this.tick()}_handleFragmentLoadProgress(e){let t=e.frag,{part:n,payload:r}
vendor: 20,299 bytes, lines 24-27
24=e,{config:i,trackId:a,levels:o}=this;if(!o){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${t.sn} of level ${t.level} will not be buffered`);return}let s=o[a];if(!s){this.warn(`Audio track is undefined on fragment load progress`);return}let c=s.details;if(!c){this.warn(`Audio track details undefined on fragment load progress`),this.removeUnbufferedFrags(t.start);return}let l=i.defaultAudioCodec||s.audioCodec||`mp4a.40.2`,u=this.transmuxer;u||=this.transmuxer=new k_(this.hls,Y.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this));let d=this.initPTS[t.cc],f=t.initSegment?.data;if(d!==void 0){let e=n?n.index:-1,i=e!==-1,a=new Vp(t.level,t.sn,t.stats.chunkCount,r.byteLength,e,i);u.push(r,f,l,``,t,n,c.totalduration,!1,a,d)}else{this.log(`Unknown video PTS for cc ${t.cc}, waiting for video PTS before demuxing audio frag ${t.sn} of [${c.startSN} ,${c.endSN}],track ${a}`);let{cache:e}=this.waitingData=this.waitingData||{frag:t,part:n,cache:new xh,complete:!1};e.push(new Uint8Array(r)),this.state!==$.STOPPED&&(this.state=$.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;let n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===Y.MAIN&&pd(t.frag)&&(this.mainFragLoading=t,this.state===$.IDLE&&this.tick())}onFragBuffered(e,t){let{frag:n,part:r}=t;if(n.type!==Y.AUDIO){!this.audioOnly&&n.type===Y.MAIN&&!n.elementaryStreams.video&&!n.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${r?` p: `+r.index:``} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:`false`}`);return}if(pd(n)){this.fragPrevious=n;let e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(q.AUDIO_TRACK_SWITCHED,Vu({},e)))}this.fragBufferedComplete(n,r),this.media&&this.tick()}onError(e,t){if(t.fatal){this.state=$.ERROR;return}switch(t.details){case K.FRAG_GAP:case K.FRAG_PARSING_ERROR:case K.FRAG_DECRYPT_ERROR:case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Y.AUDIO,t);break;case K.AUDIO_TRACK_LOAD_ERROR:case K.AUDIO_TRACK_LOAD_TIMEOUT:case K.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===$.WAITING_TRACK&&t.context?.type===J.AUDIO_TRACK&&(this.state=$.IDLE);break;case K.BUFFER_ADD_CODEC_ERROR:case K.BUFFER_APPEND_ERROR:if(t.parent!==`audio`)return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case K.BUFFER_FULL_ERROR:if(t.parent!==`audio`)return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,1/0,`audio`));break;case K.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==dd.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==dd.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===$.ENDED&&(this.state=$.IDLE);let e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,t,Y.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;let n=`audio`,{hls:r}=this,{remuxResult:i,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}let{frag:s,part:c,level:l}=o,{details:u}=l,{audio:d,text:f,id3:p,initSegment:m}=i;if(this.fragContextChanged(s)||!u){this.fragmentTracker.removeFragment(s);return}if(this.state=$.PARSING,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),m!=null&&m.tracks){let e=s.initSegment||s;if(this.unhandledEncryptionError(m,s))return;this._bufferInitSegment(l,m.tracks,e,a),r.trigger(q.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:n,tracks:m.tracks})}if(d){let{startPTS:e,endPTS:t,startDTS:n,endDTS:r}=d;c&&(c.elementaryStreams[dd.AUDIO]={startPTS:e,endPTS:t,startDTS:n,endDTS:r}),s.setElementaryStreamInfo(dd.AUDIO,e,t,n,r),this.bufferFragmentData(d,s,c,a)}if(p!=null&&(t=p.samples)!=null&&t.length){let e=zu({id:n,frag:s,details:u},p);r.trigger(q.FRAG_PARSING_METADATA,e)}if(f){let e=zu({id:n,frag:s,details:u},f);r.trigger(q.FRAG_PARSING_USERDATA,e)}}_bufferInitSegment(e,t,n,r){if(this.state!==$.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;let i=t.audio;i.id=Y.AUDIO;let a=e.audioCodec;this.log(`Init audio buffer, container:${i.container}, codecs[level/parsed]=[${a}/${i.codec}]`),a&&a.split(`,`).length===1&&(i.levelCodec=a),this.hls.trigger(q.BUFFER_CODECS,t);let o=i.initSegment;if(o!=null&&o.byteLength){let e={type:`audio`,frag:n,part:null,chunkMeta:r,parent:n.type,data:o};this.hls.trigger(q.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,n){let r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===xp.NOT_LOADED||r===xp.PARTIAL){var i;if(!pd(e))this._loadInitSegment(e,t);else if((i=t.details)!=null&&i.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=$.WAITING_INIT_PTS;let n=this.mainDetails;n&&n.fragmentStart!==t.details.fragmentStart&&hh(t.details,n)}else super.loadFragment(e,t,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){let{name:t,lang:n,assocLang:r,characteristics:i,audioCodec:a,channels:o}=this.bufferedTrack;qf({name:t,lang:n,assocLang:r,characteristics:i,audioCodec:a,channels:o},e,Xf)||($f(e.url,this.hls)?(this.log(`Switching audio track : flushing all audio`),super.flushMainBuffer(0,1/0,`audio`),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){let{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(q.AUDIO_TRACK_SWITCHED,Vu({},e))}},M_=class extends Wu{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,n){let r=t?.renditionReports;if(r){let i=-1;for(let n=0;n<r.length;n++){let a=r[n],o;try{o=new self.URL(a.URI,t.url).href}catch(e){this.warn(`Could not construct new URL for Rendition Report: ${e}`),o=a.URI||``}if(o===e){i=n;break}else o===e.substring(0,o.length)&&(i=n)}if(i!==-1){let e=r[i],a=parseInt(e[`LAST-MSN`])||t.lastPartSn,o=parseInt(e[`LAST-PART`])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){let e=Math.min(t.age-t.partTarget,t.targetduration);o>=0&&e>t.partTarget&&(o+=1)}let s=n&&Nf(n);return new Pf(a,o>=0?o:void 0,s)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}return e}playlistLoaded(e,t,n){let{details:r,stats:i}=t,a=self.performance.now(),o=i.loading.first?Math.max(0,a-i.loading.first):0;r.advancedDateTime=Date.now()-o;let s=this.hls.config.timelineOffset;if(s!==r.appliedTimelineOffset){let e=Math.max(s||0,0);r.appliedTimelineOffset=e,r.fragments.forEach(t=>{t.setStart(t.playlistOffset+e)})}if(r.live||n!=null&&n.live){let s=`levelInfo`in t?t.levelInfo:t.track;if(r.reloaded(n),n&&r.fragments.length>0){Ym(n,r,this);let e=r.playlistParsingError;if(e){this.warn(e);let n=this.hls;if(!n.config.ignorePlaylistParsingErrors){let{networkDetails:a}=t;n.trigger(q.ERROR,{type:G.NETWORK_ERROR,details:K.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:e,reason:e.message,level:t.level||void 0,parent:r.fragments[0]?.type,networkDetails:a,stats:i});return}r.playlistParsingError=null}}r.requestScheduled===-1&&(r.requestScheduled=i.loading.start);let c=this.hls.mainForwardBufferInfo,l=c?c.end-c.len:0,u=nh(r,(r.edge-l)*1e3);if(r.requestScheduled+u<a?r.requestScheduled=a:r.requestScheduled+=u,this.log(`live playlist ${e} ${r.advanced?`REFRESHED `+r.lastPartSn+`-`+r.lastPartIndex:r.updated?`UPDATED`:`MISSED`}`),!this.canLoad||!r.live)return;let d,f,p;if(r.canBlockReload&&r.endSN&&r.advanced){let e=this.hls.config.lowLatencyMode,i=r.lastPartSn,o=r.endSN,c=r.lastPartIndex,l=c!==-1,u=i===o;l?u?(f=o+1,p=e?0:c):(f=i,p=e?c+1:r.maxPartIndex):f=o+1;let m=r.age,h=m+r.ageHeader,g=Math.min(h-r.partTarget,r.targetduration*1.5);if(g>0){if(h>r.targetduration*3)this.log(`Playlist last advanced ${m.toFixed(2)}s ago. Omitting segment and part directives.`),f=void 0,p=void 0;else if(n!=null&&n.tuneInGoal&&h-r.partTarget>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${g} with playlist age: ${r.age}`),g=0;else{let e=Math.floor(g/r.targetduration);if(f+=e,p!==void 0){let e=Math.round(g%r.targetduration/r.partTarget);p+=e}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${m.toFixed(2)}s goal: ${g} skip sn ${e} to part ${p}`)}r.tuneInGoal=g}if(d=this.getDeliveryDirectives(r,t.deliveryDirectives,f,p),e||!u){r.requestScheduled=a,this.loadingPlaylist(s,d);return}}else (r.canBlockReload||r.canSkipUntil)&&(d=this.getDeliveryDirectives(r,t.deliveryDirectives,f,p));d&&f!==void 0&&r.canBlockReload&&(r.requestScheduled=i.loading.first+Math.max(u-o*2,u/2)),this.scheduleLoading(s,d,r)}else this.clearTimer()}scheduleLoading(e,t,n){let r=n||e.details;if(!r){this.loadingPlaylist(e,t);return}let i=self.performance.now(),a=r.requestScheduled;if(i>=a){this.loadingPlaylist(e,t);return}let o=a-i;this.log(`reload live playlist ${e.name||e.bitrate+`bps`} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o)}getDeliveryDirectives(e,t,n,r){let i=Nf(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,r=t.part,i=Mf.No),new Pf(n,r,i)}checkRetry(e){let t=e.details,n=cp(e),r=e.errorAction,{action:i,retryCount:a=0,retryConfig:o}=r||{},s=!!r&&!!o&&(i===_p.RetryRequest||!r.resolved&&i===_p.SendAlternateToPenaltyBox);if(s){var c;if(a>=o.maxNumRetry)return!1;if(n&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{let e=fp(o,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),e),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,r.resolved=!0}return s}};function N_(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!P_(e[n].attrs,t[n].attrs))return!1;return!0}function P_(e,t,n){let r=e[`STABLE-RENDITION-ID`];return r&&!n?r===t[`STABLE-RENDITION-ID`]:!(n||[`LANGUAGE`,`NAME`,`CHARACTERISTICS`,`AUTOSELECT`,`DEFAULT`,`FORCED`,`ASSOC-LANGUAGE`]).some(n=>e[n]!==t[n])}function F_(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||``).toLowerCase())}var I_=class extends M_{constructor(e){super(e,`audio-track-controller`),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){let{hls:e}=this;e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.MANIFEST_PARSED,this.onManifestParsed,this),e.on(q.LEVEL_LOADING,this.onLevelLoading,this),e.on(q.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(q.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(q.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.MANIFEST_PARSED,this.onManifestParsed,this),e.off(q.LEVEL_LOADING,this.onLevelLoading,this),e.off(q.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(q.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(q.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){let{id:n,groupId:r,details:i}=t,a=this.tracksInGroup[n];if(!a||a.groupId!==r){this.warn(`Audio track with id:${n} and group:${r} not found in active group ${a?.groupId}`);return}let o=a.details;a.details=t.details,this.log(`Audio track ${n} "${a.name}" lang:${a.lang} group:${r} loaded [${i.startSN}-${i.endSN}]`),n===this.trackId&&this.playlistLoaded(n,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){let t=this.hls.levels[e];if(!t)return;let n=t.audioGroups||null,r=this.groupIds,i=this.currentTrack;if(!n||r?.length!==n?.length||n!=null&&n.some(e=>r?.indexOf(e)===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;let e=this.tracks.filter(e=>!n||n.indexOf(e.groupId)!==-1);if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>{e.id=t});else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=e;let t=this.hls.config.audioPreference;if(!i&&t){let n=Kf(t,e,Xf);if(n>-1)i=e[n];else{let e=Kf(t,this.tracks);i=this.tracks[e]}}let r=this.findTrackId(i);r===-1&&i&&(r=this.findTrackId(null));let a={audioTracks:e};this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${n?.join(`,`)}`),this.hls.trigger(q.AUDIO_TRACKS_UPDATED,a);let o=this.trackId;if(r!==-1&&o===-1)this.setAudioTrack(r);else if(e.length&&o===-1){let t=Error(`No audio track selected for current audio group-ID(s): ${this.groupIds?.join(`,`)} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(q.ERROR,{type:G.MEDIA_ERROR,details:K.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}}onError(e,t){t.fatal||!t.context||t.context.type===J.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){let t=this.hls;if(t.config.audioPreference=e,e){let n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){let r=this.currentTrack;if(r&&qf(e,r,Xf))return r;let i=Kf(e,this.tracksInGroup,Xf);if(i>-1){let e=this.tracksInGroup[i];return this.setAudioTrack(i),e}else if(r){let r=t.loadLevel;r===-1&&(r=t.firstAutoLevel);let i=Zf(e,t.levels,n,r,Xf);if(i===-1)return null;t.nextLoadLevel=i}if(e.channels||e.audioCodec){let t=Kf(e,n);if(t>-1)return n[t]}}}return null}setAudioTrack(e){let t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;let n=this.currentTrack,r=t[e],i=r.details&&!r.details.live;if(e===this.trackId&&r===n&&i||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(q.AUDIO_TRACK_SWITCHING,Vu({},r)),i))return;let a=this.switchParams(r.url,n?.details,r.details);this.loadPlaylist(a)}findTrackId(e){let t=this.tracksInGroup;for(let n=0;n<t.length;n++){let r=t[n];if(!(this.selectDefaultTrack&&!r.default)&&(!e||qf(e,r,Xf)))return n}if(e){let{name:n,lang:r,assocLang:i,characteristics:a,audioCodec:o,channels:s}=e;for(let e=0;e<t.length;e++){let c=t[e];if(qf({name:n,lang:r,assocLang:i,characteristics:a,audioCodec:o,channels:s},c,Xf))return e}for(let n=0;n<t.length;n++){let r=t[n];if(P_(e.attrs,r.attrs,[`LANGUAGE`,`ASSOC-LANGUAGE`,`CHARACTERISTICS`]))return n}for(let n=0;n<t.length;n++){let r=t[n];if(P_(e.attrs,r.attrs,[`LANGUAGE`]))return n}}return-1}loadPlaylist(e){super.loadPlaylist();let t=this.currentTrack;this.shouldLoadPlaylist(t)&&$f(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let n=e.id,r=e.groupId,i=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading audio-track ${n} "${e.name}" lang:${e.lang} group:${r}${t?.msn===void 0?``:` at sn `+t.msn+` part `+t.part}${o&&a.live?` age `+o.toFixed(1)+(a.type&&` `+a.type||``):``} ${i}`),this.hls.trigger(q.AUDIO_TRACK_LOADING,{url:i,id:n,groupId:r,deliveryDirectives:t||null,track:e})}},L_=class{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,n){if(this.queues===null||this.tracks===null)return;let r=this.queues[t];r.push(e),r.length===1&&!n&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{let n={label:`async-blocker`,execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(n,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){let n={label:`async-blocker-prepend`,execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(n)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{let t=e[0]?.label;(t===`async-blocker`||t===`async-blocker-prepend`)&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){this.queues!==null&&this.queues.audio[0]===e&&this.shiftAndExecuteNext(`audio`)}executeNext(e){if(this.queues===null||this.tracks===null)return;let t=this.queues[e];if(t.length){let n=t[0];try{n.execute()}catch(t){if(n.onError(t),this.queues===null||this.tracks===null)return;let r=this.tracks[e]?.buffer;r!=null&&r.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){return this.queues?.[e][0]||null}toString(){let{queues:e,tracks:t}=this;return e===null||t===null?`<destroyed>`:` 25${this.list(`video`)} 26${this.list(`audio`)} 27${this.list(`audiovideo`)}}`}list(e){var t,n;return(t=this.queues)!=null&&t[e]||(n=this.tracks)!=null&&n[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:``}listSbInfo(e){let t=this.tracks?.[e],n=t?.buffer;return n?`SourceBuffer${n.updating?` updating`:``}${t.ended?` ended`:``}${t.ending?` ending`:``}`:`none`}listOps(e){return this.queues?.[e].map(e=>e.label).join(`, `)||``}},R_=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,z_=`HlsJsTrackRemovedError`,B_=class extends Error{constructor(e){super(e),this.name=z_}},V_=class extends Wu{constructor(e,t){super(`buffer-controller`,e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=e=>{this.hls&&this.mediaSource?.readyState===`open`&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=e=>{let{media:t,mediaSource:n}=this;e&&this.log(`Media source opened`),!(!t||!n)&&(n.removeEventListener(`sourceopen`,this._onMediaSourceOpen),t.removeEventListener(`emptied`,this._onMediaEmptied),this.updateDuration(),this.hls.trigger(q.MEDIA_ATTACHED,{media:t,mediaSource:n}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log(`Media source closed`)},this._onMediaSourceEnded=()=>{this.log(`Media source ended`)},this._onMediaEmptied=()=>{let{mediaSrc:e,_objectUrl:t}=this;e!==t&&this.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=ed($u(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&=(this.operationQueue.destroy(),null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){let{hls:e}=this;
vendor: 4,168 bytes, lines 27-29
27e.on(q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.MANIFEST_PARSED,this.onManifestParsed,this),e.on(q.BUFFER_RESET,this.onBufferReset,this),e.on(q.BUFFER_APPENDING,this.onBufferAppending,this),e.on(q.BUFFER_CODECS,this.onBufferCodecs,this),e.on(q.BUFFER_EOS,this.onBufferEos,this),e.on(q.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(q.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(q.FRAG_PARSED,this.onFragParsed,this),e.on(q.FRAG_CHANGED,this.onFragChanged,this),e.on(q.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.MANIFEST_PARSED,this.onManifestParsed,this),e.off(q.BUFFER_RESET,this.onBufferReset,this),e.off(q.BUFFER_APPENDING,this.onBufferAppending,this),e.off(q.BUFFER_CODECS,this.onBufferCodecs,this),e.off(q.BUFFER_EOS,this.onBufferEos,this),e.off(q.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(q.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(q.FRAG_PARSED,this.onFragParsed,this),e.off(q.FRAG_CHANGED,this.onFragChanged,this),e.off(q.ERROR,this.onError,this)}transferMedia(){let{media:e,mediaSource:t}=this;if(!e)return null;let n={};if(this.operationQueue){let e=this.isUpdating();e||this.operationQueue.removeBlockers();let t=this.isQueued();(e||t)&&this.warn(`Transfering MediaSource with${t?` operations in queue`:``}${e?` updating SourceBuffer(s)`:``} ${this.operationQueue}`),this.operationQueue.destroy()}let r=this.transferData;return!this.sourceBufferCount&&r&&r.mediaSource===t?zu(n,r.tracks):this.sourceBuffers.forEach(e=>{let[t]=e;t&&(n[t]=zu({},this.tracks[t]),this.removeBuffer(t)),e[0]=e[1]=null}),{media:e,mediaSource:t,tracks:n}}initTracks(){this.sourceBuffers=[[null,null],[null,null]],this.tracks={},this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var n;let r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsTotal=r,this.log(`${r} bufferCodec event(s) expected.`),(n=this.transferData)!=null&&n.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,t){let n=this.media=t.media;this.transferData=this.overrides=void 0;let r=$u(this.appendSource);if(r){let e=!!t.mediaSource;(e||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);let i=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(i),e)this._objectUrl=n.src,this.attachTransferred();else{let e=this._objectUrl=self.URL.createObjectURL(i);if(this.appendSource)try{n.removeAttribute(`src`);let t=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||t&&i instanceof t,H_(n),U_(n,e),n.load()}catch{n.src=e}else n.src=e}n.addEventListener(`emptied`,this._onMediaEmptied)}}assignMediaSource(e){this.log(`${this.transferData?.mediaSource===e?`transferred`:`created`} media source: ${e.constructor?.name}`),e.addEventListener(`sourceopen`,this._onMediaSourceOpen),e.addEventListener(`sourceended`,this._onMediaSourceEnded),e.addEventListener(`sourceclose`,this._onMediaSourceClose),this.appendSource&&(e.addEventListener(`startstreaming`,this._onStartStreaming),e.addEventListener(`endstreaming`,this._onEndStreaming))}attachTransferred(){let e=this.media,t=this.transferData;if(!t||!e)return;let n=this.tracks,r=t.tracks,i=r?Object.keys(r):null,a=i?i.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(r&&i&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log(`attachTransferred: waiting for SourceBuffer track info`);return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal}) 28required tracks: ${Bf(n,(e,t)=>e===`initSegment`?void 0:t)}; 29transfer tracks: ${Bf(r,(e,t)=>e===`initSegment`?void 0:t)}}`),!td(r,n)){t.mediaSource=null,t.tracks=void 0;let i=e.currentTime,a=this.details,o=Math.max(i,a?.fragments[0].start||0
vendor: 17,253 bytes, line 29
29);if(o-i>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${i} -> ${o}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(r)}"->"${Object.keys(n)}") start time: ${o} currentTime: ${i}`),this.onMediaDetaching(q.MEDIA_DETACHING,{}),this.onMediaAttaching(q.MEDIA_ATTACHING,t),e.currentTime=o;return}this.transferData=void 0,i.forEach(e=>{let t=e,n=r[t];if(n){let e=n.buffer;if(e){let r=this.fragmentTracker,i=n.id;if(r.hasFragments(i)||r.hasParts(i)){let n=Q.getBuffered(e);r.detectEvictedFragments(t,n,i,null,!0)}let a=W_(t),o=[t,e];this.sourceBuffers[a]=o,e.updating&&this.operationQueue&&this.operationQueue.prependBlocker(t),this.trackSourceBuffer(t,n)}}}),o(),this.bufferCreated()}else this.log(`attachTransferred: MediaSource w/o SourceBuffers`),o()}get mediaSourceOpenOrEnded(){let e=this.mediaSource?.readyState;return e===`open`||e===`ended`}onMediaDetaching(e,t){let n=!!t.transferMedia;this.transferData=this.overrides=void 0;let{media:r,mediaSource:i,_objectUrl:a}=this;if(i){if(this.log(`media source ${n?`transferring`:`detaching`}`),n)this.sourceBuffers.forEach(([e])=>{e&&this.removeBuffer(e)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){let e=i.readyState===`open`;try{let t=i.sourceBuffers;for(let n=t.length;n--;)e&&t[n].abort(),i.removeSourceBuffer(t[n]);e&&i.endOfStream()}catch(e){this.warn(`onMediaDetaching: ${e.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}i.removeEventListener(`sourceopen`,this._onMediaSourceOpen),i.removeEventListener(`sourceended`,this._onMediaSourceEnded),i.removeEventListener(`sourceclose`,this._onMediaSourceClose),this.appendSource&&(i.removeEventListener(`startstreaming`,this._onStartStreaming),i.removeEventListener(`endstreaming`,this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(r.removeEventListener(`emptied`,this._onMediaEmptied),n||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(r.removeAttribute(`src`),this.appendSource&&H_(r),r.load()):this.warn(`media|source.src was changed by a third party - skip cleanup`)),this.media=null),this.hls.trigger(q.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){let t=this.tracks[e]?.buffer;if(this.removeBuffer(e),t)try{var n;(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}catch(t){this.warn(`onBufferReset ${e}`,t)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[W_(e)]=[null,null];let t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new L_(this.tracks)}onBufferCodecs(e,t){let n=this.tracks,r=Object.keys(t);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);let i=`audiovideo`in t&&(n.audio||n.video)||n.audiovideo&&(`audio`in t||`video`in t),a=!i&&this.sourceBufferCount&&this.media&&r.some(e=>!n[e]);if(i||a){this.warn(`Unsupported transition between "${Object.keys(n)}" and "${r}" SourceBuffers`);return}r.forEach(e=>{var r;let{id:i,codec:a,levelCodec:o,container:s,metadata:c,supplemental:l}=t[e],u=n[e],d=(r=this.transferData)==null||(r=r.tracks)==null?void 0:r[e],f=d!=null&&d.buffer?d:u,p=f?.pendingCodec||f?.codec,m=f?.levelCodec;u||=n[e]={buffer:void 0,listeners:[],codec:a,supplemental:l,container:s,levelCodec:o,metadata:c,id:i};let h=df(p,m),g=h?.replace(R_,`$1`),_=df(a,o),v=_?.replace(R_,`$1`);_&&h&&g!==v&&(e.slice(0,5)===`audio`&&(_=lf(_,this.appendSource)),this.log(`switching codec ${p} to ${_}`),_!==(u.pendingCodec||u.codec)&&(u.pendingCodec=_),u.container=s,this.appendChangeType(e,s,_))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&t.audio?.id===`main`&&(this.log(`Main audio-only`),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{let n=this.tracks[t];return e[t]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},e},{})}appendChangeType(e,t,n){let r=`${t};codecs=${n}`,i={label:`change-type=${r}`,execute:()=>{let i=this.tracks[e];if(i){let a=i.buffer;a!=null&&a.changeType&&(this.log(`changing ${e} sourceBuffer type to ${r}`),a.changeType(r),i.codec=n,i.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}};this.append(i,e,this.isPending(this.tracks[e]))}blockAudio(e){let t=e.start,n=t+e.duration*.05;if(this.fragmentTracker.getAppendedFrag(t,Y.MAIN)?.gap===!0)return;let r={label:`block-audio`,execute:()=>{let e=this.tracks.video;(this.lastVideoAppendEnd>n||e!=null&&e.buffer&&Q.isBuffered(e.buffer,n)||this.fragmentTracker.getAppendedFrag(n,Y.MAIN)?.gap===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext(`audio`))},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn(`Error executing block-audio operation`,e)}};this.blockedAudioAppend={op:r,frag:e},this.append(r,`audio`,!0)}unblockAudio(){let{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){let{tracks:n}=this,{data:r,type:i,parent:a,frag:o,part:s,chunkMeta:c,offset:l}=t,u=c.buffering[i],{sn:d,cc:f}=o,p=self.performance.now();u.start=p;let m=o.stats.buffering,h=s?s.stats.buffering:null;m.start===0&&(m.start=p),h&&h.start===0&&(h.start=p);let g=n.audio,_=!1;i===`audio`&&g?.container===`audio/mpeg`&&(_=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);let v=n.video,y=v?.buffer;if(y&&d!==`initSegment`){let e=s||o,t=this.blockedAudioAppend;if(i===`audio`&&a!==`main`&&!this.blockedAudioAppend&&!(v.ending||v.ended)){let t=e.start+e.duration*.05,n=y.buffered,r=this.currentOp(`video`);(!n.length&&!r||!r&&!Q.isBuffered(y,t)&&this.lastVideoAppendEnd<t)&&this.blockAudio(e)}else if(i===`video`){let n=e.end;if(t){let e=t.frag.start;(n>e||n<this.lastVideoAppendEnd||Q.isBuffered(y,e))&&this.unblockAudio()}this.lastVideoAppendEnd=n}}let b=(s||o).start,x={label:`append-${i}`,execute:()=>{u.executeStart=self.performance.now();let e=this.tracks[i]?.buffer;e&&(_?this.updateTimestampOffset(e,b,.1,i,d,f):l!==void 0&&W(l)&&this.updateTimestampOffset(e,l,1e-6,i,d,f)),this.appendExecutor(r,i)},onStart:()=>{},onComplete:()=>{let e=self.performance.now();u.executeEnd=u.end=e,m.first===0&&(m.first=e),h&&h.first===0&&(h.first=e);let t={};this.sourceBuffers.forEach(([e,n])=>{e&&(t[e]=Q.getBuffered(n))}),this.appendErrors[i]=0,i===`audio`||i===`video`?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(q.BUFFER_APPENDED,{type:i,frag:o,part:s,chunkMeta:c,parent:o.type,timeRanges:t})},onError:e=>{let t={type:G.MEDIA_ERROR,parent:o.type,details:K.BUFFER_APPEND_ERROR,sourceBufferName:i,frag:o,part:s,chunkMeta:c,error:e,err:e,fatal:!1},n=this.media?.error;if(e.code===DOMException.QUOTA_EXCEEDED_ERR||e.name==`QuotaExceededError`||`quota`in e)t.details=K.BUFFER_FULL_ERROR;else if(e.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!n)t.errorAction=bp(!0);else if(e.name===z_&&this.sourceBufferCount===0)t.errorAction=bp(!0);else{let e=++this.appendErrors[i];this.warn(`Failed ${e}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${i}" sourceBuffer (${n||`no media error`})`),(e>=this.hls.config.appendErrorMaxRetry||n)&&(t.fatal=!0)}this.hls.trigger(q.ERROR,t)}};this.log(`queuing "${i}" append sn: ${d}${s?` p: `+s.index:``} of ${o.type===Y.MAIN?`level`:`track`} ${o.level} cc: ${f}`),this.append(x,i,this.isPending(this.tracks[i]))}getFlushOp(e,t,n){return this.log(`queuing "${e}" remove ${t}-${n}`),{label:`remove`,execute:()=>{this.removeExecutor(e,t,n)},onStart:()=>{},onComplete:()=>{this.hls.trigger(q.BUFFER_FLUSHED,{type:e})},onError:r=>{this.warn(`Failed to remove ${t}-${n} from "${e}" SourceBuffer`,r)}}}onBufferFlushing(e,t){let{type:n,startOffset:r,endOffset:i}=t;n?this.append(this.getFlushOp(n,r,i),n):this.sourceBuffers.forEach(([e])=>{e&&this.append(this.getFlushOp(e,r,i),e)})}onFragParsed(e,t){let{frag:n,part:r}=t,i=[],a=r?r.elementaryStreams:n.elementaryStreams;a[dd.AUDIOVIDEO]?i.push(`audiovideo`):(a[dd.AUDIO]&&i.push(`audio`),a[dd.VIDEO]&&i.push(`video`)),i.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers(()=>{let e=self.performance.now();n.stats.buffering.end=e,r&&(r.stats.buffering.end=e);let t=r?r.stats:n.stats;this.hls.trigger(q.FRAG_BUFFERED,{frag:n,part:r,stats:t,id:n.type})},i).catch(e=>{this.warn(`Fragment buffered callback ${e}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){let t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){this.sourceBuffers.forEach(([e])=>{if(e){let n=this.tracks[e];(!t.type||t.type===e)&&(n.ending=!0,n.ended||(n.ended=!0,this.log(`${e} buffer reached EOS`)))}});let n=this.overrides?.endOfStream!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{var t;return e&&!((t=this.tracks[e])!=null&&t.ended)})?n?(this.log(`Queueing EOS`),this.blockUntilOpen(()=>{this.tracksEnded();let{mediaSource:e}=this;if(!e||e.readyState!==`open`){e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`);return}this.log(`Calling mediaSource.endOfStream()`),e.endOfStream(),this.hls.trigger(q.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(q.BUFFERED_TO_END,void 0)):t.type===`video`&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){let t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{let e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===K.BUFFER_APPEND_ERROR&&t.frag){let e=t.errorAction?.nextAutoLevel;W(e)&&e!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){let{hls:e,details:t,media:n}=this;if(!n||t===null||!this.sourceBufferCount)return;let r=e.config,i=n.currentTime,a=t.levelTargetDuration,o=t.live&&r.liveBackBufferLength!==null?r.liveBackBufferLength:r.backBufferLength;if(W(o)&&o>=0){let e=Math.max(o,a),t=Math.floor(i/a)*a-e;this.flushBackBuffer(i,a,t)}let s=r.frontBufferFlushThreshold;if(W(s)&&s>0){let e=Math.max(r.maxBufferLength,s),t=Math.max(e,a),n=Math.floor(i/a)*a+t;this.flushFrontBuffer(i,a,n)}}flushBackBuffer(e,t,n){this.sourceBuffers.forEach(([e,t])=>{if(t){let i=Q.getBuffered(t);if(i.length>0&&n>i.start(0)){var r;this.hls.trigger(q.BACK_BUFFER_REACHED,{bufferEnd:n});let t=this.tracks[e];if((r=this.details)!=null&&r.live)this.hls.trigger(q.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(t!=null&&t.ended){this.log(`Cannot flush ${e} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(q.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:e})}}})}flushFrontBuffer(e,t,n){this.sourceBuffers.forEach(([t,r])=>{if(r){let i=Q.getBuffered(r),a=i.length;if(a<2)return;let o=i.start(a-1),s=i.end(a-1);if(n>o||e>=o&&e<=s)return;this.hls.trigger(q.BUFFER_FLUSHING,{startOffset:o,endOffset:1/0,type:t})}})}getDurationAndRange(){let{details:e,mediaSource:t}=this;if(!e||!this.media||t?.readyState!==`open`)return null;let n=e.edge;if(e.live&&this.hls.config.liveDurationInfinity){if(e.fragments.length&&t.setLiveSeekableRange){let t=Math.max(0,e.fragmentStart);return{duration:1/0,start:t,end:Math.max(t,n)}}return{duration:1/0}}let r=this.overrides?.duration;if(r)return W(r)?{duration:r}:null;let i=this.media.duration;return n>(W(t.duration)?t.duration:0)&&n>i||!W(i)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:n}){let r=this.mediaSource;!this.media||!r||r.readyState!==`open`||(r.duration!==e&&(W(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),r.duration=e),t!==void 0&&n!==void 0&&(this.log(`MediaSource duration is set to ${r.duration}. Setting seekable range to ${t}-${n}.`),r.setLiveSeekableRange(t,n)))}get tracksReady(){let e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){let{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:n}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${Bf(n)}`),this.tracksReady){let e=this.transferData?.tracks;e&&Object.keys(e).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){let e={};this.sourceBuffers.forEach(([t,n])=>{if(t){let r=this.tracks[t];e[t]={buffer:n,container:r.container,codec:r.codec,supplemental:r.supplemental,levelCodec:r.levelCodec,id:r.id,metadata:r.metadata}}}),this.hls.trigger(q.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([e])=>{this.executeNext(e)})}else{let e=Error(`could not create source buffer for media codec(s)`);this.hls.trigger(q.ERROR,{type:G.MEDIA_ERROR,details:K.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){let{tracks:e,sourceBuffers:t,mediaSource:n}=this;if(!n)throw Error(`createSourceBuffers called when mediaSource was null`);for(let i in e){let a=i,o=e[a];if(this.isPending(o)){let e=this.getTrackCodec(o,a),i=`${o.container};codecs=${e}`;o.codec=e,this.log(`creating sourceBuffer(${i})${this.currentOp(a)?` Queued`:``} ${Bf(o)}`);try{let e=n.addSourceBuffer(i),r=W_(a);t[r]=[a,e],o.buffer=e}catch(e){var r;this.error(`error while trying to add sourceBuffer: ${e.message}`),this.shiftAndExecuteNext(a),(r=this.operationQueue)==null||r.removeBlockers(),delete this.tracks[a],this.hls.trigger(q.ERROR,{type:G.MEDIA_ERROR,details:K.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:a,mimeType:i,parent:o.id});return}this.trackSourceBuffer(a,o)}}this.bufferCreated()}getTrackCodec(e,t){let n=e.supplemental,r=e.codec;n&&(t===`video`||t===`audiovideo`)&&ef(n,`video`)&&(r=uf(r,n));let i=df(r,e.levelCodec);return i?t.slice(0,5)===`audio`?lf(i,this.appendSource):i:``}trackSourceBuffer(e,t){let n=t.buffer;if(!n)return;let r=this.getTrackCodec(t,e);this.tracks[e]={buffer:n,codec:r,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,`updatestart`,this.onSBUpdateStart),this.addBufferListener(e,`updateend`,this.onSBUpdateEnd),this.addBufferListener(e,`error`,this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,`bufferedchange`,(e,t)=>{let n=t.removedRanges;n!=null&&n.length&&this.hls.trigger(q.BUFFER_FLUSHED,{type:e})})}get mediaSrc(){var e,t;return(((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,`source`))||this.media)?.src}onSBUpdateStart(e){let t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){if(this.mediaSource?.readyState===`closed`){this.resetBuffer(e);return}let t=this.currentOp(e);t&&(t.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){let n=Error(`${e} SourceBuffer error. MediaSource readyState: ${this.mediaSource?.readyState}`);this.error(`${n}`,t),this.hls.trigger(q.ERROR,{type:G.MEDIA_ERROR,details:K.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});let r=this.currentOp(e);r&&r.onError(n)}updateTimestampOffset(e,t,n,r,i,a){let o=t-e.timestampOffset;Math.abs(o)>=n&&(this.log(`Updating ${r} SourceBuffer timestampOffset to ${t} (sn: ${i} cc: ${a})`),e.timestampOffset=t)}removeExecutor(e,t,n){let{media:r,mediaSource:i}=this,a=this.tracks[e],o=a?.buffer;if(!r||!i||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}let s=W(r.duration)?r.duration:1/0,c=W(i.duration)?i.duration:1/0,l=Math.max(0,t),u=Math.min(n,s,c);u>l&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${l},${u}] from the ${e} SourceBuffer`),o.remove(l,u)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){let n=this.tracks[t],r=n?.buffer;if(!r)throw new B_(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);n.ending=!1,n.ended=!1,r.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(e=>{this.warn(`SourceBuffer blocked callback ${e}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(e){this.warn(`Callback run without blocking ${this.operationQueue} ${e}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log(`Blocking operation requested, but no SourceBuffers exist`),Promise.resolve().then(e);let{operationQueue:n}=this,r=t.map(e=>this.appendBlocker(e));return t.length>1&&this.blockedAudioAppend&&this.unblockAudio(),Promise.all(r).then(t=>
vendor: 6,921 bytes, line 29
29{n===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(e=>{let t=this.tracks[e]?.buffer;!t||t.updating||this.shiftAndExecuteNext(e)})}append(e,t,n){this.operationQueue&&this.operationQueue.append(e,t,n)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,n){let r=this.tracks[e];if(!r)return;let i=r.buffer;if(!i)return;let a=n.bind(this,e);r.listeners.push({event:t,listener:a}),i.addEventListener(t,a)}removeBufferListeners(e){let t=this.tracks[e];if(!t)return;let n=t.buffer;n&&(t.listeners.forEach(e=>{n.removeEventListener(e.event,e.listener)}),t.listeners.length=0)}};function H_(e){let t=e.querySelectorAll(`source`);[].slice.call(t).forEach(t=>{e.removeChild(t)})}function U_(e,t){let n=self.document.createElement(`source`);n.type=`video/mp4`,n.src=t,e.appendChild(n)}function W_(e){return e===`audio`?1:0}var G_=class e{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=1/0,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){let{hls:e}=this;e.on(q.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(q.MANIFEST_PARSED,this.onManifestParsed,this),e.on(q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(q.BUFFER_CODECS,this.onBufferCodecs,this),e.on(q.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){let{hls:e}=this;e.off(q.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(q.MANIFEST_PARSED,this.onManifestParsed,this),e.off(q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(q.BUFFER_CODECS,this.onBufferCodecs,this),e.off(q.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){let n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){let n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&W(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}let e=this.hls.levels;if(e.length){let t=this.hls,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(t){let n=this.hls.levels;if(!n.length)return-1;let r=n.filter((e,n)=>this.isLevelAllowed(e)&&n<=t);return this.clientRect=null,e.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=1/0,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=1/0,this.timer&&=(self.clearInterval(this.timer),void 0)}getDimensions(){if(this.clientRect)return this.clientRect;let e=this.media,t={width:0,height:0};if(e){let n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,!t.width&&!t.height&&(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;let r=(e,t)=>t?e.width!==t.width||e.height!==t.height:!0,i=e.length-1,a=Math.max(t,n);for(let t=0;t<e.length;t+=1){let n=e[t];if((n.width>=a||n.height>=a)&&r(n,e[t+1])){i=t;break}}return i}},K_={MANIFEST:`m`,AUDIO:`a`,VIDEO:`v`,MUXED:`av`,INIT:`i`,CAPTION:`c`,TIMED_TEXT:`tt`,KEY:`k`,OTHER:`o`},q_={HLS:`h`},J_=class e{constructor(t,n){Array.isArray(t)&&(t=t.map(t=>t instanceof e?t:new e(t))),this.value=t,this.params=n}},Y_=`Dict`;function X_(e){return Array.isArray(e)?JSON.stringify(e):e instanceof Map?`Map{}`:e instanceof Set?`Set{}`:typeof e==`object`?JSON.stringify(e):String(e)}function Z_(e,t,n,r){return Error(`failed to ${e} "${X_(t)}" as ${n}`,{cause:r})}function Q_(e,t,n){return Z_(`serialize`,e,t,n)}var $_=class{constructor(e){this.description=e}},ev=`Bare Item`,tv=`Boolean`;function nv(e){if(typeof e!=`boolean`)throw Q_(e,tv);return e?`?1`:`?0`}function rv(e){return btoa(String.fromCharCode(...e))}var iv=`Byte Sequence`;function av(e){if(ArrayBuffer.isView(e)===!1)throw Q_(e,iv);return`:${rv(e)}:`}var ov=`Integer`;function sv(e){return e<-999999999999999||999999999999999<e}function cv(e){if(sv(e))throw Q_(e,ov);return e.toString()}function lv(e){return`@${cv(e.getTime()/1e3)}`}function uv(e,t){if(e<0)return-uv(-e,t);let n=10**t;if(Math.abs(e*n%1-.5)<2**-52){let t=Math.floor(e*n);return(t%2==0?t:t+1)/n}else return Math.round(e*n)/n}var dv=`Decimal`;function fv(e){let t=uv(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw Q_(e,dv);let n=t.toString();return n.includes(`.`)?n:`${n}.0`}var pv=`String`,mv=/[\x00-\x1f\x7f]+/;function hv(e){if(mv.test(e))throw Q_(e,pv);return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}
29function gv(e){return e.description||e.toString().slice(7,-1)}var _v=`Token`;function vv(e){let t=gv(e);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t)===!1)throw Q_(t,_v);return t}function yv(e){switch(typeof e){case`number`:if(!W(e))throw Q_(e,ev);return Number.isInteger(e)?cv(e):fv(e);case`string`:return hv(e);case`symbol`:return vv(e);case`boolean`:return nv(e);case`object`:if(e instanceof Date)return lv(e);if(e instanceof Uint8Array)return av(e);if(e instanceof $_)return vv(e);default:throw Q_(e,ev)}}var bv=`Key`;function xv(e){if(/^[a-z*][a-z0-9\-_.*]*$/.test(e)===!1)throw Q_(e,bv);return e}function Sv(e){return e==null?``:Object.entries(e).map(([e,t])=>t===!0?`;${xv(e)}`:`;${xv(e)}=${yv(t)}`).join(``)}function Cv(e){return e instanceof J_?`${yv(e.value)}${Sv(e.params)}`:yv(e)}function wv(e){return`(${e.value.map(Cv).join(` `)})${Sv(e.params)}`}function Tv(e,t={whitespace:!0}){if(typeof e!=`object`||!e)throw Q_(e,Y_);let n=e instanceof Map?e.entries():Object.entries(e),r=t?.whitespace?` `:``;return Array.from(n).map(([e,t])=>{t instanceof J_||(t=new J_(t));let n=xv(e);return t.value===!0?n+=Sv(t.params):(n+=`=`,Array.isArray(t.value)?n+=wv(t):n+=Cv(t)),n}).join(`,${r}`)}function Ev(e,t){return Tv(e,t)}var Dv=`CMCD-Object`,Ov=`CMCD-Request`,kv=`CMCD-Session`,Av=`CMCD-Status`,jv={br:Dv,ab:Dv,d:Dv,ot:Dv,tb:Dv,tpb:Dv,lb:Dv,tab:Dv,lab:Dv,url:Dv,pb:Ov,bl:Ov,tbl:Ov,dl:Ov,ltc:Ov,mtp:Ov,nor:Ov,nrr:Ov,rc:Ov,sn:Ov,sta:Ov,su:Ov,ttfb:Ov,ttfbb:Ov,ttlb:Ov,cmsdd:Ov,cmsds:Ov,smrt:Ov,df:Ov,cs:Ov,ts:Ov,cid:kv,pr:kv,sf:kv,sid:kv,st:kv,v:kv,msd:kv,bs:Av,bsd:Av,cdn:Av,rtp:Av,bg:Av,pt:Av,ec:Av,e:Av},Mv={REQUEST:Ov};function Nv(e){return Object.keys(e).reduce((t,n)=>{var r;return(r=e[n])==null||r.forEach(e=>t[e]=n),t},{})}function Pv(e,t){let n={};if(!e)return n;let r=Object.keys(e),i=t?Nv(t):{};return r.reduce((t,n)=>{let r=jv[n]||i[n]||Mv.REQUEST,a=t[r]??(t[r]={});return a[n]=e[n],t},n)}function Fv(e){return[`ot`,`sf`,`st`,`e`,`sta`].includes(e)}function Iv(e){return typeof e==`number`?W(e):e!=null&&e!==``&&e!==!1}var Lv=`event`;function Rv(e,t){let n=new URL(e),r=new URL(t);if(n.origin!==r.origin)return e;let i=n.pathname.split(`/`).slice(1),a=r.pathname.split(`/`).slice(1,-1);for(;i[0]===a[0];)i.shift(),a.shift();for(;a.length;)a.shift(),i.unshift(`..`);return i.join(`/`)+n.search+n.hash}var zv=e=>Math.round(e),Bv=(e,t)=>Array.isArray(e)?e.map(e=>Bv(e,t)):e instanceof J_&&typeof e.value==`string`?new J_(Bv(e.value,t),e.params):(t.baseUrl&&(e=Rv(e,t.baseUrl)),t.version===1?encodeURIComponent(e):e),Vv=e=>zv(e/100)*100,Hv={br:zv,d:zv,bl:Vv,dl:Vv,mtp:Vv,nor:(e,t)=>{let n=e;return t.version>=2&&(e instanceof J_&&typeof e.value==`string`?n=new J_([e]):typeof e==`string`&&(n=[e])),Bv(n,t)},rtp:Vv,tb:zv},Uv=`request`,Wv=`response`,Gv=`ab.bg.bl.br.bs.bsd.cdn.cid.cs.df.ec.lab.lb.ltc.msd.mtp.pb.pr.pt.sf.sid.sn.st.sta.tab.tb.tbl.tpb.ts.v`.split(`.`),Kv=[`e`],qv=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Jv(e){return qv.test(e)}function Yv(e){return Gv.includes(e)||Kv.includes(e)||Jv(e)}var Xv=[`d`,`dl`,`nor`,`ot`,`rtp`,`su`];function Zv(e){return Gv.includes(e)||Xv.includes(e)||Jv(e)}var Qv=[`cmsdd`,`cmsds`,`rc`,`smrt`,`ttfb`,`ttfbb`,`ttlb`,`url`];function $v(e){return Gv.includes(e)||Xv.includes(e)||Qv.includes(e)||Jv(e)}var ey=[`bl`,`br`,`bs`,`cid`,`d`,`dl`,`mtp`,`nor`,`nrr`,`ot`,`pr`,`rtp`,`sf`,`sid`,`st`,`su`,`tb`,`v`];function ty(e){return ey.includes(e)||Jv(e)}var ny={[Wv]:$v,[Lv]:Yv,[Uv]:Zv};function ry(e,t={}){let n={};if(typeof e!=`object`||!e)return n;let r=t.version||e.v||1,i=t.reportingMode||Uv,a=r===1?ty:ny[i],o=Object.keys(e).filter(a),s=t.filter;typeof s==`function`&&(o=o.filter(s));let c=i===Wv||i===Lv;c&&!o.includes(`ts`)&&o.push(`ts`),r>1&&!o.includes(`v`)&&o.push(`v`);let l=zu({},Hv,t.formatters),u={version:r,reportingMode:i,baseUrl:t.baseUrl};return o.sort().forEach(t=>{let i=e[t],a=l[t];if(typeof a==`function`&&(i=a(i,u)),t===`v`){if(r===1)return;i=r}t==`pr`&&i===1||(c&&t===`ts`&&!W(i)&&(i=Date.now()),Iv(i)&&(Fv(t)&&typeof i==`string`&&(i=new $_(i)),n[t]=i))}),n}function iy(e,t={}){let n={};if(!e)return n;let r=Pv(ry(e,t),t?.customHeaderMap);return Object.entries(r).reduce((e,[t,n])=>{let r=Ev(n,{whitespace:!1});return r&&(e[t]=r),e},n)}function ay(e,t,n){return zu(e,iy(t,n))}var oy=`CMCD`;function sy(e,t={}){return e?Ev(ry(e,t),{whitespace:!1}):``}function cy(e,t={}){if(!e)return``;let n=sy(e,t);return encodeURIComponent(n)}function ly(e,t={}){return e?`${oy}=${cy(e,t)}`:``}var uy=/CMCD=[^&#]+/;function dy(e,t,n){let r=ly(t,n);return r?uy.test(e)?e.replace(uy,r):`${e}${e.includes(`?`)?`&`:`?`}${r}`:e}var fy=class{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||=!0,this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:K_.MANIFEST,su:!this.initialized})}catch(e){this.hls.logger.warn(`Could not generate manifest CMCD data.`,e)}},this.applyFragmentData=e=>{try{let{frag:t,part:n}=e,r=this.hls.levels[t.level],i=this.getObjectType(t),a={d:(n||t).duration*1e3,ot:i};(i===K_.VIDEO||i===K_.AUDIO||i==K_.MUXED)&&(a.br=r.bitrate/1e3,a.tb=this.getTopBandwidth(i)/1e3,a.bl=this.getBufferLength(i));let o=n?this.getNextPart(n):this.getNextFrag(t);o!=null&&o.url&&o.url!==t.url&&(a.nor=o.url),this.apply(e,a)}catch(e){this.hls.logger.warn(`Could not generate segment CMCD data.`,e)}},this.hls=e;let t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||e.sessionId,this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){let e=this.hls;
vendor: 10,249 bytes, line 29
29e.on(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(q.MEDIA_DETACHED,this.onMediaDetached,this),e.on(q.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){let e=this.hls;e.off(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(q.MEDIA_DETACHED,this.onMediaDetached,this),e.off(q.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener(`waiting`,this.onWaiting),this.media.addEventListener(`playing`,this.onPlaying)}onMediaDetached(){this.media&&=(this.media.removeEventListener(`waiting`,this.onWaiting),this.media.removeEventListener(`playing`,this.onPlaying),null)}onBufferCreated(e,t){this.audioBuffer=t.tracks.audio?.buffer,this.videoBuffer=t.tracks.video?.buffer}createData(){return{v:1,sf:q_.HLS,sid:this.sid,cid:this.cid,pr:this.media?.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){zu(t,this.createData());let n=t.ot===K_.INIT||t.ot===K_.VIDEO||t.ot===K_.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su??=this.buffering;let{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((e,n)=>(r.includes(n)&&(e[n]=t[n]),e),{}));let i={baseUrl:e.url};this.useHeaders?(e.headers||={},ay(e.headers,t,i)):e.url=dy(e.url,t,i)}getNextFrag(e){let t=this.hls.levels[e.level]?.details;if(t){let n=e.sn-t.startSN;return t.fragments[n+1]}}getNextPart(e){var t;let{index:n,fragment:r}=e,i=(t=this.hls.levels[r.level])==null||(t=t.details)==null?void 0:t.partList;if(i){let{sn:e}=r;for(let t=i.length-1;t>=0;t--){let r=i[t];if(r.index===n&&r.fragment.sn===e)return i[t+1]}}}getObjectType(e){let{type:t}=e;if(t===`subtitle`)return K_.TIMED_TEXT;if(e.sn===`initSegment`)return K_.INIT;if(t===`audio`)return K_.AUDIO;if(t===`main`)return this.hls.audioTracks.length?K_.VIDEO:K_.MUXED}getTopBandwidth(e){let t=0,n,r=this.hls;if(e===K_.AUDIO)n=r.audioTracks;else{let e=r.maxAutoLevel,t=e>-1?e+1:r.levels.length;n=r.levels.slice(0,t)}return n.forEach(e=>{e.bitrate>t&&(t=e.bitrate)}),t>0?t:NaN}getBufferLength(e){let t=this.media,n=e===K_.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:Q.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){let{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new n(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,n,r){t(e),this.loader.load(e,n,r)}}}createFragmentLoader(){let{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new n(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,n,r){t(e),this.loader.load(e,n,r)}}}},py=3e5,my=class extends Wu{constructor(e){super(`content-steering`,e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=`.`,this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){let e=this.hls;e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(q.MANIFEST_PARSED,this.onManifestParsed,this),e.on(q.ERROR,this.onError,this)}unregisterListeners(){let e=this.hls;e&&(e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(q.MANIFEST_PARSED,this.onManifestParsed,this),e.off(q.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){let e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&=(this.loader.destroy(),null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){let t=this.levels;t&&(this.levels=t.filter(t=>t!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=`.`,this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){let{contentSteering:n}=t;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){let{errorAction:n}=t;if(n?.action===_p.SendAlternateToPenaltyBox&&n.flags===vp.MoveAllAlternatesMatchingHost){let e=this.levels,r=this._pathwayPriority,i=this.pathwayId;if(t.context){let{groupId:n,pathwayId:r,type:a}=t.context;n&&e?i=this.getPathwayForGroupId(n,a,i):r&&(i=r)}i in this.penalizedPathways||(this.penalizedPathways[i]=performance.now()),!r&&e&&(r=this.pathways()),r&&r.length>1&&(this.updatePathwayPriority(r),n.resolved=this.pathwayId!==i),t.details===K.BUFFER_APPEND_ERROR&&!t.fatal?n.resolved=!0:n.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${i} levels: ${e&&e.length} priorities: ${Bf(r)} penalized: ${Bf(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){let n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t,n=this.penalizedPathways,r=performance.now();Object.keys(n).forEach(e=>{r-n[e]>py&&delete n[e]});for(let r=0;r<e.length;r++){let i=e[r];if(i in n)continue;if(i===this.pathwayId)return;let a=this.hls.nextLoadLevel,o=this.hls.levels[a];if(t=this.getLevelsForPathway(i),t.length>0){this.log(`Setting Pathway to "${i}"`),this.pathwayId=i,oh(t),this.hls.trigger(q.LEVELS_UPDATED,{levels:t});let e=this.hls.levels[a];o&&e&&this.levels&&(e.attrs[`STABLE-VARIANT-ID`]!==o.attrs[`STABLE-VARIANT-ID`]&&e.bitrate!==o.bitrate&&this.log(`Unstable Pathways change from bitrate ${o.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,n){let r=this.getLevelsForPathway(n).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===J.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===J.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return n}clonePathways(e){let t=this.levels;if(!t)return;let n={},r={};e.forEach(e=>{let{ID:i,"BASE-ID":a,"URI-REPLACEMENT":o}=e;if(t.some(e=>e.pathwayId===i))return;let s=this.getLevelsForPathway(a).map(e=>{let t=new Zp(e.attrs);t[`PATHWAY-ID`]=i;let a=t.AUDIO&&`${t.AUDIO}_clone_${i}`,s=t.SUBTITLES&&`${t.SUBTITLES}_clone_${i}`;a&&(n[t.AUDIO]=a,t.AUDIO=a),s&&(r[t.SUBTITLES]=s,t.SUBTITLES=s);let c=gy(e.uri,t[`STABLE-VARIANT-ID`],`PER-VARIANT-URIS`,o),l=new Ff({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:c,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t<e.audioGroups.length;t++)l.addGroupId(`audio`,`${e.audioGroups[t]}_clone_${i}`);if(e.subtitleGroups)for(let t=1;t<e.subtitleGroups.length;t++)l.addGroupId(`text`,`${e.subtitleGroups[t]}_clone_${i}`);return l});t.push(...s),hy(this.audioTracks,n,o,i),hy(this.subtitleTracks,r,o,i)})}loadSteeringManifest(e){let t=this.hls.config,n=t.loader;this.loader&&this.loader.destroy(),this.loader=new n(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!==`data:`){let e=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set(`_HLS_pathway`,this.pathwayId),r.searchParams.set(`_HLS_throughput`,``+e)}let i={responseType:`json`,url:r.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},s={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0};this.log(`Requesting steering manifest: ${r}`),this.loader.load(i,s,{onSuccess:(e,t,n,i)=>{this.log(`Loaded steering manifest: "${r}"`);let a=e.data;if(a?.VERSION!==1){this.log(`Steering VERSION ${a.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=a.TTL;let{"RELOAD-URI":o,"PATHWAY-CLONES":s,"PATHWAY-PRIORITY":c}=a;if(o)try{this.uri=new self.URL(o,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${o}`);return}this.scheduleRefresh(this.uri||n.url),s&&this.clonePathways(s);let l={steeringManifest:a,url:r.toString()};this.hls.trigger(q.STEERING_MANIFEST_LOADED,l),c&&this.updatePathwayPriority(c)},onError:(e,t,n,r)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),e.code===410){this.enabled=!1,this.log(`Steering manifest ${t.url} no longer available`);return}let i=this.timeToLoad*1e3;if(e.code===429){let e=this.loader;if(typeof e?.getResponseHeader==`function`){let t=e.getResponseHeader(`Retry-After`);t&&(i=parseFloat(t)*1e3)}this.log(`Steering manifest ${t.url} rate limited`);return}this.scheduleRefresh(this.uri||t.url,i)},onTimeout:(e,t,n)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}})}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{let t=this.hls?.media;if(t&&!t.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}};function hy(e,t,n,r){e&&Object.keys(t).forEach(i=>
29{let a=e.filter(e=>e.groupId===i).map(e=>{let a=zu({},e);return a.details=void 0,a.attrs=new Zp(a.attrs),a.url=a.attrs.URI=gy(e.url,e.attrs[`STABLE-RENDITION-ID`],`PER-RENDITION-URIS`,n),a.groupId=a.attrs[`GROUP-ID`]=t[i],a.attrs[`PATHWAY-ID`]=r,a});e.push(...a)})}function gy(e,t,n,r){let{HOST:i,PARAMS:a,[n]:o}=r,s;t&&(s=o?.[t],s&&(e=s));let c=new self.URL(e);return i&&!s&&(c.host=i),a&&Object.keys(a).sort().forEach(e=>{e&&c.searchParams.set(e,a[e])}),c.href}var _y=class e extends Wu{constructor(t){super(`eme`,t.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=e.CDMCleanupPromise?[e.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=e=>{let{initDataType:t,initData:n}=e,r=`"${e.type}" event: init data type: "${t}"`;if(this.debug(r),n!==null){if(!this.keyFormatPromise){let e=Object.keys(this.keySystemAccessPromises);e.length||(e=vm(this.config));let t=e.map(_m).filter(e=>!!e);this.keyFormatPromise=this.getKeyFormatPromise(t)}this.keyFormatPromise.then(i=>{let a=gm(i);if(t!==`sinf`||a!==mm.FAIRPLAY){this.log(`Ignoring "${e.type}" event with init data type: "${t}" for selected key-system ${a}`);return}let o;try{let e=xd(new Uint8Array(n)),t=Ld(cm(JSON.parse(e).sinf));if(!t)throw Error(`'schm' box missing or not cbcs/cenc with schi > tenc`);o=new Uint8Array(t.subarray(8,24))}catch(e){this.warn(`${r} Failed to parse sinf: ${e}`);return}let s=rd(o),{keyIdToKeySessionPromise:c,mediaKeySessions:l}=this,u=c[s];for(let e=0;e<l.length;e++){let r=l[e],i=r.decryptdata;if(!i.keyId)continue;let a=rd(i.keyId);if(im(o,i.keyId)||i.uri.replace(/-/g,``).indexOf(s)!==-1){if(u=c[a],!u)continue;if(i.pssh)break;delete c[a],i.pssh=new Uint8Array(n),i.keyId=o,u=c[s]=u.then(()=>this.generateRequestWithPreferredKeySession(r,t,n,`encrypted-event-key-match`)),u.catch(e=>this.handleError(e));break}}u||this.handleError(Error(`Key ID ${s} not encountered in playlist. Key-system sessions ${l.length}.`))}).catch(e=>this.handleError(e))}},this.onWaitingForKey=e=>{this.log(`"${e.type}" event`)},this.hls=t,this.config=t.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();let e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}
29registerListeners(){this.hls.on(q.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(q.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(q.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(q.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(q.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(q.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(q.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(q.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(q.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(q.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){let{drmSystems:t,widevineLicenseUrl:n}=this.config,r=t?.[e];if(r)return r.licenseUrl;if(e===mm.WIDEVINE&&n)return n}getLicenseServerUrlOrThrow(e){let t=this.getLicenseServerUrl(e);if(t===void 0)throw Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){let{drmSystems:t}=this.config,n=t?.[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){let t=this.hls.levels,n=(e,t,n)=>!!e&&n.indexOf(e)===t,r=t.map(e=>e.audioCodec).filter(n),i=t.map(e=>e.videoCodec).filter(n);return r.length+i.length===0&&i.push(`avc1.42e01e`),new Promise((t,n)=>{let a=e=>{let o=e.shift();this.getMediaKeysPromise(o,r,i).then(e=>t({keySystem:o,mediaKeys:e})).catch(t=>{e.length?a(e):t instanceof by?n(t):n(new by({type:G.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))})};a(e)})}requestMediaKeySystemAccess(e,t){let{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!=`function`){let e=`Configured requestMediaKeySystemAccess is not a function ${n}`;return ym===null&&self.location.protocol===`http:`&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(Error(e))}return n(e,t)}getMediaKeysPromise(e,t,n){let r=bm(e,t,n,this.config.drmSystemOptions||{}),i=this.keySystemAccessPromises[e],a=i?.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Bf(r)}`),a=this.requestMediaKeySystemAccess(e,r);let t=i=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch(t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)}),a.then(n=>{this.log(`Access for key-system "${n.keySystem}" obtained`);let r=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);let i=t.mediaKeys=n.createMediaKeys().then(n=>(this.log(`Media-keys created for "${e}"`),t.hasMediaKeys=!0,r.then(t=>t?this.setMediaKeysServerCertificate(n,e,t):n)));return i.catch(t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)}),i})}return a.then(()=>i.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${rd(e.keyId||[])} keyUri: ${e.uri}`);let r={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:n.createSession(),keyStatus:`status-pending`};return this.mediaKeySessions.push(r),r}renewKeySession(e){let t=e.decryptdata;if(t.pssh){let n=this.createMediaKeySessionContext(e),r=vy(t);this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(n,`cenc`,t.pssh.buffer,`expired`)}else this.warn(`Could not renew expired session. Missing pssh initData.`);this.removeSession(e)}updateKeySession(e,t){let n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyId ${rd(e.decryptdata.keyId||[])} 30 } (data length: ${t.byteLength})`),n.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>_m(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:e,mediaKeys:t})=>this.attemptSetMediaKeys(e,t))}selectKeySystem(e){return new Promise((t,n)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:e})=>{let r=_m(e);r?t(r):n(Error(`Unable to find format for key-system "${e}"`))}).catch(n)})}selectKeySystemFormat(e){let t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||=(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(`, `)}`),this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){let t=vm(this.config),n=e.map(gm).filter(e=>!!e&&t.indexOf(e)!==-1);return this.selectKeySystem(n)}getKeyStatus(e){let{mediaKeySessions:t}=this;for(let n=0;n<t.length;n++){let r=yy(e,t[n]);if(r)return r}}loadKey(e){let t=e.keyInfo.decryptdata,n=vy(t),r=this.bannedKeyIds[n];if(r||this.getKeyStatus(t)===`internal-error`){let n=xy(r||`internal-error`,t);return this.handleError(n,e.frag),Promise.reject(n)}let i=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);let a=this.keyIdToKeySessionPromise[n];if(!a){let r=this.getKeySystemForKeyPromise(t).then(({keySystem:n,mediaKeys:r})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${i}`),this.attemptSetMediaKeys(n,r).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:n,mediaKeys:r,decryptdata:t}))))).then(e=>{let n=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(e,`cenc`,n,`playlist-key`)});return r.catch(t=>this.handleError(t,e.frag)),this.keyIdToKeySessionPromise[n]=r,r}return a.catch(n=>{if(n instanceof by){let r=Vu({},n.data);this.getKeyStatus(t)===`internal-error`&&(r.decryptdata=t);let i=new by(r,n.message);this.handleError(i,e.frag)}}),a}throwIfDestroyed(e=`Invalid state`){if(!this.hls)throw Error(`invalid state`)}handleError(e,t){if(this.hls)if(e instanceof by){t&&(e.data.frag=t);let n=e.data.decryptdata;this.error(`${e.message}${n?` (${rd(n.keyId||[])})`:``}`),this.hls.trigger(q.ERROR,e.data)}else this.error(e.message),this.hls.trigger(q.ERROR,{type:G.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}
30getKeySystemForKeyPromise(e){let t=vy(e),n=this.keyIdToKeySessionPromise[t];if(!n){let t=gm(e.keyFormat),n=t?[t]:vm(this.config);return this.attemptKeySystemAccess(n)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=vm(this.config)),e.length===0)throw new by({type:G.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Bf({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();let n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);let r=Promise.all(n).then(()=>this.media?this.media.setMediaKeys(t):new Promise((e,n)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return n(Error(`Attempted to set mediaKeys without media element attached`));this.mediaKeys=t,this.media.setMediaKeys(t).then(e).catch(n)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(e=>n.indexOf(e)===-1)})}generateRequestWithPreferredKeySession(e,t,n,r){var i;let a=(i=this.config.drmSystems)==null||(i=i[e.keySystem])==null?void 0:i.generateRequest;if(a)try{let r=a.call(this.hls,t,n,e);if(!r)throw Error(`Invalid response from configured generateRequest filter`);t=r.initDataType,n=r.initData?r.initData:null,e.decryptdata.pssh=n?new Uint8Array(n):null}catch(e){if(this.warn(e.message),this.hls&&this.hls.config.debug)throw e}if(n===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);let o=vy(e.decryptdata),s=e.decryptdata.uri;this.log(`Generating key-session request for "${r}" keyId: ${o} URI: ${s} (init data type: ${t} length: ${n.byteLength})`);let c=new Eh,l=e._onmessage=t=>{let n=e.mediaKeysSession;if(!n){c.emit(`error`,Error(`invalid state`));return}let{messageType:r,message:i}=t;this.log(`"${r}" message event for session "${n.sessionId}" message size: ${i.byteLength}`),r===`license-request`||r===`license-renewal`?this.renewLicense(e,i).catch(e=>{c.eventNames().length?c.emit(`error`,e):this.handleError(e)}):r===`license-release`?e.keySystem===mm.FAIRPLAY&&this.updateKeySession(e,lm(`acknowledged`)).then(()=>this.removeSession(e)).catch(e=>this.handleError(e)):this.warn(`unhandled media key message type "${r}"`)},u=(e,t)=>{t.keyStatus=e;let n;e.startsWith(`usable`)?c.emit(`resolved`):e===`internal-error`||e===`output-restricted`||e===`output-downscaled`?n=xy(e,t.decryptdata):e===`expired`?n=Error(`key expired (keyId: ${o})`):e===`released`?n=Error(`key released`):e===`status-pending`||this.warn(`unhandled key status change "${e}" (keyId: ${o}
30)`),n&&(c.eventNames().length?c.emit(`error`,n):this.handleError(n))},d=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession){c.emit(`error`,Error(`invalid state`));return}let n=this.getKeyStatuses(e);if(!Object.keys(n).some(e=>n[e]!==`status-pending`))return;if(n[o]===`expired`){this.log(`Expired key ${Bf(n)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let r=n[o];if(r)u(r,e);else{var i;let t=1e3;e.keyStatusTimeouts||={},(i=e.keyStatusTimeouts)[o]||(i[o]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;let n=this.getKeyStatus(e.decryptdata);if(n&&n!==`status-pending`)return this.log(`No status for keyId ${o} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${n} from other session.`),u(n,e);this.log(`key status for ${o} in key-session "${e.mediaKeysSession.sessionId}" timed out after ${t}ms`),r=`internal-error`,u(r,e)},t)),this.log(`No status for keyId ${o} (${Bf(n)}).`)}};gh(e.mediaKeysSession,`message`,l),gh(e.mediaKeysSession,`keystatuseschange`,d);let f=new Promise((e,t)=>{c.on(`error`,t),c.on(`resolved`,e)});return e.mediaKeysSession.generateRequest(t,n).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o} URI: ${s}`)}).catch(t=>{throw new by({type:G.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_SESSION,error:t,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${t}`)}).then(()=>f).catch(t=>(c.removeAllListeners(),this.removeSession(e).then(()=>{throw t}))).then(()=>(c.removeAllListeners(),e))}getKeyStatuses(e){let t={};return e.mediaKeysSession.keyStatuses.forEach((n,r)=>{if(typeof r==`string`&&typeof n==`object`){let e=r;r=n,n=e}let i=`buffer`in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r);if(e.keySystem===mm.PLAYREADY&&i.length===16){let e=rd(i);t[e]=n,dm(i)}let a=rd(i);n===`internal-error`&&(this.bannedKeyIds[a]=n),this.log(`key status change "${n}" for keyStatuses keyId: ${a} key-session "${e.mediaKeysSession.sessionId}"`),t[a]=n}),t}fetchServerCertificate(e){let t=this.config,n=t.loader,r=new n(t),i=this.getServerCertificateUrl(e);return i?(this.log(`Fetching server certificate for "${e}"`),new Promise((n,a)=>{let o={responseType:`arraybuffer`,url:i},s=t.certLoadPolicy.default,c={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};r.load(o,c,{onSuccess:(e,t,r,i)=>{n(e.data)},onError:(t,n,r,s)=>{a(new by({type:G.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:Vu({url:o.url,data:void 0},t)},`"${e}" certificate request failed (${i}). Status: ${t.code} (${t.text})`))},onTimeout:(t,n,r)=>{a(new by({type:G.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:o.url,data:void 0}},`"${e}" certificate request timed out (${i})`))},onAbort:(e,t,n)=>{a(Error(`aborted`))}})})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((r,i)=>{e.setServerCertificate(n).then(i=>{this.log(`setServerCertificate ${i?`success`:`not supported by CDM`} (${n.byteLength}) on "${t}"`),r(e)}).catch(e=>{i(new by({type:G.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(t=>this.updateKeySession(e,new Uint8Array(t)).catch(t=>{throw new by({type:G.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:t,fatal:!1},t.message)}))}unpackPlayReadyKeyMessage(e,t){let n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes(`PlayReadyKeyMessage`))return e.setRequestHeader(`Content-Type`,`text/xml; charset=utf-8`),t;let r=new DOMParser().parseFromString(n,`application/xml`),i=r.querySelectorAll(`HttpHeader`);if(i.length>0){let t;for(let n=0,r=i.length;n<r;n++){t=i[n];let r=t.querySelector(`name`)?.textContent,a=t.querySelector(`value`)?.textContent;r&&a&&e.setRequestHeader(r,a)}}let a=r.querySelector(`Challenge`)?.textContent;
vendor: 4,243 bytes, line 30
30if(!a)throw Error(`Cannot find <Challenge> in key message`);return lm(atob(a))}setupLicenseXHR(e,t,n,r){let i=this.config.licenseXhrSetup;return i?Promise.resolve().then(()=>{if(!n.decryptdata)throw Error(`Key removed`);return i.call(this.hls,e,t,n,r)}).catch(a=>{if(!n.decryptdata)throw a;return e.open(`POST`,t,!0),i.call(this.hls,e,t,n,r)}).then(n=>(e.readyState||e.open(`POST`,t,!0),{xhr:e,licenseChallenge:n||r})):(e.open(`POST`,t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){let n=this.config.keyLoadPolicy.default;return new Promise((r,i)=>{let a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);let o=new XMLHttpRequest;o.responseType=`arraybuffer`,o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return i(Error(`invalid state`));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let t=o.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);let n=this.config.licenseResponseCallback;if(n)try{t=n.call(this.hls,o,a,e)}catch(e){this.error(e)}r(t)}else{let s=n.errorRetry,c=s?s.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||o.status>=400&&o.status<500)i(new by({type:G.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{let n=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${n} attempts left`),this.requestLicense(e,t).then(r,i)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:t,licenseChallenge:n})=>{e.keySystem==mm.PLAYREADY&&(n=this.unpackPlayReadyKeyMessage(t,n)),t.send(n)}).catch(i)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;let n=t.media;this.media=n,gh(n,`encrypted`,this.onMediaEncrypted),gh(n,`waitingforkey`,this.onWaitingForKey);let r=this.mediaResolved;r?r():this.mediaKeys=n.mediaKeys}onMediaDetached(){let e=this.media;e&&(_h(e,`encrypted`,this.onMediaEncrypted),_h(e,`waitingforkey`,this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var t;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};let n=this.mediaResolved;if(n&&n(),!this.mediaKeys&&!this.mediaKeySessions.length)return;let r=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Tm.clearKeyUriToKeyIdMap();let a=i.length;e.CDMCleanupPromise=Promise.all(i.map(e=>this.removeSession(e)).concat((r==null||(t=r.setMediaKeys(null))==null?void 0:t.catch(e=>{this.log(`Could not clear media keys: ${e}`),this.hls&&this.hls.trigger(q.ERROR,{type:G.OTHER_ERROR,details:K.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:Error(`Could not clear media keys: ${e}`)})}))||Promise.resolve())).catch(e=>{this.log(`Could not close sessions and clear media keys: ${e}`),this.hls&&this.hls.trigger(q.ERROR,{type:G.OTHER_ERROR,details:K.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:Error(`Could not close sessions and clear media keys: ${e}`)})}).then(()=>{a&&this.log(`finished closing key sessions and clearing media keys`)})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){let e=t.reduce((e,t)=>(e.indexOf(t.keyFormat)===-1&&e.push(t.keyFormat),e),[]);this.log(`Selecting key-system from session-keys ${e.join(`, `)}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){let{mediaKeysSession:t,licenseXhr:n,decryptdata:r}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${rd(r?.keyId||[])}`),e._onmessage&&=(t.removeEventListener(`message`,e._onmessage),void 0),e._onkeystatuseschange&&=(t.removeEventListener(`keystatuseschange`,e._onkeystatuseschange),void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;let i=this.mediaKeySessions.indexOf(e);i>-1&&this.mediaKeySessions.splice(i,1);let{keyStatusTimeouts:a}=e;
30a&&Object.keys(a).forEach(e=>self.clearTimeout(a[e]));let{drmSystemOptions:o}=this.config;return(Sm(o)?new Promise((e,n)=>{self.setTimeout(()=>n(Error(`MediaKeySession.remove() timeout`)),8e3),t.remove().then(e).catch(n)}):Promise.resolve()).catch(e=>{this.log(`Could not remove session: ${e}`),this.hls&&this.hls.trigger(q.ERROR,{type:G.OTHER_ERROR,details:K.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:Error(`Could not remove session: ${e}`)})}).then(()=>t.close()).catch(e=>{this.log(`Could not close session: ${e}`),this.hls&&this.hls.trigger(q.ERROR,{type:G.OTHER_ERROR,details:K.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:Error(`Could not close session: ${e}`)})})}return Promise.resolve()}};_y.CDMCleanupPromise=void 0;function vy(e){if(!e)throw Error(`Could not read keyId of undefined decryptdata`);if(e.keyId===null)throw Error(`keyId is null`);return rd(e.keyId)}function yy(e,t){if(e.keyId&&t.mediaKeysSession.keyStatuses.has(e.keyId))return t.mediaKeysSession.keyStatuses.get(e.keyId);if(e.matches(t.decryptdata))return t.keyStatus}var by=class extends Error{constructor(e,t){super(t),this.data=void 0,e.error||=Error(t),this.data=e,e.err=e.error}};function xy(e,t){let n=e===`output-restricted`,r=n?K.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:K.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new by({type:G.KEY_SYSTEM_ERROR,details:r,fatal:!1,decryptdata:t},n?`HDCP level output restricted`:`key status changed to "${e}"`)}var Sy=class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}
vendor: 15,230 bytes, line 30
30registerListeners(){this.hls.on(q.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(q.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(q.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(q.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){let n=this.hls.config;if(n.capLevelOnFPSDrop){let e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&typeof e.getVideoPlaybackQuality==`function`&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,n){let r=performance.now();if(t){if(this.lastTime){let e=r-this.lastTime,i=n-this.lastDroppedFrames,a=t-this.lastDecodedFrames,o=1e3*i/e,s=this.hls;if(s.trigger(q.FPS_DROP,{currentDropped:i,currentDecoded:a,totalDroppedFrames:n}),o>0&&i>s.config.fpsDroppedMonitoringThreshold*a){let e=s.currentLevel;s.logger.warn(`drop FPS ratio greater than max allowed value for currentLevel: `+e),e>0&&(s.autoLevelCapping===-1||s.autoLevelCapping>=e)&&(--e,s.trigger(q.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:s.currentLevel}),s.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=n,this.lastDecodedFrames=t}}checkFPSInterval(){let e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){let t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}};function Cy(e,t){let n;try{n=new Event(`addtrack`)}catch{n=document.createEvent(`Event`),n.initEvent(`addtrack`,!1,!1)}n.track=e,t.dispatchEvent(n)}function wy(e,t){let n=e.mode;if(n===`disabled`&&(e.mode=`hidden`),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw Error(`addCue is failed for: ${t}`)}catch(n){Qu.debug(`[texttrack-utils]: ${n}`);try{let n=new self.TextTrackCue(t.startTime,t.endTime,t.text);n.id=t.id,e.addCue(n)}catch(e){Qu.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${e}`)}}n===`disabled`&&(e.mode=n)}function Ty(e,t){let n=e.mode;if(n===`disabled`&&(e.mode=`hidden`),e.cues)for(let n=e.cues.length;n--;)t&&e.cues[n].removeEventListener(`enter`,t),e.removeCue(e.cues[n]);n===`disabled`&&(e.mode=n)}function Ey(e,t,n,r){let i=e.mode;if(i===`disabled`&&(e.mode=`hidden`),e.cues&&e.cues.length>0){let i=Oy(e.cues,t,n);for(let t=0;t<i.length;t++)(!r||r(i[t]))&&e.removeCue(i[t])}i===`disabled`&&(e.mode=i)}function Dy(e,t){if(t<=e[0].startTime)return 0;let n=e.length-1;if(t>e[n].endTime)return-1;let r=0,i=n,a;for(;r<=i;)if(a=Math.floor((i+r)/2),t<e[a].startTime)i=a-1;else if(t>e[a].startTime&&r<n)r=a+1;else return a;return e[r].startTime-t<t-e[i].startTime?r:i}function Oy(e,t,n){let r=[],i=Dy(e,t);if(i>-1)for(let a=i,o=e.length;a<o;a++){let i=e[a];if(i.startTime>=t&&i.endTime<=n)r.push(i);else if(i.startTime>n)return r}return r}function ky(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];(r.kind===`subtitles`||r.kind===`captions`)&&r.label&&t.push(e[n])}return t}var Ay=class extends M_{constructor(e){super(e,`subtitle-track-controller`),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=null,t=ky(this.media.textTracks);for(let n=0;n<t.length;n++)if(t[n].mode===`hidden`)e=t[n];else if(t[n].mode===`showing`){e=t[n];break}let n=this.findTrackForTextTrack(e);this.subtitleTrack!==n&&this.setSubtitleTrack(n)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){let{hls:e}=this;e.on(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.MANIFEST_PARSED,this.onManifestParsed,this),e.on(q.LEVEL_LOADING,this.onLevelLoading,this),e.on(q.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(q.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(q.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.MANIFEST_PARSED,this.onManifestParsed,this),e.off(q.LEVEL_LOADING,this.onLevelLoading,this),e.off(q.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(q.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(q.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&`onchange`in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener(`change`,this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){let n=this.media;if(!n)return;let r=!!t.transferMedia;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||n.textTracks.removeEventListener(`change`,this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,!r&&ky(n.textTracks).forEach(e=>{Ty(e)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){let{id:n,groupId:r,details:i}=t,a=this.tracksInGroup[n];if(!a||a.groupId!==r){this.warn(`Subtitle track with id:${n} and group:${r} not found in active group ${a?.groupId}`);return}let o=a.details;a.details=t.details,this.log(`Subtitle track ${n} "${a.name}" lang:${a.lang} group:${r} loaded [${i.startSN}-${i.endSN}]`),n===this.trackId&&this.playlistLoaded(n,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){let t=this.hls.levels[e];if(!t)return;let n=t.subtitleGroups||null,r=this.groupIds,i=this.currentTrack;if(!n||r?.length!==n?.length||n!=null&&n.some(e=>r?.indexOf(e)===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;let e=this.tracks.filter(e=>!n||n.indexOf(e.groupId)!==-1);if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>{e.id=t});else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=e;let t=this.hls.config.subtitlePreference;if(!i&&t){this.selectDefaultTrack=!1;let n=Kf(t,e);if(n>-1)i=e[n];else{let e=Kf(t,this.tracks);i=this.tracks[e]}}let r=this.findTrackId(i);r===-1&&i&&(r=this.findTrackId(null));let a={subtitleTracks:e};this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${n?.join(`,`)}" group-id`),this.hls.trigger(q.SUBTITLE_TRACKS_UPDATED,a),r!==-1&&this.trackId===-1&&this.setSubtitleTrack(r)}}findTrackId(e){let t=this.tracksInGroup,n=this.selectDefaultTrack;for(let r=0;r<t.length;r++){let i=t[r];if(!(n&&!i.default||!n&&!e)&&(!e||qf(i,e)))return r}if(e){for(let n=0;n<t.length;n++){let r=t[n];if(P_(e.attrs,r.attrs,[`LANGUAGE`,`ASSOC-LANGUAGE`,`CHARACTERISTICS`]))return n}for(let n=0;n<t.length;n++){let r=t[n];if(P_(e.attrs,r.attrs,[`LANGUAGE`]))return n}}return-1}findTrackForTextTrack(e){if(e){let t=this.tracksInGroup;for(let n=0;n<t.length;n++){let r=t[n];if(F_(r,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===J.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;let t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){let n=this.currentTrack;if(n&&qf(e,n))return n;let r=Kf(e,this.tracksInGroup);if(r>-1){let e=this.tracksInGroup[r];return this.setSubtitleTrack(r),e}else if(n)return null;else{let n=Kf(e,t);if(n>-1)return t[n]}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let n=e.id,r=e.groupId,i=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading subtitle ${n} "${e.name}" lang:${e.lang} group:${r}${t?.msn===void 0?``:` at sn `+t.msn+` part `+t.part}${o&&a.live?` age `+o.toFixed(1)+(a.type&&` `+a.type||``):``} ${i}`),this.hls.trigger(q.SUBTITLE_TRACK_LOADING,{url:i,id:n,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){let{media:e}=this;if(!e)return;let t=ky(e.textTracks),n=this.currentTrack,r;if(n&&(r=t.filter(e=>F_(n,e))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach(e=>{e.mode!==`disabled`&&e!==r&&(e.mode=`disabled`)}),r){let e=this.subtitleDisplay?`showing`:`hidden`;r.mode!==e&&(r.mode=e)}}setSubtitleTrack(e){let t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!W(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;let n=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(q.SUBTITLE_TRACK_SWITCH,{id:e});return}let i=!!r.details&&!r.details.live;if(e===this.trackId&&r===n&&i)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:``));let{id:a,groupId:o=``,name:s,type:c,url:l}=r;this.hls.trigger(q.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:s,type:c,url:l});let u=this.switchParams(r.url,n?.details,r.details);this.loadPlaylist(u)}};function jy(){try{return crypto.randomUUID()}catch{try{let e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf(`/`)+1)}catch{let e=new Date().getTime();return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t==`x`?n:n&3|8).toString(16)})}}}function My(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0).toString()}var Ny=.025,Py=function(e){return e[e.Point=0]=`Point`,e[e.Range=1]=`Range`,e}({});function Fy(e,t,n){return`${e.identifier}-${n+1}-${My(t)}`}var Iy=class{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat(`X-RESUME-OFFSET`,this.resumeOffset),this.playoutLimit=e.attr.optionalFloat(`X-PLAYOUT-LIMIT`,this.playoutLimit),this.restrictions=e.attr.enumeratedStringList(`X-RESTRICT`,this.restrictions),this.snapOptions=e.attr.enumeratedStringList(`X-SNAP`,this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){if(e>0&&e>=this.assetList.length)return!0;let t=this.playoutLimit;return e<=0||isNaN(t)?!1:t===0?!0:(this.assetList[e]?.startOffset||0)>t}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){let e=this.dateRange.startTime;if(this.snapOptions.out){let t=this.dateRange.tagAnchor;if(t)return Ly(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;let e=this.dateRange.tagAnchor;if(e){let t=this.dateRange.startTime;return t-Ly(t,e)<.1}return!1}get resumptionOffset(){let e=this.resumeOffset,t=W(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){let e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){let t=this.resumeAnchor;if(t)return Ly(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<Ny))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart===null?this.startTime:this._timelineStart}set timelineStart(e){this._timelineStart=e}get duration(){let e=this.playoutLimit,t;return t=this._duration===null?this.dateRange.duration?this.dateRange.duration:this.dateRange.plannedDuration||0:this._duration,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr[`X-TIMELINE-OCCUPIES`]===`RANGE`?Py.Range:Py.Point}get supplementsPrimary(){return this.dateRange.attr[`X-TIMELINE-STYLE`]===`PRIMARY`}get contentMayVary(){return this.dateRange.attr[`X-CONTENT-MAY-VARY`]!==`NO`}get assetUrl(){return this.dateRange.attr[`X-ASSET-URI`]}get assetListUrl(){return this.dateRange.attr[`X-ASSET-LIST`]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return By(this)}};function Ly(e,t){return e-t.start<t.duration/2&&!(Math.abs(e-(t.start+t.duration))<Ny)?t.start:t.start+t.duration}function Ry(e,t,n){let r=new self.URL(e,n);return r.protocol!==`data:`&&r.searchParams.set(`_HLS_primary_id`,t),r}function zy(e,t){for(;(n=e.assetList[++t])!=null&&n.error;)var n;return t}function By(e){return`["${e.identifier}" ${e.cue.pre?`<pre>`:e.cue.post?`<post>`:``}${e.timelineStart.toFixed(2)}-${e.resumeTime.toFixed(2)}]`}function Vy(e){let t=e.timelineStart,n=e.duration||0;return`["${e.identifier}" ${t.toFixed(2)}-${(t+n).toFixed(2)}]`}var Hy=class{constructor(e,t,n,r){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetail
vendor: 4,085 bytes, line 30
30s=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(q.PLAYOUT_LIMIT_REACHED,{})};let i=this.hls=new e(t);this.interstitial=n,this.assetItem=r;let a=()=>{this.hasDetails=!0};i.once(q.LEVEL_LOADED,a),i.once(q.AUDIO_TRACK_LOADED,a),i.once(q.SUBTITLE_TRACK_LOADED,a),i.on(q.MEDIA_ATTACHING,(e,{media:t})=>{this.removeMediaListeners(),this.mediaAttached=t,this.interstitial.playoutLimit&&(t.addEventListener(`timeupdate`,this.checkPlayout),this.appendInPlace&&i.on(q.BUFFER_APPENDED,()=>{let e=this.bufferedEnd;this.reachedPlayout(e)&&(this._bufferedEosTime=e,i.trigger(q.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){let e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=Ry(t,e.config.primarySessionId||``).href}catch{}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;let n=Math.min(this._bufferedEosTime||1/0,this.duration),r=this.timelineOffset,i=Q.bufferInfo(e,r,0);return this.getAssetTime(i.end)>=n-.02}reachedPlayout(e){let t=this.interstitial.playoutLimit;return this.startOffset+e>=t}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){return this.hls?.media||null}get bufferedEnd(){let e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;let t=Q.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){let e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){let e=this.assetItem.duration;if(!e)return 0;let t=this.interstitial.playoutLimit;if(t){let n=t-this.startOffset;if(n>0&&n<e)return n}return e}get remaining(){let e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){return this.hls?.config.timelineOffset||0}set timelineOffset(e){let t=this.timelineOffset;if(e!==t){let n=e-t;if(Math.abs(n)>1/9e4&&this.hls){if(this.hasDetails)throw Error(`Cannot set timelineOffset after playlists are loaded`);this.hls.config.timelineOffset=e}}}getAssetTime(e){let t=this.timelineOffset,n=this.duration;return Math.min(Math.max(0,e-t),n)}removeMediaListeners(){let e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener(`timeupdate`,this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls?.transferMedia()||null}resetDetails(){let e=this.hls;if(e&&this.hasDetails){e.stopLoad();let t=e=>delete e.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,n){var r;(r=this.hls)==null||r.on(e,t)}once(e,t,n){var r;(r=this.hls)==null||r.once(e,t)}off(e,t,n){var r;(r=this.hls)==null||r.off(e,t)}toString(){return`HlsAssetPlayer: ${Vy(this.assetItem)} ${this.hls?.sessionId} ${this.appendInPlace?`append-in-place`:``}`}},Uy=.033,Wy=class extends Wu{constructor(e,t){super(`interstitials-sched`,t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={}
vendor: 2,161 bytes, line 30
30,this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((n,r)=>e<=r.startOffset&&t>r.startOffset?(delete r.error,n+1):n,0):0}get duration(){let e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let n=-1;e.nextEvent?n=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(n=this.findEventIndex(e.previousEvent.identifier)+1);let r=this.items;if(r)for(r[n]||(t===void 0&&(t=e.start),n=this.findItemIndexAtTime(t));n>=0&&(i=r[n])!=null&&i.event;){var i;n--}return n}findItemIndexAtTime(e,t){let n=this.items;if(n)for(let r=0;r<n.length;r++){let i=n[r];if(t&&t!==`primary`&&(i=i[t]),e===i.start||e>i.start&&e<i.end)return r}return-1}findJumpRestrictedIndex(e,t){let n=this.items;if(n)for(let r=e;r<=t&&n[r];r++){let e=n[r].event;if(e!=null&&e.restrictions.jump&&!e.appendInPlace)return r}return-1}findEventIndex(e){let t=this.items;if(t){for(let n=t.length;n--;)if(t[n].event?.identifier===e)return n}return-1}findAssetIndex(e,t){let n=e.assetList,r=n.length;if(r>1)for(let e=0;e<r;e++){let i=n[e];if(!i.error){let n=i.timelineStart;if(t===n||t>n&&(t<n+(i.duration||0)||e===r-1))return e}}return 0}get assetIdAtEnd(){var e;let t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){let e=t.assetList,n=e[e.length-1];if(n)return n.identifier}return null}parseInterstitialDateRanges(e,t){let n=e.main.details,{dateRanges:r}=n,i=this.events,a=this.parseDateRanges(r,{url:n.url},t),o=Object.keys(r),s=i?i.filter(e=>!o.includes(e.identifier)):[];a.length&&a.sort((e,t)=>{let n=e.cue.pre,r=e.cue.post,i=t.cue.pre,a=t.cue.post;if(n&&!i)return-1;if(i&&!n||r&&!a)return 1;if(a&&!r)return-1;if(!n&&!i&&!r&&!a){let n=e.startTime,r=t.startTime;if(n!==r)return n-r}return e.dateRange.tagOrder-t.dateRange.tagOrder}),this.events=a,s.forEach(e=>{this.removeEvent(e)}),this.updateSchedule(e,s)}updateSchedule(e,t=[],n=!1){let r=this.events||[];
vendor: 4,689 bytes, line 30
30if(r.length||t.length||this.length<2){let i=this.items,a=this.parseSchedule(r,e);(n||t.length||i?.length!==a.length||a.some((e,t)=>Math.abs(e.playout.start-i[t].playout.start)>.005||Math.abs(e.playout.end-i[t].playout.end)>.005))&&(this.items=a,this.onScheduleUpdate(t,i))}}parseDateRanges(e,t,n){let r=[],i=Object.keys(e);for(let a=0;a<i.length;a++){let o=i[a],s=e[o];if(s.isInterstitial){let e=this.eventMap[o];e?e.setDateRange(s):(e=new Iy(s,t),this.eventMap[o]=e,n===!1&&(e.appendInPlace=n)),r.push(e)}}return r}parseSchedule(e,t){let n=[],r=t.main.details,i=r.live?1/0:r.edge,a=0;if(e=e.filter(e=>!e.error&&!(e.cue.once&&e.hasPlayed)),e.length){this.resolveOffsets(e,t);let r=0,o=0;if(e.forEach((t,s)=>{let c=t.cue.pre,l=t.cue.post,u=e[s-1]||null,d=t.appendInPlace,f=l?i:t.startOffset,p=t.duration,m=t.timelineOccupancy===Py.Range?p:0,h=t.resumptionOffset,g=u?.startTime===f,_=f+t.cumulativeDuration,v=d?_+p:f+h;if(c||!l&&f<=0){let e=o;o+=m,t.timelineStart=_;let r=a;a+=p,n.push({event:t,start:_,end:v,playout:{start:r,end:a},integrated:{start:e,end:o}})}else if(f<=i){if(!g){let i=f-r;if(i>Uy){let c=r,l=o;o+=i;let u=a;a+=i;let d={previousEvent:e[s-1]||null,nextEvent:t,start:c,end:c+i,playout:{start:u,end:a},integrated:{start:l,end:o}};n.push(d)}else i>0&&u&&(u.cumulativeDuration+=i,n[n.length-1].end=f)}l&&(v=_),t.timelineStart=_;let i=o;o+=m;let c=a;a+=p,n.push({event:t,start:_,end:v,playout:{start:c,end:a},integrated:{start:i,end:o}})}else return;let y=t.resumeTime;r=l||y>i?i:y}),r<i){let e=r,t=o,s=i-r;o+=s;let c=a;a+=s,n.push({previousEvent:n[n.length-1]?.event||null,nextEvent:null,start:r,end:e+s,playout:{start:c,end:a},integrated:{start:t,end:o}})}this.setDurations(i,a,o)}else n.push({previousEvent:null,nextEvent:null,start:0,end:i,playout:{start:0,end:i},integrated:{start:0,end:i}}),this.setDurations(i,i,i);return n}setDurations(e,t,n){this.durations={primary:e,playout:t,integrated:n}}resolveOffsets(e,t){let n=t.main.details,r=n.live?1/0:n.edge,i=0,a=-1;e.forEach((o,s)=>{let c=o.cue.pre,l=o.cue.post,u=c?0:l?r:o.startTime;this.updateAssetDurations(o),a===u?o.cumulativeDuration=i:(i=0,a=u),!l&&o.snapOptions.in&&(o.resumeAnchor=rp(null,n.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&s+1<e.length&&e[s+1].startTime-e[s].resumeTime<Uy&&(e[s+1].appendInPlace=!1,e[s+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));let d=W(o.resumeOffset)?o.resumeOffset:o.duration;i+=d})}primaryCanResumeInPlaceAt(e,t){let n=e.resumeTime,r=e.startTime+e.resumptionOffset;return Math.abs(n-r)>Ny?(this.log(`"${e.identifier}" resumption ${n} not aligned with estimated timeline end ${r}`),!1):!Object.keys(t).some(r=>{let i=t[r].details,a=i.edge;if(n>=a)return this.log(`"${e.identifier}" resumption ${n} past ${r} playlist end ${a}`),!1;let o=rp(null,i.fragments,n);if(!o)return this.log(`"${e.identifier}" resumption ${n} does not align with any fragments in ${r} playlist (${i.fragStart}-${i.fragmentEnd})`),!0;let s=r===`audio`?.175:0;return Math.abs(o.start-n)<Ny+s||Math.abs(o.end-n)<Ny+s?!1:(this.log(`"${e.identifier}" resumption ${n} not aligned with ${r} fragment bounds (${o.start}-${o.end} sn: ${o.sn} cc: ${o.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;let t=e.timelineStart,n=0,r=!1,i=!1;for(let a=0;a<e.assetList.length;a++){let o=e.assetList[a],s=t+n;o.startOffset=n,o.timelineStart=s,r||=o.duration===null,i||=!!o.error;let c=o.error?0:o.duration||0;n+=c}r&&!i?e.duration=Math.max(n,e.duration):e.duration=n}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}};function Gy(e){return`[${e.event?`"`+e.event.identifier+`"`:`primary`}: ${e.start.toFixed(2)}-${e.end.toFixed(2)}]`}var Ky=class{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){let n=e.assetListUrl,r;try{r=Ry(n,this.hls.sessionId,e.baseUrl)}catch(t){let r=this.assignAssetListError(e,K.ASSET_LIST_LOAD_ERROR,t,n);this.hls.trigger(q.ERROR,r);return}t&&r.protocol!==`data:`&&r.searchParams.set(`_HLS_start_offset`,``+t);let i=this.hls.config,a=i.loader,o=new a(i),s={responseType:`json`,url:r.href},c=i.interstitialAssetListLoadPolicy.default,l={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};return o.load(s,l,{onSuccess:(t,n,r,i)=>{let a=t.data,o=a?.ASSETS;if(!Array.isArray(o)){let t=this.assignAssetListError(e,K.ASSET_LIST_PARSING_ERROR,Error(`Invalid interstitial asset list`),r.url,n,i);this.hls.trigger(q.ERROR,t);return}e.assetListResponse=a,this.hls.trigger(q.ASSET_LIST_LOADED,{event:e,assetListResponse:a,networkDetails:i}
vendor: 4,290 bytes, lines 30-31
30)},onError:(t,n,r,i)=>{let a=this.assignAssetListError(e,K.ASSET_LIST_LOAD_ERROR,Error(`Error loading X-ASSET-LIST: HTTP status ${t.code} ${t.text} (${n.url})`),n.url,i,r);this.hls.trigger(q.ERROR,a)},onTimeout:(t,n,r)=>{let i=this.assignAssetListError(e,K.ASSET_LIST_LOAD_TIMEOUT,Error(`Timeout loading X-ASSET-LIST (${n.url})`),n.url,t,r);this.hls.trigger(q.ERROR,i)}}),this.hls.trigger(q.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,n,r,i,a){return e.error=n,{type:G.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:n,networkDetails:a,stats:i}}};function qy(e){var t;e==null||(t=e.play())==null||t.catch(()=>{})}function Jy(e,t){return`[${e}] Advancing timeline position to ${t}`}var Yy=class extends Wu{constructor(e,t){super(`interstitials`,e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{let e=this.currentTime;if(e===void 0||this.playbackDisabled||!this.schedule)return;let t=e-this.timelinePos;if(Math.abs(t)<1/7056e5)return;let n=t<=-.01;this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),this.timelinePos=e,this.bufferedPos=e;let r=this.playingItem;if(!r){this.checkBuffer();return}if(n&&this.schedule.resetErrorsInRange(e,e-t)&&this.updateSchedule(!0),this.checkBuffer(),n&&e<r.start||e>=r.end){var i;let t=this.findItemIndex(r),a=this.schedule.findItemIndexAtTime(e);if(a===-1&&(a=t+(n?-1:1),this.log(`seeked ${n?`back `:``}to position not covered by schedule ${e} (resolving from ${t} to ${a})`)),!this.isInterstitial(r)&&(i=this.media)!=null&&i.paused&&(this.shouldPlay=!1),!n&&a>t){let e=this.schedule.findJumpRestrictedIndex(t+1,a);if(e>t){this.setSchedulePosition(e);return}}this.setSchedulePosition(a);return}let a=this.playingAsset;if(!a){if(this.playingLastItem&&this.isInterstitial(r)){let t=r.event.assetList[0];t&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(e,t))}return}let o=a.timelineStart,s=a.duration||0;if(n&&e<o||e>=o+s){var c;(c=r.event)!=null&&c.appendInPlace&&(this.clearAssetPlayers(r.event,r),this.flushFrontBuffer(e)),this.setScheduleToAssetAtTime(e,a)}},this.onTimeupdate=()=>{let e=this.currentTime;if(e===void 0||this.playbackDisabled)return;if(this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),e>this.timelinePos)this.timelinePos=e,e>this.bufferedPos&&this.checkBuffer();else return;let t=this.playingItem;if(!t||this.playingLastItem)return;if(e>=t.end){this.timelinePos=t.end;let e=this.findItemIndex(t);this.setSchedulePosition(e+1)}let n=this.playingAsset;n&&e>=n.timelineStart+(n.duration||0)&&this.setScheduleToAssetAtTime(e,n)},this.onScheduleUpdate=(e,t)=>{let n=this.schedule;if(!n)return;let r=this.playingItem,i=n.events||[],a=n.items||[],o=n.durations,s=e.map(e=>e.identifier),c=!!(i.length||s.length);(c||t)&&this.log(`INTERSTITIALS_UPDATED (${i.length}): ${i} 31Schedule: ${a.map(e=>Gy(e))} pos: ${this.timelinePos}`),s.length&&this.log(`Removed events ${s}`);let l=null,u=null;r&&(l=this.updateItem(r,this.timelinePos),this.itemsMatch(r,l)?this.playingItem=l:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);let d=this.bufferingItem;if(d&&(u=this.updateItem(d,this.bufferedPos),this.itemsMatch(d,u)?this.bufferingItem=u:d.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(d.event,null))),e.forEach(e=>{e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,null)})}),this.playerQueue.forEach(e=>{if(e.interstitial.appendInPlace){let t=e.assetItem.timelineStart,n=e.timelineOffset-t;if(n)try{e.timelineOffset=t}catch(r){Math.abs(n)>Ny&&this.warn(`${r} ("${e.assetId}" ${e.timelineOffset}->${t})`)}}}),c||t){if(this.hls.trigger(q.INTERSTITIALS_UPDATED,{events:i.slice(0),schedule:a.slice(0),durations:o,removedIds:s}
31),this.isInterstitial(r)&&s.includes(r.event.identifier)){this.warn(`Interstitial "${r.event.identifier}" removed while playing`),this.primaryFallback(r.event);return}r&&this.trimInPlace(l,r),d&&u!==l&&this.trimInPlace(u,d),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new Ky(e),this.schedule=new Wy(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){let e=this.hls;e&&(e.on(q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(q.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(q.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(q.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(q.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(q.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(q.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(q.BUFFER_APPENDED,this.onBufferAppended,this),e.on(q.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(q.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(q.MEDIA_ENDED,this.onMediaEnded,this),e.on(q.ERROR,this.onError,this),e.on(q.DESTROYING,this.onDestroying,this))}unregisterListeners(){let e=this.hls;
vendor: 7,192 bytes, line 31
31e&&(e.off(q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(q.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(q.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(q.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(q.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(q.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(q.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(q.BUFFER_CODECS,this.onBufferCodecs,this),e.off(q.BUFFER_APPENDED,this.onBufferAppended,this),e.off(q.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(q.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(q.MEDIA_ENDED,this.onMediaEnded,this),e.off(q.ERROR,this.onError,this),e.off(q.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){let e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){_h(e,`play`,this.onPlay),_h(e,`pause`,this.onPause),_h(e,`seeking`,this.onSeeking),_h(e,`timeupdate`,this.onTimeupdate)}onMediaAttaching(e,t){let n=this.media=t.media;gh(n,`seeking`,this.onSeeking),gh(n,`timeupdate`,this.onTimeupdate),gh(n,`play`,this.onPlay),gh(n,`pause`,this.onPause)}onMediaAttached(e,t){let n=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,n===null)this.checkStart();else if(!r){this.clearScheduleState();let e=this.findItemIndex(n);this.setSchedulePosition(e)}}clearScheduleState(){this.log(`clear schedule state`),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){let n=!!t.transferMedia,r=this.media;if(this.media=null,!n&&(r&&this.removeMediaListeners(r),this.detachedData)){let e=this.getBufferingPlayer();e&&(this.log(`Removing schedule state for detachedData and ${e}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,e.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;let e=this,t=()=>e.bufferingItem||e.waitingItem,n=t=>t&&e.getAssetPlayer(t.identifier),r=(t,r,i,o,s)=>{if(t){let c=t[r].start,l=t.event;if(l){if(r===`playout`||l.timelineOccupancy!==Py.Point){let e=n(i);e?.interstitial===l&&(c+=e.assetItem.startOffset+e[s])}}else{let n=o===`bufferedPos`?a():e[o];c+=n-t.start}return c}return 0},i=(t,n)=>{var r;if(t!==0&&n!==`primary`&&(r=e.schedule)!=null&&r.length){let r=e.schedule.findItemIndexAtTime(t),i=e.schedule.items?.[r];if(i)return t+(i[n].start-i.start)}return t},a=()=>{let t=e.bufferedPos;return t===Number.MAX_VALUE?o(`primary`):Math.max(t,0)},o=t=>{var n;return(n=e.primaryDetails)!=null&&n.live?e.primaryDetails.edge:e.schedule?.durations[t]||0},s=(t,i)=>{var a;let o=e.effectivePlayingItem;if(o!=null&&(a=o.event)!=null&&a.restrictions.skip||!e.schedule)return;e.log(`seek to ${t} "${i}"`);let s=e.effectivePlayingItem,c=e.schedule.findItemIndexAtTime(t,i),l=e.schedule.items?.[c],u=e.getBufferingPlayer(),d=u?.interstitial?.appendInPlace,f=s&&e.itemsMatch(s,l);if(s&&(d||f)){let a=n(e.playingAsset),o=a?.media||e.primaryMedia;if(o){let n=i===`primary`?o.currentTime:r(s,i,e.playingAsset,`timelinePos`,`currentTime`),c=t-n,l=(d?n:o.currentTime)+c;if(l>=0&&(!a||d||l<=a.duration)){o.currentTime=l;return}}}if(l){let n=t;if(i!==`primary`){let e=t-l[i].start;n=l.start+e}let r=!e.isInterstitial(l);if((!e.isInterstitial(s)||s.event.appendInPlace)&&(r||l.event.appendInPlace)){let t=e.media||(d?u?.media:null);t&&(t.currentTime=n)}else if(s){let a=e.findItemIndex(s);if(c>a){let t=e.schedule.findJumpRestrictedIndex(a+1,c);if(t>a){e.setSchedulePosition(t);return}}let o=0;if(r)e.timelinePos=n,e.checkBuffer();else{let e=l.event.assetList,n=t-(l[i]||l).start;for(let t=e.length;t--;){let r=e[t];if(r.duration&&n>=r.startOffset&&n<r.startOffset+r.duration){o=t;break}}}e.setSchedulePosition(c,o)}}},c=()=>{let n=e.effectivePlayingItem;if(e.isInterstitial(n))return n;let r=t();return e.isInterstitial(r)?r:null},l={get bufferedEnd(){let n=t(),i=e.bufferingItem;return i&&i===n&&(r(i,`playout`,e.bufferingAsset,`bufferedPos`,`bufferedEnd`)-i.playout.start||e.bufferingAsset?.startOffset)||0},get currentTime(){let t=c(),n=e.effectivePlayingItem;return n&&n===t?r(n,`playout`,e.effectivePlayingAsset,`timelinePos`,`currentTime`)-n.playout.start:0},set currentTime(t){let n=c(),r=e.effectivePlayingItem;r&&r===n&&s(t+r.playout.start,`playout`)},get duration(){let e=c();return e?e.playout.end-e.playout.start:0},get assetPlayers(){let t=c()?.event.assetList;return t?t.map(t=>e.getAssetPlayer(t.identifier)):[]},get playingIndex(){let t=c()?.event;return t&&e.effectivePlayingAsset?t.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return c()}};return this.manager={get events(){var t;return((t=e.schedule)==null||(t=t.events)==null?void 0:t.slice(0))||[]},get schedule(){var t;return((t=e.schedule)==null||(t=t.items)==null?void 0:t.slice(0))||[]},get interstitialPlayer(){return c()?l:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){let n=t();return e.findItemIndex(n)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){let t=e.effectivePlayingItem;return e.findItemIndex(t)},primary:{get bufferedEnd(){return a()},get currentTime(){let t=e.timelinePos;return t>0?t:0},set currentTime(e){s(e,`primary`)},get duration(){return o(`primary`)},get seekableStart(){return e.primaryDetails?.fragmentStart||0}},integrated:{get bufferedEnd(){return r(t(),`integrated`,e.bufferingAsset,`bufferedPos`,`bufferedEnd`)},get currentTime(){return r(e.effectivePlayingItem,`integrated`,e.effectivePlayingAsset,`timelinePos`,`currentTime`)},set currentTime(e){s(e,`integrated`)},get duration(){return o(`integrated`)},get seekableStart(){return i(e.primaryDetails?.fragmentStart||0,`integrated`)}},skip:()=>{let t=e.effectivePlayingItem,n=t?.event;if(n&&!n.restrictions.skip){let r=e.findItemIndex(t);n.appendInPlace?s(t.playout.start+t.event.duration+.001,`playout`):e.advanceAfterAssetEnded(n,r,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}
31get playingLastItem(){let e=this.playingItem,t=this.schedule?.items;return!this.playbackStarted||!e||!t?!1:this.findItemIndex(e)===t.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e;if(this.mediaSelection===null)return;let t=this.waitingItem||this.playingItem;if(this.isInterstitial(t)&&!t.event.appendInPlace)return;let n=this.media;!n&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(n=this.primaryMedia);let r=n?.currentTime;if(!(r===void 0||!W(r)))return r}get primaryMedia(){return this.media||this.detachedData?.media||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){let n=this.getAssetPlayer(e);n&&this.transferMediaFromPlayer(n,t)}transferMediaFromPlayer(e,t){let n=e.interstitial.appendInPlace,r=e.media;if(n&&r===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&r){this.detachedData={media:r};return}let n=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Bf(n)}`),this.detachedData=n}else t&&r&&(this.shouldPlay||=!r.paused)}transferMediaTo(e,t){if(e.media===t)return;let n=null,r=this.hls,i=e!==r,a=i&&e.interstitial.appendInPlace,o=this.detachedData?.mediaSource,s;if(r.media)a&&(n=r.transferMedia(),this.detachedData=n),s=`Primary`;else if(o){let e=this.getBufferingPlayer();e?(n=e.transferMedia(),s=`${e}`):s=`detached MediaSource`}else s=`detached media`;if(!n){if(o)n=this.detachedData,this.log(`using detachedData: MediaSource ${Bf(n)}`);else if(!this.detachedData||r.media===t){let e=this.playerQueue;e.length>1&&e.forEach(e=>{if(i&&e.interstitial.appendInPlace!==a){let t=e.interstitial;this.clearInterstitial(e.interstitial,null),t.appendInPlace=!1,t.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${t}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}let c=n&&`mediaSource`in n&&n.mediaSource?.readyState!==`closed`,l=c&&n?n:t;this.log(`${c?`transfering MediaSource`:`attaching media`} to ${i?e:`Primary`} from ${s} (media.currentTime: ${t.currentTime})`);let u=this.schedule;if(l===n&&u){let t=i&&e.assetId===u.assetIdAtEnd;l.overrides={duration:u.duration,endOfStream:!i||t,cueRemoval:!i}}e.attachMedia(l)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){let e=this.schedule,t=e?.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);let n=this.timelinePos,r=this.effectivePlayingItem;if(n===-1){let n=this.hls.startPosition;if(this.timelinePos=n,t.length===0)this.setSchedulePosition(0);else if(t[0].cue.pre){this.log(Jy(`checkStart (preroll)`,n));let r=e.findEventIndex(t[0].identifier);this.setSchedulePosition(r)}else if(n>=0||!this.primaryLive){this.log(Jy(`checkStart`,n));let t=this.timelinePos=n>0?n:0,r=e.findItemIndexAtTime(t);this.setSchedulePosition(r)}else this.hls.liveSyncPosition===0?this.setSchedulePosition(0):this.log(`[checkStart] waiting for live start`)}else if(r&&!this.playingItem){this.log(Jy(`checkStart (playing item)`,r.start));let t=e.findItemIndex(r);this.setSchedulePosition(t)}}advanceAssetBuffering(e,t){let n=e.event,r=zy(n,n.findAssetIndex(t));if(!n.isAssetPastPlayoutLimit(r))this.bufferedToEvent(e,r);else if(this.schedule){let t=this.schedule.items?.[this.findItemIndex(e)+1];t&&this.bufferedToItem(t)}}
31advanceAfterAssetEnded(e,t,n){let r=zy(e,n);if(!e.isAssetPastPlayoutLimit(r)){if(e.appendInPlace){let t=e.assetList[r];t&&this.advanceInPlace(t.timelineStart)}this.setSchedulePosition(t,r)}else if(this.schedule){let n=this.schedule.items;if(n){let r=t+1;if(r>=n.length){this.setSchedulePosition(-1);return}let i=e.resumeTime;this.timelinePos<i&&(this.log(Jy(`advanceAfterAssetEnded`,i)),this.timelinePos=i,e.appendInPlace&&this.advanceInPlace(i),this.checkBuffer(this.bufferedPos<i)),this.setSchedulePosition(r)}}}setScheduleToAssetAtTime(e,t){let n=this.schedule;if(!n)return;let r=t.parentIdentifier,i=n.getEvent(r);if(i){let t=n.findEventIndex(r),a=n.findAssetIndex(i,e);this.advanceAfterAssetEnded(i,t,a-1)}}setSchedulePosition(e,t){let n=this.schedule?.items;if(!n||this.playbackDisabled)return;let r=e>=0?n[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${r&&Gy(r)}) pos: ${this.timelinePos}`);let i=this.waitingItem||this.playingItem,a=this.playingLastItem;if(this.isInterstitial(i)){let s=i.event,c=this.playingAsset,l=c?.identifier,u=l?this.getAssetPlayer(l):null;if(u&&l&&(!this.eventItemsMatch(i,r)||t!==void 0&&l!==s.assetList[t].identifier)){var o;let t=s.findAssetIndex(c);if(this.log(`INTERSTITIAL_ASSET_ENDED ${t+1}/${s.assetList.length} ${Vy(c)}`),this.endedAsset=c,this.playingAsset=null,this.hls.trigger(q.INTERSTITIAL_ASSET_ENDED,{asset:c,assetListIndex:t,event:s,schedule:n.slice(0),scheduleIndex:e,player:u}),i!==this.playingItem){this.itemsMatch(i,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(s,this.findItemIndex(this.playingItem),t);return}this.retreiveMediaSource(l,r),u.media&&!((o=this.detachedData)!=null&&o.mediaSource)&&u.detachMedia()}if(!this.eventItemsMatch(i,r)&&(this.endedItem=i,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${s} ${Gy(i)}`),s.hasPlayed=!0,this.hls.trigger(q.INTERSTITIAL_ENDED,{event:s,schedule:n.slice(0),scheduleIndex:e}),s.cue.once)){this.updateSchedule();let e=this.schedule?.items;if(r&&e){let n=this.findItemIndex(r);this.advanceSchedule(n,e,t,i,a)}return}}this.advanceSchedule(e,n,t,i,a)}advanceSchedule(e,t,n,r,i){let a=this.schedule;if(!a)return;let o=t[e]||null,s=this.primaryMedia,c=this.playerQueue;if(c.length&&c.forEach(t=>{let n=t.interstitial,r=a.findEventIndex(n.identifier);(r<e||r>e+1)&&this.clearInterstitial(n,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);let i=o.event;if(n===void 0){n=a.findAssetIndex(i,this.timelinePos);let t=zy(i,n-1);if(i.isAssetPastPlayoutLimit(t)||i.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(i,e,n);return}n=t}let c=this.waitingItem;this.assetsBuffered(o,s)||this.setBufferingItem(o);let l=this.preloadAssets(i,n);if(this.eventItemsMatch(o,c||r)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${Gy(o)} ${i.appendInPlace?`append in place`:``}`),this.hls.trigger(q.INTERSTITIAL_STARTED,{event:i,schedule:t.slice(0),scheduleIndex:e})),!i.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${i}`);return}if(i.assetListLoader&&=(i.assetListLoader.destroy(),void 0),!s){this.log(`Waiting for attachMedia to start Interstitial ${i}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;let u=i.assetList[n];if(!u){this.advanceAfterAssetEnded(i,e,n||0);return}if(l||=this.getAssetPlayer(u.identifier),l===null||l.destroyed){let e=i.assetList.length;this.warn(`asset ${n+1}/${e} player destroyed ${i}`),l=this.createAssetPlayer(i,u,n),l.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&i.appendInPlace&&this.isAssetBuffered(u))return;this.startAssetPlayer(l,n,t,e,s),this.shouldPlay&&qy(l.media)}else o?(this.resumePrimary(o,e,r),this.shouldPlay&&qy(this.hls.media)):i&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){return this.mediaSelection?.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,n){var r;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${Gy(e)}`),!((r=this.detachedData)!=null&&r.mediaSource)){let n=this.timelinePos;(n<e.start||n>=e.end)&&(n=this.getPrimaryResumption(e,t),this.log(Jy(`resumePrimary`,n)),this.timelinePos=n),this.attachPrimary(n,e)}if(!n)return;
31let i=this.schedule?.items;i&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Gy(e)}`),this.hls.trigger(q.INTERSTITIALS_PRIMARY_RESUMED,{schedule:i.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){let n=e.start;if(this.primaryLive){let e=this.primaryDetails;if(t===0)return this.hls.startPosition;if(e&&(n<e.fragmentStart||n>e.edge))return this.hls.liveSyncPosition||-1}return n}isAssetBuffered(e){let t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:Q.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,n){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;let r=this.primaryMedia;if(!r)return;let i=this.hls;i.media?this.checkBuffer():(this.transferMediaTo(i,r),n&&this.startLoadingPrimaryAt(e,n)),n||(this.log(Jy(`attachPrimary`,e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,n))}startLoadingPrimaryAt(e,t){let n=this.hls;!n.loadingEnabled||!n.media||Math.abs((n.mainForwardBufferInfo?.start||n.media.currentTime)-e)>.5?n.startLoad(e,t):n.bufferingEnabled||n.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(q.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(q.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;let n=this.hls.levels[t.level];if(!n.details)return;let r=Vu(Vu({},this.mediaSelection||this.altSelection),{},{main:n});this.mediaSelection=r,this.schedule.parseInterstitialDateRanges(r,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){let n=this.hls.audioTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=Vu(Vu({},this.altSelection),{},{audio:n});return}this.mediaSelection=Vu(Vu({},r),{},{audio:n})}onSubtitleTrackUpdated(e,t){let n=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=Vu(Vu({},this.altSelection),{},{subtitles:n});return}this.mediaSelection=Vu(Vu({},r),{},{subtitles:n})}onAudioTrackSwitching(e,t){let n=Gf(t);this.playerQueue.forEach(({hls:e})=>e&&(e.setAudioOption(t)||e.setAudioOption(n)))}onSubtitleTrackSwitch(e,t){let n=Gf(t);this.playerQueue.forEach(({hls:e})=>e&&(e.setSubtitleOption(t)||t.id!==-1&&e.setSubtitleOption(n)))}onBufferCodecs(e,t){let n=t.tracks;n&&(this.requiredTracks=n)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){let n=this.playingItem;n&&!this.itemsMatch(n,this.bufferingItem)&&!this.isInterstitial(n)&&(this.bufferedPos=this.timelinePos,this.checkBuffer())}onBufferedToEnd(e){if(!this.schedule)return;let t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let e=0;e<t.length;e++){let n=t[e];if(n.cue.post){let e=this.schedule.findEventIndex(n.identifier),t=this.schedule.items?.[e];this.isInterstitial(t)&&this.eventItemsMatch(t,this.bufferingItem)&&this.bufferedToItem(t,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){let t=this.playingItem;if(!this.playingLastItem&&t){let e=this.findItemIndex(t);this.setSchedulePosition(e+1)}else this.shouldPlay=!1}updateItem(e,t){let n=this.schedule?.items;return e&&n&&n[this.findItemIndex(e,t)]||null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((t,n)=>{e.event.isAssetPastPlayoutLimit(n)&&this.clearAssetPlayer(t.identifier,null)});let n=e.end+.25,r=Q.bufferInfo(this.primaryMedia,n,0);(r.end>n||(r.nextStart||0)>n)&&(this.log(`trim buffered interstitial ${Gy(e)} (was ${Gy(t)})`),this.attachPrimary(n,null,!0),this.flushFrontBuffer(n))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){return!!t&&(e===t||e.event.identifier===t.event?.identifier)}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;let n=this.mediaSelection;n&&((t=this.schedule)==null||t.updateSchedule(n,[],e))}
vendor: 8,482 bytes, line 31
31checkBuffer(e){let t=this.schedule?.items;if(!t)return;let n=Q.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||=n.len<1,this.updateBufferedPos(n.end,t,e)}updateBufferedPos(e,t,n){let r=this.schedule,i=this.bufferingItem;if(this.bufferedPos>e||!r)return;if(t.length===1&&this.itemsMatch(t[0],i)){this.bufferedPos=e;return}let a=this.playingItem,o=this.findItemIndex(a),s=r.findItemIndexAtTime(e);if(this.bufferedPos<e){var c;let n=this.findItemIndex(i),r=Math.min(n+1,t.length-1),a=t[r];if((s===-1&&i&&e>=i.end||(c=a.event)!=null&&c.appendInPlace&&e+.01>=a.start)&&(s=r),this.isInterstitial(i)){let e=i.event;if(r-o>1&&e.appendInPlace===!1||e.assetList.length===0&&e.assetListLoader)return}if(this.bufferedPos=e,s>n&&s>o)this.bufferedToItem(a);else{let t=this.primaryDetails;this.primaryLive&&t&&e>t.edge-t.targetduration&&a.start<t.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(a)&&this.preloadAssets(a.event,0)}}else n&&a&&!this.itemsMatch(a,i)&&(s===o?this.bufferedToItem(a):s===o+1&&this.bufferedToItem(t[s]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(e=>{let n=this.getAssetPlayer(e.identifier);return!(n!=null&&n.bufferedInPlaceToEnd(t))})}setBufferingItem(e){let t=this.bufferingItem,n=this.schedule;if(!this.itemsMatch(e,t)&&n){let{items:r,events:i}=n;if(!r||!i)return t;let a=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));let s=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Gy(e)}`+(t?` (${s.toFixed(2)} remaining)`:``)),!this.playbackDisabled)if(a){let t=n.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((e,n)=>{let r=this.getAssetPlayer(e.identifier);r&&(n===t&&r.loadSource(),r.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(e=>e.pauseBuffering());this.hls.trigger(q.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:i.slice(0),schedule:r.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){let n=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(n!==null){this.bufferingAsset=null;let t=this.detachedData;t&&t.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e)}}}preloadPrimary(e){let t=this.findItemIndex(e),n=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(n)}bufferedToEvent(e,t){let n=e.event,r=n.assetList.length===0&&!n.assetListLoader,i=n.cue.once;if(r||!i){let e=this.preloadAssets(n,t);if(e!=null&&e.interstitial.appendInPlace){let t=this.primaryMedia;t&&this.bufferAssetPlayer(e,t)}}}preloadAssets(e,t){let n=e.assetUrl,r=e.assetList.length,i=r===0&&!e.assetListLoader,a=e.cue.once;if(i){let i=e.timelineStart;if(e.appendInPlace){var o;let t=this.playingItem;!this.isInterstitial(t)&&(t==null||(o=t.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(i+.25)}let a,s=0;if(!this.playingItem&&this.primaryLive&&(s=this.hls.startPosition,s===-1&&(s=this.hls.liveSyncPosition||0)),s&&!(e.cue.pre||e.cue.post)){let e=s-i;e>0&&(a=Math.round(e*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${n?1:r} ${e}${a?` live-start: ${s} start-offset: ${a}`:``}`),n)return this.createAsset(e,0,0,i,e.duration,n);let c=this.assetListLoader.loadAssetList(e,a);c&&(e.assetListLoader=c)}else if(!a&&r){for(let n=t;n<r;n++){let t=e.assetList[n],r=this.getAssetPlayerQueueIndex(t.identifier);(r===-1||this.playerQueue[r].destroyed)&&!t.error&&this.createAssetPlayer(e,t,n)}let n=e.assetList[t];if(n){let e=this.getAssetPlayer(n.identifier);return e&&e.loadSource(),e}}return null}flushFrontBuffer(e){let t=this.requiredTracks;t&&(this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(t=>{this.hls.trigger(q.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:t})}))}getAssetPlayerQueueIndex(e){let t=this.playerQueue;for(let n=0;n<t.length;n++)if(e===t[n].assetId)return n;return-1}getAssetPlayer(e){let t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){let{playerQueue:e,primaryMedia:t}=this;if(t){for(let n=0;n<e.length;n++)if(e[n].media===t)return e[n]}return null}createAsset(e,t,n,r,i,a){let o={parentIdentifier:e.identifier,identifier:Fy(e,a,t),duration:i,startOffset:n,timelineStart:r,uri:a};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,n){let r=this.hls,i=r.userConfig,a=i.videoPreference,o=r.loadLevelObj||r.levels[r.currentLevel];(a||o)&&(a=zu({},a),o.videoCodec&&(a.videoCodec=o.videoCodec),o.videoRange&&(a.allowedVideoRanges=[o.videoRange]));let s=r.audioTracks[r.audioTrack],c=r.subtitleTracks[r.subtitleTrack],l=0;if(this.primaryLive||e.appendInPlace){let e=this.timelinePos-t.timelineStart;if(e>1){let n=t.duration;n&&e<n&&(l=e)}}let u=t.identifier,d=Vu(Vu({},i),{},{maxMaxBufferLength:Math.min(180,r.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:u,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:l,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:a,audioPreference:s||i.audioPreference,subtitlePreference:c||i.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(d.timelineOffset=t.timelineStart));let f=d.cmcd;f!=null&&f.sessionId&&f.contentId&&(d.cmcd=zu({},f,{contentId:My(t.uri)})),this.getAssetPlayer(u)&&this.warn(`Duplicate date range identifier ${e} and asset ${u}`);let p=new Hy(this.HlsPlayerClass,d,e,t);this.playerQueue.push(p),e.assetList[n]=t;let m=!0,h=r=>{if(r.live){let t=Error(`Interstitials MUST be VOD assets ${e}`),r={fatal:!0,type:G.OTHER_ERROR,details:K.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},i=this.schedule?.findEventIndex(e.identifier)||-1;this.handleAssetItemError(r,e,i,n,t.message);return}let i=r.edge-r.fragmentStart,a=t.duration;(m||a===null||i>a)&&(m=!1,this.log(`Interstitial asset "${u}" duration change ${a} > ${i}`),t.duration=i,this.updateSchedule())};p.on(q.LEVEL_UPDATED,(e,{details:t})=>h(t)),p.on(q.LEVEL_PTS_UPDATED,(e,{details:t})=>h(t)),p.on(q.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());let g=(e,t)=>{let n=this.getAssetPlayer(u);if(n&&t.tracks){n.off(q.BUFFER_CODECS,g),n.tracks=t.tracks;let e=this.primaryMedia;this.bufferingAsset===n.assetItem&&e&&!n.media&&this.bufferAssetPlayer(n,e)}};p.on(q.BUFFER_CODECS,g),p.on(q.BUFFERED_TO_END,()=>{let n=this.getAssetPlayer(u);if(this.log(`buffered to end of asset ${n}`),!n||!this.schedule)return;let r=this.schedule.findEventIndex(e.identifier),i=this.schedule.items?.[r];this.isInterstitial(i)&&this.advanceAssetBuffering(i,t)});let _=t=>()=>{if(!this.getAssetPlayer(u)||!this.schedule)return;this.shouldPlay=!0;let n=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,n,t)};return p.once(q.MEDIA_ENDED,_(n)),p.once(q.PLAYOUT_LIMIT_REACHED,_(1/0)),p.on(q.ERROR,(t,r)=>{if(!this.schedule)return;let i=this.getAssetPlayer(u);if(r.details===K.BUFFER_STALLED_ERROR){if(i!=null&&i.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(r,e,this.schedule.findEventIndex(e.identifier),n,`Asset player error ${r.error} ${e}`)}),p.on(q.DESTROYING,()=>{if(!this.getAssetPlayer(u)||!this.schedule)return;let t=Error(`Asset player destroyed unexpectedly ${u}`),r={fatal:!0,type:G.OTHER_ERROR,details:K.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};this.handleAssetItemError(r,e,this.schedule.findEventIndex(e.identifier),n,t.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Vy(t)}`),this.hls.trigger(q.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:n,event:e,player:p}),p}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,t)})}resetAssetPlayer(e){let t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);let n=this.playerQueue[t];this.transferMediaFromPlayer(n,null),n.resetDetails()}}clearAssetPlayer(e,t){let n=this.getAssetPlayerQueueIndex(e);if(n!==-1){let e=this.playerQueue[n];this.log(`clear ${e} toSegment: ${t&&Gy(t)}`),this.transferMediaFromPlayer(e,t),this.playerQueue.splice(n,1),e.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}
31startAssetPlayer(e,t,n,r,i){let{interstitial:a,assetItem:o,assetId:s}=e,c=a.assetList.length,l=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!l||l.identifier!==s)&&(l&&(this.clearAssetPlayer(l.identifier,n[r]),delete l.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${c} ${Vy(o)}`),this.hls.trigger(q.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:a,schedule:n.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,i)}bufferAssetPlayer(e,t){if(!this.schedule)return;let{interstitial:n,assetItem:r}=e,i=this.schedule.findEventIndex(n.identifier),a=this.schedule.items?.[i];if(!a)return;e.loadSource(),this.setBufferingItem(a),this.bufferingAsset=r;let o=this.getBufferingPlayer();if(o===e)return;let s=n.appendInPlace;if(s&&o?.interstitial.appendInPlace===!1)return;let c=o?.tracks||this.detachedData?.tracks||this.requiredTracks;if(s&&r!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(c&&!td(c,e.tracks)){let t=Error(`Asset ${Vy(r)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(c)}')`),a={fatal:!0,type:G.OTHER_ERROR,details:K.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},o=n.findAssetIndex(r);this.handleAssetItemError(a,n,i,o,t.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){let t=this.schedule,n=this.primaryMedia;if(!t||!n)return;let r=n.currentTime,i=t.findAssetIndex(e,r),a=e.assetList[i];if(a){let o=this.getAssetPlayer(a.identifier);if(o){let s=o.currentTime||r-a.timelineStart,c=o.duration-s;if(this.warn(`Stalled at ${s} of ${s+c} in ${o} ${e} (media.currentTime: ${r})`),s&&(c/n.playbackRate<.5||o.bufferedInPlaceToEnd(n))&&o.hls){let n=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,n,i)}}}}advanceInPlace(e){let t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,n,r,i){if(e.details===K.BUFFER_STALLED_ERROR)return;let a=t.assetList[r]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${a&&Vy(a)} ${e.error}`),!this.schedule)return;let o=a?.identifier||``,s=this.getAssetPlayerQueueIndex(o),c=this.playerQueue[s]||null,l=this.schedule.items,u=zu({},e,{fatal:!1,errorAction:bp(!0),asset:a,assetListIndex:r,event:t,schedule:l,scheduleIndex:n,player:c});if(this.hls.trigger(q.INTERSTITIAL_ASSET_ERROR,u),!e.fatal)return;let d=this.playingAsset,f=this.bufferingAsset,p=Error(i);if(a&&(this.clearAssetPlayer(o,null),a.error=p),!t.assetList.some(e=>!e.error))t.error=p;else for(let e=r;e<t.assetList.length;e++)this.resetAssetPlayer(t.assetList[e].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):d&&d.identifier===o?this.advanceAfterAssetEnded(t,n,r):f&&f.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,f)}primaryFallback(e){let t=e.timelineStart,n=this.effectivePlayingItem,r=this.timelinePos;if(n){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${r} playing: ${Gy(n)} error: ${e.error}`),r===-1&&(r=this.hls.startPosition);let i=this.updateItem(n,r);this.itemsMatch(n,i)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(r===-1){this.checkStart();return}if(!this.schedule)return;let i=this.schedule.findItemIndexAtTime(r);this.setSchedulePosition(i)}onAssetListLoaded(e,t){var n;let r=t.event,i=r.identifier,a=t.assetListResponse.ASSETS;if(!((n=this.schedule)!=null&&n.hasEvent(i)))return;let o=r.timelineStart,s=r.duration,c=0;a.forEach((e,t)=>{let n=parseFloat(e.DURATION);this.createAsset(r,t,c,o+c,n,e.URI),c+=n}),r.duration=c,this.log(`Loaded asset-list with duration: ${c} (was: ${s}) ${r}`);let l=this.waitingItem?.event.identifier===i;this.updateSchedule();let u=this.bufferingItem?.event;if(l){let e=this.schedule.findEventIndex(i),t=this.schedule.items?.[e];if(t){if(!this.playingItem&&this.timelinePos>t.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==e){r.error=Error(`Interstitial ${a.length?`no longer within playback range`:`asset-list is empty`} ${this.timelinePos} ${r}`),this.log(r.error.message),this.updateSchedule(!0),this.primaryFallback(r);return}this.setBufferingItem(t)}this.setSchedulePosition(e)}else if(u?.identifier===i){let e=r.assetList[0];if(e){let t=this.getAssetPlayer(e.identifier);if(u.appendInPlace){let e=this.primaryMedia;t&&e&&this.bufferAssetPlayer(t,e)}else t&&t.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case K.ASSET_LIST_PARSING_ERROR:case K.ASSET_LIST_LOAD_ERROR:case K.ASSET_LIST_LOAD_TIMEOUT:{let e=t.interstitial;e&&(this.updateSchedule(!0),this.primaryFallback(e));break}case K.BUFFER_STALLED_ERROR:{let e=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(e)&&e.event.appendInPlace){this.handleInPlaceStall(e.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}},Xy=500,Zy=class extends yh{constructor(e,t,n){super(e,t,n,`subtitle-stream-controller`,Y.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(q.LEVEL_LOADED,this.onLevelLoaded,this),e.on(q.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUp
vendor: 8,815 bytes, line 31
31dated,this),e.on(q.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(q.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(q.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(q.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();let{hls:e}=this;e.off(q.LEVEL_LOADED,this.onLevelLoaded,this),e.off(q.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(q.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(q.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(q.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(q.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=$.IDLE,this.setInterval(Xy),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){let{frag:n,success:r}=t;if(this.fragContextChanged(n)||(pd(n)&&(this.fragPrevious=n),this.state=$.IDLE),!r)return;let i=this.tracksBuffered[this.currentTrackId];if(!i)return;let a,o=n.start;for(let e=0;e<i.length;e++)if(o>=i[e].start&&o<=i[e].end){a=i[e];break}let s=n.start+n.duration;a?a.end=s:(a={start:o,end:s},i.push(a)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null),this.media&&this.tick()}onBufferFlushing(e,t){let{startOffset:n,endOffset:r}=t;if(n===0&&r!==1/0){let e=r-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach(t=>{for(let n=0;n<t.length;){if(t[n].end<=e){t.shift();continue}else if(t[n].start<e)t[n].start=e;else break;n++}}),this.fragmentTracker.removeFragmentsInRange(n,e,Y.SUBTITLE)}}onError(e,t){let n=t.frag;n?.type===Y.SUBTITLE&&(t.details===K.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==$.STOPPED&&(this.state=$.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&N_(this.levels,t)){this.levels=t.map(e=>new Ff(e));return}this.tracksBuffered=[],this.levels=t.map(e=>{let t=new Ff(e);return this.tracksBuffered[t.id]=[],t}),this.fragmentTracker.removeFragmentsInRange(0,1/0,Y.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}let r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.state!==$.STOPPED&&this.setInterval(Xy)}onSubtitleTrackLoaded(e,t){var n;let{currentTrackId:r,levels:i}=this,{details:a,id:o}=t;if(!i){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}let s=i[o];if(o>=i.length||!s)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:``},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(a.live||(n=s.details)!=null&&n.live){if(a.deltaUpdateFailed)return;let e=this.mainDetails;if(!e){this.startFragRequested=!1;return}let t=e.fragments[0];s.details?(c=this.alignPlaylists(a,s.details,this.levelLastLoaded?.details),c===0&&t&&(c=t.start,th(a,c))):a.hasProgramDateTime&&e.hasProgramDateTime?(hh(a,e),c=a.fragmentStart):t&&(c=t.start,th(a,c)),e&&!this.startFragRequested&&this.setStartPosition(e,c)}s.details=a,this.levelLastLoaded=s,o===r&&(this.hls.trigger(q.SUBTITLE_TRACK_UPDATED,{details:a,id:o,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===$.IDLE&&(rp(null,a.fragments,this.media.currentTime,0)||(this.warn(`Subtitle playlist not aligned with playback`),s.details=void 0)))}_handleFragmentLoadComplete(e){let{frag:t,payload:n}=e,r=t.decryptdata,i=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&r!=null&&r.key&&r.iv&&om(r.method)){let e=performance.now();this.decrypter.decrypt(new Uint8Array(n),r.key.buffer,r.iv.buffer,sm(r.method)).catch(e=>{throw i.trigger(q.ERROR,{type:G.MEDIA_ERROR,details:K.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e}).then(n=>{let r=performance.now();i.trigger(q.FRAG_DECRYPTED,{frag:t,payload:n,stats:{tstart:e,tdecrypt:r}})}).catch(e=>{this.warn(`${e.name}: ${e.message}`),this.state=$.IDLE})}}doTick(){if(!this.media){this.state=$.IDLE;return}if(this.state===$.IDLE){let{currentTrackId:e,levels:t}=this,n=t?.[e];if(!n||!t.length||!n.details||this.waitForLive(n))return;let{config:r}=this,i=this.getLoadPosition(),{end:a,len:o}=Q.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],i,r.maxBufferHole),s=n.details;if(o>this.hls.maxBufferLength+s.levelTargetDuration)return;let c=s.fragments,l=c.length,u=s.edge,d=null,f=this.fragPrevious;if(a<u){let e=r.maxFragLookUpTolerance,t=a>u-e?0:e;d=rp(f,c,Math.max(c[0].start,a),t),!d&&f&&f.start<c[0].start&&(d=c[0])}else d=c[l-1];if(d=this.filterReplacedPrimary(d,n.details),!d)return;let p=c[d.sn-s.startSN-1];if(p&&p.cc===d.cc&&this.fragmentTracker.getState(p)===xp.NOT_LOADED&&(d=p),this.fragmentTracker.getState(d)===xp.NOT_LOADED){let e=this.mapToInitFragWhenRequired(d);e&&this.loadFragment(e,n,a)}}}loadFragment(e,t,n){pd(e)?super.loadFragment(e,t,n):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Qy(this.tracksBuffered[this.currentTrackId]||[])}},Qy=class{constructor(e){this.buffered=void 0;let t=(t,n,r)=>{if(n>>>=0,n>r-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${r})`);return e[n][t]};this.buffered={get length(){return e.length},end(n){return t(`end`,n,e.length)},start(n){return t(`start`,n,e.length)}}}},$y={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},eb=e=>String.fromCharCode($y[e]||e),tb=15,nb=100,rb={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},ib={17:2,18:4,21:6,22:8,23:10,19:13,20:15},ab={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ob={25:2,26:4,29:6,30:8,31:10,27:13,28:15},sb=[`white`,`green`,`blue`,`cyan`,`red`,`yellow`,`magenta`,`black`,`transparent`],cb=class{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){let n=typeof t==`function`?t():t;Qu.log(`${this.time} [${e}] ${n}`)}}},lb=function(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t},ub=class{constructor(){this.foreground=`white`,this.underline=!1,this.italics=!1,this.background=`black`,this.flash=!1}reset(){this.foreground=`white`,this.underline=!1,this.italics=!1,this.background=`black`,this.flash=!1}setStyles(e){let t=[`foreground`,`underline`,`italics`,`background`,`flash`];for(let n=0;n<t.length;n++){let r=t[n];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return this.foreground===`white`&&!this.underline&&!this.italics&&this.background===`black`&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return`color=`+this.foreground+`, underline=`+this.underline+`, italics=`+this.italics+`, background=`+this.background+`, flash=`+this.flash}},db=class{constructor(){this.uchar=` `,this.penState=new ub}reset(){this.uchar=` `,this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===` `&&this.penState.isDefault()}},fb=class{constructor(e){this.chars=[],this.pos=0,this.currPenState=new ub,this.cueStartTime=null,this.logger=void 0;for(let e=0;e<nb;e++)this.chars.push(new db);this.logger=e}equals(e){for(let t=0;t<nb;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<nb;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<nb;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}
vendor: 5,642 bytes, lines 31-32
31setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,`Negative cursor position `+this.pos),this.pos=0):this.pos>nb&&(this.logger.log(3,`Too large cursor position `+this.pos),this.pos=nb)}moveCursor(e){let t=this.pos+e;if(e>1)for(let e=this.pos+1;e<t+1;e++)this.chars[e].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(` `,this.currPenState)}insertChar(e){e>=144&&this.backSpace();let t=eb(e);if(this.pos>=nb){this.logger.log(0,()=>`Cannot insert `+e.toString(16)+` (`+t+`) at position `+this.pos+`. Skipping it!`);return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<nb;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){let e=[],t=!0;for(let n=0;n<nb;n++){let r=this.chars[n].uchar;r!==` `&&(t=!1),e.push(r)}return t?``:e.join(``)}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}},pb=class{constructor(e){this.rows=[],this.currRow=tb-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<tb;t++)this.rows.push(new fb(e));this.logger=e}reset(){for(let e=0;e<tb;e++)this.rows[e].clear();this.currRow=tb-1}equals(e){let t=!0;for(let n=0;n<tb;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<tb;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<tb;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,`setCursor: `+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>`pacData = `+Bf(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let e=0;e<tb;e++)this.rows[e].clear();let e=this.currRow+1-this.nrRollUpRows,n=this.lastOutputScreen;if(n){let r=n.rows[e].cueStartTime,i=this.logger.time;if(r!==null&&i!==null&&r<i)for(let r=0;r<this.nrRollUpRows;r++)this.rows[t-this.nrRollUpRows+r+1].copy(n.rows[e+r])}}this.currRow=t;let n=this.rows[this.currRow];if(e.indent!==null){let t=e.indent,r=Math.max(t-1,0);n.setCursor(e.indent),e.color=n.chars[r].penState.foreground}let r={foreground:e.color,underline:e.underline,italics:e.italics,background:`black`,flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>`bkgData = `+Bf(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,`roll_up but nrRollUpRows not set yet`);return}this.logger.log(1,()=>this.getDisplayText());let e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,`Rolling up`)}getDisplayText(e){e||=!1;let t=[],n=``,r=-1;for(let n=0;n<tb;n++){let i=this.rows[n].getTextString();i&&(r=n+1,e?t.push(`Row `+r+`: '`+i+`'`):t.push(i.trim()))}return t.length>0&&(n=e?`[`+t.join(` | `)+`]`:t.join(` 32`)),n}getTextAndFormat(){return this.rows}},mb=class{constructor(e,t,n){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new pb(n),this.nonDisplayedMemory=new pb(n),this.lastOutputScreen=new pb(n),this.currRollUpRow=this.displayedMemory.rows[tb-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[tb-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>`MODE=`+e),this.mode===`MODE_POP-ON`?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!==`MODE_ROLL-UP`&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);let t=this.writeScreen===this.displayedMemory?`DISP`:`NON_DISP`;this.logger.log(2,()=>t+`: `+this.writeScreen.getDisplayText(!0)),(this.mode===`MODE_PAINT-ON`||this.mode===`MODE_ROLL-UP`)&&(this.logger.log(1,()=>`DISPLAYED: `+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,`RCL - Resume Caption Loading`),this.setMode(`MODE_POP-ON`)}ccBS(){this.logger.log(2,`BS - BackSpace`),this.mode!==`MODE_TEXT`&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,`DER- Delete to End of Row`),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,`RU(`+e+`) - Roll Up`),this.writeScreen=this.displayedMemory,this.setMode(`MODE_ROLL-UP`),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,`FON - Flash On`),this.writeScreen.setPen({flash:!0})}
vendor: 13,761 bytes, lines 32-40
32ccRDC(){this.logger.log(2,`RDC - Resume Direct Captioning`),this.setMode(`MODE_PAINT-ON`)}ccTR(){this.logger.log(2,`TR`),this.setMode(`MODE_TEXT`)}ccRTD(){this.logger.log(2,`RTD`),this.setMode(`MODE_TEXT`)}ccEDM(){this.logger.log(2,`EDM - Erase Displayed Memory`),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,`CR - Carriage Return`),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,`ENM - Erase Non-displayed Memory`),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,`EOC - End Of Caption`),this.mode===`MODE_POP-ON`){let e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>`DISP: `+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,`TO(`+e+`) - Tab Offset`),this.writeScreen.moveCursor(e)}ccMIDROW(e){let t={flash:!1};t.underline=e%2==1,t.italics=e>=46,t.italics?t.foreground=`white`:t.foreground=[`white`,`green`,`blue`,`cyan`,`red`,`yellow`,`magenta`][Math.floor(e/2)-16],this.logger.log(2,`MIDROW: `+Bf(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){let t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}},hb=class{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=vb(),this.logger=void 0;let r=this.logger=new cb;this.channels=[null,new mb(e,t,r),new mb(e+1,n,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let e=0;e<t.length;e+=2){let n=t[e]&127,r=t[e+1]&127,i=!1,a=null;if(n===0&&r===0)continue;this.logger.log(3,()=>`[`+lb([t[e],t[e+1]])+`] -> (`+lb([n,r])+`)`);let o=this.cmdHistory;if(n>=16&&n<=31){if(_b(n,r,o)){gb(null,null,o),this.logger.log(3,()=>`Repeated command (`+lb([n,r])+`) is dropped`);continue}gb(n,r,this.cmdHistory),i=this.parseCmd(n,r),i||=this.parseMidrow(n,r),i||=this.parsePAC(n,r),i||=this.parseBackgroundAttributes(n,r)}else gb(null,null,o);if(!i&&(a=this.parseChars(n,r),a)){let e=this.currentChannel;e&&e>0?this.channels[e].insertChars(a):this.logger.log(2,`No channel found yet. TEXT-MODE?`)}!i&&!a&&this.logger.log(2,()=>`Couldn't parse cleaned data `+lb([n,r])+` orig: `+lb([t[e],t[e+1]]))}}parseCmd(e,t){if(!((e===20||e===28||e===21||e===29)&&t>=32&&t<=47||(e===23||e===31)&&t>=33&&t<=35))return!1;let n=e===20||e===21||e===23?1:2,r=this.channels[n];return e===20||e===21||e===28||e===29?t===32?r.ccRCL():t===33?r.ccBS():t===34?r.ccAOF():t===35?r.ccAON():t===36?r.ccDER():t===37?r.ccRU(2):t===38?r.ccRU(3):t===39?r.ccRU(4):t===40?r.ccFON():t===41?r.ccRDC():t===42?r.ccTR():t===43?r.ccRTD():t===44?r.ccEDM():t===45?r.ccCR():t===46?r.ccENM():t===47&&r.ccEOC():r.ccTO(t-32),this.currentChannel=n,!0}parseMidrow(e,t){let n=0;if((e===17||e===25)&&t>=32&&t<=47){if(n=e===17?1:2,n!==this.currentChannel)return this.logger.log(0,`Mismatch channel in midrow parsing`),!1;let r=this.channels[n];return r?(r.ccMIDROW(t),this.logger.log(3,()=>`MIDROW (`+lb([e,t])+`)`),!0):!1}return!1}parsePAC(e,t){let n;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(e===16||e===24)&&t>=64&&t<=95))return!1;let r=e<=23?1:2;n=t>=64&&t<=95?r===1?rb[e]:ab[e]:r===1?ib[e]:ob[e];let i=this.channels[r];return i?(i.setPAC(this.interpretPAC(n,t)),this.currentChannel=r,!0):!1}interpretPAC(e,t){let n,r={color:null,italics:!1,indent:null,underline:!1,row:e};return n=t>95?t-96:t-64,r.underline=(n&1)==1,n<=13?r.color=[`white`,`green`,`blue`,`cyan`,`red`,`yellow`,`magenta`,`white`][Math.floor(n/2)]:n<=15?(r.italics=!0,r.color=`white`):r.indent=Math.floor((n-16)/2)*4,r}parseChars(e,t){let n,r=null,i=null;if(e>=25?(n=2,i=e-8):(n=1,i=e),i>=17&&i<=19){let e;e=i===17?t+80:i===18?t+112:t+144,this.logger.log(2,()=>`Special char '`+eb(e)+`' in channel `+n),r=[e]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);return r&&this.logger.log(3,()=>`Char codes = `+lb(r).join(`,`)),r}parseBackgroundAttributes(e,t){if(!((e===16||e===24)&&t>=32&&t<=47||(e===23||e===31)&&t>=45&&t<=47))return!1;let n,r={};e===16||e===24?(n=Math.floor((t-32)/2),r.background=sb[n],t%2==1&&(r.background+=`_semi`)):t===45?r.background=`transparent`:(r.foreground=`black`,t===47&&(r.underline=!0));let i=e<=23?1:2;return this.channels[i].setBkgData(r),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){let t=this.channels[e];t&&t.reset()}gb(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){let n=this.channels[t];n&&n.cueSplitAtTime(e)}}};function gb(e,t,n){n.a=e,n.b=t}function _b(e,t,n){return n.a===e&&n.b===t}function vb(){return{a:null,b:null}}var yb=(function(){if(pm!=null&&pm.VTTCue)return self.VTTCue;let e=[``,`lr`,`rl`],t=[`start`,`middle`,`end`,`left`,`right`];function n(e,t){if(typeof t!=`string`||!Array.isArray(e))return!1;let n=t.toLowerCase();return~e.indexOf(n)?n:!1}function r(t){return n(e,t)}function i(e){return n(t,e)}function a(e,...t){let n=1;for(;n<arguments.length;n++){let t=arguments[n];for(let n in t)e[n]=t[n]}return e}function o(e,t,n){let o=this,s={enumerable:!0};o.hasBeenReset=!1;let c=``,l=!1,u=e,d=t,f=n,p=null,m=``,h=!0,g=`auto`,_=`start`,v=50,y=`middle`,b=50,x=`middle`;Object.defineProperty(o,`id`,a({},s,{get:function(){return c},set:function(e){c=``+e}})),Object.defineProperty(o,`pauseOnExit`,a({},s,{get:function(){return l},set:function(e){l=!!e}})),Object.defineProperty(o,`startTime`,a({},s,{get:function(){return u},set:function(e){if(typeof e!=`number`)throw TypeError(`Start time must be set to a number.`);u=e,this.hasBeenReset=!0}})),Object.defineProperty(o,`endTime`,a({},s,{get:function(){return d},set:function(e){if(typeof e!=`number`)throw TypeError(`End time must be set to a number.`);d=e,this.hasBeenReset=!0}})),Object.defineProperty(o,`text`,a({},s,{get:function(){return f},set:function(e){f=``+e,this.hasBeenReset=!0}})),Object.defineProperty(o,`region`,a({},s,{get:function(){return p},set:function(e){p=e,this.hasBeenReset=!0}})),Object.defineProperty(o,`vertical`,a({},s,{get:function(){return m},set:function(e){let t=r(e);if(t===!1)throw SyntaxError(`An invalid or illegal string was specified.`);m=t,this.hasBeenReset=!0}})),Object.defineProperty(o,`snapToLines`,a({},s,{get:function(){return h},set:function(e){h=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,`line`,a({},s,{get:function(){return g},set:function(e){if(typeof e!=`number`&&e!==`auto`)throw SyntaxError(`An invalid number or illegal string was specified.`);g=e,this.hasBeenReset=!0}})),Object.defineProperty(o,`lineAlign`,a({},s,{get:function(){return _},set:function(e){let t=i(e);if(!t)throw SyntaxError(`An invalid or illegal string was specified.`);_=t,this.hasBeenReset=!0}})),Object.defineProperty(o,`position`,a({},s,{get:function(){return v},set:function(e){if(e<0||e>100)throw Error(`Position must be between 0 and 100.`);v=e,this.hasBeenReset=!0}})),Object.defineProperty(o,`positionAlign`,a({},s,{get:function(){return y},set:function(e){let t=i(e);if(!t)throw SyntaxError(`An invalid or illegal string was specified.`);y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,`size`,a({},s,{get:function(){return b},set:function(e){if(e<0||e>100)throw Error(`Size must be between 0 and 100.`);b=e,this.hasBeenReset=!0}})),Object.defineProperty(o,`align`,a({},s,{get:function(){return x},set:function(e){let t=i(e);if(!t)throw SyntaxError(`An invalid or illegal string was specified.`);x=t,this.hasBeenReset=!0}})),o.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o})(),bb=class{decode(e,t){if(!e)return``;if(typeof e!=`string`)throw Error(`Error - expected string data.`);return decodeURIComponent(encodeURIComponent(e))}};function xb(e){function t(e,t,n,r){return(e|0)*3600+(t|0)*60+(n|0)+parseFloat(r||0)}let n=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?t(n[2],n[3],0,n[4]):t(n[1],n[2],n[3],n[4]):null}var Sb=class{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==``&&(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let r=0;r<n.length;++r)if(t===n[r]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){let n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}};function Cb(e,t,n,r){let i=r?e.split(r):[e];for(let e in i){if(typeof i[e]!=`string`)continue;let r=i[e].split(n);if(r.length!==2)continue;let a=r[0],o=r[1];t(a,o)}}var wb=new yb(0,0,``),Tb=wb.align===`middle`?`middle`:`center`;function Eb(e,t,n){let r=e;function i(){let t=xb(e);if(t===null)throw Error(`Malformed timestamp: `+r);return e=e.replace(/^[^\sa-zA-Z-]+/,``),t}function a(e,t){let r=new Sb;Cb(e,function(e,t){let i;switch(e){case`region`:for(let i=n.length-1;i>=0;i--)if(n[i].id===t){r.set(e,n[i].region);break}break;case`vertical`:r.alt(e,t,[`rl`,`lr`]);break;case`line`:i=t.split(`,`),r.integer(e,i[0]),r.percent(e,i[0])&&r.set(`snapToLines`,!1),r.alt(e,i[0],[`auto`]),i.length===2&&r.alt(`lineAlign`,i[1],[`start`,Tb,`end`]);break;case`position`:i=t.split(`,`),r.percent(e,i[0]),i.length===2&&r.alt(`positionAlign`,i[1],[`start`,Tb,`end`,`line-left`,`line-right`,`auto`]);break;case`size`:r.percent(e,t);break;case`align`:r.alt(e,t,[`start`,Tb,`end`,`left`,`right`]);break}},/:/,/\s/),t.region=r.get(`region`,null),t.vertical=r.get(`vertical`,``);let i=r.get(`line`,`auto`);i===`auto`&&wb.line===-1&&(i=-1),t.line=i,t.lineAlign=r.get(`lineAlign`,`start`),t.snapToLines=r.get(`snapToLines`,!0),t.size=r.get(`size`,100),t.align=r.get(`align`,Tb);let a=r.get(`position`,`auto`);a===`auto`&&wb.position===50&&(a=t.align===`start`||t.align===`left`?0:t.align===`end`||t.align===`right`?100:50),t.position=a}function o(){e=e.replace(/^\s+/,``)}if(o(),t.startTime=i(),o(),e.slice(0,3)!==`-->`)throw Error(`Malformed time stamp (time stamps must be separated by '-->'): `+r);e=e.slice(3),o(),t.endTime=i(),o(),a(e,t)}function Db(e){return e.replace(/<br(?: \/)?>/gi,` 33`)}var Ob=class{constructor(){this.state=`INITIAL`,this.buffer=``,this.decoder=new bb,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){let t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function n(){let e=t.buffer,n=0;for(e=Db(e);n<e.length&&e[n]!==`\r`&&e[n]!==` 34`;)++n;let r=e.slice(0,n);return e[n]===`\r`&&++n,e[n]===` 35`&&++n,t.buffer=e.slice(n),r}function r(e){Cb(e,function(e,t){},/:/)}try{let e=``;if(t.state===`INITIAL`){if(!/\r\n|\n/.test(t.buffer))return this;e=n();let r=e.match(/^()?WEBVTT([ \t].*)?$/);if(!(r!=null&&r[0]))throw Error(`Malformed WebVTT signature.`);t.state=`HEADER`}let i=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(i?i=!1:e=n(),t.state){case`HEADER`:/:/.test(e)?r(e):e||(t.state=`ID`);continue;case`NOTE`:e||(t.state=`ID`);continue;case`ID`:if(/^NOTE($|[ \t])/.test(e)){t.state=`NOTE`;break}if(!e)continue;if(t.cue=new yb(0,0,``),t.state=`CUE`,e.indexOf(`-->`)===-1){t.cue.id=e;continue}case`CUE`:if(!t.cue){t.state=`BADCUE`;continue}try{Eb(e,t.cue,t.regionList)}catch{t.cue=null,t.state=`BADCUE`;continue}t.state=`CUETEXT`;continue;case`CUETEXT`:{let n=e.indexOf(`-->`)!==-1;if(!e||n&&(i=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state=`ID`;continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=` 36`),t.cue.text+=e}continue;case`BADCUE`:e||(t.state=`ID`)}}}catch{t.state===`CUETEXT`&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state===`INITIAL`?`BADWEBVTT`:`BADCUE`}return this}flush(){let e=this;try{if((e.cue||e.state===`HEADER`)&&(e.buffer+=` 37 38`,e.parse()),e.state===`INITIAL`||e.state===`BADWEBVTT`)throw Error(`Malformed WebVTT signature.`)}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}},kb=/\r\n|\n\r|\n|\r/g,Ab=function(e,t,n=0){return e.slice(n,n+t.length)===t},jb=function(e){let t=parseInt(e.slice(-3)),n=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),i=e.length>9?parseInt(e.substring(0,e.indexOf(`:`))):0;if(!W(t)||!W(n)||!W(r)||!W(i))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*n,t+=60*1e3*r,t+=3600*1e3*i,t};function Mb(e,t,n){return My(e.toString())+My(t.toString())+My(n)}var Nb=function(e,t,n){let r=e[t],i=e[r.prevCC];if(!i||!i.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(a=i)!=null&&a.new;){var a;e.ccOffset+=r.start-i.start,r.new=!1,r=i,i=e[r.prevCC]}e.presentationOffset=n};function Pb(e,t,n,r,i,a,o){let s=new Ob,c=nd(new Uint8Array(e)).trim().replace(kb,` 39`).split(` 40`),l=[],u=t?n_(t.baseTime,t.timescale):0,d=`00:00.000`,f=0,p=0,m,h=!0;s.oncue=function(e){let a=n[r],o=n.ccOffset,s=(f-u)/9e4;if(a!=null&&a.new&&(p===void 0?Nb(n,r,s):o=n.ccOffset=a.start),s){if(!t){m=Error(`Missing initPTS for VTT MPEGTS`);return}o=s-n.presentationOffset}let c=e.endTime-e.startTime,d=f_((e.startTime+o-p)*9e4,i*9e4)/9e4;e.startTime=Math.max(d,0),e.endTime=Math.max(d+c,0);let h=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(h)),e.id||=Mb(e.startTime,e.endTime,h),e.endTime>0&&l.push(e)},s.onparsingerror=function(e){m=e},s.onflush=function(){if(m){o(m);return}a(l)}
vendor: 4,364 bytes, lines 40-42
40,c.forEach(e=>{if(h)if(Ab(e,`X-TIMESTAMP-MAP=`)){h=!1,e.slice(16).split(`,`).forEach(e=>{Ab(e,`LOCAL:`)?d=e.slice(6):Ab(e,`MPEGTS:`)&&(f=parseInt(e.slice(7)))});try{p=jb(d)/1e3}catch(e){m=e}return}else e===``&&(h=!1);s.parse(e+` 41`)}),s.flush()}var Fb=`stpp.ttml.im1t`,Ib=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Lb=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Rb={left:`start`,center:`center`,right:`end`,start:`start`,end:`end`};function zb(e,t,n,r){let i=Z(new Uint8Array(e),[`mdat`]);if(i.length===0){r(Error(`Could not parse IMSC1 mdat`));return}let a=i.map(e=>nd(e)),o=e_(t.baseTime,1,t.timescale);try{a.forEach(e=>n(Bb(e,o)))}catch(e){r(e)}}function Bb(e,t){let n=new DOMParser().parseFromString(e,`text/xml`).getElementsByTagName(`tt`)[0];if(!n)throw Error(`Invalid ttml`);let r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},i=Object.keys(r).reduce((e,t)=>(e[t]=n.getAttribute(`ttp:${t}`)||r[t],e),{}),a=n.getAttribute(`xml:space`)!==`preserve`,o=Hb(Vb(n,`styling`,`style`)),s=Hb(Vb(n,`layout`,`region`)),c=Vb(n,`body`,`[begin]`);return[].map.call(c,e=>{let n=Ub(e,a);if(!n||!e.hasAttribute(`begin`))return null;let r=qb(e.getAttribute(`begin`),i),c=qb(e.getAttribute(`dur`),i),l=qb(e.getAttribute(`end`),i);if(r===null)throw Kb(e);if(l===null){if(c===null)throw Kb(e);l=r+c}let u=new yb(r-t,l-t,n);u.id=Mb(u.startTime,u.endTime,u.text);let d=s[e.getAttribute(`region`)],f=o[e.getAttribute(`style`)],p=Wb(d,f,o),{textAlign:m}=p;if(m){let e=Rb[m];e&&(u.lineAlign=e),u.align=m}return zu(u,p),u}).filter(e=>e!==null)}function Vb(e,t,n){let r=e.getElementsByTagName(t)[0];return r?[].slice.call(r.querySelectorAll(n)):[]}function Hb(e){return e.reduce((e,t)=>{let n=t.getAttribute(`xml:id`);return n&&(e[n]=t),e},{})}function Ub(e,t){return[].slice.call(e.childNodes).reduce((e,n,r)=>{var i;return n.nodeName===`br`&&r?e+` 42`:(i=n.childNodes)!=null&&i.length?Ub(n,t):t?e+n.textContent.trim().replace(/\s+/g,` `):e+n.textContent},``)}function Wb(e,t,n){let r=`http://www.w3.org/ns/ttml#styling`,i=null,a=[`displayAlign`,`textAlign`,`color`,`backgroundColor`,`fontSize`,`fontFamily`],o=e!=null&&e.hasAttribute(`style`)?e.getAttribute(`style`):null;return o&&n.hasOwnProperty(o)&&(i=n[o]),a.reduce((n,a)=>{let o=Gb(t,r,a)||Gb(e,r,a)||Gb(i,r,a);return o&&(n[a]=o),n},{})}function Gb(e,t,n){return e&&e.hasAttributeNS(t,n)?e.getAttributeNS(t,n):null}function Kb(e){return Error(`Could not parse ttml timestamp ${e}`)}function qb(e,t){if(!e)return null;let n=xb(e);return n===null&&(Ib.test(e)?n=Jb(e,t):Lb.test(e)&&(n=Yb(e,t))),n}function Jb(e,t){let n=Ib.exec(e),r=(n[4]|0)+(n[5]|0)/t.subFrameRate;return(n[1]|0)*3600+(n[2]|0)*60+(n[3]|0)+r/t.frameRate}function Yb(e,t){let n=Lb.exec(e),r=Number(n[1]);switch(n[2]){case`h`:return r*3600;case`m`:return r*60;case`ms`:return r*1e3;case`f`:return r/t.frameRate;case`t`:return r/t.tickRate}return r}var Xb=class{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}},Zb=class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=tx(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}}
vendor: 8,676 bytes, line 42
42,e.on(q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(q.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(q.FRAG_LOADING,this.onFragLoading,this),e.on(q.FRAG_LOADED,this.onFragLoaded,this),e.on(q.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(q.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(q.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(q.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(q.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){let{hls:e}=this;e.off(q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(q.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(q.FRAG_LOADING,this.onFragLoading,this),e.off(q.FRAG_LOADED,this.onFragLoaded,this),e.off(q.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(q.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(q.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(q.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(q.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){let e=new Xb(this,`textTrack1`),t=new Xb(this,`textTrack2`),n=new Xb(this,`textTrack3`),r=new Xb(this,`textTrack4`);this.cea608Parser1=new hb(1,e,t),this.cea608Parser2=new hb(3,n,r)}addCues(e,t,n,r,i){let a=!1;for(let e=i.length;e--;){let r=i[e],o=ex(r[0],r[1],t,n);if(o>=0&&(r[0]=Math.min(r[0],t),r[1]=Math.max(r[1],n),a=!0,o/(n-t)>.5))return}if(a||i.push([t,n]),this.config.renderTextTracksNatively){let i=this.captionsTracks[e];this.Cues.newCue(i,t,n,r)}else{let i=this.Cues.newCue(null,t,n,r);this.hls.trigger(q.CUES_PARSED,{type:`captions`,cues:i,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:r,timescale:i,trackId:a}){let{unparsedVttFrags:o}=this;n===Y.MAIN&&(this.initPTS[t.cc]={baseTime:r,timescale:i,trackId:a}),o.length&&(this.unparsedVttFrags=[],o.forEach(e=>{this.initPTS[e.frag.cc]?this.onFragLoaded(q.FRAG_LOADED,e):this.hls.trigger(q.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e.frag,error:Error(`Subtitle discontinuity domain does not match main`)})}))}getExistingTrack(e,t){let{media:n}=this;if(n)for(let r=0;r<n.textTracks.length;r++){let i=n.textTracks[r];if($b(i,{name:e,lang:t,characteristics:`transcribes-spoken-dialog,describes-music-and-sound`}))return i}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;let{captionsProperties:t,captionsTracks:n,media:r}=this,{label:i,languageCode:a}=t[e],o=this.getExistingTrack(i,a);if(o)n[e]=o,Ty(n[e]),Cy(n[e],r);else{let t=this.createTextTrack(`captions`,i,a);t&&(t[e]=!0,n[e]=t)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;let t=this.captionsProperties[e];if(!t)return;let n={_id:e,label:t.label,kind:`captions`,default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(q.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(e,t,n){let r=this.media;if(r)return r.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){let n=!!t.transferMedia;if(this.media=null,n)return;let{captionsTracks:r}=this;Object.keys(r).forEach(e=>{Ty(r[e]),delete r[e]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=tx(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){let{media:e}=this;if(!e)return;let t=e.textTracks;if(t)for(let e=0;e<t.length;e++)Ty(t[e])}onSubtitleTracksUpdated(e,t){let n=t.subtitleTracks||[],r=n.some(e=>e.textCodec===Fb);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(N_(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){let e=this.media,t=e?ky(e.textTracks):null;if(this.tracks.forEach((e,n)=>{let r;if(t){let n=null;for(let r=0;r<t.length;r++)if(t[r]&&$b(t[r],e)){n=t[r],t[r]=null;break}n&&(r=n)}if(r)Ty(r);else{let t=Qb(e);r=this.createTextTrack(t,e.name,e.lang),r&&(r.mode=`disabled`)}r&&this.textTracks.push(r)}),t!=null&&t.length){let e=t.filter(e=>e!==null).map(e=>e.label);e.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${e.join(`, `)}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){let e=this.tracks.map(e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}));this.hls.trigger(q.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(e=>{let t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;let n=`textTrack${t[1]}`,r=this.captionsProperties[n];r&&(r.label=e.name,e.lang&&(r.languageCode=e.lang),r.media=e)})}closedCaptionsForLevel(e){return this.hls.levels[e.level]?.attrs[`CLOSED-CAPTIONS`]}onFragLoading(e,t){if(this.enabled&&t.frag.type===Y.MAIN){let{cea608Parser1:e,cea608Parser2:n,lastSn:r}=this,{cc:i,sn:a}=t.frag,o=t.part?.index??-1;e&&n&&(a!==r+1||a===r&&o!==this.lastPartIndex+1||i!==this.lastCc)&&(e.reset(),n.reset()),this.lastCc=i,this.lastSn=a,this.lastPartIndex=o}}onFragLoaded(e,t){let{frag:n,payload:r}=t;if(n.type===Y.SUBTITLE)if(r.byteLength){let e=n.decryptdata,i=`stats`in t;if(e==null||!e.encrypted||i){let e=this.tracks[n.level],i=this.vttCCs;i[n.cc]||(i[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),e&&e.textCodec===Fb?this._parseIMSC1(n,r):this._parseVTTs(t)}}else this.hls.trigger(q.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:Error(`Empty subtitle payload`)})}_parseIMSC1(e,t){let n=this.hls;zb(t,this.initPTS[e.cc],t=>{this._appendCues(t,e.level),n.trigger(q.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},t=>{n.logger.log(`Failed to parse IMSC1: ${t}`),n.trigger(q.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})})}_parseVTTs(e){var t;let{frag:n,payload:r}=e,{initPTS:i,unparsedVttFrags:a}=this,o=i.length-1;if(!i[n.cc]&&o===-1){a.push(e);return}let s=this.hls;Pb((t=n.initSegment)!=null&&t.data?Bd(n.initSegment.data,new Uint8Array(r)).buffer:r,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,e=>{this._appendCues(e,n.level),s.trigger(q.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},t=>{let i=t.message===`Missing initPTS for VTT MPEGTS`;i?a.push(e):this._fallbackToIMSC1(n,r),s.logger.log(`Failed to parse VTT cue: ${t}`),!(i&&o>n.cc)&&s.trigger(q.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:t})})}_fallbackToIMSC1(e,t){let n=this.tracks[e.level];n.textCodec||zb(t,this.initPTS[e.cc],()=>{n.textCodec=Fb,this._parseIMSC1(e,t)},()=>{n.textCodec=`wvtt`})}_appendCues(e,t){let n=this.hls;if(this.config.renderTextTracksNatively){let n=this.textTracks[t];if(!n||n.mode===`disabled`)return;e.forEach(e=>wy(n,e))}else{let r=this.tracks[t];if(!r)return;let i=r.default?`default`:`subtitles`+t;n.trigger(q.CUES_PARSED,{type:`subtitles`,cues:e,track:i})}}onFragDecrypted(e,t){let{frag:n}=t;n.type===Y.SUBTITLE&&this.onFragLoaded(q.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;let{frag:n,samples:r}=t;if(!(n.type===Y.MAIN&&this.closedCaptionsForLevel(n)===`NONE`))for(let e=0;e<r.length;e++){let t=r[e].bytes;if(t){this.cea608Parser1||this.initCea608Parsers();let n=this.extractCea608Data(t);this.cea608Parser1.addData(r[e].pts,n[0]),this.cea608Parser2.addData(r[e].pts,n[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:r,type:i}){let{media:a}=this;if(!(!a||a.currentTime<n)){if(!i||i===`video`){let{captionsTracks:e}=this;Object.keys(e).forEach(r=>Ey(e[r],t,n))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){let{textTracks:e}=this;Object.keys(e).forEach(n=>Ey(e[n],t,r))}}}extractCea608Data(e){let t=[[],[]],n=e[0]&31,r=2;for(let i=0;i<n;i++){let n=e[r++],i=127&e[r++],a=127&e[r++];if(!(i===0&&a===0)&&4&n){let e=3&n;(e===0||e===1)&&(t[e].push(i),t[e].push(a))}}return t}};function Qb(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?`
42captions`:`subtitles`}function $b(e,t){return!!e&&e.kind===Qb(t)&&F_(t,e)}function ex(e,t,n,r){return Math.min(t,r)-Math.max(e,n)}function tx(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}var nx=/\s/,rx={newCue(e,t,n,r){let i=[],a,o,s,c,l,u=self.VTTCue||self.TextTrackCue;for(let f=0;f<r.rows.length;f++)if(a=r.rows[f],s=!0,c=0,l=``,!a.isEmpty()){var d;for(let e=0;e<a.chars.length;e++)nx.test(a.chars[e].uchar)&&s?c++:(l+=a.chars[e].uchar,s=!1);a.cueStartTime=t,t===n&&(n+=1e-4),c>=16?c--:c++;let r=Db(l.trim()),p=Mb(t,n,r);e!=null&&(d=e.cues)!=null&&d.getCueById(p)||(o=new u(t,n,r),o.id=p,o.line=f+1,o.align=`left`,o.position=10+Math.min(80,Math.floor(c*8/32)*10),i.push(o))}return e&&i.length&&(i.sort((e,t)=>e.line===`auto`||t.line===`auto`?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line),i.forEach(t=>wy(e,t))),i}};function ix(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}var ax=/(\d+)-(\d+)\/(\d+)/,ox=class{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||ux,this.controller=new self.AbortController,this.stats=new ud}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,n){let r=this.stats;if(r.loading.start)throw Error(`Loader can only be used once.`);r.loading.start=self.performance.now();let i=sx(e,this.controller.signal),a=e.responseType===`arraybuffer`,o=a?`byteLength`:`length`,{maxTimeToFirstByteMs:s,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,i),self.clearTimeout(this.requestTimeout),t.timeout=s&&W(s)?s:c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(T_(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(n=>{this.response=this.loader=n;let i=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},c-(i-r.loading.start)),!n.ok){let{status:e,statusText:t}=n;throw new dx(t||`fetch, bad network response`,e,n)}r.loading.first=i,r.total=lx(n.headers)||r.total;let o=this.callbacks?.onProgress;return o&&W(t.highWaterMark)?this.loadProgressively(n,r,e,t.highWaterMark,o):a?n.arrayBuffer():e.responseType===`json`?n.json():n.text()}).then(n=>{var i;let a=this.response;if(!a)throw Error(`loader destroyed`);self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);let s=n[o];s&&(r.loaded=r.total=s);let c={url:a.url,data:n,code:a.status},l=this.callbacks?.onProgress;l&&!W(t.highWaterMark)&&l(r,e,n,a),(i=this.callbacks)==null||i.onSuccess(c,r,e,a)}).catch(t=>{var n;if(self.clearTimeout(this.requestTimeout),r.aborted)return;let i=t&&t.code||0,a=t?t.message:null;(n=this.callbacks)==null||n.onError({code:i,text:a},e,t?t.details:null,r)})}getCacheAge(){let e=null;if(this.response){let t=this.response.headers.get(`age`);e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,n,r=0,i){let a=new xh,o=e.body.getReader(),s=()=>o.read().then(o=>{if(o.done)return a.dataLength&&i(t,n,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));let c=o.value,l=c.length;return t.loaded+=l,l<r||a.dataLength?(a.push(c),a.dataLength>=r&&i(t,n,a.flush().buffer,e)):i(t,n,c.buffer,e),s()}).catch(()=>Promise.reject());return s()}};function sx(e,t){let n={method:`GET`,mode:`cors`,credentials:`same-origin`,signal:t,headers:new self.Headers(zu({},e.headers))};return e.rangeEnd&&n.headers.set(`Range`,`bytes=`+e.rangeStart+`-`+String(e.rangeEnd-1)),n}function cx(e){let t=ax.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}function lx(e){let t=e.get(`Content-Range`);if(t){let e=cx(t);if(W(e))return e}let n=e.get(`Content-Length`);if(n)return parseInt(n)}
vendor: 9,626 bytes, line 42
42function ux(e,t){return new self.Request(e.url,t)}var dx=class extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}},fx=/^age:\s*[\d.]+\s*$/im,px=class{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new ud,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){let e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,n){if(this.stats.loading.start)throw Error(`Loader can only be used once.`);this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=n,this.loadInternal()}loadInternal(){let{config:e,context:t}=this;if(!e||!t)return;let n=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;let i=this.xhrSetup;i?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return i(n,t.url)}).catch(e=>{if(!(this.loader!==n||this.stats.aborted))return n.open(`GET`,t.url,!0),i(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(e=>{var i;(i=this.callbacks)==null||i.onError({code:n.status,text:e.message},t,n,r)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open(`GET`,t.url,!0);let r=t.headers,{maxTimeToFirstByteMs:i,maxLoadTimeMs:a}=n.loadPolicy;if(r)for(let t in r)e.setRequestHeader(t,r[t]);t.rangeEnd&&e.setRequestHeader(`Range`,`bytes=`+t.rangeStart+`-`+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),n.timeout=i&&W(i)?i:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){let{context:e,loader:t,stats:n}=this;if(!e||!t)return;let r=t.readyState,i=this.config;if(!n.aborted&&r>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),i.timeout!==i.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),i.timeout=i.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;let r=t.status,s=t.responseType===`text`?t.responseText:null;if(r>=200&&r<300){let i=s??t.response;if(i!=null){var a;n.loading.end=Math.max(self.performance.now(),n.loading.first),n.loaded=n.total=t.responseType===`arraybuffer`?i.byteLength:i.length,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first);let o=this.callbacks?.onProgress;o&&o(n,e,i,t);let s={url:t.responseURL,data:i,code:r};(a=this.callbacks)==null||a.onSuccess(s,n,e,t);return}}let c=i.loadPolicy.errorRetry,l=n.retry;if(mp(c,l,!1,{url:e.url,data:void 0,code:r}))this.retry(c);else{var o;Qu.error(`${r} while loading ${e.url}`),(o=this.callbacks)==null||o.onError({code:r,text:t.statusText},e,t,n)}}}loadtimeout(){if(!this.config)return;let e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(mp(e,t,!0))this.retry(e);else{Qu.warn(`timeout while loading ${this.context?.url}`);let e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){let{context:t,stats:n}=this;this.retryDelay=fp(e,n.retry),n.retry++,Qu.warn(`${status?`HTTP Status `+status:`Timeout`} while loading ${t?.url}, retrying ${n.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){let t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&fx.test(this.loader.getAllResponseHeaders())){let t=this.loader.getResponseHeader(`age`);e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&RegExp(`^${e}:\\s*[\\d.]+\\s*$`,`im`).test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}},mx=Vu(Vu({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:1/0,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:`edge`,liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:px,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:ep,bufferController:V_,capLevelController:G_,errorController:yp,fpsController:Sy,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:ym,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:`linear`},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:`linear`}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},hx()),{},{subtitleStreamController:Zy,subtitleTrackController:Ay,timelineController:Zb,audioStreamController:j_,audioTrackController:I_,emeController:_y,cmcdController:fy,contentSteeringController:my,interstitialsController:Yy});function hx(){return{cueHandler:rx,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:`English`,captionsTextTrack1LanguageCode:`en`,captionsTextTrack2Label:`Spanish`,captionsTextTrack2LanguageCode:`es`,captionsTextTrack3Label:`Unknown CC`,captionsTextTrack3LanguageCode:``,captionsTextTrack4Label:`Unknown CC`,captionsTextTrack4LanguageCode:``,renderTextTracksNatively:!0}}function gx(e,t,n){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw Error(`Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration`);if(t.liveMaxLatencyDurationCount!==void 0&&(t.liveSyncDurationCount===void 0||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw Error(`Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"`);if(t.liveMaxLatencyDuration!==void 0&&(t.liveSyncDuration===void 0||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw Error(`Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"`);let r=_x(e),i=[`manifest`,`level`,`frag`],a=[`TimeOut`,`MaxRetry`,`RetryDelay`,`MaxRetryTimeout`];
vendor: 1,766 bytes, line 42
42return i.forEach(e=>{let i=`${e===`level`?`playlist`:e}LoadPolicy`,o=t[i]===void 0,s=[];a.forEach(n=>{let a=`${e}Loading${n}`,c=t[a];if(c!==void 0&&o){s.push(a);let e=r[i].default;switch(t[i]={default:e},n){case`TimeOut`:e.maxLoadTimeMs=c,e.maxTimeToFirstByteMs=c;break;case`MaxRetry`:e.errorRetry.maxNumRetry=c,e.timeoutRetry.maxNumRetry=c;break;case`RetryDelay`:e.errorRetry.retryDelayMs=c,e.timeoutRetry.retryDelayMs=c;break;case`MaxRetryTimeout`:e.errorRetry.maxRetryDelayMs=c,e.timeoutRetry.maxRetryDelayMs=c;break}}}),s.length&&n.warn(`hls.js config: "${s.join(`", "`)}" setting(s) are deprecated, use "${i}": ${Bf(t[i])}`)}),Vu(Vu({},r),t)}function _x(e){return e&&typeof e==`object`?Array.isArray(e)?e.map(_x):Object.keys(e).reduce((t,n)=>(t[n]=_x(e[n]),t),{}):e}function vx(e,t){let n=e.loader;n!==ox&&n!==px?(t.log(`[config]: Custom loader detected, cannot enable progressive streaming`),e.progressive=!1):ix()&&(e.loader=ox,e.progressive=!0,e.enableSoftwareAES=!0,t.log(`[config]: Progressive streaming enabled, using FetchLoader`))}var yx=2,bx=.1,xx=.05,Sx=100,Cx=class extends Bp{constructor(e,t){super(`gap-controller`,e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var e;(e=this.media)!=null&&e.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{this.hls&&(this.ended=this.media?.currentTime||1,this.hls.trigger(q.MEDIA_ENDED,{stalled:!1}))},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){let{hls:e}=this;
vendor: 6,959 bytes, line 42
42e&&(e.on(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(q.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){let{hls:e}=this;e&&(e.off(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(q.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(Sx),this.mediaSource=t.mediaSource;let n=this.media=t.media;gh(n,`playing`,this.onMediaPlaying),gh(n,`waiting`,this.onMediaWaiting),gh(n,`ended`,this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();let{media:n}=this;n&&(_h(n,`playing`,this.onMediaPlaying),_h(n,`waiting`,this.onMediaWaiting),_h(n,`ended`,this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;let t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){let n=this.hls?.config;if(!n)return;let r=this.media;if(!r)return;let{seeking:i}=r,a=this.seeking&&!i,o=!this.seeking&&i,s=r.paused&&!i||r.ended||r.playbackRate===0;if(this.seeking=i,e!==t){t&&(this.ended=0),this.moved=!0,i||(this.nudgeRetry=0,n.nudgeOnVideoHole&&!s&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(o||a){a&&this.stallResolved(e);return}if(s){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&r.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(q.MEDIA_ENDED,{stalled:!1}));return}if(!Q.getBuffered(r).length){this.nudgeRetry=0;return}let c=Q.bufferInfo(r,e,0),l=c.nextStart||0,u=this.fragmentTracker;if(i&&u&&this.hls){let t=wx(this.hls.inFlightFragments,e),n=c.len>yx,r=!l||t||l-e>yx&&!u.getPartialFragment(e);if(n||r)return;this.moved=!1}let d=this.hls?.latestLevelDetails;if(!this.moved&&this.stalled!==null&&u){if(!(c.len>0)&&!l)return;let t=Math.max(l,c.start||0)-e,n=d!=null&&d.live?d.targetduration*2:yx,i=Ex(e,u);if(t>0&&(t<=n||i)){r.paused||this._trySkipBufferHole(i);return}}let f=n.detectStallWithCurrentTimeMs,p=self.performance.now(),m=this.waiting,h=this.stalled;if(h===null)if(m>0&&p-m<f)h=this.stalled=m;else{this.stalled=p;return}let g=p-h;if(!i&&(g>=f||m)&&this.hls){if(this.mediaSource?.readyState===`ended`&&!(d!=null&&d.live)&&Math.abs(e-(d?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(q.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(c),!this.media||!this.hls)return}let _=Q.bufferInfo(r,e,n.maxBufferHole);this._tryFixBufferStall(_,g,e)}stallResolved(e){let t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){let n=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(n)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(q.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var n;let r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(n=this.buffered.audio)!=null&&n.length&&r&&r.length>1&&e>r.end(0)){let n=Q.bufferedInfo(Q.timeRangesToArray(this.buffered.audio),e,0);if(n.len>1&&t>=n.start){let n=Q.timeRangesToArray(r),i=Q.bufferedInfo(n,t,0).bufferedIndex;if(i>-1&&i<n.length-1){let t=Q.bufferedInfo(n,e,0).bufferedIndex,r=n[i].end,a=n[i+1].start;if((t===-1||t>i)&&a-r<1&&e-r<2){let n=Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${r} -> ${a} buffered index: ${t}`);this.warn(n.message),this.media.currentTime+=1e-6;let i=Ex(e,this.fragmentTracker);i&&`fragment`in i?i=i.fragment:i||=void 0;let o=Q.bufferInfo(this.media,e,0);this.hls.trigger(q.ERROR,{type:G.MEDIA_ERROR,details:K.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:n,reason:n.message,frag:i,buffer:o.len,bufferInfo:o})}}}}}_tryFixBufferStall(e,t,n){let{fragmentTracker:r,media:i}=this,a=this.hls?.config;if(!i||!r||!a)return;let o=this.hls?.latestLevelDetails,s=Ex(n,r);if((s||o!=null&&o.live&&n<o.fragmentStart)&&(this._trySkipBufferHole(s)||!this.media))return;let c=e.buffered,l=this.adjacentTraversal(e,n);(c&&c.length>1&&e.len>a.maxBufferHole||e.nextStart&&(e.nextStart-n<a.maxBufferHole||l))&&(t>a.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn(`Trying to nudge playhead over buffer-hole`),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){let n=this.fragmentTracker,r=e.nextStart;if(n&&r){let e=n.getFragAtPos(t,Y.MAIN),i=n.getFragAtPos(r,Y.MAIN);if(e&&i)return i.sn-e.sn<2}return!1}_reportStall(e){let{hls:t,media:n,stallReported:r,stalled:i}=this;if(!r&&i!==null&&n&&t){this.stallReported=!0;let r=Error(`Playback stalling at @${n.currentTime} due to low buffer (${Bf(e)})`);this.warn(r.message),t.trigger(q.ERROR,{type:G.MEDIA_ERROR,details:K.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len,bufferInfo:e,stalled:{start:i}})}}_trySkipBufferHole(e){let{fragmentTracker:t,media:n}=this,r=this.hls?.config;if(!n||!t||!r)return 0;let i=n.currentTime,a=Q.bufferInfo(n,i,0),o=i<a.start?a.start:a.nextStart;if(o&&this.hls){let c=a.len<=r.maxBufferHole,l=a.len>0&&a.len<1&&n.readyState<3,u=o-i;if(u>0&&(c||l)){if(u>r.maxBufferHole){let n=!1;if(i===0){let e=t.getAppendedFrag(0,Y.MAIN);e&&o<e.end&&(n=!0)}if(!n&&e){var s;if(!((s=this.hls.loadLevelObj)!=null&&s.details)||wx(this.hls.inFlightFragments,o))return 0;let n=!1,r=e.end;for(;r<o;){let e=Ex(r,t);if(e)r+=e.duration;else{n=!0;break}}if(n)return 0}}let c=Math.max(o+xx,i+bx);if(this.warn(`skipping hole, adjusting currentTime from ${i} to ${c}`),this.moved=!0,n.currentTime=c,!(e!=null&&e.gap)){let t=Error(`fragment loaded with buffer holes, seeking from ${i} to ${c}`),n={type:G.MEDIA_ERROR,details:K.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:t,reason:t.message,buffer:a.len,bufferInfo:a};e&&(`fragment`in e?n.part=e:n.frag=e),this.hls.trigger(q.ERROR,n)}return c}}return 0}_tryNudgeBuffer(e){let{hls:t,media:n,nudgeRetry:r}=this,i=t?.config;if(!n||!i)return 0;let a=n.currentTime;if(this.nudgeRetry++,r<i.nudgeMaxRetry){let o=a+(r+1)*i.nudgeOffset,s=Error(`Nudging 'currentTime' from ${a} to ${o}`);this.warn(s.message),n.currentTime=o,t.trigger(q.ERROR,{type:G.MEDIA_ERROR,details:K.BUFFER_NUDGE_ON_STALL,error:s,fatal:!1,buffer:e.len,bufferInfo:e})}else{let n=Error(`Playhead still not moving while enough data buffered @${a} after ${i.nudgeMaxRetry} nudges`);this.error(n.message),t.trigger(q.ERROR,{type:G.MEDIA_ERROR,details:K.BUFFER_STALLED_ERROR,error:n,fatal:!0,buffer:e.len,bufferInfo:e})}}};function wx(e,t){let n=Tx(e.main);if(n&&n.start<=t)return n;let r=Tx(e.audio);return r&&r.start<=t?r:null}function Tx(e){if(!e)return null;switch(e.state){case $.IDLE:case $.STOPPED:case $.ENDED:case $.ERROR:return null}return e.frag}function Ex(e,t){return t.getAppendedFrag(e,Y.MAIN)||t.getPartialFragment(e)}var Dx=.25;function Ox(){if(!(typeof self>`u`))return self.VTTCue||self.TextTrackCue}function kx(e,t,n,r,i){let a=new e(t,n,``);
vendor: 1,066 bytes, line 42
42try{a.value=r,i&&(a.type=i)}catch{a=new e(t,n,Bf(i?Vu({type:i},r):r))}return a}var Ax=(()=>{let e=Ox();try{e&&new e(0,1/0,``)}catch{return Number.MAX_VALUE}return 1/0})(),jx=class{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(q.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){let{hls:e}=this;e&&(e.on(q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(q.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(q.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(q.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){let{hls:e}=this;
vendor: 16,277 bytes, line 42
42e&&(e.off(q.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(q.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(q.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(q.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){this.media=t.media,t.overrides?.cueRemoval===!1&&(this.removeCues=!1)}onMediaAttached(){let e=this.hls?.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&=(this.removeCues&&Ty(this.id3Track,this.onEventCueEnter),null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){let t=this.getID3Track(e.textTracks);return t.mode=`hidden`,t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){let n=e[t];if(n.kind===`metadata`&&n.label===`id3`)return Cy(n,this.media),n}return this.media.addTextTrack(`metadata`,`id3`)}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;let{enableEmsgMetadataCues:n,enableID3MetadataCues:r}=this.hls.config;if(!n&&!r)return;let{samples:i}=t;this.id3Track||=this.createTrack(this.media);let a=Ox();if(a)for(let e=0;e<i.length;e++){let t=i[e].type;if(t===pg.emsg&&!n||!r)continue;let o=lg(i[e].data),s=i[e].pts,c=s+i[e].duration;c>Ax&&(c=Ax),c-s<=0&&(c=s+Dx);for(let e=0;e<o.length;e++){let n=o[e];if(!ug(n)){this.updateId3CueEnds(s,t);let e=kx(a,s,c,n,t);e&&this.id3Track.addCue(e)}}}}updateId3CueEnds(e,t){let n=this.id3Track?.cues;if(n)for(let r=n.length;r--;){let i=n[r];i.type===t&&i.startTime<e&&i.endTime===Ax&&(i.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:n,type:r}){let{id3Track:i,hls:a}=this;if(!a)return;let{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:s}}=a;if(i&&(o||s)){let e;e=r===`audio`?e=>e.type===pg.audioId3&&s:r===`video`?e=>e.type===pg.emsg&&o:e=>e.type===pg.audioId3&&s||e.type===pg.emsg&&o,Ey(i,t,n,e)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;let{assetPlayerId:n,timelineOffset:r,enableDateRangeMetadataCues:i,interstitialsController:a}=this.hls.config;if(!i)return;let o=Ox();if(n&&r&&!a){let{fragmentStart:t,fragmentEnd:r}=e,i=this.assetCue;i?(i.startTime=t,i.endTime=r):o&&(i=this.assetCue=kx(o,t,r,{assetPlayerId:this.hls.config.assetPlayerId},`hlsjs.interstitial.asset`),i&&(i.id=n,this.id3Track||=this.createTrack(this.media),this.id3Track.addCue(i),i.addEventListener(`enter`,this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;let{id3Track:s}=this,{dateRanges:c}=e,l=Object.keys(c),u=this.dateRangeCuesAppended;if(s&&t){var d;if((d=s.cues)!=null&&d.length){let e=Object.keys(u).filter(e=>!l.includes(e));for(let t=e.length;t--;){let n=e[t],r=u[n]?.cues;delete u[n],r&&Object.keys(r).forEach(e=>{let t=r[e];if(t){t.removeEventListener(`enter`,this.onEventCueEnter);try{s.removeCue(t)}catch{}}})}}else u=this.dateRangeCuesAppended={}}let f=e.fragments[e.fragments.length-1];if(!(l.length===0||!W(f?.programDateTime))){this.id3Track||=this.createTrack(this.media);for(let e=0;e<l.length;e++){let t=l[e],n=c[t],r=n.startTime,i=u[t],s=i?.cues||{},d=i?.durationKnown||!1,f=Ax,{duration:p,endDate:m}=n;if(m&&p!==null)f=r+p,d=!0;else if(n.endOnNext&&!d){let e=l.reduce((e,t)=>{if(t!==n.id){let r=c[t];if(r.class===n.class&&r.startDate>n.startDate&&(!e||n.startDate<e.startDate))return r}return e},null);e&&(f=e.startTime,d=!0)}let h=Object.keys(n.attr);for(let e=0;e<h.length;e++){let c=h[e];if(!$p(c))continue;let l=s[c];if(l)d&&!(i!=null&&i.durationKnown)?l.endTime=f:Math.abs(l.startTime-r)>.01&&(l.startTime=r,l.endTime=f);else if(o){let e=n.attr[c];em(c)&&(e=id(e));let i=kx(o,r,f,{key:c,data:e},pg.dateRange);i&&(i.id=t,this.id3Track.addCue(i),s[c]=i,a&&(c===`X-ASSET-LIST`||c===`X-ASSET-URL`)&&i.addEventListener(`enter`,this.onEventCueEnter))}}u[t]={cues:s,dateRange:n,durationKnown:d}}}}},Mx=class{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{let{media:e}=this,t=this.levelDetails;if(!e||!t)return;this.currentTime=e.currentTime;let n=this.computeLatency();if(n===null)return;this._latency=n;let{lowLatencyMode:r,maxLiveSyncPlaybackRate:i}=this.config;if(!r||i===1||!t.live)return;let a=this.targetLatency;if(a===null)return;let o=n-a;if(o<Math.min(this.maxLatency,a+t.targetduration)&&o>.05&&this.forwardBufferLength>1){let t=Math.min(2,Math.max(1,i)),n=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20,r=Math.min(t,Math.max(1,n));this.changeMediaPlaybackRate(e,r)}else e.playbackRate!==1&&e.playbackRate!==0&&this.changeMediaPlaybackRate(e,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){return this.hls?.latestLevelDetails||null}get latency(){return this._latency||0}get maxLatency(){let{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;let t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){let e=this.levelDetails;if(e===null||this.hls===null)return null;let{holdBack:t,partHoldBack:n,targetduration:r}=e,{liveSyncDuration:i,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,s=this.hls.userConfig,c=o&&n||t;(this._targetLatencyUpdated||s.liveSyncDuration||s.liveSyncDurationCount||c===0)&&(c=i===void 0?a*r:i);let l=r;return c+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,l)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){let e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;let n=this.levelDetails;if(n===null)return null;let r=n.edge,i=e-t-this.edgeStalled,a=r-n.totalduration,o=r-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(a,i),o)}get drift(){let e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){let e=this.levelDetails;if(e===null)return 0;let t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){let{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;let n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){let{hls:e}=this;e&&(e.on(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(q.ERROR,this.onError,this))}unregisterListeners(){let{hls:e}=this;e&&(e.off(q.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(q.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(q.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener(`timeupdate`,this.onTimeupdate)}onMediaDetaching(){this.media&&=(this.media.removeEventListener(`timeupdate`,this.onTimeupdate),null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener(`timeupdate`,this.onTimeupdate)}onError(e,t){var n;t.details===K.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(n=this.levelDetails)!=null&&n.live&&this.hls.logger.warn(`[latency-controller]: Stall detected, adjusting target latency`))}changeMediaPlaybackRate(e,t){var n;e.playbackRate!==t&&((n=this.hls)==null||n.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${this.targetLatency?.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){let e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){let e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}},Nx=class extends M_{constructor(e,t){super(e,`level-controller`),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){let{hls:e}=this;e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(q.LEVEL_LOADED,this.onLevelLoaded,this),e.on(q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(q.FRAG_BUFFERED,this.onFragBuffered,this),e.on(q.ERROR,this.onError,this)}_unregisterListeners(){let{hls:e}=this;e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(q.LEVEL_LOADED,this.onLevelLoaded,this),e.off(q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(q.FRAG_BUFFERED,this.onFragBuffered,this),e.off(q.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(e=>{e.loadError=0,e.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){let n=this.hls.config.preferManagedMediaSource,r=[],i={},a={},o=!1,s=!1,c=!1;t.levels.forEach(e=>{let t=e.attrs,{audioCodec:l,videoCodec:u}=e;l&&(e.audioCodec=l=lf(l,n)||void 0),u&&=e.videoCodec=pf(u);let{width:d,height:f,unknownCodecs:p}=e,m=p?.length||0;if(o||=!!(d&&f),s||=!!u,c||=!!l,m||l&&!this.isAudioSupported(l)||u&&!this.isVideoSupported(u)){this.log(`Some or all CODECS not supported "${t.CODECS}"`);return}let{CODECS:h,"FRAME-RATE":g,"HDCP-LEVEL":_,"PATHWAY-ID":v,RESOLUTION:y,"VIDEO-RANGE":b}=t,x=`${`${v||`.`}-`}${e.bitrate}-${y}-${g}-${h}-${b}-${_}`;if(!i[x]){let t=this.createLevel(e);i[x]=t,a[x]=1,r.push(t)}else if(i[x].uri!==e.url&&!e.attrs[`PATHWAY-ID`]){let t=a[x]+=1;e.attrs[`PATHWAY-ID`]=Array(t+1).join(`.`);let n=this.createLevel(e);i[x]=n,r.push(n)}else i[x].addGroupId(`audio`,t.AUDIO),i[x].addGroupId(`text`,t.SUBTITLES)}),this.filterAndSortMediaOptions(r,t,o,s,c)}createLevel(e){let t=new Ff(e),n=e.supplemental;if(n!=null&&n.videoCodec&&!this.isVideoSupported(n.videoCodec)){let e=Error(`SUPPLEMENTAL-CODECS not supported "${n.videoCodec}"`);this.log(e.message),t.supportedResult=bf(e,[])}return t}isAudioSupported(e){return ef(e,`audio`,this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return ef(e,`video`,this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,n,r,i){let a=[],o=[],s=e,c=t.stats?.parsing||{};if((n||r)&&i&&(s=s.filter(({videoCodec:e,videoRange:t,width:n,height:r})=>(!!e||!!(n&&r))&&jf(t))),s.length===0){Promise.resolve().then(()=>{if(this.hls){let e=`no level with compatible codecs found in manifest`,n=e;t.levels.length&&(n=`one or more CODECS in variant not supported: ${Bf(t.levels.map(e=>e.attrs.CODECS).filter((e,t,n)=>n.indexOf(e)===t))}`,this.warn(n),e+=` (${n})`);let r=Error(e);this.hls.trigger(q.ERROR,{type:G.MEDIA_ERROR,details:K.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:r,reason:n})}}),c.end=performance.now();return}t.audioTracks&&(a=t.audioTracks.filter(e=>!e.audioCodec||this.isAudioSupported(e.audioCodec)),Px(a)),t.subtitles&&(o=t.subtitles,Px(o));let l=s.slice(0);s.sort((e,t)=>{if(e.attrs[`HDCP-LEVEL`]!==t.attrs[`HDCP-LEVEL`])return(e.attrs[`HDCP-LEVEL`]||``)>(t.attrs[`HDCP-LEVEL`]||``)?1:-1;if(n&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return Af.indexOf(e.videoRange)-Af.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){let n=rf(e.videoCodec),r=rf(t.videoCodec);if(n!==r)return r-n}if(e.uri===t.uri&&e.codecSet!==t.codecSet){let n=af(e.codecSet),r=af(t.codecSet);if(n!==r)return r-n}return e.averageBitrate===t.averageBitrate?0:e.averageBitrate-t.averageBitrate});let u=l[0];if(this.steering&&(s=this.steering.filterParsedLevels(s),s.length!==l.length)){for(let e=0;e<l.length;e++)if(l[e].pathwayId===s[0].pathwayId){u=l[e];break}}this._levels=s;for(let e=0;e<s.length;e++)if(s[e]===u){this._firstLevel=e;let t=u.bitrate,n=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${s.length} level(s) found, first bitrate: ${t}`),this.hls.userConfig?.abrEwmaDefaultEstimate===void 0){let e=Math.min(t,this.hls.config.abrEwmaDefaultEstimateMax);e>n&&n===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}let d=i&&!r,f=this.hls.config,p=!!(f.audioStreamController&&f.audioTrackController),m={levels:s,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:i,video:r,altAudio:p&&!d&&a.some(e=>!!e.url)};c.end=performance.now(),this.hls.trigger(q.MANIFEST_PARSED,m)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){let t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){let n=Error(`invalid level idx`),r=e<0;if(this.hls.trigger(q.ERROR,{type:G.OTHER_ERROR,details:K.LEVEL_SWITCH_ERROR,level:e,fatal:r,error:n,reason:n.message}),r)return;e=Math.min(e,t.length-1)}let n=this.currentLevelIndex,r=this.currentLevel,i=r?r.attrs[`PATHWAY-ID`]:void 0,a=t[e],o=a.attrs[`PATHWAY-ID`];if(this.currentLevelIndex=e,this.currentLevel=a,n===e&&r&&i===o)return;this.log(`Switching to level ${e} (${a.height?a.height+`p `:``}${a.videoRange?a.videoRange+` `:``}${a.codecSet?a.codecSet+` `:``}@${a.bitrate})${o?` with Pathway `+o:``} from level ${n}${i?` with Pathway `+i:``}`);let s={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(q.LEVEL_SWITCHING,s);let c=a.details;if(!c||c.live){let e=this.switchParams(a.uri,r?.details,c);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){let e=this.hls.config.startLevel;return e===void 0?this.hls.firstAutoLevel:e}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){let t=this.steering.pathways(),n=e.filter(e=>t.indexOf(e)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=n}}onError(e,t){t.fatal||!t.context||t.context.type===J.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===Y.MAIN){let e=t.elementaryStreams;if(!Object.keys(e).some(t=>!!e[t]))return;let n=this._levels[t.level];n!=null&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var n;let{level:r,details:i}=t,a=t.levelInfo;if(!a){var o;this.warn(`Invalid level index ${r}`),(o=t.deliveryDirectives)!=null&&o.skip&&(i.deltaUpdateFailed=!0);return}if(a===this.currentLevel||t.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let e=a.details;e===t.details&&e.advanced&&(e=void 0),this.playlistLoaded(r,t,e)}else (n=t.deliveryDirectives)!=null&&n.skip&&(i.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLo
vendor: 4,357 bytes, line 42
42ading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let n=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,i=e.attrs[`PATHWAY-ID`],a=e.details,o=a?.age;this.log(`Loading level index ${r}${t?.msn===void 0?``:` at sn `+t.msn+` part `+t.part}${i?` Pathway `+i:``}${o&&a.live?` age `+o.toFixed(1)+(a.type&&` `+a.type||``):``} ${n}`),this.hls.trigger(q.LEVEL_LOADING,{url:n,level:r,levelInfo:e,pathwayId:e.attrs[`PATHWAY-ID`],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex===-1?this.hls.nextAutoLevel:this.manualLevelIndex}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;let n=this._levels.filter((t,n)=>n===e?(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach(e=>e.level=-1)),!1):!0);oh(n),this._levels=n,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);let r=n.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&=Math.min(this._startLevel,r),this.hls.trigger(q.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){let{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(q.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}};function Px(e){let t={};e.forEach(e=>{let n=e.groupId||``;e.id=t[n]=t[n]||0,t[n]++})}function Fx(){return self.SourceBuffer||self.WebKitSourceBuffer}function Ix(){if(!$u())return!1;let e=Fx();return!e||e.prototype&&typeof e.prototype.appendBuffer==`function`&&typeof e.prototype.remove==`function`}function Lx(){if(!Ix())return!1;let e=$u();return typeof e?.isTypeSupported==`function`&&([`avc1.42E01E,mp4a.40.2`,`av01.0.01M.08`,`vp09.00.50.08`].some(t=>e.isTypeSupported(nf(t,`video`)))||[`mp4a.40.2`,`fLaC`].some(t=>e.isTypeSupported(nf(t,`audio`))))}function Rx(){var e;let t=Fx();return typeof(t==null||(e=t.prototype)==null?void 0:e.changeType)==`function`}var zx=100,Bx=class extends yh{constructor(e,t,n){super(e,t,n,`stream-controller`,Y.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{let e=this.media,t=e?e.currentTime:null;if(t===null||!W(t)||(this.log(`Media seeked to ${t.toFixed(3)}`),!this.getBufferedFrag(t)))return;let n=this.getFwdBufferInfoAtPos(e,t,Y.MAIN,0);if(n===null||n.len===0){this.warn(`Main forward buffer length at ${t} on "seeked" event ${n?n.len:`empty`})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(q.MANIFEST_PARSED,this.onManifestParsed,this),e.on(q.LEVEL_LOADING,this.onLevelLoading,this),e.on(q.LEVEL_LOADED,this.onLevelLoaded,this),e.on(q.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(q.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(q.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(q.BUFFER_CREATED,this.onBufferCreated,this),e.on(q.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(q.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();let{hls:e}=this;e.off(q.MANIFEST_PARSED,this.onManifestParsed,this),e.off(q.LEVEL_LOADED,this.onLevelLoaded,this),e.off(q.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(q.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(q.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(q.BUFFER_CREATED,this.onBufferCreated,this),e.off(q.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(q.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(q.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}
vendor: 27,952 bytes, line 42
42startLoad(e,t){if(this.levels){let{lastCurrentTime:n,hls:r}=this;if(this.stopLoad(),this.setInterval(zx),this.level=-1,!this.startFragRequested){let e=r.startLevel;e===-1&&(r.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=r.firstAutoLevel),r.nextLoadLevel=e,this.level=r.loadLevel,this._hasEnoughToStart=!!t}n>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n),this.state=$.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=$.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case $.WAITING_LEVEL:{let{levels:e,level:t}=this,n=e?.[t],r=n?.details;if(r&&(!r.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(r))break;this.state=$.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=$.IDLE;break}break}case $.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===$.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){let{hls:e,levelLastLoaded:t,levels:n,media:r}=this;if(t===null||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;let i=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(n!=null&&n[i]))return;let a=n[i],o=this.getMainFwdBufferInfo();if(o===null)return;let s=this.getLevelDetails();if(s&&this._streamEnded(o,s)){let e={};this.altAudio===2&&(e.type=`video`),this.hls.trigger(q.BUFFER_EOS,e),this.state=$.ENDED;return}if(!this.buffering)return;e.loadLevel!==i&&e.manualLevel===-1&&this.log(`Adapting to level ${i} from level ${this.level}`),this.level=e.nextLoadLevel=i;let c=a.details;if(!c||this.state===$.WAITING_LEVEL||this.waitForLive(a)){this.level=i,this.state=$.WAITING_LEVEL,this.startFragRequested=!1;return}let l=o.len,u=this.getMaxBufferLength(a.maxBitrate);if(l>=u)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);let d=this.backtrackFragment?this.backtrackFragment.start:o.end,f=this.getNextFragment(d,c);if(this.couldBacktrack&&!this.fragPrevious&&f&&pd(f)&&this.fragmentTracker.getState(f)!==xp.OK){let e=(this.backtrackFragment??f).sn-c.startSN,t=c.fragments[e-1];t&&f.cc===t.cc&&(f=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,d)){if(!f.gap){let e=this.audioOnly&&!this.altAudio?dd.AUDIO:dd.VIDEO,t=(e===dd.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,Y.MAIN)}f=this.getNextFragmentLoopLoading(f,c,o,Y.MAIN,u)}f&&(this.exceedsMaxBuffer(o,u,f)||(f.initSegment&&!f.initSegment.data&&!this.bitrateTest&&(f=f.initSegment),this.loadFragment(f,a,d)))}loadFragment(e,t,n){let r=this.fragmentTracker.getState(e);r===xp.NOT_LOADED||r===xp.PARTIAL?pd(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,n):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Y.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,1/0),this.altAudio!==0&&(this.getLevelDetails()?.fragmentStart||0)>this.lastCurrentTime&&super.flushMainBuffer(0,1/0,`audio`)}nextLevelSwitch(){let{levels:e,media:t}=this;if(t!=null&&t.readyState){let n,r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);let i=this.getLevelDetails();if(i!=null&&i.live){let e=this.getMainFwdBufferInfo();if(!e||e.len<i.targetduration*2)return}if(!t.paused&&e){let t=e[this.hls.nextLoadLevel],r=this.fragLastKbps;n=r&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*r)+1:0}else n=0;let a=this.getBufferedFrag(t.currentTime+n);if(a){let e=this.followingBufferedFrag(a);if(e){this.abortCurrentFrag();let t=e.maxStartPTS?e.maxStartPTS:e.start,n=e.duration,r=Math.max(a.end,t+Math.min(Math.max(n-this.config.maxFragLookUpTolerance,n*(this.couldBacktrack?.5:.125)),n*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(r,1/0)}}}}abortCurrentFrag(){let e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case $.KEY_LOADING:case $.FRAG_LOADING:case $.FRAG_LOADING_WAITING_RETRY:case $.PARSING:case $.PARSED:this.state=$.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?`video`:null)}onMediaAttached(e,t){super.onMediaAttached(e,t);let n=t.media;gh(n,`playing`,this.onMediaPlaying),gh(n,`seeked`,this.onMediaSeeked)}onMediaDetaching(e,t){let{media:n}=this;n&&(_h(n,`playing`,this.onMediaPlaying),_h(n,`seeked`,this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log(`Trigger BUFFER_RESET`),this.hls.trigger(q.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let n=!1,r=!1;for(let e=0;e<t.levels.length;e++){let i=t.levels[e].audioCodec;i&&(n||=i.indexOf(`mp4a.40.2`)!==-1,r||=i.indexOf(`mp4a.40.5`)!==-1)}this.audioCodecSwitch=n&&r&&!Rx(),this.audioCodecSwitch&&this.log(`Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC`),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){let{levels:n}=this;if(!n||this.state!==$.IDLE)return;let r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=$.WAITING_LEVEL)}onLevelLoaded(e,t){var n;let{levels:r,startFragRequested:i}=this,a=t.level,o=t.details,s=o.totalduration;if(!r){this.warn(`Levels were reset while loading level ${a}`);return}this.log(`Level ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:``}, cc [${o.startCC}, ${o.endCC}] duration:${s}`);let c=t.levelInfo,l=this.fragCurrent;l&&(this.state===$.FRAG_LOADING||this.state===$.FRAG_LOADING_WAITING_RETRY)&&l.level!==t.level&&l.loader&&this.abortCurrentFrag();let u=0;if(o.live||(n=c.details)!=null&&n.live){if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;u=this.alignPlaylists(o,c.details,this.levelLastLoaded?.details)}if(c.details=o,this.levelLastLoaded=c,i||this.setStartPosition(o,u),this.hls.trigger(q.LEVEL_UPDATED,{details:o,level:a}),this.state===$.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=$.IDLE}i&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){let{config:t,media:n}=this;if(!n)return;let r=this.hls.liveSyncPosition,i=this.getLoadPosition(),a=e.fragmentStart,o=e.edge,s=i>=a-t.maxFragLookUpTolerance&&i<=o;if(r!==null&&n.duration>r&&(i<r||!s)){let a=t.liveMaxLatencyDuration===void 0?t.liveMaxLatencyDurationCount*e.targetduration:t.liveMaxLatencyDuration;if((!s&&n.readyState<4||i<o-a)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),n.readyState))if(this.warn(`Playback: ${i.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${r.toFixed(3)}`),this.config.liveSyncMode===`buffered`){var c;let e=Q.bufferInfo(n,r,0);if(!((c=e.buffered)!=null&&c.length)){n.currentTime=r;return}if(e.start<=i){n.currentTime=r;return}let{nextStart:t}=Q.bufferedInfo(e.buffered,i,0);t&&(n.currentTime=t)}else n.currentTime=r}}_handleFragmentLoadProgress(e){let t=e.frag,{part:n,payload:r}=e,{levels:i}=this;if(!i){this.warn(`Levels were reset while fragment load was in progress. Fragment ${t.sn} of level ${t.level} will not be buffered`);return}let a=i[t.level];if(!a){this.warn(`Level ${t.level} not found on progress`);return}let o=a.details;if(!o){this.warn(`Dropping fragment ${t.sn} of level ${t.level} after level details were reset`),this.fragmentTracker.removeFragment(t);return}let s=a.videoCodec,c=o.PTSKnown||!o.live,l=t.initSegment?.data,u=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new k_(this.hls,Y.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=n?n.index:-1,p=f!==-1,m=new Vp(t.level,t.sn,t.stats.chunkCount,r.byteLength,f,p),h=this.initPTS[t.cc];d.push(r,l,u,s,t,n,o.totalduration,c,m,h)}onAudioTrackSwitching(e,t){let n=this.hls,r=this.altAudio!==0;if($f(t.url,n))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log(`Switching on main audio, use media.buffered to schedule main fragment loading`),this.mediaBuffer=this.media;let e=this.fragCurrent;e&&(this.log(`Switching to main audio track, cancel main fragment load`),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(r){this.altAudio=0,this.fragmentTracker.removeAllFragments(),n.once(q.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(q.AUDIO_TRACK_SWITCHED,t)}),n.trigger(q.BUFFER_FLUSHING,{startOffset:0,endOffset:1/0,type:null});return}n.trigger(q.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){let n=$f(t.url,this.hls);if(n){let e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log(`Switching on alternate audio, use video.buffered to schedule main fragment loading`),this.mediaBuffer=e)}this.altAudio=n?2:0,this.tick()}onBufferCreated(e,t){let n=t.tracks,r,i,a=!1;for(let e in n){let t=n[e];if(t.id===`main`){if(i=e,r=t,e===`video`){let t=n[e];t&&(this.videoBuffer=t.buffer)}}else a=!0}a&&r?(this.log(`Alternate track found, use ${i}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){let{frag:n,part:r}=t,i=n.type===Y.MAIN;if(i){if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${r?` p: `+r.index:``} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===$.PARSED&&(this.state=$.IDLE);return}let e=r?r.stats:n.stats;this.fragLastKbps=Math.round(8*e.total/(e.buffering.end-e.loading.first)),pd(n)&&(this.fragPrevious=n),this.fragBufferedComplete(n,r)}let a=this.media;a&&(!this._hasEnoughToStart&&Q.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),i&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){if(t.fatal){this.state=$.ERROR;return}switch(t.details){case K.FRAG_GAP:case K.FRAG_PARSING_ERROR:case K.FRAG_DECRYPT_ERROR:case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Y.MAIN,t);break;case K.LEVEL_LOAD_ERROR:case K.LEVEL_LOAD_TIMEOUT:case K.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===$.WAITING_LEVEL&&t.context?.type===J.LEVEL&&(this.state=$.IDLE);break;case K.BUFFER_ADD_CODEC_ERROR:case K.BUFFER_APPEND_ERROR:if(t.parent!==`main`)return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case K.BUFFER_FULL_ERROR:if(t.parent!==`main`)return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,1/0));break;case K.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=$.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==dd.AUDIO||!this.altAudio){let e=(t===dd.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;e&&(this.afterBufferFlushed(e,t,Y.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){let{media:e}=this;if(!e)return;let t=e.currentTime,n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}let r=this.timelineOffset;r&&n&&(n+=r);let i=this.getLevelDetails(),a=Q.getBuffered(e),o=a.length?a.start(0):0,s=o-n,c=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||s>0&&(s<c||this.loadingParts&&s<2*(i?.partTarget||0)))&&(this.log(`adjusting start position by ${s} to match buffer start`),n+=s,this.startPosition=n),t<n&&(this.log(`seek to target start position ${n} from current time ${t} buffer start ${o}`),e.currentTime=n)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log(`Swapping audio codec`),t=t.indexOf(`mp4a.40.5`)===-1?`mp4a.40.5`:`mp4a.40.2`),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(e=>{let{hls:n}=this,r=e?.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=$.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;let i=r.stats;i.parsing.start=i.parsing.end=i.buffering.start=i.buffering.end=self.performance.now(),n.trigger(q.FRAG_LOADED,e),r.bitrateTest=!1}).catch(t=>{this.state===$.STOPPED||this.state===$.ERROR||(this.warn(t),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){let t=this.playlistType,{hls:n}=this,{remuxResult:r,chunkMeta:i}=e,a=this.getCurrentContext(i);if(!a){this.resetWhenMissingContext(i);return}let{frag:o,part:s,level:c}=a,{video:l,text:u,id3:d,initSegment:f}=r,{details:p}=c,m=this.altAudio?void 0:r.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=$.PARSING,f){let e=f.tracks;if(e){let r=o.initSegment||o;if(this.unhandledEncryptionError(f,o))return;this._bufferInitSegment(c,e,r,i),n.trigger(q.FRAG_PARSING_INIT_SEGMENT,{frag:r,id:t,tracks:e})}let r=f.initPTS,a=f.timescale,s=this.initPTS[o.cc];if(W(r)&&(!s||s.baseTime!==r||s.timescale!==a)){let e=f.trackId;this.initPTS[o.cc]={baseTime:r,timescale:a,trackId:e},n.trigger(q.INIT_PTS_FOUND,{frag:o,id:t,initPTS:r,timescale:a,trackId:e})}}if(l&&p){m&&l.type===`audiovideo`&&this.logMuxedErr(o);let e=p.fragments[o.sn-1-p.startSN],t=o.sn===p.startSN,n=!e||o.cc>e.cc;if(r.independent!==!1){let{startPTS:e,endPTS:r,startDTS:a,endDTS:c}=l;if(s)s.elementaryStreams[l.type]={startPTS:e,endPTS:r,startDTS:a,endDTS:c};else if(l.firstKeyFrame&&l.independent&&i.id===1&&!n&&(this.couldBacktrack=!0),l.dropped&&l.independent){let i=this.getMainFwdBufferInfo(),a=(i?i.end:this.getLoadPosition())+this.config.maxBufferHole,s=l.firstKeyFramePTS?l.firstKeyFramePTS:e;if(!t&&a<s-this.config.maxBufferHole&&!n){this.backtrack(o);return}else n&&(o.gap=!0);o.setElementaryStreamInfo(l.type,o.start,r,o.start,c,!0)}else t&&e-(p.appliedTimelineOffset||0)>yx&&(o.gap=!0);o.setElementaryStreamInfo(l.type,e,r,a,c),this.backtrackFragment&&=o,this.bufferFragmentData(l,o,s,i,t||n)}else if(t||n)o.gap=!0;else{this.backtrack(o);return}}if(m){let{startPTS:e,endPTS:t,startDTS:n,endDTS:r}=m;s&&(s.elementaryStreams[dd.AUDIO]={startPTS:e,endPTS:t,startDTS:n,endDTS:r}),o.setElementaryStreamInfo(dd.AUDIO,e,t,n,r),this.bufferFragmentData(m,o,s,i)}if(p&&d!=null&&d.samples.length){let e={id:t,frag:o,details:p,samples:d.samples};n.trigger(q.FRAG_PARSING_METADATA,e)}if(p&&u){let e={id:t,frag:o,details:p,samples:u.samples};n.trigger(q.FRAG_PARSING_USERDATA,e)}}logMuxedErr(e){this.warn(`${pd(e)?`Media`:`Init`} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,n,r){if(this.state!==$.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(n));let{audio:i,video:a,audiovideo:o}=t;if(i){let n=e.audioCodec,r=df(i.codec,n);r===`mp4a`&&(r=`mp4a.40.5`);let a=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){r&&=r.indexOf(`mp4a.40.5`)===-1?`mp4a.40.5`:`mp4a.40.2`;let e=i.metadata;e&&`channelCount`in e&&(e.channelCount||1)!==1&&a.indexOf(`firefox`)===-1&&(r=`mp4a.40.5`)}r&&r.indexOf(`mp4a.40.5`)!==-1&&a.indexOf(`android`)!==-1&&i.container!==`audio/mpeg`&&(r=`mp4a.40.2`,this.log(`Android: force audio codec to ${r}`)),n&&n!==r&&this.log(`Swapping manifest audio codec "${n}" for "${r}"`),i.levelCodec=r,i.id=Y.MAIN,this.log(`Init audio buffer, container:${i.container}, codecs[selected/level/parsed]=[${r||``}/${n||``}/${i.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=Y.MAIN;let n=a.codec;if(n?.length===4)switch(n){case`hvc1`:case`hev1`:a.codec=`hvc1.1.6.L120.90`;break;case`av01`:a.codec=`av01.0.04M.08`;break;case`avc1`:a.codec=`avc1.42e01e`;break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||``}/${n}]${a.codec===n?``:` parsed-corrected=`+a.codec}${a.supplemental?` supplemental=`+a.supplemental:``}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);let s=Object.keys(t);if(s.length){if(this.hls.trigger(q.BUFFER_CODECS,t),!this.hls)return;s.forEach(e=>{let i=t[e].initSegment;i!=null&&i.byteLength&&this.hls.trigger(q.BUFFER_APPENDING,{type:e,data:i,frag:n,part:null,chunkMeta:r,parent:n.type})})}this.tickImmediate()}getMainFwdBufferInfo(){let e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,Y.MAIN)}get maxBufferLength(){let{levels:e,level:t}=this,n=e?.[t];return n?this.getMaxBufferLength(n.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=$.IDLE}checkFragmentChanged(){let e=this.media,t=null;if(e&&e.readyState>1&&e.seeking===!1){let n=e.currentTime;if(Q.isBuffered(e,n)?t=this.getAppendedFrag(n):Q.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;let e=this.fragPlaying,n=t.level;(!e||t.sn!==e.sn||e.level!==n)&&(this.fragPlaying=t,this.hls.trigger(q.FRAG_CHANGED,{frag:t}),(!e||e.level!==n)&&this.hls.trigger(q.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){let e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){if(this.fragPlaying)return this.fragPlaying;let e=this.media?.currentTime||this.lastCurrentTime;return W(e)?this.getAppendedFrag(e):null}get currentProgramDateTime(){let e=this.media?.currentTime||this.lastCurrentTime;if(W(e)){let t=this.getLevelDetails(),n=this.currentFrag||(t?rp(null,t.fragments,e):null);if(n){let t=n.programDateTime;if(t!==null){let r=t+(e-n.start)*1e3;return new Date(r)}}}return null}get currentLevel(){let e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){let e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}},Vx=class extends Wu{constructor(e,t){super(`key-loader`,t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(let t in this.keyIdToKeyInfo){let n=this.keyIdToKeyInfo[t].loader;if(n){if(e&&e!==n.context?.frag.type)return;n.abort()}}}detach(){for(let e in this.keyIdToKeyInfo){let t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(let e in this.keyIdToKeyInfo){let t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=K.KEY_LOAD_ERROR,n,r,i){return new zp({type:G.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:i,error:n,networkDetails:r})}loadClear(e,t,n){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let r=0,i=t.length;r<i;r++){let a=t[r];if(e.cc<=a.cc&&(!pd(e)||!pd(a)||e.sn<a.sn)||!n&&r==i-1)return this.emeController.selectKeySystemFormat(a).then(e=>{if(!this.emeController)return;a.setKeyFormat(e);let t=gm(e);if(t)return this.emeController.getKeySystemAccess([t])})}if(this.config.requireKeySystemAccessOnStart){let e=vm(this.config);if(e.length)return this.emeController.getKeySystemAccess(e)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var n,r;t&&e.setKeyFormat(t);let i=e.decryptdata;if(!i){let n=Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,K.KEY_LOAD_ERROR,n))}let a=i.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,K.KEY_LOAD_ERROR,Error(`Invalid key URI: "${a}"`)));let o=Hx(i),s=this.keyIdToKeyInfo[o];if((n=s)!=null&&n.decryptdata.key)return i.key=s.decryptdata.key,Promise.resolve({frag:e,keyInfo:s});if(this.emeController&&(r=s)!=null&&r.keyLoadPromise)switch(this.emeController.getKeyStatus(s.decryptdata)){case`usable`:case`usable-in-future`:return s.keyLoadPromise.then(t=>{let{keyInfo:n}=t;return i.key=n.decryptdata.key,{frag:e,keyInfo:n}})}switch(this.log(`${this.keyIdToKeyInfo[o]?`Rel`:`L`}oading${i.keyId?` keyId: `+rd(i.keyId):``} URI: ${i.uri} from ${e.type} ${e.level}`),s=this.keyIdToKeyInfo[o]={decryptdata:i,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},i.method){case`SAMPLE-AES`:case`SAMPLE-AES-CENC`:case`SAMPLE-AES-CTR`:return i.keyFormat===`identity`?this.loadKeyHTTP(s,e):this.loadKeyEME(s,e);case`AES-128`:case`AES-256`:case`AES-256-CTR`:return this.loadKeyHTTP(s,e);default:return Promise.reject(this.createKeyLoadError(e,K.KEY_LOAD_ERROR,Error(`Key supplied with unsupported METHOD: "${i.method}"`)))}}loadKeyEME(e,t){let n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r;if(!e.decryptdata.keyId&&(r=t.initSegment)!=null&&r.data){let n=Fd(t.initSegment.data);if(n.length){let t=n[0];t.some(e=>e!==0)?(this.log(`Using keyId found in init segment ${rd(t)}`),Tm.setKeyIdForUri(e.decryptdata.uri,t)):(t=Tm.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${rd(t)}`)),e.decryptdata.keyId=t}}return!e.decryptdata.keyId&&!pd(t)?Promise.resolve(n):(e.keyLoadPromise=this.emeController.loadKey(n).then(t=>(e.mediaKeySessionContext=t,n))).catch(n=>{throw e.keyLoadPromise=null,`data`in n&&(n.data.frag=t),n})}return Promise.resolve(n)}loadKeyHTTP(e,t){let n=this.config,r=n.loader,i=new r(n);return t.keyLoader=e.loader=i,e.keyLoadPromise=new Promise((r,a)=>{let o={keyInfo:e,frag:t,responseType:`arraybuffer`,url:e.decryptdata.uri},s=n.keyLoadPolicy.default,c={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};i.load(o,c,{onSuccess:(e,t,n,i)=>{let{frag:o,keyInfo:s}=n,c=Hx(s.decryptdata);if(!o.decryptdata||s!==this.keyIdToKeyInfo[c])return a(this.createKeyLoadError(o,K.KEY_LOAD_ERROR,Error(`after key load, decryptdata unset or changed`),i));s.decryptdata.key=o.decryptdata.key=new Uint8Array(e.data),o.keyLoader=null,s.loader=null,r({frag:o,keyInfo:s})},onError:(e,n,r,i)=>{this.resetLoader(n),a(this.createKeyLoadError(t,K.KEY_LOAD_ERROR,Error(`HTTP Error ${e.code} loading key ${e.text}`),r,Vu({url:o.url,data:void 0},e)))},onTimeout:(e,n,r)=>{this.resetLoader(n),a(this.createKeyLoadError(t,K.KEY_LOAD_TIMEOUT,Error(`key loading timed out`),r))},onAbort:(e,n,r)=>{this.resetLoader(n),a(this.createKeyLoadError(t,K.INTERNAL_ABORTED,Error(`key loading aborted`),r))}})})}resetLoader(e){let{frag:t,keyInfo:n,url:r}=e,i=n.loader;t.keyLoader===i&&(t.keyLoader=null,n.loader=null);let a=Hx(n.decryptdata)||r;delete this.keyIdToKeyInfo[a],i&&i.destroy()}};function Hx(e){if(e.keyFormat!==hm.FAIRPLAY){let t=e.keyId;if(t)return rd(t)}return e.uri}function Ux(e){let{type:t}=e;switch(t){case J.AUDIO_TRACK:return Y.AUDIO;case J.SUBTITLE_TRACK:return Y.SUBTITLE;default:return Y.MAIN}}function Wx(e,t){let n=e.url;return(n===void 0||n.indexOf(`data:`)===0)&&(n=t.url),n}var Gx=class{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){let{hls:e}=this;e.on(q.MANIFEST_LOADING,this.onManifestLoading,this),e.on(q.LEVEL_LOADING,this.onLevelLoading,this),e.on(q.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(q.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(q.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){let{hls:e}=this;e.off(q.MANIFEST_LOADING,this.onManifestLoading,this),e.off(q.LEVEL_LOADING,this.onLevelLoading,this),e.off(q.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(q.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(q.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){let t=this.hls.config,n=t.pLoader,r=t.loader,i=new(n||r)(t);return this.loaders[e.type]=i,i}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(let e in this.loaders){let t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){let{url:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:`text`,type:J.MANIFEST,url:n,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){let{id:n,level:r,pathwayId:i,url:a,deliveryDirectives:o,levelInfo:s}=t;this.load({id:n,level:r,pathwayId:i,responseType:`text`,type:J.LEVEL,url:a,deliveryDirectives:o,levelOrTrack:s})}onAudioTrackLoading(e,t){let{id:n,groupId:r,url:i,deliveryDirectives:a,track:o}=t;this.load({id:n,groupId:r,level:null,responseType:`text`,type:J.AUDIO_TRACK,url:i,deliveryDirectives:a,levelOrTrack:o})}onSubtitleTrackLoading(e,t){let{id:n,groupId:r,url:i,deliveryDirectives:a,track:o}=t;this.load({id:n,groupId:r,level:null,responseType:`text`,type:J.SUBTITLE_TRACK,url:i,deliveryDirectives:a,levelOrTrack:o})}onLevelsUpdated(e,t){let n=this.loaders[J.LEVEL];if(n){let e=n.context;e&&!t.levels.some(t=>t===e.levelOrTrack)&&(n.abort(),delete this.loaders[J.LEVEL])}}load(e){let t=this.hls.config,n=this.getInternalLoader(e);if(n){let t=this.hls.logger,r=n.context;if(r&&r.levelOrTrack===e.levelOrTrack&&(r.url===e.url||r.deliveryDirectives&&!e.deliveryDirectives)){r.url===e.url?t.log(`[playlist-loader]: ignore ${e.url} ongoing request`):t.log(`[playlist-loader]: ignore ${e.url} in favor of ${r.url}`);return}t.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let r;if(r=e.type===J.MANIFEST?t.manifestLoadPolicy.default:zu({},t.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),W(e.deliveryDirectives?.part)){let t;if(e.type===J.LEVEL&&e.level!==null?t=this.hls.levels[e.level].details:e.type===J.AUDIO_TRACK&&e.id!==null?t=this.hls.audioTracks[e.id].details:e.type===J.SUBTITLE_TRACK&&e.id!==null&&(t=this.hls.subtitleTracks[e.id].details),t){let e=t.partTarget,n=t.targetduration;if(e&&n){let t=Math.max(e*3,n*.8)*1e3;r=zu({},r,{maxTimeToFirstByteMs:Math.min(t,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,r.maxTimeToFirstByteMs)})}}}let i=r.errorRetry||r.timeoutRetry||{},a={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:i.maxNumRetry||0,retryDelay:i.retryDelayMs||0,maxRetryDelay:i.maxRetryDelayMs||0};n.load(e,a,{onSuccess:(e,t,n,r)=>{let i=this.getInternalLoader(n);this.resetInternalLoader(n.type);let a=e.data;t.parsing.start=performance.now(),Pm.isMediaPlaylist(a)||n.type!==J.MANIFEST?this.handleTrackOrLevelPlaylist(e,t,n,r||null,i):this.handleMasterPlaylist(e,t,n,r)},onError:(e,t,n,r)=>{this.handleNetworkError(t,n,!1,e,r)},onTimeout:(e,t,n)=>{this.handleNetworkError(t,n,!0,void 0,e)}})}
vendor: 4,204 bytes, line 42
42checkAutostartLoad(){if(!this.hls)return;let{config:{autoStartLoad:e,startPosition:t},forceStartLoad:n}=this.hls;(e||n)&&(this.hls.logger.log(`${e?`auto`:`force`} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,n,r){let i=this.hls,a=e.data,o=Wx(e,n),s=Pm.parseMasterPlaylist(a,o);if(s.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,n,s.playlistParsingError,r,t);return}let{contentSteering:c,levels:l,sessionData:u,sessionKeys:d,startTimeOffset:f,variableList:p}=s;this.variableList=p,l.forEach(e=>{let{unknownCodecs:t}=e;if(t){let{preferManagedMediaSource:n}=this.hls.config,{audioCodec:r,videoCodec:i}=e;for(let a=t.length;a--;){let o=t[a];ef(o,`audio`,n)?(e.audioCodec=r=r?`${r},${o}`:o,Qd.audio[r.substring(0,4)]=2,t.splice(a,1)):ef(o,`video`,n)&&(e.videoCodec=i=i?`${i},${o}`:o,Qd.video[i.substring(0,4)]=2,t.splice(a,1))}}});let{AUDIO:m=[],SUBTITLES:h,"CLOSED-CAPTIONS":g}=Pm.parseMasterPlaylistMedia(a,o,s);m.length&&!m.some(e=>!e.url)&&l[0].audioCodec&&!l[0].attrs.AUDIO&&(this.hls.logger.log(`[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one`),m.unshift({type:`main`,name:`main`,groupId:`main`,default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Zp({}),bitrate:0,url:``})),i.trigger(q.MANIFEST_LOADED,{levels:l,audioTracks:m,subtitles:h,captions:g,contentSteering:c,url:o,stats:t,networkDetails:r,sessionData:u,sessionKeys:d,startTimeOffset:f,variableList:p})}handleTrackOrLevelPlaylist(e,t,n,r,i){let a=this.hls,{id:o,level:s,type:c}=n,l=Wx(e,n),u=W(s)?s:W(o)?o:0,d=Ux(n),f=Pm.parseLevelPlaylist(e.data,l,u,d,0,this.variableList);if(c===J.MANIFEST){let e={attrs:new Zp({}),bitrate:0,details:f,name:``,url:l};f.requestScheduled=t.loading.start+nh(f,0),a.trigger(q.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:l,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=f,this.handlePlaylistLoaded(f,e,t,n,r,i)}handleManifestParsingError(e,t,n,r,i){this.hls.trigger(q.ERROR,{type:G.NETWORK_ERROR,details:K.MANIFEST_PARSING_ERROR,fatal:t.type===J.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:r,stats:i})}handleNetworkError(e,t,n=!1,r,i){let a=`A network ${n?`timeout`:`error`+(r?` (status `+r.code+`)`:``)} occurred while loading ${e.type}`;e.type===J.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===J.AUDIO_TRACK||e.type===J.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);let o=Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let s=K.UNKNOWN,c=!1,l=this.getInternalLoader(e);switch(e.type){case J.MANIFEST:s=n?K.MANIFEST_LOAD_TIMEOUT:K.MANIFEST_LOAD_ERROR,c=!0;break;case J.LEVEL:s=n?K.LEVEL_LOAD_TIMEOUT:K.LEVEL_LOAD_ERROR,c=!1;break;case J.AUDIO_TRACK:s=n?K.AUDIO_TRACK_LOAD_TIMEOUT:K.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case J.SUBTITLE_TRACK:s=n?K.SUBTITLE_TRACK_LOAD_TIMEOUT:K.SUBTITLE_LOAD_ERROR,c=!1;break}l&&this.resetInternalLoader(e.type);let u={type:G.NETWORK_ERROR,details:s,fatal:c,url:e.url,loader:l,context:e,error:o,networkDetails:t,stats:i};r&&(u.response=Vu({url:t?.url||e.url,data:void 0},r)),this.hls.trigger(q.ERROR,u)}handlePlaylistLoaded(e,t,n,r,i,a){let o=this.hls,{type:s,level:c,levelOrTrack:l,id:u,groupId:d,deliveryDirectives:f}=r,p=Wx(t,r),m=Ux(r),h=typeof r.level==`number`&&m===Y.MAIN?c:void 0,g=e.playlistParsingError;if(g){if(this.hls.logger.warn(`${g} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(q.ERROR,{type:G.NETWORK_ERROR,details:K.LEVEL_PARSING_ERROR,fatal:!1,url:p,error:g,reason:g.message,response:t,context:r,level:h,parent:m,networkDetails:i,stats:n});return}e.playlistParsingError=null}if(!e.fragments.length){let a=e.playlistParsingError=Error(`No Segments found in Playlist`);o.trigger(q.ERROR,{type:G.NETWORK_ERROR,details:K.LEVEL_EMPTY_ERROR,fatal:!1,url:p,error:a,reason:a.message,response:t,context:r,level:h,parent:m,networkDetails:i,stats:n});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),s){case J.MANIFEST:case J.LEVEL:if(h){if
vendor: 4,274 bytes, line 42
42(!l)h=0;else if(l!==o.levels[h]){let e=o.levels.indexOf(l);e>-1&&(h=e)}}o.trigger(q.LEVEL_LOADED,{details:e,levelInfo:l||o.levels[0],level:h||0,id:u||0,stats:n,networkDetails:i,deliveryDirectives:f,withoutMultiVariant:s===J.MANIFEST});break;case J.AUDIO_TRACK:o.trigger(q.AUDIO_TRACK_LOADED,{details:e,track:l,id:u||0,groupId:d||``,stats:n,networkDetails:i,deliveryDirectives:f});break;case J.SUBTITLE_TRACK:o.trigger(q.SUBTITLE_TRACK_LOADED,{details:e,track:l,id:u||0,groupId:d||``,stats:n,networkDetails:i,deliveryDirectives:f});break}}},Kx=class e{static get version(){return Dh}static isMSESupported(){return Ix()}static isSupported(){return Lx()}static getMediaSource(){return $u()}static get Events(){return q}static get MetadataSchema(){return pg}static get ErrorTypes(){return G}static get ErrorDetails(){return K}static get DefaultConfig(){return e.defaultConfig?e.defaultConfig:mx}static set DefaultConfig(t){e.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Eh,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;let n=this.logger=Zu(t.debug||!1,`Hls instance`,t.assetPlayerId),r=this.config=gx(e.DefaultConfig,t,n);this.userConfig=t,r.progressive&&vx(r,n);let{abrController:i,bufferController:a,capLevelController:o,errorController:s,fpsController:c}=r,l=new s(this),u=this.abrController=new i(this),d=new Sp(this),f=r.interstitialsController,p=f?this.interstitialsController=new f(this,e):null,m=this.bufferController=new a(this,d),h=this.capLevelController=new o(this),g=new c(this),_=new Gx(this),v=r.contentSteeringController,y=v?new v(this):null,b=this.levelController=new Nx(this,y),x=new jx(this),S=new Vx(this.config,this.logger),C=this.streamController=new Bx(this,d,S),w=this.gapController=new Cx(this,d);h.setStreamController(C),g.setStreamController(C);let T=[_,b,C];p&&T.splice(1,0,p),y&&T.splice(1,0,y),this.networkControllers=T;let E=[u,m,w,h,g,x,d];this.audioTrackController=this.createController(r.audioTrackController,T);let D=r.audioStreamController;D&&T.push(this.audioStreamController=new D(this,d,S)),this.subtitleTrackController=this.createController(r.subtitleTrackController,T);let O=r.subtitleStreamController;O&&T.push(this.subtititleStreamController=new O(this,d,S)),this.createController(r.timelineController,E),S.emeController=this.emeController=this.createController(r.emeController,E),this.cmcdController=this.createController(r.cmcdController,E),this.latencyController=this.createController(Mx,E),this.coreComponents=E,T.push(l);let k=l.onErrorOut;typeof k==`function`&&this.on(q.ERROR,k,l),this.on(q.MANIFEST_LOADED,_.onManifestLoaded,_)}createController(e,t){if(e){let n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,r){this._emitter.off(e,t,n,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(this.logger.error(`An internal error happened while handling event `+e+`. Error message: "`+t.message+`". Here is a stacktrace:`,t),!this.triggeringException){this.triggeringException=!0;let n=e===q.ERROR;this.trigger(q.ERROR,{type:G.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,fatal:n,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log(`destroy`),this.trigger(q.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEac
vendor: 6,156 bytes, line 42
42h(e=>e.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(e=>e.destroy()),this.coreComponents.length=0;let e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||`media`in e&&!e.media){let t=Error(`attachMedia failed: invalid argument (${e})`);this.trigger(q.ERROR,{type:G.OTHER_ERROR,details:K.ATTACH_MEDIA_ERROR,fatal:!0,error:t});return}this.logger.log(`attachMedia`),this._media&&(this.logger.warn(`media must be detached before attaching`),this.detachMedia());let t=`media`in e,n=t?e.media:e,r=t?e:{media:n};this._media=n,this.trigger(q.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log(`detachMedia`),this.trigger(q.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;let e=this.bufferController.transferMedia();return this.trigger(q.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();let t=this.media,n=this._url,r=this._url=ld.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${r}`),t&&n&&(n!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(q.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?`, <skip seek to start>`:``)})`),this.started=!0,this.resumeBuffering();for(let n=0;n<this.networkControllers.length&&(this.networkControllers[n].startLoad(e,t),!(!this.started||!this.networkControllers));n++);}stopLoad(){this.logger.log(`stopLoad`),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log(`resume buffering`),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log(`pause buffering`),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){let e={[Y.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[Y.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[Y.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log(`swapAudioCodec`),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log(`recoverMediaError`);let e=this._media,t=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||=this._sessionId=jy(),e}get levels(){return this.levelController.levels||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){let e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){let t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){let{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){kf(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){let{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;let n=e.length;for(let r=0;r<n;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){let{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this,r;if(r=t===-1&&e!=null&&e.length?e.length-1:t,n)for(let t=r;t--;){let r=e[t].attrs[`HDCP-LEVEL`];if(r&&r<=n)return t}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){return this.audioTrackController?.setAudioOption(e)||null}
42setSubtitleOption(e){return this.subtitleTrackController?.setSubtitleOption(e)||null}get allAudioTracks(){let e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){let e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){let e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){let t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){let e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){let e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){let e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){let t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){let e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){let t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){return this.interstitialsController?.interstitialsManager||null}getMediaDecodingInfo(e,t=this.allAudioTracks){return Sf(e,Uf(t),navigator.mediaCapabilities)}};Kx.defaultConfig=void 0;var qx=[`application/x-mpegurl`,`application/vnd.apple.mpegurl`],Jx=[`video/flv`,`video/x-flv`],Yx=new WeakMap,Xx=new WeakMap,Zx=[`src`,`data-hls-src`,`data-video-src`,`data-src`];function Qx(e){let t=e.trim().toLowerCase().split(/[?#]/)[0]??``;return/\.m3u8?$/i.test(t)}function $x(e){let t=e.trim().toLowerCase().split(/[?#]/)[0]??``;return/\.flv$/i.test(t)}function eS(e){let t=e.trim().toLowerCase();return qx.some(e=>t.includes(e))}function tS(e){let t=e.trim().toLowerCase();return Jx.some(e=>t.includes(e))}function nS(e,t=``){return Qx(e)||eS(t)||$x(e)||tS(t)}function rS(e,t=``){return $x(e)||tS(t)?`flv`:Qx(e)||eS(t)?`hls`:`native`}function iS(e){for(let t of Zx){let n=e.getAttribute(t)?.trim();if(n)return n}for(let t of Array.from(e.querySelectorAll(`source`))){let e=t.getAttribute(`src`)?.trim();if(e)return e}return``}function aS(e){return e.getAttribute(`type`)?.trim()||(e.querySelector(`source`)?.getAttribute(`type`)?.trim()??``)}function oS(e){e.muted=!0,e.defaultMuted=!0,e.setAttribute(`muted`,``),e.setAttribute(`autoplay`,``),e.setAttribute(`playsinline`,``),e.setAttribute(`webkit-playsinline`,``)}function sS(e){let t=()=>{e.play().catch(e=>{console.warn(`[ç´æ] èªå¨ææ¾è¢«æµè§å¨æ¦æªï¼è¯·æå¨ç¹å»ææ¾:`,e)})};if(e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA){t();return}e.addEventListener(`canplay`,t,{once:!0})}function cS(e){e.removeAttribute(`src`),e.querySelectorAll(`source`).forEach(e=>e.remove()),e.src&&(e.removeAttribute(`src`),e.load())}function lS(e){let t=Yx.get(e);t&&(t.destroy(),Yx.delete(e));let n=Xx.get(e);n&&(n.pause(),n.unload(),n.detachMediaElement(),n.destroy(),Xx.delete(e)),e.removeAttribute(`src`),e.load()}function uS(e,t,n){e.on(Kx.Events.ERROR,(r,i)=>{if(console.error(`[HLS] ææ¾é误:`,n,i),i.fatal)switch(i.type){case Kx.ErrorTypes.NETWORK_ERROR:e.startLoad();break;case Kx.ErrorTypes.MEDIA_ERROR:e.recoverMediaError();break;default:e.destroy(),Yx.delete(t);break}})}function dS(e,t){if(cS(e),oS(e),!Nu.default.isSupported()){e.src=t,sS(e);return}let n=Nu.default.createPlayer({type:`flv`,url:t,isLive:!0,cors:!0,withCredentials:!1},{enableStashBuffer:!1,enableWorker:!0});n.attachMediaElement(e),n.load(),n.on(Nu.default.Events.METADATA_ARRIVED,()=>{sS(e)}),Xx.set(e,n)}function fS(e,t){if(cS(e),oS(e),e.canPlayType(`application/vnd.apple.mpegurl`)){e.src=t,sS(e);return}if(!Kx.isSupported()){console.error(`[HLS] å½åæµè§å¨ä¸æ¯æ MSEï¼æ æ³ææ¾:`,t);return}let n=new Kx({enableWorker:!0,lowLatencyMode:!1,liveBackBufferLength:0,backBufferLength:0,maxBufferLength:30,maxMaxBufferLength:600,manifestLoadingMaxRetry:4,manifestLoadingRetryDelay:1e3,levelLoadingMaxRetry:4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3});Yx.set(e,n),uS(n,e,t),n.attachMedia(e),n.on(Kx.Events.MEDIA_ATTA
42CHED,()=>{cS(e),n.loadSource(t)}),n.on(Kx.Events.MANIFEST_PARSED,()=>{sS(e)})}function pS(e,t,n=``){let r=t.trim();if(!r)return;lS(e);let i=rS(r,n);if(i===`flv`){dS(e,r);return}if(i===`hls`){fS(e,r);return}e.src=r}function mS(e){if(!e)return e;let t=e.replace(/(<video\b[^>]*?)\s+src=(["'])([^"']+)\2/gi,(e,t,n,r)=>nS(r)?`${t} data-video-src=${n}${r}${n}`:e);if(typeof DOMParser>`u`)return t;let n=new DOMParser().parseFromString(t,`text/html`);return n.querySelectorAll(`video`).forEach(e=>{let t=e,n=iS(t),r=aS(t),i=nS(n,r);t.classList.add(`hls-video-player`),t.setAttribute(`playsinline`,``),t.setAttribute(`webkit-playsinline`,``),t.hasAttribute(`controls`)||t.setAttribute(`controls`,``),n&&t.setAttribute(`data-video-src`,n),r&&t.setAttribute(`data-video-type`,r),i&&(cS(t),oS(t))}),n.body.innerHTML}function hS(e){let t=[];return e.querySelectorAll(`video.hls-video-player`).forEach(e=>{let n=e;if(n.dataset.streamReady===`1`)return;let r=aS(n)||n.getAttribute(`data-video-type`)?.trim()||``,i=n.getAttribute(`data-video-src`)?.trim()||iS(n);i&&(cS(n),pS(n,i,r),n.dataset.streamReady=`1`,t.push(()=>{n.dataset.streamReady=`0`,lS(n)}))}),()=>{t.forEach(e=>e())}}var gS=[`innerHTML`],_S=Qn({__name:`ContentVideoHost`,props:{html:{}},setup(e){let t=e,n=L(null),r=null,i=U(()=>mS(String(t.html??``))),a=async()=>{await Tn(),r?.(),r=null,n.value&&(r=hS(n.value))};return Wn(i,()=>{a()},{flush:`post`,immediate:!0}),gr(()=>{r?.(),r=null}),(e,t)=>(z(),B(`div`,{ref_key:`hostRef`,ref:n,innerHTML:i.value},null,8,gS))}}),vS=[`poster`,`width`],yS=Qn({__name:`LiveVideoPlayer`,props:{src:{},poster:{default:``},width:{default:`100%`},videoClass:{default:`hls-video-player`}},setup(e){let t=e,n=L(null),r=()=>{!n.value||!t.src.trim()||pS(n.value,t.src)};return Wn(()=>t.src,()=>{r()}),pr(()=>{r()}),gr(()=>{n.value&&lS(n.value)}),(t,r)=>(z(),B(`video`,{ref_key:`videoRef`,ref:n,class:_e(e.videoClass),controls:``,preload:`auto`,playsinline:``,"webkit-playsinline":``,poster:e.poster||void 0,width:e.width},null,10,vS))}}),bS={class:`main-header fix-header`},xS={class:`main header-warp`},SS={class:`logo`,href:`/`},CS=[`src`],wS={class:`menu`,"aria-label":`é¢é导èª`},TS=[`href`,`target`,`rel`],ES=`https://wap.scsjb.cn/main/main`,DS=zo(Qn({__name:`MainHeader`,props:{channels:{},currentChannelId:{}},setup(e){function t(e){return e.isExternal?e.link||``:`/channels/${e.channel_id}`}return(n,r)=>(z(),B(`header`,bS,[V(`div`,xS,[V(`a`,SS,[V(`img`,{src:`${ES}/imgs/logo.png`,alt:`åå·ææºæ¥`},null,8,CS)]),V(`nav`,wS,[(z(!0),B(R,null,Dr(e.channels,n=>(z(),B(`div`,{key:n.channel_id,class:_e([`li`,{cur:n.channel_id===e.currentChannelId}])},[V(`a`,{href:t(n),target:n.isExternal?`_blank`:void 0,rel:n.isExternal?`noopener noreferrer`:void 0,class:`bn_a`},I(n.channel_name),9,TS)],2))),128))])])]))}}),[[`__scopeId`,`data-v-80490f68`]]),OS={},kS={class:`footer`};function AS(e,t){return z(),B(`div`,kS,[...t[0]||=[V(`div`,{id:`top`},[V(`i`,{class:`iconfont icon-fanhuidingbu`})],-1)]])}var jS=zo(OS,[[`render`,AS]]);function MS(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(typeof document>`u`)){var r=document.head||document.getElementsByTagName(`head`)[0],i=document.createElement(`style`);i.type=`text/css`,n===`top`&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}MS(`@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:100% 0}75%{background-position:0 100%}to{background-position:0 0}}@keyframes watermark-horizontal{0%{background-position-x:0}to{background-position-x:100%}}@keyframes watermark-vertical{0%{background-position-y:0}to{background-position-y:100%}}`);var NS=function(e,t){return NS=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},NS(e,t)};function PS(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);NS(e,t);function n(){this.constructor=e}
42e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var FS=function(){return FS=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},FS.apply(this,arguments)};function IS(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function LS(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var RS=function(e){return e.toDataURL(`image/png`,1)},zS=function(e){return typeof e==`function`},BS=function(e){return e===void 0},VS=function(e){return typeof e==`string`},HS=function(e,t,n){t===void 0&&(t={}),n===void 0&&(n=`http://www.w3.org/2000/svg`);var r=document.createElementNS(n,e);for(var i in t)r.setAttribute(i,t[i]);return r},US=function(e,t,n){for(var r=[],i=``,a=``,o=0,s=t.length;o<s;o++){if(a=t.charAt(o),a===`
43`){r.push(i),i=``;continue}i+=a,e.measureText(i).width>n&&(r.push(i.substring(0,i.length-1)),i=``,o--)}return r.push(i),r},WS=function(e,t){return IS(void 0,void 0,void 0,function(){var n,r,i,a,o,s,c,l;return LS(this,function(u){switch(u.label){case 0:return n=HS(`svg`,{xmlns:`http://www.w3.org/2000/svg`}),r=document.createElement(`div`),r.setAttribute(`xmlns`,`http://www.w3.org/1999/xhtml`),r.style.cssText=` 44 text-align: center; 45 display: flex; 46 align-items: center; 47 justify-content: center; 48 width: 100%; 49 height: 100%; 50 font: ${e.font}; 51 color: ${t.fontColor}; 52`,r.innerHTML=`<div class='rich-text-content'>${t.content}</div>`,document.body.appendChild(r),[4,GS(r)];case 1:return u.sent(),i=r.querySelector(`.rich-text-content`)?.getBoundingClientRect(),a=i?.width,o=i?.height,document.body.removeChild(r),s=t.richTextWidth||a||t.width,c=t.richTextHeight||o||t.height,n.setAttribute(`width`,s.toString()),n.setAttribute(`height`,c.toString()),l=HS(`foreignObject`,{width:s.toString(),height:c.toString()}),l.appendChild(r),n.appendChild(l),[2,{element:n,width:s,height:c}]}})})};function GS(e){return IS(this,void 0,void 0,function(){var t,n,r,i,a;return LS(this,function(o){switch(o.label){case 0:t=e.querySelectorAll(`img`),n=function(e){var t,n,r,i,a;return LS(this,function(o){switch(o.label){case 0:if(t=e.getAttribute(`src`),!t)return[3,6];o.label=1;case 1:return o.trys.push([1,5,,6]),[4,fetch(t)];case 2:return n=o.sent(),[4,n.blob()];case 3:return r=o.sent(),[4,new Promise(function(e,t){var n=new FileReader;n.onloadend=function(){return e(n.result)},n.onerror=t,n.readAsDataURL(r)})];case 4:return i=o.sent(),VS(i)&&e.setAttribute(`src`,i),[3,6];case 5:return a=o.sent(),console.error(`Error converting ${t} to base64:`,a),[3,6];case 6:return[2]}})},r=0,i=Array.from(t),o.label=1;case 1:return r<i.length?(a=i[r],[5,n(a)]):[3,4];case 2:o.sent(),o.label=3;case 3:return r++,[3,1];case 4:return[2]}})})}var KS=function(e){return`data:image/svg+xml;charset=utf-8,${e.outerHTML.replace(/<(img|br|input|hr|embed)(.*?)>/g,`<$1$2/>`).replace(/\n/g,``).replace(/\t/g,``).replace(/#/g,`%23`)}`},qS=function(e,t){return BS(e)?t:e},JS=function(e,t,n){t===void 0&&(t=void 0),n===void 0&&(n=void 0);var r=new Image;return r.setAttribute(`crossOrigin`,`anonymous`),!BS(t)&&(r.width=t),!BS(n)&&(r.height=n),r.src=e,new Promise(function(e){r.onload=function(){e(r)}})},YS=function(e,t,n){return Array.from({length:e},function(){return Array(t).fill(n)})},XS=function(e,t){if(!e)return``;var n=Math.random()*6+2,r=Math.random()*2+2;switch(t){case`repeat`:return`animation: 200s linear 0s infinite alternate watermark !important;`;case`repeat-x`:return`animation: ${n}s linear 0s infinite alternate watermark-vertical !important;'`;case`repeat-y`:return`animation: ${r}s linear 0s infinite alternate watermark-horizontal !important;'`;case`no-repeat`:return`animation: ${n}s linear 0s infinite alternate watermark-horizontal, ${r}s linear 0s infinite alternate watermark-vertical !important;`;default:return``}},ZS={width:300,height:300,rotate:45,layout:`default`,auxiliaryLine:!1,translatePlacement:`middle`,contentType:`text`,content:`hello watermark-js-plus`,textType:`fill`,imageWidth:0,imageHeight:0,lineHeight:30,zIndex:2147483647,backgroundPosition:`0 0`,backgroundRepeat:`repeat`,fontSize:`20px`,fontFamily:`sans-serif`,fontStyle:``,fontVariant:``,fontColor:`#000`,fontWeight:`normal`,filter:`none`,letterSpacing:`0px`,wordSpacing:`0px`,globalAlpha:.5,mode:`default`,mutationObserve:!0,monitorProtection:!1,movable:!1,parent:`body`,onSuccess:function(){},onBeforeDestroy:function(){},onDestroyed:function(){},onObserveError:function(){}},QS=function(e,t,n){var r=e.getContext(`2d`);if(r===null)throw Error(`get context error`);r.font=`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${t.fontSize} ${t.fontFamily}`,r.filter=t.filter,r.letterSpacing=t.letterSpacing,r.wordSpacing=t.wordSpacing,t?.rotate&&(t.rotate=(360-t.rotate%360)*(Math.PI/180)),BS(n.textRowMaxWidth)&&(t.textRowMaxWidth=t.width);var i={image:{rect:{width:t.imageWidth,height:t.imageHeight},position:{x:0,y:0}},textLine:{data:[],yOffsetValue:0},advancedStyleParams:{linear:{x0:0,x1:0},radial:{x0:0,y0:0,r0:0,x1:0,y1:0,r1:0},conic:{x:0,y:0,startAngle:0},pattern:{}}};switch(t.contentType){case`text`:i.textLine.data=[t.content];break;case`multi-line-text`:i.textLine.data=US(r,t.content,t.textRowMaxWidth);break}var a=t.width/2,o=t.height/2,s=`middle`,c=`center`;switch(!BS(n?.translateX)&&!BS(n?.translateY)?(a=n?.translateX,o=n?.translateY,s=`top`,c=`left`):(i.advancedStyleParams.linear.x0=-t.width/2,i.advancedStyleParams.linear.x1=t.width/2,i.advancedStyleParams.radial.r0=0,i.advancedStyleParams.radial.r1=t.width/2),n.translatePlacement){case`top`:a=t.width/2,o=0,s=`to
52p`,i.advancedStyleParams.linear.x0=-t.width/2,i.advancedStyleParams.linear.x1=t.width/2,i.advancedStyleParams.radial.y0=i.textLine.data.length*t.lineHeight/2,i.advancedStyleParams.radial.y1=i.textLine.data.length*t.lineHeight/2,i.advancedStyleParams.conic.y=i.textLine.data.length*t.lineHeight/2;break;case`top-start`:a=0,o=0,s=`top`,c=`start`,i.advancedStyleParams.linear.x0=0,i.advancedStyleParams.linear.x1=t.width,i.advancedStyleParams.radial.x0=t.width/2,i.advancedStyleParams.radial.y0=i.textLine.data.length*t.lineHeight/2,i.advancedStyleParams.radial.x1=t.width/2,i.advancedStyleParams.radial.y1=i.textLine.data.length*t.lineHeight/2,i.advancedStyleParams.conic.x=t.width/2,i.advancedStyleParams.conic.y=i.textLine.data.length*t.lineHeight/2;break;case`top-end`:a=t.width,o=0,s=`top`,c=`end`,i.advancedStyleParams.linear.x0=0,i.advancedStyleParams.linear.x1=-t.width,i.advancedStyleParams.radial.x0=-t.width/2,i.advancedStyleParams.radial.y0=i.textLine.data.length*t.lineHeight/2,i.advancedStyleParams.radial.x1=-t.width/2,i.advancedStyleParams.radial.y1=i.textLine.data.length*t.lineHeight/2,i.advancedStyleParams.conic.x=-t.width/2,i.advancedStyleParams.conic.y=i.textLine.data.length*t.lineHeight/2;break;case`bottom`:a=t.width/2,o=t.height,s=`bottom`,i.advancedStyleParams.linear.x0=-t.width/2,i.advancedStyleParams.linear.x1=t.width/2,i.advancedStyleParams.radial.y0=-i.textLine.data.length*t.lineHeight/2,i.advancedStyleParams.radial.y1=-i.textLine.data.length*t.lineHeight/2,i.advancedStyleParams.conic.x=0,i.advancedStyleParams.conic.y=-i.textLine.data.length*t.lineHeight/2;break;case`bottom-start`:a=0,o=t.height,s=`bottom`,c=`start`,i.advancedStyleParams.linear.x0=0,i.advancedStyleParams.linear.x1=t.width,i.advancedStyleParams.radial.x0=t.width/2,i.advancedStyleParams.radial.y0=-i.textLine.data.length*t.lineHeight/2,i.advancedStyleParams.radial.x1=t.width/2,i.advancedStyleParams.radial.y1=-i.textLine.data.length*t.lineHeight/2,i.advancedStyleParams.conic.x=t.width/2,i.advancedStyleParams.conic.y=-i.textLine.data.length*t.lineHeight/2;break;case`bottom-end`:a=t.width,o=t.height,s=`bottom`,c=`end`,i.advancedStyleParams.linear.x0=0,i.advancedStyleParams.linear.x1=-t.width,i.advancedStyleParams.radial.x0=-t.width/2,i.advancedStyleParams.radial.y0=-i.textLine.data.length*t.lineHeight/2,i.advancedStyleParams.radial.x1=-t.width/2,i.advancedStyleParams.radial.y1=-i.textLine.data.length*t.lineHeight/2,i.advancedStyleParams.conic.x=-t.width/2,i.advancedStyleParams.conic.y=-i.textLine.data.length*t.lineHeight/2;break;case`left`:a=0,o=t.height/2,c=`start`,i.advancedStyleParams.linear.x0=0,i.advancedStyleParams.linear.x1=t.width,i.advancedStyleParams.radial.x0=t.width/2,i.advancedStyleParams.radial.x1=t.width/2,i.advancedStyleParams.conic.x=t.width/2,i.advancedStyleParams.conic.y=0;break;case`right`:a=t.width,o=t.height/2,c=`end`,i.advancedStyleParams.linear.x0=0,i.advancedStyleParams.linear.x1=-t.width,i.advancedStyleParams.radial.x0=-t.width/2,i.advancedStyleParams.radial.x1=-t.width/2,i.advancedStyleParams.conic.x=-t.width/2,i.advancedStyleParams.conic.y=0;break}if(t.translateX=a,t.translateY=o,BS(n?.textBaseline)&&(t.textBaseline=s),BS(n?.textAlign)&&(t.textAlign=c),[`text`,`multi-line-text`].includes(t.contentType))switch(t.textBaseline){case`middle`:i.textLine.yOffsetValue=(i.textLine.data.length-1)*t.lineHeight/2;break;case`bottom`:case`alphabetic`:case`ideographic`:i.textLine.yOffsetValue=(i.textLine.data.length-1)*t.lineHeight+(t.lineHeight-parseInt(t.fontSize))/2;break;case`top`:case`hanging`:i.textLine.yOffsetValue=-t.lineHeight/2+parseInt(t.fontSize)/2;break}return i},$S=(function(e){typeof window>`u`||e&&Object.defineProperty(window,`MutationObserver`,{writable:!1,configurable:!1})}),eC=function(){function e(t,n){this.props=t,this.options=n,this.canvas=e.createCanvas(this.options.width,this.options.height),this.recommendOptions=QS(this.canvas,this.options,this.props)}return e.createCanvas=function(e,t){var n,r=window.devicePixelRatio||1,i=document.createElement(`canvas`);return i.width=e*r,i.height=t*r,i.style.width=`${e}px`,i.style.height=`${t}px`,(n=i.getContext(`2d`))==null||n.setTransform(r,0,0,r,0,0),i},e.clearCanvas=function(e){var t=e.getContext(`2d`);if(t===null)throw Error(`get context error`);
52t.restore(),t.resetTransform(),t.clearRect(0,0,e.width,e.height);var n=window.devicePixelRatio||1;t.setTransform(n,0,0,n,0,0)},e.prototype.getCanvas=function(){return this.canvas},e.prototype.clear=function(){e.clearCanvas(this.canvas)},e.prototype.draw=function(){var e=this,t=this.canvas.getContext(`2d`);if(t===null)throw Error(`get context error`);return this.options.auxiliaryLine&&(t.beginPath(),t.rect(0,0,this.options.width,this.options.height),t.lineWidth=1,t.strokeStyle=`#000`,t.stroke(),t.closePath(),t.beginPath(),t.rect(this.options.translateX,this.options.translateY,1,1),t.lineWidth=1,t.strokeStyle=`#f00`,t.stroke(),t.closePath()),this.setStyle(t),t.save(),t.translate(this.options.translateX,this.options.translateY),t.rotate(this.options.rotate),new Promise(function(n){switch(e.options.contentType){case`text`:e.drawText(t,n);break;case`image`:e.drawImage(t,n);break;case`multi-line-text`:e.drawMultiLineText(t,n);break;case`rich-text`:e.drawRichText(t,n);break}})},e.prototype.setStyle=function(e){var t=`fillStyle`;this.options.textType===`stroke`&&(t=`strokeStyle`);var n=this.options.fontColor;if(this.options?.advancedStyle)switch(this.options.advancedStyle.type){case`linear`:n=this.createLinearGradient(e);break;case`radial`:n=this.createRadialGradient(e);break;case`conic`:n=this.createConicGradient(e);break;case`pattern`:n=this.createPattern(e);break}e[t]&&n&&(e[t]=n),this.options.textAlign&&(e.textAlign=this.options.textAlign),this.options.textBaseline&&(e.textBaseline=this.options.textBaseline),e.globalAlpha=this.options.globalAlpha,this.options.shadowStyle&&(e.shadowBlur=qS(this.options.shadowStyle.shadowBlur,0),e.shadowColor=qS(this.options.shadowStyle.shadowColor,`#00000000`),e.shadowOffsetX=qS(this.options.shadowStyle.shadowOffsetX,0),e.shadowOffsetY=qS(this.options.shadowStyle.shadowOffsetY,0)),zS(this.options.extraDrawFunc)&&this.options.extraDrawFunc(e)},e.prototype.createLinearGradient=function(e){var t,n=e.createLinearGradient(qS(this.options.advancedStyle?.params?.linear?.x0,this.recommendOptions.advancedStyleParams.linear.x0),qS(this.options.advancedStyle?.params?.linear?.y0,0),qS(this.options.advancedStyle?.params?.linear?.x1,this.recommendOptions.advancedStyleParams.linear.x1),qS(this.options.advancedStyle?.params?.linear?.y1,0));return(t=this.options?.advancedStyle?.colorStops)==null||t.forEach(function(e){n.addColorStop(e.offset,e.color)}),n},e.prototype.createConicGradient=function(e){var t,n=e.createConicGradient(qS(this.options?.advancedStyle?.params?.conic?.startAngle,0),qS(this.options?.advancedStyle?.params?.conic?.x,this.recommendOptions.advancedStyleParams.conic.x),qS(this.options?.advancedStyle?.params?.conic?.y,this.recommendOptions.advancedStyleParams.conic.y));return(t=this.options?.advancedStyle?.colorStops)==null||t.forEach(function(e){n.addColorStop(e.offset,e.color)}),n},e.prototype.createRadialGradient=function(e){var t,n=e.createRadialGradient(qS(this.options?.advancedStyle?.params?.radial?.x0,this.recommendOptions.advancedStyleParams.radial.x0),qS(this.options?.advancedStyle?.params?.radial?.y0,this.recommendOptions.advancedStyleParams.radial.y0),qS(this.options?.advancedStyle?.params?.radial?.r0,this.recommendOptions.advancedStyleParams.radial.r0),qS(this.options?.advancedStyle?.params?.radial?.x1,this.recommendOptions.advancedStyleParams.radial.x1),qS(this.options?.advancedStyle?.params?.radial?.y1,this.recommendOptions.advancedStyleParams.radial.y1),qS(this.options?.advancedStyle?.params?.radial?.r1,this.recommendOptions.advancedStyleParams.radial.r1));return(t=this.options?.advancedStyle?.colorStops)==null||t.forEach(function(e){n.addColorStop(e.offset,e.color)}),n},e.prototype.createPattern=function(e){return e.createPattern(this.options?.advancedStyle?.params?.pattern?.image,this.options?.advancedStyle?.params?.pattern?.repetition||``)},e.prototype.setText=function(e,t){var n=`fillText`;this.options.textType===`stroke`&&(n=`strokeText`),e[n]&&e[n](t.text,t.x,t.y,t.maxWidth)},e.prototype.drawText=function(e,t){this.setText(e,{text:this.options.content,x:0,y:0-this.recommendOptions.textLine.yOffsetValue,maxWidth:this.options.textRowMaxWidth||this.options.width}),t(e.canvas)},e.prototype.drawImage=function(e,t){var n=this;JS(this.options.image).then(function(r){var i=n.getImageRect(r),a=i.width,o=i.height,s=n.getDrawImagePosition(a,o);e.drawImage(r,s.x,s.y,a,o),t(e.canvas)})},e.prototype.drawMultiLineText=function(e,t){var n=this,r=this.recommendOptions.textLine.data,i=this.recommendOptions.textLine.yOffsetValue;r.forEach(function(t,r){n.setText(e,{text:t,x:0,y:n.options.lineHeight*r-i,maxWidth:n.options.textRowMaxWidth||n.options.width})}),t(e.canvas)},e.prototype.drawRichText=function(e,t){return IS(this,void 0,void 0,function(){var n,r=this;return LS(this,function(i){switch(i.label){case 0:return[4,WS(e,this.options)];case 1:return n=i.sent(),JS(KS(n.element),n.width,n.height).then(function(n){var i=r.getDrawImagePosition(n.width,n.height);e.drawImage(n,i.x,i.y,n.width,n.height),t(e.canvas)}),[2]}})})},e.prototype.getImageRect=function(e){var t={width:this.options.imageWidth||0,height:this.options.imageHeight||0};switch(!0){case t.width!==0&&t.height===0:t.height=t.width*e.height/e.width;break;case t.width===0&&t.height!==0:t.width=t.height*e.width/e.height;break;case t.width===0&&t.height===0:t.width=e.width,t.height=e.height;break}return t},e.prototype.getDrawImagePosition=function(e,t){var n={x:-e/2,y:-t/2};switch(this.options.translatePlacement){case`top`:n.x=-e/2,n.y=0;break;case`top-start`:n.x=0,n.y=0;break;case`top-end`:n.x=-e,n.y=0;break;case`bottom`:n.x=-e/2,n.y=-t;break;case`bottom-start`:n.x=0,n.y=-t;break;case`bottom-end`:n.x=-e,n.y=-t;break;case`left`:n.x=0,n.y=-t/2;break;case`right`:n.x=-e,n.y=-t/2;break}return!BS(this.props?.translateX)&&(n.x=0),!BS(this.props?.translateY)&&(n.y=0),n},e}(),tC=function(){function e(e,t){this.options=e,this.partialWidth=this.options.width,this.partialHeight=this.options.height,this.rows=this.options.gridLayoutOptions?.rows||1,this.cols=this.options.gridLayoutOptions?.cols||1,this.matrix=this.options.gridLayoutOptions?.matrix||YS(this.rows,this.cols,1),this.gap=this.options.gridLayoutOptions?.gap||[0,0],this.partialCanvas=t}return e.prototype.draw=function(){var e=eC.createCanvas(this.options.gridLayoutOptions?.width||this.partialWidth*this.cols+this.gap[0]*this.cols,this.options.gridLayoutOptions?.height||this.partialHeight*this.rows+this.gap[1]*this.rows),t=e.getContext(`2d`);this.options.gridLayoutOptions?.backgroundImage&&t?.drawImage(this.options.gridLayoutOptions?.backgroundImage,0,0,this.options.gridLayoutOptions?.width,this.options.gridLayoutOptions?.height);for(var n=0;n<this.rows;n++)for(var r=0;r<this.cols;r++)this.matrix?.[n]?.[r]&&t?.drawImage(this.partialCanvas,this.partialWidth*r+this.gap[0]*r,this.partialHeight*n+this.gap[1]*n,this.partialWidth,this.partialHeight);return e},e}(),nC=function(e,t){switch(e.layout){case`grid`:return new tC(e,t).draw();default:return t}},rC=function(e){switch(e.layout){case`grid`:var t=e.gridLayoutOptions?.cols||1,n=e.gridLayoutOptions?.rows||1,r=e.gridLayoutOptions?.gap||[0,0];return[e.width*t+r[0]*t,e.height*n+r[1]*n];default:return[e.width,e.height]}},iC=function(){function e(e){e===void 0&&(e={}),this.parentElement=document.body,this.isCreating=!1,this.props=e,this.options=FS(FS({},ZS),e),this.changeParentElement(this.options.parent),this.watermarkCanvas=new eC(this.props,this.options),$S(this.options.monitorProtection)}return e.prototype.changeOptions=function(){return IS(this,arguments,void 0,function(e,t,n){return e===void 0&&(e={}),t===void 0&&(t=`overwrite`),n===void 0&&(n=!0),LS(this,function(r){switch(r.label){case 0:return this.initConfigData(e,t),$S(this.options.monitorProtection),n?(this.remove(),[4,this.create()]):[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.create=function(){return IS(this,void 0,void 0,function(){var e,t,n,r,i,a,o,s,c,l;return LS(this,function(u){switch(u.label){case 0:if(this.isCreating)return[2];this.isCreating=!0,u.label=1;case 1:return u.trys.push([1,,3,4]),!this.validateUnique()||!this.validateContent()?[2]:(e=BS(this.watermarkDom),[4,this.watermarkCanvas?.draw()]);case 2:if(u.sent(),this.layoutCanvas=nC(this.options,this.watermarkCanvas?.getCanvas()),t=RS(this.layoutCanvas),(a=this.watermarkCanvas)==null||a.clear(),this.watermarkDom=document.createElement(`div`),n=document.createElement(`div`),this.watermarkDom.__WATERMARK__=`watermark`,this.watermarkDom.__WATERMARK__INSTANCE__=this,r=this.checkParentElementType(),this.watermarkDom.style.cssText=` 53 z-index:${this.options.zIndex}!important;display:block!important;visibility:visible!important;transform:none!important;scale:none!important; 54 ${r===`custom`?`top:0!important;bottom:0!important;left:0!important;right:0!important;height:100%!important;pointer-events:none!important;position:absolute!important;`:`position:relative!important;`} 55 `,i=rC(this.options),n.style.cssText=` 56 display:block!important;visibility:visible!important;pointer-events:none;top:0;bottom:0;left:0;right:0;transform:none!important;scale:none!important; 57 position:${r===`root`?`fixed`:`absolute`}!important;-webkit-print-color-adjust:exact!important;width:100%!important;height:100%!important; 58 z-index:${this.options.zIndex}!important;background-image:url(${t})!important;background-repeat:${this.options.backgroundRepeat}!important; 59 background-size:${i[0]}px ${i[1]}px!important;background-position:${this.options.backgroundPosition}; 60 ${XS(this.options.movable,this.options.backgroundRepeat)} 61 `,this.watermarkDom.appendChild(n),this.parentElement.appendChild(this.watermarkDom),this.options.mutationObserve)try{this.bindMutationObserver()}catch{(s=(o=this.options).onObserveError)==null||s.call(o)}return e&&((l=(c=this.options).onSuccess)==null||l.call(c)),[3,4];case 3:return this.isCreating=!1,[7];case 4:return[2]}})})},e.prototype.destroy=function(){this.remove(),this.watermarkDom=void 0},e.prototype.check=function(){return IS(this,void 0,void 0,function(){return LS(this,function(e){return[2,this.parentElement.contains(this.watermarkDom)]})})},e.prototype.remove=function(){var e,t,n,r,i,a,o;(t=(e=this.options).onBeforeDestroy)==null||t.call(e),(n=this.observer)==null||n.disconnect(),(r=this.parentObserver)==null||r.disconnect(),(i=this.watermarkDom?.parentNode)==null||i.removeChild(this.watermarkDom),
61(o=(a=this.options).onDestroyed)==null||o.call(a)},e.prototype.initConfigData=function(e,t){var n=this;t===void 0&&(t=`overwrite`),t===`append`?Object.keys(e).forEach(function(t){n.props&&(n.props[t]=e[t])}):this.props=e,this.options=FS(FS({},ZS),this.props),this.changeParentElement(this.options.parent),this.watermarkCanvas=new eC(this.props,this.options)},e.prototype.changeParentElement=function(e){if(typeof e==`string`){var t=document.querySelector(e);t&&(this.parentElement=t)}else this.parentElement=e;this.parentElement||console.error(`[WatermarkJsPlus]: please pass a valid parent element.`)},e.prototype.validateUnique=function(){var e=!0;return Array.from(this.parentElement.childNodes).forEach(function(t){e&&Object.hasOwnProperty.call(t,`__WATERMARK__`)&&(e=!1)}),e},e.prototype.validateContent=function(){switch(this.options.contentType){case`image`:return Object.hasOwnProperty.call(this.options,`image`);case`multi-line-text`:case`rich-text`:case`text`:return this.options.content.length>0}},e.prototype.checkParentElementType=function(){return[`html`,`body`].includes(this.parentElement.tagName.toLocaleLowerCase())?`root`:`custom`},e.prototype.recreateOnMutation=function(){return IS(this,void 0,void 0,function(){var e,t;return LS(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.remove(),[4,this.create()];case 1:return n.sent(),[3,3];case 2:return n.sent(),(t=(e=this.options).onObserveError)==null||t.call(e),[3,3];case 3:return[2]}})})},e.prototype.bindMutationObserver=function(){var e=this;this.watermarkDom&&(this.observer=new MutationObserver(function(t){t.length>0&&e.recreateOnMutation()}),this.observer.observe(this.watermarkDom,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`,`id`],childList:!0,subtree:!0,characterData:!0}),this.parentObserver=new MutationObserver(function(t){var n=e.watermarkDom;n&&t.some(function(e){return Array.from(e.removedNodes).includes(n)})&&e.recreateOnMutation()}),this.parentObserver.observe(this.parentElement,{childList:!0}))},e}(),aC=function(e){var t=e.ctx,n=e.width,r=e.height,i=e.fillColor,a=e.compositeOperation,o=e.compositeTimes;if(o>0){t.globalCompositeOperation,t.globalCompositeOperation=a,t.globalCompositeOperation,t.fillStyle=i;for(var s=0;s<o;s++)t.fillRect(0,0,n,r)}};(function(e){PS(t,e);function t(t){return t===void 0&&(t={}),e.call(this,FS(FS({},t),{globalAlpha:.005,mode:`blind`}))||this}return t.prototype.changeOptions=function(){return IS(this,arguments,void 0,function(e,t,n){return e===void 0&&(e={}),t===void 0&&(t=`overwrite`),n===void 0&&(n=!0),LS(this,function(r){switch(r.label){case 0:return e.globalAlpha=.005,e.mode=`blind`,this.initConfigData(e,t),$S(this.options.monitorProtection),n?(this.remove(),[4,this.create()]):[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},t.decode=function(e){var t=e.url,n=t===void 0?``:t,r=e.fillColor,i=r===void 0?`#000`:r,a=e.compositeOperation,o=a===void 0?`color-burn`:a,s=e.mode,c=s===void 0?`canvas`:s,l=e.compositeTimes,u=l===void 0?3:l,d=e.onSuccess;if(n&&c===`canvas`){var f=new Image;f.src=n,f.addEventListener(`load`,function(){var e=f.width,t=f.height,n=eC.createCanvas(e,t),r=n.getContext(`2d`);if(!r)throw Error(`get context error`);r.drawImage(f,0,0,e,t),aC({ctx:r,width:e,height:t,fillColor:i,compositeOperation:o,compositeTimes:u});var a=RS(n);zS(d)&&d?.(a)})}},t})(iC),function(){function e(e){e===void 0&&(e={});var t;this.drew=!1,this.props=e,this.options=FS(FS({},ZS),e),this.props.crossOrigin&&((t=this.props.dom)==null||t.setAttribute(`crossOrigin`,`anonymous`)),this.watermarkCanvas=new eC(this.props,this.options),this.originalSrc=this.props.dom?.src,this.backgroundImage=this.getBackgroundImage()}return e.prototype.create=function(){return IS(this,void 0,void 0,function(){var e;return LS(this,function(t){switch(t.label){case 0:return this.drew?[2]:[4,this.watermarkCanvas?.draw()];case 1:return t.sent(),this.options.layout=`grid`,this.options.gridLayoutOptions=FS(FS({},this.options.gridLayoutOptions),{width:this.backgroundImage?.width,height:this.backgroundImage?.height,backgroundImage:this.backgroundImage}),this.layoutCanvas=nC(this.options,this.watermarkCanvas?.getCanvas()),this.options.dom.src=RS(this.layoutCanvas),(e=this.watermarkCanvas)==null||e.clear(),this.drew=!0,[2]}})})},e.prototype.destroy=function(){this.options.dom.src=this.originalSrc,this.drew=!1}
61,e.prototype.getBackgroundImage=function(){if(this.options.dom)return this.options.dom},e}();var oC=e=>{if(typeof e==`string`&&e.trim())return e.trim();if(e&&typeof e==`object`){let t=e,n=[t.ip,t.clientIp,t.client_ip,t.IP];for(let e of n)if(typeof e==`string`&&e.trim())return e.trim()}return``},sC=async()=>{try{let e=await fetch(`/camel-gateway/gjmsAdmin/blackWord/getInfo`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();return oC(t?.data??t)}catch(e){return console.error(`è·å客æ·ç«¯ IP 失败:`,e),``}};function cC(e){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`}function lC(e,t){return`ä»
ä¾é¢è§ï¼éæ£å¼ç¨¿ä»¶\n${e}\nIP: ${t||`æªç¥`}`}function uC(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function dC(){let e=ss(),t=null,n=cC(new Date),r=()=>{t&&=(t.destroy(),null)},i=async e=>{let r={content:lC(n,e),contentType:`multi-line-text`,width:280,height:180,rotate:22,globalAlpha:.18,fontSize:`14px`,fontColor:`#333333`,lineHeight:22,zIndex:9999};if(t){await t.changeOptions(r);return}t=new iC(r),await t.create()},a=async()=>{await i(``);let t=await sC();if(!uC(e.query.key)){r();return}await i(t)};Wn(()=>uC(e.query.key),e=>{if(!e){r();return}a()},{immediate:!0}),_r(()=>{r()})}var fC={EDITING:1,PENDING_AUDIT:2,REJECTED:3,TO_PUBLISH:4,PUBLISHED:5,RETRY:6,DELETED:7},pC={[fC.EDITING]:{label:`ç¼è¾ä¸`,color:`#2196F3`,icon:`edit`},[fC.PENDING_AUDIT]:{label:`å¾
å®¡æ ¸`,color:`#00BCD4`},[fC.REJECTED]:{label:`已驳å`,color:`#FF9800`},[fC.TO_PUBLISH]:{label:`å¾
åå¸`,color:`#66BB6A`},[fC.PUBLISHED]:{label:`å·²åå¸`,color:`#009688`},[fC.RETRY]:{label:`å·²æ¤ç¨¿`,color:`#F44336`},[fC.DELETED]:{label:`å·²å é¤`,color:`#BF360C`,icon:`delete`}};function mC(e){let t=Number(e);if(Number.isFinite(t))return pC[t]}var hC={point:{priority:1,label:`éç¹è¯`,underlineColor:`#2563eb`,bg:`rgba(219, 234, 254, 0.78)`,textColor:`#1d4ed8`,badgeBg:`#eff6ff`,badgeColor:`#2563eb`},special:{priority:2,label:`ç¹æ®éç¹è¯`,underlineColor:`#7c3aed`,bg:`rgba(237, 233, 254, 0.78)`,textColor:`#6d28d9`,badgeBg:`#f5f3ff`,badgeColor:`#7c3aed`},warn:{priority:3,label:`ææè¯`,underlineColor:`#ca8a04`,bg:`rgba(254, 249, 195, 0.82)`,textColor:`#a16207`,badgeBg:`#fefce8`,badgeColor:`#b45309`},forbid:{priority:4,label:`è¿ç¦è¯`,underlineColor:`#dc2626`,bg:`rgba(254, 226, 226, 0.78)`,textColor:`#b91c1c`,badgeBg:`#fef2f2`,badgeColor:`#dc2626`}};function gC(e,t){let n=document.createElement(`div`);n.innerHTML=e??``;let r=TC(n),i=EC(r),a=i.map(({text:e})=>e).join(``);if(!a)return n.innerHTML;let o=_C(a,t);return o.length===0||wC(r,i,vC(a.length,o),a),n.innerHTML}function _C(e,t){let n=[],r=e.toLowerCase();for(let[e,i]of Object.entries(t||{}))if(!(!i||!i.length)&&hC[e])for(let t of i){if(!t)continue;let i=t.toLowerCase(),a=0;for(;(a=r.indexOf(i,a))!==-1;)n.push({start:a,end:a+t.length,type:e,keyword:t}),a+=1}return n}function vC(e,t){let n=Array.from({length:e},()=>new Set);for(let e of t)for(let t=e.start;t<e.end;t++)n[t].add(e.type);return n}function yC(e,t){let n=[];if(t.length===0)return n;let r=0,i=bC(t[0]);for(let a=1;a<=t.length;a++){let o=a<t.length?bC(t[a]):null;o!==i&&(n.push({start:r,end:a,types:[...t[r]],text:e.substring(r,a)}),r=a,i=o)}return n}function bC(e){return[...e].sort().join(`,`)}function xC(e){let t=[...e].sort((e,t)=>(hC[e].priority||0)-(hC[t].priority||0)),n=hC[t[t.length-1]];if(!n)return``;let r=t.map((e,t)=>{let n=hC[e];return n?`inset 0 ${-(3+t*4)}px 0 0 ${n.underlineColor}`:``}).filter(Boolean).join(`, `),i=Math.max(0,(t.length-1)*4);return`background-color:${n.bg};color:${n.textColor};box-shadow:${r};`+(i>0?`padding-bottom:${i}px;`:``)}function SC(e){let t={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};return e.replace(/[&<>"']/g,e=>t[e])}function CC(e){return e.map(e=>{let t=SC(e.text);if(e.types.length===0)return t;let n=e.types.map(e=>`kw-${e}`).join(` `),r=xC(e.types);return`<span data-highlight="yes" data-kw-types="${e.types.join(`,`)}" class="kw-highlight ${n}" style="${r}">${t}</span>`}).join(``)}function wC(e,t,n,r){for(let i=e.length-1;i>=0;i--){let{startIdx:a,endIdx:o}=t[i],s=n.slice(a,o);if(!s.some(e=>e.size>0))continue;let c=CC(yC(r.substring(a,o),s)),l=document.createElement(`span`);l.innerHTML=c;let u=e[i].parentNode;for(;l.firstChild;)u.insertBefore(l.firstChild,e[i]);u.removeChild(e[i])}}function TC(e){let t=[...e.childNodes],n=[];for(;t.length;){let e=t.shift();e.nodeType===e.TEXT_NODE?e.wholeText&&n.push(e):t.unshift(...e.childNodes)}return n}function EC(e){let t=0;return e.map(e=>{let n=t,r=t+e.wholeText.length;return t=r,{text:e.wholeText,startIdx:n,endIdx:r}})}var DC={class:`news-page`},OC={class:`keyword-tip-label`},kC={class:`keyword-tip-list`},AC={class:`container`},jC={class:`main row`,style:{"padding-top":`80px`}},MC={class:`col-7`},NC={class:`warp`},PC=[`innerHTML`],FC={key:1,class:`subject`},IC=[`innerHTML`],LC={key:3,class:`sub-title`},RC={class:`content-info`},zC={class:`meta-left`},BC={class:`breadcrumb-nav`,"aria-label":`é¢å
å±å¯¼èª`},VC=[`href`,`title`,`target`],HC={class:`meta-time`}
61,UC={key:0,class:`meta-origin`},WC={key:0,class:`meta-right`},GC={key:1,class:`meta-views`},KC={key:4,id:`video`},qC={class:`content`},JC={key:0,class:`promotion`},YC={href:`https://work.weixin.qq.com/kfid/kfc27e919c908cf63b1`,target:`_blank`},XC={style:{color:`#f00`}},ZC={style:{color:`#f00`}},QC={class:`footer`},$C={key:0,class:`keywords`},ew={key:0,class:`readtitle`},tw={class:`newsList`},nw=[`href`,`target`],rw=[`src`],iw={class:`right-content`},aw=[`href`,`target`],ow=[`href`,`target`],sw={class:`info`},cw={class:`createformat`},lw={class:`by`},uw={class:`col-3`},dw=Qn({__name:`News`,props:{articleid:{},areticleid:{},topicid:{}},setup(e){let t=ss(),n=os();dC();let r=e,i=U(()=>{let e=t.query.key;return typeof e==`string`&&e.trim().length>0}),a=U(()=>{let e=t.query.from;return typeof e==`string`&&e.trim().toLowerCase()===`wechat`}),o=U(()=>i.value&&a.value),s=L(!1),c=L(``),l=L(``),u=L(``),d=L({forbid:[],warn:[],point:[],special:[]}),f=L({show:!1,left:0,top:0,groups:[]}),p=L([]),m=L(null),h=U(()=>{let e=Number(m.value??0);return e&&p.value.some(t=>Number(t?.channel_id)===e)?e:null}),g=U(()=>r.articleid??r.areticleid??``),_=L({id:g.value}),v=L({channel_id:null,channel_name:``}),y=L(null),b=U(()=>String(r.topicid??``).trim()),x=L(``),S=U(()=>Number(b.value||0)||Number(y.value?.id??0)),C=U(()=>{let e=Number(v.value.channel_id??m.value??0),t=p.value.find(t=>Number(t?.channel_id)===e);return t?{id:t.channel_id,name:t.channel_name,link:t.link||`/channels/${t.channel_id}`,isExternal:!!t.isExternal}:{id:v.value.channel_id,name:v.value.channel_name,link:e?`/channels/${e}`:`#`,isExternal:!1}}),w=U(()=>{let e=[C.value],t=S.value;if(t){let n=String(x.value||y.value?.title||``).trim();e.push({id:t,name:n?`[ä¸é¢]${n}`:`[ä¸é¢]`,link:`/topic/${t}`,isExternal:!1})}return e}),T=L(``),E=L(``),D=U(()=>{if(i.value)return mC(_.value?.status)}),O=U(()=>{let e=Number(_.value?.baseHeat??_.value?.base_heat??NaN),t=Number(_.value?.finalHeat??_.value?.final_heat??NaN);return e===0&&t===0?!1:T.value!=null&&T.value!==``&&Number(T.value)!==0}),k=U(()=>D.value?!0:O.value),A=L([]),j=L([]),M=L([]),N=L([]),ee=L([]);function P(e){let t=Number(e?.type??1);if(t===5)return String(e?.external_link??e?.externalLink??``);let n=Number(e?.id??0);return n?t===2?`/topic/${n}`:t===3?`/live/${n}`:`/news/${n}`:`#`}function F(e){return Number(e?.type??0)===5}function te(){let e=n.resolve({name:`smsplan`});window.open(e.href,`_blank`)}async function ne(){let e=b.value;if(!e){x.value=``;return}try{let n=t.query.key,r=await tl(e,n);x.value=String(r?.title??``).trim()}catch(e){console.error(`å è½½ä¸é¢æ é¢å¤±è´¥:`,e),x.value=``}}async function re(e){if(e)try{await ne();let n=t.query.key;typeof n==`string`&&n.trim().length>0||al(e);let r=await tl(e,n);_.value={..._.value,...r,id:r?.id??Number(e)},v.value={channel_id:r?.channel_id??r?.categoryId??null,channel_name:r?.channel_name??r?.categories?.name??``},m.value=Number(v.value.channel_id)||null,y.value=r?.topic_home??r?.topicHome??null,T.value=r?.currentHeat??r?.views??r?.viewNum??``,E.value=r?.video_url??r?.videoUrl??``,Array.isArray(r?.keywords)?j.value=r.keywords:typeof r?.keywords==`string`?j.value=r.keywords.split(/[,\sï¼]+/).map(e=>e.trim()).filter(Boolean):j.value=[],await pe(r),await ue()}catch(e){console.error(`å è½½æ°é»è¯¦æ
失败:`,e)}}function ie(e){let t=document.createElement(`div`);return t.innerHTML=e,t.innerText||``}function ae(e){let t=e;if(!t)return{forbid:[],warn:[],point:[],special:[]};let n=t;return(t.success===`true`||t.success===!0||t.data?.point||t.data?.specialPoint||t.data?.special)&&(n=t.data??t),n?.data&&(n.success===`true`||n.success===!0)&&(n=n.data),{forbid:[],warn:[],point:Array.isArray(n?.point)?n.point:[],special:Array.isArray(n?.specialPoint)?n.specialPoint:Array.isArray(n?.special)?n.special:[]}}function oe(){s.value=!1,c.value=``,l.value=``,u.value=``,d.value={forbid:[],warn:[],point:[],special:[]},f.value={show:!1,left:0,top:0,groups:[]}}function se(e,t){let n=t.split(`,`).filter(Boolean),r=[];for(let t of n){let n=hC[t],i=d.value[t]||[];if(!n||!i.length)continue;let a=e.toLowerCase(),o=i.filter(e=>{let t=String(e).toLowerCase();return t.includes(a)||a.includes(t)});o.length&&r.push({type:t,label:n.label,keywords:o,bg:n.badgeBg,color:n.badgeColor})}return r.sort((e,t)=>
61(hC[t.type]?.priority||0)-(hC[e.type]?.priority||0)),r}function ce(e){let t=e.target;if(!(t instanceof HTMLElement)||!t.classList.contains(`kw-highlight`))return;let n=se(t.innerText||``,t.getAttribute(`data-kw-types`)||``);if(!n.length)return;let r=e.clientX,i=e.clientY;f.value={show:!0,left:r,top:i-30,groups:n},Tn(()=>{let e=document.getElementById(`keyword-tip`);if(!e)return;let{height:t}=e.getBoundingClientRect(),n=i-30-t;n<8&&(n=i+16);let a=r,o=e.offsetWidth||200;a+o>window.innerWidth-8&&(a=Math.max(8,window.innerWidth-o-8)),f.value.left=a,f.value.top=n})}function le(e){let t=e.target;t instanceof HTMLElement&&t.classList.contains(`kw-highlight`)&&(f.value.show=!1)}async function ue(){if(!o.value){oe();return}let e=String(_.value?.title??``),t=String(_.value?.subTitle??_.value?.sub_title??``).trim(),n=String(_.value?.content??``),r=ie(`${e}\n${t}\n${n}`);try{let i=ae(await sl(r,`gjms`));d.value=i,c.value=gC(e,i),l.value=gC(t,i),u.value=gC(n,i),s.value=!0}catch(e){console.error(`å
³é®è¯æ£æµå¤±è´¥:`,e),oe()}}function de(e){let t=e?.categories?.name??``;return{...e,categoryName:_.value.showRelatedArticles===0?t:v.value?.channel_name}}async function pe(e){let t=Number(e?.showRelatedArticles??0);try{let e=[];t===0?e=await Zc(1,10,1):t===1?e=await Zc(m.value??1,10,1,g.value):t===2&&(e=await nl(g.value)),M.value=e.slice(0,10).map(de)}catch(e){console.error(`å è½½ç¸å
³æ°é»å¤±è´¥:`,e),M.value=[]}}async function me(){try{p.value=await jl()}catch(e){console.error(`å 载导èªé¢é失败:`,e),p.value=[]}}let he=e=>{if(!e)return``;let t=new Date(String(e));if(Number.isNaN(t.getTime()))return``;let n=new Date,r=n.getFullYear()===t.getFullYear(),i=r&&n.getMonth()===t.getMonth();if(i&&n.getDate()===t.getDate()){let e=Math.max(n.getTime()-t.getTime(),0),r=Math.floor(e/(3600*1e3));return`${Math.max(r,1)}å°æ¶å`}if(i){let e=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();return`${Math.max(Math.floor((e-r)/(1440*60*1e3)),1)}天å`}return r?`${Math.max(n.getMonth()-t.getMonth(),1)}æå`:`${t.getFullYear()}å¹´${t.getMonth()+1}æ${t.getDate()}æ¥`},ge=e=>{let t=e?.publishedDate??e?.publish_time??e?.publishTime??e?.create_time;return he(t)||String(t??``).trim()},_e=U(()=>String(_.value?.subTitle??_.value?.sub_title??``).trim());return Wn([g,b],([e])=>{re(String(e??``))},{immediate:!0}),pr(()=>{me(),window.addEventListener(`mouseover`,ce),window.addEventListener(`mouseout`,le)}),_r(()=>{window.removeEventListener(`mouseover`,ce),window.removeEventListener(`mouseout`,le)}),(e,t)=>(z(),B(`main`,DC,[H(DS,{channels:p.value,"current-channel-id":h.value},null,8,[`channels`,`current-channel-id`]),f.value.show?(z(),B(`div`,{key:0,id:`keyword-tip`,class:`keyword-tip`,style:fe({left:f.value.left+`px`,top:f.value.top+`px`})},[t[0]||=V(`div`,{class:`keyword-tip-title`},`触åå
³é®å`,-1),(z(!0),B(R,null,Dr(f.value.groups,e=>(z(),B(`div`,{key:e.type,class:`keyword-tip-item`},[V(`div`,OC,I(e.label)+`ï¼`,1),V(`div`,kC,[(z(!0),B(R,null,Dr(e.keywords,(t,n)=>(z(),B(`span`,{key:e.type+`-`+n,class:`keyword-tip-tag`,style:fe({backgroundColor:e.bg,color:e.color})},I(t),5))),128))])]))),128))],4)):oa(``,!0),V(`div`,AC,[V(`div`,jC,[V(`div`,MC,[V(`div`,NC,[s.value?(z(),B(`div`,{key:0,class:`subject`,innerHTML:c.value},null,8,PC)):(z(),B(`div`,FC,I(_.value.title),1)),s.value&&l.value?(z(),B(`div`,{key:2,class:`sub-title`,innerHTML:l.value},null,8,IC)):_e.value?(z(),B(`div`,LC,I(_e.value),1)):oa(``,!0),V(`div`,RC,[V(`div`,zC,[V(`nav`,BC,[t[2]||=V(`a`,{href:`/`,class:`breadcrumb-link`},`é¦é¡µ`,-1),(z(!0),B(R,null,Dr(w.value,(e,n)=>(z(),B(R,{key:e.link||n},[t[1]||=V(`span`,{class:`breadcrumb-sep`},`>`,-1),V(`a`,{class:`breadcrumb-link`,href:e.link,title:e.name||`æ ç®`,target:e.isExternal?`_blank`:void 0},I(e.name||`æ ç®`),9,VC)],64))),128))]),V(`span`,HC,I(ge(_.value)),1),_.value.origin?(z(),B(`span`,UC,`æ¥æº: `+I(_.value.origin),1)):oa(``,!0)]),k.value?(z(),B(`div`,WC,[D.value?(z(),B(`span`,{key:0,class:`meta-status`,style:fe({color:D.value.color})},` ç¶æï¼ `+I(D.value.label),5)):oa(``,!0),O.value?(z(),B(`span`,GC,` ç度: `+I(T.value),1)):oa(``,!0)])):oa(``,!0)]),E.value?(z(),B(`div`,KC,[H(yS,{id:`videoShow`,src:E.value,width:850},null,8,[`src`])])):oa(``,!0),V(`div`,qC,[t[10]||=V(`div`,{class:`left-tools`},`s`,-1),H(_S,{class:`message`,html:s.value?u.value:String(_.value.content??``)},null,8,[`html`]),A.value&&A.value.length?(z(),B(`div`,JC,[V(`a`,YC,[t[3]||=ia(` ç¹å»å 群 åå¤â`,
61-1),V(`span`,XC,I(A.value[0]),1),t[4]||=ia(`â `,-1),t[5]||=V(`br`,null,null,-1),t[6]||=V(`br`,null,null,-1),t[7]||=ia(` å å
¥â`,-1),V(`span`,ZC,I(A.value[1]),1),t[8]||=ia(`â `,-1)])])):oa(``,!0),V(`div`,QC,[_.value.show_keywords===1?(z(),B(`div`,$C,[t[9]||=ia(` å
³é®è¯: `,-1),(z(!0),B(R,null,Dr(j.value,e=>(z(),B(`a`,{key:e,href:``},I(e),1))),128))])):oa(``,!0)])])]),V(`div`,{class:`ad`,style:{margin:`20px 0`},onClick:te},[...t[11]||=[V(`img`,{src:`/main/main/imgs/1200.jpg`},null,-1)]]),M.value.length===0?(z(),B(`div`,ew,[...t[12]||=[V(`span`,null,[V(`i`,{class:`iconfont icon-zuixing-47`}),ia(` ç¸å
³æ°é»`)],-1),V(`span`,null,`About`,-1)]])):oa(``,!0),V(`section`,tw,[(z(!0),B(R,null,Dr(M.value,e=>(z(),B(`div`,{class:`news-item`,key:e.id},[V(`a`,{class:`thumb`,href:P(e),target:F(e)?`_blank`:void 0,rel:`noopener noreferrer`},[V(`img`,{src:e.thumbnail},null,8,rw)],8,nw),V(`div`,iw,[V(`a`,{class:`subject`,href:P(e),target:F(e)?`_blank`:void 0,rel:`noopener noreferrer`},I(e.title),9,aw),V(`a`,{class:`simple-desc`,href:P(e),target:F(e)?`_blank`:void 0,rel:`noopener noreferrer`},I(e.summary),9,ow),V(`div`,sw,[V(`span`,cw,I(ge(e)),1),V(`span`,lw,I(e.categoryName),1)])])]))),128))])]),V(`div`,uw,[H(Ol,{"daily-news-list":N.value,"weekly-news-list":ee.value},null,8,[`daily-news-list`,`weekly-news-list`])])]),H(jS)])]))}}),fw={class:`channel-page`},pw={class:`main row`,style:{"padding-top":`80px`}},mw={class:`col-7`},hw={key:0,class:`banner`},gw={class:`left-banner`},_w={class:`swiper`},vw=[`href`,`target`],yw=[`src`],bw={class:`title`},xw={class:`right-banner`},Sw=[`href`,`target`],Cw=[`src`],ww={class:`mask`},Tw={class:`title`},Ew=[`href`,`target`],Dw=[`src`],Ow={class:`mask`},kw={class:`title`},Aw=[`href`,`target`],jw=[`src`],Mw={class:`c`},Nw={class:`time`},Pw={class:`t`},Fw={class:`d`},Iw={class:`newsList`},Lw={class:`readtitle`},Rw=[`href`,`target`],zw=[`src`],Bw={class:`right-content`},Vw=[`href`,`target`],Hw=[`href`,`target`],Uw={class:`info`},Ww={class:`createformat`},Gw={class:`by`},Kw={class:`news-item`},qw=[`val`],Jw=[`val`],Yw=[`val`],Xw={class:`col-3`},Zw=`https://msmp.scsjb.cn/gjms_pic/`,Qw=8,$w=Qn({__name:`Channel`,props:{channelid:{}},setup(e){let t=e,n=L([]),r=L(null),i=L({id:null,channel_name:``}),a=L([]),o=L([]),s=L(1),c=L(!1),l=L(!0),u=L(1),d=null,f=L([{rank:`01`,id:50658,title:`2026å¹´4æ14æ¥ ä¸å快讯`},{rank:`02`,id:50660,title:`ä¹å±±äººï¼è¿é¡¹è¡¥è´´æ¿çå»¶é¿`},{rank:`03`,id:50665,title:`ä»å¹´ä¸å£åº¦åå·ç交é建设æèµå®æ580.1亿å
`},{rank:`04`,id:50664,title:`å
«éåºç¤¾åºï¼æ¥é£ä¼´æé¿ï¼äº²åç»æ¶å
ï¼ç¤¾åºå¼å±å®¶åºæè²äº²åæ´»å¨`},{rank:`05`,id:50661,title:`ä¸è¿å ï¼âè´¡åæ¯âå å奿¯æ°¸çåå·æè½©èä¸å¦é¢`},{rank:`06`,id:50663,title:`第åä¸å±ä¸å½ç½ç»è§å¬å¤§ä¼æ¥äºï¼æé½é«æ°åºæ´»å¨ä¸æ°`},{rank:`07`,id:50662,title:`çå½èµå§ä¸¾åâéèèµè½ æ¤èªåºæµ·âââå
±å»ºâä¸å¸¦ä¸è·¯âé¶ä¼å¯¹æ¥æ´»å¨`}]),p=L([{rank:`01`,id:50624,title:`åå·ç2026å¹´æ®é髿 ¡ä¸åæ¬èè¯å°äº4æ16æ¥è³17æ¥ä¸¾è¡`},{rank:`02`,id:50542,title:`ä¼çå¸1.8ä¸äº©å¬æ´èå°å¨åæåºéæ¶ä¸å¸`},{rank:`03`,id:50566,title:`åå·å¤å°æè¿ä»å¹´é¦ä¸ª30â`},{rank:`04`,id:50595,title:`æéæåä¸å
¬é åå·çç«å¥åº·å车å¼è¿åå±±è¶è¥¿`},{rank:`05`,id:50613,title:`2026å¹´4æ10æ¥ ä¸å快讯`},{rank:`06`,id:50658,title:`2026å¹´4æ14æ¥ ä¸å快讯`},{rank:`07`,id:50634,title:`æ§è½©æ
éæ¿æè 书é¦å½é坿°ç« ââã䏿¬ä¹¦è¯»ææ§è½©ãæ°ä¹¦åå¸ä¼å满举è¡`},{rank:`08`,id:50539,title:`2026å¹´4æ7æ¥ ä¸å快讯`},{rank:`09`,id:50660,title:`ä¹å±±äººï¼è¿é¡¹è¡¥è´´æ¿çå»¶é¿`},{rank:`10`,id:50620,title:`ç¯ç«èèå æææ¶¦ä¸å®¶`}]),m=U(()=>{let e=Number(t.channelid??``);return Number.isFinite(e)?e:null}),h=U(()=>a.value[0]??{}),g=U(()=>u.value===3&&a.value.length>=3);function _(e){return e?/^https?:\/\//i.test(e)?e:`${Zw}${e}`:``}let v=e=>{if(!e)return``;let t=new Date(String(e));if(Number.isNaN(t.getTime()))return``;let n=new Date,r=n.getFullYear()===t.getFullYear(),i=r&&n.getMonth()===t.getMonth();if(i&&n.getDate()===t.getDate()){let e=Math.max(n.getTime()-t.getTime(),0),r=Math.floor(e/(3600*1e3));return`${Math.max(r,1)}å°æ¶å`}if(i){let e=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();return`${Math.max(Math.floor((e-r)/(1440*60*1e3)),1)}天å`}return r?`${Math.max(n.getMonth()-t.getMonth(),1)}æå`:`${t.getFullYear()}å¹´${t.getMonth()+1}æ${t.getDate()}æ¥`},y=e=>{let t=e?.publishedDate??e?.publish_time??e?.publishTime??e?.create_time;return v(t)||String(t??``).trim()};function b(e){let t=Number(e?.type??1);if(t===5)return String(e?.external_link??e?.externalLink??``);let n=Number(e?.id??0);return n?t===2?`/topic/${n}`:t===3?`/live/${n}`:`/news/${n}`:`#`}function x(e){return Number(e?.type??0)===5}async function S(){n.value=await jl()}async function C(e){let t=n.value.find(t=>t.channel_id===e),r=Number(t?.fullwidth_top_num??1)===3?3:1;u.value=r,a.value=(await Yc(e,r)??[]).map(e=>({id:Number(e?.id??0),title:e?.title??``,summary:e?.summary??``,publishedDate:e?.publishedDate??``,pc_top_img_url:e?.fullwidthTopUrl??e?.pc_top_img_url??e?.pcTopImgUrl??``,type:Number(e?.type??1),external_link:e?.external_link??e?.externalLink??``}))}function w(e){let t=new Set(a.value.map(e=>Number(e.id??0)).filter(e=>e>0));return e.filter(e=>!t.has(e.id))}async function T(e,t){if(!(c.value||!l.value)){c.value=!0;try{let n=await Xc(e,Qw,t),r=w(n.map(e=>({id:Number(e?.id??0),title:e?.title??``,summary:e?.summary??``,thumbnail:e?.thumbnail??``,createformat:v(e.publishedDate),type:Number(e?.type??1),external_link:e?.external_link??e?.externalLink??``})));o.value=t===1?r:[...o.value,...r],n.length<Qw?l.value=!1:s.value=t+1}finally{c.value=!1}}}async function E(){try{await S();let e=n.value[0]?.channel_id??null,t=m.value??e;if(t==null)return;r.value=t,i.value={id:t,channel_name:n.value.find(e=>e.channel_id===t)?.channel_name??`åå·`},s.value=1,l.value=!0,o.value=[],await C(t),await T(t,1)}catch(e){console.error(`å è½½æ ç®é¡µå¤±è´¥:`,e)}}return pr(async()=>{await E(),d=()=>{let e=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop,t=window.innerHeight||document.documentElement.clientHeight,n=document.documentElement.scrollHeight||document.body.scrollHeight;e+t>=n-60&&r.value!=null&&T(r.value,s.value)},window.addEventListener(`scroll`,d,{passive:!0})}),Wn(()=>t.channelid,async()=>{await E()}),gr(()=>{d&&window.removeEventListener(`scroll`,d)}),(e,t)=>(z(),B(R,null,[H(DS,{channels:n.value,"current-channel-id":r.value},null,8,[`channels`,`current-channel-id`]),V(`div`,fw,[V(`div`,pw,[V(`div`,mw,[g.value?(z(),B(`section`,hw,[V(`div`,gw,[V(`div`,_w,[V(`a`,{class:`item`,href:b(a.value[0]??{}),target:x(a.value[0]??{})?`_blank`:void 0,rel:`noopener noreferrer`}
61,[V(`img`,{src:_(a.value[0]?.pc_top_img_url||a.value[0]?.pcTopImgUrl)},null,8,yw),V(`div`,bw,I(a.value[0]?.title),1)],8,vw)])]),V(`div`,xw,[V(`a`,{class:`item`,href:b(a.value[1]??{}),target:x(a.value[1]??{})?`_blank`:void 0,rel:`noopener noreferrer`},[V(`img`,{src:_(a.value[1]?.pc_top_img_url||a.value[1]?.pcTopImgUrl)},null,8,Cw),V(`div`,ww,[V(`div`,Tw,I(a.value[1]?.title),1)])],8,Sw),V(`a`,{href:b(a.value[2]??{}),target:x(a.value[2]??{})?`_blank`:void 0,rel:`noopener noreferrer`},[V(`img`,{src:_(a.value[2]?.pc_top_img_url||a.value[2]?.pcTopImgUrl)},null,8,Dw),V(`div`,Ow,[V(`div`,kw,I(a.value[2]?.title),1)])],8,Ew)])])):(z(),B(`a`,{key:1,class:`banner`,href:b(h.value),target:x(h.value)?`_blank`:void 0,rel:`noopener noreferrer`},[V(`img`,{src:_(h.value.pc_top_img_url||h.value.pcTopImgUrl)},null,8,jw),V(`div`,Mw,[V(`div`,Nw,I(y(h.value)),1),V(`div`,Pw,I(h.value.title),1),V(`div`,Fw,I(h.value.summary),1)])],8,Aw)),V(`section`,Iw,[V(`div`,Lw,[V(`span`,null,I(i.value.channel_name),1),t[0]||=V(`span`,{style:{display:`none`}},null,-1)]),(z(!0),B(R,null,Dr(o.value,e=>(z(),B(`div`,{key:e.id,class:`news-item`},[V(`a`,{class:`thumb`,href:b(e),target:x(e)?`_blank`:void 0,rel:`noopener noreferrer`},[V(`img`,{src:_(e.thumbnail),alt:``},null,8,zw)],8,Rw),V(`div`,Bw,[V(`a`,{class:`subject`,href:b(e),target:x(e)?`_blank`:void 0,rel:`noopener noreferrer`},I(e.title),9,Vw),V(`a`,{class:`simple-desc`,href:b(e),target:x(e)?`_blank`:void 0,rel:`noopener noreferrer`},I(e.summary),9,Hw),V(`div`,Uw,[V(`span`,Ww,I(e.createformat),1),V(`span`,Gw,I(i.value.channel_name),1)])])]))),128))]),V(`section`,null,[V(`div`,Kw,[c.value?(z(),B(`div`,{key:0,class:`loadingMoreText`,val:i.value.id},` å è½½ä¸... `,8,qw)):l.value?(z(),B(`div`,{key:2,class:`loadingMoreText`,val:i.value.id}
61,` å è½½æ´å¤... `,8,Yw)):(z(),B(`div`,{key:1,class:`loadingMoreText`,val:i.value.id},` æ²¡ææ´å¤äº `,8,Jw))])])]),V(`div`,Xw,[H(Ol,{"daily-news-list":f.value,"weekly-news-list":p.value},null,8,[`daily-news-list`,`weekly-news-list`])])])]),H(jS)],64))}});function eT(e){let t=document.createElement(`div`);return t.innerHTML=e,t.innerText||``}function tT(e){let t=e;if(!t)return{forbid:[],warn:[],point:[],special:[]};let n=t;return(t.success===`true`||t.success===!0||t.data?.forbid||t.data?.warn||t.data?.point||t.data?.specialPoint||t.data?.special)&&(n=t.data??t),n?.data&&(n.success===`true`||n.success===!0)&&(n=n.data),{forbid:[],warn:[],point:Array.isArray(n?.point)?n.point:[],special:Array.isArray(n?.specialPoint)?n.specialPoint:Array.isArray(n?.special)?n.special:[]}}function nT(){let e=ss(),t=U(()=>{let t=e.query.key,n=e.query.from,r=typeof t==`string`&&t.trim().length>0,i=typeof n==`string`&&n.trim().toLowerCase()===`wechat`;return r&&i}),n=L(!1),r=L({forbid:[],warn:[],point:[],special:[]}),i=L({show:!1,left:0,top:0,groups:[]}),a=()=>{n.value=!1,r.value={forbid:[],warn:[],point:[],special:[]},i.value={show:!1,left:0,top:0,groups:[]}},o=(e,t)=>{let n=t.split(`,`).filter(Boolean),i=[];for(let t of n){let n=hC[t],a=r.value[t]||[];if(!n||!a.length)continue;let o=e.toLowerCase(),s=a.filter(e=>{let t=String(e).toLowerCase();return t.includes(o)||o.includes(t)});s.length&&i.push({type:t,label:n.label,keywords:s,bg:n.badgeBg,color:n.badgeColor})}return i.sort((e,t)=>(hC[t.type]?.priority||0)-(hC[e.type]?.priority||0)),i},s=e=>{if(!n.value)return;let t=e.target;if(!(t instanceof HTMLElement)||!t.classList.contains(`kw-highlight`))return;let r=o(t.innerText||``,t.getAttribute(`data-kw-types`)||``);if(!r.length)return;let a=e.clientX,s=e.clientY;i.value={show:!0,left:a,top:s-30,groups:r},Tn(()=>{let e=document.getElementById(`keyword-tip`);if(!e)return;let{height:t}=e.getBoundingClientRect(),n=s-30-t;n<8&&(n=s+16);let r=a,o=e.offsetWidth||200;r+o>window.innerWidth-8&&(r=Math.max(8,window.innerWidth-o-8)),i.value.left=r,i.value.top=n})},c=e=>{let t=e.target;t instanceof HTMLElement&&t.classList.contains(`kw-highlight`)&&(i.value.show=!1)};return pr(()=>{window.addEventListener(`mouseover`,s),window.addEventListener(`mouseout`,c)}),_r(()=>{window.removeEventListener(`mouseover`,s),window.removeEventListener(`mouseout`,c)}),{shouldHighlightKeywords:t,keywordHighlightEnabled:n,keywordTip:i,clearKeywordHighlight:a,highlightFields:async e=>{if(!t.value)return a(),null;let i=Object.values(e).map(e=>eT(String(e??``))).join(` 62`);try{let t=tT(await sl(i,`gjms`));r.value=t;let a={};for(let[n,r]of Object.entries(e))a[n]=gC(String(r??``),t);return n.value=!0,a}catch(e){return console.error(`å ³é®è¯æ£æµå¤±è´¥:`,e),a(),null}}}}var rT={class:`news-page`},iT={class:`keyword-tip-label`},aT={class:`keyword-tip-list`},oT={class:`container`},sT={class:`topic-page`},cT={class:`topic-main`},lT={class:`special_banner`},uT=[`src`],dT={key:0,class:`special_desc`},fT=[`innerHTML`],pT={key:1,class:`text`},mT={class:`newsList`},hT=[`id`],gT={class:`readtitle`},_T=[`href`],vT=[`src`],yT={class:`right-content`},bT=[`href`],xT=[`href`],ST={class:`info`},CT={class:`createformat`},wT={class:`by`},TT={class:`topic-right`},ET=zo(Qn({__name:`Topic`,props:{articleid:{}},setup(e){let t=e,n=ss();dC();let{keywordHighlightEnabled:r,keywordTip:i,highlightFields:a,clearKeywordHighlight:o}=nT(),s=L(``),c=U(()=>{let e=n.query.key;return typeof e==`string`&&e.trim()?e.trim():void 0}),l=U(()=>!!c.value),u=L([]),d=L(null),f=U(()=>{let e=Number(d.value??0);return e&&u.value.some(t=>Number(t?.channel_id)===e)?e:null}),p=L({}),m=L([]),h=L({}),g=U(()=>{if(l.value)return mC(h.value?.status??p.value?.status)}),_=L([]),v=L([]),y=async()=>{try{u.value=await jl()}catch(e){console.error(`Failed to fetch channels:`,e),u.value=[]}},b=async()=>{if(t.articleid)try{let e=await tl(t.articleid,c.value);h.value={...e,id:e?.id??Number(t.articleid)},d.value=Number(h.value?.channel_id??h.value?.categoryId??0)||null}catch(e){console.error(`Failed to preload article detail:`,e),h.value={},d.value=null}},x=e=>e?.topic??e?.special??e?.specialInfo??e?.article??e??{},S=e=>(Array.isArray(e?.topic_data)&&e.topic_data||Array.isArray(e?.specialCategories)&&e.specialCategories||Array.isArray(e?.specialCategoryList)&&e.specialCategoryList||Array.isArray(e?.classifyList)&&e.classifyList||Array.isArray(e?.categories)&&e.categories||(Array.isArray(e)?e:[])).map(e=>({...e,name:e?.name??e?.classify_name??``,articlesList:Array.isArray(e?.articlesList)?e.articlesList:Array.isArray(e?.sub_news_list)?e.sub_news_list:[]})),C=async()=>
62{if(t.articleid)try{let e=await il(t.articleid,c.value);p.value=x(e),m.value=S(e)}catch(e){console.error(`Failed to fetch topic data:`,e),p.value={},m.value=[]}},w=e=>e?/^https?:\/\//i.test(e)?e:`https://msmp.scsjb.cn/gjms_pic/${e}`:``,T=e=>e?/^https?:\/\//i.test(e)?e:`https://msmp.scsjb.cn/gjms_pic/${e}`:``,E=e=>{let n=Number(e?.type??1);if(n===5)return String(e?.external_link??e?.externalLink??``);let r=Number(e?.id??0);return r?n===2?`/topic/${r}`:n===3?`/live/${r}`:t.articleid?`/news/${r}/${t.articleid}`:`/news/${r}`:`#`},D=e=>{if(!e)return``;let t=new Date(String(e));if(Number.isNaN(t.getTime()))return``;let n=new Date,r=n.getFullYear()===t.getFullYear(),i=r&&n.getMonth()===t.getMonth();if(i&&n.getDate()===t.getDate()){let e=Math.max(n.getTime()-t.getTime(),0),r=Math.floor(e/(3600*1e3));return`${Math.max(r,1)}å°æ¶å`}if(i){let e=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();return`${Math.max(Math.floor((e-r)/(1440*60*1e3)),1)}天å`}return r?`${Math.max(n.getMonth()-t.getMonth(),1)}æå`:`${t.getFullYear()}å¹´${t.getMonth()+1}æ${t.getDate()}æ¥`},O=e=>{let t=e?.publishedDate??e?.publish_time??e?.publishTime??e?.create_time;return D(t)||String(t??``).trim()},k=e=>String(e?.categories?.name??``).trim()||`ä¸é¢`,A=U(()=>String(h.value?.summary??p.value?.summary??``).trim()),j=async()=>{let e=A.value;if(!e){o(),s.value=``;return}s.value=(await a({summary:e}))?.summary??``};return pr(async()=>{await Promise.all([y(),b(),C()]),await j()}),(e,t)=>(z(),B(`main`,rT,[H(DS,{channels:u.value,"current-channel-id":f.value},null,8,[`channels`,`current-channel-id`]),nn(i).show?(z(),B(`div`,{key:0,id:`keyword-tip`,class:`keyword-tip`,style:fe({left:nn(i).left+`px`,top:nn(i).top+`px`})},[t[0]||=V(`div`,{class:`keyword-tip-title`},`触åå
³é®å`,-1),(z(!0),B(R,null,Dr(nn(i).groups,e=>(z(),B(`div`,{key:e.type,class:`keyword-tip-item`},[V(`div`,iT,I(e.label)+`ï¼`,1),V(`div`,aT,[(z(!0),B(R,null,Dr(e.keywords,(t,n)=>(z(),B(`span`,{key:e.type+`-`+n,class:`keyword-tip-tag`,style:fe({backgroundColor:e.bg,color:e.color})},I(t),5))),128))])]))),128))],4)):oa(``,!0),V(`div`,oT,[V(`div`,sT,[V(`div`,cT,[V(`div`,lT,[V(`img`,{src:w(h.value.specialHeaderImage??p.value.specialHeaderImage??p.value.pc_top_img_url??p.value.pcTopImgUrl)},null,8,uT)]),A.value?(z(),B(`div`,dT,[nn(r)?(z(),B(`div`,{key:0,class:`text`,innerHTML:s.value},null,8,fT)):(z(),B(`div`,pT,I(A.value),1))])):oa(``,!0),g.value?(z(),B(`div`,{key:1,class:`article-status`,style:fe({color:g.value.color})},` ç¶æï¼`+I(g.value.label),5)):oa(``,!0),V(`section`,mT,[(z(!0),B(R,null,Dr(m.value,(e,n)=>(z(),B(`div`,{key:n,id:`s1_${n}`},[V(`div`,gT,[V(`span`,null,I(e.name),1),t[1]||=V(`span`,{style:{display:`none`}},null,-1)]),(z(!0),B(R,null,Dr(e.articlesList,e=>(z(),B(`div`,{key:e.id,class:`news-item`},[V(`a`,{class:`thumb`,href:E(e),target:`_blank`},[V(`img`,{src:T(e.title_img_url??e.thumbnail)},null,8,vT)],8,_T),V(`div`,yT,[V(`a`,{class:`subject`,href:E(e),target:`_blank`},I(e.title),9,bT),V(`a`,{class:`simple-desc`,href:E(e),target:`_blank`},I(e.summary),9,xT),V(`div`,ST,[V(`span`,CT,I(O(e)),1),V(`span`,wT,I(k(e)),1)])])]))),128))],8,hT))),128))])]),V(`div`,TT,[H(Ol,{"daily-news-list":_.value,"weekly-news-list":v.value},null,8,[`daily-news-list`,`weekly-news-list`])])]),H(jS)])]))}}),[[`__scopeId`,`data-v-11c4a347`]]),DT={class:`news-page`},OT={class:`keyword-tip-label`},kT={class:`keyword-tip-list`},AT={class:`container`,style:{"padding-top":`60px`}},jT={class:`topBanner`},MT={class:`inner`},NT={class:`p-topBg`},PT={class:`banner`},FT={class:`banner-txt`},IT=[`innerHTML`],LT={key:1,class:`p-topRead`},RT={class:`main row`,style:{"padding-top":`10px`}},zT={class:`col-7`},BT={key:0,class:`special_banner`},VT={key:0,id:`video`},HT=[`src`],UT=[`src`],WT={class:`livetitle`,style:{"margin-top":`35px`}},GT={style:{"margin-left":`10px`}},KT={id:`cd-timeline`,class:`cd-container`},qT={class:`cd-timeline-content`},JT={key:0,id:`video_sub`},YT=[`src`],XT={class:`cd-date`},ZT={class:`col-3`},QT=Qn({__name:`Live`,props:{articleid:{}},setup(e){let t=e,n=ss();dC();let{keywordHighlightEnabled:r,keywordTip:i,highlightFields:a,clearKeywordHighlight:o}=nT(),s=L(``),c=L({}),l=U(()=>{let e=n.query.key;return typeof e==`string`&&e.trim()?e.trim():void 0}),u=U(()=>!!l.value),d=U(()=>{let e=n.query.from;return typeof e==`string`&&e.trim().toLowerCase()===`wechat`}),f=U(()=>{let e=n.query.id;return typeof e==`string`&&e.trim()?e.trim():``}),p=U(()=>d.value&&!!f.value),m=L([]),h=L(null),g=U(()=>{let e=Number(h.value??0);return e&&m.value.some(t=>Number(t?.channel_id)===e)?e:null}),_=L({}),v=L([]),y=L(!0),b=L(null),x=L([]),S=L([]),C=U(()=>
62{if(u.value)return p.value?mC(v.value.find(e=>M(e,f.value))?.status??_.value?.status):mC(_.value?.status)}),w=U(()=>{let e=_.value?.videoCover??_.value?.video_cover??_.value?.pc_live_img_url??``;return e==null?``:String(e)}),T=U(()=>{let e=_.value?.videoLink??_.value?.video_link??_.value?.video_url??_.value?.videoUrl??``;return e==null?``:String(e)}),E=U(()=>{let e=_.value?.thumbnail??_.value?.thumb??``;return e==null?``:String(e)}),D=e=>{let t=e?.publishedDate??e?.published_date??e?.publish_time??e?.publishTime??e?.create_time??e?.createTime??e?.time??e?.live_time??e?.liveTime??``;return t==null?``:String(t)},O=e=>{let t=e?.videoLink??e?.video_link??e?.video_url??e?.videoUrl??``;return t==null?``:String(t)},k=e=>{let t=e?.img_url??e?.imgUrl??e?.image??e?.image_url??e?.thumbnail??``;return t==null?``:String(t)},A=e=>{let t=[e?.live_data,e?.liveData,e?.timeline,e?.timeLine,e?.live_list,e?.liveList,e?.sub_news_list,e?.subNewsList].find(e=>Array.isArray(e));return Array.isArray(t)?t.map(e=>({...e,display_time:D(e),display_video:O(e),display_image:k(e)})):[]},j=async(e,t)=>{if(!e){_.value={},v.value=[],o(),s.value=``,c.value={};return}try{let n=await rl(e,t);_.value={...n,id:n?.id??Number(e)},v.value=A(n),h.value=Number(n?.channel_id??n?.categoryId??0)||null,await ee()}catch(e){console.error(`å è½½ç´æè¯¦æ
失败:`,e),_.value={},v.value=[],o(),s.value=``,c.value={}}};function M(e,t){return t?[e?.id,e?.articleId,e?.article_id].some(e=>String(e??``)===t):!1}function N(e){let t=String(e?.content??``);if(!r.value||!p.value)return t;let n=String(e?.id??e?.articleId??e?.article_id??``);return c.value[n]??t}let ee=async()=>{if(s.value=``,c.value={},p.value){let e=f.value,t=v.value.find(t=>M(t,e));if(!t){o();return}let n=String(t.content??``).trim();if(!n){o();return}let r=await a({content:n});r?.content&&(c.value={[String(t.id??t.articleId??t.article_id??e)]:r.content});return}let e=String(_.value?.summary??``).trim();if(!e){o();return}s.value=(await a({summary:e}))?.summary??``},P=async()=>{try{m.value=await jl()}catch(e){console.error(`å 载导èªé¢é失败:`,e),m.value=[]}},F=()=>{b.value&&=(clearInterval(b.value),null)},te=()=>{F(),b.value=setInterval(()=>{j(String(t.articleid??``),l.value)},60*1e3)};return Wn(()=>t.articleid,e=>{j(String(e??``),l.value),y.value&&te()},{immediate:!0}),Wn(y,e=>{if(e){j(String(t.articleid??``),l.value),te();return}F()}),pr(()=>{P()}),_r(()=>{F()}),(e,t)=>(z(),B(`main`,DT,[H(DS,{channels:m.value,"current-channel-id":g.value},null,8,[`channels`,`current-channel-id`]),nn(i).show?(z(),B(`div`,{key:0,id:`keyword-tip`,class:`keyword-tip`,style:fe({left:nn(i).left+`px`,top:nn(i).top+`px`})},[t[1]||=V(`div`,{class:`keyword-tip-title`},`触åå
³é®å`,-1),(z(!0),B(R,null,Dr(nn(i).groups,e=>(z(),B(`div`,{key:e.type,class:`keyword-tip-item`},[V(`div`,OT,I(e.label)+`ï¼`,1),V(`div`,kT,[(z(!0),B(R,null,Dr(e.keywords,(t,n)=>(z(),B(`span`,{key:e.type+`-`+n,class:`keyword-tip-tag`,style:fe({backgroundColor:e.bg,color:e.color})},I(t),5))),128))])]))),128))],4)):oa(``,!0),V(`div`,AT,[V(`div`,jT,[V(`div`,MT,[V(`div`,NT,[V(`h1`,PT,[t[2]||=V(`span`,{class:`logo`},null,-1),V(`span`,FT,I(_.value.title),1)]),nn(r)&&s.value?(z(),B(`p`,{key:0,class:`p-topRead`,innerHTML:s.value},null,8,IT)):(z(),B(`p`,LT,I(_.value.summary),1)),C.value?(z(),B(`div`,{key:2,class:`article-status`,style:fe({color:C.value.color})},` ç¶æï¼`+I(C.value.label),5)):oa(``,!0)])])]),V(`div`,RT,[V(`div`,zT,[w.value||E.value?(z(),B(`div`,BT,[w.value&&T.value?(z(),B(`div`,VT,[H(yS,{id:`videoShow`,src:T.value,poster:w.value,width:850},null,8,[`src`,`poster`])])):w.value?(z(),B(`img`,{key:1,src:w.value,alt:`ç´æå°é¢`,style:{display:`block`,width:`100%`,"max-width":`850px`}},null,8,HT)):E.value?(z(),B(`img`,{key:2,src:E.value,alt:`ç´æç¼©ç¥å¾`,style:{display:`block`,width:`100%`,"max-width":`850px`}},null,8,UT)):oa(``,!0)])):oa(``,!0),V(`div`,WT,[t[4]||=V(`div`,{class:`t`},`ç´æå
容`,-1),V(`div`,GT,[Rn(V(`input`,{id:`auto`,"onUpdate:modelValue":t[0]||=e=>y.value=e,type:`checkbox`},null,512),[[Do,y.value]]),t[3]||=V(`label`,{for:`auto`},`èªå¨å·æ°`,-1)])]),V(`section`,KT,[(z(!0),B(R,null,Dr(v.value,(e,n)=>(z(),B(`div`,{key:e.publishedDate||e.publish_time||n,class:`cd-timeline-block`},[t[5]||=V(`div`,{class:`cd-timeline-img cd-picture`},null,-1),V(`div`,qT,[e.display_video?(z(),B(`div`,JT,[H(yS,{id:`videoShow_sub_${n}`,src:e.display_video,poster:e.display_image||void 0,width:772},null,8,[`id`,`src`,`poster`])])):oa(``,!0),e.display_image?(z(),B(`img`,{key:1,src:e.display_image,alt:`ç´æé
å¾`,class:`timeline-image`},null,8,YT)):oa(``,!0),H(_S,{class:`content img-box`,html:N(e)},null,8,[`html`]),V(`span`,XT,I(e.display_time),1)])]))),128))])]),V(`div`,ZT,[H(Ol,{"daily-news-list":x.value,"weekly-news-list":S.value},null,8,[`daily-news-list`,`weekly-news-list`])])]),H(jS)])]))}}),$T={style:{"text-align":`center`,padding:`50px`}},eE=Qn({__name:`Temp`,props:{tempKey:{}},setup(e){let t=e,n=ss(),r=os(),i=L(`æ£å¨å è½½ï¼è¯·ç¨å...`);function a(){let e=n.query.from;return typeof e==`string`?e.trim():``}function o(e={}){let n=a(),r={key:t.tempKey,...e};return n&&(r.from=n),r}return pr(async()=>
62{if(!t.tempKey){await r.replace({name:`not-found`});return}try{let e=await ol(t.tempKey);if(!e||typeof e!=`object`||!e.id){i.value=`æ¾ä¸å°å
容ï¼å³å°è·³è½¬å° 404 页é¢...`,setTimeout(()=>r.replace({name:`not-found`}),1500);return}let n=Number(e.type??1),s=Number(e.id),c=a().toLowerCase()===`wechat`;if(n===5){let t=String(e.external_link??e.externalLink??``);t?(i.value=`å³å°è·³è½¬å°å¤é¨é¾æ¥...`,window.location.replace(t)):(i.value=`å¤é¨é¾æ¥æ æï¼å³å°è·³è½¬å° 404 页é¢...`,setTimeout(()=>r.replace({name:`not-found`}),1500));return}let l=``,u=o();if(n===2)l=`/topic/${s}`;else if(n===3)l=`/live/${s}`;else if(n===4&&c){let t=Number(e.parentId??e.parent_id??0);if(!t){i.value=`æ¾ä¸å°ç¶ç´æï¼å³å°è·³è½¬å° 404 页é¢...`,setTimeout(()=>r.replace({name:`not-found`}),1500);return}l=`/live/${t}`,u=o({id:String(s)})}else l=`/news/${s}`;i.value=`æ£å¨è·³è½¬å° ${l}...`,await r.replace({path:l,query:u})}catch(e){console.error(`å¤ç临æ¶é¾æ¥å¤±è´¥:`,e),i.value=`å 载失败ï¼å³å°è·³è½¬å° 404 页é¢...`,setTimeout(()=>r.replace({name:`not-found`}),1500)}}),(e,t)=>(z(),B(`div`,$T,[V(`p`,null,I(i.value),1)]))}}),tE={class:`main row`,style:{"padding-top":`80px`}},nE={class:`col-7`},rE={class:`search_input`},iE={class:`ipt`},aE={class:`search_end`},oE={class:`newsList`,style:{"margin-top":`0`}},sE={key:0,class:`news-item`},cE=[`href`],lE=[`src`],uE={class:`right-content`},dE=[`href`,`innerHTML`],fE=[`href`],pE={class:`info`},mE={class:`createformat`},hE={class:`col-3`},gE=Qn({__name:`Search`,props:{keyword:{}},setup(e){let t=e,n=ss(),r=os(),i=L([]),a=L(null),o=L(t.keyword??``),s=L([]),c=L([]),l=L([]),u=e=>{if(!e)return``;let t=new Date(String(e));if(Number.isNaN(t.getTime()))return``;let n=new Date,r=n.getFullYear()===t.getFullYear(),i=r&&n.getMonth()===t.getMonth();if(i&&n.getDate()===t.getDate()){let e=Math.max(n.getTime()-t.getTime(),0),r=Math.floor(e/(3600*1e3));return`${Math.max(r,1)}å°æ¶å`}if(i){let e=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();return`${Math.max(Math.floor((e-r)/(1440*60*1e3)),1)}天å`}return r?`${Math.max(n.getMonth()-t.getMonth(),1)}æå`:`${t.getFullYear()}å¹´${t.getMonth()+1}æ${t.getDate()}æ¥`},d=e=>{let t=e?.publishedDate??e?.publish_time??e?.publishTime??e?.create_time;return u(t)||String(t??``).trim()},f=e=>{let t=Number(e?.type??1);if(t===5)return String(e?.external_link??e?.externalLink??``);let n=Number(e?.id??0);return n?t===2?`/topic/${n}`:t===3?`/live/${n}`:`/news/${n}`:`#`},p=e=>String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),m=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),h=(e,t)=>{let n=p(e),r=t.trim();if(!r)return n;let i=RegExp(`(${m(p(r))})`,`gi`);return n.replace(i,`<span class="search-keyword-highlight">$1</span>`)},g=async e=>{let t=e.trim();if(!t){s.value=[];return}try{s.value=await el(t,20,1)}catch(e){console.error(`æç´¢ç¨¿ä»¶å¤±è´¥:`,e),s.value=[]}};Wn(()=>t.keyword??n.params.keyword,e=>{let t=String(e??``).trim();o.value=t,g(t)},{immediate:!0});function _(){let e=o.value.trim();if(!e){s.value=[],r.replace({name:`search`,params:{keyword:``}});return}if(String(n.params.keyword??``).trim()===e){g(e);return}r.replace({name:`search`,params:{keyword:e}})}return(e,t)=>(z(),B(R,null,[H(DS,{channels:i.value,"current-channel-id":a.value},null,8,[`channels`,`current-channel-id`]),V(`div`,tE,[V(`div`,nE,[V(`div`,rE,[V(`div`,iE,[Rn(V(`input`,{type:`text`,placeholder:`请è¾å
¥æç´¢å
³é®è¯`,"onUpdate:modelValue":t[0]||=e=>o.value=e,onKeydown:Mo(_,[`enter`])},null,544),[[Eo,o.value]])]),V(`div`,{class:`sbtn`,onClick:_},`æç´¢`)]),V(`div`,aE,[V(`span`,null,`â `+I(o.value)+` âçæç´¢ç»æ`,1)]),V(`section`,oE,[s.value.length===0?(z(),B(`div`,sE,` æ "`+I(o.value)+`"çæç´¢ç»æ `,1)):oa(``,!0),(z(!0),B(R,null,Dr(s.value,e=>(z(),B(`div`,{key:e.id,class:`news-item`},[V(`a`,{class:`thumb`,href:f(e)},[V(`img`,{src:e.thumbnail},null,8,lE)],8,cE),V(`div`,uE,[V(`a`,{class:`subject`,href:f(e),innerHTML:h(e.title,o.value)},null,8,dE),V(`a`,{class:`simple-desc`,href:f(e)},I(e.summary),9,fE),V(`div`,pE,[V(`span`,mE,I(d(e)),1)])])]))),128))])]),V(`div`,hE,[H(Ol,{"daily-news-list":c.value,"weekly-news-list":l.value},null,8,[`daily-news-list`,`weekly-news-list`])])]),H(jS)],64))}}),_E={class:`sms-plan-page`},vE=`sms-plan-flexible-js`,yE=`/main/main/js/flexible.js`,bE=zo(Qn({__name:`SmsPlan`,setup(e){let t=null;function n(){return window.flexibleInit?Promise.resolve():(t||=new Promise((e,t)=>
62{let n=document.getElementById(vE);if(n){n.addEventListener(`load`,()=>e(),{once:!0}),n.addEventListener(`error`,()=>t(Error(`flexible.js å 载失败`)),{once:!0});return}let r=document.createElement(`script`);r.id=vE,r.src=yE,r.async=!0,r.onload=()=>e(),r.onerror=()=>t(Error(`flexible.js å 载失败`)),document.head.appendChild(r)}),t)}pr(async()=>{try{await n(),window.flexibleInit?.()}catch(e){console.error(`åå§å rem èªéåºå¤±è´¥:`,e)}}),_r(()=>{window.flexibleDestroy?.()});function r(e){let t=e.currentTarget,n=t.getAttribute(`rel`)??``;if(!window.confirm(n)){e.preventDefault();return}let r=t.getAttribute(`href`)??``,i=t.getAttribute(`n`)??``;/android/i.test(navigator.userAgent)&&i&&t.setAttribute(`href`,`${r}?body=${i}`)}return(e,t)=>(z(),B(`div`,_E,[t[16]||=V(`div`,{class:`top-bar`},[V(`div`,{class:`logo`},[V(`img`,{src:`/other/other/smsplan/imgs/logo.png`,alt:`åå·ææºæ¥`,class:`top-bar__logo-img`})]),V(`div`,{class:`title`},`精彩ä¸å¡æ¨è`)],-1),V(`div`,{class:`container`},[V(`div`,{class:`goods-box`},[V(`div`,{class:`group list active`},[V(`div`,{class:`item`},[t[3]||=V(`div`,{class:`l`},[V(`img`,{src:`/other/other/smsplan/imgs/tk.png`,alt:``})],-1),V(`div`,{class:`r`},[t[1]||=V(`p`,{class:`title`},`åå·ææºæ¥\xA0 (æ¯æ5å
)`,-1),t[2]||=V(`span`,{class:`tag`},` æ¬æ¥æ¯ä¸ä»½åæ¶ãåç¡®ãæå¨çæ°é»ææºæ¥ï¼æ¯å¤©ä¼å读è
æä¾éè¦çæ¶æ¿è¦é»ãè´¢ç»æ°é»ãæ°çèµè®¯ä»¥å便æ°ä¿¡æ¯ï¼åæ¶ä¹ä¼ä¸ºè¯»è
æä¾ç活娱ä¹çä¿¡æ¯ï¼å¼å¯¼ä¼é²å¥åº·çæ´»ã `,-1),V(`div`,{class:`buy`},[t[0]||=V(`div`,{class:`price`},null,-1),V(`div`,{class:`btn`},[V(`a`,{href:`sms:10658678`,n:`sc`,rel:`åå·ç§»å¨ç¨æ·ç¼è¾çä¿¡scåéå°10658678`,onClick:r},` è®¢è´ `)])])])]),V(`div`,{class:`item`},[t[7]||=V(`div`,{class:`l`},[V(`img`,{src:`/other/other/smsplan/imgs/tk.png`,alt:``})],-1),V(`div`,{class:`r`},[t[5]||=V(`p`,{class:`title`},`åå·ææºæ¥-åå·å¿«è®¯ç\xA0 (æ¯æ2å
)`,-1),t[6]||=V(`span`,{class:`tag`},` æ¬æ¥æ¯ä¸æ¬¾éçä¿¡ã彩信ãçè§é¢ä¸ºä¸ä½çå¤åªä½ææºæ¥ï¼å®æå读è
æä¾ææ°ãæå¿«çç²¾éæ°é»èµè®¯ãè§è®¯ã读è
æ éä¸è½½APPï¼ä¾¿å¯å¨çä¿¡çé¢ç´æ¥ç¹å»ææ¾è§çã `,-1),V(`div`,{class:`buy`},[t[4]||=V(`div`,{class:`price`},null,-1),V(`div`,{class:`btn`},[V(`a`,{href:`sms:10086`,n:`ktsckx`,rel:`åå·ç§»å¨ç¨æ·ç¼è¾çä¿¡ktsckxåéå°10086`,onClick:r},` è®¢è´ `)])])])]),V(`div`,{class:`item`},[t[11]||=V(`div`,{class:`l`},[V(`img`,{src:`/other/other/smsplan/imgs/tk.png`,alt:``})],-1),V(`div`,{class:`r`},[t[9]||=V(`p`,{class:`title`},`åå·ç¹å¿«\xA0 (æ¯æ1.6å
)`,-1),t[10]||=V(`span`,{class:`tag`},` âåå·ç¹å¿«â主è¦ä¸ºè¯»è
æ¥éåå·æ¬å°éè¦æ°é»ãå½é
å½å
çç¹äºä»¶ï¼ä»¥åè´¢ç»ãä½è²ã娱ä¹çéè¦æ°é»å
容ã `,-1),V(`div`,{class:`buy`},[t[8]||=V(`div`,{class:`price`},null,-1),V(`div`,{class:`btn`},[V(`a`,{href:`sms:10621111`,n:`6`,rel:`åé6å°10621111`,onClick:r},` è®¢è´ `)])])])]),V(`div`,{class:`item`},[t[15]||=V(`div`,{class:`l`},[V(`img`,{src:`/other/other/smsplan/imgs/tk.png`,alt:``})],-1),V(`div`,{class:`r`},[t[13]||=V(`p`,{class:`title`},`娱ä¹è±è¾¹\xA0 (æ¯æ6å
)`,-1),t[14]||=V(`span`,{class:`tag`},` 为读è
æä¾å
¨çææ°ççç¹å¨±ä¹ä½è²ç»¼åä¿¡æ¯ï¼å
æ¬æå¦ãèºæ¯ãææãæ¼åºãåç±»ä½è²æ¯èµèµè®¯çã `,-1),V(`div`,{class:`buy`},[t[12]||=V(`div`,{class:`price`},null,-1),V(`div`,{class:`btn`},[V(`a`,{href:`sms:10621111`,n:`YLHB`,rel:`åéYLHBå°10621111`,onClick:r},` è®¢è´ `)])])])])])])])]))}}),[[`__scopeId`,`data-v-c5b00d78`]]),xE={style:{"text-align":`center`,padding:`50px`}},SE=Qn({__name:`NotFound`,setup(e){return(e,t)=>{let n=Cr(`router-link`);return z(),B(`div`,xE,[t[1]||=V(`h1`,null,`404 - 页颿ªæ¾å°`,-1),t[2]||=V(`p`,null,`æ¨è¦æ¥æ¾ç页é¢ä¸åå¨ã`,-1),H(n,{to:`/`},{default:Ln(()=>[...t[0]||=[ia(`è¿åé¦é¡µ`,-1)]]),_:1})])}}}),CE=Jc({history:pc(),routes:[{path:`/`,name:`index`,component:Mu},{path:`/news/:articleid/:topicid?`,name:`news`,component:dw,props:e=>{let t=String(e.params.articleid??``);return{articleid:t,areticleid:t,topicid:String(e.params.topicid??``)}}},{path:`/channels/:channelid`,name:`channel`,component:$w,props:e=>({channelid:String(e.params.channelid??``)})},{path:`/topic/:articleid`,name:`topic`,component:ET,props:e=>({articleid:String(e.params.articleid??``)})},{path:`/live/:articleid`,name:`live`,component:QT,props:e=>({articleid:String(e.params.articleid??``)})},{path:`/temp/:key`,name:`temp`,component:eE,props:e=>({tempKey:String(e.params.key??``)})},{path:`/search/:keyword?`,name:`search`,component:gE,props:e=>({keyword:String(e.params.keyword??``)})},{path:`/other/smsplan`,name:`smsplan`,component:bE}
62,{path:`/:pathMatch(.*)*`,name:`not-found`,component:SE}]});Io(Ho).use(CE).mount(`#app`);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.