');function Vt(t,e){J(e,!0);function s(p){e.onHomeClick&&(p.preventDefault(),e.onHomeClick())}var r=Ct(),n=y(r),a=y(n);V(2),w(n),V(2),w(r),gt("click",a,s),Z(t,r),Q()}ht(["click"]);export{Vt as F,Yt as W,E as a,qt as b,Wt as c,Ot as d,Bt as e,Nt as f,Ht as g,Dt as l,Kt as r,j as s,Tt as t};
diff --git a/.svelte-kit/output/client/_app/immutable/chunks/DmyE0d-6.js b/.svelte-kit/output/client/_app/immutable/chunks/DmyE0d-6.js
new file mode 100644
index 0000000..2b8de64
--- /dev/null
+++ b/.svelte-kit/output/client/_app/immutable/chunks/DmyE0d-6.js
@@ -0,0 +1 @@
+import{l as o,E as p,g as u,H as y,n as _,j as l,C as g,o as r,q as E,t as d,k as m,v}from"./CkzjbUDB.js";import{B as T}from"./CFYBLbZM.js";function c(a,n,...s){var i=new T(a);o(()=>{const t=n()??null;i.ensure(t,t&&(e=>t(e,...s)))},p)}function N(a,n){let s=null,i=l;var t;if(l){s=m;for(var e=v(document.head);e!==null&&(e.nodeType!==g||e.data!==a);)e=r(e);if(e===null)E(!1);else{var f=r(e);e.remove(),d(f)}}l||(t=document.head.appendChild(u()));try{o(()=>n(t),y|_)}finally{i&&(E(!0),d(s))}}export{N as h,c as s};
diff --git a/.svelte-kit/output/client/_app/immutable/chunks/Dr80VTgO.js b/.svelte-kit/output/client/_app/immutable/chunks/Dr80VTgO.js
new file mode 100644
index 0000000..1a684cf
--- /dev/null
+++ b/.svelte-kit/output/client/_app/immutable/chunks/Dr80VTgO.js
@@ -0,0 +1 @@
+import{c as w,a as S,r as b,u as h,b as o,D as T,S as e}from"./CkzjbUDB.js";function n(r,s){return r===s||r?.[e]===s}function x(r={},s,i,l){var c=w.r,d=o;return S(()=>{var f,a;return b(()=>{f=a,a=[],h(()=>{r!==i(...a)&&(s(r,...a),f&&n(i(...f),r)&&s(null,...f))})}),()=>{let t=d;for(;t!==c&&t.parent!==null&&t.parent.f&T;)t=t.parent;const p=()=>{a&&n(i(...a),r)&&s(null,...a)},u=t.teardown;t.teardown=()=>{p(),u?.()}}}),r}export{x as b};
diff --git a/.svelte-kit/output/client/_app/immutable/chunks/DsupRLPE.js b/.svelte-kit/output/client/_app/immutable/chunks/DsupRLPE.js
deleted file mode 100644
index 67f0dd5..0000000
--- a/.svelte-kit/output/client/_app/immutable/chunks/DsupRLPE.js
+++ /dev/null
@@ -1 +0,0 @@
-import{e}from"./w0kPbzMq.js";e();
diff --git a/.svelte-kit/output/client/_app/immutable/chunks/DxGD2b0U.js b/.svelte-kit/output/client/_app/immutable/chunks/DxGD2b0U.js
new file mode 100644
index 0000000..1b31a6d
--- /dev/null
+++ b/.svelte-kit/output/client/_app/immutable/chunks/DxGD2b0U.js
@@ -0,0 +1 @@
+import{y as i,u as a,ad as d,Z as m,c as r,Q as g}from"./CkzjbUDB.js";function _(n){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function h(n,e,s){if(n==null)return e(void 0),i;const u=a(()=>n.subscribe(e,s));return u.unsubscribe?()=>u.unsubscribe():u}const c=[];function k(n,e=i){let s=null;const u=new Set;function f(o){if(d(n,o)&&(n=o,s)){const l=!c.length;for(const t of u)t[1](),c.push(t,n);if(l){for(let t=0;t{u.delete(t),u.size===0&&s&&(s(),s=null)}}return{set:f,update:b,subscribe:p}}function x(n){let e;return h(n,s=>e=s)(),e}function y(n){r===null&&_(),g&&r.l!==null?w(r).m.push(n):m(()=>{const e=a(n);if(typeof e=="function")return e})}function z(n){r===null&&_(),y(()=>()=>a(n))}function w(n){var e=n.l;return e.u??={a:[],b:[],m:[]}}export{z as a,x as g,y as o,h as s,k as w};
diff --git a/.svelte-kit/output/client/_app/immutable/chunks/XE2G8ySY.js b/.svelte-kit/output/client/_app/immutable/chunks/XE2G8ySY.js
new file mode 100644
index 0000000..9d47f59
--- /dev/null
+++ b/.svelte-kit/output/client/_app/immutable/chunks/XE2G8ySY.js
@@ -0,0 +1 @@
+import{w as B,x as L,y as m,z as D,A as S,B as A,l as M,j as R,F as U,E as p,G as w,I as x,t as Y,q as T,k as F,J as $,K as q,P as z,L as C,M as G,b as j,N as J,O as K,u as Q,Q as V,R as W,T as X,U as Z,V as H,W as k,S as ee,X as re}from"./CkzjbUDB.js";import{B as ne}from"./CFYBLbZM.js";import{s as ae,g as se}from"./DxGD2b0U.js";let g=!1,E=Symbol();function _e(e,n,s){const r=s[n]??={store:null,source:D(void 0),unsubscribe:m};if(r.store!==e&&!(E in s))if(r.unsubscribe(),r.store=e??null,e==null)r.source.v=void 0,r.unsubscribe=m;else{var i=!0;r.unsubscribe=ae(e,u=>{i?r.source.v=u:A(r.source,u)}),i=!1}return e&&E in s?se(e):S(r.source)}function de(){const e={};function n(){B(()=>{for(var s in e)e[s].unsubscribe();L(e,E,{enumerable:!1,value:!0})})}return[e,n]}function te(e){var n=g;try{return g=!1,[e(),g]}finally{g=n}}function le(e,n,s=!1){var r;R&&(r=F,U());var i=new ne(e),u=s?p:0;function v(t,f){if(R){var d=w(r);if(t!==parseInt(d.substring(1))){var _=x();Y(_),i.anchor=_,T(!1),i.ensure(t,f),T(!0);return}}i.ensure(t,f)}M(()=>{var t=!1;n((f,d=0)=>{t=!0,v(d,f)}),t||v(-1,null)},u)}function oe(e,n,s,r){var i=!V||(s&W)!==0,u=(s&K)!==0,v=(s&k)!==0,t=r,f=!0,d=()=>(f&&(f=!1,t=v?Q(r):r),t);let _;if(u){var O=ee in e||re in e;_=$(e,n)?.set??(O&&n in e?a=>e[n]=a:void 0)}var o,I=!1;u?[o,I]=te(()=>e[n]):o=e[n],o===void 0&&r!==void 0&&(o=d(),_&&(i&&q(),_(o)));var l;if(i?l=()=>{var a=e[n];return a===void 0?d():(f=!0,a)}:l=()=>{var a=e[n];return a!==void 0&&(t=void 0),a===void 0?t:a},i&&(s&z)===0)return l;if(_){var y=e.$$legacy;return(function(a,b){return arguments.length>0?((!i||!b||y||I)&&_(b?l():a),a):l()})}var P=!1,c=((s&X)!==0?Z:H)(()=>(P=!1,l()));u&&S(c);var N=j;return(function(a,b){if(arguments.length>0){const h=b?S(c):i&&u?C(a):a;return A(c,h),P=!0,t!==void 0&&(t=h),a}return G&&P||(N.f&J)!==0?c.v:S(c)})}export{_e as a,le as i,oe as p,de as s};
diff --git a/.svelte-kit/output/client/_app/immutable/chunks/mmStoiki.js b/.svelte-kit/output/client/_app/immutable/chunks/mmStoiki.js
deleted file mode 100644
index 6e57c0b..0000000
--- a/.svelte-kit/output/client/_app/immutable/chunks/mmStoiki.js
+++ /dev/null
@@ -1 +0,0 @@
-import{a4 as T,a3 as d,a5 as g,a6 as w,a7 as E,x as m,h as l,f as s,a8 as y,i as N,c as _,a9 as x,l as M,aa as A}from"./w0kPbzMq.js";const C=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function L(e){return C?.createHTML(e)??e}function v(e){var t=T("template");return t.innerHTML=L(e.replaceAll("","")),t.content}function a(e,t){var r=m;r.nodes===null&&(r.nodes={start:e,end:t,a:null,t:null})}function R(e,t){var r=(t&w)!==0,c=(t&E)!==0,n,i=!e.startsWith("");return()=>{if(l)return a(s,null),s;n===void 0&&(n=v(i?e:""+e),r||(n=d(n)));var o=c||g?document.importNode(n,!0):n.cloneNode(!0);if(r){var f=d(o),u=o.lastChild;a(f,u)}else a(o,o);return o}}function b(e,t,r="svg"){var c=!e.startsWith(""),n=`<${r}>${c?e:""+e}${r}>`,i;return()=>{if(l)return a(s,null),s;if(!i){var o=v(n),f=d(o);for(i=document.createDocumentFragment();d(f);)i.appendChild(d(f))}var u=i.cloneNode(!0);{var p=d(u),h=u.lastChild;a(p,h)}return u}}function D(e,t){return b(e,t,"svg")}function I(e=""){if(!l){var t=_(e+"");return a(t,t),t}var r=s;return r.nodeType!==x?(r.before(r=_()),M(r)):A(r),a(r,r),r}function F(){if(l)return a(s,null),s;var e=document.createDocumentFragment(),t=document.createComment(""),r=_();return e.append(t,r),a(t,r),e}function H(e,t){if(l){var r=m;((r.f&y)===0||r.nodes.end===null)&&(r.nodes.end=s),N();return}e!==null&&e.before(t)}const O="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(O);export{H as a,a as b,F as c,D as d,R as f,I as t};
diff --git a/.svelte-kit/output/client/_app/immutable/chunks/w0kPbzMq.js b/.svelte-kit/output/client/_app/immutable/chunks/w0kPbzMq.js
deleted file mode 100644
index 4c55800..0000000
--- a/.svelte-kit/output/client/_app/immutable/chunks/w0kPbzMq.js
+++ /dev/null
@@ -1 +0,0 @@
-var qt=Array.isArray,Ht=Array.prototype.indexOf,le=Array.prototype.includes,Cn=Array.from,Mn=Object.defineProperty,ve=Object.getOwnPropertyDescriptor,Ut=Object.getOwnPropertyDescriptors,Vt=Object.prototype,Bt=Array.prototype,it=Object.getPrototypeOf,Je=Object.isExtensible;const zt=()=>{};function Fn(e){return e()}function Gt(e){for(var t=0;t{e=r,t=s});return{promise:n,resolve:e,reject:t}}const E=2,ie=4,we=8,ft=1<<24,q=16,M=32,J=64,Kt=128,k=512,g=1024,b=2048,F=4096,P=8192,C=16384,re=32768,Qe=1<<25,Ae=65536,Me=1<<17,$t=1<<18,ye=1<<19,ut=1<<20,jn=1<<25,Q=65536,Fe=1<<21,Oe=1<<22,V=1<<23,de=Symbol("$state"),Ln=Symbol("legacy props"),Yn=Symbol(""),Y=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Hn=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml"),Ne=3,ot=8;function Xt(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Un(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Zt(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Wt(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Jt(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Qt(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Vn(){throw new Error("https://svelte.dev/e/hydration_failed")}function Bn(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function en(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function tn(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function nn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function zn(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Gn=1,Kn=2,$n=16,Xn=1,Zn=2,Wn=4,Jn=8,Qn=16,er=1,tr=2,rn="[",sn="[!",nr="[?",ln="]",Ue={},m=Symbol(),an="http://www.w3.org/1999/xhtml";function Ve(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function rr(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let ee=!1;function sr(e){ee=e}let S;function ae(e){if(e===null)throw Ve(),Ue;return S=e}function lr(){return ae(K(S))}function ir(e){if(ee){if(K(S)!==null)throw Ve(),Ue;S=e}}function ar(e=1){if(ee){for(var t=e,n=S;t--;)n=K(n);S=n}}function fr(e=!0){for(var t=0,n=S;;){if(n.nodeType===ot){var r=n.data;if(r===ln){if(t===0)return n;t-=1}else(r===rn||r===sn||r[0]==="["&&!isNaN(Number(r.slice(1))))&&(t+=1)}var s=K(n);e&&n.remove(),n=s}}function ur(e){if(!e||e.nodeType!==ot)throw Ve(),Ue;return e.data}function ct(e){return e===this.v}function fn(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function _t(e){return!fn(e,this.v)}let De=!1;function or(){De=!0}let T=null;function Se(e){T=e}function cr(e,t=!1,n){T={p:T,i:!1,c:null,e:null,s:e,x:null,r:d,l:De&&!t?{s:null,u:null,$:[]}:null}}function _r(e){var t=T,n=t.e;if(n!==null){t.e=null;for(var r of n)kt(r)}return t.i=!0,T=t.p,{}}function ge(){return!De||T!==null&&T.l===null}let X=[];function vt(){var e=X;X=[],Gt(e)}function et(e){if(X.length===0&&!he){var t=X;queueMicrotask(()=>{t===X&&vt()})}X.push(e)}function un(){for(;X.length>0;)vt()}function on(e){var t=d;if(t===null)return v.f|=V,e;if((t.f&re)===0&&(t.f&ie)===0)throw e;Re(e,t)}function Re(e,t){for(;t!==null;){if((t.f&Kt)!==0){if((t.f&re)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const cn=-7169;function y(e,t){e.f=e.f&cn|t}function Be(e){(e.f&k)!==0||e.deps===null?y(e,g):y(e,F)}function dt(e){if(e!==null)for(const t of e)(t.f&E)===0||(t.f&Q)===0||(t.f^=Q,dt(t.deps))}function _n(e,t,n){(e.f&b)!==0?t.add(e):(e.f&F)!==0&&n.add(e),dt(e.deps),y(e,g)}const H=new Set;let w=null,D=null,je=null,he=!1,Pe=!1,se=null,be=null;var tt=0;let vn=1;class z{id=vn++;current=new Map;previous=new Map;#a=new Set;#f=new Set;#r=new Map;#t=new Map;#_=null;#e=[];#v=[];#l=new Set;#s=new Set;#n=new Map;is_fork=!1;#u=!1;#i=new Set;#o(){return this.is_fork||this.#t.size>0}#p(){for(const r of this.#i)for(const s of r.#t.keys()){for(var t=!1,n=s;n.parent!==null;){if(this.#n.has(n)){t=!0;break}n=n.parent}if(!t)return!0}return!1}skip_effect(t){this.#n.has(t)||this.#n.set(t,{d:[],m:[]})}unskip_effect(t){var n=this.#n.get(t);if(n){this.#n.delete(t);for(var r of n.d)y(r,b),this.schedule(r);for(r of n.m)y(r,F),this.schedule(r)}}#c(){if(tt++>1e3&&(H.delete(this),hn()),!this.#o()){for(const i of this.#l)this.#s.delete(i),y(i,b),this.schedule(i);for(const i of this.#s)y(i,F),this.schedule(i)}const t=this.#e;this.#e=[],this.apply();var n=se=[],r=[],s=be=[];for(const i of t)try{this.#d(i,n,r)}catch(a){throw wt(i),a}if(w=null,s.length>0){var l=z.ensure();for(const i of s)l.schedule(i)}if(se=null,be=null,this.#o()||this.#p()){this.#h(r),this.#h(n);for(const[i,a]of this.#n)pt(i,a)}else{this.#r.size===0&&H.delete(this),this.#l.clear(),this.#s.clear();for(const i of this.#a)i(this);this.#a.clear(),nt(r),nt(n),this.#_?.resolve()}var u=w;if(this.#e.length>0){const i=u??=this;i.#e.push(...this.#e.filter(a=>!i.#e.includes(a)))}u!==null&&(H.add(u),u.#c()),H.has(this)||this.#w()}#d(t,n,r){t.f^=g;for(var s=t.first;s!==null;){var l=s.f,u=(l&(M|J))!==0,i=u&&(l&g)!==0,a=i||(l&P)!==0||this.#n.has(s);if(!a&&s.fn!==null){u?s.f^=g:(l&ie)!==0?n.push(s):Ee(s)&&((l&q)!==0&&this.#s.add(s),ue(s));var o=s.first;if(o!==null){s=o;continue}}for(;s!==null;){var f=s.next;if(f!==null){s=f;break}s=s.parent}}}#h(t){for(var n=0;n!this.current.has(c));if(s.length===0)t&&f.discard();else if(n.length>0){f.activate();var l=new Set,u=new Map;for(var i of n)ht(i,s,l,u);u=new Map;var a=[...f.current.keys()].filter(c=>this.current.has(c)?this.current.get(c)[0]!==c:!0);for(const c of this.#v)(c.f&(C|P|Me))===0&&ze(c,a,u)&&((c.f&(Oe|q))!==0?(y(c,b),f.schedule(c)):f.#l.add(c));if(f.#e.length>0){f.apply();for(var o of f.#e)f.#d(o,[],[]);f.#e=[]}f.deactivate()}}for(const f of H)f.#i.has(this)&&(f.#i.delete(this),f.#i.size===0&&!f.#o()&&(f.activate(),f.#c()))}increment(t,n){let r=this.#r.get(n)??0;if(this.#r.set(n,r+1),t){let s=this.#t.get(n)??0;this.#t.set(n,s+1)}}decrement(t,n,r){let s=this.#r.get(n)??0;if(s===1?this.#r.delete(n):this.#r.set(n,s-1),t){let l=this.#t.get(n)??0;l===1?this.#t.delete(n):this.#t.set(n,l-1)}this.#u||r||(this.#u=!0,et(()=>{this.#u=!1,this.flush()}))}transfer_effects(t,n){for(const r of t)this.#l.add(r);for(const r of n)this.#s.add(r);t.clear(),n.clear()}oncommit(t){this.#a.add(t)}ondiscard(t){this.#f.add(t)}settled(){return(this.#_??=at()).promise}static ensure(){if(w===null){const t=w=new z;Pe||(H.add(w),he||et(()=>{w===t&&t.flush()}))}return w}apply(){{D=null;return}}schedule(t){if(je=t,t.b?.is_pending&&(t.f&(ie|we|ft))!==0&&(t.f&re)===0){t.b.defer_effect(t);return}for(var n=t;n.parent!==null;){n=n.parent;var r=n.f;if(se!==null&&n===d&&(v===null||(v.f&E)===0))return;if((r&(J|M))!==0){if((r&g)===0)return;n.f^=g}}this.#e.push(n)}}function dn(e){var t=he;he=!0;try{for(var n;;){if(un(),w===null)return n;w.flush()}}finally{he=t}}function hn(){try{Qt()}catch(e){Re(e,je)}}let L=null;function nt(e){var t=e.length;if(t!==0){for(var n=0;n0)){B.clear();for(const s of L){if((s.f&(C|P))!==0)continue;const l=[s];let u=s.parent;for(;u!==null;)L.has(u)&&(L.delete(u),l.push(u)),u=u.parent;for(let i=l.length-1;i>=0;i--){const a=l[i];(a.f&(C|P))===0&&ue(a)}}L.clear()}}L=null}}function ht(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const s of e.reactions){const l=s.f;(l&E)!==0?ht(s,t,n,r):(l&(Oe|q))!==0&&(l&b)===0&&ze(s,t,r)&&(y(s,b),Ge(s))}}function ze(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(le.call(t,s))return!0;if((s.f&E)!==0&&ze(s,t,n))return n.set(s,!0),!0}return n.set(e,!1),!1}function Ge(e){w.schedule(e)}function pt(e,t){if(!((e.f&M)!==0&&(e.f&g)!==0)){(e.f&b)!==0?t.d.push(e):(e.f&F)!==0&&t.m.push(e),y(e,g);for(var n=e.first;n!==null;)pt(n,t),n=n.next}}function wt(e){y(e,g);for(var t=e.first;t!==null;)wt(t),t=t.next}function pn(e,t,n,r){const s=ge()?Ke:gn;var l=e.filter(_=>!_.settled);if(n.length===0&&l.length===0){r(t.map(s));return}var u=d,i=wn(),a=l.length===1?l[0].promise:l.length>1?Promise.all(l.map(_=>_.promise)):null;function o(_){i();try{r(_)}catch(p){(u.f&C)===0&&Re(p,u)}xe()}if(n.length===0){a.then(()=>o(t.map(s)));return}var f=yt();function c(){Promise.all(n.map(_=>yn(_))).then(_=>o([...t.map(s),..._])).catch(_=>Re(_,u)).finally(()=>f())}a?a.then(()=>{i(),c(),xe()}):c()}function wn(){var e=d,t=v,n=T,r=w;return function(l=!0){fe(e),G(t),Se(n),l&&(e.f&C)===0&&(r?.activate(),r?.apply())}}function xe(e=!0){fe(null),G(null),Se(null),e&&w?.deactivate()}function yt(){var e=d,t=e.b,n=w,r=t.is_rendered();return t.update_pending_count(1,n),n.increment(r,e),(s=!1)=>{t.update_pending_count(-1,n),n.decrement(r,e,s)}}function Ke(e){var t=E|b,n=v!==null&&(v.f&E)!==0?v:null;return d!==null&&(d.f|=ye),{ctx:T,deps:null,effects:null,equals:ct,f:t,fn:e,reactions:null,rv:0,v:m,wv:0,parent:n??d,ac:null}}function yn(e,t,n){let r=d;r===null&&Xt();var s=void 0,l=Xe(m),u=!v,i=new Map;return kn(()=>{var a=d,o=at();s=o.promise;try{Promise.resolve(e()).then(o.resolve,o.reject).finally(xe)}catch(p){o.reject(p),xe()}var f=w;if(u){if((a.f&re)!==0)var c=yt();if(r.b.is_rendered())i.get(f)?.reject(Y),i.delete(f);else{for(const p of i.values())p.reject(Y);i.clear()}i.set(f,o)}const _=(p,h=void 0)=>{if(c){var N=h===Y;c(N)}if(!(h===Y||(a.f&C)!==0)){if(f.activate(),h)l.f|=V,Ye(l,h);else{(l.f&V)!==0&&(l.f^=V),Ye(l,p);for(const[oe,me]of i){if(i.delete(oe),oe===f)break;me.reject(Y)}}f.deactivate()}};o.promise.then(_,p=>_(null,p||"unknown"))}),xn(()=>{for(const a of i.values())a.reject(Y)}),new Promise(a=>{function o(f){function c(){f===s?a(l):o(s)}f.then(c,c)}o(s)})}function vr(e){const t=Ke(e);return Pt(t),t}function gn(e){const t=Ke(e);return t.equals=_t,t}function En(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n0&&!mt&&Tn()}return t}function Tn(){mt=!1;for(const e of Le)(e.f&g)!==0&&y(e,F),Ee(e)&&ue(e);Le.clear()}function Ce(e){$(e,e.v+1)}function bt(e,t,n){var r=e.reactions;if(r!==null)for(var s=ge(),l=r.length,u=0;u{if(W===l)return i();var a=v,o=W;G(null),lt(l);var f=i();return G(a),lt(o),f};return r&&n.set("length",U(e.length)),new Proxy(e,{defineProperty(i,a,o){(!("value"in o)||o.configurable===!1||o.enumerable===!1||o.writable===!1)&&en();var f=n.get(a);return f===void 0?u(()=>{var c=U(o.value);return n.set(a,c),c}):$(f,o.value,!0),!0},deleteProperty(i,a){var o=n.get(a);if(o===void 0){if(a in i){const f=u(()=>U(m));n.set(a,f),Ce(s)}}else $(o,m),Ce(s);return!0},get(i,a,o){if(a===de)return e;var f=n.get(a),c=a in i;if(f===void 0&&(!c||ve(i,a)?.writable)&&(f=u(()=>{var p=ce(c?i[a]:m),h=U(p);return h}),n.set(a,f)),f!==void 0){var _=_e(f);return _===m?void 0:_}return Reflect.get(i,a,o)},getOwnPropertyDescriptor(i,a){var o=Reflect.getOwnPropertyDescriptor(i,a);if(o&&"value"in o){var f=n.get(a);f&&(o.value=_e(f))}else if(o===void 0){var c=n.get(a),_=c?.v;if(c!==void 0&&_!==m)return{enumerable:!0,configurable:!0,value:_,writable:!0}}return o},has(i,a){if(a===de)return!0;var o=n.get(a),f=o!==void 0&&o.v!==m||Reflect.has(i,a);if(o!==void 0||d!==null&&(!f||ve(i,a)?.writable)){o===void 0&&(o=u(()=>{var _=f?ce(i[a]):m,p=U(_);return p}),n.set(a,o));var c=_e(o);if(c===m)return!1}return f},set(i,a,o,f){var c=n.get(a),_=a in i;if(r&&a==="length")for(var p=o;pU(m)),n.set(p+"",h))}if(c===void 0)(!_||ve(i,a)?.writable)&&(c=u(()=>U(void 0)),$(c,ce(o)),n.set(a,c));else{_=c.v!==m;var N=u(()=>ce(o));$(c,N)}var oe=Reflect.getOwnPropertyDescriptor(i,a);if(oe?.set&&oe.set.call(f,o),!_){if(r&&typeof a=="string"){var me=n.get("length"),Ie=Number(a);Number.isInteger(Ie)&&Ie>=me.v&&$(me,Ie+1)}Ce(s)}return!0},ownKeys(i){_e(s);var a=Reflect.ownKeys(i).filter(c=>{var _=n.get(c);return _===void 0||_.v!==m});for(var[o,f]of n)f.v!==m&&!(o in i)&&a.push(o);return a},setPrototypeOf(){tn()}})}var rt,An,Sn,Tt,At;function hr(){if(rt===void 0){rt=window,An=document,Sn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Tt=ve(t,"firstChild").get,At=ve(t,"nextSibling").get,Je(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Je(n)&&(n.__t=void 0)}}function ke(e=""){return document.createTextNode(e)}function qe(e){return Tt.call(e)}function K(e){return At.call(e)}function pr(e,t){if(!ee)return qe(e);var n=qe(S);if(n===null)n=S.appendChild(ke());else if(t&&n.nodeType!==Ne){var r=ke();return n?.before(r),ae(r),r}return t&&Ze(n),ae(n),n}function wr(e,t=!1){if(!ee){var n=qe(e);return n instanceof Comment&&n.data===""?K(n):n}if(t){if(S?.nodeType!==Ne){var r=ke();return S?.before(r),ae(r),r}Ze(S)}return S}function yr(e,t=1,n=!1){let r=ee?S:e;for(var s;t--;)s=r,r=K(r);if(!ee)return r;if(n){if(r?.nodeType!==Ne){var l=ke();return r===null?s?.after(l):r.before(l),ae(l),l}Ze(r)}return ae(r),r}function gr(e){e.textContent=""}function Er(){return!1}function mr(e,t,n){return document.createElementNS(an,e,void 0)}function Ze(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===Ne;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function St(e){var t=v,n=d;G(null),fe(null);try{return e()}finally{G(t),fe(n)}}function Rt(e){d===null&&(v===null&&Jt(),Wt()),ne&&Zt()}function Rn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function j(e,t){var n=d;n!==null&&(n.f&P)!==0&&(e|=P);var r={ctx:T,deps:null,nodes:null,f:e|b|k,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};w?.register_created_effect(r);var s=r;if((e&ie)!==0)se!==null?se.push(r):z.ensure().schedule(r);else if(t!==null){try{ue(r)}catch(u){throw te(r),u}s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&ye)===0&&(s=s.first,(e&q)!==0&&(e&Ae)!==0&&s!==null&&(s.f|=Ae))}if(s!==null&&(s.parent=n,n!==null&&Rn(s,n),v!==null&&(v.f&E)!==0&&(e&J)===0)){var l=v;(l.effects??=[]).push(s)}return r}function xt(){return v!==null&&!I}function xn(e){const t=j(we,null);return y(t,g),t.teardown=e,t}function br(e){Rt();var t=d.f,n=!v&&(t&M)!==0&&(t&re)===0;if(n){var r=T;(r.e??=[]).push(e)}else return kt(e)}function kt(e){return j(ie|ut,e)}function Tr(e){return Rt(),j(we|ut,e)}function Ar(e){z.ensure();const t=j(J|ye,e);return(n={})=>new Promise(r=>{n.outro?Dn(t,()=>{te(t),r(void 0)}):(te(t),r(void 0))})}function Sr(e){return j(ie,e)}function kn(e){return j(Oe|ye,e)}function Rr(e,t=0){return j(we|t,e)}function xr(e,t=[],n=[],r=[]){pn(r,t,n,s=>{j(we,()=>e(...s.map(_e)))})}function kr(e,t=0){var n=j(q|t,e);return n}function Or(e){return j(M|ye,e)}function Ot(e){var t=e.teardown;if(t!==null){const n=ne,r=v;st(!0),G(null);try{t.call(null)}finally{st(n),G(r)}}}function We(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const s=n.ac;s!==null&&St(()=>{s.abort(Y)});var r=n.next;(n.f&J)!==0?n.parent=null:te(n,t),n=r}}function On(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&M)===0&&te(t),t=n}}function te(e,t=!0){var n=!1;(t||(e.f&$t)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(Nn(e.nodes.start,e.nodes.end),n=!0),y(e,Qe),We(e,t&&!n),pe(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const l of r)l.stop();Ot(e),e.f^=Qe,e.f|=C;var s=e.parent;s!==null&&s.first!==null&&Nt(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Nn(e,t){for(;e!==null;){var n=e===t?null:K(e);e.remove(),e=n}}function Nt(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Dn(e,t,n=!0){var r=[];Dt(e,r,!0);var s=()=>{n&&te(e),t&&t()},l=r.length;if(l>0){var u=()=>--l||s();for(var i of r)i.out(u)}else s()}function Dt(e,t,n){if((e.f&P)===0){e.f^=P;var r=e.nodes&&e.nodes.t;if(r!==null)for(const i of r)(i.is_global||n)&&t.push(i);for(var s=e.first;s!==null;){var l=s.next,u=(s.f&Ae)!==0||(s.f&M)!==0&&(e.f&q)!==0;Dt(s,t,u?n:!1),s=l}}}function Nr(e){It(e,!0)}function It(e,t){if((e.f&P)!==0){e.f^=P,(e.f&g)===0&&(y(e,b),z.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,s=(n.f&Ae)!==0||(n.f&M)!==0;It(n,s?t:!1),n=r}var l=e.nodes&&e.nodes.t;if(l!==null)for(const u of l)(u.is_global||t)&&u.in()}}function Dr(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var s=n===r?null:K(n);t.append(n),n=s}}let Te=!1,ne=!1;function st(e){ne=e}let v=null,I=!1;function G(e){v=e}let d=null;function fe(e){d=e}let O=null;function Pt(e){v!==null&&(O===null?O=[e]:O.push(e))}let A=null,R=0,x=null;function In(e){x=e}let Ct=1,Z=0,W=Z;function lt(e){W=e}function Mt(){return++Ct}function Ee(e){var t=e.f;if((t&b)!==0)return!0;if(t&E&&(e.f&=~Q),(t&F)!==0){for(var n=e.deps,r=n.length,s=0;se.wv)return!0}(t&k)!==0&&D===null&&y(e,g)}return!1}function Ft(e,t,n=!0){var r=e.reactions;if(r!==null&&!(O!==null&&le.call(O,e)))for(var s=0;s{e.ac.abort(Y)}),e.ac=null);try{e.f|=Fe;var f=e.fn,c=f();e.f|=re;var _=e.deps,p=w?.is_fork;if(A!==null){var h;if(p||pe(e,R),_!==null&&R>0)for(_.length=R+A.length,h=0;hi.map(i=>d[i]);
-import{h as I,i as G,g as H,E as W,j as J,k as K,l as X,n as D,ay as Z,f as z,C as O,N as Q,A as f,aG as $,au as ee,aH as te,U as re,O as se,u as ae,aI as ne,V as w,_ as oe,X as ce,aJ as p,Y as ie,Z as le,W as ue,aK as x}from"../chunks/w0kPbzMq.js";import{h as de,m as fe,u as me,s as he}from"../chunks/BcVkVDn_.js";import{a as P,c as A,f as V,t as _e}from"../chunks/mmStoiki.js";import{o as ve}from"../chunks/B43_79mg.js";import{B as ge,i as S}from"../chunks/C_B-Ij-b.js";import{p as T,b as j}from"../chunks/C6hdjiAW.js";function C(o,e,s){var l;I&&(l=z,G());var c=new ge(o);H(()=>{var t=e()??null;if(I){var r=J(l),a=r===Z,E=t!==null;if(a!==E){var m=K();X(m),c.anchor=m,D(!1),c.ensure(t,t&&(n=>s(n,t))),D(!0);return}}c.ensure(t,t&&(n=>s(n,t)))},W)}function ye(o){return class extends Ee{constructor(e){super({component:o,...e})}}}class Ee{#t;#e;constructor(e){var s=new Map,l=(t,r)=>{var a=te(r,!1,!1);return s.set(t,a),a};const c=new Proxy({...e.props||{},$$events:{}},{get(t,r){return f(s.get(r)??l(r,Reflect.get(t,r)))},has(t,r){return r===Q?!0:(f(s.get(r)??l(r,Reflect.get(t,r))),Reflect.has(t,r))},set(t,r,a){return O(s.get(r)??l(r,a),a),Reflect.set(t,r,a)}});this.#e=(e.hydrate?de:fe)(e.component,{target:e.target,anchor:e.anchor,props:c,context:e.context,intro:e.intro??!1,recover:e.recover,transformError:e.transformError}),(!e?.props?.$$host||e.sync===!1)&&$(),this.#t=c.$$events;for(const t of Object.keys(this.#e))t==="$set"||t==="$destroy"||t==="$on"||ee(this,t,{get(){return this.#e[t]},set(r){this.#e[t]=r},enumerable:!0});this.#e.$set=t=>{Object.assign(c,t)},this.#e.$destroy=()=>{me(this.#e)}}$set(e){this.#e.$set(e)}$on(e,s){this.#t[e]=this.#t[e]||[];const l=(...c)=>s.call(this,...c);return this.#t[e].push(l),()=>{this.#t[e]=this.#t[e].filter(c=>c!==l)}}$destroy(){this.#e.$destroy()}}const be="modulepreload",Pe=function(o,e){return new URL(o,e).href},M={},L=function(e,s,l){let c=Promise.resolve();if(s&&s.length>0){let m=function(n){return Promise.all(n.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const r=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),E=a?.nonce||a?.getAttribute("nonce");c=m(s.map(n=>{if(n=Pe(n,l),n in M)return;M[n]=!0;const d=n.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(l)for(let _=r.length-1;_>=0;_--){const i=r[_];if(i.href===n&&(!d||i.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${h}`))return;const u=document.createElement("link");if(u.rel=d?"stylesheet":be,d||(u.as="script"),u.crossOrigin="",u.href=n,E&&u.setAttribute("nonce",E),document.head.appendChild(u),d)return new Promise((_,i)=>{u.addEventListener("load",_),u.addEventListener("error",()=>i(new Error(`Unable to preload CSS for ${n}`)))})}))}function t(r){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=r,window.dispatchEvent(a),!a.defaultPrevented)throw r}return c.then(r=>{for(const a of r||[])a.status==="rejected"&&t(a.reason);return e().catch(t)})},Le={};var Re=V(''),ke=V(" ",1);function we(o,e){re(e,!0);let s=T(e,"components",23,()=>[]),l=T(e,"data_0",3,null),c=T(e,"data_1",3,null);se(()=>e.stores.page.set(e.page)),ae(()=>{e.stores,e.page,e.constructors,s(),e.form,l(),c(),e.stores.page.notify()});let t=p(!1),r=p(!1),a=p(null);ve(()=>{const i=e.stores.page.subscribe(()=>{f(t)&&(O(r,!0),ne().then(()=>{O(a,document.title||"untitled page",!0)}))});return O(t,!0),i});const E=x(()=>e.constructors[1]);var m=ke(),n=w(m);{var d=i=>{const v=x(()=>e.constructors[0]);var g=A(),R=w(g);C(R,()=>f(v),(y,b)=>{j(b(y,{get data(){return l()},get form(){return e.form},get params(){return e.page.params},children:(k,pe)=>{var N=A(),U=w(N);C(U,()=>f(E),(Y,q)=>{j(q(Y,{get data(){return c()},get form(){return e.form},get params(){return e.page.params}}),F=>s()[1]=F,()=>s()?.[1])}),P(k,N)},$$slots:{default:!0}}),k=>s()[0]=k,()=>s()?.[0])}),P(i,g)},h=i=>{const v=x(()=>e.constructors[0]);var g=A(),R=w(g);C(R,()=>f(v),(y,b)=>{j(b(y,{get data(){return l()},get form(){return e.form},get params(){return e.page.params}}),k=>s()[0]=k,()=>s()?.[0])}),P(i,g)};S(n,i=>{e.constructors[1]?i(d):i(h,-1)})}var u=oe(n,2);{var _=i=>{var v=Re(),g=ie(v);{var R=y=>{var b=_e();ue(()=>he(b,f(a))),P(y,b)};S(g,y=>{f(r)&&y(R)})}le(v),P(i,v)};S(u,i=>{f(t)&&i(_)})}P(o,m),ce()}const Ne=ye(we),Ie=[()=>L(()=>import("../nodes/0.D6CLfhqK.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url),()=>L(()=>import("../nodes/1.xyjmz21p.js"),__vite__mapDeps([7,1,2,5,8,9,10]),import.meta.url),()=>L(()=>import("../nodes/2.D4xyri_M.js"),__vite__mapDeps([11,1,2,10,8,4,3,12,5,13]),import.meta.url)],De=[],Me={"/":[2]},B={handleError:(({error:o})=>{console.error(o)}),reroute:(()=>{}),transport:{}},Oe=Object.fromEntries(Object.entries(B.transport).map(([o,e])=>[o,e.decode])),Ve=Object.fromEntries(Object.entries(B.transport).map(([o,e])=>[o,e.encode])),Be=!1,Ue=(o,e)=>Oe[o](e);export{Ue as decode,Oe as decoders,Me as dictionary,Ve as encoders,Be as hash,B as hooks,Le as matchers,Ie as nodes,Ne as root,De as server_loads};
diff --git a/.svelte-kit/output/client/_app/immutable/entry/app.CwuxgLSd.js b/.svelte-kit/output/client/_app/immutable/entry/app.CwuxgLSd.js
new file mode 100644
index 0000000..1c03b8c
--- /dev/null
+++ b/.svelte-kit/output/client/_app/immutable/entry/app.CwuxgLSd.js
@@ -0,0 +1,2 @@
+const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.Cq8Xsn4J.js","../chunks/DGbOEUpF.js","../chunks/CkzjbUDB.js","../chunks/DmyE0d-6.js","../chunks/CFYBLbZM.js","../chunks/B46dcLgj.js","../assets/0.DIlgUleF.css","../nodes/1.BfJAtU5y.js","../chunks/BsDbD4Ku.js","../chunks/C0nNmPgn.js","../chunks/DxGD2b0U.js","../nodes/2.DCJPxWEg.js","../chunks/XE2G8ySY.js","../chunks/D_t83wNY.js","../assets/FrogHeader.8kzFzgPu.css","../chunks/Dr80VTgO.js","../assets/2.CHt1yucP.css","../nodes/3.CW9t1woG.js","../assets/3.CjGf6tQE.css"])))=>i.map(i=>d[i]);
+import{j as I,F as U,l as z,E as H,G as W,I as X,t as Z,q as D,aF as J,k as K,B as O,X as Q,A as f,aN as $,x as ee,z as te,a1 as re,Y as se,Z as ae,aO as ne,a2 as k,a7 as oe,a4 as ce,ab as x,a5 as ie,a6 as le,a3 as ue,ac as A}from"../chunks/CkzjbUDB.js";import{h as de,m as fe,u as me,s as he}from"../chunks/BsDbD4Ku.js";import{a as P,c as S,f as F,t as _e}from"../chunks/DGbOEUpF.js";import{o as ve}from"../chunks/DxGD2b0U.js";import{p as T,i as j}from"../chunks/XE2G8ySY.js";import{B as ge}from"../chunks/CFYBLbZM.js";import{b as L}from"../chunks/Dr80VTgO.js";function C(o,e,s){var l;I&&(l=K,U());var c=new ge(o);z(()=>{var t=e()??null;if(I){var r=W(l),a=r===J,E=t!==null;if(a!==E){var m=X();Z(m),c.anchor=m,D(!1),c.ensure(t,t&&(n=>s(n,t))),D(!0);return}}c.ensure(t,t&&(n=>s(n,t)))},H)}function ye(o){return class extends Ee{constructor(e){super({component:o,...e})}}}class Ee{#t;#e;constructor(e){var s=new Map,l=(t,r)=>{var a=te(r,!1,!1);return s.set(t,a),a};const c=new Proxy({...e.props||{},$$events:{}},{get(t,r){return f(s.get(r)??l(r,Reflect.get(t,r)))},has(t,r){return r===Q?!0:(f(s.get(r)??l(r,Reflect.get(t,r))),Reflect.has(t,r))},set(t,r,a){return O(s.get(r)??l(r,a),a),Reflect.set(t,r,a)}});this.#e=(e.hydrate?de:fe)(e.component,{target:e.target,anchor:e.anchor,props:c,context:e.context,intro:e.intro??!1,recover:e.recover,transformError:e.transformError}),(!e?.props?.$$host||e.sync===!1)&&$(),this.#t=c.$$events;for(const t of Object.keys(this.#e))t==="$set"||t==="$destroy"||t==="$on"||ee(this,t,{get(){return this.#e[t]},set(r){this.#e[t]=r},enumerable:!0});this.#e.$set=t=>{Object.assign(c,t)},this.#e.$destroy=()=>{me(this.#e)}}$set(e){this.#e.$set(e)}$on(e,s){this.#t[e]=this.#t[e]||[];const l=(...c)=>s.call(this,...c);return this.#t[e].push(l),()=>{this.#t[e]=this.#t[e].filter(c=>c!==l)}}$destroy(){this.#e.$destroy()}}const be="modulepreload",Pe=function(o,e){return new URL(o,e).href},B={},w=function(e,s,l){let c=Promise.resolve();if(s&&s.length>0){let m=function(n){return Promise.all(n.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const r=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),E=a?.nonce||a?.getAttribute("nonce");c=m(s.map(n=>{if(n=Pe(n,l),n in B)return;B[n]=!0;const d=n.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(l)for(let _=r.length-1;_>=0;_--){const i=r[_];if(i.href===n&&(!d||i.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${h}`))return;const u=document.createElement("link");if(u.rel=d?"stylesheet":be,d||(u.as="script"),u.crossOrigin="",u.href=n,E&&u.setAttribute("nonce",E),document.head.appendChild(u),d)return new Promise((_,i)=>{u.addEventListener("load",_),u.addEventListener("error",()=>i(new Error(`Unable to preload CSS for ${n}`)))})}))}function t(r){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=r,window.dispatchEvent(a),!a.defaultPrevented)throw r}return c.then(r=>{for(const a of r||[])a.status==="rejected"&&t(a.reason);return e().catch(t)})},Ne={};var Re=F(''),pe=F(" ",1);function ke(o,e){re(e,!0);let s=T(e,"components",23,()=>[]),l=T(e,"data_0",3,null),c=T(e,"data_1",3,null);se(()=>e.stores.page.set(e.page)),ae(()=>{e.stores,e.page,e.constructors,s(),e.form,l(),c(),e.stores.page.notify()});let t=x(!1),r=x(!1),a=x(null);ve(()=>{const i=e.stores.page.subscribe(()=>{f(t)&&(O(r,!0),ne().then(()=>{O(a,document.title||"untitled page",!0)}))});return O(t,!0),i});const E=A(()=>e.constructors[1]);var m=pe(),n=k(m);{var d=i=>{const v=A(()=>e.constructors[0]);var g=S(),R=k(g);C(R,()=>f(v),(y,b)=>{L(b(y,{get data(){return l()},get form(){return e.form},get params(){return e.page.params},children:(p,Oe)=>{var N=S(),V=k(N);C(V,()=>f(E),(q,Y)=>{L(Y(q,{get data(){return c()},get form(){return e.form},get params(){return e.page.params}}),G=>s()[1]=G,()=>s()?.[1])}),P(p,N)},$$slots:{default:!0}}),p=>s()[0]=p,()=>s()?.[0])}),P(i,g)},h=i=>{const v=A(()=>e.constructors[0]);var g=S(),R=k(g);C(R,()=>f(v),(y,b)=>{L(b(y,{get data(){return l()},get form(){return e.form},get params(){return e.page.params}}),p=>s()[0]=p,()=>s()?.[0])}),P(i,g)};j(n,i=>{e.constructors[1]?i(d):i(h,-1)})}var u=oe(n,2);{var _=i=>{var v=Re(),g=ie(v);{var R=y=>{var b=_e();ue(()=>he(b,f(a))),P(y,b)};j(g,y=>{f(r)&&y(R)})}le(v),P(i,v)};j(u,i=>{f(t)&&i(_)})}P(o,m),ce()}const Ie=ye(ke),De=[()=>w(()=>import("../nodes/0.Cq8Xsn4J.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url),()=>w(()=>import("../nodes/1.BfJAtU5y.js"),__vite__mapDeps([7,1,2,5,8,9,10]),import.meta.url),()=>w(()=>import("../nodes/2.DCJPxWEg.js"),__vite__mapDeps([11,1,2,10,8,12,4,3,13,14,15,16]),import.meta.url),()=>w(()=>import("../nodes/3.CW9t1woG.js"),__vite__mapDeps([17,1,2,10,8,12,4,3,13,14,9,18]),import.meta.url)],Be=[],Fe={"/":[2],"/profile/[handle]":[3]},M={handleError:(({error:o})=>{console.error(o)}),reroute:(()=>{}),transport:{}},we=Object.fromEntries(Object.entries(M.transport).map(([o,e])=>[o,e.decode])),Me=Object.fromEntries(Object.entries(M.transport).map(([o,e])=>[o,e.encode])),Ve=!1,qe=(o,e)=>we[o](e);export{qe as decode,we as decoders,Fe as dictionary,Me as encoders,Ve as hash,M as hooks,Ne as matchers,De as nodes,Ie as root,Be as server_loads};
diff --git a/.svelte-kit/output/client/_app/immutable/entry/start.BUzUbSG3.js b/.svelte-kit/output/client/_app/immutable/entry/start.BUzUbSG3.js
new file mode 100644
index 0000000..db2c4c3
--- /dev/null
+++ b/.svelte-kit/output/client/_app/immutable/entry/start.BUzUbSG3.js
@@ -0,0 +1 @@
+import{l as o,a as r}from"../chunks/C0nNmPgn.js";export{o as load_css,r as start};
diff --git a/.svelte-kit/output/client/_app/immutable/entry/start.YsP-T6iU.js b/.svelte-kit/output/client/_app/immutable/entry/start.YsP-T6iU.js
deleted file mode 100644
index 40ed9e1..0000000
--- a/.svelte-kit/output/client/_app/immutable/entry/start.YsP-T6iU.js
+++ /dev/null
@@ -1 +0,0 @@
-import{l as o,a as r}from"../chunks/D9RahMPT.js";export{o as load_css,r as start};
diff --git a/.svelte-kit/output/client/_app/immutable/nodes/0.Cq8Xsn4J.js b/.svelte-kit/output/client/_app/immutable/nodes/0.Cq8Xsn4J.js
new file mode 100644
index 0000000..0dde594
--- /dev/null
+++ b/.svelte-kit/output/client/_app/immutable/nodes/0.Cq8Xsn4J.js
@@ -0,0 +1,7 @@
+import{a as s,f as r}from"../chunks/DGbOEUpF.js";import{a2 as f,aa as d,a7 as p}from"../chunks/CkzjbUDB.js";import{h as g,s as h}from"../chunks/DmyE0d-6.js";import"../chunks/B46dcLgj.js";const v=!0,m=!1,A=Object.freeze(Object.defineProperty({__proto__:null,prerender:v,ssr:m},Symbol.toStringTag,{value:"Module"}));var y=r('');function u(t){var o=y();s(t,o)}var F=r('
');function w(t){var o=F();s(t,o)}var _=r(` `,1),b=r(" ",1);function O(t,o){var e=b();g("12qhfyh",c=>{var n=_();d(8),s(c,n)});var a=f(e);u(a);var i=p(a,2);w(i);var l=p(i,2);h(l,()=>o.children),s(t,e)}export{O as component,A as universal};
diff --git a/.svelte-kit/output/client/_app/immutable/nodes/0.D6CLfhqK.js b/.svelte-kit/output/client/_app/immutable/nodes/0.D6CLfhqK.js
deleted file mode 100644
index 3110676..0000000
--- a/.svelte-kit/output/client/_app/immutable/nodes/0.D6CLfhqK.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import{a as o,f as c,d as v}from"../chunks/mmStoiki.js";import{W as g,Y as d,Z as x,aq as y,V as h,_ as n}from"../chunks/w0kPbzMq.js";import{s as u,h as B,a as A}from"../chunks/8u-mThFx.js";import"../chunks/DsupRLPE.js";import{i as F}from"../chunks/C_B-Ij-b.js";const _=!0,w=!1,z=Object.freeze(Object.defineProperty({__proto__:null,prerender:_,ssr:w},Symbol.toStringTag,{value:"Module"}));var b=c('');function k(l){var e=b();o(l,e)}var G=v('',1),Q=v('',1),M=c('');function m(l,e){var t=M(),s=d(t),a=d(s);{var p=r=>{var i=G();y(11),o(r,i)},f=r=>{var i=Q();y(10),o(r,i)};F(a,r=>{e.side==="left"?r(p):r(f,-1)})}x(s),x(t),g(()=>u(t,1,`plant-overlay ${e.side??""}`,"svelte-11afcec")),o(l,t)}var O=c(` `,1),j=c(" ",1);function T(l,e){var t=j();B("12qhfyh",r=>{var i=O();y(2),o(r,i)});var s=h(t);k(s);var a=n(s,2);m(a,{side:"left"});var p=n(a,2);m(p,{side:"right"});var f=n(p,2);A(f,()=>e.children),o(l,t)}export{T as component,z as universal};
diff --git a/.svelte-kit/output/client/_app/immutable/nodes/1.BfJAtU5y.js b/.svelte-kit/output/client/_app/immutable/nodes/1.BfJAtU5y.js
new file mode 100644
index 0000000..193c226
--- /dev/null
+++ b/.svelte-kit/output/client/_app/immutable/nodes/1.BfJAtU5y.js
@@ -0,0 +1 @@
+import{a as b,f as k}from"../chunks/DGbOEUpF.js";import"../chunks/B46dcLgj.js";import{c as x,Y as $,Z as i,u as y,_ as l,$ as A,A as v,a0 as E,U,a1 as Y,a2 as Z,a3 as j,a4 as q,a5 as u,a6 as m,a7 as w}from"../chunks/CkzjbUDB.js";import{s as _}from"../chunks/BsDbD4Ku.js";import{s as z,p as g}from"../chunks/C0nNmPgn.js";function B(r=!1){const e=x,t=e.l.u;if(!t)return;let a=()=>E(e.s);if(r){let o=0,s={};const f=U(()=>{let p=!1;const c=e.s;for(const n in c)c[n]!==s[n]&&(s[n]=c[n],p=!0);return p&&o++,o});a=()=>v(f)}t.b.length&&$(()=>{h(e,a),l(t.b)}),i(()=>{const o=y(()=>t.m.map(A));return()=>{for(const s of o)typeof s=="function"&&s()}}),t.a.length&&i(()=>{h(e,a),l(t.a)})}function h(r,e){if(r.l.s)for(const t of r.l.s)v(t);e()}const C={get error(){return g.error},get status(){return g.status}};z.updated.check;const d=C;var D=k("
",1);function K(r,e){Y(e,!1),B();var t=D(),a=Z(t),o=u(a,!0);m(a);var s=w(a,2),f=u(s,!0);m(s),j(()=>{_(o,d.status),_(f,d.error?.message)}),b(r,t),q()}export{K as component};
diff --git a/.svelte-kit/output/client/_app/immutable/nodes/1.xyjmz21p.js b/.svelte-kit/output/client/_app/immutable/nodes/1.xyjmz21p.js
deleted file mode 100644
index 8e2d141..0000000
--- a/.svelte-kit/output/client/_app/immutable/nodes/1.xyjmz21p.js
+++ /dev/null
@@ -1 +0,0 @@
-import{a as b,f as k}from"../chunks/mmStoiki.js";import"../chunks/DsupRLPE.js";import{o as x,O as $,u as i,t as y,Q as l,R as A,A as v,T as E,K,U as O,V as Q,W as R,X as T,Y as u,Z as m,_ as U}from"../chunks/w0kPbzMq.js";import{s as _}from"../chunks/BcVkVDn_.js";import{s as V,p as g}from"../chunks/D9RahMPT.js";function W(a=!1){const e=x,t=e.l.u;if(!t)return;let r=()=>E(e.s);if(a){let o=0,s={};const f=K(()=>{let c=!1;const p=e.s;for(const n in p)p[n]!==s[n]&&(s[n]=p[n],c=!0);return c&&o++,o});r=()=>v(f)}t.b.length&&$(()=>{h(e,r),l(t.b)}),i(()=>{const o=y(()=>t.m.map(A));return()=>{for(const s of o)typeof s=="function"&&s()}}),t.a.length&&i(()=>{h(e,r),l(t.a)})}function h(a,e){if(a.l.s)for(const t of a.l.s)v(t);e()}const X={get error(){return g.error},get status(){return g.status}};V.updated.check;const d=X;var Y=k("
",1);function B(a,e){O(e,!1),W();var t=Y(),r=Q(t),o=u(r,!0);m(r);var s=U(r,2),f=u(s,!0);m(s),R(()=>{_(o,d.status),_(f,d.error?.message)}),b(a,t),T()}export{B as component};
diff --git a/.svelte-kit/output/client/_app/immutable/nodes/2.D4xyri_M.js b/.svelte-kit/output/client/_app/immutable/nodes/2.D4xyri_M.js
deleted file mode 100644
index 3159a22..0000000
--- a/.svelte-kit/output/client/_app/immutable/nodes/2.D4xyri_M.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import{a as we,f as Fe}from"../chunks/mmStoiki.js";import{o as zn,a as $o}from"../chunks/B43_79mg.js";import{c as Xs,g as Go,h as ct,l as zs,a3 as Ko,i as Vo,A as H,j as Ho,ag as Yo,k as Lr,n as Qs,f as ns,a1 as Wo,aE as qo,ap as Rr,a as jo,aL as ht,b as Li,aM as Xo,s as zo,L as Qo,aN as Zo,aD as Xi,aO as Jo,aP as el,aH as tl,ac as br,aQ as sl,G as il,r as Qn,p as Zn,aR as Zs,aS as rl,aB as nl,m as al,d as ol,a2 as ll,aT as cl,aU as hl,aV as ul,aW as dl,aX as fl,U as Vs,Y as he,aq as Jn,Z as oe,_ as ye,W as Ze,X as Hs,u as gl,C as se,aJ as xe,B as ea,V as ml,aK as ta,v as pl,aY as yl}from"../chunks/w0kPbzMq.js";import{s as qe,d as sa,e as _r,a as Ps}from"../chunks/BcVkVDn_.js";import{i as It}from"../chunks/C_B-Ij-b.js";import{t as El,a as vl,s as Dr,h as Tl}from"../chunks/8u-mThFx.js";import{p as as,b as Ri}from"../chunks/C6hdjiAW.js";import"../chunks/DsupRLPE.js";function Sl(a,e,t){for(var s=[],i=e.length,r,n=e.length,o=0;o{if(r){if(r.pending.delete(u),r.done.add(u),r.pending.size===0){var d=a.outrogroups;bi(a,Xi(r.done)),d.delete(r),d.size===0&&(a.outrogroups=null)}}else n-=1},!1)}if(n===0){var c=s.length===0&&t!==null;if(c){var l=t,h=l.parentNode;nl(h),h.append(l),a.items.clear()}bi(a,e,!c)}else r={pending:new Set(e),done:new Set},(a.outrogroups??=new Set).add(r)}function bi(a,e,t=!0){var s;if(a.pending.size>0){s=new Set;for(const n of a.pending.values())for(const o of n)s.add(a.items.get(o).e)}for(var i=0;i{var v=t();return Zo(v)?v:v==null?[]:Xi(v)}),u,d=new Map,g=!0;function f(v){(E.effect.f&il)===0&&(E.pending.delete(v),E.fallback=l,Al(E,u,n,e,s),l!==null&&(u.length===0?(l.f&ht)===0?Qn(l):(l.f^=ht,Yt(l,null,n)):Zn(l,()=>{l=null})))}function p(v){E.pending.delete(v)}var y=Go(()=>{u=H(h);var v=u.length;let T=!1;if(ct){var x=Ho(n)===Yo;x!==(v===0)&&(n=Lr(),zs(n),Qs(!1),T=!0)}for(var S=new Set,R=jo,A=zo(),I=0;Ir(n)):(l=Li(()=>r(Cr??=Xs())),l.f|=ht)),v>S.size&&Xo(),ct&&v>0&&zs(Lr()),!g)if(d.set(R,S),A){for(const[w,U]of o)S.has(w)||R.skip_effect(U.e);R.oncommit(f),R.ondiscard(p)}else f(R);T&&Qs(!0),H(h)}),E={effect:y,items:o,pending:d,outrogroups:null,fallback:l};g=!1,ct&&(n=ns)}function Vt(a){for(;a!==null&&(a.f&rl)===0;)a=a.next;return a}function Al(a,e,t,s,i){var r=e.length,n=a.items,o=Vt(a.effect.first),c,l=null,h=[],u=[],d,g,f,p;for(p=0;p0){var A=r===0?t:null;Sl(a,S,A)}}}function Il(a,e,t,s,i,r,n,o){var c=(n&Jo)!==0?(n&el)===0?tl(t,!1,!1):br(t):null,l=(n&sl)!==0?br(i):null;return{v:c,i:l,e:Li(()=>(r(e,c??t,l??i,o),()=>{a.delete(s)}))}}function Yt(a,e,t){if(a.nodes)for(var s=a.nodes.start,i=a.nodes.end,r=e&&(e.f&ht)===0?e.nodes.start:t;s!==null;){var n=ll(s);if(r.before(s),s===i)return;s=n}}function ut(a,e,t){e===null?a.effect.first=t:e.next=t,t===null?a.effect.last=e:t.prev=e}function _i(a,e,t,s){var i=a.__style;if(ct||i!==e){var r=El(e);(!ct||r!==a.getAttribute("style"))&&(r==null?a.removeAttribute("style"):a.style.cssText=r),a.__style=e}return s}const Ll=Symbol("is custom element"),Rl=Symbol("is html"),bl=ul?"link":"LINK";function at(a,e,t,s){var i=_l(a);ct&&(i[e]=a.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&a.nodeName===bl)||i[e]!==(i[e]=t)&&(e==="loading"&&(a[cl]=t),t==null?a.removeAttribute(e):typeof t!="string"&&Dl(a).includes(e)?a[e]=t:a.setAttribute(e,t))}function _l(a){return a.__attributes??={[Ll]:a.nodeName.includes("-"),[Rl]:a.namespaceURI===hl}}var Pr=new Map;function Dl(a){var e=a.getAttribute("is")||a.nodeName,t=Pr.get(e);if(t)return t;Pr.set(e,t=[]);for(var s,i=a,r=Element.prototype;r!==i;){s=fl(i);for(var n in s)s[n].set&&t.push(n);i=dl(i)}return t}const Cl="https://iameli.com",Pl="did:plc:rbvrr34edl5ddpuwcubjiost",kl="place.stream.video",wl="https://vod-beta.stream.place/xrpc/place.stream.playback.getVideoPlaylist";async function Ol(a,e=20){const t=new URLSearchParams({repo:Pl,collection:kl,limit:String(e)});a&&t.set("cursor",a);const s=await fetch(`${Cl}/xrpc/com.atproto.repo.listRecords?${t}`);if(!s.ok)throw new Error(`Failed to fetch records: ${s.status}`);return s.json()}function ia(a){return`${wl}?uri=${encodeURIComponent(a)}`}function ra(a){const e=Math.floor(a/1e9),t=Math.floor(e/3600),s=Math.floor(e%3600/60),i=e%60;return t>0?`${t}:${String(s).padStart(2,"0")}:${String(i).padStart(2,"0")}`:`${s}:${String(i).padStart(2,"0")}`}function na(a){return new Date(a).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const Js=new Map;async function aa(a){if(Js.has(a))return Js.get(a);try{const e=await fetch(`https://plc.directory/${a}`);if(!e.ok)return a;const s=(await e.json()).alsoKnownAs?.[0],i=s?s.replace("at://","@"):a;return Js.set(a,i),i}catch{return a}}const ei=new Map;async function Fl(a){if(ei.has(a))return ei.get(a);try{const e=await fetch(`https://plc.directory/${a}`);if(!e.ok)return null;const i=(await e.json()).service?.find(r=>r.id==="#atproto_pds"||r.type==="AtprotoPersonalDataServer")?.serviceEndpoint??null;return i&&ei.set(a,i),i}catch{return null}}function Ml(a){const e=a.match(/^at:\/\/([^/]+)\/([^/]+)\/([^/]+)$/);return e?{repo:e[1],collection:e[2],rkey:e[3]}:null}const os=new Map;async function Nl(a){const e=a.value.livestream?.uri;if(!e)return null;if(os.has(e))return os.get(e);try{const t=Ml(e);if(!t)return null;const s=await Fl(t.repo);if(!s)return null;const i=new URLSearchParams({repo:t.repo,collection:t.collection,rkey:t.rkey}),r=await fetch(`${s}/xrpc/com.atproto.repo.getRecord?${i}`);if(!r.ok)return null;const o=(await r.json()).value?.thumb?.ref?.$link;if(!o)return null;const c=`${s}/xrpc/com.atproto.sync.getBlob?did=${encodeURIComponent(t.repo)}&cid=${encodeURIComponent(o)}`;return os.set(e,c),c}catch{return os.set(e,null),null}}const G=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},Bl=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=Ul},Ul=Number.MAX_SAFE_INTEGER||9007199254740991;let Y=(function(a){return a.NETWORK_ERROR="networkError",a.MEDIA_ERROR="mediaError",a.KEY_SYSTEM_ERROR="keySystemError",a.MUX_ERROR="muxError",a.OTHER_ERROR="otherError",a})({}),D=(function(a){return a.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",a.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",a.KEY_SYSTEM_NO_SESSION="keySystemNoSession",a.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",a.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",a.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",a.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",a.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",a.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",a.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",a.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",a.MANIFEST_LOAD_ERROR="manifestLoadError",a.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",a.MANIFEST_PARSING_ERROR="manifestParsingError",a.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",a.LEVEL_EMPTY_ERROR="levelEmptyError",a.LEVEL_LOAD_ERROR="levelLoadError",a.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",a.LEVEL_PARSING_ERROR="levelParsingError",a.LEVEL_SWITCH_ERROR="levelSwitchError",a.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",a.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",a.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",a.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",a.FRAG_LOAD_ERROR="fragLoadError",a.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",a.FRAG_DECRYPT_ERROR="fragDecryptError",a.FRAG_PARSING_ERROR="fragParsingError",a.FRAG_GAP="fragGap",a.REMUX_ALLOC_ERROR="remuxAllocError",a.KEY_LOAD_ERROR="keyLoadError",a.KEY_LOAD_TIMEOUT="keyLoadTimeOut",a.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",a.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",a.BUFFER_APPEND_ERROR="bufferAppendError",a.BUFFER_APPENDING_ERROR="bufferAppendingError",a.BUFFER_STALLED_ERROR="bufferStalledError",a.BUFFER_FULL_ERROR="bufferFullError",a.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",a.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",a.ASSET_LIST_LOAD_ERROR="assetListLoadError",a.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",a.ASSET_LIST_PARSING_ERROR="assetListParsingError",a.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",a.INTERNAL_EXCEPTION="internalException",a.INTERNAL_ABORTED="aborted",a.ATTACH_MEDIA_ERROR="attachMediaError",a.UNKNOWN="unknown",a})({}),m=(function(a){return a.MEDIA_ATTACHING="hlsMediaAttaching",a.MEDIA_ATTACHED="hlsMediaAttached",a.MEDIA_DETACHING="hlsMediaDetaching",a.MEDIA_DETACHED="hlsMediaDetached",a.MEDIA_ENDED="hlsMediaEnded",a.STALL_RESOLVED="hlsStallResolved",a.BUFFER_RESET="hlsBufferReset",a.BUFFER_CODECS="hlsBufferCodecs",a.BUFFER_CREATED="hlsBufferCreated",a.BUFFER_APPENDING="hlsBufferAppending",a.BUFFER_APPENDED="hlsBufferAppended",a.BUFFER_EOS="hlsBufferEos",a.BUFFERED_TO_END="hlsBufferedToEnd",a.BUFFER_FLUSHING="hlsBufferFlushing",a.BUFFER_FLUSHED="hlsBufferFlushed",a.MANIFEST_LOADING="hlsManifestLoading",a.MANIFEST_LOADED="hlsManifestLoaded",a.MANIFEST_PARSED="hlsManifestParsed",a.LEVEL_SWITCHING="hlsLevelSwitching",a.LEVEL_SWITCHED="hlsLevelSwitched",a.LEVEL_LOADING="hlsLevelLoading",a.LEVEL_LOADED="hlsLevelLoaded",a.LEVEL_UPDATED="hlsLevelUpdated",a.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",a.LEVELS_UPDATED="hlsLevelsUpdated",a.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",a.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",a.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",a.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",a.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",a.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",a.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",a.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",a.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",a.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",a.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",a.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",a.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",a.CUES_PARSED="hlsCuesParsed",a.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",a.INIT_PTS_FOUND="hlsInitPtsFound",a.FRAG_LOADING="hlsFragLoading",a.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",a.FRAG_LOADED="hlsFragLoaded",a.FRAG_DECRYPTED="hlsFragDecrypted",a.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",a.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",a.FRAG_PARSING_METADATA="hlsFragParsingMetadata",a.FRAG_PARSED="hlsFragParsed",a.FRAG_BUFFERED="hlsFragBuffered",a.FRAG_CHANGED="hlsFragChanged",a.FPS_DROP="hlsFpsDrop",a.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",a.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",a.ERROR="hlsError",a.DESTROYING="hlsDestroying",a.KEY_LOADING="hlsKeyLoading",a.KEY_LOADED="hlsKeyLoaded",a.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",a.BACK_BUFFER_REACHED="hlsBackBufferReached",a.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",a.ASSET_LIST_LOADING="hlsAssetListLoading",a.ASSET_LIST_LOADED="hlsAssetListLoaded",a.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",a.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",a.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",a.INTERSTITIAL_STARTED="hlsInterstitialStarted",a.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",a.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",a.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",a.INTERSTITIAL_ENDED="hlsInterstitialEnded",a.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",a.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",a.EVENT_CUE_ENTER="hlsEventCueEnter",a})({});var J={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},V={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class bt{constructor(e,t=0,s=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_=s}sample(e,t){const s=Math.pow(this.alpha_,e);this.estimate_=t*(1-s)+s*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class $l{constructor(e,t,s,i=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_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new bt(e),this.fast_=new bt(t),this.defaultTTFB_=i,this.ttfb_=new bt(e)}update(e,t){const{slow_:s,fast_:i,ttfb_:r}=this;s.halfLife!==e&&(this.slow_=new bt(e,s.getEstimate(),s.getTotalWeight())),i.halfLife!==t&&(this.fast_=new bt(t,i.getEstimate(),i.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new bt(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const s=8*t,i=e/1e3,r=s/i;this.fast_.sample(i,r),this.slow_.sample(i,r)}sampleTTFB(e){const t=e/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(s,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 Gl(a,e,t){return(e=Vl(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function ne(){return ne=Object.assign?Object.assign.bind():function(a){for(var e=1;e`):gt}function wr(a,e,t){return e[a]?e[a].bind(e):Yl(a,t)}const Ci=Di();function Wl(a,e,t){const s=Di();if(typeof console=="object"&&a===!0||typeof a=="object"){const i=["debug","log","info","warn","error"];i.forEach(r=>{s[r]=wr(r,a,t)});try{s.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch{return Di()}i.forEach(r=>{Ci[r]=wr(r,a)})}else ne(Ci,s);return s}const re=Ci;function Et(a=!0){return typeof self>"u"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function ql(a){return typeof self<"u"&&a===self.ManagedMediaSource}function oa(a,e){const t=Object.keys(a),s=Object.keys(e),i=t.length,r=s.length;return!i||!r||i===r&&!t.some(n=>s.indexOf(n)===-1)}function $e(a,e=!1){if(typeof TextDecoder<"u"){const l=new TextDecoder("utf-8").decode(a);if(e){const h=l.indexOf("\0");return h!==-1?l.substring(0,h):l}return l.replace(/\0/g,"")}const t=a.length;let s,i,r,n="",o=0;for(;o>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=String.fromCharCode(s);break;case 12:case 13:i=a[o++],n+=String.fromCharCode((s&31)<<6|i&63);break;case 14:i=a[o++],r=a[o++],n+=String.fromCharCode((s&15)<<12|(i&63)<<6|(r&63)<<0);break}}return n}function Le(a){let e="";for(let t=0;t1||i===1&&(t=this.levelkeys[s[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(!G(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return me(this)?(this._ref||(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){const t=this.levelkeys;if(t){var s;const i=t[e];i&&!((s=this._decryptdata)!=null&&s.keyId)&&(this._decryptdata=i.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,s,i,r,n=!1){const{elementaryStreams:o}=this,c=o[e];if(!c){o[e]={startPTS:t,endPTS:s,startDTS:i,endDTS:r,partial:n};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,s),c.startDTS=Math.min(c.startDTS,i),c.endDTS=Math.max(c.endDTS,r)}}class zl extends ca{constructor(e,t,s,i,r){super(s),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=i;const n=e.enumeratedString("BYTERANGE");n&&this.setByteRange(n,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function ha(a,e){const t=Object.getPrototypeOf(a);if(t){const s=Object.getOwnPropertyDescriptor(t,e);return s||ha(t,e)}}function Ql(a,e){const t=ha(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const Fr=Math.pow(2,32)-1,Zl=[].push,ua={video:1,audio:2,id3:3,text:4};function pe(a){return String.fromCharCode.apply(null,a)}function da(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function q(a,e){const t=fa(a,e);return t<0?4294967296+t:t}function Mr(a,e){let t=q(a,e);return t*=Math.pow(2,32),t+=q(a,e+4),t}function fa(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function Jl(a){const e=a.byteLength;for(let t=0;t8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=s>1?t+s:e}return!1}function Q(a,e){const t=[];if(!e.length)return t;const s=a.byteLength;for(let i=0;i1?i+r:s;if(n===e[0])if(e.length===1)t.push(a.subarray(i+8,o));else{const c=Q(a.subarray(i+8,o),e.slice(1));c.length&&Zl.apply(t,c)}i=o}return t}function ec(a){const e=[],t=a[0];let s=8;const i=q(a,s);s+=4;let r=0,n=0;t===0?(r=q(a,s),n=q(a,s+4),s+=8):(r=Mr(a,s),n=Mr(a,s+8),s+=16),s+=2;let o=a.length+n;const c=da(a,s);s+=2;for(let l=0;l>>31===1)return re.warn("SIDX has hierarchical references (not supported)"),null;const f=q(a,h);h+=4,e.push({referenceSize:d,subsegmentDuration:f,info:{duration:f/i,start:o,end:o+d-1}}),o+=d,h+=4,s=h}return{earliestPresentationTime:r,timescale:i,version:t,referencesCount:c,references:e}}function ga(a){const e=[],t=Q(a,["moov","trak"]);for(let i=0;i{const r=q(i,4),n=e[r];n&&(n.default={duration:q(i,12),flags:q(i,20)})}),e}function tc(a){const e=a.subarray(8),t=e.subarray(86),s=pe(e.subarray(4,8));let i=s,r;const n=s==="enca"||s==="encv";if(n){const l=Q(e,[s])[0].subarray(s==="enca"?28:78);Q(l,["sinf"]).forEach(u=>{const d=Q(u,["schm"])[0];if(d){const g=pe(d.subarray(4,8));if(g==="cbcs"||g==="cenc"){const f=Q(u,["frma"])[0];f&&(i=pe(f))}}})}const o=i;switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const c=Q(t,["avcC"])[0];c&&c.length>3&&(i+="."+cs(c[1])+cs(c[2])+cs(c[3]),r=ls(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=Q(e,[s])[0],l=Q(c.subarray(28),["esds"])[0];if(l&&l.length>7){let h=4;if(l[h++]!==3)break;h=ii(l,h),h+=2;const u=l[h++];if(u&128&&(h+=2),u&64&&(h+=l[h++]),l[h++]!==4)break;h=ii(l,h);const d=l[h++];if(d===64)i+="."+cs(d);else break;if(h+=12,l[h++]!==5)break;h=ii(l,h);const g=l[h++];let f=(g&248)>>3;f===31&&(f+=1+((g&7)<<3)+((l[h]&224)>>5)),i+="."+f}break}case"hvc1":case"hev1":{const c=Q(t,["hvcC"])[0];if(c&&c.length>12){const l=c[1],h=["","A","B","C"][l>>6],u=l&31,d=q(c,2),g=(l&32)>>5?"H":"L",f=c[12],p=c.subarray(6,12);i+="."+h+u,i+="."+sc(d).toString(16).toUpperCase(),i+="."+g+f;let y="";for(let E=p.length;E--;){const v=p[E];(v||y)&&(y="."+v.toString(16).toUpperCase()+y)}i+=y}r=ls(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{i=ls(i,t)||i;break}case"vp09":{const c=Q(t,["vpcC"])[0];if(c&&c.length>6){const l=c[4],h=c[5],u=c[6]>>4&15;i+="."+ze(l)+"."+ze(h)+"."+ze(u)}break}case"av01":{const c=Q(t,["av1C"])[0];if(c&&c.length>2){const l=c[1]>>>5,h=c[1]&31,u=c[2]>>>7?"H":"M",d=(c[2]&64)>>6,g=(c[2]&32)>>5,f=l===2&&d?g?12:10:d?10:8,p=(c[2]&16)>>4,y=(c[2]&8)>>3,E=(c[2]&4)>>2,v=c[2]&3;i+="."+l+"."+ze(h)+u+"."+ze(f)+"."+p+"."+y+E+v+"."+ze(1)+"."+ze(1)+"."+ze(1)+"."+0,r=ls("dav1",t)}break}}return{codec:i,encrypted:n,supplemental:r}}function ls(a,e){const t=Q(e,["dvvC"]),s=t.length?t[0]:Q(e,["dvcC"])[0];if(s){const i=s[2]>>1&127,r=s[2]<<5&32|s[3]>>3&31;return a+"."+ze(i)+"."+ze(r)}}function sc(a){let e=0;for(let t=0;t<32;t++)e|=(a>>t&1)<<31-t;return e>>>0}function ii(a,e){const t=e+5;for(;a[e++]&128&&e{const r=s.subarray(8,24);r.some(n=>n!==0)||(re.log(`[eme] Patching keyId in 'enc${i?"a":"v"}>sinf>>tenc' box: ${Le(r)} -> ${Le(t)}`),s.set(t,8))})}function rc(a){const e=[];return ma(a,t=>e.push(t.subarray(8,24))),e}function ma(a,e){Q(a,["moov","trak"]).forEach(s=>{const i=Q(s,["mdia","minf","stbl","stsd"])[0];if(!i)return;const r=i.subarray(8);let n=Q(r,["enca"]);const o=n.length>0;o||(n=Q(r,["encv"])),n.forEach(c=>{const l=o?c.subarray(28):c.subarray(78);Q(l,["sinf"]).forEach(u=>{const d=pa(u);d&&e(d,o)})})})}function pa(a){const e=Q(a,["schm"])[0];if(e){const t=pe(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const s=Q(a,["schi","tenc"])[0];if(s)return s}}}function nc(a,e,t){const s={},i=Q(a,["moof","traf"]);for(let r=0;rs[r].duration)){let r=1/0,n=0;const o=Q(a,["sidx"]);for(let c=0;cu+d.info.duration||0,0);n=Math.max(n,h+l.earliestPresentationTime/l.timescale)}}n&&G(n)&&Object.keys(s).forEach(c=>{s[c].duration||(s[c].duration=n*s[c].timescale-s[c].start)})}return s}function ac(a){const e={valid:null,remainder:null},t=Q(a,["moof"]);if(t.length<2)return e.remainder=a,e;const s=t[t.length-1];return e.valid=a.slice(0,s.byteOffset-8),e.remainder=a.slice(s.byteOffset-8),e}function Ke(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function Nr(a,e){const t=[],s=e.samples,i=e.timescale,r=e.id;let n=!1;return Q(s,["moof"]).map(c=>{const l=c.byteOffset-8;Q(c,["traf"]).map(u=>{const d=Q(u,["tfdt"]).map(g=>{const f=g[0];let p=q(g,4);return f===1&&(p*=Math.pow(2,32),p+=q(g,8)),p/i})[0];return d!==void 0&&(a=d),Q(u,["tfhd"]).map(g=>{const f=q(g,4),p=q(g,0)&16777215,y=(p&1)!==0,E=(p&2)!==0,v=(p&8)!==0;let T=0;const x=(p&16)!==0;let S=0;const R=(p&32)!==0;let A=8;f===r&&(y&&(A+=8),E&&(A+=4),v&&(T=q(g,A),A+=4),x&&(S=q(g,A),A+=4),R&&(A+=4),e.type==="video"&&(n=Ys(e.codec)),Q(u,["trun"]).map(I=>{const b=I[0],L=q(I,0)&16777215,C=(L&1)!==0;let w=0;const U=(L&4)!==0,F=(L&256)!==0;let N=0;const k=(L&512)!==0;let $=0;const B=(L&1024)!==0,K=(L&2048)!==0;let W=0;const M=q(I,4);let O=8;C&&(w=q(I,O),O+=4),U&&(O+=4);let X=w+l;for(let te=0;te>1&63;return t===39||t===40}else return(e&31)===6}function Zi(a,e,t,s){const i=ya(a);let r=0;r+=e;let n=0,o=0,c=0;for(;r=i.length)break;c=i[r++],n+=c}while(c===255);o=0;do{if(r>=i.length)break;c=i[r++],o+=c}while(c===255);const l=i.length-r;let h=r;if(ol){re.error(`Malformed SEI payload. ${o} is too small, only ${l} bytes left to parse.`);break}if(n===4){if(i[h++]===181){const d=da(i,h);if(h+=2,d===49){const g=q(i,h);if(h+=4,g===1195456820){const f=i[h++];if(f===3){const p=i[h++],y=31&p,E=64&p,v=E?2+y*3:0,T=new Uint8Array(v);if(E){T[0]=p;for(let x=1;x16){const u=[];for(let f=0;f<16;f++){const p=i[h++].toString(16);u.push(p.length==1?"0"+p:p),(f===3||f===5||f===7||f===9)&&u.push("-")}const d=o-16,g=new Uint8Array(d);for(let f=0;f>24&255,r[1]=s>>16&255,r[2]=s>>8&255,r[3]=s&255,r.set(a,4),i=0,s=8;i0?(r=new Uint8Array(4),e.length>0&&new DataView(r.buffer).setUint32(0,e.length,!1)):r=new Uint8Array;const n=new Uint8Array(4);return t.byteLength>0&&new DataView(n.buffer).setUint32(0,t.byteLength,!1),cc([112,115,115,104],new Uint8Array([s,0,0,0]),a,r,i,n,t)}function uc(a){const e=[];if(a instanceof ArrayBuffer){const t=a.byteLength;let s=0;for(;s+32>>24;if(r!==0&&r!==1)return{offset:t,size:e};const n=a.buffer,o=Le(new Uint8Array(n,t+12,16));let c=null,l=null,h=0;if(r===0)h=28;else{const d=a.getUint32(28);if(!d||s<32+d*16)return{offset:t,size:e};c=[];for(let g=0;g/\(Windows.+Firefox\//i.test(navigator.userAgent),Bt={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 Ji(a,e){const t=Bt[e];return!!t&&!!t[a.slice(0,4)]}function zt(a,e,t=!0){return!a.split(",").some(s=>!er(s,e,t))}function er(a,e,t=!0){var s;const i=Et(t);return(s=i?.isTypeSupported(Qt(a,e)))!=null?s:!1}function Qt(a,e){return`${e}/mp4;codecs=${a}`}function Br(a){if(a){const e=a.substring(0,4);return Bt.video[e]}return 2}function ks(a){const e=Ea();return a.split(",").reduce((t,s)=>{const r=e&&Ys(s)?9:Bt.video[s];return r?(r*2+t)/(t?3:2):(Bt.audio[s]+t)/(t?2:1)},0)}const ri={};function fc(a,e=!0){if(ri[a])return ri[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[a];for(let i=0;ifc(t.toLowerCase(),e))}function mc(a,e){const t=[];if(a){const s=a.split(",");for(let i=0;i4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1)&&(Ur(a,"audio")||Ur(a,"video")))return a;if(e){const t=e.split(",");if(t.length>1){if(a){for(let s=t.length;s--;)if(t[s].substring(0,4)===a.substring(0,4))return t[s]}return t[0]}}return e||a}function Ur(a,e){return Ji(a,e)&&er(a,e)}function pc(a){const e=a.split(",");for(let t=0;t2&&s[0]==="avc1"&&(e[t]=`avc1.${parseInt(s[1]).toString(16)}${("000"+parseInt(s[2]).toString(16)).slice(-4)}`)}return e.join(",")}function yc(a){if(a.startsWith("av01.")){const e=a.split("."),t=["0","111","01","01","01","0"];for(let s=e.length;s>4&&s<10;s++)e[s]=t[s-4];return e.join(".")}return a}function $r(a){const e=Et(a)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Pi(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Ec={supported:!0,powerEfficient:!0,smooth:!0},vc={supported:!1,smooth:!1,powerEfficient:!1},va={supported:!0,configurations:[],decodingInfoResults:[Ec]};function Ta(a,e){return{supported:!1,configurations:e,decodingInfoResults:[vc],error:a}}function Tc(a,e,t,s,i,r){const n=a.videoCodec,o=a.audioCodec?a.audioGroups:null,c=r?.audioCodec,l=r?.channels,h=l?parseInt(l):c?1/0:2;let u=null;if(o!=null&&o.length)try{o.length===1&&o[0]?u=e.groups[o[0]].channels:u=o.reduce((d,g)=>{if(g){const f=e.groups[g];if(!f)throw new Error(`Audio track group ${g} not found`);Object.keys(f.channels).forEach(p=>{d[p]=(d[p]||0)+f.channels[p]})}return d},{2:0})}catch{return!0}return n!==void 0&&(n.split(",").some(d=>Ys(d))||a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(s,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(i,8e6))||!!u&&G(h)&&Object.keys(u).some(d=>parseInt(d)>h)}function Sa(a,e,t,s={}){const i=a.videoCodec;if(!i&&!a.audioCodec||!t)return Promise.resolve(va);const r=[],n=Sc(a),o=n.length,c=xc(a,e,o>0),l=c.length;for(let h=o||1*l||1;h--;){const u={type:"media-source"};if(o&&(u.video=n[h%o]),l){u.audio=c[h%l];const d=u.audio.bitrate;u.video&&d&&(u.video.bitrate-=d)}r.push(u)}if(i){const h=navigator.userAgent;if(i.split(",").some(u=>Ys(u))&&Ea())return Promise.resolve(Ta(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${h})`),r))}return Promise.all(r.map(h=>{const u=Ic(h);return s[u]||(s[u]=t.decodingInfo(h))})).then(h=>({supported:!h.some(u=>!u.supported),configurations:r,decodingInfoResults:h})).catch(h=>({supported:!1,configurations:r,decodingInfoResults:[],error:h}))}function Sc(a){var e;const t=(e=a.videoCodec)==null?void 0:e.split(","),s=xa(a),i=a.width||640,r=a.height||480,n=a.frameRate||30,o=a.videoRange.toLowerCase();return t?t.map(c=>{const l={contentType:Qt(yc(c),"video"),width:i,height:r,bitrate:s,framerate:n};return o!=="sdr"&&(l.transferFunction=o),l}):[]}function xc(a,e,t){var s;const i=(s=a.audioCodec)==null?void 0:s.split(","),r=xa(a);return i&&a.audioGroups?a.audioGroups.reduce((n,o)=>{var c;const l=o?(c=e.groups[o])==null?void 0:c.tracks:null;return l?l.reduce((h,u)=>{if(u.groupId===o){const d=parseFloat(u.channels||"");i.forEach(g=>{const f={contentType:Qt(g,"audio"),bitrate:t?Ac(g,r):r};d&&(f.channels=""+d),h.push(f)})}return h},n):n},[]):[]}function Ac(a,e){if(e<=1)return 1;let t=128e3;return a==="ec-3"?t=768e3:a==="ac-3"&&(t=64e4),Math.min(e/2,t)}function xa(a){return Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)/1e3)*1e3||1}function Ic(a){let e="";const{audio:t,video:s}=a;if(s){const i=Pi(s.contentType);e+=`${i}_r${s.height}x${s.width}f${Math.ceil(s.framerate)}${s.transferFunction||"sd"}_${Math.ceil(s.bitrate/1e5)}`}if(t){const i=Pi(t.contentType);e+=`${s?"_":""}${i}_c${t.channels}`}return e}const ki=["NONE","TYPE-0","TYPE-1",null];function Lc(a){return ki.indexOf(a)>-1}const Os=["SDR","PQ","HLG"];function Rc(a){return!!a&&Os.indexOf(a)>-1}var Is={No:"",Yes:"YES",v2:"v2"};function Gr(a){const{canSkipUntil:e,canSkipDateRanges:t,age:s}=a,i=s!!s).map(s=>s.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const s=(t=e.supplemental)==null?void 0:t.videoCodec;s&&s!==e.videoCodec&&(this.codecSet+=`,${s.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 Vr(this._audioGroups,e)}hasSubtitleGroup(e){return Vr(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(t)===-1&&s.push(t)}else if(e==="text"){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(t)===-1&&s.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(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function Vr(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function bc(){if(typeof matchMedia=="function"){const a=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(a.media!==e.media)return a.matches===!0}return!1}function _c(a,e){let t=!1,s=[];if(a&&(t=a!=="SDR",s=[a]),e){s=e.allowedVideoRanges||Os.slice(0);const i=s.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:i&&bc(),t||(s=["SDR"])}return{preferHDR:t,allowedVideoRanges:s}}const Dc=a=>{const e=new WeakSet;return(t,s)=>{if(a&&(s=a(t,s)),typeof s=="object"&&s!==null){if(e.has(s))return;e.add(s)}return s}},ce=(a,e)=>JSON.stringify(a,Dc(e));function Cc(a,e,t,s,i){const r=Object.keys(a),n=s?.channels,o=s?.audioCodec,c=i?.videoCodec,l=n&&parseInt(n)===2;let h=!1,u=!1,d=1/0,g=1/0,f=1/0,p=1/0,y=0,E=[];const{preferHDR:v,allowedVideoRanges:T}=_c(e,i);for(let I=r.length;I--;){const b=a[r[I]];h||(h=b.channels[2]>0),d=Math.min(d,b.minHeight),g=Math.min(g,b.minFramerate),f=Math.min(f,b.minBitrate),T.filter(C=>b.videoRanges[C]>0).length>0&&(u=!0)}d=G(d)?d:0,g=G(g)?g:0;const x=Math.max(1080,d),S=Math.max(30,g);f=G(f)?f:t,t=Math.max(f,t),u||(e=void 0);const R=r.length>1;return{codecSet:r.reduce((I,b)=>{const L=a[b];if(b===I)return I;if(E=u?T.filter(C=>L.videoRanges[C]>0):[],R){if(L.minBitrate>t)return je(b,`min bitrate of ${L.minBitrate} > current estimate of ${t}`),I;if(!L.hasDefaultAudio)return je(b,"no renditions with default or auto-select sound found"),I;if(o&&b.indexOf(o.substring(0,4))%5!==0)return je(b,`audio codec preference "${o}" not found`),I;if(n&&!l){if(!L.channels[n])return je(b,`no renditions with ${n} channel sound found (channels options: ${Object.keys(L.channels)})`),I}else if((!o||l)&&h&&L.channels[2]===0)return je(b,"no renditions with stereo sound found"),I;if(L.minHeight>x)return je(b,`min resolution of ${L.minHeight} > maximum of ${x}`),I;if(L.minFramerate>S)return je(b,`min framerate of ${L.minFramerate} > maximum of ${S}`),I;if(!E.some(C=>L.videoRanges[C]>0))return je(b,`no variants with VIDEO-RANGE of ${ce(E)} found`),I;if(c&&b.indexOf(c.substring(0,4))%5!==0)return je(b,`video codec preference "${c}" not found`),I;if(L.maxScore=ks(I)||L.fragmentError>a[I].fragmentError)?I:(p=L.minIndex,y=L.maxScore,b)},void 0),videoRanges:E,preferHDR:v,minFramerate:g,minBitrate:f,minIndex:p}}function je(a,e){re.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function Aa(a){return a.reduce((e,t)=>{let s=e.groups[t.groupId];s||(s=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(t);const i=t.channels||"2";return s.channels[i]=(s.channels[i]||0)+1,s.hasDefault=s.hasDefault||t.default,s.hasAutoSelect=s.hasAutoSelect||t.autoselect,s.hasDefault&&(e.hasDefaultAudio=!0),s.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Pc(a,e,t,s){return a.slice(t,s+1).reduce((i,r,n)=>{if(!r.codecSet)return i;const o=r.audioGroups;let c=i[r.codecSet];c||(i[r.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:n,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,r.bitrate);const l=Math.min(r.height,r.width);return c.minHeight=Math.min(c.minHeight,l),c.minFramerate=Math.min(c.minFramerate,r.frameRate),c.minIndex=Math.min(c.minIndex,n),c.maxScore=Math.max(c.maxScore,r.score),c.fragmentError+=r.fragmentError,c.videoRanges[r.videoRange]=(c.videoRanges[r.videoRange]||0)+1,o&&o.forEach(h=>{if(!h)return;const u=e.groups[h];u&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?u.hasDefault:u.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(u.channels).forEach(d=>{c.channels[d]=(c.channels[d]||0)+u.channels[d]}))}),i},{})}function Hr(a){if(!a)return a;const{lang:e,assocLang:t,characteristics:s,channels:i,audioCodec:r}=a;return{lang:e,assocLang:t,characteristics:s,channels:i,audioCodec:r}}function Je(a,e,t){if("attrs"in a){const s=e.indexOf(a);if(s!==-1)return s}for(let s=0;ss.indexOf(i)===-1)}function At(a,e){const{audioCodec:t,channels:s}=a;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(s===void 0||s===(e.channels||"2"))}function Oc(a,e,t,s,i){const r=e[s],o=e.reduce((d,g,f)=>{const p=g.uri;return(d[p]||(d[p]=[])).push(f),d},{})[r.uri];o.length>1&&(s=Math.max.apply(Math,o));const c=r.videoRange,l=r.frameRate,h=r.codecSet.substring(0,4),u=Yr(e,s,d=>{if(d.videoRange!==c||d.frameRate!==l||d.codecSet.substring(0,4)!==h)return!1;const g=d.audioGroups,f=t.filter(p=>!g||g.indexOf(p.groupId)!==-1);return Je(a,f,i)>-1});return u>-1?u:Yr(e,s,d=>{const g=d.audioGroups,f=t.filter(p=>!g||g.indexOf(p.groupId)!==-1);return Je(a,f,i)>-1})}function Yr(a,e,t){for(let s=e;s>-1;s--)if(t(a[s]))return s;for(let s=e+1;s{var s;const{fragCurrent:i,partCurrent:r,hls:n}=this,{autoLevelEnabled:o,media:c}=n;if(!i||!c)return;const l=performance.now(),h=r?r.stats:i.stats,u=r?r.duration:i.duration,d=l-h.loading.start,g=n.minAutoLevel,f=i.level,p=this._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||f<=g){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const y=p>-1&&p!==f,E=!!t||y;if(!E&&(c.paused||!c.playbackRate||!c.readyState))return;const v=n.mainForwardBufferInfo;if(!E&&v===null)return;const T=this.bwEstimator.getEstimateTTFB(),x=Math.abs(c.playbackRate);if(d<=Math.max(T,1e3*(u/(x*2))))return;const S=v?v.len/x:0,R=h.loading.first?h.loading.first-h.loading.start:-1,A=h.loaded&&R>-1,I=this.getBwEstimate(),b=n.levels,L=b[f],C=Math.max(h.loaded,Math.round(u*(i.bitrate||L.averageBitrate)/8));let w=A?d-R:d;w<1&&A&&(w=Math.min(d,h.loaded*8/I));const U=A?h.loaded*1e3/w:0,F=T/1e3,N=U?(C-h.loaded)/U:C*8/I+F;if(N<=S)return;const k=U?U*8:I,$=((s=t?.details||this.hls.latestLevelDetails)==null?void 0:s.live)===!0,B=this.hls.config.abrBandWidthUpFactor;let K=Number.POSITIVE_INFINITY,W;for(W=f-1;W>g;W--){const te=b[W].maxBitrate,z=!b[W].details||$;if(K=this.getTimeToLoadFrag(F,k,u*te,z),K=N||K>u*10)return;A?this.bwEstimator.sample(d-Math.min(T,R),h.loaded):this.bwEstimator.sampleTTFB(d);const M=b[W].maxBitrate;this.getBwEstimate()*B>M&&this.resetEstimator(M);const O=this.findBestLevel(M,g,W,0,S,1,1);O>-1&&(W=O),this.warn(`Fragment ${i.sn}${r?" part "+r.index:""} of level ${f} is loading too slowly;
- Fragment duration: ${i.duration.toFixed(3)}
- Time to underbuffer: ${S.toFixed(3)} s
- Estimated load time for current fragment: ${N.toFixed(3)} s
- Estimated load time for down switch fragment: ${K.toFixed(3)} s
- TTFB estimate: ${R|0} ms
- Current BW estimate: ${G(I)?I|0:"Unknown"} bps
- New BW estimate: ${this.getBwEstimate()|0} bps
- Switching to level ${W} @ ${M|0} bps`),n.nextLoadLevel=n.nextAutoLevel=W,this.clearTimer();const X=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===W&&W>0){const te=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${W>0?"and switching down":""}
- Fragment duration: ${i.duration.toFixed(3)} s
- Time to underbuffer: ${te.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,W>g){let z=this.findBestLevel(this.hls.levels[g].bitrate,g,W,0,te,1,1);z===-1&&(z=g),this.hls.nextLoadLevel=this.hls.nextAutoLevel=z,this.resetEstimator(this.hls.levels[z].bitrate)}}};y||N>K*2?X():this.timer=self.setInterval(X,K*1e3),n.trigger(m.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:r,stats:h})},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(){const e=this.hls.config;return new $l(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.FRAG_LOADING,this.onFragLoading,this),e.on(m.FRAG_LOADED,this.onFragLoaded,this),e.on(m.FRAG_BUFFERED,this.onFragBuffered,this),e.on(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(m.LEVEL_LOADED,this.onLevelLoaded,this),e.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(m.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.FRAG_LOADING,this.onFragLoading,this),e.off(m.FRAG_LOADED,this.onFragLoaded,this),e.off(m.FRAG_BUFFERED,this.onFragBuffered,this),e.off(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(m.LEVEL_LOADED,this.onLevelLoaded,this),e.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(m.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(m.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){const s=t.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var i;this.fragCurrent=s,this.partCurrent=(i=t.part)!=null?i: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 D.BUFFER_ADD_CODEC_ERROR:case D.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case D.FRAG_LOAD_TIMEOUT:{const s=t.frag,{fragCurrent:i,partCurrent:r}=this;if(s&&i&&s.sn===i.sn&&s.level===i.level){const n=performance.now(),o=r?r.stats:s.stats,c=n-o.loading.start,l=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&l>-1){const u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(u,l),o.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,t,s,i){const r=e+s/t,n=i?e+this.lastLevelLoadSec:0;return r+n}onLevelLoaded(e,t){const s=this.hls.config,{loading:i}=t.stats,r=i.end-i.first;G(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:s}){const i=s?s.stats:t.stats;if(t.type===V.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const r=s?s.duration:t.duration,n=this.hls.levels[t.level],o=(n.loaded?n.loaded.bytes:0)+i.loaded,c=(n.loaded?n.loaded.duration:0)+r;n.loaded={bytes:o,duration:c},n.realBitrate=Math.round(8*o/c)}if(t.bitrateTest){const r={stats:i,frag:t,part:s,id:t.type};this.onFragBuffered(m.FRAG_BUFFERED,r),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:s,part:i}=t,r=i!=null&&i.stats.loaded?i.stats:s.stats;if(r.aborted||this.ignoreFragment(s))return;const n=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(n,r.loaded),r.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=n/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==V.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,s=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,r=this.findBestLevel(s,t,e,0,i,1,1);if(r>-1)return r;const n=this.hls.firstLevel,o=Math.min(Math.max(n,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${n} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!s||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const r=s&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const n=this.hls.levels;if(n.length>Math.max(e,r)&&n[e].loadError<=n[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:s}=this;if(s.levels.length<=1)return s.loadLevel;const{maxAutoLevel:i,config:r,minAutoLevel:n}=s,o=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),l=this.getStarvationDelay();let h=r.abrBandWidthFactor,u=r.abrBandWidthUpFactor;if(l){const y=this.findBestLevel(c,n,i,l,0,h,u);if(y>=0)return this.rebufferNotice=-1,y}let d=o?Math.min(o,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){const y=this.bitrateTestDelay;y&&(d=(o?Math.min(o,r.maxLoadingDelay):r.maxLoadingDelay)-y,this.info(`bitrate test took ${Math.round(1e3*y)}ms, set first fragment max fetchDuration to ${Math.round(1e3*d)} ms`),h=u=1)}const g=this.findBestLevel(c,n,i,l,d,h,u);if(this.rebufferNotice!==g&&(this.rebufferNotice=g,this.info(`${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${g}`)),g>-1)return g;const f=s.levels[n],p=s.loadLevelObj;return p&&f?.bitrate=t;k--){var N;const $=f[k],B=k>u;if(!$)continue;if(E.useMediaCapabilities&&!$.supportedResult&&!$.supportedPromise){const z=navigator.mediaCapabilities;typeof z?.decodingInfo=="function"&&Tc($,L,R,A,e,I)?($.supportedPromise=Sa($,L,z,this.supportedCache),$.supportedPromise.then(Z=>{if(!this.hls)return;$.supportedResult=Z;const ve=this.hls.levels,ge=ve.indexOf($);Z.error?this.warn(`MediaCapabilities decodingInfo error: "${Z.error}" for level ${ge} ${ce(Z)}`):Z.supported?Z.decodingInfoResults.some(_e=>_e.smooth===!1||_e.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${ge} not smooth or powerEfficient: ${ce(Z)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${ge} ${ce(Z)}`),ge>-1&&ve.length>1&&(this.log(`Removing unsupported level ${ge}`),this.hls.removeLevel(ge),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(Z=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${Z}`)})):$.supportedResult=va}if((S&&$.codecSet!==S||R&&$.videoRange!==R||B&&A>$.frameRate||!B&&A>0&&A<$.frameRate||(N=$.supportedResult)!=null&&(N=N.decodingInfoResults)!=null&&N.some(z=>z.smooth===!1))&&(!x||k!==C)){F.push(k);continue}const K=$.details,W=(g?K?.partTarget:K?.averagetargetduration)||w;let M;B?M=o*e:M=n*e;const O=w&&i>=w*2&&r===0?$.averageBitrate:$.maxBitrate,X=this.getTimeToLoadFrag(U,M,O*W,K===void 0);if(M>=O&&(k===h||$.loadError===0&&$.fragmentError===0)&&(X<=U||!G(X)||T&&!this.bitrateTestDelay||X${k} adjustedbw(${Math.round(M)})-bitrate=${Math.round(M-O)} ttfb:${U.toFixed(1)} avgDuration:${W.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${X.toFixed(1)} firstSelection:${x} codecSet:${$.codecSet} videoRange:${$.videoRange} hls.loadLevel:${y}`)),x&&(this.firstSelection=k),k}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:s}=this.hls;return Math.min(Math.max(e,s),t)}}const Ia={search:function(a,e){let t=0,s=a.length-1,i=null,r=null;for(;t<=s;){i=(t+s)/2|0,r=a[i];const n=e(r);if(n>0)t=i+1;else if(n<0)s=i-1;else return r}return null}};function Mc(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!G(e))return null;const s=a[0].programDateTime;if(e<(s||0))return null;const i=a[a.length-1].endProgramDateTime;if(e>=(i||0))return null;for(let r=0;r0&&o<15e-7&&(t+=15e-7),r&&a.level!==r.level&&r.end<=a.end&&(r=e[2+a.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&((!a||a.level===r.level)&&Wr(t,s,r)===0||Nc(r,a,Math.min(i,s))))return r;const n=Ia.search(e,Wr.bind(null,t,s));return n&&(n!==a||!r)?n:r}function Nc(a,e,t){if(e&&e.start===0&&e.level0){const s=e.tagList.reduce((i,r)=>(r[0]==="INF"&&(i+=parseFloat(r[1])),i),t);return a.start<=s}return!1}function Wr(a=0,e=0,t){if(t.start<=a&&t.start+t.duration>a)return 0;const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-s<=a?1:t.start-s>a&&t.start?-1:0}function Bc(a,e,t){const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-s>a}function La(a,e,t){if(a&&a.startCC<=e&&a.endCC>=e){let s=a.fragments;const{fragmentHint:i}=a;i&&(s=s.concat(i));let r;return Ia.search(s,n=>n.cce?-1:(r=n,n.end<=t?1:n.start>t?-1:0)),r||null}return null}function Ms(a){switch(a.details){case D.FRAG_LOAD_TIMEOUT:case D.KEY_LOAD_TIMEOUT:case D.LEVEL_LOAD_TIMEOUT:case D.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Ra(a){return a.details.startsWith("key")}function ba(a){return Ra(a)&&!!a.frag&&!a.frag.decryptdata}function qr(a,e){const t=Ms(e);return a.default[`${t?"timeout":"error"}Retry`]}function tr(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function jr(a){return ie(ie({},a),{errorRetry:null,timeoutRetry:null})}function Ns(a,e,t,s){if(!a)return!1;const i=s?.code,r=e499)}function wi(a){return a===0&&navigator.onLine===!1}var Ie={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},Ne={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4};class $c extends Ve{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(m.ERROR,this.onError,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(m.ERROR,this.onError,this),e.off(m.ERROR,this.onErrorOut,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===V.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,s=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||s===-1?t.loadLevel:s}variantHasKey(e,t){if(e){var s;if((s=e.details)!=null&&s.hasKey(t))return!0;const i=e.audioGroups;if(i)return this.hls.allAudioTracks.filter(n=>i.indexOf(n.groupId)>=0).some(n=>{var o;return(o=n.details)==null?void 0:o.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var s;if(t.fatal)return;const i=this.hls,r=t.context;switch(t.details){case D.FRAG_LOAD_ERROR:case D.FRAG_LOAD_TIMEOUT:case D.KEY_LOAD_ERROR:case D.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case D.FRAG_PARSING_ERROR:if((s=t.frag)!=null&&s.gap){t.errorAction=Ot();return}case D.FRAG_GAP:case D.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Ie.SendAlternateToPenaltyBox;return}case D.LEVEL_EMPTY_ERROR:case D.LEVEL_PARSING_ERROR:{var n;const c=t.parent===V.MAIN?t.level:i.loadLevel;t.details===D.LEVEL_EMPTY_ERROR&&((n=t.context)!=null&&(n=n.levelDetails)!=null&&n.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case D.LEVEL_LOAD_ERROR:case D.LEVEL_LOAD_TIMEOUT:typeof r?.level=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level));return;case D.AUDIO_TRACK_LOAD_ERROR:case D.AUDIO_TRACK_LOAD_TIMEOUT:case D.SUBTITLE_LOAD_ERROR:case D.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){const c=i.loadLevelObj;if(c&&(r.type===J.AUDIO_TRACK&&c.hasAudioGroup(r.groupId)||r.type===J.SUBTITLE_TRACK&&c.hasSubtitleGroup(r.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=Ie.SendAlternateToPenaltyBox,t.errorAction.flags=Ne.MoveAllAlternatesMatchingHost;return}}return;case D.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:Ie.SendAlternateToPenaltyBox,flags:Ne.MoveAllAlternatesMatchingHDCP};return;case D.KEY_SYSTEM_SESSION_UPDATE_FAILED:case D.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case D.KEY_SYSTEM_NO_SESSION:t.errorAction={action:Ie.SendAlternateToPenaltyBox,flags:Ne.MoveAllAlternatesMatchingKey};return;case D.BUFFER_ADD_CODEC_ERROR:case D.REMUX_ALLOC_ERROR:case D.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:i.loadLevel)}return;case D.INTERNAL_EXCEPTION:case D.BUFFER_APPENDING_ERROR:case D.BUFFER_FULL_ERROR:case D.LEVEL_SWITCH_ERROR:case D.BUFFER_STALLED_ERROR:case D.BUFFER_SEEK_OVER_HOLE:case D.BUFFER_NUDGE_ON_STALL:t.errorAction=Ot();return}t.type===Y.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=Ot())}getPlaylistRetryOrSwitchAction(e,t){const s=this.hls,i=qr(s.config.playlistLoadPolicy,e),r=this.playlistError++;if(Ns(i,r,Ms(e),e.response))return{action:Ie.RetryRequest,flags:Ne.None,retryConfig:i,retryCount:r};const o=this.getLevelSwitchAction(e,t);return i&&(o.retryConfig=i,o.retryCount=r),o}getFragRetryOrSwitchAction(e){const t=this.hls,s=this.getVariantLevelIndex(e.frag),i=t.levels[s],{fragLoadPolicy:r,keyLoadPolicy:n}=t.config,o=qr(Ra(e)?n:r,e),c=t.levels.reduce((h,u)=>h+u.fragmentError,0);if(i&&(e.details!==D.FRAG_GAP&&i.fragmentError++,!ba(e)&&Ns(o,c,Ms(e),e.response)))return{action:Ie.RetryRequest,flags:Ne.None,retryConfig:o,retryCount:c};const l=this.getLevelSwitchAction(e,s);return o&&(l.retryConfig=o,l.retryCount=c),l}getLevelSwitchAction(e,t){const s=this.hls;t==null&&(t=s.loadLevel);const i=this.hls.levels[t];if(i){var r,n;const l=e.details;i.loadError++,l===D.BUFFER_APPEND_ERROR&&i.fragmentError++;let h=-1;const{levels:u,loadLevel:d,minAutoLevel:g,maxAutoLevel:f}=s;!s.autoLevelEnabled&&!s.config.preserveManualLevelOnError&&(s.loadLevel=-1);const p=(r=e.frag)==null?void 0:r.type,E=(p===V.AUDIO&&l===D.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(l===D.BUFFER_ADD_CODEC_ERROR||l===D.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:R})=>i.audioCodec!==R),T=e.sourceBufferName==="video"&&(l===D.BUFFER_ADD_CODEC_ERROR||l===D.BUFFER_APPEND_ERROR)&&u.some(({codecSet:R,audioCodec:A})=>i.codecSet!==R&&i.audioCodec===A),{type:x,groupId:S}=(n=e.context)!=null?n:{};for(let R=u.length;R--;){const A=(R+d)%u.length;if(A!==d&&A>=g&&A<=f&&u[A].loadError===0){var o,c;const I=u[A];if(l===D.FRAG_GAP&&p===V.MAIN&&e.frag){const b=u[A].details;if(b){const L=Rt(e.frag,b.fragments,e.frag.start);if(L!=null&&L.gap)continue}}else{if(x===J.AUDIO_TRACK&&I.hasAudioGroup(S)||x===J.SUBTITLE_TRACK&&I.hasSubtitleGroup(S))continue;if(p===V.AUDIO&&(o=i.audioGroups)!=null&&o.some(b=>I.hasAudioGroup(b))||p===V.SUBTITLE&&(c=i.subtitleGroups)!=null&&c.some(b=>I.hasSubtitleGroup(b))||E&&i.audioCodec===I.audioCodec||T&&i.codecSet===I.codecSet||!E&&i.codecSet!==I.codecSet)continue}h=A;break}}if(h>-1&&s.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:Ie.SendAlternateToPenaltyBox,flags:Ne.None,nextAutoLevel:h}}return{action:Ie.SendAlternateToPenaltyBox,flags:Ne.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case Ie.DoNothing:break;case Ie.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==D.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}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,s=e.errorAction;if(!s)return;const{flags:i}=s,r=s.nextAutoLevel;switch(i){case Ne.None:this.switchLevel(e,r);break;case Ne.MoveAllAlternatesMatchingHDCP:{const c=this.getVariantLevelIndex(e.frag),l=t.levels[c],h=l?.attrs["HDCP-LEVEL"];if(s.hdcpLevel=h,h==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(h){t.maxHdcpLevel=ki[ki.indexOf(h)-1],s.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case Ne.MoveAllAlternatesMatchingKey:{const c=e.decryptdata;if(c){const l=this.hls.levels,h=l.length;for(let d=h;d--;)if(this.variantHasKey(l[d],c)){var n,o;this.log(`Banned key found in level ${d} (${l[d].bitrate}bps) or audio group "${(n=l[d].audioGroups)==null?void 0:n.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${Le(c.keyId||[])}`),l[d].fragmentError++,l[d].loadError++,this.log(`Removing level ${d} with key error (${e.error})`),this.hls.removeLevel(d)}const u=e.frag;if(this.hls.levels.length{const c=this.fragments[o];if(!c||n>=c.body.sn)return;if(!c.buffered&&(!c.loaded||r)){c.body.type===s&&this.removeFragment(c.body);return}const l=c.range[e];if(l){if(l.time.length===0){this.removeFragment(c.body);return}l.time.some(h=>{const u=!this.isTimeBuffered(h.startPTS,h.endPTS,t);return u&&this.removeFragment(c.body),u})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const s=e.frag,i=_t(s),r=this.fragments[i];if(!r||r.buffered&&s.gap)return;const n=!s.relurl;Object.keys(t).forEach(o=>{const c=s.elementaryStreams[o];if(!c)return;const l=t[o],h=n||c.partial===!0;r.range[o]=this.getBufferedTimes(s,e.part,h,l)}),r.loaded=null,Object.keys(r.range).length?(this.bufferedEnd(r,s),hs(r)||this.removeParts(s.sn-1,s.type)):this.removeFragment(r.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const s=this.activePartLists[t];s&&(this.activePartLists[t]=Xr(s,i=>i.fragment.sn>=e))}fragBuffered(e,t){const s=_t(e);let i=this.fragments[s];!i&&t&&(i=this.fragments[s]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,this.bufferedEnd(i,e))}getBufferedTimes(e,t,s,i){const r={time:[],partial:s},n=e.start,o=e.end,c=e.minEndPTS||o,l=e.maxStartPTS||n;for(let h=0;h=u&&c<=d){r.time.push({startPTS:Math.max(n,i.start(h)),endPTS:Math.min(o,i.end(h))});break}else if(nu){const g=Math.max(n,i.start(h)),f=Math.min(o,i.end(h));f>g&&(r.partial=!0,r.time.push({startPTS:g,endPTS:f}))}else if(o<=u)break}return r}getPartialFragment(e){let t=null,s,i,r,n=0;const{bufferPadding:o,fragments:c}=this;return Object.keys(c).forEach(l=>{const h=c[l];h&&hs(h)&&(i=h.body.start-o,r=h.body.end+o,e>=i&&e<=r&&(s=Math.min(e-i,r-e),n<=s&&(t=h.body,n=s)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||hs(t))}getState(e){const t=_t(e),s=this.fragments[t];return s?s.buffered?hs(s)?Ee.PARTIAL:Ee.OK:Ee.APPENDING:Ee.NOT_LOADED}isTimeBuffered(e,t,s){let i,r;for(let n=0;n=i&&t<=r)return!0;if(t<=i)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const s=t.frag,i=t.part?null:t,r=_t(s);this.fragments[r]={body:s,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:s,part:i,timeRanges:r,type:n}=t;if(s.sn==="initSegment")return;const o=s.type;if(i){let l=this.activePartLists[o];l||(this.activePartLists[o]=l=[]),l.push(i)}this.timeRanges=r;const c=r[n];this.detectEvictedFragments(n,c,o,i)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=_t(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,s=Object.keys(t);if(!e)return s.length>0;for(let i=s.length;i--;){const r=t[s[i]];if(r?.body.type===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,s,i,r){i&&!this.hasGaps||Object.keys(this.fragments).forEach(n=>{const o=this.fragments[n];if(!o)return;const c=o.body;c.type!==s||i&&!c.gap||c.starte&&(o.buffered||r)&&this.removeFragment(c)})}removeFragment(e){const t=_t(e);e.clearElementaryStreamInfo();const s=this.activePartLists[e.type];if(s){const i=e.sn;this.activePartLists[e.type]=Xr(s,r=>r.fragment.sn!==i)}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;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(s=>s.clearElementaryStreamInfo())}}function hs(a){var e,t,s;return a.buffered&&!!(a.body.gap||(e=a.range.video)!=null&&e.partial||(t=a.range.audio)!=null&&t.partial||(s=a.range.audiovideo)!=null&&s.partial)}function _t(a){return`${a.type}_${a.level}_${a.sn}`}function Xr(a,e){return a.filter(t=>{const s=e(t);return s||t.clearElementaryStreamInfo(),s})}var vt={cbc:0,ctr:1};class Kc{constructor(e,t,s){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=s}decrypt(e,t){switch(this.aesMode){case vt.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case vt.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function Vc(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class Hc{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(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),s=new Uint32Array(4);for(let i=0;i<4;i++)s[i]=t.getUint32(i*4);return s}initTable(){const e=this.sBox,t=this.invSBox,s=this.subMix,i=s[0],r=s[1],n=s[2],o=s[3],c=this.invSubMix,l=c[0],h=c[1],u=c[2],d=c[3],g=new Uint32Array(256);let f=0,p=0,y=0;for(y=0;y<256;y++)y<128?g[y]=y<<1:g[y]=y<<1^283;for(y=0;y<256;y++){let E=p^p<<1^p<<2^p<<3^p<<4;E=E>>>8^E&255^99,e[f]=E,t[E]=f;const v=g[f],T=g[v],x=g[T];let S=g[E]*257^E*16843008;i[f]=S<<24|S>>>8,r[f]=S<<16|S>>>16,n[f]=S<<8|S>>>24,o[f]=S,S=x*16843009^T*65537^v*257^f*16843008,l[E]=S<<24|S>>>8,h[E]=S<<16|S>>>16,u[E]=S<<8|S>>>24,d[E]=S,f?(f=v^g[g[g[x^v]]],p^=g[g[p]]):f=p=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let s=!0,i=0;for(;i{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,s,i);const c=this.flush();c?r(c.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,s,i)}softwareDecrypt(e,t,s,i){const{currentIV:r,currentResult:n,remainderData:o}=this;if(i!==vt.cbc||t.byteLength!==16)return re.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=Ke(o,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;r&&(s=r);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new Hc),l.expandKey(t);const h=n;return this.currentResult=l.decrypt(c.buffer,0,s),this.currentIV=c.slice(-16).buffer,h||null}webCryptoDecrypt(e,t,s,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,s,i));this.key=t,this.fastAesKey=new Yc(this.subtle,t,i)}return this.fastAesKey.expandKey().then(r=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Kc(this.subtle,new Uint8Array(s),i).decrypt(e.buffer,r)):Promise.reject(new Error("web crypto not initialized"))).catch(r=>(re.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,s,i)))}onWebCryptoError(e,t,s,i){const r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,s,i);const n=this.flush();if(n)return n.buffer}throw new Error("WebCrypto"+(r?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const s=e.length-e.length%qc;return s!==e.length&&(t=e.slice(0,s),this.remainderData=e.slice(s)),t}logOnce(e){this.logEnabled&&(re.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const zr=Math.pow(2,17);class jc{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const s=e.url;if(!s)return Promise.reject(new ot({type:Y.NETWORK_ERROR,details:D.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${s?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,r=i.fLoader,n=i.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(f=>f[0]==="GAP")){c(Zr(e));return}else e.gap=!1;const l=this.loader=r?new r(i):new n(i),h=Qr(e);e.loader=l;const u=jr(i.fragLoadPolicy.default),d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:zr};e.stats=l.stats;const g={onSuccess:(f,p,y,E)=>{this.resetLoader(e,l);let v=f.data;y.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(v.slice(0,16)),v=v.slice(16)),o({frag:e,part:null,payload:v,networkDetails:E})},onError:(f,p,y,E)=>{this.resetLoader(e,l),c(new ot({type:Y.NETWORK_ERROR,details:D.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:ie({url:s,data:void 0},f),error:new Error(`HTTP Error ${f.code} ${f.text}`),networkDetails:y,stats:E}))},onAbort:(f,p,y)=>{this.resetLoader(e,l),c(new ot({type:Y.NETWORK_ERROR,details:D.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:y,stats:f}))},onTimeout:(f,p,y)=>{this.resetLoader(e,l),c(new ot({type:Y.NETWORK_ERROR,details:D.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:y,stats:f}))}};t&&(g.onProgress=(f,p,y,E)=>t({frag:e,part:null,payload:y,networkDetails:E})),l.load(h,d,g)})}loadPart(e,t,s){this.abort();const i=this.config,r=i.fLoader,n=i.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(Zr(e,t));return}const l=this.loader=r?new r(i):new n(i),h=Qr(e,t);e.loader=l;const u=jr(i.fragLoadPolicy.default),d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:zr};t.stats=l.stats,l.load(h,d,{onSuccess:(g,f,p,y)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const E={frag:e,part:t,payload:g.data,networkDetails:y};s(E),o(E)},onError:(g,f,p,y)=>{this.resetLoader(e,l),c(new ot({type:Y.NETWORK_ERROR,details:D.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:ie({url:h.url,data:void 0},g),error:new Error(`HTTP Error ${g.code} ${g.text}`),networkDetails:p,stats:y}))},onAbort:(g,f,p)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),c(new ot({type:Y.NETWORK_ERROR,details:D.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:p,stats:g}))},onTimeout:(g,f,p)=>{this.resetLoader(e,l),c(new ot({type:Y.NETWORK_ERROR,details:D.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:p,stats:g}))}})})}updateStatsFromPart(e,t){const s=e.stats,i=t.stats,r=i.total;if(s.loaded+=i.loaded,r){const c=Math.round(e.duration/t.duration),l=Math.min(Math.round(s.loaded/r),c),u=(c-l)*Math.round(s.loaded/l);s.total=s.loaded+u}else s.total=Math.max(s.loaded,s.total);const n=s.loading,o=i.loading;n.start?n.first+=o.first-o.start:(n.start=o.start,n.first=o.first),n.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function Qr(a,e=null){const t=e||a,s={frag:a,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,r=t.byteRangeEndOffset;if(G(i)&&G(r)){var n;let o=i,c=r;if(a.sn==="initSegment"&&Xc((n=a.decryptdata)==null?void 0:n.method)){const l=r-i;l%16&&(c=r+(16-l%16)),i!==0&&(s.resetIV=!0,o=i-16)}s.rangeStart=o,s.rangeEnd=c}return s}function Zr(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),s={type:Y.MEDIA_ERROR,details:D.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(s.part=e),(e||a).stats.aborted=!0,new ot(s)}function Xc(a){return a==="AES-128"||a==="AES-256"}class ot extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class _a extends Ve{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(){}}class ir{constructor(e,t,s,i=0,r=-1,n=!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=us(),this.buffering={audio:us(),video:us(),audiovideo:us()},this.level=e,this.sn=t,this.id=s,this.size=i,this.part=r,this.partial=n}}function us(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Jr={length:0,start:()=>0,end:()=>0};class j{static isBuffered(e,t){if(e){const s=j.getBuffered(e);for(let i=s.length;i--;)if(t>=s.start(i)&&t<=s.end(i))return!0}return!1}static bufferedRanges(e){if(e){const t=j.getBuffered(e);return j.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let s=0;s1&&e.sort((h,u)=>h.start-u.start||u.end-h.end);let i=-1,r=[];if(s)for(let h=0;h=e[h].start&&t<=e[h].end&&(i=h);const u=r.length;if(u){const d=r[u-1].end;e[h].start-dd&&(r[u-1].end=e[h].end):r.push(e[h])}else r.push(e[h])}else r=e;let n=0,o,c=t,l=t;for(let h=0;h=u&&t<=d&&(i=h),t+s>=u&&t{const i=s.substring(2,s.length-1),r=t?.[i];return r===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),s):r})}return e}function tn(a,e,t){let s=a.variableList;s||(a.variableList=s={});let i,r;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const n=new self.URL(t).searchParams;if(n.has(i))r=n.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(n){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${n.message}`))}}else i=e.NAME,r=e.VALUE;i in s?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):s[i]=r||""}function zc(a,e,t){const s=e.IMPORT;if(t&&s in t){let i=a.variableList;i||(a.variableList=i={}),i[s]=t[s]}else a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}const Qc=/^(\d+)x(\d+)$/,sn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class ue{constructor(e,t){typeof e=="string"&&(e=ue.parseAttrList(e,t)),ne(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const s=new Uint8Array(t.length/2);for(let i=0;iNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const s=this[e];return s?parseFloat(s):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const s=this[e];return(s?s.split(/[ ,]+/):[]).reduce((i,r)=>(i[r.toLowerCase()]=!0,i),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Qc.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let s;const i={};for(sn.lastIndex=0;(s=sn.exec(e))!==null;){const n=s[1].trim();let o=s[2];const c=o.indexOf('"')===0&&o.lastIndexOf('"')===o.length-1;let l=!1;if(c)o=o.slice(1,-1);else switch(n){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":l=!0}if(t&&(c||l))o=Oi(t,o);else if(!l&&!c)switch(n){case"CLOSED-CAPTIONS":if(o==="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":re.warn(`${e}: attribute ${n} is missing quotes`)}i[n]=o}return i}}const Zc="com.apple.hls.interstitial";function Jc(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function eh(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class Ca{constructor(e,t,s=0){var i;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=(i=t?.tagOrder)!=null?i:s,t){const r=t.attr;for(const n in r)if(Object.prototype.hasOwnProperty.call(e,n)&&e[n]!==r[n]){re.warn(`DATERANGE tag attribute: "${n}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=n;break}e=ne(new ue({}),r,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){const r=t?.endDate||new Date(this.attr["END-DATE"]);G(r.getTime())&&(this._endDate=r)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const 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(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(re.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(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(G(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===Zc}get isValid(){return!!this.id&&!this._badValueForSameId&&G(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)}}const th=10;class sh{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.driftStartTime=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}const t=this.lastPartSn-e.lastPartSn,s=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!s||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&s>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 s=t.decryptdata;return s||(t.setKeyFormat(e.keyFormat),s=t.decryptdata),!!s&&e.matches(s)})}get hasProgramDateTime(){return this.fragments.length?G(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||th}get drift(){const 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(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let s=e.length;s--;)if(e[s].index>t)return e[s].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){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function Bs(a,e){return a.length===e.length?!a.some((t,s)=>t!==e[s]):!1}function rn(a,e){return!a&&!e?!0:!a||!e?!1:Bs(a,e)}function Ft(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function rr(a){switch(a){case"AES-128":case"AES-256":return vt.cbc;case"AES-256-CTR":return vt.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function nr(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function Fi(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function ih(a){const e=Fi(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Pa(a){const e=function(s,i,r){const n=s[i];s[i]=s[r],s[r]=n};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function ka(a){const e=a.split(":");let t=null;if(e[0]==="data"&&e.length===2){const s=e[1].split(";"),i=s[s.length-1].split(",");if(i.length===2){const r=i[0]==="base64",n=i[1];r?(s.splice(-1,1),t=nr(n)):t=ih(n)}}return t}const Us=typeof self<"u"?self:void 0;var de={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Re={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Ls(a){switch(a){case Re.FAIRPLAY:return de.FAIRPLAY;case Re.PLAYREADY:return de.PLAYREADY;case Re.WIDEVINE:return de.WIDEVINE;case Re.CLEARKEY:return de.CLEARKEY}}function ni(a){switch(a){case de.FAIRPLAY:return Re.FAIRPLAY;case de.PLAYREADY:return Re.PLAYREADY;case de.WIDEVINE:return Re.WIDEVINE;case de.CLEARKEY:return Re.CLEARKEY}}function Wt(a){const{drmSystems:e,widevineLicenseUrl:t}=a,s=e?[de.FAIRPLAY,de.WIDEVINE,de.PLAYREADY,de.CLEARKEY].filter(i=>!!e[i]):[];return!s[de.WIDEVINE]&&t&&s.push(de.WIDEVINE),s}const wa=(function(a){return Us!=null&&(a=Us.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function rh(a,e,t,s){let i;switch(a){case de.FAIRPLAY:i=["cenc","sinf"];break;case de.WIDEVINE:case de.PLAYREADY:i=["cenc"];break;case de.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return nh(i,e,t,s)}function nh(a,e,t,s){return[{initDataTypes:a,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:e.map(r=>({contentType:`audio/mp4; codecs=${r}`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:t.map(r=>({contentType:`video/mp4; codecs=${r}`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function ah(a){var e;return!!a&&(a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function Oa(a){const e=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),s=t.substring(t.indexOf("<"),t.length),n=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(n){const o=n.childNodes[0]?n.childNodes[0].nodeValue:n.getAttribute("VALUE");if(o){const c=nr(o).subarray(0,16);return Pa(c),c}}return null}let Dt={};class yt{static clearKeyUriToKeyIdMap(){Dt={}}static setKeyIdForUri(e,t){Dt[e]=t}static addKeyIdForUri(e){const t=Object.keys(Dt).length%Number.MAX_SAFE_INTEGER,s=new Uint8Array(16);return new DataView(s.buffer,12,4).setUint32(0,t),Dt[e]=s,s}constructor(e,t,s,i=[1],r=null,n){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.pssh=null,this.method=e,this.uri=t,this.keyFormat=s,this.keyFormatVersions=i,this.iv=r,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Ft(e),n!=null&&n.startsWith("0x")&&(this.keyId=new Uint8Array(la(n)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&Bs(e.keyFormatVersions,this.keyFormatVersions)&&rn(e.iv,this.iv)&&rn(e.keyId,this.keyId)}isSupported(){if(this.method){if(Ft(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Re.FAIRPLAY:case Re.WIDEVINE:case Re.PLAYREADY:case Re.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(Ft(this.method)){let r=this.iv;return r||(typeof e!="number"&&(re.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),r=lh(e)),new yt(this.method,this.uri,"identity",this.keyFormatVersions,r)}if(this.keyId){const r=Dt[this.uri];if(r&&!Bs(this.keyId,r)&&yt.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const s=ka(this.uri);if(s)switch(this.keyFormat){case Re.WIDEVINE:if(this.pssh=s,!this.keyId){const r=uc(s.buffer);if(r.length){var i;const n=r[0];this.keyId=(i=n.kids)!=null&&i.length?n.kids[0]:null}}this.keyId||(this.keyId=nn(t));break;case Re.PLAYREADY:{const r=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=hc(r,null,s),this.keyId=Oa(s);break}default:{let r=s.subarray(0,16);if(r.length!==16){const n=new Uint8Array(16);n.set(r,16-r.length),r=n}this.keyId=r;break}}if(!this.keyId||this.keyId.byteLength!==16){let r;r=oh(t),r||(r=nn(t),r||(r=Dt[this.uri])),r&&(this.keyId=r,yt.setKeyIdForUri(this.uri,r))}return this}}function oh(a){const e=a?.[Re.WIDEVINE];return e?e.keyId:null}function nn(a){const e=a?.[Re.PLAYREADY];if(e){const t=ka(e.uri);if(t)return Oa(t)}return null}function lh(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const an=/#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,on=/#EXT-X-MEDIA:(.*)/g,ch=/^#EXT(?:INF|-X-TARGETDURATION):/m,ai=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),hh=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):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class et{static findGroup(e,t){for(let s=0;s0&&r.length({id:l.attrs.AUDIO,audioCodec:l.audioCodec})),SUBTITLES:n.map(l=>({id:l.attrs.SUBTITLES,textCodec:l.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(on.lastIndex=0;(i=on.exec(e))!==null;){const l=new ue(i[1],s),h=l.TYPE;if(h){const u=o[h],d=r[h]||[];r[h]=d;const g=l.LANGUAGE,f=l["ASSOC-LANGUAGE"],p=l.CHANNELS,y=l.CHARACTERISTICS,E=l["INSTREAM-ID"],v={attrs:l,bitrate:0,id:c++,groupId:l["GROUP-ID"]||"",name:l.NAME||g||"",type:h,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:g,url:l.URI?et.resolve(l.URI,t):""};if(f&&(v.assocLang=f),p&&(v.channels=p),y&&(v.characteristics=y),E&&(v.instreamId=E),u!=null&&u.length){const T=et.findGroup(u,v.groupId)||u[0];un(v,T,"audioCodec"),un(v,T,"textCodec")}d.push(v)}}return r}static parseLevelPlaylist(e,t,s,i,r,n){var o;const c={url:t},l=new sh(t),h=l.fragments,u=[];let d=null,g=0,f=0,p=0,y=0,E=0,v=null,T=new si(i,c),x,S,R,A=-1,I=!1,b=null,L;if(ai.lastIndex=0,l.m3u8=e,l.hasVariableRefs=en(e),((o=ai.exec(e))==null?void 0:o[0])!=="#EXTM3U")return l.playlistParsingError=new Error("Missing format identifier #EXTM3U"),l;for(;(x=ai.exec(e))!==null;){I&&(I=!1,T=new si(i,c),T.playlistOffset=p,T.setStart(p),T.sn=g,T.cc=y,E&&(T.bitrate=E),T.level=s,d&&(T.initSegment=d,d.rawProgramDateTime&&(T.rawProgramDateTime=d.rawProgramDateTime,d.rawProgramDateTime=null),b&&(T.setByteRange(b),b=null)));const F=x[1];if(F){T.duration=parseFloat(F);const N=(" "+x[2]).slice(1);T.title=N||null,T.tagList.push(N?["INF",F,N]:["INF",F])}else if(x[3]){if(G(T.duration)){T.playlistOffset=p,T.setStart(p),R&&fn(T,R,l),T.sn=g,T.level=s,T.cc=y,h.push(T);const N=(" "+x[3]).slice(1);T.relurl=Oi(l,N),Mi(T,v,u),v=T,p+=T.duration,g++,f=0,I=!0}}else{if(x=x[0].match(hh),!x){re.warn("No matches on slow regex match for level playlist!");continue}for(S=1;S0&&gn(l,N,x),g=l.startSN=parseInt(k);break;case"SKIP":{l.skippedSegments&&rt(l,N,x);const B=new ue(k,l),K=B.decimalInteger("SKIPPED-SEGMENTS");if(G(K)){l.skippedSegments+=K;for(let M=K;M--;)h.push(null);g+=K}const W=B.enumeratedString("RECENTLY-REMOVED-DATERANGES");W&&(l.recentlyRemovedDateranges=(l.recentlyRemovedDateranges||[]).concat(W.split(" ")));break}case"TARGETDURATION":l.targetduration!==0&&rt(l,N,x),l.targetduration=Math.max(parseInt(k),1);break;case"VERSION":l.version!==null&&rt(l,N,x),l.version=parseInt(k);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":l.live||rt(l,N,x),l.live=!1;break;case"#":(k||$)&&T.tagList.push($?[k,$]:[k]);break;case"DISCONTINUITY":y++,T.tagList.push(["DIS"]);break;case"GAP":T.gap=!0,T.tagList.push([N]);break;case"BITRATE":T.tagList.push([N,k]),E=parseInt(k)*1e3,G(E)?T.bitrate=E:E=0;break;case"DATERANGE":{const B=new ue(k,l),K=new Ca(B,l.dateRanges[B.ID],l.dateRangeTagCount);l.dateRangeTagCount++,K.isValid||l.skippedSegments?l.dateRanges[K.id]=K:re.warn(`Ignoring invalid DATERANGE tag: "${k}"`),T.tagList.push(["EXT-X-DATERANGE",k]);break}case"DEFINE":{{const B=new ue(k,l);"IMPORT"in B?zc(l,B,n):tn(l,B,t)}break}case"DISCONTINUITY-SEQUENCE":l.startCC!==0?rt(l,N,x):h.length>0&&gn(l,N,x),l.startCC=y=parseInt(k);break;case"KEY":{const B=ln(k,t,l);if(B.isSupported()){if(B.method==="NONE"){R=void 0;break}R||(R={});const K=R[B.keyFormat];K!=null&&K.matches(B)||(K&&(R=ne({},R)),R[B.keyFormat]=B)}else re.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${k}"`);break}case"START":l.startTimeOffset=cn(k);break;case"MAP":{const B=new ue(k,l);if(T.duration){const K=new si(i,c);dn(K,B,s,R),d=K,T.initSegment=d,d.rawProgramDateTime&&!T.rawProgramDateTime&&(T.rawProgramDateTime=d.rawProgramDateTime)}else{const K=T.byteRangeEndOffset;if(K){const W=T.byteRangeStartOffset;b=`${K-W}@${W}`}else b=null;dn(T,B,s,R),d=T,I=!0}d.cc=y;break}case"SERVER-CONTROL":{L&&rt(l,N,x),L=new ue(k),l.canBlockReload=L.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=L.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&L.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=L.optionalFloat("PART-HOLD-BACK",0),l.holdBack=L.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{l.partTarget&&rt(l,N,x);const B=new ue(k);l.partTarget=B.decimalFloatingPoint("PART-TARGET");break}case"PART":{let B=l.partList;B||(B=l.partList=[]);const K=f>0?B[B.length-1]:void 0,W=f++,M=new ue(k,l),O=new zl(M,T,c,W,K);B.push(O),T.duration+=O.duration;break}case"PRELOAD-HINT":{const B=new ue(k,l);l.preloadHint=B;break}case"RENDITION-REPORT":{const B=new ue(k,l);l.renditionReports=l.renditionReports||[],l.renditionReports.push(B);break}default:re.warn(`line parsed but not handled: ${x}`);break}}}v&&!v.relurl?(h.pop(),p-=v.duration,l.partList&&(l.fragmentHint=v)):l.partList&&(Mi(T,v,u),T.cc=y,l.fragmentHint=T,R&&fn(T,R,l)),l.targetduration||(l.playlistParsingError=new Error("Missing Target Duration"));const C=h.length,w=h[0],U=h[C-1];if(p+=l.skippedSegments*l.targetduration,p>0&&C&&U){l.averagetargetduration=p/C;const F=U.sn;l.endSN=F!=="initSegment"?F:0,l.live||(U.endList=!0),A>0&&(dh(h,A),w&&u.unshift(w))}return l.fragmentHint&&(p+=l.fragmentHint.duration),l.totalduration=p,u.length&&l.dateRangeTagCount&&w&&Fa(u,l),l.endCC=y,l}}function Fa(a,e){let t=a.length;if(!t)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];a.push(o),t++}else return;const s=a[t-1],i=e.live?1/0:e.totalduration,r=Object.keys(e.dateRanges);for(let o=r.length;o--;){const c=e.dateRanges[r[o]],l=c.startDate.getTime();c.tagAnchor=s.ref;for(let h=t;h--;){var n;if(((n=a[h])==null?void 0:n.sn)=o||s===0){var n;const c=(((n=t[s+1])==null?void 0:n.start)||i)-r.start;if(e<=o+c*1e3){const l=t[s].sn-a.startSN;if(l<0)return-1;const h=a.fragments;if(h.length>t.length){const d=(t[s+1]||h[h.length-1]).sn-a.startSN;for(let g=d;g>l;g--){const f=h[g].programDateTime;if(e>=f&&es);["video","audio","text"].forEach(s=>{const i=t.filter(r=>Ji(r,s));i.length&&(e[`${s}Codec`]=i.map(r=>r.split("/")[0]).join(","),t=t.filter(r=>i.indexOf(r)===-1))}),e.unknownCodecs=t}function un(a,e,t){const s=e[t];s&&(a[t]=s)}function dh(a,e){let t=a[e];for(let s=e;s--;){const i=a[s];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function Mi(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function dn(a,e,t,s){a.relurl=e.URI,e.BYTERANGE&&a.setByteRange(e.BYTERANGE),a.level=t,a.sn="initSegment",s&&(a.levelkeys=s),a.initSegment=null}function fn(a,e,t){a.levelkeys=e;const{encryptedFragments:s}=t;(!s.length||s[s.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&s.push(a)}function rt(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function gn(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function oi(a,e){const t=e.startPTS;if(G(t)){let s=0,i;e.sn>a.sn?(s=t-a.start,i=a):(s=a.start-t,i=e),i.duration!==s&&i.setDuration(s)}else e.sn>a.sn?a.cc===e.cc&&a.minEndPTS?e.setStart(a.start+(a.minEndPTS-a.start)):e.setStart(a.start+a.duration):e.setStart(Math.max(a.start-e.duration,0))}function Ma(a,e,t,s,i,r,n){s-t<=0&&(n.warn("Fragment should have a positive duration",e),s=t+e.duration,r=i+e.duration);let c=t,l=s;const h=e.startPTS,u=e.endPTS;if(G(h)){const E=Math.abs(h-t);a&&E>a.totalduration?n.warn(`media timestamps and playlist times differ by ${E}s for level ${e.level} ${a.url}`):G(e.deltaPTS)?e.deltaPTS=Math.max(E,e.deltaPTS):e.deltaPTS=E,c=Math.max(t,h),t=Math.min(t,h),i=e.startDTS!==void 0?Math.min(i,e.startDTS):i,l=Math.min(s,u),s=Math.max(s,u),r=e.endDTS!==void 0?Math.max(r,e.endDTS):r}const d=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(s-e.start),e.startPTS=t,e.maxStartPTS=c,e.startDTS=i,e.endPTS=s,e.minEndPTS=l,e.endDTS=r;const g=e.sn;if(!a||ga.endSN)return 0;let f;const p=g-a.startSN,y=a.fragments;for(y[p]=e,f=p;f>0;f--)oi(y[f],y[f-1]);for(f=p;f=0;h--){const u=i[h].initSegment;if(u){s=u;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let r;ph(a,e,(h,u,d,g)=>{if((!e.startCC||e.skippedSegments)&&u.cc!==h.cc){const f=h.cc-u.cc;for(let p=d;p{var u;h&&(!h.initSegment||h.initSegment.relurl===((u=s)==null?void 0:u.relurl))&&(h.initSegment=s)}),e.skippedSegments){if(e.deltaUpdateFailed=n.some(h=>!h),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let h=e.skippedSegments;h--;)n.shift();e.startSN=n[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=gh(a.dateRanges,e,t));const h=a.fragments.filter(u=>u.rawProgramDateTime);if(a.hasProgramDateTime&&!e.hasProgramDateTime)for(let u=1;u{u.elementaryStreams=h.elementaryStreams,u.stats=h.stats}),r?Ma(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS,t):Na(a,e),n.length&&(e.totalduration=e.edge-n[0].start),e.driftStartTime=a.driftStartTime,e.driftStart=a.driftStart;const l=e.advancedDateTime;if(e.advanced&&l){const h=e.edge;e.driftStart||(e.driftStartTime=l,e.driftStart=h),e.driftEndTime=l,e.driftEnd=h}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=a.requestScheduled)}function gh(a,e,t){const{dateRanges:s,recentlyRemovedDateranges:i}=e,r=ne({},a);i&&i.forEach(c=>{delete r[c]});const o=Object.keys(r).length;return o?(Object.keys(s).forEach(c=>{const l=r[c],h=new Ca(s[c].attr,l);h.isValid?(r[c]=h,l||(h.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${ce(s[c].attr)}"`)}),r):s}function mh(a,e,t){if(a&&e){let s=0;for(let i=0,r=a.length;i<=r;i++){const n=a[i],o=e[i+s];n&&o&&n.index===o.index&&n.fragment.sn===o.fragment.sn?t(n,o):s--}}}function ph(a,e,t){const s=e.skippedSegments,i=Math.max(a.startSN,e.startSN)-e.startSN,r=(a.fragmentHint?1:0)+(s?e.endSN:Math.min(a.endSN,e.endSN))-e.startSN,n=e.startSN-a.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;for(let l=i;l<=r;l++){const h=c[n+l];let u=o[l];if(s&&!u&&h&&(u=e.fragments[l]=h),h&&u){t(h,u,l,o);const d=h.relurl,g=u.relurl;if(d&&yh(d,g)){e.playlistParsingError=mn(`media sequence mismatch ${u.sn}:`,a,e,h,u);return}else if(h.cc!==u.cc){e.playlistParsingError=mn(`discontinuity sequence mismatch (${h.cc}!=${u.cc})`,a,e,h,u);return}}}}function mn(a,e,t,s,i){return new Error(`${a} ${i.url}
-Playlist starting @${e.startSN}
-${e.m3u8}
-
-Playlist starting @${t.startSN}
-${t.m3u8}`)}function Na(a,e,t=!0){const s=e.startSN+e.skippedSegments-a.startSN,i=a.fragments,r=s>=0;let n=0;if(r&&se){const r=s[s.length-1].duration*1e3;r{var s;(s=e.details)==null||s.fragments.forEach(i=>{i.level=t,i.initSegment&&(i.initSegment.level=t)})})}function yh(a,e){return a!==e&&e?yn(a)!==yn(e):!1}function yn(a){return a.replace(/\?[^?]*$/,"")}function qt(a,e){for(let s=0,i=a.length;sa.startCC)}function En(a,e){const t=a.start+e;a.startPTS=t,a.setStart(t),a.endPTS=t+a.duration}function Ka(a,e){const t=e.fragments;for(let s=0,i=t.length;s{const{config:n,fragCurrent:o,media:c,mediaBuffer:l,state:h}=this,u=c?c.currentTime:0,d=j.bufferInfo(l||c,u,n.maxBufferHole),g=!d.len;if(this.log(`Media seeking to ${G(u)?u.toFixed(3):u}, state: ${h}, ${g?"out of":"in"} buffer`),this.state===P.ENDED)this.resetLoadingState();else if(o){const f=n.maxFragLookUpTolerance,p=o.start-f,y=o.start+o.duration+f;if(g||yd.end){const E=u>y;(u