1import{d as Ks,r as de,o as _t,p as wo,c as ie,a as Lo,h as St,u as Ao,b as fe,w as Io,e as Ro,f as ee,F as xt,g as Gt,i as se,m as _r,j as Y,_ as qe,k as Qt,l as lt,n as Rs,q as Kt,s as De,t as Ae,v as Be,x as Co,y as Do,z as _o,A as Ys,B as Ws,C as Po,D as ko,E as ss,G as is,H as Zt,I as ki,J as Et,K as Mo,L as Oo,M as Fo,N as No,O as Bo,P as $o,Q as Ft,R as Uo}from"./rkOfJjIS.js";const Go=Symbol.for("nuxt:client-only"),Ho=Ks({name:"ClientOnly",inheritAttrs:!1,props:["fallback","placeholder","placeholderTag","fallbackTag"],setup(r,{slots:e,attrs:t}){const s=de(!1);return _t(()=>{s.value=!0}),wo(Go,!0),i=>{var l;if(s.value)return(l=e.default)==null?void 0:l.call(e);const n=e.fallback||e.placeholder;if(n)return n();const a=i.fallback||i.placeholder||"",o=i.fallbackTag||i.placeholderTag||"span";return ie(o,t,a)}}}),Vo=r=>r._type==="span",zo={types:{span:"span",image:"img"},marks:{strong:"strong",em:"em",link:"a"},styles:{h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",normal:"p",blockquote:"blockquote"},listItem:"li",container:"div"},Ko=["abbr","accesskey","accessKey","action","alt","autocomplete","autofocus","autoplay","charset","checked","cite","class","cols","colspan","command","content","datetime","default","disabled","download","draggable","dropzone","headers","height","hidden","href","hreflang","id","maxlength","minlength","muted","placeholder","preload","radiogroup","readonly","required","role","selected","src","srcdoc","srcset","tabindex","title","value","width","wrap"];function Yo(r,e){return r!=null&&r.listItem&&r._type!=="list"?e.listItem||"li":r!=null&&r._type?e.types[r._type]||e.marks[r._type]:void 0}function Wo(r,e,t){const s=r.style&&e.styles[r.style],n=qn(r,typeof s=="string");return!r.listItem&&r.style&&s?St(s,n,{default:t}):t==null?void 0:t()}function qo(r,e){return Oi(e,r,()=>(r.children||[]).map(t=>Vo(t)?Mi(t.text,t.marks,e,r.markDefs):Oi(e,t,()=>Mi(t.text,t.marks,e,r.markDefs))))}function Mi(r,[e,...t]=[],s,i=[]){if(!e)return r;const n=e in s.marks?{_type:e,_key:""}:i.find(a=>a._key===e);return Oi(s,n,()=>Mi(r,t,s,i))}function Wn(r,e){if(!e.listItem)return r.push(e),r;const t=r[r.length-1]||{};return t._type!=="list"||!t.children||e.level===1&&e.listItem!==t.listItem?(r.push({_type:"list",listItem:e.listItem,level:e.level,children:[e]}),r):e.level===t.level&&e.listItem===t.listItem?(t.children.push(e),r):(Wn(t.children,e),r)}function Oi(r,e,t){const s=Yo(e,r);if(!s)return t==null?void 0:t();if(!e)return;const i=typeof s=="string",n=qn(e,i);return i?St(s,n,t==null?void 0:t()):St(s,n,{default:()=>t==null?void 0:t()})}function qn(r,e){return Object.fromEntries(Object.entries(r).filter(([t])=>t!=="_type"&&t!=="markDefs").map(([t,s])=>t==="_key"?["key",s||null]:!e||Ko.includes(t)?[t,s]:[]))}function Fi(r,e){return r.map(t=>Wo(t,e,()=>qo(t,e)))}const jo=Ks({name:"SanityContent",props:{blocks:{type:Array,default:()=>[]},serializers:{type:Object,default:()=>({})}},setup(r){const e=Lo(r.serializers,zo);return e.types.list=e.types.list||Xo(e),()=>{var t;return Fi(((t=r.blocks)==null?void 0:t.reduce(Wn,[]))||[],e)}}}),Xo=r=>Ks({name:"ListComponent",inheritAttrs:!1,props:{children:{type:Array,default:()=>[]},level:{type:Number,default:1}},setup(e){return()=>{var s;const t=((s=e.children[0])==null?void 0:s.listItem)==="number";return e.level>1?St(r.listItem||"li",[St(t?"ol":"ul",{},{default:()=>Fi(e.children,r)})]):St(t?"ol":"ul",{},{default:()=>Fi(e.children,r)})}}});/** 2 * Encodes an RGBA image to a PNG data URI. RGB should not be premultiplied by A. 3 * 4 * @remarks 5 * This is optimized for speed and simplicity and does not optimize for size 6 * at all. This doesn't do any compression (all values are stored uncompressed). 7 * 8 * @see https://github.com/evanw/thumbhash 9 * @author Evan Wallace 10 * @license MIT 11 */function jn(r,e,t){const s=r*4+1,i=6+e*(5+s),n=[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,r>>8,r&255,0,0,e>>8,e&255,8,6,0,0,0,0,0,0,0,i>>>24,i>>16&255,i>>8&255,i&255,73,68,65,84,120,1],a=[0,498536548,997073096,651767980,1994146192,1802195444,1303535960,1342533948,-306674912,-267414716,-690576408,-882789492,-1687895376,-2032938284,-1609899400,-1111625188];let o=1,l=0;for(let d=0,u=0,f=s-1;d<e;d++,f+=s-1)for(n.push(d+1<e?0:1,s&255,s>>8,~s&255,s>>8^255,0),l=(l+o)%65521;u<f;u++){const h=t[u]&255;n.push(h),o=(o+h)%65521,l=(l+o)%65521}n.push(l>>8,l&255,o>>8,o&255,0,0,0,0,0,0,0,0,73,69,78,68,174,66,96,130);for(let[d,u]of[[12,29],[37,41+i]]){let f=-1;for(let h=d;h<u;h++)f^=n[h],f=f>>>4^a[f&15],f=f>>>4^a[f&15];f=~f,n[u++]=f>>>24,n[u++]=f>>16&255,n[u++]=f>>8&255,n[u++]=f&255}return`data:image/png;base64,${globalThis.btoa(String.fromCharCode(...n))}`}const nr=32,Qo="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Xn=typeof window>"u",Zo=!Xn&&"loading"in HTMLImageElement.prototype,Jo=!Xn&&(!("onscroll"in window)||/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent));function Qn(r,e=document){return typeof r=="string"?[...e.querySelectorAll(r)]:r instanceof Element?[r]:[...r]}function el(r,e){let t,s;return r>=1?(t=e,s=Math.round(e/r)):(t=Math.round(e*r),s=e),{width:t,height:s}}function tl(r,e){let t;return function(...s){t&&clearTimeout(t),t=setTimeout(()=>{t=void 0,r(...s)},e)}}const sl="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~",vs=(r,e,t)=>{let s=0;for(;e<t;)s*=83,s+=sl.indexOf(r[e++]);return s},Zn=Math.pow,Yt=Math.PI,il=Yt*2,Jn=3294.6,ea=269.025,rl=r=>r>10.31475?Zn(r/ea+.052132,2.4):r/Jn,ri=r=>~~(r>1227e-8?ea*Zn(r,.416666)-13.025:r*Jn+1),Ht=r=>(r<0?-1:1)*r*r,Pr=r=>{for(r+=Yt/2;r>Yt;)r-=il;const e=1.27323954*r-.405284735*Ht(r);return .225*(Ht(e)-e)+e};function nl(r){const e=vs(r,2,6);return[e>>16,e>>8&255,e&255]}function al(r,e,t,s){const i=vs(r,0,1),n=i%9+1,a=~~(i/9)+1,o=n*a;let l=0,c=0,d=0,u=0,f=0,h=0,p=0,m=0,g=0,y=0,E=0,v=0,S=0,T=0;const L=(vs(r,1,2)+1)/13446*(s|1),b=new Float64Array(o*3),C=nl(r);for(l=0;l<3;l++)b[l]=rl(C[l]);for(l=1;l<o;l++)T=vs(r,4+l*2,6+l*2),b[l*3]=Ht(~~(T/(19*19))-9)*L,b[l*3+1]=Ht(~~(T/19)%19-9)*L,b[l*3+2]=Ht(T%19-9)*L;const A=e*4,w=new Uint8ClampedArray(A*t);for(u=0;
11u<t;u++)for(v=Yt*u/t,d=0;d<e;d++){for(f=0,h=0,p=0,S=Yt*d/e,c=0;c<a;c++)for(g=Pr(v*c),l=0;l<n;l++)m=Pr(S*l)*g,y=(l+c*n)*3,f+=b[y]*m,h+=b[y+1]*m,p+=b[y+2]*m;E=4*d+u*A,w[E]=ri(f),w[E+1]=ri(h),w[E+2]=ri(p),w[E+3]=255}return w}function ol(r,{ratio:e=1,size:t=nr}={}){const{width:s,height:i}=el(e,t),n=al(r,s,i);return jn(s,i,n)}function ll(r){let{PI:e,min:t,max:s,cos:i,round:n}=Math,a=r[0]|r[1]<<8|r[2]<<16,o=r[3]|r[4]<<8,l=(a&63)/63,c=(a>>6&63)/31.5-1,d=(a>>12&63)/31.5-1,u=(a>>18&31)/31,f=a>>23,h=(o>>3&63)/63,p=(o>>9&63)/63,m=o>>15,g=s(3,m?f?5:7:o&7),y=s(3,m?o&7:f?5:7),E=f?(r[5]&15)/15:1,v=(r[5]>>4)/15,S=f?6:5,T=0,L=(k,M,N)=>{let G=[];for(let U=0;U<M;U++)for(let H=U?0:1;H*M<k*(M-U);H++)G.push(((r[S+(T>>1)]>>((T++&1)<<2)&15)/7.5-1)*N);return G},b=L(g,y,u),C=L(3,3,h*1.25),A=L(3,3,p*1.25),w=f&&L(5,5,v),I=cl(r),P=n(I>1?32:32*I),R=n(I>1?32/I:32),D=new Uint8Array(P*R*4),_=[],B=[];for(let k=0,M=0;k<R;k++)for(let N=0;N<P;N++,M+=4){let G=l,U=c,H=d,z=E;for(let q=0,oe=s(g,f?5:3);q<oe;q++)_[q]=i(e/P*(N+.5)*q);for(let q=0,oe=s(y,f?5:3);q<oe;q++)B[q]=i(e/R*(k+.5)*q);for(let q=0,oe=0;q<y;q++)for(let pe=q?0:1,we=B[q]*2;pe*y<g*(y-q);pe++,oe++)G+=b[oe]*_[pe]*we;for(let q=0,oe=0;q<3;q++)for(let pe=q?0:1,we=B[q]*2;pe<3-q;pe++,oe++){let Ue=_[pe]*we;U+=C[oe]*Ue,H+=A[oe]*Ue}if(f)for(let q=0,oe=0;q<5;q++)for(let pe=q?0:1,we=B[q]*2;pe<5-q;pe++,oe++)z+=w[oe]*_[pe]*we;let Z=G-2/3*U,K=(3*G-Z+H)/2,Q=K-H;D[M]=s(0,255*t(1,K)),D[M+1]=s(0,255*t(1,Q)),D[M+2]=s(0,255*t(1,Z)),D[M+3]=s(0,255*t(1,z))}return{w:P,h:R,rgba:D}}function cl(r){let e=r[3],t=r[2]&128,s=r[4]&128,i=s?t?5:7:e&7,n=s?e&7:t?5:7;return i/n}function dl(r){const e=ul(r),{w:t,h:s,rgba:i}=ll(e);return jn(t,s,i)}function ul(r){return Uint8Array.from(globalThis.atob(fl(r)),e=>e.charCodeAt(0))}function fl(r){return r.replaceAll("-","+").replaceAll("_","/")}function hl(r='img[loading="lazy"]',{hash:e=!0,hashType:t="blurhash",placeholderSize:s=nr,updateSizesOnResize:i=!1,onImageLoad:n}={}){const a=new Set;for(const o of Qn(r)){const l=Cs(o,{updateOnResize:i});if(i&&l&&a.add(l),e){const d=Bi({image:o,hash:typeof e=="string"?e:void 0,hashType:t,size:s});d&&(o.src=d)}if(!o.dataset.src&&!o.dataset.srcset){(typeof __UNLAZY_LOGGING__>"u"||__UNLAZY_LOGGING__)&&console.error("[unlazy] Missing `data-src` or `data-srcset` attribute",o);continue}if(Jo||!Zo){ta(o),_s(o),Ds(o);continue}if(o.src||(o.src=Qo),o.complete&&o.naturalWidth>0){Ni(o,n);continue}const c=()=>Ni(o,n);o.addEventListener("load",c,{once:!0}),a.add(()=>o.removeEventListener("load",c))}return()=>{for(const o of a)o();a.clear()}}function pl(r='img[data-sizes="auto"], source[data-sizes="auto"]'){for(const e of Qn(r))Cs(e)}function Ni(r,e){var o;if(((o=r.parentElement)==null?void 0:o.tagName.toLowerCase())==="picture"){ta(r),_s(r),Ds(r),e==null||e(r);return}const s=new Image,{srcset:i,src:n,sizes:a}=r.dataset;if(a==="auto"){const l=sa(r);l&&(s.sizes=`${l}px`)}else r.sizes&&(s.sizes=r.sizes);i&&(s.srcset=i),n&&(s.src=n),s.addEventListener("load",()=>{_s(r),Ds(r),e==null||e(r)},{once:!0})}function Bi({image:r,hash:e,hashType:t="blurhash",size:s=nr,ratio:i}={}){if(!e&&r){const{blurhash:n,thumbhash:a}=r.dataset;e=a||n,t=a?"thumbhash":"blurhash"}if(e)try{if(t==="thumbhash")return dl(e);if(!i&&r){const n=r.width||r.offsetWidth||s,a=r.height||r.offsetHeight||s;i=n/a}return ol(e,{ratio:i,size:s})}catch(n){(typeof __UNLAZY_LOGGING__>"u"||__UNLAZY_LOGGING__)&&console.error(`Error generating ${t} placeholder:`,n)}}const rs=new WeakMap;function Cs(r,e){var s;if(r.dataset.sizes!=="auto")return;const t=sa(r);if(t&&(r.sizes=`${t}px`),((s=r.parentElement)==null?void 0:s.tagName.toLowerCase())==="picture"&&!(e!=null&&e.skipChildren)&&[...r.parentElement.getElementsByTagName("source")].forEach(i=>Cs(i,{skipChildren:!0})),e!=null&&e.updateOnResize){if(!rs.has(r)){const i=tl(()=>Cs(r),500),n=new ResizeObserver(i);rs.set(r,n),n.observe(r)}return()=>{const i=rs.get(r);i&&(i.disconnect(),rs.delete(r))}}}function Ds(r){r.dataset.src&&(r.src=r.dataset.src,r.removeAttribute("data-src"))}function _s(r){r.dataset.srcset&&(r.srcset=r.dataset.srcset,r.removeAttribute("data-srcset"))}function ta(r){const e=r.parentElement;(e==null?void 0:e.tagName.toLowerCase())==="picture"&&([...e.querySelectorAll("source[data-srcset]")].forEac
11h(_s),[...e.querySelectorAll("source[data-src]")].forEach(Ds))}function sa(r){var e,t;return r instanceof HTMLSourceElement?(t=(e=r.parentElement)==null?void 0:e.getElementsByTagName("img")[0])==null?void 0:t.offsetWidth:r.offsetWidth}const ml={key:0},gl=["type","data-srcset","data-sizes"],vl=["src","data-src","data-srcset","data-sizes"],yl=["src","data-src","data-srcset","data-sizes"],El=Ks({inheritAttrs:!1,__name:"UnLazyImage",props:{src:{default:void 0},srcSet:{default:void 0},sources:{default:void 0},autoSizes:{type:Boolean,default:!1},blurhash:{default:void 0},thumbhash:{default:void 0},placeholderSrc:{default:void 0},placeholderSize:{default:void 0},placeholderRatio:{default:void 0},lazyLoad:{type:Boolean,default:!0},preload:{type:Boolean,default:!1},ssr:{type:Boolean,default:void 0}},emits:["loaded","error"],setup(r,{emit:e}){const t=r,s=e,i=Ao().public.unlazy,n=fe(()=>t.thumbhash||t.blurhash),a=(t.ssr??i.ssr)&&n.value?Bi({hash:n.value,hashType:t.thumbhash?"thumbhash":"blurhash",size:t.placeholderSize||i.placeholderSize,ratio:t.placeholderRatio}):void 0,o=de();let l,c;return Io(()=>{if(l==null||l(),!!o.value){if(n.value&&n.value!==c){const d=Bi({image:o.value,hash:n.value,hashType:t.thumbhash?"thumbhash":"blurhash",size:t.placeholderSize||i.placeholderSize,ratio:t.placeholderRatio});d&&(o.value.src=d),c=n.value}if(t.preload){t.autoSizes&&pl(o.value),Ni(o.value),s("loaded",o.value);return}t.lazyLoad&&(l=hl(o.value,{hash:!1,onImageLoad(d){s("loaded",d)}}))}}),Ro(()=>{l==null||l()}),(d,u)=>{var f;return(f=t.sources)!=null&&f.length?(ee(),ie("picture",ml,[(ee(!0),ie(xt,null,Gt(t.sources,(h,p)=>(ee(),ie("source",{key:p,type:h.type,"data-srcset":h.srcSet,"data-sizes":h.sizes},null,8,gl))),128)),se("img",_r({ref_key:"target",ref:o},d.$attrs,{src:Y(a)||d.placeholderSrc,"data-src":d.src,"data-srcset":d.srcSet,"data-sizes":d.autoSizes?"auto":void 0,loading:"lazy",onError:u[0]||(u[0]=h=>s("error",h))}),null,16,vl)])):(ee(),ie("img",_r({key:1,ref_key:"target",ref:o},d.$attrs,{src:Y(a)||d.placeholderSrc,"data-src":d.src,"data-srcset":d.srcSet,"data-sizes":d.autoSizes?"auto":void 0,loading:"lazy",onError:u[1]||(u[1]=h=>s("error",h))}),null,16,yl))}}}),xl={key:1},Tl=["alt","src"],Sl={__name:"BaseImage",props:{image:{type:Object,default:()=>{}},auto:{default:"format",type:String},fit:{default:"max",type:String},useHotspot:{type:Boolean,default:()=>!1},lazy:{type:Boolean,default:()=>!0}},setup(r){const{$urlFor:e}=Qt(),t=r,s=fe(()=>{var f,h,p;return((p=(h=(f=t.image)==null?void 0:f.asset)==null?void 0:h.metadata)==null?void 0:p.blurHash)??""}),i=fe(()=>t.image?`${e(t.image).auto(t.auto).width(800).fit(t.fit)}`:""),n=fe(()=>[{type:"image/webp",srcSet:a(t.image,"webp")},{type:"image/jpeg",srcSet:a(t.image)}]),a=(f,h="jpeg")=>(!f||!f.asset,""),o=fe(()=>{var m,g,y,E,v,S,T,L;const f=(E=(y=(g=(m=t.image)==null?void 0:m.asset)==null?void 0:g.metadata)==null?void 0:y.dimensions)==null?void 0:E.width,h=((S=(v=t.image)==null?void 0:v.crop)==null?void 0:S.left)??0,p=((L=(T=t.image)==null?void 0:T.crop)==null?void 0:L.right)??0;return f-h*f-p*f}),l=fe(()=>{var m,g,y,E,v,S,T,L;const f=(E=(y=(g=(m=t.image)==null?void 0:m.asset)==null?void 0:g.metadata)==null?void 0:y.dimensions)==null?void 0:E.height,h=((S=(v=t.image)==null?void 0:v.crop)==null?void 0:S.top)??0,p=((L=(T=t.image)==null?void 0:T.crop)==null?void 0:L.bottom)??0;return f-h*f-p*f}),c=fe(()=>{if(!(!o||!l))return o.value>l.value?"landscape":o.value<l.value?"portrait":"square"}),d=fe(()=>{var f,h,p;return t.useHotspot&&((f=t.image)!=null&&f.hotspot)?{"object-position":`${[(h=t.image)==null?void 0:h.hotspot.x,(p=t.image)==null?void 0:p.hotspot.y].map(m=>`${(m*100).toFixed(2)}%`).join(" ")}`}:""}),u=fe(()=>t.useHotspot?{}:{aspectRatio:`${o.value} / ${l.value}`});return(f,h)=>{var m,g,y,E,v;const p=El;return((g=(m=t.image)==null?void 0:m.asset)==null?void 0:g.extension)!=="gif"&&((E=(y=t.image)==null?void 0:y.asset)==null?void 0:E.extension)!=="svg"&&t.lazy===!0?(ee(),lt(p,{key:0,blurhash:Y(s),"placeholder-ratio":Y(o)/Y(l),src:Y(i),sources:Y(n),width:Y(o),height:Y(l),alt:t.image.alt||"",style:Rs([Y(d),Y(u)]),class:Kt(Y(c)),"auto-sizes":""},null,8,["blurhash","placeholder-ratio","src","sources","width","height","alt","style","class"])):(ee(),ie("picture",xl,[se("img",{alt:t.image.alt||"",src:(v=t.image)==null?void 0:v.asset.url,style:Rs([Y(d),Y(u)]),class:Kt(Y(c))},null,14,Tl)]))}}},qs=qe(Sl,[["__scopeId","data-v-549ad783"]]),bl={key:0,class:"text-sm"},wl={__name:"BaseFigure",props:{image:{type:Object,default:()=>{}},auto:{default:"format",type:String},fit:{default:"max",type:String},useHotspot:{type:Boolean,default:()=>!1}},setup(r){const e=r;return(t,s)=>{var n;const i=qs;return ee(),ie("figure",null,[De(i,{image:e.image,auto:e.auto,fit:e.fit,"use-hotspot":e.useHotspot},null,8,["image","auto","fit","use-hotspot"]),(n=e.image)!=null&&n.caption?(ee(),ie("figcaption",bl,Ae(e.image.caption),1)):Be("",!0)])}}};function Ll(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ia={exports:{}};(function(r,e){(function(t){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,c,d){if(d=d||{}
vendor: 2,901 bytes, line 11
11,l=l.trim(),c=c.trim(),!c){if(!d.alwaysNormalize)return l;var u=o.parseURL(l);if(!u)throw new Error("Error trying to parse base URL.");return u.path=o.normalizePath(u.path),o.buildURLFromParts(u)}var f=o.parseURL(c);if(!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return d.alwaysNormalize?(f.path=o.normalizePath(f.path),o.buildURLFromParts(f)):c;var h=o.parseURL(l);if(!h)throw new Error("Error trying to parse base URL.");if(!h.netLoc&&h.path&&h.path[0]!=="/"){var p=i.exec(h.path);h.netLoc=p[1],h.path=p[2]}h.netLoc&&!h.path&&(h.path="/");var m={scheme:h.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment};if(!f.netLoc&&(m.netLoc=h.netLoc,f.path[0]!=="/"))if(!f.path)m.path=h.path,f.params||(m.params=h.params,f.query||(m.query=h.query));else{var g=h.path,y=g.substring(0,g.lastIndexOf("/")+1)+f.path;m.path=o.normalizePath(y)}return m.path===null&&(m.path=d.alwaysNormalize?o.normalizePath(f.path):f.path),o.buildURLFromParts(m)},parseURL:function(l){var c=s.exec(l);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(n,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};r.exports=o})()})(ia);var ar=ia.exports;function kr(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,s)}return t}function Ee(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?kr(Object(t),!0).forEach(function(s){Rl(r,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):kr(Object(t)).forEach(function(s){Object.defineProperty(r,s,Object.getOwnPropertyDescriptor(t,s))})}return r}function Al(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var s=t.call(r,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Il(r){var e=Al(r,"string");return typeof e=="symbol"?e:String(e)}function Rl(r,e,t){return e=Il(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function me(){return me=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},me.apply(this,arguments)}const W=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},Cl=Number.isSafeInteger||function(r){return typeof r=="number"&&Math.abs(r)<=Dl},Dl=Number.MAX_SAFE_INTEGER||9007199254740991;
11let x=function(r){return r.MEDIA_ATTACHING="hlsMediaAttaching",r.MEDIA_ATTACHED="hlsMediaAttached",r.MEDIA_DETACHING="hlsMediaDetaching",r.MEDIA_DETACHED="hlsMediaDetached",r.BUFFER_RESET="hlsBufferReset",r.BUFFER_CODECS="hlsBufferCodecs",r.BUFFER_CREATED="hlsBufferCreated",r.BUFFER_APPENDING="hlsBufferAppending",r.BUFFER_APPENDED="hlsBufferAppended",r.BUFFER_EOS="hlsBufferEos",r.BUFFER_FLUSHING="hlsBufferFlushing",r.BUFFER_FLUSHED="hlsBufferFlushed",r.MANIFEST_LOADING="hlsManifestLoading",r.MANIFEST_LOADED="hlsManifestLoaded",r.MANIFEST_PARSED="hlsManifestParsed",r.LEVEL_SWITCHING="hlsLevelSwitching",r.LEVEL_SWITCHED="hlsLevelSwitched",r.LEVEL_LOADING="hlsLevelLoading",r.LEVEL_LOADED="hlsLevelLoaded",r.LEVEL_UPDATED="hlsLevelUpdated",r.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",r.LEVELS_UPDATED="hlsLevelsUpdated",r.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",r.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",r.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",r.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",r.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",r.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",r.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",r.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",r.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",r.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",r.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",r.CUES_PARSED="hlsCuesParsed",r.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",r.INIT_PTS_FOUND="hlsInitPtsFound",r.FRAG_LOADING="hlsFragLoading",r.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",r.FRAG_LOADED="hlsFragLoaded",r.FRAG_DECRYPTED="hlsFragDecrypted",r.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",r.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",r.FRAG_PARSING_METADATA="hlsFragParsingMetadata",r.FRAG_PARSED="hlsFragParsed",r.FRAG_BUFFERED="hlsFragBuffered",r.FRAG_CHANGED="hlsFragChanged",r.FPS_DROP="hlsFpsDrop",r.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",r.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",r.ERROR="hlsError",r.DESTROYING="hlsDestroying",r.KEY_LOADING="hlsKeyLoading",r.KEY_LOADED="hlsKeyLoaded",r.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",r.BACK_BUFFER_REACHED="hlsBackBufferReached",r.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",r}({}),J=function(r){return r.NETWORK_ERROR="networkError",r.MEDIA_ERROR="mediaError",r.KEY_SYSTEM_ERROR="keySystemError",r.MUX_ERROR="muxError",r.OTHER_ERROR="otherError",r}({}),$=function(r){return r.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",r.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",r.KEY_SYSTEM_NO_SESSION="keySystemNoSession",r.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",r.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",r.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",r.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",r.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",r.MANIFEST_LOAD_ERROR="manifestLoadError",r.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",r.MANIFEST_PARSING_ERROR="manifestParsingError",r.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",r.LEVEL_EMPTY_ERROR="levelEmptyError",r.LEVEL_LOAD_ERROR="levelLoadError",r.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",r.LEVEL_PARSING_ERROR="levelParsingError",r.LEVEL_SWITCH_ERROR="levelSwitchError",r.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",r.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",r.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",r.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",r.FRAG_LOAD_ERROR="fragLoadError",r.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",r.FRAG_DECRYPT_ERROR="fragDecryptError",r.FRAG_PARSING_ERROR="fragParsingError",r.FRAG_GAP="fragGap",r.REMUX_ALLOC_ERROR="remuxAllocError",r.KEY_LOAD_ERROR="keyLoadError",r.KEY_LOAD_TIMEOUT="keyLoadTimeOut",r.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",r.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",r.BUFFER_APPEND_ERROR="bufferAppendError",r.BUFFER_APPENDING_ERROR="bufferAppendingError",r.BUFFER_STALLED_ERROR="bufferStalledError",r.BUFFER_FULL_ERROR="bufferFullError",r.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",r.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",r.INTERNAL_EXCEPTION="internalException",r.INTERNAL_ABORTED="aborted",r.UNKNOWN="unknown",r}({});const at=function(){},$i={trace:at,debug:at,log:at,warn:at,info:at,error:at};let Vt=$i;function _l(r){const e=self.console[r];return e?e.bind(self.console,`[${r}] >`):at}function Pl(r,...e){e.forEach(function(t){Vt[t]=r[t]?r[t].bind(r):_l
vendor: 11,243 bytes, line 11
11(t)})}function kl(r,e){if(typeof console=="object"&&r===!0||typeof r=="object"){Pl(r,"debug","log","info","warn","error");try{Vt.log(`Debug logs enabled for "${e}" in hls.js version 1.5.15`)}catch{Vt=$i}}else Vt=$i}const O=Vt,Ml=/^(\d+)x(\d+)$/,Mr=/(.+?)=(".*?"|.*?)(?:,|$)/g;class ue{constructor(e){typeof e=="string"&&(e=ue.parseAttrList(e)),me(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;i<t.length/2;i++)s[i]=parseInt(t.slice(i*2,i*2+2),16);return s}else return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.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]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Ml.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const s={},i='"';for(Mr.lastIndex=0;(t=Mr.exec(e))!==null;){let n=t[2];n.indexOf(i)===0&&n.lastIndexOf(i)===n.length-1&&(n=n.slice(1,-1));const a=t[1].trim();s[a]=n}return s}}function Ol(r){return r!=="ID"&&r!=="CLASS"&&r!=="START-DATE"&&r!=="DURATION"&&r!=="END-DATE"&&r!=="END-ON-NEXT"}function Fl(r){return r==="SCTE35-OUT"||r==="SCTE35-IN"}class ra{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const s=t.attr;for(const i in s)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==s[i]){O.warn(`DATERANGE tag attribute: "${i}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=i;break}e=me(new ue({}),s,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const s=new Date(this.attr["END-DATE"]);W(s.getTime())&&(this._endDate=s)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(W(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&W(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class js{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var ae={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class na{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[ae.AUDIO]:null,[ae.VIDEO]:null,[ae.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const s=e.split("@",2);let i;s.length===1?i=(t==null?void 0:t.byteRangeEndOffset)||0:i=parseInt(s[1]),this._byteRange=[i,parseInt(s[0])+i]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=ar.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class ni extends na{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new js,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const s=Object.keys(this.levelkeys);if(s.length===1)return this._decryptdata=this.levelkeys[s[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!W(this.programDateTime))return null;const e=W(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),s=t.length;if(s>1||s===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,s,i,n,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:t,endPTS:s,startDTS:i,endDTS:n,partial:a};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,s),l.startDTS=Math.min(l.startDTS,i),l.endDTS=Math.max(l.endDTS,n)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[ae.AUDIO]=null,e[ae.VIDEO]=null,e[ae.AUDIOVIDEO]=null}}class Nl extends na{constructor(e,t,s,i,n){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.stats=new js,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 a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,n),n&&(this.fragOffset=n.fragOffset+n.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)}}const Bl=10;class $l{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.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 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.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,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?W(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Bl}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(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end: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 lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function or(r){return Uint8Array.from(atob(r),e=>e.charCodeAt(0))}function Ul(r){const e=Ui(r).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Gl(r){const e=function(s,i,n){const a=s[i];s[i]=s[n],s[n]=a};e(r,0,3),e(r,1,2),e(r,4,5),e(r,6,7)}function Hl(r){const e=r.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 n=i[0]==="base64",a=i[1];n?(s.splice(-1,1),t=or(a)):t=Ul(a)}}return t}function Ui(r){return Uint8Array.from(unescape(encodeURIComponent(r)),e=>e.charCodeAt(0))}const Lt=typeof self<"u"?self:void 0;var ce={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Ie={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Or(r){switch(r){case Ie.FAIRPLAY:return ce.FAIRPLAY;case Ie.PLAYREADY:return ce.PLAYREADY;case Ie.WIDEVINE:return ce.WIDEVINE;case Ie.CLEARKEY:return ce.CLEARKEY}}var Bt={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",FAIRPLAY:"94ce86fb07ff4f43adb893d2fa968ca2",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Fr(r){if(r===Bt.WIDEVINE)return ce.WIDEVINE;if(r===Bt.PLAYREADY)return ce.PLAYREADY;if(r===Bt.CENC||r===Bt.CLEARKEY)return ce.CLEARKEY}function Nr(r){switch(r){case ce.FAIRPLAY:return Ie.FAIRPLAY;case ce.PLAYREADY:return Ie.PLAYREADY;case ce.WIDEVINE:return Ie.WIDEVINE;case ce.CLEARKEY:return Ie.CLEARKEY}}function ai(r){const{drmSystems:e,widevineLicenseUrl:t}=r,s=e?[ce.FAIRPLAY,ce.WIDEVINE,ce.PLAYREADY,ce.CLEARKEY].filter(i=>!!e[i]):[];return!s[ce.WIDEVINE]&&t&&s.push(ce.WIDEVINE),s}const aa=function(r){return Lt!=null&&(r=Lt.navigator)!=null&&r.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function Vl(r,e,t,s){let i;switch(r){case ce.FAIRPLAY:i=["cenc","sinf"];break;case ce.WIDEVINE:case ce.PLAYREADY:i=["cenc"];break;case ce.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${r}`)}return zl(i,e,t,s)}function zl(r,e,t,s){return[{initDataTypes:r,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs="${n}
11"`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs="${n}"`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function ct(r,e,t){return Uint8Array.prototype.slice?r.slice(e,t):new Uint8Array(Array.prototype.slice.call(r,e,t))}const lr=(r,e)=>e+10<=r.length&&r[e]===73&&r[e+1]===68&&r[e+2]===51&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128,oa=(r,e)=>e+10<=r.length&&r[e]===51&&r[e+1]===68&&r[e+2]===73&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128,Wt=(r,e)=>{const t=e;let s=0;for(;lr(r,e);){s+=10;const i=Xs(r,e+6);s+=i,oa(r,e+10)&&(s+=10),e+=s}if(s>0)return r.subarray(t,t+s)},Xs=(r,e)=>{let t=0;return t=(r[e]&127)<<21,t|=(r[e+1]&127)<<14,t|=(r[e+2]&127)<<7,t|=r[e+3]&127,t},Kl=(r,e)=>lr(r,e)&&Xs(r,e+6)+10<=r.length-e,cr=r=>{const e=ca(r);for(let t=0;t<e.length;t++){const s=e[t];if(la(s))return Ql(s)}},la=r=>r&&r.key==="PRIV"&&r.info==="com.apple.streaming.transportStreamTimestamp",Yl=r=>{const e=String.fromCharCode(r[0],r[1],r[2],r[3]),t=Xs(r,4),s=10;return{type:e,size:t,data:r.subarray(s,s+t)}},ca=r=>{let e=0;const t=[];for(;lr(r,e);){const s=Xs(r,e+6);e+=10;const i=e+s;for(;e+8<i;){const n=Yl(r.subarray(e)),a=Wl(n);a&&t.push(a),e+=n.size+10}oa(r,e)&&(e+=10)}return t},Wl=r=>r.type==="PRIV"?ql(r):r.type[0]==="W"?Xl(r):jl(r),ql=r=>{if(r.size<2)return;const e=Ye(r.data,!0),t=new Uint8Array(r.data.subarray(e.length+1));return{key:r.type,info:e,data:t.buffer}},jl=r=>{if(r.size<2)return;if(r.type==="TXXX"){let t=1;const s=Ye(r.data.subarray(t),!0);t+=s.length+1;const i=Ye(r.data.subarray(t));return{key:r.type,info:s,data:i}}const e=Ye(r.data.subarray(1));return{key:r.type,data:e}},Xl=r=>{if(r.type==="WXXX"){if(r.size<2)return;let t=1;const s=Ye(r.data.subarray(t),!0);t+=s.length+1;const i=Ye(r.data.subarray(t));return{key:r.type,info:s,data:i}}const e=Ye(r.data);return{key:r.type,data:e}},Ql=r=>{if(r.data.byteLength===8){const e=new Uint8Array(r.data),t=e[3]&1;let s=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return s/=45,t&&(s+=4772185884e-2),Math.round(s)}},Ye=(r,e=!1)=>{const t=Zl();if(t){const c=t.decode(r);if(e){const d=c.indexOf("\0");return d!==-1?c.substring(0,d):c}return c.replace(/\0/g,"")}const s=r.length;let i,n,a,o="",l=0;for(;l<s;){if(i=r[l++],i===0&&e)return o;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(i);break;case 12:case 13:n=r[l++],o+=String.fromCharCode((i&31)<<6|n&63);break;case 14:n=r[l++],a=r[l++],o+=String.fromCharCode((i&15)<<12|(n&63)<<6|(a&63)<<0);break}}return o};let oi;function Zl(){if(!navigator.userAgent.includes("PlayStation 4"))return!oi&&typeof self.TextDecoder<"u"&&(oi=new self.TextDecoder("utf-8")),oi}const He={hexDump:function(r){let e="";for(let t=0;t<r.length;t++){let s=r[t].toString(16);s.length<2&&(s="0"+s),e+=s}return e}},Ps=Math.pow(2,32)-1,Jl=[].push,da={video:1,audio:2,id3:3,text:4};function ge(r){return String.fromCharCode.apply(null,r)}function ua(r,e){const t=r[e]<<8|r[e+1];return t<0?65536+t:t}function j(r,e){const t=fa(r,e);return t<0?4294967296+t:t}function Br(r,e){let t=j(r,e);return t*=Math.pow(2,32),t+=j(r,e+4),t}function fa(r,e){return r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}function li(r,e,t){r[e]=t>>24,r[e+1]=t>>16&255,r[e+2]=t>>8&255,r[e+3]=t&255}function ec(r){const e=r.byteLength;for(let t=0;t<e;){const s=j(r,t);if(s>8&&r[t+4]===109&&r[t+5]===111&&r[t+6]===111&&r[t+7]===102)return!0;t=s>1?t+s:e}return!1}function te(r,e){const t=[];if(!e.length)return t;const s=r.byteLength;for(let i=0;i<s;){const n=j(r,i),a=ge(r.subarray(i+4,i+8)),o=n>1?i+n:s;if(a===e[0])if(e.length===1)t.push(r.subarray(i+8,o));else{const l=te(r.subarray(i+8,o),e.slice(1));l.length&&Jl.apply(t,l)}i=o}return t}function tc(r){const e=[],t=r[0];let s=8;const i=j(r,s);s+=4;let n=0,a=0;t===0?(n=j(r,s),a=j(r,s+4),s+=8):(n=Br(r,s),a=Br(r,s+8),s+=16),s+=2;let o=r.length+a;const l=ua(r,s);s+=2;for(let c=0;c<l;c++){let d=s;const u=j(r,d);d+=4;const f=u&2147483647;if((u&2147483648)>>>31===1)return O.warn("SIDX has hierarchical references (not supported)"),null;const p=j(r,d);d+=4,e.push({referenceSize:f,subsegmentDuration:p,info:{duration:p/i,start:o,end:o+f-1}}),o+=f,d+=4,s=d}return{earliestPresentationTime:n,timescale:i,version:t,referencesCount:l,references:e}}function ha(r){const e=[],t=te(r,["moov","trak"]);for(let i=0;i<t.length;i++){const n=t[i],a=te(n,["tkhd"])[0];if(a){let o=a[0];const l=j(a,o===0?12:20),c=te(n,["mdia","mdhd"])[0];if(c){o=c[0];const d=j(c,o===0?12:20),u=te(n,["mdia","hdlr"])[0];if(u){const f=ge(u.subarray(8,12)),h={soun:ae.AUDIO,vide:ae.VIDEO}[f];if(h){const p=te(n,["mdia","minf","stbl","stsd"])[0],m=sc(p);e[l]={timescale:d,type:h},e[h]=Ee({timescale:d,id:l},m)}}}}}
vendor: 8,673 bytes, line 11
11return te(r,["moov","mvex","trex"]).forEach(i=>{const n=j(i,4),a=e[n];a&&(a.default={duration:j(i,12),flags:j(i,20)})}),e}function sc(r){const e=r.subarray(8),t=e.subarray(86),s=ge(e.subarray(4,8));let i=s;const n=s==="enca"||s==="encv";if(n){const o=te(e,[s])[0].subarray(s==="enca"?28:78);te(o,["sinf"]).forEach(c=>{const d=te(c,["schm"])[0];if(d){const u=ge(d.subarray(4,8));if(u==="cbcs"||u==="cenc"){const f=te(c,["frma"])[0];f&&(i=ge(f))}}})}switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const a=te(t,["avcC"])[0];i+="."+ns(a[1])+ns(a[2])+ns(a[3]);break}case"mp4a":{const a=te(e,[s])[0],o=te(a.subarray(28),["esds"])[0];if(o&&o.length>12){let l=4;if(o[l++]!==3)break;l=ci(o,l),l+=2;const c=o[l++];if(c&128&&(l+=2),c&64&&(l+=o[l++]),o[l++]!==4)break;l=ci(o,l);const d=o[l++];if(d===64)i+="."+ns(d);else break;if(l+=12,o[l++]!==5)break;l=ci(o,l);const u=o[l++];let f=(u&248)>>3;f===31&&(f+=1+((u&7)<<3)+((o[l]&224)>>5)),i+="."+f}break}case"hvc1":case"hev1":{const a=te(t,["hvcC"])[0],o=a[1],l=["","A","B","C"][o>>6],c=o&31,d=j(a,2),u=(o&32)>>5?"H":"L",f=a[12],h=a.subarray(6,12);i+="."+l+c,i+="."+d.toString(16).toUpperCase(),i+="."+u+f;let p="";for(let m=h.length;m--;){const g=h[m];(g||p)&&(p="."+g.toString(16).toUpperCase()+p)}i+=p;break}case"dvh1":case"dvhe":{const a=te(t,["dvcC"])[0],o=a[2]>>1&127,l=a[2]<<5&32|a[3]>>3&31;i+="."+Ge(o)+"."+Ge(l);break}case"vp09":{const a=te(t,["vpcC"])[0],o=a[4],l=a[5],c=a[6]>>4&15;i+="."+Ge(o)+"."+Ge(l)+"."+Ge(c);break}case"av01":{const a=te(t,["av1C"])[0],o=a[1]>>>5,l=a[1]&31,c=a[2]>>>7?"H":"M",d=(a[2]&64)>>6,u=(a[2]&32)>>5,f=o===2&&d?u?12:10:d?10:8,h=(a[2]&16)>>4,p=(a[2]&8)>>3,m=(a[2]&4)>>2,g=a[2]&3;i+="."+o+"."+Ge(l)+c+"."+Ge(f)+"."+h+"."+p+m+g+"."+Ge(1)+"."+Ge(1)+"."+Ge(1)+"."+0;break}}return{codec:i,encrypted:n}}function ci(r,e){const t=e+5;for(;r[e++]&128&&e<t;);return e}function ns(r){return("0"+r.toString(16).toUpperCase()).slice(-2)}function Ge(r){return(r<10?"0":"")+r}function ic(r,e){if(!r||!e)return r;const t=e.keyId;return t&&e.isCommonEncryption&&te(r,["moov","trak"]).forEach(i=>{const a=te(i,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=te(a,["enca"]);const l=o.length>0;l||(o=te(a,["encv"])),o.forEach(c=>{const d=l?c.subarray(28):c.subarray(78);te(d,["sinf"]).forEach(f=>{const h=pa(f);if(h){const p=h.subarray(8,24);p.some(m=>m!==0)||(O.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${He.hexDump(p)} -> ${He.hexDump(t)}`),h.set(t,8))}})})}),r}function pa(r){const e=te(r,["schm"])[0];if(e){const t=ge(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return te(r,["schi","tenc"])[0]}return null}function rc(r,e){return te(e,["moof","traf"]).reduce((t,s)=>{const i=te(s,["tfdt"])[0],n=i[0],a=te(s,["tfhd"]).reduce((o,l)=>{const c=j(l,4),d=r[c];if(d){let u=j(i,4);if(n===1){if(u===Ps)return O.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),o;u*=Ps+1,u+=j(i,8)}const f=d.timescale||9e4,h=u/f;if(W(h)&&(o===null||h<o))return h}return o},null);return a!==null&&W(a)&&(t===null||a<t)?a:t},null)}function nc(r,e){let t=0,s=0,i=0;const n=te(r,["moof","traf"]);for(let a=0;a<n.length;a++){const o=n[a],l=te(o,["tfhd"])[0],c=j(l,4),d=e[c];if(!d)continue;const u=d.default,f=j(l,0)|(u==null?void 0:u.flags);let h=u==null?void 0:u.duration;f&8&&(f&2?h=j(l,12):h=j(l,8));const p=d.timescale||9e4,m=te(o,["trun"]);for(let g=0;g<m.length;g++){if(t=ac(m[g]),!t&&h){const y=j(m[g],4);t=h*y}d.type===ae.VIDEO?s+=t/p:d.type===ae.AUDIO&&(i+=t/p)}}if(s===0&&i===0){let a=1/0,o=0,l=0;const c=te(r,["sidx"]);for(let d=0;d<c.length;d++){const u=tc(c[d]);if(u!=null&&u.references){a=Math.min(a,u.earliestPresentationTime/u.timescale);const f=u.references.reduce((h,p)=>h+p.info.duration||0,0);o=Math.max(o,f+u.earliestPresentationTime/u.timescale),l=o-a}}if(l&&W(l))return l}return s||i}function ac(r){const e=j(r,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let s=0;const i=j(r,4);for(let n=0;n<i;n++){if(e&256){const a=j(r,t);s+=a,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return s}function oc(r,e,t){te(e,["moof","traf"]).forEach(s=>{te(s,["tfhd"]).forEach(i=>{const n=j(i,4),a=r[n];if(!a)return;const o=a.timescale||9e4;te(s,["tfdt"]).forEach(l=>{const c=l[0],d=t*o;if(d){let u=j(l,4);if(c===0)u-=d,u=Math.max(u,0),li(l,4,u);else{u*=Math.pow(2,32),u+=j(l,8),u-=d,u=Math.max(u,0);const f=Math.floor(u/(Ps+1)),h=Math.floor(u%(Ps+1));li(l,4,f),li(l,8,h)}}})})})}function lc(r){const e={valid:null,remainder:null},t=te(r,["moof"]);if(t.length<2)return e.remainder=r,e;const s=t[t.length-1];return e.valid=ct(r,0,s.byteOffset-8),e.remainder=ct(r,s.byteOffset-8),e}function Oe(r,e){const t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function $r(r,e){const t=[],s=e.samples,i=e.timescale,n=e.id;let a=!1;return te(s,["moof"]).map(l=>{const c=l.byteOffset-8;te(l,["traf"]).map(u=>{const f=te(u,["tfdt"]).map(h=>{const p=h[0];let m=j(h,4);return p===1&&(m*=Math.pow(2,32),m+=j(h,8)),m/i})[0];return f!==void 0&&(r=f),te(u,["tfhd"]).map(h=>{const p=j(h,4),m=j(h,0)&16777215,g=(m&1)!==0,y=(m&2)!==0,E=(m&8)!==0;let v=0;const S=(m&16)!==0;let T=0;const L=(m&32)!==0;let b=8;p===n&&(g&&(b+=8),y&&(b+=4),E&&(v=j(h,b),b+=4),S&&(T=j(h,b),b+=4),L&&(b+=4),e.type==="video"&&(a=cc(e.codec)),te(u,["trun"]).map(C=>{const A=C[0],w=j(C,0)&16777215,I=(w&1)!==0;let P=0;const R=(w&4)!==0,D=(w&256)!==0;let _=0;const B=(w&512)!==0;let k=0;const M=(w&1024)!==0,N=(w&2048)!==0;let G=0;const U=j(C,4);let H=8;I&&(P=j(C,H),H+=4),R&&(H+=4);let z=P+c;for(let Z=0;Z<U;Z++){if(D?(_=j(C,H),H+=4):_=v,B?(k=j(C,H),H+=4):k=T,M&&(H+=4),N&&(A===0?G=j(C,H):G=fa(C,H),H+=4),e.type===ae.VIDEO){let K=0;for(;K<k;){const Q=j(s,z);if(z+=4,dc(a,s[z])){const q=s.subarray(z,z+Q);ma(q,a?2:1,r+G/i,t)}z+=Q,K+=Q+4}}r+=_/i}}))})})}),t}function cc(r){if(!r)return!1;const e=r.indexOf("."),t=e<0?r:r.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function dc(r,e){if(r){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function ma(r,e,t,s){const i=ga(r);let n=0;n+=e;let a=0,o=0,l=0;for(;n<i.length;){a=0;do{if(n>=i.length)break;l=i[n++],a+=l}while(l===255);o=0;do{if(n>=i.length)break;l=i[n++],o+=l}while(l===255);const c=i.length-n;let d=n;if(o<c)n+=o;else if(o>c){O.error(`Malformed SEI payload. ${o} is too small, only ${c} bytes left to parse.`);break}if(a===4){if(i[d++]===181){const f=ua(i,d);if(d+=2,f===49){const h=j(i,d);if(d+=4,h===1195456820){const p=i[d++];if(p===3){const m=i[d++],g=31&m,y=64&m,E=y?2+g*3:0,v=new Uint8Array(E);if(y){v[0]=m;for(let S=1;S<E;S++)v[S]=i[d++]}s.push({type:p,payloadType:a,pts:t,bytes:v})}}}}}else if(a===5&&o>16){const u=[];for(let p=0;p<16;p++){const m=i[d++].toString(16);u.push(m.length==1?"0"+m:m),(p===3||p===5||p===7||p===9)&&u.push("-")}const f=o-16,h=new Uint8Array(f);for(let p=0;p<f;p++)h[p]=i[d++];s.push({payloadType:a,pts:t,uuid:u.join(""),userData:Ye(h),userDataBytes:h})}}}function ga(r){const e=r.byteLength,t=[];let s=1;for(;s<e-2;)r[s]===0&&r[s+1]===0&&r[s+2]===3?(t.push(s+2),s+=2):s++;if(t.length===0)return r;const i=e-t.length,n=new Uint8Array(i);let a=0;for(s=0;s<i;a++,s++)a===t[0]&&(a++,t.shift()),n[s]=r[a];return n}function uc(r){const e=r[0];let t="",s="",i=0,n=0,a=0,o=0,l=0,c=0;if(e===0){for(;ge(r.subarray(c,c+1))!=="\0";)t+=ge(r.subarray(c,c+1)),c+=1;for(t+=ge(r.subarray(c,c+1)),c+=1;ge(r.subarray(c,c+1))!=="\0";)s+=ge(r.subarray(c,c+1)),c+=1;s+=ge(r.subarray(c,c+1)),c+=1,i=j(r,12),n=j(r,16),o=j(r,20),l=j(r,24),c=28}else if(e===1){c+=4,i=j(r,c),c+=4;const u=j(r,c);c+=4;const f=j(r,c);for(c+=4,a=2**32*u+f,Cl(a)||(a=Number.MAX_SAFE_INTEGER,O.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=j(r,c),c+=4,l=j(r,c),c+=4;ge(r.subarray(c,c+1))!=="\0";)t+=ge(r.subarray(c,c+1)),c+=1;for(t+=ge(r.subarray(c,c+1)),c+=1;ge(r.subarray(c,c+1))!=="\0";)s+=ge(r.subarray(c,c+1)),c+=1;s+=ge(r.subarray(c,c+1)),c+=1}const d=r.subarray(c,r.byteLength);return{schemeIdUri:t,value:s,timeScale:i,presentationTime:a,presentationTimeDelta:n,eventDuration:o,id:l,payload:d}}function fc(r,...e){const t=e.length;let s=8,i=t;for(;i--;)s+=e[i].byteLength;const n=new Uint8Array(s);for(n[0]=s>>24&255,n[1]=s>>16&255,n[2]=s>>8&255,n[3]=s&255,n.set(r,4),i=0,s=8;i<t;i++)n.set(e[i],s),s+=e[i].byteLength;return n}function hc(r,e,t){if(r.byteLength!==16)throw new RangeError("Invalid system id");let s,i;s=0,i=new Uint8Array;let n;s>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const a=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),fc([112,115,115,104],new Uint8Array([s,0,0,0]),r,n,i,a,t||new Uint8Array)}function pc(r){const e=[];
11if(r instanceof ArrayBuffer){const t=r.byteLength;let s=0;for(;s+32<t;){const i=new DataView(r,s),n=mc(i);e.push(n),s+=n.size}}return e}function mc(r){const e=r.getUint32(0),t=r.byteOffset,s=r.byteLength;if(s<e)return{offset:t,size:s};if(r.getUint32(4)!==1886614376)return{offset:t,size:e};const n=r.getUint32(8)>>>24;if(n!==0&&n!==1)return{offset:t,size:e};const a=r.buffer,o=He.hexDump(new Uint8Array(a,t+12,16)),l=r.getUint32(28);let c=null,d=null;if(n===0){if(e-32<l||l<22)return{offset:t,size:e};d=new Uint8Array(a,t+32,l)}else if(n===1){if(!l||s<t+32+l*16+16)return{offset:t,size:e};c=[];for(let u=0;u<l;u++)c.push(new Uint8Array(a,t+32+u*16,16))}return{version:n,systemId:o,kids:c,data:d,offset:t,size:e}}let as={};class qt{static clearKeyUriToKeyIdMap(){as={}}constructor(e,t,s,i=[1],n=null){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=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Ie.FAIRPLAY:case Ie.WIDEVINE:case Ie.PLAYREADY:case Ie.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&O.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const s=gc(e);return new qt(this.method,this.uri,"identity",this.keyFormatVersions,s)}const t=Hl(this.uri);if(t)switch(this.keyFormat){case Ie.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Ie.PLAYREADY:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=hc(s,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(i)),a=n.substring(n.indexOf("<"),n.length),c=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("KID")[0];if(c){const d=c.childNodes[0]?c.childNodes[0].nodeValue:c.getAttribute("VALUE");if(d){const u=or(d).subarray(0,16);Gl(u),this.keyId=u}}break}default:{let s=t.subarray(0,16);if(s.length!==16){const i=new Uint8Array(16);i.set(s,16-s.length),s=i}this.keyId=s;break}}if(!this.keyId||this.keyId.byteLength!==16){let s=as[this.uri];if(!s){const i=Object.keys(as).length%Number.MAX_SAFE_INTEGER;s=new Uint8Array(16),new DataView(s.buffer,12,4).setUint32(0,i),as[this.uri]=s}this.keyId=s}return this}}function gc(r){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=r>>8*(15-t)&255;return e}const va=/\{\$([a-zA-Z0-9-_]+)\}/g;function Ur(r){return va.test(r)}function Le(r,e,t){if(r.variableList!==null||r.hasVariableRefs)for(let s=t.length;s--;){const i=t[s],n=e[i];n&&(e[i]=Gi(r,n))}}function Gi(r,e){if(r.variableList!==null||r.hasVariableRefs){const t=r.variableList;return e.replace(va,s=>{const i=s.substring(2,s.length-1),n=t==null?void 0:t[i];return n===void 0?(r.playlistParsingError||(r.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),s):n})}return e}function Gr(r,e,t){let s=r.variableList;s||(r.variableList=s={});let i,n;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(i))n=a.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(a){r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else i=e.NAME,n=e.VALUE;i in s?r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):s[i]=n||""}function vc(r,e,t){const s=e.IMPORT;if(t&&s in t){let i=r.variableList;i||(r.variableList=i={}),i[s]=t[s]}else r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}function ut(r=!0){return typeof self>"u"?void 0:(r||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function yc(r){return typeof self<"u"&&r===self.ManagedMediaSource}const ks={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,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,rv
vendor: 37,644 bytes, line 11
1160:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Ec(r,e){const t=ks[e];return!!t&&!!t[r.slice(0,4)]}function di(r,e,t=!0){return!r.split(",").some(s=>!ya(s,e,t))}function ya(r,e,t=!0){var s;const i=ut(t);return(s=i==null?void 0:i.isTypeSupported(jt(r,e)))!=null?s:!1}function jt(r,e){return`${e}/mp4;codecs="${r}"`}function Hr(r){if(r){const e=r.substring(0,4);return ks.video[e]}return 2}function Ms(r){return r.split(",").reduce((e,t)=>{const s=ks.video[t];return s?(s*2+e)/(e?3:2):(ks.audio[t]+e)/(e?2:1)},0)}const ui={};function xc(r,e=!0){if(ui[r])return ui[r];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[r];for(let s=0;s<t.length;s++)if(ya(t[s],"audio",e))return ui[r]=t[s],t[s];return r}const Tc=/flac|opus/i;function Os(r,e=!0){return r.replace(Tc,t=>xc(t.toLowerCase(),e))}function Vr(r,e){return r&&r!=="mp4a"?r:e&&e.split(",")[0]}function Sc(r){const e=r.split(",");for(let t=0;t<e.length;t++){const s=e[t].split(".");if(s.length>2){let i=s.shift()+".";i+=parseInt(s.shift()).toString(16),i+=("000"+parseInt(s.shift()).toString(16)).slice(-4),e[t]=i}}return e.join(",")}const zr=/#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,Kr=/#EXT-X-MEDIA:(.*)/g,bc=/^#EXT(?:INF|-X-TARGETDURATION):/m,Yr=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),wc=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(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 ze{static findGroup(e,t){for(let s=0;s<e.length;s++){const i=e[s];if(i.id===t)return i}}static resolve(e,t){return ar.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return bc.test(e)}static parseMasterPlaylist(e,t){const s=Ur(e),i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:s},n=[];zr.lastIndex=0;let a;for(;(a=zr.exec(e))!=null;)if(a[1]){var o;const c=new ue(a[1]);Le(i,c,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const d=Gi(i,a[2]),u={attrs:c,bitrate:c.decimalInteger("BANDWIDTH")||c.decimalInteger("AVERAGE-BANDWIDTH"),name:c.NAME,url:ze.resolve(d,t)},f=c.decimalResolution("RESOLUTION");f&&(u.width=f.width,u.height=f.height),Lc(c.CODECS,u),(o=u.unknownCodecs)!=null&&o.length||n.push(u),i.levels.push(u)}else if(a[3]){const c=a[3],d=a[4];switch(c){case"SESSION-DATA":{const u=new ue(d);Le(i,u,["DATA-ID","LANGUAGE","VALUE","URI"]);const f=u["DATA-ID"];f&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[f]=u);break}case"SESSION-KEY":{const u=Wr(d,t,i);u.encrypted&&u.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(u)):O.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${d}"`);break}case"DEFINE":{{const u=new ue(d);Le(i,u,["NAME","VALUE","QUERYPARAM"]),Gr(i,u,t)}break}case"CONTENT-STEERING":{const u=new ue(d);Le(i,u,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:ze.resolve(u["SERVER-URI"],t),pathwayId:u["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=qr(d);break}}}const l=n.length>0&&n.length<i.levels.length;return i.levels=l?n:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(e,t,s){let i;const n={},a=s.levels,o={AUDIO:a.map(c=>({id:c.attrs.AUDIO,audioCodec:c.audioCodec})),SUBTITLES:a.map(c=>({id:c.attrs.SUBTITLES,textCodec:c.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(Kr.lastIndex=0;(i=Kr.exec(e))!==null;){const c=new ue(i[1]),d=c.TYPE;if(d){const u=o[d],f=n[d]||[];n[d]=f,Le(s,c,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const h=c.LANGUAGE,p=c["ASSOC-LANGUAGE"],m=c.CHANNELS,g=c.CHARACTERISTICS,y=c["INSTREAM-ID"],E={attrs:c,bitrate:0,id:l++,groupId:c["GROUP-ID"]||"",name:c.NAME||h||"",type:d,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:h,url:c.URI?ze.resolve(c.URI,t):""};if(p&&(E.assocLang=p),m&&(E.channels=m),g&&(E.characteristics=g),y&&(E.instreamId=y),u!=null&&u.length){const v=ze.findGroup(u,E.groupId)||u[0];jr(E,v,"audioCodec"),jr(E,v,"textCodec")}f.push(E)}}return n}static parseLevelPlaylist(e,t,s,i,n,a){const o=new $l(t),l=o.fragments;let c=null,d=0,u=0,f=0,h=0,p=null,m=new ni(i,t),g,y,E,v=-1,S=!1,T=null;for(Yr.lastIndex=0,o.m3u8=e,o.hasVariableRefs=Ur(e);(g=Yr.exec(e))!==null;){S&&(S=!1,m=new ni(i,t),m.start=f,m.sn=d,m.cc=h,m.level=s,c&&(m.initSegment=c,m.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null,T&&(m.setByteRange(T),T=null)));const A=g[1];if(A){m.duration=parseFloat(A);const w=(" "+g[2]).slice(1);m.title=w||null,m.tagList.push(w?["INF",A,w]:["INF",A])}else if(g[3]){if(W(m.duration)){m.start=f,E&&Zr(m,E,o),m.sn=d,m.level=s,m.cc=h,l.push(m);const w=(" "+g[3]).slice(1);m.relurl=Gi(o,w),Xr(m,p),p=m,f+=m.duration,d++,u=0,S=!0}}else if(g[4]){const w=(" "+g[4]).slice(1);p?m.setByteRange(w,p):m.setByteRange(w)}else if(g[5])m.rawProgramDateTime=(" "+g[5]).slice(1),m.tagList.push(["PROGRAM-DATE-TIME",m.rawProgramDateTime]),v===-1&&(v=l.length);else{if(g=g[0].match(wc),!g){O.warn("No matches on slow regex match for level playlist!");continue}for(y=1;y<g.length&&!(typeof g[y]<"u");y++);const w=(" "+g[y]).slice(1),I=(" "+g[y+1]).slice(1),P=g[y+2]?(" "+g[y+2]).slice(1):"";switch(w){case"PLAYLIST-TYPE":o.type=I.toUpperCase();break;case"MEDIA-SEQUENCE":d=o.startSN=parseInt(I);break;case"SKIP":{const R=new ue(I);Le(o,R,["RECENTLY-REMOVED-DATERANGES"]);const D=R.decimalInteger("SKIPPED-SEGMENTS");if(W(D)){o.skippedSegments=D;for(let B=D;B--;)l.unshift(null);d+=D}const _=R.enumeratedString("RECENTLY-REMOVED-DATERANGES");_&&(o.recentlyRemovedDateranges=_.split(" "));break}case"TARGETDURATION":o.targetduration=Math.max(parseInt(I),1);break;case"VERSION":o.version=parseInt(I);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":o.live=!1;break;case"#":(I||P)&&m.tagList.push(P?[I,P]:[I]);break;case"DISCONTINUITY":h++,m.tagList.push(["DIS"]);break;case"GAP":m.gap=!0,m.tagList.push([w]);break;case"BITRATE":m.tagList.push([w,I]);break;case"DATERANGE":{const R=new ue(I);Le(o,R,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Le(o,R,R.clientAttrs);const D=new ra(R,o.dateRanges[R.ID]);D.isValid||o.skippedSegments?o.dateRanges[D.id]=D:O.warn(`Ignoring invalid DATERANGE tag: "${I}"`),m.tagList.push(["EXT-X-DATERANGE",I]);break}case"DEFINE":{{const R=new ue(I);Le(o,R,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in R?vc(o,R,a):Gr(o,R,t)}break}case"DISCONTINUITY-SEQUENCE":h=parseInt(I);break;case"KEY":{const R=Wr(I,t,o);if(R.isSupported()){if(R.method==="NONE"){E=void 0;break}E||(E={}),E[R.keyFormat]&&(E=me({},E)),E[R.keyFormat]=R}else O.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${I}"`);break}case"START":o.startTimeOffset=qr(I);break;case"MAP":{const R=new ue(I);if(Le(o,R,["BYTERANGE","URI"]),m.duration){const D=new ni(i,t);Qr(D,R,s,E),c=D,m.initSegment=c,c.rawProgramDateTime&&!m.rawProgramDateTime&&(m.rawProgramDateTime=c.rawProgramDateTime)}else{const D=m.byteRangeEndOffset;if(D){const _=m.byteRangeStartOffset;T=`${D-_}@${_}`}else T=null;Qr(m,R,s,E),c=m,S=!0}break}case"SERVER-CONTROL":{const R=new ue(I);o.canBlockReload=R.bool("CAN-BLOCK-RELOAD"),o.canSkipUntil=R.optionalFloat("CAN-SKIP-UNTIL",0),o.canSkipDateRanges=o.canSkipUntil>0&&R.bool("CAN-SKIP-DATERANGES"),o.partHoldBack=R.optionalFloat("PART-HOLD-BACK",0),o.holdBack=R.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const R=new ue(I);o.partTarget=R.decimalFloatingPoint("PART-TARGET");break}case"PART":{let R=o.partList;R||(R=o.partList=[]);const D=u>0?R[R.length-1]:void 0,_=u++,B=new ue(I);Le(o,B,["BYTERANGE","URI"]);const k=new Nl(B,m,t,_,D);R.push(k),m.duration+=k.duration;break}case"PRELOAD-HINT":{const R=new ue(I);Le(o,R,["URI"]),o.preloadHint=R;break}case"RENDITION-REPORT":{const R=new ue(I);Le(o,R,["URI"]),o.renditionReports=o.renditionReports||[],o.renditionReports.push(R);break}default:O.warn(`line parsed but not handled: ${g}`);break}}}p&&!p.relurl?(l.pop(),f-=p.duration,o.partList&&(o.fragmentHint=p)):o.partList&&(Xr(m,p),m.cc=h,o.fragmentHint=m,E&&Zr(m,E,o));const L=l.length,b=l[0],C=l[L-1];if(f+=o.skippedSegments*o.targetduration,f>0&&L&&C){o.averagetargetduration=f/L;const A=C.sn;o.endSN=A!=="initSegment"?A:0,o.live||(C.endList=!0),b&&(o.startCC=b.cc)}else o.endSN=0,o.startCC=0;return o.fragmentHint&&(f+=o.fragmentHint.duration),o.totalduration=f,o.endCC=h,v>0&&Ac(l,v),o}}function Wr(r,e,t){var s,i;const n=new ue(r);Le(t,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const a=(s=n.METHOD)!=null?s:"",o=n.URI,l=n.hexadecimalInteger("IV"),c=n.KEYFORMATVERSIONS,d=(i=n.KEYFORMAT)!=null?i:"identity";o&&n.IV&&!l&&O.error(`Invalid IV: ${n.IV}`);const u=o?ze.resolve(o,e):"",f=(c||"1").split("/").map(Number).filter(Number.isFinite);return new qt(a,u,d,f,l)}function qr(r){const t=new ue(r).decimalFloatingPoint("TIME-OFFSET");return W(t)?t:null}function Lc(r,e){let t=(r||"").split(/[ ,]+/).filter(s=>s);["video","audio","text"].forEach(s=>{const i=t.filter(n=>Ec(n,s));i.length&&(e[`${s}Codec`]=i.join(","),t=t.filter(n=>i.indexOf(n)===-1))}),e.unknownCodecs=t}function jr(r,e,t){const s=e[t];s&&(r[t]=s)}function Ac(r,e){let t=r[e];for(let s=e;s--;){const i=r[s];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function Xr(r,e){r.rawProgramDateTime?r.programDateTime=Date.parse(r.rawProgramDateTime):e!=null&&e.programDateTime&&(r.programDateTime=e.endProgramDateTime),W(r.programDateTime)||(r.programDateTime=null,r.rawProgramDateTime=null)}function Qr(r,e,t,s){r.relurl=e.URI,e.BYTERANGE&&r.setByteRange(e.BYTERANGE),r.level=t,r.sn="initSegment",s&&(r.levelkeys=s),r.initSegment=null}function Zr(r,e,t){r.levelkeys=e;const{encryptedFragments:s}=t;(!s.length||s[s.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&s.push(r)}var ne={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},X={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Jr(r){const{type:e}=r;switch(e){case ne.AUDIO_TRACK:return X.AUDIO;case ne.SUBTITLE_TRACK:return X.SUBTITLE;default:return X.MAIN}}function fi(r,e){let t=r.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Ic{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.LEVEL_LOADING,this.onLevelLoading,this),e.on(x.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(x.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.LEVEL_LOADING,this.onLevelLoading,this),e.off(x.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(x.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,s=t.pLoader,i=t.loader,n=s||i,a=new n(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:s}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ne.MANIFEST,url:s,deliveryDirectives:null})}onLevelLoading(e,t){const{id:s,level:i,pathwayId:n,url:a,deliveryDirectives:o}=t;this.load({id:s,level:i,pathwayId:n,responseType:"text",type:ne.LEVEL,url:a,deliveryDirectives:o})}onAudioTrackLoading(e,t){const{id:s,groupId:i,url:n,deliveryDirectives:a}=t;this.load({id:s,groupId:i,level:null,responseType:"text",type:ne.AUDIO_TRACK,url:n,deliveryDirectives:a})}onSubtitleTrackLoading(e,t){const{id:s,groupId:i,url:n,deliveryDirectives:a}=t;this.load({id:s,groupId:i,level:null,responseType:"text",type:ne.SUBTITLE_TRACK,url:n,deliveryDirectives:a})}load(e){var t;const s=this.hls.config;let i=this.getInternalLoader(e);if(i){const c=i.context;if(c&&c.url===e.url&&c.level===e.level){O.trace("[playlist-loader]: playlist request ongoing");return}O.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let n;if(e.type===ne.MANIFEST?n=s.manifestLoadPolicy.default:n=me({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),W((t=e.deliveryDirectives)==null?void 0:t.part)){let c;if(e.type===ne.LEVEL&&e.level!==null?c=this.hls.levels[e.level].details:e.type===ne.AUDIO_TRACK&&e.id!==null?c=this.hls.audioTracks[e.id].details:e.type===ne.SUBTITLE_TRACK&&e.id!==null&&(c=this.hls.subtitleTracks[e.id].details),c){const d=c.partTarget,u=c.targetduration;if(d&&u){const f=Math.max(d*3,u*.8)*1e3;n=me({},n,{maxTimeToFirstByteMs:Math.min(f,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(f,n.maxTimeToFirstByteMs)})}}}const a=n.errorRetry||n.timeoutRetry||{},o={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(c,d,u,f)=>{const h=this.getInternalLoader(u);this.resetInternalLoader(u.type);const p=c.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(c,u,new Error("no EXTM3U delimiter"),f||null,d);return}d.parsing.start=performance.now(),ze.isMediaPlaylist(p)?this.handleTrackOrLevelPlaylist(c,d,u,f||null,h):this.handleMasterPlaylist(c,d,u,f)},onError:(c,d,u,f)=>{this.handleNetworkError(d,u,!1,c,f)},onTimeout:(c,d,u)=>{this.handleNetworkError(d,u,!0,void 0,c)}};i.load(e,o,l)}handleMasterPlaylist(e,t,s,i){const n=this.hls,a=e.data,o=fi(e,s),l=ze.parseMasterPlaylist(a,o);if(l.playlistParsingError){this.handleManifestParsingError(e,s,l.playlistParsingError,i,t);return}const{contentSteering:c,levels:d,sessionData:u,sessionKeys:f,startTimeOffset:h,variableList:p}=l;this.variableList=p;const{AUDIO:m=[],SUBTITLES:g,"CLOSED-CAPTIONS":y}=ze.parseMasterPlaylistMedia(a,o,l);m.length&&!m.some(v=>!v.url)&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(O.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new ue({}),bitrate:0,url:""})),n.trigger(x.MANIFEST_LOADED,{levels:d,audioTracks:m,subtitles:g,captions:y,contentSteering:c,url:o,stats:t,networkDetails:i,sessionData:u,sessionKeys:f,startTimeOffset:h,variableList:p})}handleTrackOrLevelPlaylist(e,t,s,i,n){const a=this.hls,{id:o,level:l,type:c}=s,d=fi(e,s),u=0,f=W(l)?l:W(o)?o:0,h=Jr(s),p=ze.parseLevelPlaylist(e.data,d,f,h,u,this.variableList);if(c===ne.MANIFEST){const m={attrs:new ue({}),bitrate:0,details:p,name:"",url:d};a.trigger(x.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:d,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),s.levelDetails=p,this.handlePlaylistLoaded(p,e,t,s,i,n)}handleManifestParsingError(e,t,s,i,n){this.hls.trigger(x.ERROR,{type:J.NETWORK_ERROR,details:$.MANIFEST_PARSING_ERROR,fatal:t.type===ne.MANIFEST,url:e.url,err:s,error:s,reason:s.message,response:e,context:t,networkDetails:i,stats:n})}handleNetworkError(e,t,s=!1,i,n){let a=`A network ${s?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===ne.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===ne.AUDIO_TRACK||e.type===ne.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);O.warn(`[playlist-loader]: ${a}`);let l=$.UNKNOWN,c=!1;const d=this.getInternalLoader(e);switch(e.type){case ne.MANIFEST:l=s?$.MANIFEST_LOAD_TIMEOUT:$.MANIFEST_LOAD_ERROR,c=!0;break;case ne.LEVEL:l=s?$.LEVEL_LOAD_TIMEOUT:$.LEVEL_LOAD_ERROR,c=!1;break;case ne.AUDIO_TRACK:l=s?$.AUDIO_TRACK_LOAD_TIMEOUT:$.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case ne.SUBTITLE_TRACK:l=s?$.SUBTITLE_TRACK_LOAD_TIMEOUT:$.SUBTITLE_LOAD_ERROR,c=!1;break}d&&this.resetInternalLoader(e.type);const u={type:J.NETWORK_ERROR,details:l,fatal:c,url:e.url,loader:d,context:e,error:o,networkDetails:t,stats:n};if(i){const f=(t==null?void 0:t.url)||e.url;u.response=Ee({url:f,data:void 0},i)}this.hls.trigger(x.ERROR,u)}handlePlaylistLoaded(e,t,s,i,n,a){const o=this.hls,{type:l,level:c,id:d,groupId:u,deliveryDirectives:f}=i,h=fi(t,i),p=Jr(i),m=typeof i.level=="number"&&p===X.MAIN?c:void 0;if(!e.fragments.length){const y=new Error("No Segments found in Playlist");o.trigger(x.ERROR,{type:J.NETWORK_ERROR,details:$.LEVEL_EMPTY_ERROR,fatal:!1,url:h,error:y,reason:y.message,response:t,context:i,level:m,parent:p,networkDetails:n,stats:s});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const g=e.playlistParsingError;if(g){o.trigger(x.ERROR,{type:J.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:h,error:g,reason:g.message,response:t,context:i,level:m,parent:p,networkDetails:n,stats:s});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case ne.MANIFEST:case ne.LEVEL:o.trigger(x.LEVEL_LOADED,{details:e,level:m||0,id:d||0,stats:s,networkDetails:n,deliveryDirectives:f});break;case ne.AUDIO_TRACK:o.trigger(x.AUDIO_TRACK_LOADED,{details:e,id:d||0,groupId:u||"",stats:s,networkDetails:n,deliveryDirectives:f});break;case ne.SUBTITLE_TRACK:o.trigger(x.SUBTITLE_TRACK_LOADED,{details:e,id:d||0,groupId:u||"",stats:s,networkDetails:n,deliveryDirectives:f});break}}}function Ea(r,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=r,e.dispatchEvent(t)}function xa(r,e){const t=r.mode;if(t==="disabled"&&(r.mode="hidden"),r.cues&&!r.cues.getCueById(e.id))try{if(r.addCue(e),!r.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(s){O.debug(`[texttrack-utils]: ${s}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,r.addCue(i)}catch(i){O.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(r.mode=t)}function Tt(r){const e=r.mode;if(e==="disabled"&&(r.mode="hidden"),r.cues)for(let t=r.cues.length;t--;)r.removeCue(r.cues[t]);e==="disabled"&&(r.mode=e)}function Hi(r,e,t,s){const i=r.mode;if(i==="disabled"&&(r.mode="hidden"),r.cues&&r.cues.length>0){const n=Cc(r.cues,e,t);for(let a=0;a<n.length;a++)(!s||s(n[a]))&&r.removeCue(n[a])}i==="disabled"&&(r.mode=i)}function Rc(r,e){if(e<r[0].startTime)return 0;const t=r.length-1;if(e>r[t].endTime)return-1;let s=0,i=t;for(;s<=i;){const n=Math.floor((i+s)/2);if(e<r[n].startTime)i=n-1;else if(e>r[n].startTime&&s<t)s=n+1;else return n}return r[s].startTime-e<e-r[i].startTime?s:i}function Cc(r,e,t){const s=[],i=Rc(r,e);if(i>-1)for(let n=i,a=r.length;n<a;n++){const o=r[n];if(o.startTime>=e&&o.endTime<=t)s.push(o);else if(o.startTime>t)return s}return s}function ys(r){const e=[];for(let t=0;t<r.length;t++){const s=r[t];(s.kind==="subtitles"||s.kind==="captions")&&s.label&&e.push(r[t])}return e}var $e={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const Dc=.25;function Vi(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function en(r,e,t,s,i){let n=new r(e,t,"");try{n.value=s,i&&(n.type=i)}catch{n=new r(e,t,JSON.stringify(i?Ee({type:i},s):s))}return n}const os=(()=>{const r=Vi();try{r&&new r(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function hi(r,e){return r.getTime()/1e3-e}function _c(r){return Uint8Array.from(r.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class Pc{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(x.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(x.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(Tt(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const s=e[t];if(s.kind==="metadata"&&s.label==="id3")return Ea(s,this.media),s}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:s,enableID3MetadataCues:i}}}=this;if(!s&&!i)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=Vi();if(a)for(let o=0;o<n.length;o++){const l=n[o].type;if(l===$e.emsg&&!s||!i)continue;const c=ca(n[o].data);if(c){const d=n[o].pts;let u=d+n[o].duration;u>os&&(u=os),u-d<=0&&(u=d+Dc);for(let h=0;h<c.length;h++){const p=c[h];if(!la(p)){this.updateId3CueEnds(d,l);const m=en(a,d,u,p,l);m&&this.id3Track.addCue(m)}}}}}updateId3CueEnds(e,t){var s;const i=(s=this.id3Track)==null?void 0:s.cues;if(i)for(let n=i.length;n--;){const a=i[n];a.type===t&&a.startTime<e&&a.endTime===os&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:s,type:i}){const{id3Track:n,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:l}}=a;if(n&&(o||l)){let c;i==="audio"?c=d=>d.type===$e.audioId3&&l:i==="video"?c=d=>d.type===$e.emsg&&o:c=d=>d.type===$e.audioId3&&l||d.type===$e.emsg&&o,Hi(n,t,s,c)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:s,id3Track:i}=this,{dateRanges:n}=t,a=Object.keys(n);if(i){const d=Object.keys(s).filter(u=>!a.includes(u));for(let u=d.length;u--;){const f=d[u];Object.keys(s[f].cues).forEach(h=>{i.removeCue(s[f].cues[h])}),delete s[f]}}const o=t.fragments[t.fragments.length-1];if(a.length===0||!W(o==null?void 0:o.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const l=o.programDateTime/1e3-o.start,c=Vi();for(let d=0;d<a.length;d++){const u=a[d],f=n[u],h=hi(f.startDate,l),p=s[u],m=(p==null?void 0:p.cues)||{};let g=(p==null?void 0:p.durationKnown)||!1,y=os;const E=f.endDate;if(E)y=hi(E,l),g=!0;else if(f.endOnNext&&!g){const S=a.reduce((T,L)=>{if(L!==f.id){const b=n[L];if(b.class===f.class&&b.startDate>f.startDate&&(!T||f.startDate<T.startDate))return b}return T},null);S&&(y=hi(S.startDate,l),g=!0)}const v=Object.keys(f.attr);for(let S=0;S<v.length;S++){const T=v[S];if(!Ol(T))continue;const L=m[T];if(L)g&&!p.durationKnown&&(L.endTime=y);else if(c){let b=f.attr[T];Fl(T)&&(b=_c(b));const C=en(c,h,y,{key:T,data:b},$e.dateRange);C&&(C.id=u,this.id3Track.addCue(C),m[T]=C)}}s[u]={cues:m,dateRange:f,durationKnown:g}}}}class kc{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:s,targetduration:i}=e,{liveSyncDuration:n,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,l=this.hls.userConfig;let c=o&&s||t;(l.liveSyncDuration||l.liveSyncDurationCount||c===0)&&(c=n!==void 0?n:a*i);const d=i;return c+Math.min(this.stallCount*1,d)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,s=this.levelDetails;if(e===null||t===null||s===null)return null;const i=s.edge,n=e-t-this.edgeStalled,a=i-s.totalduration,o=i-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(a,n),o)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const s=e.buffered.length;return(s?e.buffered.end(s-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(x.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(x.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(x.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(x.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(x.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(x.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var s;t.details===$.BUFFER_STALLED_ERROR&&(this.stallCount++,(s=this.levelDetails)!=null&&s.live&&O.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const s=this.computeLatency();if(s===null)return;this._latency=s;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:n}=this.config;if(!i||n===1||!t.live)return;const a=this.targetLatency;if(a===null)return;const o=s-a,l=Math.min(this.maxLatency,a+t.targetduration);if(o<l&&o>.05&&this.forwardBufferLength>1){const d=Math.min(2,Math.max(1,n)),u=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;e.playbackRate=Math.min(d,Math.max(1,u))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const zi=["NONE","TYPE-0","TYPE-1",null];function Mc(r){return zi.indexOf(r)>-1}const Fs=["SDR","PQ","HLG"];function Oc(r){return!!r&&Fs.indexOf(r)>-1}var Es={No:"",Yes:"YES",v2:"v2"};function tn(r){const{canSkipUntil:e,canSkipDateRanges:t,age:s}=r,i=s<e/2;return e&&i?t?Es.v2:Es.Yes:Es.No}class sn{constructor(e,t,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=s}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class At{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(t=>!!t).map(t=>t.substring(0,4)).join(","),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 rn(this._audioGroups,e)}hasSubtitleGroup(e){return rn(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 rn(r,e){return!e||!r?!1:r.indexOf(e)!==-1}function pi(r,e){const t=e.startPTS;if(W(t)){let s=0,i;e.sn>r.sn?(s=t-r.start,i=r):(s=r.start-t,i=e),i.duration!==s&&(i.duration=s)}else e.sn>r.sn?r.cc===e.cc&&r.minEndPTS?e.start=r.start+(r.minEndPTS-r.start):e.start=r.start+r.duration:e.start=Math.max(r.start-e.duration,0)}function Ta(r,e,t,s,i,n){s-t<=0&&(O.warn("Fragment should have a positive duration",e),s=t+e.duration,n=i+e.duration);let o=t,l=s;const c=e.startPTS,d=e.endPTS;if(W(c)){const g=Math.abs(c-t);W(e.deltaPTS)?e.deltaPTS=Math.max(g,e.deltaPTS):e.deltaPTS=g,o=Math.max(t,c),t=Math.min(t,c),i=Math.min(i,e.startDTS),l=Math.min(s,d),s=Math.max(s,d),n=Math.max(n,e.endDTS)}const u=t-e.start;e.start!==0&&(e.start=t),e.duration=s-e.start,e.startPTS=t,e.maxStartPTS=o,e.startDTS=i,e.endPTS=s,e.minEndPTS=l,e.endDTS=n;const f=e.sn;if(!r||f<r.startSN||f>r.endSN)return 0;let h;const p=f-r.startSN,m=r.fragments;for(m[p]=e,h=p;h>0;h--)pi(m[h],m[h-1]);for(h=p;h<m.length-1;h++)pi(m[h],m[h+1]);return r.fragmentHint&&pi(m[m.length-1],r.fragmentHint),r.PTSKnown=r.alignedSliding=!0,u}function Fc(r,e){let t=null;const s=r.fragments;for(let l=s.length-1;l>=0;l--){const c=s[l].initSegment;if(c){t=c;break}}r.fragmentHint&&delete r.fragmentHint.endPTS;let i=0,n;if($c(r,e,(l,c)=>{l.relurl&&(i=l.cc-c.cc),W(l.startPTS)&&W(l.endPTS)&&(c.start=c.startPTS=l.startPTS,c.startDTS=l.startDTS,c.maxStartPTS=l.maxStartPTS,c.endPTS=l.endPTS,c.endDTS=l.endDTS,c.minEndPTS=l.minEndPTS,c.duration=l.endPTS-l.startPTS,c.duration&&(n=c),e.PTSKnown=e.alignedSliding=!0),c.elementaryStreams=l.elementaryStreams,c.loader=l.loader,c.stats=l.stats,l.initSegment&&(c.initSegment=l.initSegment,t=l.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(c=>{var d;c&&(!c.initSegment||c.initSegment.relurl===((d=t)==null?void 0:d.relurl))&&(c.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(l=>!l),e.deltaUpdateFailed){O.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let l=e.skippedSegments;l--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=Nc(r.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const a=e.fragments;if(i){O.warn("discontinuity sliding from playlist, take drift into account");for(let l=0;l<a.length;l++)a[l].cc+=i}e.skippedSegments&&(e.startCC=e.fragments[0].cc),Bc(r.partList,e.partList,(l,c)=>{c.elementaryStreams=l.elementaryStreams,c.stats=l.stats}),n?Ta(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):Sa(r,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=r.driftStartTime,e.driftStart=r.driftStart;const o=e.advancedDateTime;if(e.advanced&&o){const l=e.edge;e.driftStart||(e.driftStartTime=o,e.driftStart=l),e.driftEndTime=o,e.driftEnd=l}else e.driftEndTime=r.driftEndTime,e.driftEnd=r.driftEnd,e.advancedDateTime=r.advancedDateTime}function Nc(r,e,t){const s=me({},r);return t&&t.forEach(i=>{delete s[i]}),Object.keys(e).forEach(i=>{const n=new ra(e[i].attr,s[i]);n.isValid?s[i]=n:O.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[i].attr)}"`)}),s}function Bc(r,e,t){if(r&&e){let s=0;for(let i=0,n=r.length;i<=n;i++){const a=r[i],o=e[i+s];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?t(a,o):s--}}}function $c(r,e,t){const s=e.skippedSegments,i=Math.max(r.startSN,e.startSN)-e.startSN,n=(r.fragmentHint?1:0)+(s?e.endSN:Math.min(r.endSN,e.endSN))-e.startSN,a=e.startSN-r.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments;for(let c=i;c<=n;c++){const d=l[a+c];let u=o[c];s&&!u&&c<s&&(u=e.fragments[c]=d),d&&u&&t(d,u)}}function Sa(r,e){const t=e.startSN+e.skippedSegments-r.startSN,s=r.fragments;t<0||t>=s.length||Ki(e,s[t].start)}function Ki(r,e){if(e){const t=r.fragments;for(let s=r.skippedSegments;s<t.length;s++)t[s].start+=e;r.fragmentHint&&(r.fragmentHint.start+=e)}}function Uc(r,e=1/0){let t=1e3*r.targetduration;if(r.updated){const s=r.fragments;if(s.length&&t*4>e){const n=s[s.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function Gc(r,e,t){if(!(r!=null&&r.details))return null;const s=r.details;let i=s.fragments[e-s.startSN];return i||(i=s.fragmentHint,i&&i.sn===e)?i:e<s.startSN&&t&&t.sn===e?t:null}function nn(r,e,t){var s;return r!=null&&r.details?ba((s=r.details)==null?void 0:s.partList,e,t):null}function ba(r,e,t){if(r)for(let s=r.length;s--;){const i=r[s];if(i.index===t&&i.fragment.sn===e)return i}return null}function wa(r){r.forEach((e,t)=>{const{details:s}=e;s!=null&&s.fragments&&s.fragments.forEach(i=>{i.level=t})})}function Ns(r){switch(r.details){case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_TIMEOUT:case $.LEVEL_LOAD_TIMEOUT:case $.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function an(r,e){const t=Ns(e);return r.default[`${t?"timeout":"error"}Retry`]}function dr(r,e){const t=r.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*r.retryDelayMs,r.maxRetryDelayMs)}function on(r){return Ee(Ee({},r),{errorRetry:null,timeoutRetry:null})}function Bs(r,e,t,s){if(!r)return!1;const i=s==null?void 0:s.code,n=e<r.maxNumRetry&&(Hc(i)||!!t);return r.shouldRetry?r.shouldRetry(r,e,t,s,n):n}function Hc(r){return r===0&&navigator.onLine===!1||!!r&&(r<400||r>499)}const La={search:function(r,e){let t=0,s=r.length-1,i=null,n=null;for(;t<=s;){i=(t+s)/2|0,n=r[i];const a=e(n);if(a>0)t=i+1;else if(a<0)s=i-1;else return n}return null}};function Vc(r,e,t){if(e===null||!Array.isArray(r)||!r.length||!W(e))return null;const s=r[0].programDateTime;if(e<(s||0))return null;const i=r[r.length-1].endProgramDateTime;if(e>=(i||0))return null;t=t||0;for(let n=0;n<r.length;++n){const a=r[n];if(Kc(e,t,a))return a}return null}function $s(r,e,t=0,s=0,i=.005){let n=null;if(r){n=e[r.sn-e[0].sn+1]||null;const o=r.endDTS-t;o>0&&o<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(n=e[0]);if(n&&((!r||r.level===n.level)&&Yi(t,s,n)===0||zc(n,r,Math.min(i,s))))return n;const a=La.search(e,Yi.bind(null,t,s));return a&&(a!==r||!n)?a:n}function zc(r,e,t){if(e&&e.start===0&&e.level<r.level&&(e.endPTS||0)>0){const s=e.tagList.reduce((i,n)=>(n[0]==="INF"&&(i+=parseFloat(n[1])),i),t);return r.start<=s}return!1}function Yi(r=0,e=0,t){if(t.start<=r&&t.start+t.duration>r)return 0;const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-s<=r?1:t.start-s>r&&t.start?-1:0}function Kc(r,e,t){const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-s>r}function Yc(r,e){return La.search(r,t=>t.cc<e?1:t.cc>e?-1:0)}var xe={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Fe={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class Wc{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=O.log.bind(O,"[info]:"),this.warn=O.warn.bind(O,"[
11warning]:"),this.error=O.error.bind(O,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(x.ERROR,this.onError,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(x.ERROR,this.onError,this),e.off(x.ERROR,this.onErrorOut,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===X.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var s,i;if(t.fatal)return;const n=this.hls,a=t.context;switch(t.details){case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case $.FRAG_PARSING_ERROR:if((s=t.frag)!=null&&s.gap){t.errorAction={action:xe.DoNothing,flags:Fe.None};return}case $.FRAG_GAP:case $.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=xe.SendAlternateToPenaltyBox;return}case $.LEVEL_EMPTY_ERROR:case $.LEVEL_PARSING_ERROR:{var o,l;const c=t.parent===X.MAIN?t.level:n.loadLevel;t.details===$.LEVEL_EMPTY_ERROR&&((o=t.context)!=null&&(l=o.levelDetails)!=null&&l.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:typeof(a==null?void 0:a.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.level));return;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.SUBTITLE_LOAD_ERROR:case $.SUBTITLE_TRACK_LOAD_TIMEOUT:if(a){const c=n.levels[n.loadLevel];if(c&&(a.type===ne.AUDIO_TRACK&&c.hasAudioGroup(a.groupId)||a.type===ne.SUBTITLE_TRACK&&c.hasSubtitleGroup(a.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=xe.SendAlternateToPenaltyBox,t.errorAction.flags=Fe.MoveAllAlternatesMatchingHost;return}}return;case $.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const c=n.levels[n.loadLevel],d=c==null?void 0:c.attrs["HDCP-LEVEL"];d?t.errorAction={action:xe.SendAlternateToPenaltyBox,flags:Fe.MoveAllAlternatesMatchingHDCP,hdcpLevel:d}:this.keySystemError(t)}return;case $.BUFFER_ADD_CODEC_ERROR:case $.REMUX_ALLOC_ERROR:case $.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(i=t.level)!=null?i:n.loadLevel);return;case $.INTERNAL_EXCEPTION:case $.BUFFER_APPENDING_ERROR:case $.BUFFER_FULL_ERROR:case $.LEVEL_SWITCH_ERROR:case $.BUFFER_STALLED_ERROR:case $.BUFFER_SEEK_OVER_HOLE:case $.BUFFER_NUDGE_ON_STALL:t.errorAction={action:xe.DoNothing,flags:Fe.None};return}t.type===J.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const s=this.hls,i=an(s.config.playlistLoadPolicy,e),n=this.playlistError++;if(Bs(i,n,Ns(e),e.response))return{action:xe.RetryRequest,flags:Fe.None,retryConfig:i,retryCount:n};const o=this.getLevelSwitchAction(e,t);return i&&(o.retryConfig=i,o.retryCount=n),o}getFragRetryOrSwitchAction(e){const t=this.hls,s=this.getVariantLevelIndex(e.frag),i=t.levels[s],{fragLoadPolicy:n,keyLoadPolicy:a}=t.config,o=an(e.details.startsWith("key")?a:n,e),l=t.levels.reduce((d,u)=>d+u.fragmentError,0);if(i&&(e.details!==$.FRAG_GAP&&i.fragmentError++,Bs(o,l,Ns(e),e.response)))return{action:xe.RetryRequest,flags:Fe.None,retryConfig:o,retryCount:l};const c=this.getLevelSwitchAction(e,s);return o&&(c.retryConfig=o,c.retryCount=l),c}getLevelSwitchAction(e,t){const s=this.hls;t==null&&(t=s.loadLevel);const i=this.hls.levels[t];if(i){var n,a;const c=e.details;i.loadError++,c===$.BUFFER_APPEND_ERROR&&i.fragmentError++;let d=-1;const{levels:u,loadLevel:f,minAutoLevel:h,maxAutoLevel:p}=s;s.autoLevelEnabled||(s.loadLevel=-1);
vendor: 21,856 bytes, lines 11-18
11const m=(n=e.frag)==null?void 0:n.type,y=(m===X.AUDIO&&c===$.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(c===$.BUFFER_ADD_CODEC_ERROR||c===$.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:L})=>i.audioCodec!==L),v=e.sourceBufferName==="video"&&(c===$.BUFFER_ADD_CODEC_ERROR||c===$.BUFFER_APPEND_ERROR)&&u.some(({codecSet:L,audioCodec:b})=>i.codecSet!==L&&i.audioCodec===b),{type:S,groupId:T}=(a=e.context)!=null?a:{};for(let L=u.length;L--;){const b=(L+f)%u.length;if(b!==f&&b>=h&&b<=p&&u[b].loadError===0){var o,l;const C=u[b];if(c===$.FRAG_GAP&&m===X.MAIN&&e.frag){const A=u[b].details;if(A){const w=$s(e.frag,A.fragments,e.frag.start);if(w!=null&&w.gap)continue}}else{if(S===ne.AUDIO_TRACK&&C.hasAudioGroup(T)||S===ne.SUBTITLE_TRACK&&C.hasSubtitleGroup(T))continue;if(m===X.AUDIO&&(o=i.audioGroups)!=null&&o.some(A=>C.hasAudioGroup(A))||m===X.SUBTITLE&&(l=i.subtitleGroups)!=null&&l.some(A=>C.hasSubtitleGroup(A))||y&&i.audioCodec===C.audioCodec||!y&&i.audioCodec!==C.audioCodec||v&&i.codecSet===C.codecSet)continue}d=b;break}}if(d>-1&&s.loadLevel!==d)return e.levelRetry=!0,this.playlistError=0,{action:xe.SendAlternateToPenaltyBox,flags:Fe.None,nextAutoLevel:d}}return{action:xe.SendAlternateToPenaltyBox,flags:Fe.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case xe.DoNothing:break;case xe.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==$.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,hdcpLevel:n,nextAutoLevel:a}=s;switch(i){case Fe.None:this.switchLevel(e,a);break;case Fe.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=zi[zi.indexOf(n)-1],s.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}s.resolved||this.switchLevel(e,a)}switchLevel(e,t){t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}}class ur{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=O.log.bind(O,`${t}:`),this.warn=O.warn.bind(O,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,s){const i=t==null?void 0:t.renditionReports;if(i){let n=-1;for(let a=0;a<i.length;a++){const o=i[a];let l;try{l=new self.URL(o.URI,t.url).href}catch(c){O.warn(`Could not construct new URL for Rendition Report: ${c}`),l=o.URI||""}if(l===e){n=a;break}else l===e.substring(0,l.length)&&(n=a)}if(n!==-1){const a=i[n],o=parseInt(a["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let l=parseInt(a["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const d=Math.min(t.age-t.partTarget,t.targetduration);l>=0&&d>t.partTarget&&(l+=1)}const c=s&&tn(s);return new sn(o,l>=0?l:void 0,c)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,s){const{details:i,stats:n}=t,a=self.performance.now(),o=n.loading.first?Math.max(0,a-n.loading.first):0;if(i.advancedDateTime=Date.now()-o,i.live||s!=null&&s.live){if(i.reloaded(s),s&&this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),s&&i.fragments.length>0&&Fc(s,i),!this.canLoad||!i.live)return;let l,c,d;if(i.canBlockReload&&i.endSN&&i.advanced){const g=this.hls.config.lowLatencyMode,y=i.lastPartSn,E=i.endSN,v=i.lastPartIndex,S=v!==-1,T=y===E,L=g?0:v;S?(c=T?E+1:y,d=T?L:v+1):c=E+1;const b=i.age,C=b+i.ageHeader;let A=Math.min(C-i.partTarget,i.targetduration*1.5);if(A>0){if(s&&A>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${A} with playlist age: ${i.age}`),A=0;else{const w=Math.floor(A/i.targetduration);if(c+=w,d!==void 0){const I=Math.round(A%i.targetduration/i.partTarget);d+=I}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${b.toFixed(2)}s goal: ${A} skip sn ${w} to part ${d}`)}i.tuneInGoal=A}if(l=this.getDeliveryDirectives(i,t.deliveryDirectives,c,d),g||!T){this.loadPlaylist(l);return}}else(i.canBlockReload||i.canSkipUntil)&&(l=this.getDeliveryDirectives(i,t.deliveryDirectives,c,d));const u=this.hls.mainForwardBufferInfo,f=u?u.end-u.len:0,h=(i.edge-f)*1e3,p=Uc(i,h);i.updated&&a>this.requestScheduled+p&&(this.requestScheduled=n.loading.start),c!==void 0&&i.canBlockReload?this.requestScheduled=n.loading.first+p-(i.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+p<a?this.requestScheduled=a:this.requestScheduled-a<=0&&(this.requestScheduled+=p);let m=this.requestScheduled-a;m=Math.max(0,m),this.log(`reload live playlist ${e} in ${Math.round(m)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(l),m)}else this.clearTimer()}getDeliveryDirectives(e,t,s,i){let n=tn(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,i=t.part,n=Es.No),new sn(s,i,n)}checkRetry(e){const t=e.details,s=Ns(e),i=e.errorAction,{action:n,retryCount:a=0,retryConfig:o}=i||{},l=!!i&&!!o&&(n===xe.RetryRequest||!i.resolved&&n===xe.SendAlternateToPenaltyBox);if(l){var c;if(this.requestScheduled=-1,a>=o.maxNumRetry)return!1;if(s&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const d=dr(o,a);this.timer=self.setTimeout(()=>this.loadPlaylist(),d),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${d}ms`)}e.levelRetry=!0,i.resolved=!0}return l}}class pt{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 qc{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 pt(e),this.fast_=new pt(t),this.defaultTTFB_=i,this.ttfb_=new pt(e)}update(e,t){const{slow_:s,fast_:i,ttfb_:n}=this;s.halfLife!==e&&(this.slow_=new pt(e,s.getEstimate(),s.getTotalWeight())),i.halfLife!==t&&(this.fast_=new pt(t,i.getEstimate(),i.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new pt(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const s=8*t,i=e/1e3,n=s/i;this.fast_.sample(i,n),this.slow_.sample(i,n)}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_}destroy(){}}const Aa={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},ln={};function jc(r,e,t,s,i,n){const a=r.audioCodec?r.audioGroups:null,o=n==null?void 0:n.audioCodec,l=n==null?void 0:n.channels,c=l?parseInt(l):o?1/0:2;let d=null;if(a!=null&&a.length)try{a.length===1&&a[0]?d=e.groups[a[0]].channels:d=a.reduce((u,f)=>{if(f){const h=e.groups[f];if(!h)throw new Error(`Audio track group ${f} not found`);Object.keys(h.channels).forEach(p=>{u[p]=(u[p]||0)+h.channels[p]})}return u},{2:0})}catch{return!0}return r.videoCodec!==void 0&&(r.width>1920&&r.height>1088||r.height>1920&&r.width>1088||r.frameRate>Math.max(s,30)||r.videoRange!=="SDR"&&r.videoRange!==t||r.bitrate>Math.max(i,8e6))||!!d&&W(c)&&Object.keys(d).some(u=>parseInt(u)>c)}function Xc(r,e,t){const s=r.videoCodec,i=r.audioCodec;if(!s||!i||!t)return Promise.resolve(Aa);const n={width:r.width,height:r.height,bitrate:Math.ceil(Math.max(r.bitrate*.9,r.averageBitrate)),framerate:r.frameRate||30},a=r.videoRange;a!=="SDR"&&(n.transferFunction=a.toLowerCase());const o=s.split(",").map(l=>({type:"media-source",video:Ee(Ee({},n),{},{contentType:jt(l,"video")})}));return i&&r.audioGroups&&r.audioGroups.forEach(l=>{var c;l&&((c=e.groups[l])==null||c.tracks.forEach(d=>{if(d.groupId===l){const u=d.channels||"",f=parseFloat(u);W(f)&&f>2&&o.push.apply(o,i.split(",").map(h=>({type:"media-source",audio:{contentType:jt(h,"audio"),channels:""+f}})))}}))}),Promise.all(o.map(l=>{const c=Qc(l);return ln[c]||(ln[c]=t.decodingInfo(l))})).then(l=>({supported:!l.some(c=>!c.supported),configurations:o,decodingInfoResults:l})).catch(l=>({supported:!1,configurations:o,decodingInfoResults:[],error:l}))}function Qc(r){const{audio:e,video:t}=r,s=t||e;if(s){const i=s.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${i}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${i}`}return""}function Zc(){if(typeof matchMedia=="function"){const r=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(r.media!==e.media)return r.matches===!0}return!1}function Jc(r,e){let t=!1,s=[];return r&&(t=r!=="SDR",s=[r]),e&&(s=e.allowedVideoRanges||Fs.slice(0),t=e.preferHDR!==void 0?e.preferHDR:Zc(),t?s=s.filter(i=>i!=="SDR"):s=["SDR"]),{preferHDR:t,allowedVideoRanges:s}}function ed(r,e,t,s,i){const n=Object.keys(r),a=s==null?void 0:s.channels,o=s==null?void 0:s.audioCodec,l=a&&parseInt(a)===2;let c=!0,d=!1,u=1/0,f=1/0,h=1/0,p=0,m=[];const{preferHDR:g,allowedVideoRanges:y}=Jc(e,i);for(let T=n.length;T--;){const L=r[n[T]];c=L.channels[2]>0,u=Math.min(u,L.minHeight),f=Math.min(f,L.minFramerate),h=Math.min(h,L.minBitrate);const b=y.filter(C=>L.videoRanges[C]>0);b.length>0&&(d=!0,m=b)}u=W(u)?u:0,f=W(f)?f:0;const E=Math.max(1080,u),v=Math.max(30,f);return h=W(h)?h:t,t=Math.max(h,t),d||(e=void 0,m=[]),{codecSet:n.reduce((T,L)=>{const b=r[L];if(L===T)return T;if(b.minBitrate>t)return je(L,`min bitrate of ${b.minBitrate} > current estimate of ${t}`),T;if(!b.hasDefaultAudio)return je(L,"no renditions with default or auto-select sound found"),T;if(o&&L.indexOf(o.substring(0,4))%5!==0)return je(L,`audio codec preference "${o}" not found`),T;if(a&&!l){if(!b.channels[a])return je(L,`no renditions with ${a} channel sound found (channels options: ${Object.keys(b.channels)})`),T}else if((!o||l)&&c&&b.channels[2]===0)return je(L,"no renditions with stereo sound found"),T;return b.minHeight>E?(je(L,`min resolution of ${b.minHeight} > maximum of ${E}`),T):b.minFramerate>v?(je(L,`min framerate of ${b.minFramerate} > maximum of ${v}`),T):m.some(C=>b.videoRanges[C]>0)?b.maxScore<p?(je(L,`max score of ${b.maxScore} < selected max of ${p}`),T):T&&(Ms(L)>=Ms(T)||b.fragmentError>r[T].fragmentError)?T:(p=b.maxScore,L):(je(L,`no variants with VIDEO-RANGE of ${JSON.stringify(m)} found`),T)},void 0),videoRanges:m,preferHDR:g,minFramerate:f,minBitrate:h}}function je(r,e){O.log(`[abr] start candidates with "${r}" ignored because ${e}`)}function td(r){return r.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 sd(r,e,t,s){return r.slice(t,s+1).reduce((i,n)=>{if(!n.codecSet)return i;const a=n.audioGroups;let o=i[n.codecSet];o||(i[n.codecSet]=o={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!a,fragmentError:0}),o.minBitrate=Math.min(o.minBitrate,n.bitrate);const l=Math.min(n.height,n.width);return o.minHeight=Math.min(o.minHeight,l),o.minFramerate=Math.min(o.minFramerate,n.frameRate),o.maxScore=Math.max(o.maxScore,n.score),o.fragmentError+=n.fragmentError,o.videoRanges[n.videoRange]=(o.videoRanges[n.videoRange]||0)+1,a&&a.forEach(c=>{if(!c)return;const d=e.groups[c];d&&(o.hasDefaultAudio=o.hasDefaultAudio||e.hasDefaultAudio?d.hasDefault:d.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(d.channels).forEach(u=>{o.channels[u]=(o.channels[u]||0)+d.channels[u]}))}),i},{})}function Ke(r,e,t){if("attrs"in r){const s=e.indexOf(r);if(s!==-1)return s}for(let s=0;s<e.length;s++){const i=e[s];if(bt(r,i,t))return s}return-1}function bt(r,e,t){const{groupId:s,name:i,lang:n,assocLang:a,characteristics:o,default:l}=r,c=r.forced;return(s===void 0||e.groupId===s)&&(i===void 0||e.name===i)&&(n===void 0||e.lang===n)&&(n===void 0||e.assocLang===a)&&(l===void 0||e.default===l)&&(c===void 0||e.forced===c)&&(o===void 0||id(o,e.characteristics))&&(t===void 0||t(r,e))}function id(r,e=""){const t=r.split(","),s=e.split(",");return t.length===s.length&&!t.some(i=>s.indexOf(i)===-1)}function mt(r,e){const{audioCodec:t,channels:s}=r;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(s===void 0||s===(e.channels||"2"))}function rd(r,e,t,s,i){const n=e[s],o=e.reduce((f,h,p)=>{const m=h.uri;return(f[m]||(f[m]=[])).push(p),f},{})[n.uri];o.length>1&&(s=Math.max.apply(Math,o));const l=n.videoRange,c=n.frameRate,d=n.codecSet.substring(0,4),u=cn(e,s,f=>{if(f.videoRange!==l||f.frameRate!==c||f.codecSet.substring(0,4)!==d)return!1;const h=f.audioGroups,p=t.filter(m=>!h||h.indexOf(m.groupId)!==-1);return Ke(r,p,i)>-1});return u>-1?u:cn(e,s,f=>{const h=f.audioGroups,p=t.filter(m=>!h||h.indexOf(m.groupId)!==-1);return Ke(r,p,i)>-1})}function cn(r,e,t){for(let s=e;s;s--)if(t(r[s]))return s;for(let s=e+1;s<r.length;s++)if(t(r[s]))return s;return-1}class nd{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:s,hls:i}=this,{autoLevelEnabled:n,media:a}=i;if(!t||!a)return;const o=performance.now(),l=s?s.stats:t.stats,c=s?s.duration:t.duration,d=o-l.loading.start,u=i.minAutoLevel;if(l.aborted||l.loaded&&l.loaded===l.total||t.level<=u){this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||a.paused||!a.playbackRate||!a.readyState)return;const f=i.mainForwardBufferInfo;if(f===null)return;const h=this.bwEstimator.getEstimateTTFB(),p=Math.abs(a.playbackRate);if(d<=Math.max(h,1e3*(c/(p*2))))return;const m=f.len/p,g=l.loading.first?l.loading.first-l.loading.start:-1,y=l.loaded&&g>-1,E=this.getBwEstimate(),v=i.levels,S=v[t.level],T=l.total||Math.max(l.loaded,Math.round(c*S.averageBitrate/8));let L=y?d-g:d;L<1&&y&&(L=Math.min(d,l.loaded*8/E));const b=y?l.loaded*1e3/L:0,C=b?(T-l.loaded)/b:T*8/E+h/1e3;if(C<=m)return;const A=b?b*8:E;let w=Number.POSITIVE_INFINITY,I;for(I=t.level-1;I>u;I--){const R=v[I].maxBitrate;if(w=this.getTimeToLoadFrag(h/1e3,A,c*R,!v[I].details),w<m)break}if(w>=C||w>c*10)return;i.nextLoadLevel=i.nextAutoLevel=I,y?this.bwEstimator.sample(d-Math.min(h,g),l.loaded):this.bwEstimator.sampleTTFB(d);const P=v[I].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>P&&this.resetEstimator(P),this.clearTimer(),O.warn(`[abr] Fragment ${t.sn}${s?" part "+s.index:""} of level ${t.level} is loading too slowly; 12 Time to underbuffer: ${m.toFixed(3)} s 13 Estimated load time for current fragment: ${C.toFixed(3)} s 14 Estimated load time for down switch fragment: ${w.toFixed(3)} s 15 TTFB estimate: ${g|0} ms 16 Current BW estimate: ${W(E)?E|0:"Unknown"} bps 17 New BW estimate: ${this.getBwEstimate()|0} bps 18 Switching to level ${I} @ ${P|0} bps`),i.trigger(x.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:s,stats:l})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(O.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 qc(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.FRAG_LOADING,this.onFragLoading,this),e.on(x.FRAG_LOADED,this.onFragLoaded,this),e.on(x.FRAG_BUFFERED,this.onFragBuffered,this),e.on(x.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(x.LEVEL_LOADED,this.onLevelLoaded,this),e.on(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(x.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(x.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.FRAG_LOADING,this.onFragLoading,this),e.off(x.FRAG_LOADED,this.onFragLoaded,this),e.off(x.FRAG_BUFFERED,this.onFragBuffered,this),e.off(x.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(x.LEVEL_LOADED,this.onLevelLoaded,this),e.off(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(x.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(x.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,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 $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case $.FRAG_LOAD_TIMEOUT:{const s=t.frag,{fragCurrent:i,partCurrent:n}=this;if(s&&i&&s.sn===i.sn&&s.level===i.level){const a=performance.now(),o=n?n.stats:s.stats,l=a-o.loading.start,c=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&c>-1){const u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(u,c),o.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,s,i){const n=e+s/t,a=i?this.lastLevelLoadSec:0;return n+a}onLevelLoaded(e,t){const s=this.hls.config,{loading:i}=t.stats,n=i.end-i.start;W(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:s}){const i=s?s.stats:t.stats;if(t.type===X.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 n=s?s.duration:t.duration,a=this.hls.levels[t.level],o=(a.loaded?a.loaded.bytes:0)+i.loaded,l=(a.loaded?a.loaded.duration:0)+n;a.loaded={bytes:o,duration:l},a.realBitrate=Math.round(8*o/l)}if(t.bitrateTest){const n={stats:i,frag:t,part:s,id:t.type};this.onFragBuffered(x.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:s,part:i}=t,n=i!=null&&i.stats.loaded?i.stats:s.stats;if(n.aborted||this.ignoreFragment(s))return;const a=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==X.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,n=this.findBestLevel(s,t,e,0,i,1,1);if(n>-1)return n;const a=this.hls.firstLevel,o=Math.min(Math.max(a,t),e);return O.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!s||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=s&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,n)&&a[e].loadError<=a[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}
18_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:s}=this,{maxAutoLevel:i,config:n,minAutoLevel:a}=s,o=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),c=this.getStarvationDelay();let d=n.abrBandWidthFactor,u=n.abrBandWidthUpFactor;if(c){const g=this.findBestLevel(l,a,i,c,0,d,u);if(g>=0)return g}let f=o?Math.min(o,n.maxStarvationDelay):n.maxStarvationDelay;if(!c){const g=this.bitrateTestDelay;g&&(f=(o?Math.min(o,n.maxLoadingDelay):n.maxLoadingDelay)-g,O.info(`[abr] bitrate test took ${Math.round(1e3*g)}ms, set first fragment max fetchDuration to ${Math.round(1e3*f)} ms`),d=u=1)}const h=this.findBestLevel(l,a,i,c,f,d,u);if(O.info(`[abr] ${c?"rebuffering expected":"buffer is empty"}, optimal quality level ${h}`),h>-1)return h;const p=s.levels[a],m=s.levels[s.loadLevel];return(p==null?void 0:p.bitrate)<(m==null?void 0:m.bitrate)?a:s.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const s=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/s}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,s,i,n,a,o){var l;const c=i+n,d=this.lastLoadedFragLevel,u=d===-1?this.hls.firstLevel:d,{fragCurrent:f,partCurrent:h}=this,{levels:p,allAudioTracks:m,loadLevel:g,config:y}=this.hls;if(p.length===1)return 0;const E=p[u],v=!!(E!=null&&(l=E.details)!=null&&l.live),S=g===-1||d===-1;let T,L="SDR",b=(E==null?void 0:E.frameRate)||0;const{audioPreference:C,videoPreference:A}=y,w=this.audioTracksByGroup||(this.audioTracksByGroup=td(m));if(S){if(this.firstSelection!==-1)return this.firstSelection;const _=this.codecTiers||(this.codecTiers=sd(p,w,t,s)),B=ed(_,L,e,C,A),{codecSet:k,videoRanges:M,minFramerate:N,minBitrate:G,preferHDR:U}=B;T=k,L=U?M[M.length-1]:M[0],b=N,e=Math.max(e,G),O.log(`[abr] picked start tier ${JSON.stringify(B)}`)}else T=E==null?void 0:E.codecSet,L=E==null?void 0:E.videoRange;const I=h?h.duration:f?f.duration:0,P=this.bwEstimator.getEstimateTTFB()/1e3,R=[];for(let _=s;_>=t;_--){var D;const B=p[_],k=_>u;if(!B)continue;if(y.useMediaCapabilities&&!B.supportedResult&&!B.supportedPromise){const Z=navigator.mediaCapabilities;typeof(Z==null?void 0:Z.decodingInfo)=="function"&&jc(B,w,L,b,e,C)?(B.supportedPromise=Xc(B,w,Z),B.supportedPromise.then(K=>{if(!this.hls)return;B.supportedResult=K;const Q=this.hls.levels,q=Q.indexOf(B);K.error?O.warn(`[abr] MediaCapabilities decodingInfo error: "${K.error}" for level ${q} ${JSON.stringify(K)}`):K.supported||(O.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${q} ${JSON.stringify(K)}`),q>-1&&Q.length>1&&(O.log(`[abr] Removing unsupported level ${q}`),this.hls.removeLevel(q)))})):B.supportedResult=Aa}if(T&&B.codecSet!==T||L&&B.videoRange!==L||k&&b>B.frameRate||!k&&b>0&&b<B.frameRate||B.supportedResult&&!((D=B.supportedResult.decodingInfoResults)!=null&&D[0].smooth)){R.push(_);continue}const M=B.details,N=(h?M==null?void 0:M.partTarget:M==null?void 0:M.averagetargetduration)||I;let G;k?G=o*e:G=a*e;const U=I&&i>=I*2&&n===0?p[_].averageBitrate:p[_].maxBitrate,H=this.getTimeToLoadFrag(P,G,U*N,M===void 0);if(G>=U&&(_===d||B.loadError===0&&B.fragmentError===0)&&(H<=P||!W(H)||v&&!this.bitrateTestDelay||H<c)){const Z=this.forcedAutoLevel;return _!==g&&(Z===-1||Z!==g)&&(R.length&&O.trace(`[abr] Skipped level(s) ${R.join(",")} of ${s} max with CODECS and VIDEO-RANGE:"${p[R[0]].codecs}" ${p[R[0]].videoRange}; not compatible with "${E.codecs}" ${L}`),O.info(`[abr] switch candidate:${u}->${_} adjustedbw(${Math.round(G)})-bitrate=${Math.round(G-U)} ttfb:${P.toFixed(1)} avgDuration:${N.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${H.toFixed(1)} firstSelection:${S} codecSet:${T} videoRange:${L} hls.loadLevel:${g}`)),S&&(this.firstSelection=_),_}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:s}=this.hls,i=Math.min(Math.max(e,s),t);this._nextAutoLevel!==i&&(this.nextAutoLevelKey="",this._nextAutoLevel=i)}}class ad{constructor(){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(){}}var ye={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class od{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(x.BUFFER_APPENDED,this.onBufferAppended,this),e.on(x.FRAG_BUFFERED,this.onFragBuffered,this),e.on(x.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(x.BUFFER_APPENDED,this.onBufferAppended,this),e.off(x.FRAG_BUFFERED,this.onFragBuffered,this),e.off(x.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const s=this.activePartLists[t];if(s)for(let i=s.length;i--;){const n=s[i];if(!n)break;const a=n.end;if(n.start<=e&&a!==null&&e<=a)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:s}=this,i=Object.keys(s);for(let n=i.length;n--;){const a=s[i[n]];if((a==null?void 0:a.body.type)===t&&a.buffered){const o=a.body;if(o.start<=e&&e<=o.end)return o}}return null}detectEvictedFragments(e,t,s,i){this.timeRanges&&(this.timeRanges[e]=t);const n=(i==null?void 0:i.fragment.sn)||-1;
vendor: 201,892 bytes, lines 18-36
18Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o||n>=o.body.sn)return;if(!o.buffered&&!o.loaded){o.body.type===s&&this.removeFragment(o.body);return}const l=o.range[e];l&&l.time.some(c=>{const d=!this.isTimeBuffered(c.startPTS,c.endPTS,t);return d&&this.removeFragment(o.body),d})})}detectPartialFragments(e){const t=this.timeRanges,{frag:s,part:i}=e;if(!t||s.sn==="initSegment")return;const n=gt(s),a=this.fragments[n];if(!a||a.buffered&&s.gap)return;const o=!s.relurl;Object.keys(t).forEach(l=>{const c=s.elementaryStreams[l];if(!c)return;const d=t[l],u=o||c.partial===!0;a.range[l]=this.getBufferedTimes(s,i,u,d)}),a.loaded=null,Object.keys(a.range).length?(a.buffered=!0,(a.body.endList=s.endList||a.body.endList)&&(this.endListFragments[a.body.type]=a),ls(a)||this.removeParts(s.sn-1,s.type)):this.removeFragment(a.body)}removeParts(e,t){const s=this.activePartLists[t];s&&(this.activePartLists[t]=s.filter(i=>i.fragment.sn>=e))}fragBuffered(e,t){const s=gt(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,i.buffered=!0)}getBufferedTimes(e,t,s,i){const n={time:[],partial:s},a=e.start,o=e.end,l=e.minEndPTS||o,c=e.maxStartPTS||a;for(let d=0;d<i.length;d++){const u=i.start(d)-this.bufferPadding,f=i.end(d)+this.bufferPadding;if(c>=u&&l<=f){n.time.push({startPTS:Math.max(a,i.start(d)),endPTS:Math.min(o,i.end(d))});break}else if(a<f&&o>u){const h=Math.max(a,i.start(d)),p=Math.min(o,i.end(d));p>h&&(n.partial=!0,n.time.push({startPTS:h,endPTS:p}))}else if(o<=u)break}return n}getPartialFragment(e){let t=null,s,i,n,a=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(c=>{const d=l[c];d&&ls(d)&&(i=d.body.start-o,n=d.body.end+o,e>=i&&e<=n&&(s=Math.min(e-i,n-e),a<=s&&(t=d.body,a=s)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||ls(t))}getState(e){const t=gt(e),s=this.fragments[t];return s?s.buffered?ls(s)?ye.PARTIAL:ye.OK:ye.APPENDING:ye.NOT_LOADED}isTimeBuffered(e,t,s){let i,n;for(let a=0;a<s.length;a++){if(i=s.start(a)-this.bufferPadding,n=s.end(a)+this.bufferPadding,e>=i&&t<=n)return!0;if(t<=i)return!1}return!1}onFragLoaded(e,t){const{frag:s,part:i}=t;if(s.sn==="initSegment"||s.bitrateTest)return;const n=i?null:t,a=gt(s);this.fragments[a]={body:s,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:s,part:i,timeRanges:n}=t;if(s.sn==="initSegment")return;const a=s.type;if(i){let o=this.activePartLists[a];o||(this.activePartLists[a]=o=[]),o.push(i)}this.timeRanges=n,Object.keys(n).forEach(o=>{const l=n[o];this.detectEvictedFragments(o,l,a,i)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=gt(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,s,i,n){i&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const l=o.body;l.type!==s||i&&!l.gap||l.start<t&&l.end>e&&(o.buffered||n)&&this.removeFragment(l)})}removeFragment(e){const t=gt(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const s=this.activePartLists[e.type];if(s){const i=e.sn;this.activePartLists[e.type]=s.filter(n=>n.fragment.sn!==i)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function ls(r){var e,t,s;return r.buffered&&(r.body.gap||((e=r.range.video)==null?void 0:e.partial)||((t=r.range.audio)==null?void 0:t.partial)||((s=r.range.audiovideo)==null?void 0:s.partial))}function gt(r){return`${r.type}_${r.level}_${r.sn}`}const ld={length:0,start:()=>0,end:()=>0};class le{static isBuffered(e,t){try{if(e){const s=le.getBuffered(e);for(let i=0;i<s.length;i++)if(t>=s.start(i)&&t<=s.end(i))return!0}}catch{}return!1}static bufferInfo(e,t,s){try{if(e){const i=le.getBuffered(e),n=[];let a;for(a=0;a<i.length;a++)n.push({start:i.start(a),end:i.end(a)});return this.bufferedInfo(n,t,s)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,s){t=Math.max(0,t),e.sort(function(c,d){const u=c.start-d.start;return u||d.end-c.end});let i=[];if(s)for(let c=0;c<e.length;c++){const d=i.length;if(d){const u=i[d-1].end;e[c].start-u<s?e[c].end>u&&(i[d-1].end=e[c].end):i.push(e[c])}else i.push(e[c])}else i=e;let n=0,a,o=t,l=t;for(let c=0;c<i.length;c++){const d=i[c].start,u=i[c].end;if(t+s>=d&&t<u)o=d,l=u,n=l-t;else if(t+s<d){a=d;break}}return{len:n,start:o||0,end:l||0,nextStart:a}}static getBuffered(e){try{return e.buffered}catch(t){return O.log("failed to get media.buffered",t),ld}}}class fr{constructor(e,t,s,i=0,n=-1,a=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=cs(),this.buffering={audio:cs(),video:cs(),audiovideo:cs()},this.level=e,this.sn=t,this.id=s,this.size=i,this.part=n,this.partial=a}}function cs(){return{start:0,executeStart:0,executeEnd:0,end:0}}function xs(r,e){for(let s=0,i=r.length;s<i;s++){var t;if(((t=r[s])==null?void 0:t.cc)===e)return r[s]}return null}function cd(r,e,t){return!!(e&&(t.endCC>t.startCC||r&&r.cc<t.startCC))}function dd(r,e){const t=r.fragments,s=e.fragments;if(!s.length||!t.length){O.log("No fragments to align");return}const i=xs(t,s[0].cc);if(!i||i&&!i.startPTS){O.log("No frag in previous level to align on");return}return i}function dn(r,e){if(r){const t=r.start+e;r.start=r.startPTS=t,r.endPTS=t+r.duration}}function Ia(r,e){const t=e.fragments;for(let s=0,i=t.length;s<i;s++)dn(t[s],r);e.fragmentHint&&dn(e.fragmentHint,r),e.alignedSliding=!0}function ud(r,e,t){e&&(fd(r,t,e),!t.alignedSliding&&e&&Us(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&Sa(e,t))}function fd(r,e,t){if(cd(r,t,e)){const s=dd(t,e);s&&W(s.start)&&(O.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),Ia(s.start,e))}}function Us(r,e){if(!r.hasProgramDateTime||!e.hasProgramDateTime)return;const t=r.fragments,s=e.fragments;if(!t.length||!s.length)return;let i,n;const a=Math.min(e.endCC,r.endCC);e.startCC<a&&r.startCC<a&&(i=xs(s,a),n=xs(t,a)),(!i||!n)&&(i=s[Math.floor(s.length/2)],n=xs(t,i.cc)||t[Math.floor(t.length/2)]);const o=i.programDateTime,l=n.programDateTime;if(!o||!l)return;const c=(l-o)/1e3-(n.start-i.start);Ia(c,r)}const un=Math.pow(2,17);class hd{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 Qe({type:J.NETWORK_ERROR,details:$.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,n=i.fLoader,a=i.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(h=>h[0]==="GAP")){l(hn(e));return}else e.gap=!1;const c=this.loader=e.loader=n?new n(i):new a(i),d=fn(e),u=on(i.fragLoadPolicy.default),f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:un};e.stats=c.stats,c.load(d,f,{onSuccess:(h,p,m,g)=>{this.resetLoader(e,c);let y=h.data;m.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(y.slice(0,16)),y=y.slice(16)),o({frag:e,part:null,payload:y,networkDetails:g})},onError:(h,p,m,g)=>{this.resetLoader(e,c),l(new Qe({type:J.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Ee({url:s,data:void 0},h),error:new Error(`HTTP Error ${h.code} ${h.text}`),networkDetails:m,stats:g}))},onAbort:(h,p,m)=>{this.resetLoader(e,c),l(new Qe({type:J.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:m,stats:h}))},onTimeout:(h,p,m)=>{this.resetLoader(e,c),l(new Qe({type:J.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:m,stats:h}))},onProgress:(h,p,m,g)=>{t&&t({frag:e,part:null,payload:m,networkDetails:g})}})})}loadPart(e,t,s){this.abort();const i=this.config,n=i.fLoader,a=i.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(hn(e,t));return}const c=this.loader=e.loader=n?new n(i):new a(i),d=fn(e,t),u=on(i.fragLoadPolicy.default),f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:un};t.stats=c.stats,c.load(d,f,{onSuccess:(h,p,m,g)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const y={frag:e,part:t,payload:h.data,networkDetails:g};s(y),o(y)},onError:(h,p,m,g)=>{this.resetLoader(e,c),l(new Qe({type:J.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Ee({url:d.url,data:void 0},h),error:new Error(`HTTP Error ${h.code} ${h.text}`),networkDetails:m,stats:g}))},onAbort:(h,p,m)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),l(new Qe({type:J.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:m,stats:h}))},onTimeout:(h,p,m)=>{this.resetLoader(e,c),l(new Qe({type:J.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:m,stats:h}))}})})}updateStatsFromPart(e,t){const s=e.stats,i=t.stats,n=i.total;if(s.loaded+=i.loaded,n){const l=Math.round(e.duration/t.duration),c=Math.min(Math.round(s.loaded/n),l),u=(l-c)*Math.round(s.loaded/c);s.total=s.loaded+u}else s.total=Math.max(s.loaded,s.total);const a=s.loading,o=i.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function fn(r,e=null){const t=e||r,s={frag:r,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(W(i)&&W(n)){var a;let o=i,l=n;if(r.sn==="initSegment"&&((a=r.decryptdata)==null?void 0:a.method)==="AES-128"){const c=n-i;c%16&&(l=n+(16-c%16)),i!==0&&(s.resetIV=!0,o=i-16)}s.rangeStart=o,s.rangeEnd=l}return s}function hn(r,e){const t=new Error(`GAP ${r.gap?"tag":"attribute"} found`),s={type:J.MEDIA_ERROR,details:$.FRAG_GAP,fatal:!1,frag:r,error:t,networkDetails:null};return e&&(s.part=e),(e||r).stats.aborted=!0,new Qe(s)}class Qe extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class pd{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class md{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function gd(r){const e=r.byteLength,t=e&&new DataView(r.buffer).getUint8(e-1);return t?ct(r,0,e-t):r}class vd{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],n=s[1],a=s[2],o=s[3],l=this.invSubMix,c=l[0],d=l[1],u=l[2],f=l[3],h=new Uint32Array(256);let p=0,m=0,g=0;for(g=0;g<256;g++)g<128?h[g]=g<<1:h[g]=g<<1^283;for(g=0;g<256;g++){let y=m^m<<1^m<<2^m<<3^m<<4;y=y>>>8^y&255^99,e[p]=y,t[y]=p;const E=h[p],v=h[E],S=h[v];let T=h[y]*257^y*16843008;i[p]=T<<24|T>>>8,n[p]=T<<16|T>>>16,a[p]=T<<8|T>>>24,o[p]=T,T=S*16843009^v*65537^E*257^p*16843008,c[y]=T<<24|T>>>8,d[y]=T<<16|T>>>16,u[y]=T<<8|T>>>24,f[y]=T,p?(p=E^h[h[h[S^E]]],m^=h[h[m]]):p=m=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let s=!0,i=0;for(;i<t.length&&s;)s=t[i]===this.key[i],i++;if(s)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const a=this.ksRows=(n+6+1)*4;let o,l;const c=this.keySchedule=new Uint32Array(a),d=this.invKeySchedule=new Uint32Array(a),u=this.sBox,f=this.rcon,h=this.invSubMix,p=h[0],m=h[1],g=h[2],y=h[3];let E,v;for(o=0;o<a;o++){if(o<n){E=c[o]=t[o];continue}v=E,o%n===0?(v=v<<8|v>>>24,v=u[v>>>24]<<24|u[v>>>16&255]<<16|u[v>>>8&255]<<8|u[v&255],v^=f[o/n|0]<<24):n>6&&o%n===4&&(v=u[v>>>24]<<24|u[v>>>16&255]<<16|u[v>>>8&255]<<8|u[v&255]),c[o]=E=(c[o-n]^v)>>>0}for(l=0;l<a;l++)o=a-l,l&3?v=c[o]:v=c[o-4],l<4||o<=4?d[l]=v:d[l]=p[u[v>>>24]]^m[u[v>>>16&255]]^g[u[v>>>8&255]]^y[u[v&255]],d[l]=d[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,s){const i=this.keySize+6,n=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,l=o[0],c=o[1],d=o[2],u=o[3],f=this.uint8ArrayToUint32Array_(s);let h=f[0],p=f[1],m=f[2],g=f[3];const y=new Int32Array(e),E=new Int32Array(y.length);let v,S,T,L,b,C,A,w,I,P,R,D,_,B;const k=this.networkToHostOrderSwap;for(;t<y.length;){for(I=k(y[t]),P=k(y[t+1]),R=k(y[t+2]),D=k(y[t+3]),b=I^n[0],C=D^n[1],A=R^n[2],w=P^n[3],_=4,B=1;B<i;B++)v=l[b>>>24]^c[C>>16&255]^d[A>>8&255]^u[w&255]^n[_],S=l[C>>>24]^c[A>>16&255]^d[w>>8&255]^u[b&255]^n[_+1],T=l[A>>>24]^c[w>>16&255]^d[b>>8&255]^u[C&255]^n[_+2],L=l[w>>>24]^c[b>>16&255]^d[C>>8&255]^u[A&255]^n[_+3],b=v,C=S,A=T,w=L,_=_+4;v=a[b>>>24]<<24^a[C>>16&255]<<16^a[A>>8&255]<<8^a[w&255]^n[_],S=a[C>>>24]<<24^a[A>>16&255]<<16^a[w>>8&255]<<8^a[b&255]^n[_+1],T=a[A>>>24]<<24^a[w>>16&255]<<16^a[b>>8&255]<<8^a[C&255]^n[_+2],L=a[w>>>24]<<24^a[b>>16&255]<<16^a[C>>8&255]<<8^a[A&255]^n[_+3],E[t]=k(v^h),E[t+1]=k(L^p),E[t+2]=k(T^m),E[t+3]=k(S^g),h=I,p=P,m=R,g=D,t=t+4}return E.buffer}}const yd=16;class hr{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const s=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?gd(s):s}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,s){return this.useSoftware?new Promise((i,n)=>{this.softwareDecrypt(new Uint8Array(e),t,s);const a=this.flush();a?i(a.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,s)}softwareDecrypt(e,t,s){const{currentIV:i,currentResult:n,remainderData:a}=this;this.logOnce("JS AES decrypt"),a&&(e=Oe(a,e),this.remainderData=null);const o=this.getValidChunk(e);if(!o.length)return null;i&&(s=i);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new vd),l.expandKey(t);const c=n;return this.currentResult=l.decrypt(o.buffer,0,s),this.currentIV=ct(o,-16).buffer,c||null}webCryptoDecrypt(e,t,s){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,s));this.key=t,this.fastAesKey=new md(this.subtle,t)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new pd(this.subtle,new Uint8Array(s)).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(O.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,t,s)))}onWebCryptoError(e,t,s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,s);const i=this.flush();if(i)return i.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const s=e.length-e.length%yd;return s!==e.length&&(t=ct(e,0,s),this.remainderData=ct(e,s)),t}logOnce(e){this.logEnabled&&(O.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Ed={toString:function(r){let e="";const t=r.length;for(let s=0;s<t;s++)e+=`[${r.start(s).toFixed(3)}-${r.end(s).toFixed(3)}]`;return e}},V={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class pr extends ad{constructor(e,t,s,i,n){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=V.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=n,this.logPrefix=i,this.log=O.log.bind(O,`${i}:`),this.warn=O.warn.bind(O,`${i}:`),this.hls=e,this.fragmentLoader=new hd(e.config),this.keyLoader=s,this.fragmentTracker=t,this.config=e.config,this.decrypter=new hr(e.config),e.on(x.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=V.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const s=t.partList;if(s!=null&&s.length){const n=s[s.length-1];return le.isBuffered(this.media,n.start+n.duration/2)}const i=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(i)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const s=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),s.addEventListener("seeking",this.onvseeking),s.addEventListener("ended",this.onvended);const i=this.config;this.levels&&i.autoStartLoad&&this.state===V.STOPPED&&this.startLoad(i.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:s,mediaBuffer:i,state:n}=this,a=s?s.currentTime:0,o=le.bufferInfo(i||s,a,e.maxBufferHole);if(this.log(`media seeking to ${W(a)?a.toFixed(3):a}, state: ${n}`),this.state===V.ENDED)this.resetLoadingState();else if(t){const l=e.maxFragLookUpTolerance,c=t.start-l,d=t.start+t.duration+l;if(!o.len||d<o.start||c>o.end){const u=a>d;(a<c||u)&&(u&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}s&&(this.fragmentTracker.removeFragmentsInRange(a,1/0,this.playlistType,!0),this.lastCurrentTime=a),!this.loadedmetadata&&!o.len&&(this.nextLoadPosition=this.startPosition=a),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(x.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=V.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,s){this._loadFragForPlayback(e,t,s)}_loadFragForPlayback(e,t,s){const i=n=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${n.part?" p: "+n.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,s,i).then(n=>{if(!n)return;const a=this.state;if(this.fragContextChanged(e)){(a===V.FRAG_LOADING||!this.fragCurrent&&a===V.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=V.IDLE);return}"payload"in n&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(x.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===V.STOPPED||this.state===V.ERROR||(this.warn(`Frag error: ${(n==null?void 0:n.message)||n}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:s}=this;if(s.getState(e)===ye.APPENDING){const n=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,n),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&s.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?s.removeAllFragments():s.hasParts(e.type)&&(s.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),s.getState(e)===ye.PARTIAL&&s.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,s=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:s};this.hls.trigger(x.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(s=>{if(!s||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:i}=this,{payload:n}=s,a=e.decryptdata;if(n&&n.byteLength>0&&a!=null&&a.key&&a.iv&&a.method==="AES-128"){const o=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),a.key.buffer,a.iv.buffer).catch(l=>{throw i.trigger(x.ERROR,{type:J.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:e}),l}).then(l=>{const c=self.performance.now();return i.trigger(x.FRAG_DECRYPTED,{frag:e,payload:l,stats:{tstart:o,tdecrypt:c}}),s.payload=l,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state===V.STOPPED||this.state===V.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const s=e.frag.stats;this.state=V.IDLE,e.frag.data=new Uint8Array(e.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var s,i,n,a;const o=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===X.MAIN?"level":"track"} ${e.level} (frag:[${((s=e.startPTS)!=null?s:NaN).toFixed(3)}-${((i=e.endPTS)!=null?i:NaN).toFixed(3)}] > buffer:${o?Ed.toString(le.getBuffered(o)):"(detached)"})`),e.sn!=="initSegment"){var l;if(e.type!==X.SUBTITLE){const d=e.elementaryStreams;if(!Object.keys(d).some(u=>!!d[u])){this.state=V.IDLE;return}}const c=(l=this.levels)==null?void 0:l[e.level];c!=null&&c.fragmentError&&(this.log(`Resetting level fragment error count of ${c.fragmentError} on frag buffered`),c.fragmentError=0)}this.state=V.IDLE,o&&(!this.loadedmetadata&&e.type==X.MAIN&&o.buffered.length&&((n=this.fragCurrent)==null?void 0:n.sn)===((a=this.fragPrevious)==null?void 0:a.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:s,part:i,partsLoaded:n}=e,a=!n||n.length===0||n.some(l=>!l),o=new fr(s.level,s.sn,s.stats.chunkCount+1,0,i?i.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,s=null,i){var n;const a=t==null?void 0:t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)?(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=V.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(d=>{if(!this.fragContextChanged(d.frag))return this.hls.trigger(x.KEY_LOADED,d),this.state===V.KEY_LOADING&&(this.state=V.IDLE),d}),this.hls.trigger(x.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&a.encryptedFragments.length&&this.keyLoader.loadClear(e,a.encryptedFragments),s=Math.max(e.start,s||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const d=a.partList;if(d&&i){s>e.end&&a.fragmentHint&&(e=a.fragmentHint);const u=this.getNextPart(d,e,s);if(u>-1){const f=d[u];this.log(`Loading part sn: ${e.sn} p: ${f.index} cc: ${e.cc} of playlist [${a.startSN}-${a.endSN}] parts [0-${u}-${d.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=f.start+f.duration,this.state=V.FRAG_LOADING;let h;return o?h=o.then(p=>!p||this.fragContextChanged(p.frag)?null:this.doFragPartsLoad(e,f,t,i)).catch(p=>this.handleFragLoadError(p)):h=this.doFragPartsLoad(e,f,t,i).catch(p=>this.handleFragLoadError(p)),this.hls.trigger(x.FRAG_LOADING,{frag:e,part:f,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):h}else if(!e.url||this.loadedEndOfParts(d,s))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${a?"of ["+a.startSN+"-"+a.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(s.toFixed(3))}`),W(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=V.FRAG_LOADING;const l=this.config.progressive;let c;return l&&o?c=o.then(d=>!d||this.fragContextChanged(d==null?void 0:d.frag)?null:this.fragmentLoader.load(e,i)).catch(d=>this.handleFragLoadError(d)):c=Promise.all([this.fragmentLoader.load(e,l?i:void 0),o]).then(([d])=>(!l&&d&&i&&i(d),d)).catch(d=>this.handleFragLoadError(d)),this.hls.trigger(x.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c}doFragPartsLoad(e,t,s,i){return new Promise((n,a)=>{var o;const l=[],c=(o=s.details)==null?void 0:o.partList,d=u=>{this.fragmentLoader.loadPart(e,u,i).then(f=>{l[u.index]=f;const h=f.part;this.hls.trigger(x.FRAG_LOADED,f);const p=nn(s,e.sn,u.index+1)||ba(c,e.sn,u.index+1);if(p)d(p);else return n({frag:e,part:h,partsLoaded:l})}).catch(a)};d(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===$.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(x.ERROR,t)}else this.hls.trigger(x.ERROR,{type:J.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==V.PARSING){!this.fragCurrent&&this.state!==V.STOPPED&&this.state!==V.ERROR&&(this.state=V.IDLE);return}const{frag:s,part:i,level:n}=t,a=self.performance.now();s.stats.parsing.end=a,i&&(i.stats.parsing.end=a),this.updateLevelTiming(s,i,n,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:s}=this,{level:i,sn:n,part:a}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${n} of level ${i}. The current chunk will not be buffered.`),null;const o=t[i],l=a>-1?nn(o,n,a):null,c=l?l.fragment:Gc(o,n,s);return c?(s&&s!==c&&(c.stats=s.stats),{frag:c,part:l,level:o}):null}bufferFragmentData(e,t,s,i,n){var a;if(!e||this.state!==V.PARSING)return;const{data1:o,data2:l}=e;let c=o;if(o&&l&&(c=Oe(o,l)),!((a=c)!=null&&a.length))return;const d={type:e.type,frag:t,part:s,chunkMeta:i,parent:t.type,data:c};if(this.hls.trigger(x.BUFFER_APPENDING,d),e.dropped&&e.independent&&!s){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!le.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const s=t.currentTime,i=le.bufferInfo(t,s,0),n=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),o=Math.max(Math.min(e.start-a,i.end-a),s+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){const s=this.getLoadPosition();return W(s)?this.getFwdBufferInfoAtPos(e,s,t):null}getFwdBufferInfoAtPos(e,t,s){const{config:{maxBufferHole:i}}=this,n=le.bufferInfo(e,t,i);if(n.len===0&&n.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,s);if(a&&n.nextStart<a.end)return le.bufferInfo(e,t,Math.max(n.nextStart,i))}return n}getMaxBufferLength(e){const{config:t}=this;let s;return e?s=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):s=t.maxBufferLength,Math.min(s,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const s=this.config,i=Math.max(Math.min(e-t,s.maxBufferLength),t),n=Math.max(e-t*3,s.maxMaxBufferLength/2,i);return n>=i?(s.maxMaxBufferLength=n,this.warn(`Reduce max buffer length to ${n}s`),!0):!1}getAppendedFrag(e,t=X.MAIN){const s=this.fragmentTracker.getAppendedFrag(e,X.MAIN);return s&&"fragment"in s?s.fragment:s}getNextFragment(e,t){const s=t.fragments,i=s.length;if(!i)return null;const{config:n}=this,a=s[0].start;let o;if(t.live){const l=n.initialLiveManifestSize;if(i<l)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${l})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a)&&(o=this.getInitialLiveFragment(t,s),this.startPosition=this.nextLoadPosition=o?this.hls.liveSyncPosition||o.start:e)}else e<=a&&(o=s[0]);if(!o){const l=n.lowLatencyMode?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,l,t)}return this.mapToInitFragWhenRequired(o)}isLoopLoading(e,t){const s=this.fragmentTracker.getState(e);return(s===ye.OK||s===ye.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,s,i,n){const a=e.gap,o=this.getNextFragment(this.nextLoadPosition,t);if(o===null)return o;if(e=o,a&&e&&!e.gap&&s.nextStart){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,i);if(l!==null&&s.len+l.len>=n)return this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,s){let i=-1,n=!1,a=!0;for(let o=0,l=e.length;o<l;o++){const c=e[o];if(a=a&&!c.independent,i>-1&&s<c.start)break;const d=c.loaded;d?i=-1:(n||c.independent||a)&&c.fragment===t&&(i=o),n=d}return i}loadedEndOfParts(e,t){const s=e[e.length-1];return s&&t>s.start&&s.loaded}getInitialLiveFragment(e,t){const s=this.fragPrevious;let i=null;if(s){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),i=Vc(t,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const n=s.sn+1;if(n>=e.startSN&&n<=e.endSN){const a=t[n-e.startSN];s.cc===a.cc&&(i=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=Yc(t,s.cc),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(i=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,s){const{config:i}=this;let{fragPrevious:n}=this,{fragments:a,endSN:o}=s;const{fragmentHint:l}=s,{maxFragLookUpTolerance:c}=i,d=s.partList,u=!!(i.lowLatencyMode&&d!=null&&d.length&&l);u&&l&&!this.bitrateTest&&(a=a.concat(l),o=l.sn);let f;if(e<t){const h=e>t-c?0:c;f=$s(n,a,e,h)}else f=a[a.length-1];if(f){const h=f.sn-s.startSN,p=this.fragmentTracker.getState(f);if((p===ye.OK||p===ye.PARTIAL&&f.gap)&&(n=f),n&&f.sn===n.sn&&(!u||d[0].fragment.sn>f.sn)&&n&&f.level===n.level){const g=a[h+1];f.sn<o&&this.fragmentTracker.getState(g)!==ye.OK?f=g:f=null}}return f}synchronizeToLiveEdge(e){const{config:t,media:s}=this;if(!s)return;const i=this.hls.liveSyncPosition,n=s.currentTime,a=e.fragments[0].start,o=e.edge,l=n>=a-t.maxFragLookUpTolerance&&n<=o;if(i!==null&&s.duration>i&&(n<i||!l)){const c=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!l&&s.readyState<4||n<o-c)&&(this.loadedmetadata||(this.nextLoadPosition=i),s.readyState&&(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${i.toFixed(3)}`),s.currentTime=i))}}alignPlaylists(e,t,s){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const n=e.fragments[0].start,a=!t,o=e.alignedSliding&&W(n);if(a||!o&&!n){const{fragPrevious:l}=this;ud(l,s,e);const c=e.fragments[0].start;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${l?l.sn:"na"} fragments: ${i}`),c}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let s=this.startPosition;if(s<t&&(s=-1),s===-1||this.lastCurrentTime===-1){const i=this.startTimeOffset!==null,n=i?this.startTimeOffset:e.startTimeOffset;n!==null&&W(n)?(s=t+n,n<0&&(s+=e.totalduration),s=Math.min(Math.max(t,s),t+e.totalduration),this.log(`Start time offset ${n} found in ${i?"multivariant":"media"} playlist, adjust startPosition to ${s}`),this.startPosition=s):e.live?s=this.hls.liveSyncPosition||t:this.startPosition=s=0,this.lastCurrentTime=s}this.nextLoadPosition=s}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==V.FRAG_LOADING_WAITING_RETRY)&&(this.state=V.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const d=this.getCurrentContext(t.chunkMeta);d&&(t.frag=d.frag)}const s=t.frag;if(!s||s.type!==e||!this.levels)return;if(this.fragContextChanged(s)){var i;this.warn(`Frag load error must match current frag to retry ${s.url} > ${(i=this.fragCurrent)==null?void 0:i.url}`);return}const n=t.details===$.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(s,!0);const a=t.errorAction,{action:o,retryCount:l=0,retryConfig:c}=a||{};if(a&&o===xe.RetryRequest&&c){this.resetStartWhenNotLoaded(this.levelLastLoaded);const d=dr(c,l);this.warn(`Fragment ${s.sn} of ${e} ${s.level} errored with ${t.details}, retrying loading ${l+1}/${c.maxNumRetry} in ${d}ms`),a.resolved=!0,this.retryDate=self.performance.now()+d,this.state=V.FRAG_LOADING_WAITING_RETRY}else if(c&&a)if(this.resetFragmentErrors(e),l<c.maxNumRetry)!n&&o!==xe.RemoveAlternatePermanently&&(a.resolved=!0);else{O.warn(`${t.details} reached or exceeded max retry (${l})`);return}else(a==null?void 0:a.action)===xe.SendAlternateToPenaltyBox?this.state=V.WAITING_LEVEL:this.state=V.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===V.PARSING||this.state===V.PARSED){const t=e.frag,s=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,s),n=i&&i.len>.5;n&&this.reduceMaxBufferLength(i.len,(t==null?void 0:t.duration)||10);const a=!n;return a&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${s} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===X.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==V.STOPPED&&(this.state=V.IDLE)}afterBufferFlushed(e,t,s){if(!e)return;const i=le.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,s),this.state===V.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=V.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,s,i){var n;const a=s.details;if(!a){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,c)=>{const d=e.elementaryStreams[c];if(d){const u=d.endPTS-d.startPTS;if(u<=0)return this.warn(`Could not parse fragment ${e.sn} ${c} duration reliably (${u})`),l||!1;const f=i?0:Ta(a,e,d.startPTS,d.endPTS,d.startDTS,d.endDTS);return this.hls.trigger(x.LEVEL_PTS_UPDATED,{details:a,level:s,drift:f,type:c,frag:e,start:d.startPTS,end:d.endPTS}),!0}return l},!1)&&((n=this.transmuxer)==null?void 0:n.error)===null){const l=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(s.fragmentError===0&&(s.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(l.message),this.hls.trigger(x.ERROR,{type:J.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of level "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=V.PARSED,this.hls.trigger(x.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class Ra{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let s;if(e.length)e.length===1?s=e[0]:s=xd(e,t);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function xd(r,e){const t=new Uint8Array(e);let s=0;for(let i=0;i<r.length;i++){const n=r[i];t.set(n,s),s+=n.length}return t}function Td(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Sd(){const r=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(r);return{worker:new self.Worker(e),objectURL:e}}function bd(r){const e=new self.URL(r,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function Ve(r="",e=9e4){return{type:r,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class mr{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,s,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,s){}demux(e,t){this.cachedData&&(e=Oe(this.cachedData,e),this.cachedData=null);let s=Wt(e,0),i=s?s.length:0,n;const a=this._audioTrack,o=this._id3Track,l=s?cr(s):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&W(l))&&(this.basePTS=wd(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),s&&s.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:$e.audioId3,duration:Number.POSITIVE_INFINITY});i<c;){if(this.canParse(e,i)){const d=this.appendFrame(a,e,i);d?(this.frameIndex++,this.lastPTS=d.sample.pts,i+=d.length,n=i):i=c}else Kl(e,i)?(s=Wt(e,i),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:$e.audioId3,duration:Number.POSITIVE_INFINITY}),i+=s.length,n=i):i++;if(i===c&&n!==c){const d=ct(e,n);this.cachedData?this.cachedData=Oe(this.cachedData,d):this.cachedData=d}}return{audioTrack:a,videoTrack:Ve(),id3Track:o,textTrack:Ve()}}demuxSampleAes(e,t,s){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Ve(),id3Track:this._id3Track,textTrack:Ve()}}destroy(){}}const wd=(r,e,t)=>{if(W(r))return r*90;const s=t?t.baseTime*9e4/t.timescale:0;return e*9e4+s};function Ld(r,e,t,s){let i,n,a,o;const l=navigator.userAgent.toLowerCase(),c=s,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];i=((e[t+2]&192)>>>6)+1;const u=(e[t+2]&60)>>>2;if(u>d.length-1){const f=new Error(`invalid ADTS sampling index:${u}`);r.emit(x.ERROR,x.ERROR,{type:J.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!0,error:f,reason:f.message});return}return a=(e[t+2]&1)<<2,a|=(e[t+3]&192)>>>6,O.log(`manifest codec:${s}, ADTS type:${i}, samplingIndex:${u}`),/firefox/i.test(l)?u>=6?(i=5,o=new Array(4),n=u-3):(i=2,o=new Array(2),n=u):l.indexOf("android")!==-1?(i=2,o=new Array(2),n=u):(i=5,o=new Array(4),s&&(s.indexOf("mp4a.40.29")!==-1||s.indexOf("mp4a.40.5")!==-1)||!s&&u>=6?n=u-3:((s&&s.indexOf("mp4a.40.2")!==-1&&(u>=6&&a===1||/vivaldi/i.test(l))||!s&&a===1)&&(i=2,o=new Array(2)),n=u)),o[0]=i<<3,o[0]|=(u&14)>>1,o[1]|=(u&1)<<7,o[1]|=a<<3,i===5&&(o[1]|=(n&14)>>1,o[2]=(n&1)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:d[u],channelCount:a,codec:"mp4a.40."+i,manifestCodec:c}}function Ca(r,e){return r[e]===255&&(r[e+1]&246)===240}function Da(r,e){return r[e+1]&1?7:9}function gr(r,e){return(r[e+3]&3)<<11|r[e+4]<<3|(r[e+5]&224)>>>5}function Ad(r,e){return e+5<r.length}function Gs(r,e){return e+1<r.length&&Ca(r,e)}function Id(r,e){return Ad(r,e)&&Ca(r,e)&&gr(r,e)<=r.length-e}function Rd(r,e){if(Gs(r,e)){const t=Da(r,e);if(e+t>=r.length)return!1;const s=gr(r,e);if(s<=t)return!1;const i=e+s;return i===r.length||Gs(r,i)}return!1}function _a(r,e,t,s,i){if(!r.samplerate){const n=Ld(e,t,s,i);if(!n)return;r.config=n.config,r.samplerate=n.samplerate,r.channelCount=n.channelCount,r.codec=n.codec,r.manifestCodec=n.manifestCodec,O.log(`parsed codec:${r.codec}, rate:${n.samplerate}, channels:${n.channelCount}`)}}function Pa(r){return 1024*9e4/r}function Cd(r,e){const t=Da(r,e);if(e+t<=r.length){const s=gr(r,e)-t;if(s>0)return{headerLength:t,frameLength:s}}}function ka(r,e,t,s,i){const n=Pa(r.samplerate),a=s+i*n,o=Cd(e,t);let l;if(o){const{frameLength:u,headerLength:f}=o,h=f+u,p=Math.max(0,t+h-e.length);p?(l=new Uint8Array(h-f),l.set(e.subarray(t+f,e.length),0)):l=e.subarray(t+f,t+h);const m={unit:l,pts:a};return p||r.samples.push(m),{sample:m,length:h,missing:p}}const c=e.length-t;return l=new Uint8Array(c),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:a},length:c,missing:-1}}let ds=null;const Dd=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],_d=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Pd=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],kd=[0,1,1,4];function Ma(r,e,t,s,i){if(t+24>e.length)return;const n=Oa(e,t);if(n&&t+n.frameLength<=e.length){const a=n.samplesPerFrame*9e4/n.sampleRate,o=s+i*a,l={unit:e.subarray(t,t+n.frameLength),pts:o,dts:o};return r.config=[],r.channelCount=n.channelCount,r.samplerate=n.sampleRate,r.samples.push(l),{sample:l,length:n.frameLength,missing:0}}}function Oa(r,e){const t=r[e+1]>>3&3,s=r[e+1]>>1&3,i=r[e+2]>>4&15,n=r[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&n!==3){const a=r[e+2]>>1&1,o=r[e+3]>>6,l=t===3?3-s:s===3?3:4,c=Dd[l*14+i-1]*1e3,u=_d[(t===3?0:t===2?1:2)*3+n],f=o===3?1:2,h=Pd[t][s],p=kd[s],m=h*8*p,g=Math.floor(h*c/u+a)*p;if(ds===null){const v=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ds=v?parseInt(v[1]):0}return!!ds&&ds<=87&&s===2&&c>=224e3&&o===0&&(r[e+3]=r[e+3]|128),{sampleRate:u,channelCount:f,frameLength:g,samplesPerFrame:m}}}function vr(r,e){return r[e]===255&&(r[e+1]&224)===224&&(r[e+1]&6)!==0}function Fa(r,e){return e+1<r.length&&vr(r,e)}function Md(r,e){return vr(r,e)&&4<=r.length-e}function Na(r,e){if(e+1<r.length&&vr(r,e)){const s=Oa(r,e);let i=4;s!=null&&s.frameLength&&(i=s.frameLength);const n=e+i;return n===r.length||Fa(r,n)}return!1}class Od extends mr{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,s,i){super.resetInitSegment(e,t,s,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Wt(e,0);let s=(t==null?void 0:t.length)||0;if(Na(e,s))return!1;for(let i=e.length;s<i;s++)if(Rd(e,s))return O.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Id(e,t)}appendFrame(e,t,s){_a(e,this.observer,t,s,e.manifestCodec);const i=ka(e,t,s,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const Fd=/\/emsg[-/]ID3/i;class Nd{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,s,i){const n=this.videoTrack=Ve("video",1),a=this.audioTrack=Ve("audio",1),o=this.txtTrack=Ve("text",1);if(this.id3Track=Ve("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=ha(e);if(l.video){const{id:c,timescale:d,codec:u}=l.video;n.id=c,n.timescale=o.timescale=d,n.codec=u}if(l.audio){const{id:c,timescale:d,codec:u}=l.audio;a.id=c,a.timescale=d,a.codec=u}o.id=da.text,n.sampleDuration=0,n.duration=a.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return ec(e)}demux(e,t){this.timeOffset=t;let s=e;const i=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=Oe(this.remainderData,e));const o=lc(s);this.remainderData=o.remainder,i.samples=o.valid||new Uint8Array}else i.samples=s;const a=this.extractID3Track(i,t);return n.samples=$r(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,s=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return s.samples=$r(e,t),{videoTrack:t,audioTrack:Ve(),id3Track:i,textTrack:Ve()}}extractID3Track(e,t){const s=this.id3Track;if(e.samples.length){const i=te(e.samples,["emsg"]);i&&i.forEach(n=>{const a=uc(n);if(Fd.test(a.schemeIdUri)){const o=W(a.presentationTime)?a.presentationTime/a.timeScale:t+a.presentationTimeDelta/a.timeScale;let l=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const c=a.payload;s.samples.push({data:c,len:c.byteLength,dts:o,pts:o,type:$e.emsg,duration:l})}})}return s}demuxSampleAes(e,t,s){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const Ba=(r,e)=>{let t=0,s=5;e+=s;const i=new Uint32Array(1),n=new Uint32Array(1),a=new Uint8Array(1);for(;s>0;){a[0]=r[e];const o=Math.min(s,8),l=8-o;n[0]=4278190080>>>24+l<<l,i[0]=(a[0]&n[0])>>l,t=t?t<<o|i[0]:i[0],e+=1,s-=o}return t};class Bd extends mr{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,s,i){super.resetInitSegment(e,t,s,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,s){const i=$a(e,t,s,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;const t=Wt(e,0);if(!t)return!1;const s=t.length;return e[s]===11&&e[s+1]===119&&cr(t)!==void 0&&Ba(e,s)<16}}function $a(r,e,t,s,i){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const o=[48e3,44100,32e3][n],l=e[t+4]&63,d=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][l*3+n]*2;if(t+d>e.length)return-1;const u=e[t+6]>>5;let f=0;u===2?f+=2:(u&1&&u!==1&&(f+=2),u&4&&(f+=2));const h=(e[t+6]<<8|e[t+7])>>12-f&1,m=[2,1,2,3,3,4,4,5][u]+h,g=e[t+5]>>3,y=e[t+5]&7,E=new Uint8Array([n<<6|g<<1|y>>2,(y&3)<<6|u<<3|h<<2|l>>4,l<<4&224]),v=1536/o*9e4,S=s+i*v,T=e.subarray(t,t+d);return r.config=E,r.channelCount=m,r.samplerate=o,r.samples.push({unit:T,pts:S}),d}class $d{constructor(){this.VideoSample=null}createVideoSample(e,t,s,i){return{key:e,frame:!1,pts:t,dts:s,units:[],debug:i,length:0}}getLastNalUnit(e){var t;let s=this.VideoSample,i;if((!s||s.units.length===0)&&(s=e[e.length-1]),(t=s)!=null&&t.units){const n=s.units;i=n[n.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const s=t.samples,i=s.length;if(i){const n=s[i-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&O.log(e.pts+"/"+e.dts+":"+e.debug)}}class pn{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,s=e.byteLength-t,i=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");i.set(e.subarray(s,s+n)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const s=this.word>>>32-t;if(e>32&&O.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?s<<t|this.readBits(t):s}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,s=8,i;for(let n=0;n<e;n++)s!==0&&(i=this.readEG(),s=(t+i+256)%256),t=s===0?t:s}readSPS(){let e=0,t=0,s=0,i=0,n,a,o;const l=this.readUByte.bind(this),c=this.readBits.bind(this),d=this.readUEG.bind(this),u=this.readBoolean.bind(this),f=this.skipBits.bind(this),h=this.skipEG.bind(this),p=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);l();const g=l();if(c(5),f(3),l(),p(),g===100||g===110||g===122||g===244||g===44||g===83||g===86||g===118||g===128){const L=d();if(L===3&&f(1),p(),p(),f(1),u())for(a=L!==3?8:12,o=0;o<a;o++)u()&&(o<6?m(16):m(64))}p();const y=d();if(y===0)d();else if(y===1)for(f(1),h(),h(),n=d(),o=0;o<n;o++)h();p(),f(1);const E=d(),v=d(),S=c(1);S===0&&f(1),f(1),u()&&(e=d(),t=d(),s=d(),i=d());let T=[1,1];if(u()&&u())switch(l()){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:{T=[l()<<8|l(),l()<<8|l()];break}}return{width:Math.ceil((E+1)*16-e*2-t*2),height:(2-S)*(v+1)*16-(S?2:4)*(s+i),pixelRatio:T}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class Ud extends $d{parseAVCPES(e,t,s,i,n){const a=this.parseAVCNALu(e,s.data);let o=this.VideoSample,l,c=!1;s.data=null,o&&a.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts,"")),a.forEach(d=>{var u;switch(d.type){case 1:{let m=!1;l=!0;const g=d.data;if(c&&g.length>4){const y=new pn(g).readSliceType();(y===2||y===4||y===7||y===9)&&(m=!0)}if(m){var f;(f=o)!=null&&f.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts,"")),o.frame=!0,o.key=m;break}case 5:l=!0,(u=o)!=null&&u.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts,"")),o.key=!0,o.frame=!0;break;case 6:{l=!0,ma(d.data,1,s.pts,t.samples);break}case 7:{var h,p;l=!0,c=!0;const m=d.data,y=new pn(m).readSPS();if(!e.sps||e.width!==y.width||e.height!==y.height||((h=e.pixelRatio)==null?void 0:h[0])!==y.pixelRatio[0]||((p=e.pixelRatio)==null?void 0:p[1])!==y.pixelRatio[1]){e.width=y.width,e.height=y.height,e.pixelRatio=y.pixelRatio,e.sps=[m],e.duration=n;const E=m.subarray(1,4);let v="avc1.";for(let S=0;S<3;S++){let T=E[S].toString(16);T.length<2&&(T="0"+T),v+=T}e.codec=v}break}case 8:l=!0,e.pps=[d.data];break;case 9:l=!0,e.audFound=!0,o&&this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts,"");break;case 12:l=!0;break;default:l=!1,o&&(o.debug+="unknown NAL "+d.type+" ");break}o&&l&&o.units.push(d)}),i&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}parseAVCNALu(e,t){const s=t.byteLength;let i=e.naluState||0;const n=i,a=[];let o=0,l,c,d,u=-1,f=0;for(i===-1&&(u=0,f=t[0]&31,i=0,o=1);o<s;){if(l=t[o++],!i){i=l?0:1;continue}if(i===1){i=l?0:2;continue}if(!l)i=3;else if(l===1){if(c=o-i-1,u>=0){const h={data:t.subarray(u,c),type:f};a.push(h)}else{const h=this.getLastNalUnit(e.samples);h&&(n&&o<=4-n&&h.state&&(h.data=h.data.subarray(0,h.data.byteLength-n)),c>0&&(h.data=Oe(h.data,t.subarray(0,c)),h.state=0))}o<s?(d=t[o]&31,u=o,f=d,i=0):i=-1}else i=0}if(u>=0&&i>=0){const h={data:t.subarray(u,s),type:f,state:i};a.push(h)}if(a.length===0){const h=this.getLastNalUnit(e.samples);h&&(h.data=Oe(h.data,t))}return e.naluState=i,a}}class Gd{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new hr(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,s){const i=e[t].unit;if(i.length<=16)return;const n=i.subarray(16,i.length-i.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);i.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,s)})}decryptAacSamples(e,t,s){for(;;t++){if(t>=e.length){s();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,s=new Int8Array(t);let i=0;for(let n=32;n<e.length-16;n+=160,i+=16)s.set(e.subarray(n,n+16),i);return s}getAvcDecryptedUnit(e,t){const s=new Uint8Array(t);let i=0;for(let n=32;n<e.length-16;n+=160,i+=16)e.set(s.subarray(i,i+16),n);return e}decryptAvcSample(e,t,s,i,n){const a=ga(n.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then(l=>{n.data=this.getAvcDecryptedUnit(a,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,s+1,i)})}decryptAvcSamples(e,t,s,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,s=0){if(t>=e.length){i();return}const n=e[t].units;for(;!(s>=n.length);s++){const a=n[s];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,s,i,a),!this.decrypter.isSync()))return}}}}const ve=188;class st{constructor(e,t,s){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.videoParser=new Ud}static probe(e){const t=st.syncOffset(e);return t>0&&O.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let s=Math.min(ve*5,t-ve)+1,i=0;for(;i<s;){let n=!1,a=-1,o=0;for(let l=i;l<t;l+=ve)if(e[l]===71&&(t-l===ve||e[l+ve]===71)){if(o++,a===-1&&(a=l,a!==0&&(s=Math.min(a+ve*99,e.length-ve)+1)),n||(n=Wi(e,l)===0),n&&o>1&&(a===0&&o>2||l+ve>s))return a}else{if(o)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:da[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,s,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=st.createTrack("video"),this._audioTrack=st.createTrack("audio",i),this._id3Track=st.createTrack("id3"),this._txtTrack=st.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=s,this._duration=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:s}=this;e&&(e.pesData=null),t&&(t.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,s=!1,i=!1){s||(this.sampleAes=null);let n;const a=this._videoTrack,o=this._audioTrack,l=this._id3Track,c=this._txtTrack;let d=a.pid,u=a.pesData,f=o.pid,h=l.pid,p=o.pesData,m=l.pesData,g=null,y=this.pmtParsed,E=this._pmtId,v=e.length;if(this.remainderData&&(e=Oe(this.remainderData,e),v=e.length,this.remainderData=null),v<ve&&!i)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:l,textTrack:c};const S=Math.max(0,st.syncOffset(e));v-=(v-S)%ve,v<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,v,e.buffer.byteLength-v));let T=0;for(let b=S;b<v;b+=ve)if(e[b]===71){const C=!!(e[b+1]&64),A=Wi(e,b),w=(e[b+3]&48)>>4;let I;if(w>1){if(I=b+5+e[b+4],I===b+ve)continue}else I=b+4;switch(A){case d:C&&(u&&(n=vt(u))&&this.videoParser.parseAVCPES(a,c,n,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(e.subarray(I,b+ve)),u.size+=b+ve-I);break;case f:if(C){if(p&&(n=vt(p)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,n);break;case"mp3":this.parseMPEGPES(o,n);break;case"ac3":this.parseAC3PES(o,n);break}p={data:[],size:0}}p&&(p.data.push(e.subarray(I,b+ve)),p.size+=b+ve-I);break;case h:C&&(m&&(n=vt(m))&&this.parseID3PES(l,n),m={data:[],size:0}),m&&(m.data.push(e.subarray(I,b+ve)),m.size+=b+ve-I);break;case 0:C&&(I+=e[I]+1),E=this._pmtId=Hd(e,I);break;case E:{C&&(I+=e[I]+1);const P=Vd(e,I,this.typeSupported,s,this.observer);d=P.videoPid,d>0&&(a.pid=d,a.segmentCodec=P.segmentVideoCodec),f=P.audioPid,f>0&&(o.pid=f,o.segmentCodec=P.segmentAudioCodec),h=P.id3Pid,h>0&&(l.pid=h),g!==null&&!y&&(O.warn(`MPEG-TS PMT found at ${b} after unknown PID '${g}'. Backtracking to sync byte @${S} to parse all TS packets.`),g=null,b=S-188),y=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=A;break}}else T++;T>0&&Hs(this.observer,new Error(`Found ${T} TS packet/s that do not start with 0x47`)),a.pesData=u,o.pesData=p,l.pesData=m;const L={audioTrack:o,videoTrack:a,id3Track:l,textTrack:c};return i&&this.extractRemainingSamples(L),L}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:s,id3Track:i,textTrack:n}=e,a=s.pesData,o=t.pesData,l=i.pesData;let c;if(a&&(c=vt(a))?(this.videoParser.parseAVCPES(s,n,c,!0,this._duration),s.pesData=null):s.pesData=a,o&&(c=vt(o))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,c);break;case"mp3":this.parseMPEGPES(t,c);break;case"ac3":this.parseAC3PES(t,c);break}t.pesData=null}else o!=null&&o.size&&O.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;l&&(c=vt(l))?(this.parseID3PES(i,c),i.pesData=null):i.pesData=l}demuxSampleAes(e,t,s){const i=this.demux(e,s,!0,!this.config.progressive),n=this.sampleAes=new Gd(this.observer,this.config,t);return this.decrypt(i,n)}decrypt(e,t){return new Promise(s=>{const{audioTrack:i,videoTrack:n}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{s(e)}):s(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{s(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let s=0;const i=this.aacOverFlow;let n=t.data;if(i){this.aacOverFlow=null;const u=i.missing,f=i.sample.unit.byteLength;if(u===-1)n=Oe(i.sample.unit,n);else{const h=f-u;i.sample.unit.set(n.subarray(0,u),h),e.samples.push(i.sample),s=i.missing}}let a,o;for(a=s,o=n.length;a<o-1&&!Gs(n,a);a++);if(a!==s){let u;const f=a<o-1;if(f?u=`AAC PES did not start with ADTS header,offset:${a}`:u="No ADTS header found in AAC PES",Hs(this.observer,new Error(u),f),!f)return}_a(e,this.observer,n,a,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(i){const u=Pa(e.samplerate);l=i.sample.pts+u}else{O.warn("[tsdemuxer]: AAC PES unknown PTS");return}let c=0,d;for(;a<o;)if(d=ka(e,n,a,l,c),a+=d.length,d.missing){this.aacOverFlow=d;break}else for(c++;a<o-1&&!Gs(n,a);a++);}parseMPEGPES(e,t){const s=t.data,i=s.length;let n=0,a=0;const o=t.pts;if(o===void 0){O.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<i;)if(Fa(s,a)){const l=Ma(e,s,a,o,n);if(l)a+=l.length,n++;else break}else a++}parseAC3PES(e,t){{const s=t.data,i=t.pts;if(i===void 0){O.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=s.length;let a=0,o=0,l;for(;o<n&&(l=$a(e,s,o,i,a++))>0;)o+=l}}parseID3PES(e,t){if(t.pts===void 0){O.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=me({},t,{type:this._videoTrack?$e.emsg:$e.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}}function Wi(r,e){return((r[e+1]&31)<<8)+r[e+2]}function Hd(r,e){return(r[e+10]&31)<<8|r[e+11]}function Vd(r,e,t,s,i){const n={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=(r[e+1]&15)<<8|r[e+2],o=e+3+a-4,l=(r[e+10]&15)<<8|r[e+11];for(e+=12+l;e<o;){const c=Wi(r,e),d=(r[e+3]&15)<<8|r[e+4];switch(r[e]){case 207:if(!s){mi("ADTS AAC");break}case 15:n.audioPid===-1&&(n.audioPid=c);break;case 21:n.id3Pid===-1&&(n.id3Pid=c);break;case 219:if(!s){mi("H.264");break}case 27:n.videoPid===-1&&(n.videoPid=c,n.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?O.log("MPEG audio found, not supported in this browser"):n.audioPid===-1&&(n.audioPid=c,n.segmentAudioCodec="mp3");break;case 193:if(!s){mi("AC-3");break}case 129:t.ac3?n.audioPid===-1&&(n.audioPid=c,n.segmentAudioCodec="ac3"):O.log("AC-3 audio found, not supported in this browser");break;case 6:if(n.audioPid===-1&&d>0){let u=e+5,f=d;for(;f>2;){switch(r[u]){case 106:t.ac3!==!0?O.log("AC-3 audio found, not supported in this browser for now"):(n.audioPid=c,n.segmentAudioCodec="ac3");break}const p=r[u+1]+2;u+=p,f-=p}}break;case 194:case 135:return Hs(i,new Error("Unsupported EC-3 in M2TS found")),n;case 36:return Hs(i,new Error("Unsupported HEVC in M2TS found")),n}e+=d+5}return n}function Hs(r,e,t){O.warn(`parsing error: ${e.message}`),r.emit(x.ERROR,x.ERROR,{type:J.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function mi(r){O.log(`${r} with AES-128-CBC encryption found in unencrypted stream`)}function vt(r){let e=0,t,s,i,n,a;const o=r.data;if(!r||r.size===0)return null;for(;o[0].length<19&&o.length>1;)o[0]=Oe(o[0],o[1]),o.splice(1,1);if(t=o[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(s=(t[4]<<8)+t[5],s&&s>r.size-6)return null;const c=t[7];c&192&&(n=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,c&64?(a=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,n-a>60*9e4&&(O.warn(`${Math.round((n-a)/9e4)}s delta between PTS and DTS, align them`),n=a)):a=n),i=t[8];let d=i+9;if(r.size<=d)return null;r.size-=d;const u=new Uint8Array(r.size);for(let f=0,h=o.length;f<h;f++){t=o[f];let p=t.byteLength;if(d)if(d>p){d-=p;continue}else t=t.subarray(d),p-=d,d=0;u.set(t,e),e+=p}return s&&(s-=i+3),{data:u,pts:n,dts:a,len:s}}return null}class zd extends mr{resetInitSegment(e,t,s,i){super.resetInitSegment(e,t,s,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Wt(e,0);let s=(t==null?void 0:t.length)||0;if(t&&e[s]===11&&e[s+1]===119&&cr(t)!==void 0&&Ba(e,s)<=16)return!1;for(let i=e.length;s<i;s++)if(Na(e,s))return O.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Md(e,t)}appendFrame(e,t,s){if(this.basePTS!==null)return Ma(e,t,s,this.basePTS,this.frameIndex)}}class mn{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const et=Math.pow(2,32)-1;class F{static init(){F.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in F.types)F.types.hasOwnProperty(e)&&(F.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),s=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);F.HDLR_TYPES={video:t,audio:s};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);F.STTS=F.STSC=F.STCO=n,F.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),F.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),F.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),F.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);F.FTYP=F.box(F.types.ftyp,a,l,a,o),F.DINF=F.box(F.types.dinf,F.box(F.types.dref,i))}static box(e,...t){let s=8,i=t.length;const n=i;for(;i--;)s+=t[i].byteLength;const a=new Uint8Array(s);for(a[0]=s>>24&255,a[1]=s>>16&255,a[2]=s>>8&255,a[3]=s&255,a.set(e,4),i=0,s=8;i<n;i++)a.set(t[i],s),s+=t[i].byteLength;return a}static hdlr(e){return F.box(F.types.hdlr,F.HDLR_TYPES[e])}static mdat(e){return F.box(F.types.mdat,e)}static mdhd(e,t){t*=e;const s=Math.floor(t/(et+1)),i=Math.floor(t%(et+1));return F.box(F.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return F.box(F.types.mdia,F.mdhd(e.timescale,e.duration),F.hdlr(e.type),F.minf(e))}static mfhd(e){return F.box(F.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?F.box(F.types.minf,F.box(F.types.smhd,F.SMHD),F.DINF,F.stbl(e)):F.box(F.types.minf,F.box(F.types.vmhd,F.VMHD),F.DINF,F.stbl(e))}static moof(e,t,s){return F.box(F.types.moof,F.mfhd(e),F.traf(s,t))}static moov(e){let t=e.length;const s=[];for(;t--;)s[t]=F.trak(e[t]);return F.box.apply(null,[F.types.moov,F.mvhd(e[0].timescale,e[0].duration)].concat(s).concat(F.mvex(e)))}static mvex(e){let t=e.length;const s=[];for(;t--;)s[t]=F.trex(e[t]);return F.box.apply(null,[F.types.mvex,...s])}static mvhd(e,t){t*=e;const s=Math.floor(t/(et+1)),i=Math.floor(t%(et+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,i>>24,i>>16&255,i>>8&255,i&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return F.box(F.types.mvhd,n)}static sdtp(e){const t=e.samples||[],s=new Uint8Array(4+t.length);let i,n;for(i=0;i<t.length;i++)n=t[i].flags,s[i+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return F.box(F.types.sdtp,s)}static stbl(e){return F.box(F.types.stbl,F.stsd(e),F.box(F.types.stts,F.STTS),F.box(F.types.stsc,F.STSC),F.box(F.types.stsz,F.STSZ),F.box(F.types.stco,F.STCO))}static avc1(e){let t=[],s=[],i,n,a;for(i=0;i<e.sps.length;i++)n=e.sps[i],a=n.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(n));for(i=0;i<e.pps.length;i++)n=e.pps[i],a=n.byteLength,s.push(a>>>8&255),s.push(a&255),s=s.concat(Array.prototype.slice.call(n));const o=F.box(F.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(s))),l=e.width,c=e.height,d=e.pixelRatio[0],u=e.pixelRatio[1];return F.box(F.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,F.box(F.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),F.box(F.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,u>>24,u>>16&255,u>>8&255,u&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return F.box(F.types.mp4a,F.audioStsd(e),F.box(F.types.esds,F.esds(e)))}static mp3(e){return F.box(F.types[".mp3"],F.audioStsd(e))}static ac3(e){return F.box(F.types["ac-3"],F.audioStsd(e),F.box(F.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?F.box(F.types.stsd,F.STSD,F.mp3(e)):e.segmentCodec==="ac3"?F.box(F.types.stsd,F.STSD,F.ac3(e)):F.box(F.types.stsd,F.STSD,F.mp4a(e)):F.box(F.types.stsd,F.STSD,F.avc1(e))}static tkhd(e){const t=e.id,s=e.duration*e.timescale,i=e.width,n=e.height,a=Math.floor(s/(et+1)),o=Math.floor(s%(et+1));return F.box(F.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,i&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const s=F.sdtp(e),i=e.id,n=Math.floor(t/(et+1)),a=Math.floor(t%(et+1));return F.box(F.types.traf,F.box(F.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),F.box(F.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,a>>24,a>>16&255,a>>8&255,a&255])),F.trun(e,s.length+16+20+8+16+8+8),s)}static trak(e){return e.duration=e.duration||4294967295,F.box(F.types.trak,F.tkhd(e),F.mdia(e))}static trex(e){const t=e.id;return F.box(F.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const s=e.samples||[],i=s.length,n=12+16*i,a=new Uint8Array(n);let o,l,c,d,u,f;for(t+=8+n,a.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<i;o++)l=s[o],c=l.duration,d=l.size,u=l.flags,f=l.cts,a.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,u.degradPrio&61440,u.degradPrio&15,f>>>24&255,f>>>16&255,f>>>8&255,f&255],12+16*o);return F.box(F.types.trun,a)}static initSegment(e){F.types||F.init();const t=F.moov(e);return Oe(F.FTYP,t)}}F.types=void 0;F.HDLR_TYPES=void 0;F.STTS=void 0;F.STSC=void 0;F.STCO=void 0;F.STSZ=void 0;F.VMHD=void 0;F.SMHD=void 0;F.STSD=void 0;F.FTYP=void 0;F.DINF=void 0;const Ua=9e4;function yr(r,e,t=1,s=!1){const i=r*e*t;return s?Math.round(i):i}function Kd(r,e,t=1,s=!1){return yr(r,e,1/t,s)}function Nt(r,e=!1){return yr(r,1e3,1/Ua,e)}function Yd(r,e=1){return yr(r,Ua,1/e)}const Wd=10*1e3,gn=1024,qd=1152,jd=1536;let yt=null,gi=null;class Ts{constructor(e,t,s,i=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.ISGenerated=!1,yt===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);yt=a?parseInt(a[1]):0}if(gi===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);gi=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){O.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){O.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){O.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const s=e.reduce((i,n)=>{const a=n.pts-i;return a<-4294967296?(t=!0,ke(i,n.pts)):a>0?i:n.pts},e[0].pts);return t&&O.debug("PTS rollover detected"),s}remux(e,t,s,i,n,a,o,l){let c,d,u,f,h,p,m=n,g=n;const y=e.pid>-1,E=t.pid>-1,v=t.samples.length,S=e.samples.length>0,T=o&&v>0||v>1;if((!y||S)&&(!E||T)||this.ISGenerated||o){if(this.ISGenerated){var b,C,A,w;const D=this.videoTrackConfig;D&&(t.width!==D.width||t.height!==D.height||((b=t.pixelRatio)==null?void 0:b[0])!==((C=D.pixelRatio)==null?void 0:C[0])||((A=t.pixelRatio)==null?void 0:A[1])!==((w=D.pixelRatio)==null?void 0:w[1]))&&this.resetInitSegment()}else u=this.generateIS(e,t,n,a);const I=this.isVideoContiguous;let P=-1,R;if(T&&(P=Xd(t.samples),!I&&this.config.forceKeyFrameOnDiscontinuity))if(p=!0,P>0){O.warn(`[mp4-remuxer]: Dropped ${P} out of ${v} video samples due to a missing keyframe`);const D=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(P),t.dropped+=P,g+=(t.samples[0].pts-D)/t.inputTimeScale,R=g}else P===-1&&(O.warn(`[mp4-remuxer]: No keyframe found out of ${v} video samples`),p=!1);if(this.ISGenerated){if(S&&T){const D=this.getVideoStartPts(t.samples),B=(ke(e.samples[0].pts,D)-D)/t.inputTimeScale;m+=Math.max(0,B),g+=Math.max(0,-B)}if(S){if(e.samplerate||(O.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(e,t,n,a)),d=this.remuxAudio(e,m,this.isAudioContiguous,a,E||T||l===X.AUDIO?g:void 0),T){const D=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(O.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(e,t,n,a)),c=this.remuxVideo(t,g,I,D)}}else T&&(c=this.remuxVideo(t,g,I,0));c&&(c.firstKeyFrame=P,c.independent=P!==-1,c.firstKeyFramePTS=R)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(h=Ga(s,n,this._initPTS,this._initDTS)),i.samples.length&&(f=Ha(i,n,this._initPTS))),{audio:d,video:c,initSegment:u,independent:p,text:f,id3:h}}generateIS(e,t,s,i){const n=e.samples,a=t.samples,o=this.typeSupported,l={},c=this._initPTS;let d=!c||i,u="audio/mp4",f,h,p;if(d&&(f=h=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(u="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}l.audio={id:"audio",container:u,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):F.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(p=e.inputTimeScale,!c||p!==c.timescale?f=h=n[0].pts-Math.round(p*s):d=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:F.initSegment([t]),metadata:{width:t.width,height:t.height}},d)if(p=t.inputTimeScale,!c||p!==c.timescale){const m=this.getVideoStartPts(a),g=Math.round(p*s);h=Math.min(h,ke(a[0].dts,m)-g),f=Math.min(f,m-g)}else d=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,d?(this._initPTS={baseTime:f,timescale:p},this._initDTS={baseTime:h,timescale:p}):f=p=void 0,{tracks:l,initPTS:f,timescale:p}}remuxVideo(e,t,s,i){const n=e.inputTimeScale,a=e.samples,o=[],l=a.length,c=this._initPTS;let d=this.nextAvcDts,u=8,f=this.videoSampleDuration,h,p,m=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,y=!1;if(!s||d===null){const N=t*n,G=a[0].pts-ke(a[0].dts,a[0].pts);yt&&d!==null&&Math.abs(N-G-d)<15e3?s=!0:d=N-G}const E=c.baseTime*n/c.timescale;for(let N=0;N<l;N++){const G=a[N];G.pts=ke(G.pts-E,d),G.dts=ke(G.dts-E,d),G.dts<a[N>0?N-1:N].dts&&(y=!0)}y&&a.sort(function(N,G){const U=N.dts-G.dts,H=N.pts-G.pts;return U||H}),h=a[0].dts,p=a[a.length-1].dts;const v=p-h,S=v?Math.round(v/(l-1)):f||e.inputTimeScale/30;if(s){const N=h-d,G=N>S,U=N<-1;if((G||U)&&(G?O.warn(`AVC: ${Nt(N,!0)} ms (${N}dts) hole between fragments detected at ${t.toFixed(3)}`):O.warn(`AVC: ${Nt(-N,!0)} ms (${N}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!U||d>=a[0].pts||yt)){h=d;const H=a[0].pts-N;if(G)a[0].dts=h,a[0].pts=H;else for(let z=0;z<a.length&&!(a[z].dts>H);z++)a[z].dts-=N,a[z].pts-=N;O.log(`Video: Initial PTS/DTS adjusted: ${Nt(H,!0)}/${Nt(h,!0)}, delta: ${Nt(N,!0)} ms`)}}h=Math.max(0,h);let T=0,L=0,b=h;for(let N=0;N<l;N++){const G=a[N],U=G.units,H=U.length;let z=0;for(let Z=0;Z<H;Z++)z+=U[Z].data.length;L+=z,T+=H,G.length=z,G.dts<b?(G.dts=b,b+=S/4|0||1):b=G.dts,m=Math.min(G.pts,m),g=Math.max(G.pts,g)}p=a[l-1].dts;const C=L+4*T+8;let A;try{A=new Uint8Array(C)}catch(N){this.observer.emit(x.ERROR,x.ERROR,{type:J.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:N,bytes:C,reason:`fail allocating video mdat ${C}`});return}const w=new DataView(A.buffer);w.setUint32(0,C),A.set(F.types.mdat,4);let I=!1,P=Number.POSITIVE_INFINITY,R=Number.POSITIVE_INFINITY,D=Number.NEGATIVE_INFINITY,_=Number.NEGATIVE_INFINITY;for(let N=0;N<l;N++){const G=a[N],U=G.units;let H=0;for(let K=0,Q=U.length;K<Q;K++){const q=U[K],oe=q.data,pe=q.data.byteLength;w.setUint32(u,pe),u+=4,A.set(oe,u),u+=pe,H+=4+pe}let z;if(N<l-1)f=a[N+1].dts-G.dts,z=a[N+1].pts-G.pts;else{const K=this.config,Q=N>0?G.dts-a[N-1].dts:S;if(z=N>0?G.pts-a[N-1].pts:S,K.stretchShortVideoTrack&&this.nextAudioPts!==null){const q=Math.floor(K.maxBufferHole*n),oe=(i?m+i*n:this.nextAudioPts)-G.pts;oe>q?(f=oe-Q,f<0?f=Q:I=!0,O.log(`[mp4-remuxer]: It is approximately ${oe/90} ms to the next segment; using duration ${f/90} ms for the last video frame.`)):f=Q}else f=Q}const Z=Math.round(G.pts-G.dts);P=Math.min(P,f),D=Math.max(D,f),R=Math.min(R,z),_=Math.max(_,z),o.push(new vn(G.key,f,H,Z))}if(o.length){if(yt){if(yt<70){const N=o[0].flags;N.dependsOn=2,N.isNonSync=0}}else if(gi&&_-R<D-P&&S/D<.025&&o[0].cts===0){O.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let N=h;for(let G=0,U=o.length;G<U;G++){const H=N+o[G].duration,z=N+o[G].cts;if(G<U-1){const Z=H+o[G+1].cts;o[G].duration=Z-z}else o[G].duration=G?o[G-1].duration:S;o[G].cts=0,N=H}}}f=I||!f?S:f,this.nextAvcDts=d=p+f,this.videoSampleDuration=f,this.isVideoContiguous=!0;const M={data1:F.moof(e.sequenceNumber++,h,me({},e,{samples:o})),data2:A,startPTS:m/n,endPTS:(g+f)/n,startDTS:h/n,endDTS:d/n,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,M}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return qd;case"ac3":return jd;default:return gn}}remuxAudio(e,t,s,i,n){const a=e.inputTimeScale,o=e.samplerate?e.samplerate:a,l=a/o,c=this.getSamplesPerFrame(e),d=c*l,u=this._initPTS,f=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,h=[],p=n!==void 0;let m=e.samples,g=f?0:8,y=this.nextAudioPts||-1;const E=t*a,v=u.baseTime*a/u.timescale;if(this.isAudioContiguous=s=s||m.length&&y>0&&(i&&Math.abs(E-y)<9e3||Math.abs(ke(m[0].pts-v,E)-y)<20*d),m.forEach(function(B){B.pts=ke(B.pts-v,E)}),!s||y<0){if(m=m.filter(B=>B.pts>=0),!m.length)return;n===0?y=0:i&&!p?y=Math.max(0,E):y=m[0].pts}if(e.segmentCodec==="aac"){const B=this.config.maxAudioFramesDrift;for(let k=0,M=y;k<m.length;k++){const N=m[k],G=N.pts,U=G-M,H=Math.abs(1e3*U/a);if(U<=-B*d&&p)k===0&&(O.warn(`Audio frame @ ${(G/a).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*U/a)} ms.`),this.nextAudioPts=y=M=G);else if(U>=B*d&&H<Wd&&p){let z=Math.round(U/d);M=G-z*d,M<0&&(z--,M+=d),k===0&&(this.nextAudioPts=y=M),O.warn(`[mp4-remuxer]: Injecting ${z} audio frame @ ${(M/a).toFixed(3)}s due to ${Math.round(1e3*U/a)} ms gap.`);for(let Z=0;Z<z;Z++){const K=Math.max(M,0);let Q=mn.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);Q||(O.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Q=N.unit.subarray()),m.splice(k,0,{unit:Q,pts:K}),M+=d,k++}}N.pts=M,M+=d}}let S=null,T=null,L,b=0,C=m.length;for(;C--;)b+=m[C].unit.byteLength;for(let B=0,k=m.length;B<k;B++){const M=m[B],N=M.unit;let G=M.pts;if(T!==null){const H=h[B-1];H.duration=Math.round((G-T)/l)}else if(s&&e.segmentCodec==="aac"&&(G=y),S=G,b>0){b+=g;try{L=new Uint8Array(b)}catch(H){this.observer.emit(x.ERROR,x.ERROR,{type:J.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:H,bytes:b,reason:`fail allocating audio mdat ${b}`});return}f||(new DataView(L.buffer).setUint32(0,b),L.set(F.types.mdat,4))}else return;L.set(N,g);const U=N.byteLength;g+=U,h.push(new vn(!0,c,U,0)),T=G}const A=h.length;if(!A)return;const w=h[h.length-1];this.nextAudioPts=y=T+l*w.duration;const I=f?new Uint8Array(0):F.moof(e.sequenceNumber++,S/l,me({},e,{samples:h}));e.samples=[];const P=S/a,R=y/a,_={data1:I,data2:L,startPTS:P,endPTS:R,startDTS:P,endDTS:R,type:"audio",hasAudio:!0,hasVideo:!1,nb:A};return this.isAudioContiguous=!0,_}remuxEmptyAudio(e,t,s,i){const n=e.inputTimeScale,a=e.samplerate?e.samplerate:n,o=n/a,l=this.nextAudioPts,c=this._initDTS,d=c.baseTime*9e4/c.timescale,u=(l!==null?l:i.startDTS*n)+d,f=i.endDTS*n+d,h=o*gn,p=Math.ceil((f-u)/h),m=mn.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(O.warn("[mp4-remuxer]: remux empty Audio"),!m){O.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const g=[];for(let y=0;y<p;y++){const E=u+y*h;g.push({unit:m,pts:E,dts:E})}return e.samples=g,this.remuxAudio(e,t,s,!1)}}function ke(r,e){let t;if(e===null)return r;for(e<r?t=-8589934592:t=8589934592;Math.abs(r-e)>4294967296;)r+=t;return r}function Xd(r){for(let e=0;e<r.length;e++)if(r[e].key)return e;return-1}function Ga(r,e,t,s){const i=r.samples.length;if(!i)return;const n=r.inputTimeScale;for(let o=0;o<i;o++){const l=r.samples[o];l.pts=ke(l.pts-t.baseTime*n/t.timescale,e*n)/n,l.dts=ke(l.dts-s.baseTime*n/s.timescale,e*n)/n}const a=r.samples;return r.samples=[],{samples:a}}function Ha(r,e,t){const s=r.samples.length;if(!s)return;const i=r.inputTimeScale;for(let a=0;a<s;a++){const o=r.samples[a];o.pts=ke(o.pts-t.baseTime*i/t.timescale,e*i)/i}r.samples.sort((a,o)=>a.pts-o.pts);const n=r.samples;return r.samples=[],{samples:n}}class vn{constructor(e,t,s,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=s,this.cts=i,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class Qd{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,s,i){this.audioCodec=t,this.videoCodec=s,this.generateInitSegment(ic(e,i)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:s}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const i=this.initData=ha(e);i.audio&&(t=yn(i.audio,ae.AUDIO)),i.video&&(s=yn(i.video,ae.VIDEO));const n={};i.audio&&i.video?n.audiovideo={container:"video/mp4",codec:t+","+s,initSegment:e,id:"main"}:i.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?n.video={container:"video/mp4",codec:s,initSegment:e,id:"main"}:O.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,s,i,n,a){var o,l;let{initPTS:c,lastEndTime:d}=this;const u={audio:void 0,video:void 0,text:i,id3:s,initSegment:void 0};W(d)||(d=this.lastEndTime=n||0);const f=t.samples;if(!(f!=null&&f.length))return u;const h={initPTS:void 0,timescale:1};let p=this.initData;if((o=p)!=null&&o.length||(this.generateInitSegment(f),p=this.initData),!((l=p)!=null&&l.length))return O.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1);const m=nc(f,p),g=rc(p,f),y=g===null?n:g;(Zd(c,y,n,m)||h.timescale!==c.timescale&&a)&&(h.initPTS=y-n,c&&c.timescale===1&&O.warn(`Adjusting initPTS by ${h.initPTS-c.baseTime}`),this.initPTS=c={baseTime:h.initPTS,timescale:1});const E=e?y-c.baseTime/c.timescale:d,v=E+m;oc(p,f,c.baseTime/c.timescale),m>0?this.lastEndTime=v:(O.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const S=!!p.audio,T=!!p.video;let L="";S&&(L+="audio"),T&&(L+="video");const b={data1:f,startPTS:E,startDTS:E,endPTS:v,endDTS:v,type:L,hasAudio:S,hasVideo:T,nb:1,dropped:0};return u.audio=b.type==="audio"?b:void 0,u.video=b.type!=="audio"?b:void 0,u.initSegment=h,u.id3=Ga(s,n,c,c),i.samples.length&&(u.text=Ha(i,n,c)),u}}function Zd(r,e,t,s){if(r===null)return!0;const i=Math.max(s,1),n=e-r.baseTime/r.timescale;return Math.abs(n-t)>i}function yn(r,e){const t=r==null?void 0:r.codec;if(t&&t.length>4)return t;if(e===ae.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return Os(t,!1);const s="mp4a.40.5";return O.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${s}"`),s}return O.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let Ze;try{Ze=self.performance.now.bind(self.performance)}catch{O.debug("Unable to use Performance API on this environment"),Ze=Lt==null?void 0:Lt.Date.now}const Ss=[{demux:Nd,remux:Qd},{demux:st,remux:Ts},{demux:Od,remux:Ts},{demux:zd,remux:Ts}];Ss.splice(2,0,{demux:Bd,remux:Ts});class En{constructor(e,t,s,i,n){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=s,this.vendor=i,this.id=n}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,s,i){const n=s.transmuxing;n.executeStart=Ze();let a=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:l}=this;i&&(this.currentTransmuxState=i);const{contiguous:c,discontinuity:d,trackSwitch:u,accurateTimeOffset:f,timeOffset:h,initSegmentChange:p}=i||o,{audioCodec:m,videoCodec:g,defaultInitPts:y,duration:E,initSegmentData:v}=l,S=Jd(a,t);if(S&&S.method==="AES-128"){const C=this.getDecrypter();if(C.isSync()){let A=C.softwareDecrypt(a,S.key.buffer,S.iv.buffer);if(s.part>-1&&(A=C.flush()),!A)return n.executeEnd=Ze(),vi(s);a=new Uint8Array(A)}else return this.decryptionPromise=C.webCryptoDecrypt(a,S.key.buffer,S.iv.buffer).then(A=>{const w=this.push(A,null,s);return this.decryptionPromise=null,w}),this.decryptionPromise}const T=this.needsProbing(d,u);if(T){const C=this.configureTransmuxer(a);if(C)return O.warn(`[transmuxer] ${C.message}`),this.observer.emit(x.ERROR,x.ERROR,{type:J.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:C,reason:C.message}),n.executeEnd=Ze(),vi(s)}(d||u||p||T)&&this.resetInitSegment(v,m,g,E,t),(d||p||T)&&this.resetInitialTimestamp(y),c||this.resetContiguity();const L=this.transmux(a,S,h,f,s),b=this.currentTransmuxState;return b.contiguous=!0,b.discontinuity=!1,b.trackSwitch=!1,n.executeEnd=Ze(),L}flush(e){const t=e.transmuxing;t.executeStart=Ze();const{decrypter:s,currentTransmuxState:i,decryptionPromise:n}=this;if(n)return n.then(()=>this.flush(e));const a=[],{timeOffset:o}=i;if(s){const u=s.flush();u&&a.push(this.push(u,null,e))}const{demuxer:l,remuxer:c}=this;if(!l||!c)return t.executeEnd=Ze(),[vi(e)];const d=l.flush(o);return bs(d)?d.then(u=>(this.flushRemux(a,u,e),a)):(this.flushRemux(a,d,e),a)}flushRemux(e,t,s){const{audioTrack:i,videoTrack:n,id3Track:a,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:c}=this.currentTransmuxState;O.log(`[transmuxer.ts]: Flushed fragment ${s.sn}${s.part>-1?" p: "+s.part:""} of level ${s.level}`);const d=this.remuxer.remux(i,n,a,o,c,l,!0,this.id);e.push({remuxResult:d,chunkMeta:s}),s.transmuxing.executeEnd=Ze()}resetInitialTimestamp(e){const{demuxer:t,remuxer:s}=this;!t||!s||(t.resetTimeStamp(e),s.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,s,i,n){const{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,t,s,i),o.resetInitSegment(e,t,s,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,s,i,n){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,s,i,n):a=this.transmuxUnencrypted(e,s,i,n),a}transmuxUnencrypted(e,t,s,i){const{audioTrack:n,videoTrack:a,id3Track:o,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,a,o,l,t,s,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,s,i,n){return this.demuxer.demuxSampleAes(e,t,s).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,s,i,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:s,typeSupported:i,vendor:n}=this;let a;for(let f=0,h=Ss.length;f<h;f++){var o;if((o=Ss[f].demux)!=null&&o.probe(e)){a=Ss[f];break}}if(!a)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,c=this.remuxer,d=a.remux,u=a.demux;(!c||!(c instanceof d))&&(this.remuxer=new d(s,t,i,n)),(!l||!(l instanceof u))&&(this.demuxer=new u(s,t,i),this.probe=u.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new hr(this.config)),e}}function Jd(r,e){let t=null;return r.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const vi=r=>({remuxResult:{},chunkMeta:r});function bs(r){return"then"in r&&r.then instanceof Function}class eu{constructor(e,t,s,i,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=s,this.duration=i,this.defaultInitPts=n||null}}class tu{constructor(e,t,s,i,n,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=s,this.trackSwitch=i,this.timeOffset=n,this.initSegmentChange=a}}var Va={exports:{}};(function(r){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function i(l,c,d){this.fn=l,this.context=c,this.once=d||!1}function n(l,c,d,u,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new i(d,u||l,f),p=t?t+c:c;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],h]:l._events[p].push(h):(l._events[p]=h,l._eventsCount++),l}function a(l,c){--l._eventsCount===0?l._events=new s:delete l._events[c]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],d,u;if(this._eventsCount===0)return c;for(u in d=this._events)e.call(d,u)&&c.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},o.prototype.listeners=function(c){var d=t?t+c:c,u=this._events[d];if(!u)return[];if(u.fn)return[u.fn];for(var f=0,h=u.length,p=new Array(h);f<h;f++)p[f]=u[f].fn;return p},o.prototype.listenerCount=function(c){var d=t?t+c:c,u=this._events[d];return u?u.fn?1:u.length:0},o.prototype.emit=function(c,d,u,f,h,p){var m=t?t+c:c;if(!this._events[m])return!1;var g=this._events[m],y=arguments.length,E,v;if(g.fn){switch(g.once&&this.removeListener(c,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,d),!0;case 3:return g.fn.call(g.context,d,u),!0;case 4:return g.fn.call(g.context,d,u,f),!0;case 5:return g.fn.call(g.context,d,u,f,h),!0;case 6:return g.fn.call(g.context,d,u,f,h,p),!0}for(v=1,E=new Array(y-1);v<y;v++)E[v-1]=arguments[v];g.fn.apply(g.context,E)}else{var S=g.length,T;for(v=0;v<S;v++)switch(g[v].once&&this.removeListener(c,g[v].fn,void 0,!0),y){case 1:g[v].fn.call(g[v].context);break;case 2:g[v].fn.call(g[v].context,d);break;case 3:g[v].fn.call(g[v].context,d,u);break;case 4:g[v].fn.call(g[v].context,d,u,f);break;default:if(!E)for(T=1,E=new Array(y-1);T<y;T++)E[T-1]=arguments[T];g[v].fn.apply(g[v].context,E)}}return!0},o.prototype.on=function(c,d,u){return n(this,c,d,u,!1)},o.prototype.once=function(c,d,u){return n(this,c,d,u,!0)},o.prototype.removeListener=function(c,d,u,f){var h=t?t+c:c;if(!this._events[h])return this;if(!d)return a(this,h),this;var p=this._events[h];if(p.fn)p.fn===d&&(!f||p.once)&&(!u||p.context===u)&&a(this,h);else{for(var m=0,g=[],y=p.length;m<y;m++)(p[m].fn!==d||f&&!p[m].once||u&&p[m].context!==u)&&g.push(p[m]);g.length?this._events[h]=g.length===1?g[0]:g:a(this,h)}return this},o.prototype.removeAllListeners=function(c){var d;return c?(d=t?t+c:c,this._events[d]&&a(this,d)):(this._events=new s,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,r.exports=o})(Va);var su=Va.exports,Er=Ll(su);class za{constructor(e,t,s,i){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=s,this.onFlush=i;const a=(c,d)=>{d=d||{},d.frag=this.frag,d.id=this.id,c===x.ERROR&&(this.error=d.error),this.hls.trigger(c,d)};this.observer=new Er,this.observer.on(x.FRAG_DECRYPTED,a),this.observer.on(x.ERROR,a);const o=ut(n.preferManagedMediaSource)||{isTypeSupported:()=>!1},l={mpeg:o.isTypeSupported("audio/mpeg"),mp3:o.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:o.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&typeof Worker<"u"&&(n.workerPath||Td())){try{n.workerPath?(O.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=bd(n.workerPath)):(O.log(`injecting Web Worker for "${t}"`),this.workerContext=Sd()),this.onwmsg=u=>this.onWorkerMessage(u);const{worker:d}=this.workerContext;d.addEventListener("message",this.onwmsg),d.onerror=u=>{const f=new Error(`${u.message} (${u.filename}:${u.lineno})`);n.enableWorker=!1,O.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(x.ERROR,{type:J.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:f})},d.postMessage({cmd:"init",typeSupported:l,vendor:"",id:t,config:JSON.stringify(n)})}catch(d){O.warn(`Error setting up "${t}" Web Worker, fallback to inline`,d),this.resetWorker(),this.error=null,this.transmuxer=new En(this.observer,l,n,"",t)}return}this.transmuxer=new En(this.observer,l,n,"",t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,s,i,n,a,o,l,c,d){var u,f;c.transmuxing.start=self.performance.now();const{transmuxer:h}=this,p=a?a.start:n.start,m=n.decryptdata,g=this.frag,y=!(g&&n.cc===g.cc),E=!(g&&c.level===g.level),v=g?c.sn-g.sn:-1,S=this.part?c.part-this.part.index:-1,T=v===0&&c.id>1&&c.id===(g==null?void 0:g.stats.chunkCount),L=!E&&(v===1||v===0&&(S===1||T&&S<=0)),b=self.performance.now();(E||v||n.stats.parsing.start===0)&&(n.stats.parsing.start=b),a&&(S||!L)&&(a.stats.parsing.start=b);const C=!(g&&((u=n.initSegment)==null?void 0:u.url)===((f=g.initSegment)==null?void 0:f.url)),A=new tu(y,L,l,E,p,C);if(!L||y||C){O.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${c.sn} p: ${c.part} level: ${c.level} id: ${c.id} 19 discontinuity: ${y} 20 trackSwitch: ${E} 21 contiguous: ${L} 22 accurateTimeOffset: ${l} 23 timeOffset: ${p} 24 initSegmentChange: ${C}`);const w=new eu(s,i,t,o,d);this.configureTransmuxer(w)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:m,chunkMeta:c,state:A},e instanceof ArrayBuffer?[e]:[]);else if(h){const w=h.push(e,m,c,A);bs(w)?(h.async=!0,w.then(I=>{this.handleTransmuxComplete(I)}).catch(I=>{this.transmuxerError(I,c,"transmuxer-interface push error")})):(h.async=!1,this.handleTransmuxComplete(w))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let s=t.flush(e);bs(s)||t.async?(bs(s)||(s=Promise.resolve(s)),s.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(s,e)}}transmuxerError(e,t,s){this.hls&&(this.error=e,this.hls.trigger(x.ERROR,{type:J.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:s}))}handleFlushResult(e,t){e.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(!(t!=null&&t.event)){O.warn(`worker message received with no ${t?"event name":"data"}`);return}const s=this.hls;if(this.hls)switch(t.event){case"init":{var i;const n=(i=this.workerContext)==null?void 0:i.objectURL;n&&self.URL.revokeObjectURL(n);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":O[t.data.logType]&&O[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,s.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function Ka(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!It(r[t].attrs,e[t].attrs))return!1;return!0}function It(r,e,t){const s=r["STABLE-RENDITION-ID"];return s&&!t?s===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>r[i]!==e[i])}function qi(r,e){return e.label.toLowerCase()===r.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(r.lang||"").toLowerCase())}const xn=100;class iu extends pr{constructor(e,t,s){super(e,t,s,"[audio-stream-controller]",X.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.LEVEL_LOADED,this.onLevelLoaded,this),e.on(x.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(x.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(x.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(x.ERROR,this.onError,this),e.on(x.BUFFER_RESET,this.onBufferReset,this),e.on(x.BUFFER_CREATED,this.onBufferCreated,this),e.on(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(x.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(x.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(x.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.LEVEL_LOADED,this.onLevelLoaded,this),e.off(x.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(x.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(x.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(x.ERROR,this.onError,this),e.off(x.BUFFER_RESET,this.onBufferReset,this),e.off(x.BUFFER_CREATED,this.onBufferCreated,this),e.off(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(x.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(x.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(x.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:s,initPTS:i,timescale:n}){if(s==="main"){const a=t.cc;this.initPTS[t.cc]={baseTime:i,timescale:n},this.log(`InitPTS for cc: ${a} found from main: ${i}`),this.videoTrackCC=a,this.state===V.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=V.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(xn),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=V.IDLE):(this.loadedmetadata=!1,this.state=V.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case V.IDLE:this.doTickIdle();break;case V.WAITING_TRACK:{var e;const{levels:s,trackId:i}=this,n=s==null||(e=s[i])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=V.WAITING_INIT_PTS}break}case V.FRAG_LOADING_WAITING_RETRY:{var t;const s=performance.now(),i=this.retryDate;if(!i||s>=i||(t=this.media)!=null&&t.seeking){const{levels:n,trackId:a}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((n==null?void 0:n[a])||null),this.state=V.IDLE}break}case V.WAITING_INIT_PTS:{const s=this.waitingData;if(s){const{frag:i,part:n,cache:a,complete:o}=s;if(this.initPTS[i.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=V.FRAG_LOADING;const l=a.flush(),c={frag:i,part:n,payload:l,networkDetails:null};this._handleFragmentLoadProgress(c),o&&super._handleFragmentLoadComplete(c)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${i.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const l=this.getLoadPosition(),c=le.bufferInfo(this.mediaBuffer,l,this.config.maxBufferHole);Yi(c.end,this.config.maxFragLookUpTolerance,i)<0&&(this.log(`Waiting fragment cc (${i.cc}) @ ${i.start} cancelled because another fragment at ${c.end} is needed`),this.clearWaitingFragment())}}else this.state=V.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=V.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:s,trackId:i}=this,n=e.config;if(!s&&(this.startFragRequested||!n.startFragPrefetch)||!(t!=null&&t[i]))return;const a=t[i],o=a.details;if(!o||o.live&&this.levelLastLoaded!==a||this.waitForCdnTuneIn(o)){this.state=V.WAITING_TRACK;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,ae.AUDIO,X.AUDIO));const c=this.getFwdBufferInfo(l,X.AUDIO);if(c===null)return;const{bufferedTrack:d,switchingTrack:u}=this;if(!u&&this._streamEnded(c,o)){e.trigger(x.BUFFER_EOS,{type:"audio"}),this.state=V.ENDED;return}const f=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,X.MAIN),h=c.len,p=this.getMaxBufferLength(f==null?void 0:f.len),m=o.fragments,g=m[0].start;let y=this.flushing?this.getLoadPosition():c.end;if(u&&s){const T=this.getLoadPosition();d&&!It(u.attrs,d.attrs)&&(y=T),o.PTSKnown&&T<g&&(c.end>g||c.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=g+.05)}if(h>=p&&!u&&y<m[m.length-1].start)return;let E=this.getNextFragment(y,o),v=!1;if(E&&this.isLoopLoading(E,y)&&(v=!!E.gap,E=this.getNextFragmentLoopLoading(E,o,c,X.MAIN,p)),!E){this.bufferFlushed=!0;return}const S=f&&E.start>f.end+o.targetduration;if(S||!(f!=null&&f.len)&&c.len){const T=this.getAppendedFrag(E.start,X.MAIN);if(T===null||(v||(v=!!T.gap||!!S&&f.len===0),S&&!v||v&&c.nextStart&&c.nextStart<T.end))return}this.loadFragment(E,a,y)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(s=>new At(s))}onAudioTrackSwitching(e,t){const s=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),s?this.setInterval(xn):this.resetTransmuxer(),s?(this.switchingTrack=t,this.state=V.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=V.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(x.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var s;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:i}=this,{details:n,id:a}=t;if(!i){this.warn(`Audio tracks were reset while loading level ${a}`);return}this.log(`Audio track ${a} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const o=i[a];let l=0;if(n.live||(s=o.details)!=null&&s.live){this.checkLiveUpdate(n);const d=this.mainDetails;if(n.deltaUpdateFailed||!d)return;if(!o.details&&n.hasProgramDateTime&&d.hasProgramDateTime)Us(n,d),l=n.fragments[0].start;else{var c;l=this.alignPlaylists(n,o.details,(c=this.levelLastLoaded)==null?void 0:c.details)}}o.details=n,this.levelLastLoaded=o,!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(this.mainDetails||n,l),this.state===V.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=V.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:s,part:i,payload:n}=e,{config:a,trackId:o,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const c=l[o];if(!c){this.warn("Audio track is undefined on fragment load progress");return}const d=c.details;if(!d){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const u=a.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let f=this.transmuxer;f||(f=this.transmuxer=new za(this.hls,X.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const h=this.initPTS[s.cc],p=(t=s.initSegment)==null?void 0:t.data;if(h!==void 0){const g=i?i.index:-1,y=g!==-1,E=new fr(s.level,s.sn,s.stats.chunkCount,n.byteLength,g,y);f.push(n,p,u,"",s,i,d.totalduration,!1,E,h)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${d.startSN} ,${d.endSN}],track ${o}`);const{cache:m}=this.waitingData=this.waitingData||{frag:s,part:i,cache:new Ra,complete:!1};m.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=V.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const s=t.tracks.audio;s&&(this.mediaBuffer=s.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:s,part:i}=t;if(s.type!==X.AUDIO){if(!this.loadedmetadata&&s.type===X.MAIN){const n=this.videoBuffer||this.media;n&&le.getBuffered(n).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${i?" p: "+i.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(s.sn!=="initSegment"){this.fragPrevious=s;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(x.AUDIO_TRACK_SWITCHED,Ee({},n)))}this.fragBufferedComplete(s,i)}onError(e,t){var s;if(t.fatal){this.state=V.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(X.AUDIO,t);break;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===V.WAITING_TRACK&&((s=t.context)==null?void 0:s.type)===ne.AUDIO_TRACK&&(this.state=V.IDLE);break;case $.BUFFER_APPEND_ERROR:case $.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===$.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==ae.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==ae.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===V.ENDED&&(this.state=V.IDLE);const s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,t,X.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const s="audio",{hls:i}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:c,level:d}=o,{details:u}=d,{audio:f,text:h,id3:p,initSegment:m}=n;if(this.fragContextChanged(l)||!u){this.fragmentTracker.removeFragment(l);return}if(this.state=V.PARSING,this.switchingTrack&&f&&this.completeAudioSwitch(this.switchingTrack),m!=null&&m.tracks){const g=l.initSegment||l;this._bufferInitSegment(d,m.tracks,g,a),i.trigger(x.FRAG_PARSING_INIT_SEGMENT,{frag:g,id:s,tracks:m.tracks})}if(f){const{startPTS:g,endPTS:y,startDTS:E,endDTS:v}=f;c&&(c.elementaryStreams[ae.AUDIO]={startPTS:g,endPTS:y,startDTS:E,endDTS:v}),l.setElementaryStreamInfo(ae.AUDIO,g,y,E,v),this.bufferFragmentData(f,l,c,a)}if(p!=null&&(t=p.samples)!=null&&t.length){const g=me({id:s,frag:l,details:u},p);i.trigger(x.FRAG_PARSING_METADATA,g)}if(h){const g=me({id:s,frag:l,details:u},h);i.trigger(x.FRAG_PARSING_USERDATA,g)}}_bufferInitSegment(e,t,s,i){if(this.state!==V.PARSING)return;t.video&&delete t.video;const n=t.audio;if(!n)return;n.id="audio";const a=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${a}/${n.codec}]`),a&&a.split(",").length===1&&(n.levelCodec=a),this.hls.trigger(x.BUFFER_CODECS,t);const o=n.initSegment;if(o!=null&&o.byteLength){const l={type:"audio",frag:s,part:null,chunkMeta:i,parent:s.type,data:o};this.hls.trigger(x.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,s){const i=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||i===ye.NOT_LOADED||i===ye.PARTIAL){var n;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=V.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragments[0].start!==t.details.fragments[0].start&&Us(t.details,a)}else this.startFragRequested=!0,super.loadFragment(e,t,s)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:s}=this,i=s==null?void 0:s.attrs,n=e.attrs;t&&i&&(i.CHANNELS!==n.CHANNELS||s.name!==e.name||s.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(x.AUDIO_TRACK_SWITCHED,Ee({},e))}}class ru extends ur{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_PARSED,this.onManifestParsed,this),e.on(x.LEVEL_LOADING,this.onLevelLoading,this),e.on(x.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(x.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(x.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_PARSED,this.onManifestParsed,this),e.off(x.LEVEL_LOADING,this.onLevelLoading,this),e.off(x.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(x.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(x.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:s,groupId:i,details:n}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==i){this.warn(`Audio track with id:${s} and group:${i} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Audio track ${s} "${a.name}" lang:${a.lang} group:${i} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.audioGroups||null,i=this.groupIds;let n=this.currentTrack;if(!s||(i==null?void 0:i.length)!==(s==null?void 0:s.length)||s!=null&&s.some(o=>(i==null?void 0:i.indexOf(o))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(f=>!s||s.indexOf(f.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(f=>f.default)&&(this.selectDefaultTrack=!1),o.forEach((f,h)=>{f.id=h});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.audioPreference;if(!n&&l){const f=Ke(l,o,mt);if(f>-1)n=o[f];else{const h=Ke(l,this.tracks);n=this.tracks[h]}}let c=this.findTrackId(n);c===-1&&n&&(c=this.findTrackId(null));const d={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${s==null?void 0:s.join(",")}`),this.hls.trigger(x.AUDIO_TRACKS_UPDATED,d);const u=this.trackId;if(c!==-1&&u===-1)this.setAudioTrack(c);else if(o.length&&u===-1){var a;const f=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${o.length}`);this.warn(f.message),this.hls.trigger(x.ERROR,{type:J.MEDIA_ERROR,details:$.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:f})}}else this.shouldReloadPlaylist(n)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===ne.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&(this.requestScheduled=-1,this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const s=this.allAudioTracks;if(this.selectDefaultTrack=!1,s.length){const i=this.currentTrack;if(i&&bt(e,i,mt))return i;const n=Ke(e,this.tracksInGroup,mt);if(n>-1){const a=this.tracksInGroup[n];return this.setAudioTrack(n),a}else if(i){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const o=rd(e,t.levels,s,a,mt);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=Ke(e,s);if(a>-1)return s[a]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const s=this.currentTrack,i=t[e],n=i.details&&!i.details.live;if(e===this.trackId&&i===s&&n||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(x.AUDIO_TRACK_SWITCHING,Ee({},i)),n))return;const a=this.switchParams(i.url,s==null?void 0:s.details,i.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const i=t[s];if(!(this.selectDefaultTrack&&!i.default)&&(!e||bt(e,i,mt)))return s}if(e){const{name:s,lang:i,assocLang:n,characteristics:a,audioCodec:o,channels:l}=e;for(let c=0;c<t.length;c++){const d=t[c];if(bt({name:s,lang:i,assocLang:n,characteristics:a,audioCodec:o,channels:l},d,mt))return c}for(let c=0;c<t.length;c++){const d=t[c];if(It(e.attrs,d.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return c}for(let c=0;c<t.length;c++){const d=t[c];if(It(e.attrs,d.attrs,["LANGUAGE"]))return c}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const s=t.id,i=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}this.log(`loading audio-track playlist ${s} "${t.name}" lang:${t.lang} group:${i}`),this.clearTimer(),this.hls.trigger(x.AUDIO_TRACK_LOADING,{url:n,id:s,groupId:i,deliveryDirectives:e||null})}}}const Tn=500;class nu extends pr{constructor(e,t,s){super(e,t,s,"[subtitle-stream-controller]",X.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.LEVEL_LOADED,this.onLevelLoaded,this),e.on(x.ERROR,this.onError,this),e.on(x.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(x.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(x.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(x.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(x.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.LEVEL_LOADED,this.onLevelLoaded,this),e.off(x.ERROR,this.onError,this),e.off(x.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(x.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(x.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(x.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(x.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=V.IDLE,this.setInterval(Tn),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:s,success:i}=t;if(this.fragPrevious=s,this.state=V.IDLE,!i)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let a;const o=s.start;for(let c=0;c<n.length;c++)if(o>=n[c].start&&o<=n[c].end){a=n[c];break}const l=s.start+s.duration;a?a.end=l:(a={start:o,end:l},n.push(a)),this.fragmentTracker.fragBuffered(s),this.fragBufferedComplete(s,null)}onBufferFlushing(e,t){const{startOffset:s,endOffset:i}=t;if(s===0&&i!==Number.POSITIVE_INFINITY){const n=i-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(a=>{for(let o=0;o<a.length;){if(a[o].end<=n){a.shift();continue}else if(a[o].start<n)a[o].start=n;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(s,n,X.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===X.MAIN){var s;(s=this.media)!=null&&s.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const s=t.frag;(s==null?void 0:s.type)===X.SUBTITLE&&(t.details===$.FRAG_GAP&&this.fragmentTracker.fragBuffered(s,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==V.STOPPED&&(this.state=V.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Ka(this.levels,t)){this.levels=t.map(s=>new At(s));return}this.tracksBuffered=[],this.levels=t.map(s=>{const i=new At(s);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,X.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var s;if(this.currentTrackId=t.id,!((s=this.levels)!=null&&s.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.setInterval(Tn)}onSubtitleTrackLoaded(e,t){var s;const{currentTrackId:i,levels:n}=this,{details:a,id:o}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const l=n[o];if(o>=n.length||!l)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(a.live||(s=l.details)!=null&&s.live){const u=this.mainDetails;if(a.deltaUpdateFailed||!u)return;const f=u.fragments[0];if(!l.details)a.hasProgramDateTime&&u.hasProgramDateTime?(Us(a,u),c=a.fragments[0].start):f&&(c=f.start,Ki(a,c));else{var d;c=this.alignPlaylists(a,l.details,(d=this.levelLastLoaded)==null?void 0:d.details),c===0&&f&&(c=f.start,Ki(a,c))}}l.details=a,this.levelLastLoaded=l,o===i&&(!this.startFragRequested&&(this.mainDetails||!a.live)&&this.setStartPosition(this.mainDetails||a,c),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===V.IDLE&&($s(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:s}=e,i=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&s&&s.byteLength>0&&i!=null&&i.key&&i.iv&&i.method==="AES-128"){const a=performance.now();this.decrypter.decrypt(new Uint8Array(s),i.key.buffer,i.iv.buffer).catch(o=>{throw n.trigger(x.ERROR,{type:J.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const l=performance.now();n.trigger(x.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:a,tdecrypt:l}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=V.IDLE})}}doTick(){if(!this.media){this.state=V.IDLE;return}if(this.state===V.IDLE){const{currentTrackId:e,levels:t}=this,s=t==null?void 0:t[e];if(!s||!t.length||!s.details)return;const{config:i}=this,n=this.getLoadPosition(),a=le.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,i.maxBufferHole),{end:o,len:l}=a,c=this.getFwdBufferInfo(this.media,X.MAIN),d=s.details,u=this.getMaxBufferLength(c==null?void 0:c.len)+d.levelTargetDuration;if(l>u)return;const f=d.fragments,h=f.length,p=d.edge;let m=null;const g=this.fragPrevious;if(o<p){const y=i.maxFragLookUpTolerance,E=o>p-y?0:y;m=$s(g,f,Math.max(f[0].start,o),E),!m&&g&&g.start<f[0].start&&(m=f[0])}else m=f[h-1];if(!m)return;if(m=this.mapToInitFragWhenRequired(m),m.sn!=="initSegment"){const y=m.sn-d.startSN,E=f[y-1];E&&E.cc===m.cc&&this.fragmentTracker.getState(E)===ye.NOT_LOADED&&(m=E)}this.fragmentTracker.getState(m)===ye.NOT_LOADED&&this.loadFragment(m,s,o)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,s){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,s))}get mediaBufferTimeRanges(){return new au(this.tracksBuffered[this.currentTrackId]||[])}}class au{constructor(e){this.buffered=void 0;const t=(s,i,n)=>{if(i=i>>>0,i>n-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${n})`);return e[i][s]};this.buffered={get length(){return e.length},end(s){return t("end",s,e.length)},start(s){return t("start",s,e.length)}}}}class ou extends ur{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const s=ys(this.media.textTracks);for(let n=0;n<s.length;n++)if(s[n].mode==="hidden")t=s[n];else if(s[n].mode==="showing"){t=s[n];break}const i=this.findTrackForTextTrack(t);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_PARSED,this.onManifestParsed,this),e.on(x.LEVEL_LOADING,this.onLevelLoading,this),e.on(x.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(x.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(x.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_PARSED,this.onManifestParsed,this),e.off(x.LEVEL_LOADING,this.onLevelLoading,this),e.off(x.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(x.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(x.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),ys(this.media.textTracks).forEach(t=>{Tt(t)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:s,groupId:i,details:n}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==i){this.warn(`Subtitle track with id:${s} and group:${i} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Subtitle track ${s} "${a.name}" lang:${a.lang} group:${i} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.subtitleGroups||null,i=this.groupIds;let n=this.currentTrack;if(!s||(i==null?void 0:i.length)!==(s==null?void 0:s.length)||s!=null&&s.some(a=>(i==null?void 0:i.indexOf(a))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(d=>!s||s.indexOf(d.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(d=>d.default)&&(this.selectDefaultTrack=!1),a.forEach((d,u)=>{d.id=u});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const o=this.hls.config.subtitlePreference;if(!n&&o){this.selectDefaultTrack=!1;const d=Ke(o,a);if(d>-1)n=a[d];else{const u=Ke(o,this.tracks);n=this.tracks[u]}}let l=this.findTrackId(n);l===-1&&n&&(l=this.findTrackId(null));const c={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${s==null?void 0:s.join(",")}" group-id`),this.hls.trigger(x.SUBTITLE_TRACKS_UPDATED,c),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}else this.shouldReloadPlaylist(n)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,s=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const n=t[i];if(!(s&&!n.default||!s&&!e)&&(!e||bt(n,e)))return i}if(e){for(let i=0;i<t.length;i++){const n=t[i];if(It(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const n=t[i];if(It(e.attrs,n.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const i=t[s];if(qi(i,e))return s}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ne.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const s=this.currentTrack;if(s&&bt(e,s))return s;const i=Ke(e,this.tracksInGroup);if(i>-1){const n=this.tracksInGroup[i];return this.setSubtitleTrack(i),n}else{if(s)return null;{const n=Ke(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const s=t.id,i=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}this.log(`Loading subtitle playlist for id ${s}`),this.hls.trigger(x.SUBTITLE_TRACK_LOADING,{url:n,id:s,groupId:i,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=ys(e.textTracks),s=this.currentTrack;let i;if(s&&(i=t.filter(n=>qi(s,n))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${s.name}" and language "${s.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==i&&(n.mode="disabled")}),i){const n=this.subtitleDisplay?"showing":"hidden";i.mode!==n&&(i.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!W(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const s=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(x.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!i.details&&!i.details.live;if(e===this.trackId&&i===s&&n)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:a,groupId:o="",name:l,type:c,url:d}=i;this.hls.trigger(x.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:l,type:c,url:d});const u=this.switchParams(i.url,s==null?void 0:s.details,i.details);this.loadPlaylist(u)}}class lu{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,s){const i=this.queues[t];i.push(e),i.length===1&&!s&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const s=new Promise(n=>{t=n}),i={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(i,e),s}executeNext(e){const t=this.queues[e];if(t.length){const s=t[0];try{s.execute()}catch(i){O.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${i}`),s.onError(i);const n=this.buffers[e];n!=null&&n.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Sn=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class cu{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=s=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:s,mediaSource:i}=this;this.log("Media source opened"),s&&(s.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(x.MEDIA_ATTACHED,{media:s,mediaSource:i})),i&&i.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:s,_objectUrl:i}=this;s!==i&&O.error(`Media element src was set while attaching MediaSource (${i} > ${s})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=yc(ut(e.config.preferManagedMediaSource)),this.log=O.log.bind(O,t),this.warn=O.warn.bind(O,t),this.error=O.error.bind(O,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_PARSED,this.onManifestParsed,this),e.on(x.BUFFER_RESET,this.onBufferReset,this),e.on(x.BUFFER_APPENDING,this.onBufferAppending,this),e.on(x.BUFFER_CODECS,this.onBufferCodecs,this),e.on(x.BUFFER_EOS,this.onBufferEos,this),e.on(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(x.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(x.FRAG_PARSED,this.onFragParsed,this),e.on(x.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_PARSED,this.onManifestParsed,this),e.off(x.BUFFER_RESET,this.onBufferReset,this),e.off(x.BUFFER_APPENDING,this.onBufferAppending,this),e.off(x.BUFFER_CODECS,this.onBufferCodecs,this),e.off(x.BUFFER_EOS,this.onBufferEos,this),e.off(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(x.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(x.FRAG_PARSED,this.onFragParsed,this),e.off(x.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new lu(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let s=2;(t.audio&&!t.video||!t.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const s=this.media=t.media,i=ut(this.appendSource);if(s&&i){var n;const a=this.mediaSource=new i;this.log(`created media source: ${(n=a.constructor)==null?void 0:n.name}`),a.addEventListener("sourceopen",this._onMediaSourceOpen),a.addEventListener("sourceended",this._onMediaSourceEnded),a.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(a.addEventListener("startstreaming",this._onStartStreaming),a.addEventListener("endstreaming",this._onEndStreaming));const o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{s.removeAttribute("src");const l=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||l&&a instanceof l,bn(s),du(s,o),s.load()}catch{s.src=o}else s.src=o;s.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:s}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(i){this.warn(`onMediaDetaching: ${i.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),s&&self.URL.revokeObjectURL(s),this.mediaSrc===s?(e.removeAttribute("src"),this.appendSource&&bn(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(x.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{if(t){var s;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(s=this.mediaSource)!=null&&s.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(i){this.warn(`onBufferReset ${e}`,i)}}onBufferCodecs(e,t){const s=this.getSourceBufferTypes().length,i=Object.keys(t);if(i.forEach(a=>{if(s){const l=this.tracks[a];if(l&&typeof l.buffer.changeType=="function"){var o;const{id:c,codec:d,levelCodec:u,container:f,metadata:h}=t[a],p=Vr(l.codec,l.levelCodec),m=p==null?void 0:p.replace(Sn,"$1");let g=Vr(d,u);const y=(o=g)==null?void 0:o.replace(Sn,"$1");if(g&&m!==y){a.slice(0,5)==="audio"&&(g=Os(g,this.appendSource));const E=`${f};codecs=${g}`;this.appendChangeType(a,E),this.log(`switching codec ${p} to ${g}`),this.tracks[a]={buffer:l.buffer,codec:d,container:f,levelCodec:u,metadata:h,id:c}}}}else this.pendingTracks[a]=t[a]}),s)return;const n=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==n&&(this.log(`${n} bufferCodec event(s) expected ${i.join(",")}`),this.bufferCodecEventsExpected=n),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:s}=this,i={execute:()=>{const n=this.sourceBuffer[e];n&&(this.log(`changing ${e} sourceBuffer type to ${t}`),n.changeType(t)),s.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{this.warn(`Failed to change ${e} SourceBuffer type`,n)}};s.append(i,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:s,operationQueue:i,tracks:n}=this,{data:a,type:o,frag:l,part:c,chunkMeta:d}=t,u=d.buffering[o],f=self.performance.now();u.start=f;const h=l.stats.buffering,p=c?c.stats.buffering:null;h.start===0&&(h.start=f),p&&p.start===0&&(p.start=f);const m=n.audio;let g=!1;o==="audio"&&(m==null?void 0:m.container)==="audio/mpeg"&&(g=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const y=l.start,E={execute:()=>{if(u.executeStart=self.performance.now(),g){const v=this.sourceBuffer[o];if(v){const S=y-v.timestampOffset;Math.abs(S)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${y} (delta: ${S}) sn: ${l.sn})`),v.timestampOffset=y)}}this.appendExecutor(a,o)},onStart:()=>{},onComplete:()=>{const v=self.performance.now();u.executeEnd=u.end=v,h.first===0&&(h.first=v),p&&p.first===0&&(p.first=v);const{sourceBuffer:S}=this,T={};for(const L in S)T[L]=le.getBuffered(S[L]);this.appendErrors[o]=0,o==="audio"||o==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(x.BUFFER_APPENDED,{type:o,frag:l,part:c,chunkMeta:d,parent:l.type,timeRanges:T})},onError:v=>{const S={type:J.MEDIA_ERROR,parent:l.type,details:$.BUFFER_APPEND_ERROR,sourceBufferName:o,frag:l,part:c,chunkMeta:d,error:v,err:v,fatal:!1};if(v.code===DOMException.QUOTA_EXCEEDED_ERR)S.details=$.BUFFER_FULL_ERROR;else{const T=++this.appendErrors[o];S.details=$.BUFFER_APPEND_ERROR,this.warn(`Failed ${T}/${s.config.appendErrorMaxRetry} times to append segment in "${o}" sourceBuffer`),T>=s.config.appendErrorMaxRetry&&(S.fatal=!0)}s.trigger(x.ERROR,S)}};i.append(E,o,!!this.pendingTracks[o])}onBufferFlushing(e,t){const{operationQueue:s}=this,i=n=>({execute:this.removeExecutor.bind(this,n,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(x.BUFFER_FLUSHED,{type:n})},onError:a=>{this.warn(`Failed to remove from ${n} SourceBuffer`,a)}});t.type?s.append(i(t.type),t.type):this.getSourceBufferTypes().forEach(n=>{s.append(i(n),n)})}onFragParsed(e,t){const{frag:s,part:i}=t,n=[],a=i?i.elementaryStreams:s.elementaryStreams;a[ae.AUDIOVIDEO]?n.push("audiovideo"):(a[ae.AUDIO]&&n.push("audio"),a[ae.VIDEO]&&n.push("video"));const o=()=>{const l=self.performance.now();s.stats.buffering.end=l,i&&(i.stats.buffering.end=l);const c=i?i.stats:s.stats;this.hls.trigger(x.FRAG_BUFFERED,{frag:s,part:i,stats:c,id:s.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(o,n)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((i,n)=>{const a=this.sourceBuffer[n];return a&&(!t.type||t.type===n)&&(a.ending=!0,a.ended||(a.ended=!0,this.log(`${n} sourceBuffer now EOS`))),i&&!!(!a||a.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(n=>{const a=this.sourceBuffer[n];a&&(a.ending=!1)});const{mediaSource:i}=this;if(!i||i.readyState!=="open"){i&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${i.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),i.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:s}=this;if(!s||t===null||!this.getSourceBufferTypes().length)return;const n=e.config,a=s.currentTime,o=t.levelTargetDuration,l=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(W(l)&&l>0){const c=Math.max(l,o),d=Math.floor(a/o)*o-c;this.flushBackBuffer(a,o,d)}if(W(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const c=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),d=Math.max(c,o),u=Math.floor(a/o)*o+d;this.flushFrontBuffer(a,o,u)}}flushBackBuffer(e,t,s){const{details:i,sourceBuffer:n}=this;this.getSourceBufferTypes().forEach(o=>{const l=n[o];if(l){const c=le.getBuffered(l);if(c.length>0&&s>c.start(0)){if(this.hls.trigger(x.BACK_BUFFER_REACHED,{bufferEnd:s}),i!=null&&i.live)this.hls.trigger(x.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(l.ended&&c.end(c.length-1)-e<t*2){this.log(`Cannot flush ${o} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(x.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:o})}}})}flushFrontBuffer(e,t,s){const{sourceBuffer:i}=this;this.getSourceBufferTypes().forEach(a=>{const o=i[a];if(o){const l=le.getBuffered(o),c=l.length;if(c<2)return;const d=l.start(c-1),u=l.end(c-1);if(s>d||e>=d&&e<=u)return;if(o.ended&&e-u<2*t){this.log(`Cannot flush ${a} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(x.BUFFER_FLUSHING,{startOffset:d,endOffset:1/0,type:a})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:s,mediaSource:i}=this,n=e.fragments[0].start+e.totalduration,a=s.duration,o=W(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(i.duration=1/0,this.updateSeekableRange(e)):(n>o&&n>a||!W(a))&&(this.log(`Updating Media Source duration to ${n.toFixed(3)}`),i.duration=n)}updateSeekableRange(e){const t=this.mediaSource,s=e.fragments;if(s.length&&e.live&&t!=null&&t.setLiveSeekableRange){const n=Math.max(0,s[0].start),a=Math.max(n,n+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${n}-${a}.`),t.setLiveSeekableRange(n,a)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:s}=this,i=Object.keys(s).length;if(i&&(!e||i===2||"audiovideo"in s)){this.createSourceBuffers(s),this.pendingTracks={};const n=this.getSourceBufferTypes();if(n.length)this.hls.trigger(x.BUFFER_CREATED,{tracks:this.tracks}),n.forEach(a=>{t.executeNext(a)});else{const a=new Error("could not create source buffer for media codec(s)");this.hls.trigger(x.ERROR,{type:J.MEDIA_ERROR,details:$.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:a,reason:a.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:s}=this;if(!s)throw Error("createSourceBuffers called when mediaSource was null");for(const n in e)if(!t[n]){var i;const a=e[n];if(!a)throw Error(`source buffer exists for track ${n}, however track does not`);let o=((i=a.levelCodec)==null?void 0:i.indexOf(","))===-1?a.levelCodec:a.codec;o&&n.slice(0,5)==="audio"&&(o=Os(o,this.appendSource));const l=`${a.container};codecs=${o}`;this.log(`creating sourceBuffer(${l})`);try{const c=t[n]=s.addSourceBuffer(l),d=n;this.addBufferListener(d,"updatestart",this._onSBUpdateStart),this.addBufferListener(d,"updateend",this._onSBUpdateEnd),this.addBufferListener(d,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(d,"bufferedchange",(u,f)=>{const h=f.removedRanges;h!=null&&h.length&&this.hls.trigger(x.BUFFER_FLUSHED,{type:n})}),this.tracks[n]={buffer:c,codec:o,container:a.container,levelCodec:a.levelCodec,metadata:a.metadata,id:a.id}}catch(c){this.error(`error while trying to add sourceBuffer: ${c.message}`),this.hls.trigger(x.ERROR,{type:J.MEDIA_ERROR,details:$.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:c,sourceBufferName:n,mimeType:l})}}}get mediaSrc(){var e,t;const s=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return s==null?void 0:s.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const{operationQueue:s}=this;s.current(e).onComplete(),s.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var s;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(s=this.mediaSource)==null?void 0:s.readyState}`);this.error(`${i}`,t),this.hls.trigger(x.ERROR,{type:J.MEDIA_ERROR,details:$.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const n=this.operationQueue.current(e);n&&n.onError(i)}removeExecutor(e,t,s){const{media:i,mediaSource:n,operationQueue:a,sourceBuffer:o}=this,l=o[e];if(!i||!n||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),a.shiftAndExecuteNext(e);return}const c=W(i.duration)?i.duration:1/0,d=W(n.duration)?n.duration:1/0,u=Math.max(0,t),f=Math.min(s,c,d);f>u&&(!l.ending||l.ended)?(l.ended=!1,this.log(`Removing [${u},${f}] from the ${e} SourceBuffer`),l.remove(u,f)):a.shiftAndExecuteNext(e)}appendExecutor(e,t){const s=this.sourceBuffer[t];if(!s){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}s.ended=!1,s.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:s}=this,i=t.map(n=>s.appendBlocker(n));Promise.all(i).then(()=>{e(),t.forEach(n=>{const a=this.sourceBuffer[n];a!=null&&a.updating||s.shiftAndExecuteNext(n)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,s){const i=this.sourceBuffer[e];if(!i)return;const n=s.bind(this,e);this.listeners[e].push({event:t,listener:n}),i.addEventListener(t,n)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(s=>{t.removeEventListener(s.event,s.listener)})}}function bn(r){const e=r.querySelectorAll("source");[].slice.call(e).forEach(t=>{r.removeChild(t)})}function du(r,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,r.appendChild(t)}const uu={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Ya=r=>String.fromCharCode(uu[r]||r),Ne=15,Xe=100,fu={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},hu={17:2,18:4,21:6,22:8,23:10,19:13,20:15},pu={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},mu={25:2,26:4,29:6,30:8,31:10,27:13,28:15},gu=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class vu{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const s=typeof t=="function"?t():t;O.log(`${this.time} [${e}] ${s}`)}}}const nt=function(e){const t=[];for(let s=0;s<e.length;s++)t.push(e[s].toString(16));return t};class Wa{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let s=0;s<t.length;s++){const i=t[s];e.hasOwnProperty(i)&&(this[i]=e[i])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class yu{constructor(){this.uchar=" ",this.penState=new Wa}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class Eu{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Wa,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Xe;t++)this.chars.push(new yu);this.logger=e}equals(e){for(let t=0;t<Xe;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Xe;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Xe;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Xe&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Xe)}moveCursor(e){const t=this.pos+e;if(e>1)for(let s=this.pos+1;s<t+1;s++)this.chars[s].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=Ya(e);if(this.pos>=Xe){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<Xe;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let s=0;s<Xe;s++){const i=this.chars[s].uchar;i!==" "&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class yi{constructor(e){this.rows=[],this.currRow=Ne-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Ne;t++)this.rows.push(new Eu(e));this.logger=e}reset(){for(let e=0;e<Ne;e++)this.rows[e].clear();this.currRow=Ne-1}equals(e){let t=!0;for(let s=0;s<Ne;s++)if(!this.rows[s].equals(e.rows[s])){t=!1;break}return t}copy(e){for(let t=0;t<Ne;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Ne;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<Ne;o++)this.rows[o].clear();const n=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const o=a.rows[n].cueStartTime,l=this.logger.time;if(o!==null&&l!==null&&o<l)for(let c=0;c<this.nrRollUpRows;c++)this.rows[t-this.nrRollUpRows+c+1].copy(a.rows[n+c])}}this.currRow=t;const s=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,a=Math.max(n-1,0);s.setCursor(e.indent),e.color=s.chars[a].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let s="",i=-1;for(let n=0;n<Ne;n++){const a=this.rows[n].getTextString();a&&(i=n+1,e?t.push("Row "+i+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(e?s="["+t.join(" | ")+"]":s=t.join(` 25`)),s}getTextAndFormat(){return this.rows}}class wn{constructor(e,t,s){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new yi(s),this.nonDisplayedMemory=new yi(s),this.lastOutputScreen=new yi(s),this.currRollUpRow=this.displayedMemory.rows[Ne-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Ne-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let s=0;s<e.length;s++)this.writeScreen.insertChar(e[s]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const s=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[s]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Ln{constructor(e,t,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Tu(),this.logger=void 0;const i=this.logger=new vu;this.channels=[null,new wn(e,t,i),new wn(e+1,s,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let s=0;s<t.length;s+=2){const i=t[s]&127,n=t[s+1]&127;let a=!1,o=null;if(i===0&&n===0)continue;this.logger.log(3,()=>"["+nt([t[s],t[s+1]])+"] -> ("+nt([i,n])+")");const l=this.cmdHistory;if(i>=16&&i<=31){if(xu(i,n,l)){us(null,null,l),this.logger.log(3,()=>"Repeated command ("+nt([i,n])+") is dropped");continue}us(i,n,this.cmdHistory),a=this.parseCmd(i,n),a||(a=this.parseMidrow(i,n)),a||(a=this.parsePAC(i,n)),a||(a=this.parseBackgroundAttributes(i,n))}else us(null,null,l);if(!a&&(o=this.parseChars(i,n),o)){const d=this.currentChannel;d&&d>0?this.channels[d].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+nt([i,n])+" orig: "+nt([t[s],t[s+1]]))}}parseCmd(e,t){const s=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(s||i))return!1;const n=e===20||e===21||e===23?1:2,a=this.channels[n];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),this.currentChannel=n,!0}parseMidrow(e,t){let s=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?s=1:s=2,s!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[s];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+nt([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let s;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,n=(e===16||e===24)&&t>=64&&t<=95;if(!(i||n))return!1;const a=e<=23?1:2;t>=64&&t<=95?s=a===1?fu[e]:pu[e]:s=a===1?hu[e]:mu[e];const o=this.channels[a];return o?(o.setPAC(this.interpretPAC(s,t)),this.currentChannel=a,!0):!1}interpretPAC(e,t){let s;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?s=t-96:s=t-64,i.underline=(s&1)===1,s<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((s-16)/2)*4,i}parseChars(e,t){let s,i=null,n=null;if(e>=25?(s=2,n=e-8):(s=1,n=e),n>=17&&n<=19){let a;n===17?a=t+80:n===18?a=t+112:a=t+144,this.logger.log(2,()=>"Special char '"+Ya(a)+"' in channel "+s),i=[a]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+nt(i).join(",")),i}parseBackgroundAttributes(e,t){const s=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(s||i))return!1;let n;const a={};e===16||e===24?(n=Math.floor((t-32)/2),a.background=gu[n],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(a),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}us(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const s=this.channels[t];s&&s.cueSplitAtTime(e)}}}function us(r,e,t){t.a=r,t.b=e}function xu(r,e,t){return t.a===r&&t.b===e}function Tu(){return{a:null,b:null}}class fs{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,s){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var xr=function(){if(Lt!=null&&Lt.VTTCue)return self.VTTCue;const r=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,l){if(typeof l!="string"||!Array.isArray(o))return!1;const c=l.toLowerCase();return~o.indexOf(c)?c:!1}function s(o){return t(r,o)}function i(o){return t(e,o)}function n(o,...l){let c=1;for(;c<arguments.length;c++){const d=arguments[c];for(const u in d)o[u]=d[u]}return o}function a(o,l,c){const d=this,u={enumerable:!0};d.hasBeenReset=!1;let f="",h=!1,p=o,m=l,g=c,y=null,E="",v=!0,S="auto",T="start",L=50,b="middle",C=50,A="middle";Object.defineProperty(d,"id",n({},u,{get:function(){return f},set:function(w){f=""+w}})),Object.defineProperty(d,"pauseOnExit",n({},u,{get:function(){return h},set:function(w){h=!!w}})),Object.defineProperty(d,"startTime",n({},u,{get:function(){return p},set:function(w){if(typeof w!="number")throw new TypeError("Start time must be set to a number.");p=w,this.hasBeenReset=!0}})),Object.defineProperty(d,"endTime",n({},u,{get:function(){return m},set:function(w){if(typeof w!="number")throw new TypeError("End time must be set to a number.");m=w,this.hasBeenReset=!0}})),Object.defineProperty(d,"text",n({},u,{get:function(){return g},set:function(w){g=""+w,this.hasBeenReset=!0}})),Object.defineProperty(d,"region",n({},u,{get:function(){return y},set:function(w){y=w,this.hasBeenReset=!0}})),Object.defineProperty(d,"vertical",n({},u,{get:function(){return E},set:function(w){const I=s(w);if(I===!1)throw new SyntaxError("An invalid or illegal string was specified.");E=I,this.hasBeenReset=!0}})),Object.defineProperty(d,"snapToLines",n({},u,{get:function(){return v},set:function(w){v=!!w,this.hasBeenReset=!0}})),Object.defineProperty(d,"line",n({},u,{get:function(){return S},set:function(w){if(typeof w!="number"&&w!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");S=w,this.hasBeenReset=!0}})),Object.defineProperty(d,"lineAlign",n({},u,{get:function(){return T},set:function(w){const I=i(w);if(!I)throw new SyntaxError("An invalid or illegal string was specified.");T=I,this.hasBeenReset=!0}})),Object.defineProperty(d,"position",n({},u,{get:function(){return L},set:function(w){if(w<0||w>100)throw new Error("Position must be between 0 and 100.");L=w,this.hasBeenReset=!0}})),Object.defineProperty(d,"positionAlign",n({},u,{get:function(){return b},set:function(w){const I=i(w);if(!I)throw new SyntaxError("An invalid or illegal string was specified.");b=I,this.hasBeenReset=!0}})),Object.defineProperty(d,"size",n({},u,{get:function(){return C},set:function(w){if(w<0||w>100)throw new Error("Size must be between 0 and 100.");C=w,this.hasBeenReset=!0}})),Object.defineProperty(d,"align",n({},u,{get:function(){return A},set:function(w){const I=i(w);if(!I)throw new SyntaxError("An invalid or illegal string was specified.");A=I,this.hasBeenReset=!0}})),d.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class Su{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function qa(r){function e(s,i,n,a){return(s|0)*3600+(i|0)*60+(n|0)+parseFloat(a||0)}const t=r.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class bu{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,s){return s?this.has(e)?this.values[e]:t[s]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,s){for(let i=0;i<s.length;++i)if(t===s[i]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const s=parseFloat(t);if(s>=0&&s<=100)return this.set(e,s),!0}return!1}}function ja(r,e,t,s){const i=s?r.split(s):[r];for(const n in i){if(typeof i[n]!="string")continue;const a=i[n].split(t);if(a.length!==2)continue;const o=a[0],l=a[1];e(o,l)}}const ji=new xr(0,0,""),hs=ji.align==="middle"?"middle":"center";function wu(r,e,t){const s=r;function i(){const o=qa(r);if(o===null)throw new Error("Malformed timestamp: "+s);return r=r.replace(/^[^\sa-zA-Z-]+/,""),o}function n(o,l){const c=new bu;ja(o,function(f,h){let p;switch(f){case"region":for(let m=t.length-1;m>=0;m--)if(t[m].id===h){c.set(f,t[m].region);break}break;case"vertical":c.alt(f,h,["rl","lr"]);break;case"line":p=h.split(","),c.integer(f,p[0]),c.percent(f,p[0])&&c.set("snapToLines",!1),c.alt(f,p[0],["auto"]),p.length===2&&c.alt("lineAlign",p[1],["start",hs,"end"]);break;case"position":p=h.split(","),c.percent(f,p[0]),p.length===2&&c.alt("positionAlign",p[1],["start",hs,"end","line-left","line-right","auto"]);break;case"size":c.percent(f,h);break;case"align":c.alt(f,h,["start",hs,"end","left","right"]);break}},/:/,/\s/),l.region=c.get("region",null),l.vertical=c.get("vertical","");let d=c.get("line","auto");d==="auto"&&ji.line===-1&&(d=-1),l.line=d,l.lineAlign=c.get("lineAlign","start"),l.snapToLines=c.get("snapToLines",!0),l.size=c.get("size",100),l.align=c.get("align",hs);let u=c.get("position","auto");u==="auto"&&ji.position===50&&(u=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=u}function a(){r=r.replace(/^\s+/,"")}if(a(),e.startTime=i(),a(),r.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);r=r.slice(3),a(),e.endTime=i(),a(),n(r,e)}function Xa(r){return r.replace(/<br(?: \/)?>/gi,` 26`)}class Lu{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Su,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function s(){let n=t.buffer,a=0;for(n=Xa(n);a<n.length&&n[a]!=="\r"&&n[a]!==` 27`;)++a;const o=n.slice(0,a);return n[a]==="\r"&&++a,n[a]===` 28`&&++a,t.buffer=n.slice(a),o}function i(n){ja(n,function(a,o){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=s();const o=n.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let a=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:n=s(),t.state){case"HEADER":/:/.test(n)?i(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new xr(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{wu(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=n.indexOf("-->")!==-1;if(!n||o&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=` 29`),t.cue.text+=n}continue;case"BADCUE":n||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=` 30 31`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const Au=/\r\n|\n\r|\n|\r/g,Ei=function(e,t,s=0){return e.slice(s,s+t.length)===t},Iu=function(e){let t=parseInt(e.slice(-3));const s=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!W(t)||!W(s)||!W(i)||!W(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*s,t+=60*1e3*i,t+=60*60*1e3*n,t},xi=function(e){let t=5381,s=e.length;for(;s;)t=t*33^e.charCodeAt(--s);return(t>>>0).toString()};function Tr(r,e,t){return xi(r.toString())+xi(e.toString())+xi(t)}const Ru=function(e,t,s){let i=e[t],n=e[i.prevCC];if(!n||!n.new&&i.new){e.ccOffset=e.presentationOffset=i.start,i.new=!1;return}for(;(a=n)!=null&&a.new;){var a;e.ccOffset+=i.start-n.start,i.new=!1,i=n,n=e[i.prevCC]}e.presentationOffset=s};function Cu(r,e,t,s,i,n,a){const o=new Lu,l=Ye(new Uint8Array(r)).trim().replace(Au,` 32`).split(` 33`),c=[],d=e?Yd(e.baseTime,e.timescale):0;let u="00:00.000",f=0,h=0,p,m=!0;o.oncue=function(g){const y=t[s];let E=t.ccOffset;const v=(f-d)/9e4;if(y!=null&&y.new&&(h!==void 0?E=t.ccOffset=y.start:Ru(t,s,v)),v){if(!e){p=new Error("Missing initPTS for VTT MPEGTS");return}E=v-t.presentationOffset}const S=g.endTime-g.startTime,T=ke((g.startTime+E-h)*9e4,i*9e4)/9e4;g.startTime=Math.max(T,0),g.endTime=Math.max(T+S,0);const L=g.text.trim();g.text=decodeURIComponent(encodeURIComponent(L)),g.id||(g.id=Tr(g.startTime,g.endTime,L)),g.endTime>0&&c.push(g)},o.onparsingerror=function(g){p=g},o.onflush=function(){if(p){a(p);return}n(c)},l.forEach(g=>{if(m)if(Ei(g,"X-TIMESTAMP-MAP=")){m=!1,g.slice(16).split(",").forEach(y=>{Ei(y,"LOCAL:")?u=y.slice(6):Ei(y,"MPEGTS:")&&(f=parseInt(y.slice(7)))});try{h=Iu(u)/1e3}catch(y){p=y}return}else g===""&&(m=!1);o.parse(g+` 34`)}),o.flush()}const Ti="stpp.ttml.im1t",Qa=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Za=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Du={left:"start",center:"center",right:"end",start:"start",end:"end"};function An(r,e,t,s){const i=te(new Uint8Array(r),["mdat"]);if(i.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const n=i.map(o=>Ye(o)),a=Kd(e.baseTime,1,e.timescale);try{n.forEach(o=>t(_u(o,a)))}catch(o){s(o)}}function _u(r,e){const i=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(n).reduce((u,f)=>(u[f]=i.getAttribute(`ttp:${f}`)||n[f],u),{}),o=i.getAttribute("xml:space")!=="preserve",l=In(Si(i,"styling","style")),c=In(Si(i,"layout","region")),d=Si(i,"body","[begin]");return[].map.call(d,u=>{const f=Ja(u,o);if(!f||!u.hasAttribute("begin"))return null;const h=wi(u.getAttribute("begin"),a),p=wi(u.getAttribute("dur"),a);let m=wi(u.getAttribute("end"),a);if(h===null)throw Rn(u);if(m===null){if(p===null)throw Rn(u);m=h+p}const g=new xr(h-e,m-e,f);g.id=Tr(g.startTime,g.endTime,g.text);const y=c[u.getAttribute("region")],E=l[u.getAttribute("style")],v=Pu(y,E,l),{textAlign:S}=v;if(S){const T=Du[S];T&&(g.lineAlign=T),g.align=S}return me(g,v),g}).filter(u=>u!==null)}function Si(r,e,t){const s=r.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(t)):[]}function In(r){return r.reduce((e,t)=>{const s=t.getAttribute("xml:id");return s&&(e[s]=t),e},{})}function Ja(r,e){return[].slice.call(r.childNodes).reduce((t,s,i)=>{var n;return s.nodeName==="br"&&i?t+` 35`:(n=s.childNodes)!=null&&n.length?Ja(s,e):e?t+s.textContent.trim().replace(/\s+/g," "):t+s.textContent},"")}function Pu(r,e,t){const s="http://www.w3.org/ns/ttml#styling";let i=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=r!=null&&r.hasAttribute("style")?r.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(i=t[a]),n.reduce((o,l)=>{const c=bi(e,s,l)||bi(r,s,l)||bi(i,s,l);return c&&(o[l]=c),o},{})}function bi(r,e,t){return r&&r.hasAttributeNS(e,t)?r.getAttributeNS(e,t):null}function Rn(r){return new Error(`Could not parse ttml timestamp ${r}`)}function wi(r,e){if(!r)return null;let t=qa(r);return t===null&&(Qa.test(r)?t=ku(r,e):Za.test(r)&&(t=Mu(r,e))),t}function ku(r,e){const t=Qa.exec(r),s=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+s/e.frameRate}function Mu(r,e){const t=Za.exec(r),s=Number(t[1]);switch(t[2]){case"h":return s*3600;case"m":return s*60;case"ms":return s*1e3;case"f":return s/e.frameRate;case"t":return s/e.tickRate}return s}class Ou{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Dn(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(x.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(x.FRAG_LOADING,this.onFragLoading,this),e.on(x.FRAG_LOADED,this.onFragLoaded,this),e.on(x.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(x.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(x.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(x.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(x.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(x.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(x.FRAG_LOADING,this.onFragLoading,this),e.off(x.FRAG_LOADED,this.onFragLoaded,this),e.off(x.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(x.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(x.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(x.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(x.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new fs(this,"textTrack1"),t=new fs(this,"textTrack2"),s=new fs(this,"textTrack3"),i=new fs(this,"textTrack4");this.cea608Parser1=new Ln(1,e,t),this.cea608Parser2=new Ln(3,s,i)}}addCues(e,t,s,i,n){let a=!1;for(let o=n.length;o--;){const l=n[o],c=Fu(l[0],l[1],t,s);if(c>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],s),a=!0,c/(s-t)>.5))return}if(a||n.push([t,s]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,s,i)}else{const o=this.Cues.newCue(null,t,s,i);this.hls.trigger(x.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:s,initPTS:i,timescale:n}){const{unparsedVttFrags:a}=this;s==="main"&&(this.initPTS[t.cc]={baseTime:i,timescale:n}),a.length&&(this.unparsedVttFrags=[],a.forEach(o=>{this.onFragLoaded(x.FRAG_LOADED,o)}))}getExistingTrack(e,t){const{media:s}=this;if(s)for(let i=0;i<s.textTracks.length;i++){const n=s.textTracks[i];if(Cn(n,{name:e,lang:t,attrs:{}}))return n}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:s,media:i}=this,{label:n,languageCode:a}=t[e],o=this.getExistingTrack(n,a);if(o)s[e]=o,Tt(s[e]),Ea(s[e],i);else{const l=this.createTextTrack("captions",n,a);l&&(l[e]=!0,s[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const s=t.label,i={_id:e,label:s,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(x.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,s){const i=this.media;if(i)return i.addTextTrack(e,t,s)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{Tt(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Dn(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let s=0;s<t.length;s++)Tt(t[s])}onSubtitleTracksUpdated(e,t){const s=t.subtitleTracks||[],i=s.some(n=>n.textCodec===Ti);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(Ka(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const a=this.media,o=a?ys(a.textTracks):null;if(this.tracks.forEach((l,c)=>{let d;if(o){let u=null;for(let f=0;f<o.length;f++)if(o[f]&&Cn(o[f],l)){u=o[f],o[f]=null;break}u&&(d=u)}if(d)Tt(d);else{const u=eo(l);d=this.createTextTrack(u,l.name,l.lang),d&&(d.mode="disabled")}d&&this.textTracks.push(d)}),o!=null&&o.length){const l=o.filter(c=>c!==null).map(c=>c.label);l.length&&O.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const a=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(x.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(s=>{const i=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!i)return;const n=`textTrack${i[1]}`,a=this.captionsProperties[n];a&&(a.label=s.name,s.lang&&(a.languageCode=s.lang),a.media=s)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===X.MAIN){var s,i;const{cea608Parser1:n,cea608Parser2:a,lastSn:o}=this,{cc:l,sn:c}=t.frag,d=(s=(i=t.part)==null?void 0:i.index)!=null?s:-1;n&&a&&(c!==o+1||c===o&&d!==this.lastPartIndex+1||l!==this.lastCc)&&(n.reset(),a.reset()),this.lastCc=l,this.lastSn=c,this.lastPartIndex=d}}onFragLoaded(e,t){const{frag:s,payload:i}=t;if(s.type===X.SUBTITLE)if(i.byteLength){const n=s.decryptdata,a="stats"in t;if(n==null||!n.encrypted||a){const o=this.tracks[s.level],l=this.vttCCs;l[s.cc]||(l[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),o&&o.textCodec===Ti?this._parseIMSC1(s,i):this._parseVTTs(t)}}else this.hls.trigger(x.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const s=this.hls;An(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),s.trigger(x.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{O.log(`Failed to parse IMSC1: ${i}`),s.trigger(x.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;const{frag:s,payload:i}=e,{initPTS:n,unparsedVttFrags:a}=this,o=n.length-1;if(!n[s.cc]&&o===-1){a.push(e);return}const l=this.hls,c=(t=s.initSegment)!=null&&t.data?Oe(s.initSegment.data,new Uint8Array(i)):i;Cu(c,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,d=>{this._appendCues(d,s.level),l.trigger(x.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},d=>{const u=d.message==="Missing initPTS for VTT MPEGTS";u?a.push(e):this._fallbackToIMSC1(s,i),O.log(`Failed to parse VTT cue: ${d}`),!(u&&o>s.cc)&&l.trigger(x.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:d})})}_fallbackToIMSC1(e,t){const s=this.tracks[e.level];s.textCodec||An(t,this.initPTS[e.cc],()=>{s.textCodec=Ti,this._parseIMSC1(e,t)},()=>{s.textCodec="wvtt"})}_appendCues(e,t){const s=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(n=>xa(i,n))}else{const i=this.tracks[t];if(!i)return;const n=i.default?"default":"subtitles"+t;s.trigger(x.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:s}=t;s.type===X.SUBTITLE&&this.onFragLoaded(x.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:s,cea608Parser2:i}=this;if(!this.enabled||!s||!i)return;const{frag:n,samples:a}=t;if(!(n.type===X.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let o=0;o<a.length;o++){const l=a[o].bytes;if(l){const c=this.extractCea608Data(l);s.addData(a[o].pts,c[0]),i.addData(a[o].pts,c[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:s,endOffsetSubtitles:i,type:n}){const{media:a}=this;if(!(!a||a.currentTime<s)){if(!n||n==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(l=>Hi(o[l],t,s))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(l=>Hi(o[l],t,i))}}}extractCea608Data(e){const t=[[],[]],s=e[0]&31;let i=2;for(let n=0;n<s;n++){const a=e[i++],o=127&e[i++],l=127&e[i++];if(o===0&&l===0)continue;if((4&a)!==0){const d=3&a;(d===0||d===1)&&(t[d].push(o),t[d].push(l))}}return t}}function eo(r){return r.characteristics&&/transcribes-spoken-dialog/gi.test(r.characteristics)&&/describes-music-and-sound/gi.test(r.characteristics)?"captions":"subtitles"}function Cn(r,e){return!!r&&r.kind===eo(e)&&qi(e,r)}function Fu(r,e,t,s){return Math.min(e,s)-Math.max(r,t)}function Dn(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class Sr{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(x.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(x.MANIFEST_PARSED,this.onManifestParsed,this),e.on(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(x.BUFFER_CODECS,this.onBufferCodecs,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(x.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(x.MANIFEST_PARSED,this.onManifestParsed,this),e.off(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(x.BUFFER_CODECS,this.onBufferCodecs,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const s=this.hls.levels[t.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const s=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,s.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&W(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,s=this.getMaxLevel(e.length-1);s!==this.autoLevelCapping&&O.log(`Setting autoLevelCapping to ${s}: ${e[s].height}p@${e[s].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=s,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const s=t.filter((i,n)=>this.isLevelAllowed(i)&&n<=e);return this.clientRect=null,Sr.getMaxLevelByMediaSize(s,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const s=e.getBoundingClientRect();t.width=s.width,t.height=s.height,!t.width&&!t.height&&(t.width=s.right-s.left||e.width||0,t.height=s.bottom-s.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}isLevelAllowed(e){return!this.restrictedLevels.some(s=>e.bitrate===s.bitrate&&e.width===s.width&&e.height===s.height)}static getMaxLevelByMediaSize(e,t,s){if(!(e!=null&&e.length))return-1;const i=(o,l)=>l?o.width!==l.width||o.height!==l.height:!0;let n=e.length-1;const a=Math.max(t,s);for(let o=0;o<e.length;o+=1){const l=e[o];if((l.width>=a||l.height>=a)&&i(l,e[o+1])){n=o;break}}return n}}class Nu{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(x.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(x.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const s=this.hls.config;if(s.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,s){const i=performance.now();if(t){if(this.lastTime){const n=i-this.lastTime,a=s-this.lastDroppedFrames,o=t-this.lastDecodedFrames,l=1e3*a/n,c=this.hls;if(c.trigger(x.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:s}),l>0&&a>c.config.fpsDroppedMonitoringThreshold*o){let d=c.currentLevel;O.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=d)&&(d=d-1,c.trigger(x.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:c.currentLevel}),c.autoLevelCapping=d,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=s,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}const ps="[eme]";class wt{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=wt.CDMCleanupPromise?[wt.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=O.debug.bind(O,ps),this.log=O.log.bind(O,ps),this.warn=O.warn.bind(O,ps),this.error=O.error.bind(O,ps),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(x.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(x.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(x.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(x.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(x.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(x.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:s}=this.config,i=t[e];if(i)return i.licenseUrl;if(e===ce.WIDEVINE&&s)return s;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,s=t[e];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,s=(a,o,l)=>!!a&&l.indexOf(a)===o,i=t.map(a=>a.audioCodec).filter(s),n=t.map(a=>a.videoCodec).filter(s);return i.length+n.length===0&&n.push("avc1.42e01e"),new Promise((a,o)=>{const l=c=>{const d=c.shift();this.getMediaKeysPromise(d,i,n).then(u=>a({keySystem:d,mediaKeys:u})).catch(u=>{c.length?l(c):u instanceof Pe?o(u):o(new Pe({type:J.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_ACCESS,error:u,fatal:!0},u.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:s}=this.config;if(typeof s!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${s}`;return aa===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return s(e,t)}getMediaKeysPromise(e,t,s){const i=Vl(e,t,s,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e];let a=n==null?void 0:n.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(i)}`),a=this.requestMediaKeySystemAccess(e,i);const o=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch(l=>{this.log(`Failed to obtain access to key-system "${e}": ${l}`)}),a.then(l=>{this.log(`Access for key-system "${l.keySystem}" obtained`);const c=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),o.mediaKeys=l.createMediaKeys().then(d=>(this.log(`Media-keys created for "${e}"`),c.then(u=>u?this.setMediaKeysServerCertificate(d,e,u):d))),o.mediaKeys.catch(d=>{this.error(`Failed to create media-keys for "${e}"}: ${d}`)}),o.mediaKeys})}return a.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:s}){this.log(`Creating key-system session "${t}" keyId: ${He.hexDump(e.keyId||[])}`);const i=s.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:s,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const s=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(s,n,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return He.hexDump(e.keyId)}updateKeySession(e,t){var s;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${He.hexDump(((s=e.decryptdata)==null?void 0:s.keyId)||[])} 36 } (data length: ${t&&t.byteLength})`),i.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,s)=>{const i=ai(this.config),n=e.map(Or).filter(a=>!!a&&i.indexOf(a)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:a})=>{const o=Nr(a);o?t(o):s(new Error(`Unable to find format for key-system "${a}"`))}).catch(s)})}loadKey(e){const t=e.keyInfo.decryptdata,s=this.getKeyIdString(t),i=`(keyId: ${s} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);let n=this.keyIdToKeySessionPromise[s];return n||(n=this.keyIdToKeySessionPromise[s]=this.getKeySystemForKeyPromise(t).then(({keySystem:a,mediaKeys:o})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${i}`),this.attemptSetMediaKeys(a,o).then(()=>{this.throwIfDestroyed();const l=this.createMediaKeySessionContext({keySystem:a,mediaKeys:o,decryptdata:t});return this.generateRequestWithPreferredKeySession(l,"cenc",t.pssh,"playlist-key")}))),n.catch(a=>this.handleError(a))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Pe?this.hls.trigger(x.ERROR,e.data):this.hls.trigger(x.ERROR,{type:J.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}
36getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),s=this.keyIdToKeySessionPromise[t];if(!s){const i=Or(e.keyFormat),n=i?[i]:ai(this.config);return this.attemptKeySystemAccess(n)}return s}getKeySystemSelectionPromise(e){if(e.length||(e=ai(this.config)),e.length===0)throw new Pe({type:J.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:s}=e,i=`"${e.type}" event: init data type: "${t}"`;if(this.debug(i),s===null)return;let n,a;if(t==="sinf"&&this.config.drmSystems[ce.FAIRPLAY]){const u=ge(new Uint8Array(s));try{const f=or(JSON.parse(u).sinf),h=pa(new Uint8Array(f));if(!h)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");n=h.subarray(8,24),a=ce.FAIRPLAY}catch(f){this.warn(`${i} Failed to parse sinf: ${f}`);return}}else{const u=pc(s),f=u.filter(h=>h.systemId===Bt.WIDEVINE)[0];if(!f){u.length===0||u.some(h=>!h.systemId)?this.warn(`${i} contains incomplete or invalid pssh data`):this.log(`ignoring ${i} for ${u.map(h=>Fr(h.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(a=Fr(f.systemId),f.version===0&&f.data){const h=f.data.length-22;n=f.data.subarray(h,h+16)}}if(!a||!n)return;const o=He.hexDump(n),{keyIdToKeySessionPromise:l,mediaKeySessions:c}=this;let d=l[o];for(let u=0;u<c.length;u++){const f=c[u],h=f.decryptdata;if(!h.keyId)continue;const p=He.hexDump(h.keyId);if(o===p||h.uri.replace(/-/g,"").indexOf(o)!==-1){if(d=l[p],h.pssh)break;delete l[p],h.pssh=new Uint8Array(s),h.keyId=n,d=l[o]=d.then(()=>this.generateRequestWithPreferredKeySession(f,t,s,"encrypted-event-key-match"));break}}d||(d=l[o]=this.getKeySystemSelectionPromise([a]).then(({keySystem:u,mediaKeys:f})=>{var h;this.throwIfDestroyed();const p=new qt("ISO-23001-7",o,(h=Nr(u))!=null?h:"");return p.pssh=new Uint8Array(s),p.keyId=n,this.attemptSetMediaKeys(u,f).then(()=>{this.throwIfDestroyed();const m=this.createMediaKeySessionContext({decryptdata:p,keySystem:u,mediaKeys:f});return this.generateRequestWithPreferredKeySession(m,t,s,"encrypted-event-no-match")})})),d.catch(u=>this.handleError(u))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(s).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),s.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>s.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,s,i){var n,a;const o=(n=this.config.drmSystems)==null||(a=n[e.keySystem])==null?void 0:a.generateRequest;if(o)try{const p=o.call(this.hls,t,s,e);if(!p)throw new Error("Invalid response from configured generateRequest filter");t=p.initDataType,s=e.decryptdata.pssh=p.initData?new Uint8Array(p.initData):null}catch(p){var l;if(this.warn(p.message),(l=this.hls)!=null&&l.config.debug)throw p}if(s===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const c=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${c} (init data type: ${t} length: ${s?s.byteLength:null})`);const d=new Er,u=e._onmessage=p=>{const m=e.mediaKeysSession;if(!m){d.emit("error",new Error("invalid state"));return}const{messageType:g,message:y}=p;this.log(`"${g}" message event for session "${m.sessionId}" message size: ${y.byteLength}`),g==="license-request"||g==="license-renewal"?this.renewLicense(e,y).catch(E=>{this.handleError(E),d.emit("error",E)}):g==="license-release"?e.keySystem===ce.FAIRPLAY&&(this.updateKeySession(e,Ui("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${g}"`)},f=e._onkeystatuseschange=p=>{if(!e.mediaKeysSession){d.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const g=e.keyStatus;d.emit("keyStatus",g),g==="expired"&&(this.warn(`${e.keySystem} expired for key ${c}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",u),e.mediaKeysSession.addEventListener("keystatuseschange",f);const h=new Promise((p,m)=>{d.on("error",m),d.on("keyStatus",g=>{g.startsWith("usable")?p():g==="output-restricted"?m(new Pe({type:J.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):g==="internal-error"?m(new Pe({type:J.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${g}"`)):g==="expired"?m(new Error("key expired while generating request")):this.warn(`unhandled key status change "${g}"`)})});return e.mediaKeysSession.generateRequest(t,s).then(()=>{var p;this.log(`Request generated for key-session "${(p=e.mediaKeysSession)==null?void 0:p.sessionId}" keyId: ${c}`)}).catch(p=>{throw new Pe({type:J.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_SESSION,error:p,fatal:!1},`Error generating key-session request: ${p}`)}).then(()=>h).catch(p=>{throw d.removeAllListeners(),this.removeSession(e),p}).then(()=>(d.removeAllListeners(),e))}
vendor: 4,987 bytes, line 36
36onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,s)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${He.hexDump("buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s))} session keyId: ${He.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,s=t.loader,i=new s(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{const l={responseType:"arraybuffer",url:n},c=t.certLoadPolicy.default,d={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(f,h,p,m)=>{a(f.data)},onError:(f,h,p,m)=>{o(new Pe({type:J.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:Ee({url:l.url,data:void 0},f)},`"${e}" certificate request failed (${n}). Status: ${f.code} (${f.text})`))},onTimeout:(f,h,p)=>{o(new Pe({type:J.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(f,h,p)=>{o(new Error("aborted"))}};i.load(l,d,u)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,s){return new Promise((i,n)=>{e.setServerCertificate(s).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${s==null?void 0:s.byteLength}) on "${t}"`),i(e)}).catch(a=>{n(new Pe({type:J.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(s=>this.updateKeySession(e,new Uint8Array(s)).catch(i=>{throw new Pe({type:J.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:i,fatal:!0},i.message)}))}unpackPlayReadyKeyMessage(e,t){const s=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!s.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(s,"application/xml"),n=i.querySelectorAll("HttpHeader");if(n.length>0){let d;for(let u=0,f=n.length;u<f;u++){var a,o;d=n[u];const h=(a=d.querySelector("name"))==null?void 0:a.textContent,p=(o=d.querySelector("value"))==null?void 0:o.textContent;h&&p&&e.setRequestHeader(h,p)}}const l=i.querySelector("Challenge"),c=l==null?void 0:l.textContent;if(!c)throw new Error("Cannot find <Challenge> in key message");return Ui(atob(c))}setupLicenseXHR(e,t,s,i){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,s,i)}).catch(a=>{if(!s.decryptdata)throw a;return e.open("POST",t,!0),n.call(this.hls,e,t,s,i)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const s=this.config.keyLoadPolicy.default;return new Promise((i,n)=>{const a=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${a}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let l=o.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const c=this.config.licenseResponseCallback;if(c)try{l=c.call(this.hls,o,a,e)}catch(d){this.error(d)}i(l)}else{const l=s.errorRetry,c=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||o.status>=400&&o.status<500)n(new Pe({type:J.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{const d=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${d} attempts left`),this.requestLicense(e,t).then(i,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:l,licenseChallenge:c})=>{e.keySystem==ce.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(l,c)),l.send(c)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const s=t.media;this.media=s,s.addEventListener("encrypted",this.onMediaEncrypted),s.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},qt.clearKeyUriToKeyIdMap();const s=t.length;wt.CDMCleanupPromise=Promise.all(t.map(i=>this.removeSession(i)).concat(e==null?void 0:e.setMediaKeys(null).cat
vendor: 7,755 bytes, line 36
36ch(i=>{this.log(`Could not clear media keys: ${i}`)}))).then(()=>{s&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(i=>{this.log(`Could not close sessions and clear media keys: ${i}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=t.reduce((i,n)=>(i.indexOf(n.keyFormat)===-1&&i.push(n.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:s}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);return i>-1&&this.mediaKeySessions.splice(i,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}}wt.CDMCleanupPromise=void 0;class Pe extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var be;(function(r){r.MANIFEST="m",r.AUDIO="a",r.VIDEO="v",r.MUXED="av",r.INIT="i",r.CAPTION="c",r.TIMED_TEXT="tt",r.KEY="k",r.OTHER="o"})(be||(be={}));var Xi;(function(r){r.DASH="d",r.HLS="h",r.SMOOTH="s",r.OTHER="o"})(Xi||(Xi={}));var ot;(function(r){r.OBJECT="CMCD-Object",r.REQUEST="CMCD-Request",r.SESSION="CMCD-Session",r.STATUS="CMCD-Status"})(ot||(ot={}));const Bu={[ot.OBJECT]:["br","d","ot","tb"],[ot.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[ot.SESSION]:["cid","pr","sf","sid","st","v"],[ot.STATUS]:["bs","rtp"]};class Rt{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(s=>s instanceof Rt?s:new Rt(s))),this.value=e,this.params=t}}class to{constructor(e){this.description=void 0,this.description=e}}const $u="Dict";function Uu(r){return Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":typeof r=="object"?JSON.stringify(r):String(r)}function Gu(r,e,t,s){return new Error(`failed to ${r} "${Uu(e)}" as ${t}`,{cause:s})}const _n="Bare Item",Hu="Boolean",Vu="Byte Sequence",zu="Decimal",Ku="Integer";function Yu(r){return r<-999999999999999||999999999999999<r}const Wu=/[\x00-\x1f\x7f]+/,qu="Token",ju="Key";function We(r,e,t){return Gu("serialize",r,e,t)}function Xu(r){if(typeof r!="boolean")throw We(r,Hu);return r?"?1":"?0"}function Qu(r){return btoa(String.fromCharCode(...r))}function Zu(r){if(ArrayBuffer.isView(r)===!1)throw We(r,Vu);return`:${Qu(r)}:`}function so(r){if(Yu(r))throw We(r,Ku);return r.toString()}function Ju(r){return`@${so(r.getTime()/1e3)}`}function io(r,e){if(r<0)return-io(-r,e);const t=Math.pow(10,e);if(Math.abs(r*t%1-.5)<Number.EPSILON){const i=Math.floor(r*t);return(i%2===0?i:i+1)/t}else return Math.round(r*t)/t}function ef(r){const e=io(r,3);if(Math.floor(Math.abs(e)).toString().length>12)throw We(r,zu);const t=e.toString();return t.includes(".")?t:`${t}.0`}const tf="String";function sf(r){if(Wu.test(r))throw We(r,tf);return`"${r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function rf(r){return r.description||r.toString().slice(7,-1)}function Pn(r){const e=rf(r);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw We(e,qu);return e}function Qi(r){switch(typeof r){case"number":if(!W(r))throw We(r,_n);return Number.isInteger(r)?so(r):ef(r);case"string":return sf(r);case"symbol":return Pn(r);case"boolean":return Xu(r);case"object":if(r instanceof Date)return Ju(r);if(r instanceof Uint8Array)return Zu(r);if(r instanceof to)return Pn(r);default:throw We(r,_n)}}function Zi(r){if(/^[a-z*][a-z0-9\-_.*]*$/.test(r)===!1)throw We(r,ju);return r}function br(r){return r==null?"":Object.entries(r).map(([e,t])=>t===!0?`;${Zi(e)}`:`;${Zi(e)}=${Qi(t)}`).join("")}function ro(r){return r instanceof Rt?`${Qi(r.value)}${br(r.params)}`:Qi(r)}function nf(r){return`(${r.value.map(ro).join(" ")})${br(r.params)}`}function af(r,e={whitespace:!0}){if(typeof r!="object")throw We(r,$u);const t=r instanceof Map?r.entries():Object.entries(r),s=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,n])=>{n instanceof Rt||(n=new Rt(n));let a=Zi(i);return n.value===!0?a+=br(n.params):(a+="=",Array.isArray(n.value)?a+=nf(n):a+=ro(n)),a}).join(`,${s}`)}function of(r,e){return af(r,e)}const lf=r=>r==="ot"||r==="sf"||r==="st",cf=r=>typeof r=="number"?W(r):r!=null&&r!==""&&r!==!1;function df(r,e){const t=new URL(r),s=new URL(e);if(t.origin!==s.origin)return r;const i=t.pathname.split("/").slice(1),n=s.pathname.split("/").slice(1,-1);for(;i[0]===n[0];)i.shift(),n.shift();for(;n.length;)n.shift(),i.unshift("..");return i.join("/")}function uf(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?n:n&3|8).toString(16)})}}}const ws=r=>Math.round(r),ff=(r,e)=>(e!=null&&e.baseUrl&&(r=df(r,e.baseUrl)),encodeURIComponent(r)),ms=r=>ws(r/100)*100,hf={br:ws,d:ws,bl:ms,dl:ms,mtp:ms,nor:ff,rtp:ms,tb:ws};function pf(r,e){const t={};if(r==null||typeof r!="object")return t;const s=Object.keys(r).sort(),i=me({},hf,e==null?void 0:e.formatters),n=e==null?void 0:e.filter;return s.forEach(a=>{if(n!=null&&n(a))return;let o=r[a];const l=i[a];l&&(o=l(o,e)),!(a==="v"&&o===1)&&(a=="pr"&&o===1||cf(o)&&(lf(a)&&typeof o=="string"&&(o=new to(o)),t[a]=o))}),t}function no(r,e={}){return r?of(pf(r,e),me({whitespace:!1},e)):""}function mf(r,e={}){if(!r)return{};const t=Object.entries(r),s=Object.entries(Bu).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),i=t.reduce((n,a)=>{var o,l;const[c,d]=a,u=((o=s.find(f=>f[1].includes(c)))==null?void 0:o[0])||ot.REQUEST;return(l=n[u])!=null||(n[u]={}),n[u][c]=d,n},{});return Object.entries(i).reduce((n,[a,o])=>(n[a]=no(o,e),n),{})}function gf(r,e,t){return me(r,mf(e,t))}const vf="CMCD";function yf(r,e={}){if(!r)return"";const t=no(r,e);return`${vf}=${encodeURIComponent(t)}`}const kn=/CMCD=[^&#]+/;function Ef(r,e,t){const s=yf(e,t);if(!s)return r;if(kn.test(r))return r.replace(kn,s);const i=r.includes("?")?"&":"?";return`${r}${i}${s}`}class xf{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=i=>{try{this.apply(i,{ot:be.MANIFEST,su:!this.initialized})}catch(n){O.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=i=>{try{const n=i.frag,a=this.hls.levels[n.level],o=this.getObjectType(n),l={d:n.duration*1e3,ot:o};(o===be.VIDEO||o===be.AUDIO||o==be.MUXED)&&(l.br=a.bitrate/1e3,l.tb=this.getTopBandwidth(o)/1e3,l.bl=this.getBufferLength(o)),this.apply(i,l)}catch(n){O.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:s}=t;s!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||uf(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.includeKeys=s.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;
36e.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(x.MEDIA_DETACHED,this.onMediaDetached,this),e.on(x.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(x.MEDIA_DETACHED,this.onMediaDetached,this),e.off(x.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var s,i;this.audioBuffer=(s=t.tracks.audio)==null?void 0:s.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:Xi.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){me(t,this.createData());const s=t.ot===be.INIT||t.ot===be.VIDEO||t.ot===be.MUXED;this.starved&&s&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((n,a)=>(i.includes(a)&&(n[a]=t[a]),n),{})),this.useHeaders?(e.headers||(e.headers={}),gf(e.headers,t)):e.url=Ef(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return be.TIMED_TEXT;if(e.sn==="initSegment")return be.INIT;if(t==="audio")return be.AUDIO;if(t==="main")return this.hls.audioTracks.length?be.VIDEO:be.MUXED}getTopBandwidth(e){let t=0,s;const i=this.hls;if(e===be.AUDIO)s=i.audioTracks;else{const n=i.maxAutoLevel,a=n>-1?n+1:i.levels.length;s=i.levels.slice(0,a)}for(const n of s)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,s=e===be.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!t?NaN:le.bufferInfo(s,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,s=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new s(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,s=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new s(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}}const Tf=3e5;class Sf{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=O.log.bind(O,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(x.MANIFEST_PARSED,this.onManifestParsed,this),e.on(x.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(x.MANIFEST_PARSED,this.onManifestParsed,this),e.off(x.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(s=>s!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:s}=t;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:s}=t;if((s==null?void 0:s.action)===xe.SendAlternateToPenaltyBox&&s.flags===Fe.MoveAllAlternatesMatchingHost){const i=this.levels;let n=this.pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:o,pathwayId:l,type:c}=t.context;o&&i?a=this.getPathwayForGroupId(o,c,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&i&&(n=i.reduce((o,l)=>(o.indexOf(l.pathwayId)===-1&&o.push(l.pathwayId),o),[])),n&&n.length>1&&(this.updatePathwayPriority(n),s.resolved=this.pathwayId!==a),s.resolved||O.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${i&&i.length} priorities: ${JSON.stringify(n)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const s=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),t=this.getLevelsForPathway(s),this.pathwayId=s}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const s=this.penalizedPathways,i=performance.now();
vendor: 4,373 bytes, line 36
36Object.keys(s).forEach(n=>{i-s[n]>Tf&&delete s[n]});for(let n=0;n<e.length;n++){const a=e[n];if(a in s)continue;if(a===this.pathwayId)return;const o=this.hls.nextLoadLevel,l=this.hls.levels[o];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,wa(t),this.hls.trigger(x.LEVELS_UPDATED,{levels:t});const c=this.hls.levels[o];l&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,s){const i=this.getLevelsForPathway(s).concat(this.levels||[]);for(let n=0;n<i.length;n++)if(t===ne.AUDIO_TRACK&&i[n].hasAudioGroup(e)||t===ne.SUBTITLE_TRACK&&i[n].hasSubtitleGroup(e))return i[n].pathwayId;return s}clonePathways(e){const t=this.levels;if(!t)return;const s={},i={};e.forEach(n=>{const{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=n;if(t.some(d=>d.pathwayId===a))return;const c=this.getLevelsForPathway(o).map(d=>{const u=new ue(d.attrs);u["PATHWAY-ID"]=a;const f=u.AUDIO&&`${u.AUDIO}_clone_${a}`,h=u.SUBTITLES&&`${u.SUBTITLES}_clone_${a}`;f&&(s[u.AUDIO]=f,u.AUDIO=f),h&&(i[u.SUBTITLES]=h,u.SUBTITLES=h);const p=ao(d.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),m=new At({attrs:u,audioCodec:d.audioCodec,bitrate:d.bitrate,height:d.height,name:d.name,url:p,videoCodec:d.videoCodec,width:d.width});if(d.audioGroups)for(let g=1;g<d.audioGroups.length;g++)m.addGroupId("audio",`${d.audioGroups[g]}_clone_${a}`);if(d.subtitleGroups)for(let g=1;g<d.subtitleGroups.length;g++)m.addGroupId("text",`${d.subtitleGroups[g]}_clone_${a}`);return m});t.push(...c),Mn(this.audioTracks,s,l,a),Mn(this.subtitleTracks,i,l,a)})}loadSteeringManifest(e){const t=this.hls.config,s=t.loader;this.loader&&this.loader.destroy(),this.loader=new s(t);let i;try{i=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const d=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+d)}const n={responseType:"json",url:i.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},c={onSuccess:(d,u,f,h)=>{this.log(`Loaded steering manifest: "${i}"`);const p=d.data;if(p.VERSION!==1){this.log(`Steering VERSION ${p.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=p.TTL;const{"RELOAD-URI":m,"PATHWAY-CLONES":g,"PATHWAY-PRIORITY":y}=p;if(m)try{this.uri=new self.URL(m,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${m}`);return}this.scheduleRefresh(this.uri||f.url),g&&this.clonePathways(g);const E={steeringManifest:p,url:i.toString()};this.hls.trigger(x.STEERING_MANIFEST_LOADED,E),y&&this.updatePathwayPriority(y)},onError:(d,u,f,h)=>{if(this.log(`Error loading steering manifest: ${d.code} ${d.text} (${u.url})`),this.stopLoad(),d.code===410){this.enabled=!1,this.log(`Steering manifest ${u.url} no longer available`);return}let p=this.timeToLoad*1e3;if(d.code===429){const m=this.loader;if(typeof(m==null?void 0:m.getResponseHeader)=="function"){const g=m.getResponseHeader("Retry-After");g&&(p=parseFloat(g)*1e3)}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,p)},onTimeout:(d,u,f)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(n,l,c)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var s;const i=(s=this.hls)==null?void 0:s.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Mn(r,e,t,s){r&&Object.keys(e).forEach(i=>{const n=r.filter(a=>a.groupId===i).map(a=>{const o=me({},a);return o.details=void 0,o.attrs=new ue(o.attrs),o.url=o.attrs.URI=ao(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[i],o.attrs["PATHWAY-ID"]=s,o});r.push(...n)})}function ao(r,e,t,s){const{HOST:i,PARAMS:n,[t]:a}=s;let o;e&&(o=a==null?void 0:a[e],o&&(r=o));const l=new self.URL(r);
36return i&&!o&&(l.host=i),n&&Object.keys(n).sort().forEach(c=>{c&&l.searchParams.set(c,n[c])}),l.href}const bf=/^age:\s*[\d.]+\s*$/im;class oo{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new js,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=s,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const s=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!(this.loader!==s||this.stats.aborted))return n(s,t.url)}).catch(a=>{if(!(this.loader!==s||this.stats.aborted))return s.open("GET",t.url,!0),n(s,t.url)}).then(()=>{this.loader!==s||this.stats.aborted||this.openAndSendXhr(s,t,e)}).catch(a=>{this.callbacks.onError({code:s.status,text:a.message},t,s,i)}):this.openAndSendXhr(s,t,e)}openAndSendXhr(e,t,s){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=s.loadPolicy;if(i)for(const o in i)e.setRequestHeader(o,i[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),s.timeout=n&&W(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:s}=this;if(!e||!t)return;const i=t.readyState,n=this.config;if(!s.aborted&&i>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const a=t.status,o=t.responseType!=="text";if(a>=200&&a<300&&(o&&t.response||t.responseText!==null)){s.loading.end=Math.max(self.performance.now(),s.loading.first);const l=o?t.response:t.responseText,c=t.responseType==="arraybuffer"?l.byteLength:l.length;if(s.loaded=s.total=c,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first),!this.callbacks)return;const d=this.callbacks.onProgress;if(d&&d(s,e,l,t),!this.callbacks)return;const u={url:t.responseURL,data:l,code:a};this.callbacks.onSuccess(u,s,e,t)}else{const l=n.loadPolicy.errorRetry,c=s.retry,d={url:e.url,data:void 0,code:a};Bs(l,c,!1,d)?this.retry(l):(O.error(`${a} while loading ${e.url}`),this.callbacks.onError({code:a,text:t.statusText},e,t,s))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Bs(e,t,!0))this.retry(e);else{var s;O.warn(`timeout while loading ${(s=this.context)==null?void 0:s.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:s}=this;this.retryDelay=dr(e,s.retry),s.retry++,O.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${s.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&bf.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}function wf(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const Lf=/(\d+)-(\d+)\/(\d+)/;class On{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Cf,this.controller=new self.AbortController,this.stats=new js}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,s){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const n=Af(e,this.controller.signal),a=s.onProgress,o=e.responseType==="arraybuffer",l=o?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=s,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=c&&W(c)?c:d,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),s.onTimeout(i,e,this.response)},t.timeout),self.fetch(this.request).then(u=>{this.response=this.loader=u;const f=Math.max(self.performance.now(),i.loading.start);
36if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),s.onTimeout(i,e,this.response)},d-(f-i.loading.start)),!u.ok){const{status:h,statusText:p}=u;throw new Df(p||"fetch, bad network response",h,u)}return i.loading.first=f,i.total=Rf(u.headers)||i.total,a&&W(t.highWaterMark)?this.loadProgressively(u,i,e,t.highWaterMark,a):o?u.arrayBuffer():e.responseType==="json"?u.json():u.text()}).then(u=>{const f=this.response;if(!f)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const h=u[l];h&&(i.loaded=i.total=h);const p={url:f.url,data:u,code:f.status};a&&!W(t.highWaterMark)&&a(i,e,u,f),s.onSuccess(p,i,e,f)}).catch(u=>{if(self.clearTimeout(this.requestTimeout),i.aborted)return;const f=u&&u.code||0,h=u?u.message:null;s.onError({code:f,text:h},e,u?u.details:null,i)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,s,i=0,n){const a=new Ra,o=e.body.getReader(),l=()=>o.read().then(c=>{if(c.done)return a.dataLength&&n(t,s,a.flush(),e),Promise.resolve(new ArrayBuffer(0));const d=c.value,u=d.length;return t.loaded+=u,u<i||a.dataLength?(a.push(d),a.dataLength>=i&&n(t,s,a.flush(),e)):n(t,s,d,e),l()}).catch(()=>Promise.reject());return l()}}function Af(r,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(me({},r.headers))};return r.rangeEnd&&t.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),t}function If(r){const e=Lf.exec(r);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Rf(r){const e=r.get("Content-Range");if(e){const s=If(e);if(W(s))return s}const t=r.get("Content-Length");if(t)return parseInt(t)}function Cf(r,e){return new self.Request(r.url,e)}class Df extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}}const _f=/\s/,Pf={newCue(r,e,t,s){const i=[];let n,a,o,l,c;const d=self.VTTCue||self.TextTrackCue;for(let f=0;f<s.rows.length;f++)if(n=s.rows[f],o=!0,l=0,c="",!n.isEmpty()){var u;for(let m=0;m<n.chars.length;m++)_f.test(n.chars[m].uchar)&&o?l++:(c+=n.chars[m].uchar,o=!1);n.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const h=Xa(c.trim()),p=Tr(e,t,h);r!=null&&(u=r.cues)!=null&&u.getCueById(p)||(a=new d(e,t,h),a.id=p,a.line=f+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),i.push(a))}return r&&i.length&&(i.sort((f,h)=>f.line==="auto"||h.line==="auto"?0:f.line>8&&h.line>8?h.line-f.line:f.line-h.line),i.forEach(f=>xa(r,f))),i}},kf={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},lo=Ee(Ee({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:oo,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:nd,bufferController:cu,capLevelController:Sr,errorController:Wc,fpsController:Nu,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:aa,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,cert
vendor: 4,957 bytes, line 36
36LoadPolicy:{default:kf},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Mf()),{},{subtitleStreamController:nu,subtitleTrackController:ou,timelineController:Ou,audioStreamController:iu,audioTrackController:ru,emeController:wt,cmcdController:xf,contentSteeringController:Sf});function Mf(){return{cueHandler:Pf,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function Of(r,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=Ji(r),s=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return s.forEach(n=>{const a=`${n==="level"?"playlist":n}LoadPolicy`,o=e[a]===void 0,l=[];i.forEach(c=>{const d=`${n}Loading${c}`,u=e[d];if(u!==void 0&&o){l.push(d);const f=t[a].default;switch(e[a]={default:f},c){case"TimeOut":f.maxLoadTimeMs=u,f.maxTimeToFirstByteMs=u;break;case"MaxRetry":f.errorRetry.maxNumRetry=u,f.timeoutRetry.maxNumRetry=u;break;case"RetryDelay":f.errorRetry.retryDelayMs=u,f.timeoutRetry.retryDelayMs=u;break;case"MaxRetryTimeout":f.errorRetry.maxRetryDelayMs=u,f.timeoutRetry.maxRetryDelayMs=u;break}}}),l.length&&O.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${a}": ${JSON.stringify(e[a])}`)}),Ee(Ee({},t),e)}function Ji(r){return r&&typeof r=="object"?Array.isArray(r)?r.map(Ji):Object.keys(r).reduce((e,t)=>(e[t]=Ji(r[t]),e),{}):r}function Ff(r){const e=r.loader;e!==On&&e!==oo?(O.log("[config]: Custom loader detected, cannot enable progressive streaming"),r.progressive=!1):wf()&&(r.loader=On,r.progressive=!0,r.enableSoftwareAES=!0,O.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Li;class Nf extends ur{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(x.LEVEL_LOADED,this.onLevelLoaded,this),e.on(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(x.FRAG_BUFFERED,this.onFragBuffered,this),e.on(x.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(x.LEVEL_LOADED,this.onLevelLoaded,this),e.off(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(x.FRAG_BUFFERED,this.onFragBuffered,this),e.off(x.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}
36stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const s=this.hls.config.preferManagedMediaSource,i=[],n={},a={};let o=!1,l=!1,c=!1;t.levels.forEach(d=>{var u,f;const h=d.attrs;let{audioCodec:p,videoCodec:m}=d;((u=p)==null?void 0:u.indexOf("mp4a.40.34"))!==-1&&(Li||(Li=/chrome|firefox/i.test(navigator.userAgent)),Li&&(d.audioCodec=p=void 0)),p&&(d.audioCodec=p=Os(p,s)),((f=m)==null?void 0:f.indexOf("avc1"))===0&&(m=d.videoCodec=Sc(m));const{width:g,height:y,unknownCodecs:E}=d;if(o||(o=!!(g&&y)),l||(l=!!m),c||(c=!!p),E!=null&&E.length||p&&!di(p,"audio",s)||m&&!di(m,"video",s))return;const{CODECS:v,"FRAME-RATE":S,"HDCP-LEVEL":T,"PATHWAY-ID":L,RESOLUTION:b,"VIDEO-RANGE":C}=h,w=`${`${L||"."}-`}${d.bitrate}-${b}-${S}-${v}-${C}-${T}`;if(n[w])if(n[w].uri!==d.url&&!d.attrs["PATHWAY-ID"]){const I=a[w]+=1;d.attrs["PATHWAY-ID"]=new Array(I+1).join(".");const P=new At(d);n[w]=P,i.push(P)}else n[w].addGroupId("audio",h.AUDIO),n[w].addGroupId("text",h.SUBTITLES);else{const I=new At(d);n[w]=I,a[w]=1,i.push(I)}}),this.filterAndSortMediaOptions(i,t,o,l,c)}filterAndSortMediaOptions(e,t,s,i,n){let a=[],o=[],l=e;if((s||i)&&n&&(l=l.filter(({videoCodec:p,videoRange:m,width:g,height:y})=>(!!p||!!(g&&y))&&Oc(m))),l.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const p=new Error("no level with compatible codecs found in manifest");this.hls.trigger(x.ERROR,{type:J.MEDIA_ERROR,details:$.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:p,reason:p.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:p}=this.hls.config;a=t.audioTracks.filter(m=>!m.audioCodec||di(m.audioCodec,"audio",p)),Fn(a)}t.subtitles&&(o=t.subtitles,Fn(o));const c=l.slice(0);l.sort((p,m)=>{if(p.attrs["HDCP-LEVEL"]!==m.attrs["HDCP-LEVEL"])return(p.attrs["HDCP-LEVEL"]||"")>(m.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&p.height!==m.height)return p.height-m.height;if(p.frameRate!==m.frameRate)return p.frameRate-m.frameRate;if(p.videoRange!==m.videoRange)return Fs.indexOf(p.videoRange)-Fs.indexOf(m.videoRange);if(p.videoCodec!==m.videoCodec){const g=Hr(p.videoCodec),y=Hr(m.videoCodec);if(g!==y)return y-g}if(p.uri===m.uri&&p.codecSet!==m.codecSet){const g=Ms(p.codecSet),y=Ms(m.codecSet);if(g!==y)return y-g}return p.averageBitrate!==m.averageBitrate?p.averageBitrate-m.averageBitrate:0});let d=c[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==c.length)){for(let p=0;p<c.length;p++)if(c[p].pathwayId===l[0].pathwayId){d=c[p];break}}this._levels=l;for(let p=0;p<l.length;p++)if(l[p]===d){var u;this._firstLevel=p;const m=d.bitrate,g=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${m}`),((u=this.hls.userConfig)==null?void 0:u.abrEwmaDefaultEstimate)===void 0){const y=Math.min(m,this.hls.config.abrEwmaDefaultEstimateMax);y>g&&g===lo.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=y)}break}const f=n&&!i,h={levels:l,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:i,altAudio:!f&&a.some(p=>!!p.url)};this.hls.trigger(x.MANIFEST_PARSED,h),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const d=new Error("invalid level idx"),u=e<0;if(this.hls.trigger(x.ERROR,{type:J.OTHER_ERROR,details:$.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:d,reason:d.message}),u)return;e=Math.min(e,t.length-1)}const s=this.currentLevelIndex,i=this.currentLevel,n=i?i.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,s===e&&a.details&&i&&n===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${s}${n?" with Pathway "+n:""}`);const l={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(x.LEVEL_SWITCHING,l);const c=a.details;if(!c||c.live){const d=this.switchParams(a.uri,i==null?void 0:i.details,c);this.loadPlaylist(d)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===ne.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===X.MAIN){const s=t.elementaryStreams;if(!Object.keys(s).some(n=>!!s[n]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var s;const{level:i,details:n}=t,a=this._levels[i];if(!a){var o;this.warn(`Invalid level index ${i}`),(o=t.deliveryDirectives)!=null&&o.skip&&(n.deltaUpdateFailed=!0);return}i===this.currentLevelIndex?(a.fragmentError===0&&(a.loadError=0),this.playlistLoaded(i,t,a.details)):(s=t.deliveryDirectives)!=null&&s.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,s=this.currentLevel;if(s&&this.shouldLoadPlaylist(s)){let i=s.uri;if(e)try{i=e.addDirectives(i)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}const n=s.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${n?" Pathway "+n:""} ${i}`),this.clearTimer(),this.hls.trigger(x.LEVEL_LOADING,{url:i,level:t,pathwayId:s.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const s=this._levels.filter((i,n)=>n!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEac
vendor: 4,408 bytes, line 36
36h(a=>a.level=-1)),!1));wa(s),this._levels=s,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(x.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:s}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(x.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function Fn(r){const e={};r.forEach(t=>{const s=t.groupId||"";t.id=e[s]=e[s]||0,e[s]++})}class Bf{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const s in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[s].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=$.KEY_LOAD_ERROR,s,i,n){return new Qe({type:J.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:s,networkDetails:i})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:s,cc:i}=e;for(let n=0;n<t.length;n++){const a=t[n];if(i<=a.cc&&(s==="initSegment"||a.sn==="initSegment"||s<a.sn)){this.emeController.selectKeySystemFormat(a).then(o=>{a.setKeyFormat(o)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var s,i;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const c=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,c))}const a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));let o=this.keyUriToKeyInfo[a];if((s=o)!=null&&s.decryptdata.key)return n.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((i=o)!=null&&i.keyLoadPromise){var l;switch((l=o.mediaKeySessionContext)==null?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then(c=>(n.key=c.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}}switch(o=this.keyUriToKeyInfo[a]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const s={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const i=this.emeController.loadKey(s);if(i)return(e.keyLoadPromise=i.then(n=>(e.mediaKeySessionContext=n,s))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(s)}loadKeyHTTP(e,t){const s=this.config,i=s.loader,n=new i(s);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((a,o)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},c=s.keyLoadPolicy.default,d={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(f,h,p,m)=>{const{frag:g,keyInfo:y,url:E}=p;if(!g.decryptdata||y!==this.keyUriToKeyInfo[E])return o(this.createKeyLoadError(g,$.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),m));y.decryptdata.key=g.decryptdata.key=new Uint8Array(f.data),g.keyLoader=null,y.loader=null,a({frag:g,keyInfo:y})},onError:(f,h,p,m)=>{this.resetLoader(h),o(this.createKeyLoadError(t,$.KEY_LOAD_ERROR,new Error(`HTTP Error ${f.code} loading key ${f.text}`),p,Ee({url:l.url,data:void 0},f)))},onTimeout:(f,h,p)=>{this.resetLoader(h),o(this.createKeyLoadError(t,$.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),p))},onAbort:(f,h,p)=>{this.resetLoader(h),o(this.createKeyLoadError(t,$.INTERNAL_ABORTED,new Error("key loading aborted"),p))}};n.load(l,d,u)})}
36resetLoader(e){const{frag:t,keyInfo:s,url:i}=e,n=s.loader;t.keyLoader===n&&(t.keyLoader=null,s.loader=null),delete this.keyUriToKeyInfo[i],n&&n.destroy()}}function co(){return self.SourceBuffer||self.WebKitSourceBuffer}function uo(){if(!ut())return!1;const e=co();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function $f(){if(!uo())return!1;const r=ut();return typeof(r==null?void 0:r.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>r.isTypeSupported(jt(e,"video")))||["mp4a.40.2","fLaC"].some(e=>r.isTypeSupported(jt(e,"audio"))))}function Uf(){var r;const e=co();return typeof(e==null||(r=e.prototype)==null?void 0:r.changeType)=="function"}const Gf=250,Ls=2,Hf=.1,Vf=.05;class zf{constructor(e,t,s,i){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=s,this.hls=i}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:s,media:i,stalled:n}=this;if(i===null)return;const{currentTime:a,seeking:o}=i,l=this.seeking&&!o,c=!this.seeking&&o;if(this.seeking=o,a!==e){if(this.moved=!0,o||(this.nudgeRetry=0),n!==null){if(this.stallReported){const g=self.performance.now()-n;O.warn(`playback not stuck anymore @${a}, after ${Math.round(g)}ms`),this.stallReported=!1}this.stalled=null}return}if(c||l){this.stalled=null;return}if(i.paused&&!o||i.ended||i.playbackRate===0||!le.getBuffered(i).length){this.nudgeRetry=0;return}const d=le.bufferInfo(i,a,0),u=d.nextStart||0;if(o){const g=d.len>Ls,y=!u||t&&t.start<=a||u-a>Ls&&!this.fragmentTracker.getPartialFragment(a);if(g||y)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var f;if(!(d.len>0)&&!u)return;const y=Math.max(u,d.start||0)-a,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,S=(E==null||(f=E.details)==null?void 0:f.live)?E.details.targetduration*2:Ls,T=this.fragmentTracker.getPartialFragment(a);if(y>0&&(y<=S||T)){i.paused||this._trySkipBufferHole(T);return}}const h=self.performance.now();if(n===null){this.stalled=h;return}const p=h-n;if(!o&&p>=Gf&&(this._reportStall(d),!this.media))return;const m=le.bufferInfo(i,a,s.maxBufferHole);this._tryFixBufferStall(m,p)}_tryFixBufferStall(e,t){const{config:s,fragmentTracker:i,media:n}=this;if(n===null)return;const a=n.currentTime,o=i.getPartialFragment(a);o&&(this._trySkipBufferHole(o)||!this.media)||(e.len>s.maxBufferHole||e.nextStart&&e.nextStart-a<s.maxBufferHole)&&t>s.highBufferWatchdogPeriod*1e3&&(O.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:s,stallReported:i}=this;if(!i&&s){this.stallReported=!0;const n=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${JSON.stringify(e)})`);O.warn(n.message),t.trigger(x.ERROR,{type:J.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:s,media:i}=this;if(i===null)return 0;const n=i.currentTime,a=le.bufferInfo(i,n,0),o=n<a.start?a.start:a.nextStart;if(o){const l=a.len<=t.maxBufferHole,c=a.len>0&&a.len<1&&i.readyState<3,d=o-n;if(d>0&&(l||c)){if(d>t.maxBufferHole){const{fragmentTracker:f}=this;let h=!1;if(n===0){const p=f.getAppendedFrag(0,X.MAIN);p&&o<p.end&&(h=!0)}if(!h){const p=e||f.getAppendedFrag(n,X.MAIN);if(p){let m=!1,g=p.end;for(;g<o;){const y=f.getPartialFragment(g);if(y)g+=y.duration;else{m=!0;break}}if(m)return 0}}}const u=Math.max(o+Vf,n+Hf);if(O.warn(`skipping hole, adjusting currentTime from ${n} to ${u}`),this.moved=!0,this.stalled=null,i.currentTime=u,e&&!e.gap){const f=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${u}`);s.trigger(x.ERROR,{type:J.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:e})}return u}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:s,nudgeRetry:i}=this;if(s===null)return;const n=s.currentTime;if(this.nudgeRetry++,i<e.nudgeMaxRetry){const a=n+(i+1)*e.nudgeOffset,o=new Error(`Nudging 'currentTime' from ${n} to ${a}`);O.warn(o.message),s.currentTime=a,t.trigger(x.ERROR,{type:J.MEDIA_ERROR,details:$.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1})}else{const a=new Error(`Playhead still not moving while enough data buffered @${n} after ${e.nudgeMaxRetry} nudges`);O.error(a.message),t.trigger(x.ERROR,{type:J.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,error:a,fatal:!0})}}}const Kf=100;class Yf extends pr{constructor(e,t,s){super(e,t,s,"[stream-controller]",X.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;
36e.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_PARSED,this.onManifestParsed,this),e.on(x.LEVEL_LOADING,this.onLevelLoading,this),e.on(x.LEVEL_LOADED,this.onLevelLoaded,this),e.on(x.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(x.ERROR,this.onError,this),e.on(x.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(x.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(x.BUFFER_CREATED,this.onBufferCreated,this),e.on(x.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(x.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_PARSED,this.onManifestParsed,this),e.off(x.LEVEL_LOADED,this.onLevelLoaded,this),e.off(x.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(x.ERROR,this.onError,this),e.off(x.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(x.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(x.BUFFER_CREATED,this.onBufferCreated,this),e.off(x.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(x.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:s}=this;if(this.stopLoad(),this.setInterval(Kf),this.level=-1,!this.startFragRequested){let i=s.startLevel;i===-1&&(s.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=s.firstAutoLevel),s.nextLoadLevel=i,this.level=s.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=V.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=V.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case V.WAITING_LEVEL:{const{levels:t,level:s}=this,i=t==null?void 0:t[s],n=i==null?void 0:i.details;if(n&&(!n.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(n))break;this.state=V.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=V.IDLE;break}break}case V.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),s=this.retryDate;if(!s||t>=s||(e=this.media)!=null&&e.seeking){const{levels:i,level:n}=this,a=i==null?void 0:i[n];this.resetStartWhenNotLoaded(a||null),this.state=V.IDLE}}break}this.state===V.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:s,media:i}=this;if(t===null||!i&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=e.nextLoadLevel;if(!(s!=null&&s[n]))return;const a=s[n],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const m={};this.altAudio&&(m.type="video"),this.hls.trigger(x.BUFFER_EOS,m),this.state=V.ENDED;return}e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const c=a.details;if(!c||this.state===V.WAITING_LEVEL||c.live&&this.levelLastLoaded!==a){this.level=n,this.state=V.WAITING_LEVEL;return}const d=o.len,u=this.getMaxBufferLength(a.maxBitrate);if(d>=u)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const f=this.backtrackFragment?this.backtrackFragment.start:o.end;let h=this.getNextFragment(f,c);if(this.couldBacktrack&&!this.fragPrevious&&h&&h.sn!=="initSegment"&&this.fragmentTracker.getState(h)!==ye.OK){var p;const g=((p=this.backtrackFragment)!=null?p:h).sn-c.startSN,y=c.fragments[g-1];y&&h.cc===y.cc&&(h=y,this.fragmentTracker.removeFragment(y))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);
36if(h&&this.isLoopLoading(h,f)){if(!h.gap){const g=this.audioOnly&&!this.altAudio?ae.AUDIO:ae.VIDEO,y=(g===ae.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;y&&this.afterBufferFlushed(y,g,X.MAIN)}h=this.getNextFragmentLoopLoading(h,c,o,X.MAIN,u)}h&&(h.initSegment&&!h.initSegment.data&&!this.bitrateTest&&(h=h.initSegment),this.loadFragment(h,a,f))}loadFragment(e,t,s){const i=this.fragmentTracker.getState(e);this.fragCurrent=e,i===ye.NOT_LOADED||i===ye.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,s)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,X.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let s;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<n.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,l=e[o],c=this.fragLastKbps;c&&this.fragCurrent?s=this.fragCurrent.duration*l.maxBitrate/(1e3*c)+1:s=0}else s=0;const a=this.getBufferedFrag(t.currentTime+s);if(a){const o=this.followingBufferedFrag(a);if(o){this.abortCurrentFrag();const l=o.maxStartPTS?o.maxStartPTS:o.start,c=o.duration,d=Math.max(a.end,l+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,c*(this.couldBacktrack?.5:.125)),c*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(d,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case V.KEY_LOADING:case V.FRAG_LOADING:case V.FRAG_LOADING_WAITING_RETRY:case V.PARSING:case V.PARSED:this.state=V.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const s=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),s.addEventListener("playing",this.onvplaying),s.addEventListener("seeked",this.onvseeked),this.gapController=new zf(this.config,s,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;W(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const s=this.getMainFwdBufferInfo();if(s===null||s.len===0){this.warn(`Main forward buffer length on "seeked" event ${s?s.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(x.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let s=!1,i=!1;t.levels.forEach(n=>{const a=n.audioCodec;a&&(s=s||a.indexOf("mp4a.40.2")!==-1,i=i||a.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=s&&i&&!Uf(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:s}=this;if(!s||this.state!==V.IDLE)return;const i=s[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=V.WAITING_LEVEL)}onLevelLoaded(e,t){var s;const{levels:i}=this,n=t.level,a=t.details,o=a.totalduration;if(!i){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);const l=i[n],c=this.fragCurrent;c&&(this.state===V.FRAG_LOADING||this.state===V.FRAG_LOADING_WAITING_RETRY)&&c.level!==t.level&&c.loader&&this.abortCurrentFrag();let d=0;if(a.live||(s=l.details)!=null&&s.live){var u;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;d=this.alignPlaylists(a,l.details,(u=this.levelLastLoaded)==null?void 0:u.details)}if(l.details=a,this.levelLastLoaded=l,this.hls.trigger(x.LEVEL_UPDATED,{details:a,level:n}),this.state===V.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=V.IDLE}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,d),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:s,part:i,payload:n}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const o=a[s.level],l=o.details;if(!l){this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),this.fragmentTracker.removeFragment(s);return}const c=o.videoCodec,d=l.PTSKnown||!l.live,u=(t=s.initSegment)==null?void 0:t.data,f=this._getAudioCodec(o),h=this.transmuxer=this.transmuxer||new za(this.hls,X.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=i?i.index:-1,m=p!==-1,g=new fr(s.level,s.sn,s.stats.chunkCount,n.byteLength,p,m),y=this.initPTS[s.cc];h.push(n,u,f,c,s,i,l.totalduration,d,g,y)}onAudioTrackSwitching(e,t){const s=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const n=this.hls;s&&(n.trigger(x.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(x.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const s=t.id,i=!!this.hls.audioTracks[s].url;if(i){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=i,this.tick()}onBufferCreated(e,t){const s=t.tracks;let i,n,a=!1;for(const o in s){const l=s[o];if(l.id==="main"){if(n=o,i=l,o==="video"){const c=s[o];c&&(this.videoBuffer=c.buffer)}}else a=!0}a&&i?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:s,part:i}=t;if(s&&s.type!==X.MAIN)return;if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${i?" p: "+i.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===V.PARSED&&(this.state=V.IDLE);return}const n=i?i.stats:s.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),s.sn!=="initSegment"&&(this.fragPrevious=s),this.fragBufferedComplete(s,i)}onError(e,t){var s;if(t.fatal){this.state=V.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.
36KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(X.MAIN,t);break;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===V.WAITING_LEVEL&&((s=t.context)==null?void 0:s.type)===ne.LEVEL&&(this.state=V.IDLE);break;case $.BUFFER_APPEND_ERROR:case $.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===$.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!le.getBuffered(e).length){const s=this.state!==V.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,s)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=V.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==ae.AUDIO||this.audioOnly&&!this.altAudio){const s=(t===ae.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(s,t,X.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let s=this.startPosition;if(s>=0&&t<s){if(e.seeking){this.log(`could not seek to ${s}, already seeking at ${t}`);return}const i=le.getBuffered(e),a=(i.length?i.start(0):0)-s;a>0&&(a<this.config.maxBufferHole||a<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${a} to match buffer start`),s+=a,this.startPosition=s),this.log(`seek to target start position ${s} from current time ${t}`),e.currentTime=s}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(s=>{const{hls:i}=this;if(!s||this.fragContextChanged(e))return;t.fragmentError=0,this.state=V.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=e.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),i.trigger(x.FRAG_LOADED,s),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const s="main",{hls:i}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:c,level:d}=o,{video:u,text:f,id3:h,initSegment:p}=n,{details:m}=d,g=this.altAudio?void 0:n.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=V.PARSING,p){if(p!=null&&p.tracks){const v=l.initSegment||l;this._bufferInitSegment(d,p.tracks,v,a),i.trigger(x.FRAG_PARSING_INIT_SEGMENT,{frag:v,id:s,tracks:p.tracks})}const y=p.initPTS,E=p.timescale;W(y)&&(this.initPTS[l.cc]={baseTime:y,timescale:E},i.trigger(x.INIT_PTS_FOUND,{frag:l,id:s,initPTS:y,timescale:E}))}if(u&&m&&l.sn!=="initSegment"){const y=m.fragments[l.sn-1-m.startSN],E=l.sn===m.startSN,v=!y||l.cc>y.cc;if(n.independent!==!1){const{startPTS:S,endPTS:T,startDTS:L,endDTS:b}=u;if(c)c.elementaryStreams[u.type]={startPTS:S,endPTS:T,startDTS:L,endDTS:b};else if(u.firstKeyFrame&&u.independent&&a.id===1&&!v&&(this.couldBacktrack=!0),u.dropped&&u.independent){const C=this.getMainFwdBufferInfo(),A=(C?C.end:this.getLoadPosition())+this.config.maxBufferHole,w=u.firstKeyFramePTS?u.firstKeyFramePTS:S;if(!E&&A<w-this.config.maxBufferHole&&!v){this.backtrack(l);return}else v&&(l.gap=!0);l.setElementaryStreamInfo(u.type,l.start,T,l.start,b,!0)}else E&&S>Ls&&(l.gap=!0);l.setElementaryStreamInfo(u.type,S,T,L,b),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(u,l,c,a,E||v)}else if(E||v)l.gap=!0;else{this.backtrack(l);return}}if(g){const{startPTS:y,endPTS:E,startDTS:v,endDTS:S}=g;c&&(c.elementaryStreams[ae.AUDIO]={startPTS:y,endPTS:E,startDTS:v,endDTS:S}),l.setElementaryStreamInfo(ae.AUDIO,y,E,v,S),this.bufferFragmentData(g,l,c,a)}if(m&&h!=null&&(t=h.samples)!=null&&t.length){const y={id:s,frag:l,details:m,samples:h.samples};i.trigger(x.FRAG_PARSING_METADATA,y)}if(m&&f){const y={id:s,frag:l,details:m,samples:f.samples};i.trigger(x.FRAG_PARSING_USERDATA,y)}}_bufferInitSegment(e,t,s,i){if(this.state!==V.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:n,video:a,audiovideo:o}=t;if(n){let l=e.audioCodec;const c=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5");const d=n.metadata;d&&"channelCount"in d&&(d.channelCount||1)!==1&&c.indexOf("firefox")===-1&&(l="mp4a.40.5")}l&&l.indexOf("mp4a.40.5")!==-1&&c.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(l="mp4a.40.2",this.log(`Android: force audio codec to ${l}`)),e.audioCodec&&e.audioCodec!==l&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${l}"`),n.levelCodec=l,n.id="main",this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${l||""}/${e.audioCodec||""}/${n.codec}]`)}a&&(a.levelCodec=e.videoCodec,a.id="main",this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${a.codec}]`)),o&&this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),this.hls.trigger(x.BUFFER_CODECS,t),Object.keys(t).forEach(l=>{const d=t[l].initSegment;d!=null&&d.byteLength&&this.hls.trigger(x.BUFFER_APPENDING,{type:l,data:d,frag:s,part:null,chunkMeta:i,parent:s.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,X.MAIN)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=V.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const s=e.currentTime;if(le.isBuffered(e,s)?t=this.getAppendedFrag(s):le.isBuffered(e,s+.1)&&
36(t=this.getAppendedFrag(s+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,n=t.level;(!i||t.sn!==i.sn||i.level!==n)&&(this.fragPlaying=t,this.hls.trigger(x.FRAG_CHANGED,{frag:t}),(!i||i.level!==n)&&this.hls.trigger(x.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,s=this.currentFrag;if(s&&W(t)&&W(s.programDateTime)){const i=s.programDateTime+(t-s.start)*1e3;return new Date(i)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class it{static get version(){return"1.5.15"}static isMSESupported(){return uo()}static isSupported(){return $f()}static getMediaSource(){return ut()}static get Events(){return x}static get ErrorTypes(){return J}static get ErrorDetails(){return $}static get DefaultConfig(){return it.defaultConfig?it.defaultConfig:lo}static set DefaultConfig(e){it.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Er,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,kl(e.debug||!1,"Hls instance");const t=this.config=Of(it.DefaultConfig,e);this.userConfig=e,t.progressive&&Ff(t);const{abrController:s,bufferController:i,capLevelController:n,errorController:a,fpsController:o}=t,l=new a(this),c=this.abrController=new s(this),d=this.bufferController=new i(this),u=this.capLevelController=new n(this),f=new o(this),h=new Ic(this),p=new Pc(this),m=t.contentSteeringController,g=m?new m(this):null,y=this.levelController=new Nf(this,g),E=new od(this),v=new Bf(this.config),S=this.streamController=new Yf(this,E,v);u.setStreamController(S),f.setStreamController(S);const T=[h,y,S];g&&T.splice(1,0,g),this.networkControllers=T;const L=[c,d,u,f,p,E];this.audioTrackController=this.createController(t.audioTrackController,T);const b=t.audioStreamController;b&&T.push(new b(this,E,v)),this.subtitleTrackController=this.createController(t.subtitleTrackController,T);const C=t.subtitleStreamController;C&&T.push(new C(this,E,v)),this.createController(t.timelineController,L),v.emeController=this.emeController=this.createController(t.emeController,L),this.cmcdController=this.createController(t.cmcdController,L),this.latencyController=this.createController(kc,L),this.coreComponents=L,T.push(l);const A=l.onErrorOut;typeof A=="function"&&this.on(x.ERROR,A,l)}createController(e,t){if(e){const s=new e(this);return t&&t.push(s),s}return null}on(e,t,s=this){this._emitter.on(e,t,s)}once(e,t,s=this){this._emitter.once(e,t,s)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,s=this,i){this._emitter.off(e,t,s,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,s){return this._emitter.emit(e,t,s)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(s){if(O.error("An internal error happened while handling event "+e+'. Error message: "'+s.message+'". Here is a stacktrace:',s),!this.triggeringException){this.triggeringException=!0;const i=e===x.ERROR;this.trigger(x.ERROR,{type:J.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:i,event:e,error:s}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){O.log("destroy"),this.trigger(x.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEac
36h(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){O.log("attachMedia"),this._media=e,this.trigger(x.MEDIA_ATTACHING,{media:e})}detachMedia(){O.log("detachMedia"),this.trigger(x.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,s=this.url,i=this.url=ar.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,O.log(`loadSource:${i}`),t&&s&&(s!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(x.MANIFEST_LOADING,{url:e})}startLoad(e=-1){O.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){O.log("stopLoad"),this.started=!1,this.networkControllers.forEach(e=>{e.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.stopLoad()})}swapAudioCodec(){O.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){O.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){O.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){O.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){O.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){O.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){O.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(O.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){Mc(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const s=e.length;for(let i=0;i<s;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:s}=this;let i;if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,s)for(let n=i;n--;){const a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=s)return n}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}it.defaultConfig=void 0;function fo({muxVideo:r,videoEl:e,preferMp4:t=!1,useSmallResolution:s=!1}){const i=Y(r);if(!(i!=null&&i.asset))return!1;let n="";return{appendVideo:()=>{var o,l,c,d,u,f,h,p;if(t&&((l=(o=i.asset.data)==null?void 0:o.static_renditions)==null?void 0:l.status)==="ready"){const m=[...(d=(c=i.asset.data)==null?void 0:c.static_renditions)==null?void 0:d.files].sort((y,E)=>E.bitrate-y.bitrate),g=s?(u=m[1])==null?void 0:u.name:(f=m[0])==null?void 0:f.name;n=`https://stream.mux.com/${(h=i.asset)==null?void 0:h.playbackId}/${g}`,e.value.src=n}else if(n=`https://stream.mux.com/${(p=i.asset)==null?void 0:p.playbackId}.m3u8`,it.isSupported()){const m=new it;m.loadSource(n),m.attachMedia(e.value)}else e.value.canPlayType("application/vnd.apple.mpegurl")&&(e.value.src=n)}}}const Wf=["width","height"],qf=["src","width","height","alt"],jf={__name:"BaseLoop",props:{video:{type:Object,default:()=>{}},posterImage:{type:Object,default:()=>{}},preferMp4:{type:Boolean,default:()=>!0},useSmallResolution:{type:Boolean,default:()=>!1},preload:{type:Boolean,default:()=>!1}},emits:["loaded"],setup(r,{emit:e}){var E;Co(v=>({af60bc90:Y(d)}));
36const t=r,s=de(null),i=de(!1),n=de(!1),a=de(!1),o=fe(()=>{var S,T,L,b,C;const v=(C=(b=(L=(T=(S=t.video)==null?void 0:S.muxVideo)==null?void 0:T.asset)==null?void 0:L.data)==null?void 0:b.tracks)==null?void 0:C.find(A=>A.type==="video");return v?v.max_width:void 0}),l=fe(()=>{var S,T,L,b,C;const v=(C=(b=(L=(T=(S=t.video)==null?void 0:S.muxVideo)==null?void 0:T.asset)==null?void 0:L.data)==null?void 0:b.tracks)==null?void 0:C.find(A=>A.type==="video");return v?v.max_height:void 0}),c=fe(()=>o.value<l.value),d=fe(()=>`${o.value} / ${l.value}`),u=fe(()=>{var v,S,T,L,b,C;return(T=(S=(v=t.video)==null?void 0:v.muxVideo)==null?void 0:S.asset)!=null&&T.playbackId?`https://image.mux.com/${(C=(b=(L=t.video)==null?void 0:L.muxVideo)==null?void 0:b.asset)==null?void 0:C.playbackId}/thumbnail.jpg?time=0`:""}),f=e,{appendVideo:h}=fo({muxVideo:(E=t.video)==null?void 0:E.muxVideo,videoEl:s,preferMp4:t.preferMp4,useSmallResolution:t.useSmallResolution}),p=()=>{var v;a.value||(h(),(v=s==null?void 0:s.value)==null||v.load(),a.value=!0)},m=v=>{i.value=!v.target.paused&&!v.target.ended&&v.target.readyState>v.target.HAVE_CURRENT_DATA,n.value||(n.value=!0,f("loaded"))},g=()=>{var S,T;const v=(S=s==null?void 0:s.value)==null?void 0:S.play();v!==void 0?v.catch(function(L){}):(T=s==null?void 0:s.value)==null||T.play()};Do(s,([{isIntersecting:v}],S)=>{v?(p(),g()):setTimeout(()=>{var T;(T=s==null?void 0:s.value)==null||T.pause()},100)},{threshold:0});const{trigger:y}=_o(()=>t.preload,v=>{v&&p()});return _t(()=>{y()}),(v,S)=>{var L,b;const T=qs;return ee(),ie("figure",{class:Kt(["VideoLoop",[Y(i)&&"VideoLoop_playing",Y(c)&&"VideoLoop_portrait"]])},[se("video",{ref_key:"videoEl",ref:s,class:"VideoLoop_Video",muted:"",playsinline:"",disablePictureInPicture:"",loop:"",preload:"metadata",width:Y(o),height:Y(l),crossorigin:"anonymous",onCanplay:m,onPlaying:m,onPause:m},null,40,Wf),t.posterImage?(ee(),lt(T,{key:0,image:t.posterImage,alt:((L=t.video)==null?void 0:L.alt)??""},null,8,["image","alt"])):(ee(),ie("img",{key:1,src:Y(u),width:Y(o),height:Y(l),alt:((b=t.video)==null?void 0:b.alt)??"",loading:"lazy"},null,8,qf))],2)}}},ho=qe(jf,[["__scopeId","data-v-9fec90ce"]]),Xf={},Qf=r=>(Ys("data-v-8be40216"),r=r(),Ws(),r),Zf={class:"PlayIcon",width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Jf=Qf(()=>se("path",{d:"M1 0L9 5L1 10V0Z"},null,-1)),eh=[Jf];function th(r,e){return ee(),ie("svg",Zf,eh)}const sh=qe(Xf,[["render",th],["__scopeId","data-v-8be40216"]]),ih={props:{isFullscreen:{type:Boolean,default:()=>!1}}},rh=r=>(Ys("data-v-772491b4"),r=r(),Ws(),r),nh={class:"LoadingIcon",width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ah=rh(()=>se("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5 0C2.23858 0 0 2.23858 0 5C0 7.76142 2.23858 10 5 10C7.76142 10 10 7.76142 10 5H8.5C8.5 6.933 6.933 8.5 5 8.5C3.067 8.5 1.5 6.933 1.5 5C1.5 3.067 3.067 1.5 5 1.5V0Z"},null,-1)),oh=[ah];function lh(r,e,t,s,i,n){return ee(),ie("svg",nh,oh)}const ch=qe(ih,[["render",lh],["__scopeId","data-v-772491b4"]]),dh={},po=r=>(Ys("data-v-60e86e50"),r=r(),Ws(),r),uh={class:"PauseIcon",width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fh=po(()=>se("rect",{x:"1",width:"3",height:"10"},null,-1)),hh=po(()=>se("rect",{x:"6",width:"3",height:"10"},null,-1)),ph=[fh,hh];function mh(r,e){return ee(),ie("svg",uh,ph)}const gh=qe(dh,[["render",mh],["__scopeId","data-v-60e86e50"]]),vh=Po('<path class="FullscreenIcon_Open" d="M4 0H0V4H1.5V1.5H4V0Z" data-v-2d251729></path><path class="FullscreenIcon_Open" d="M6 0V1.5H8.5V4H10V0H6Z" data-v-2d251729></path><path class="FullscreenIcon_Open" d="M10 6H8.5V8.5H6V10H10V6Z" data-v-2d251729></path><path class="FullscreenIcon_Open" d="M1.5 6H0V10H4V8.5H1.5V6Z" data-v-2d251729></path><path class="FullscreenIcon_Close" d="M0 3.99998L4 3.99998L4 -1.51714e-05L2.5 -1.52588e-05V2.5H8.74224e-08L0 3.99998Z" data-v-2d251729></path><path class="FullscreenIcon_Close" d="M10 3.99998V2.5H7.5V-1.52588e-05L6 -1.51714e-05L6 3.99998L10 3.99998Z" data-v-2d251729></path><path class="FullscreenIcon_Close" d="M6 9.99996H7.5V7.5H10V5.99996L6 5.99996L6 9.99996Z" data-v-2d251729></path><path class="FullscreenIcon_Close" d="M2.5 9.99996H4L4 5.99996L8.74224e-08 5.99996L0 7.5H2.5V9.99996Z" data-v-2d251729></path>',8),yh=[vh],Eh={__name:"FullscreenIcon",props:{isFullscreen:{type:Boolean,default:()=>!1}},setup(r){const e=r;return(t,s)=>(ee(),ie("svg",{class:Kt(["FullscreenIcon",{FullscreenIcon_full:e.isFullscreen}]),width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},yh,2))}},xh=qe(Eh,[["__scopeId","data-v-2d251729"]]),Th=["poster","width","height"],Sh={class:"VideoPlayer_Controls"},bh={class:"VideoPlayer_Play"},wh={class:"VideoPlayer_Progress_Container"},Lh=["value","max"],Ah={key:0,class:"VideoPlayer_Time"},Ih={class:"text-sm text_white text_bold"},Rh={class:"text-sm text_white text_bold"},Ch={class:"VideoPlayer_Fullscreen"},Dh={__name:"BaseVideoPlayer",props:{video:{type:Object,required:!0},posterImage:{type:Object,default:()=>{}},showTime:{type:Boolean,default:()=>!1},preferMp4:{type:Boolean,default:()=>!0},useSmallResolution:{type:Boolean,default:()=>!1}},setup(r){var R;const e=r,t=de(),s=de(),i=de(),n=de(!0),a=de(!0),o=de(!1),l=de(0),c=de(0),d=de(0),u=fe(()=>{var _,B,k,M,N;const D=(N=(M=(k=(B=(_=e.video)==null?void 0:_.muxVideo)==null?void 0:B.asset)==null?void 0:k.data)==null?void 0:M.tracks)==null?void 0:N.find(G=>G.type==="video");return D?D.max_width:void 0}),f=fe(()=>{var _,B,k,M,N;const D=(N=(M=(k=(B=(_=e.video)==null?void 0:_.muxVideo)==null?void 0:B.asset)==null?void 0:k.data)==null?void 0:M.tracks)==null?void 0:N.find(G=>G.type==="video");return D?D.max_height:void 0}),h=fe(()=>u&&f?{"aspect-ratio":`${u.value} / ${f.value}`}:{}),{$urlFor:p}=Qt(),m=fe(()=>{var D,_,B,k,M,N,G,U,H;return e.posterImage?p(e.posterImage).width(u.value??1920).url():(B=(_=(D=e.video)==null?void 0:D.muxVideo)==null?void 0:_.asset)!=null&&B.playbackId?`https://image.mux.com/${(N=(M=(k=e.video)==null?void 0:k.muxVideo)==null?void 0:M.asset)==null?void 0:N.playbackId}
36/thumbnail.jpg?time=${((H=(U=(G=e.video)==null?void 0:G.muxVideo)==null?void 0:U.asset)==null?void 0:H.thumbTime)??0}`:""}),{appendVideo:g}=fo({muxVideo:(R=e.video)==null?void 0:R.muxVideo,videoEl:s,preferMp4:e.preferMp4,useSmallResolution:e.useSmallResolution});_t(()=>{g()});const y=()=>{s.value.paused||s.value.ended?s.value.play():s.value.pause()},{isFullscreen:E,toggle:v}=ko(s),S=()=>{a.value=!0},T=fe(()=>{let D=Math.floor(l.value/60);D=D>=10?D:`0${D}`;let _=Math.floor(l.value%60);return _=_>=10?_:`0${_}`,`${D}:${_}`}),L=fe(()=>{let D=Math.floor(c.value/60);D=D>=10?D:`0${D}`;let _=Math.floor(c.value%60);return _=_>=10?_:`0${_}`,`${D}:${_}`}),b=fe(()=>`width: ${d.value}%`),C=()=>{if(!s.value)return!1;c.value=s.value.duration,i.value.setAttribute("max",s.value.duration)},A=()=>{l.value=s.value.currentTime,s.value.ended&&(o.value=!1)},w=D=>{const _=i.value.getBoundingClientRect(),B=(D.pageX-_.left)/i.value.offsetWidth;s.value.currentTime=B*s.value.duration},I=D=>{o.value=D==="playing",n.value&&(n.value=!1)},P=D=>{const _=i.value.getBoundingClientRect(),B=(D.pageX-_.left)/i.value.offsetWidth;d.value=B>0?B*100:0};return(D,_)=>{const B=sh,k=ch,M=gh,N=xh;return ee(),ie("figure",{ref_key:"videoPlayerEl",ref:t,class:Kt(["VideoPlayer",{VideoPlayer_initial:Y(n),VideoPlayer_playing:Y(o)}])},[se("video",{ref_key:"videoEl",ref:s,class:"VideoPlayer_Video",poster:Y(m),width:Y(u),height:Y(f),style:Rs(Y(h)),playsinline:"",preload:"metadata",crossorigin:"anonymous",onLoadeddata:C,onTimeupdate:A,onCanplaythrough:S,onPlaying:_[0]||(_[0]=G=>I("playing")),onPause:_[1]||(_[1]=G=>I("pause"))},null,44,Th),se("button",{class:"VideoPlayer_Cover",onClick:y},[De(B)]),ss(se("ul",Sh,[se("li",bh,[se("button",{class:"VideoPlayer_ControlsButton VideoPlayer_ControlsButton_playpause",onClick:y}
36,[ss(se("span",null,[De(k)],512),[[is,!Y(o)&&!Y(a)]]),ss(se("span",null,[De(B)],512),[[is,!Y(o)&&Y(a)]]),ss(se("span",null,[De(M)],512),[[is,Y(o)]])])]),se("li",{class:"VideoPlayer_Progress",onClick:w,onMousemove:P},[se("div",wh,[se("progress",{ref_key:"progressEl",ref:i,value:Y(l),min:"0",max:Y(c)},null,8,Lh),se("span",{class:"VideoPlayer_Progress_Indicator",style:Rs(Y(b))},null,4)])],32),e.showTime?(ee(),ie("li",Ah,[se("span",Ih,Ae(Y(T))+"Â /Â ",1),se("span",Rh,Ae(Y(L)),1)])):Be("",!0),se("li",Ch,[se("button",{class:"VideoPlayer_ControlsButton",onClick:_[2]||(_[2]=(...G)=>Y(v)&&Y(v)(...G))},[se("span",null,[De(N,{"is-fullscreen":Y(E)},null,8,["is-fullscreen"])])])])],512),[[is,!Y(n)]])],2)}}},_h=qe(Dh,[["__scopeId","data-v-2a4a37fe"]]),Ph={key:0,class:"text-serif"},kh={__name:"Link",props:{linkType:{type:String,default:()=>"externalLink"},href:{type:String,default:()=>""},blank:{type:Boolean,default:()=>!1},route:{type:String,default:()=>""},slug:{type:String,default:()=>""},clickCopy:{type:Boolean,default:()=>!1}},setup(r){const e=Zt(),t=r,s=de(null),i=de(!1),n=de("Click to Copy"),a=fe(()=>({name:t.route??"index",params:t.slug?{slug:t.slug}:{}})),o=d=>{t.href.includes("mailto")&&!e.isMobile&&t.clickCopy&&(s.value=t.href.replace("mailto:",""),i.value=!0)},l=d=>{t.href.includes("mailto")&&!e.isMobile&&t.clickCopy&&(d.preventDefault(),navigator.clipboard.writeText(s.value).then(()=>{n.value="Copied"}).catch(u=>{console.error("Failed to copy text: ",u)}))},c=()=>{i.value=!1,n.value="Click to Copy"};return(d,u)=>{const f=Mo;return ee(),lt(f,{onMouseover:o,onMouseleave:c,onClick:l,to:t.linkType==="externalLink"?t.href:Y(a),target:t.blank&&t.linkType==="externalLink"?"_blank":"",rel:t.blank&&t.linkType==="externalLink"?"noopener":"",class:"link"},{default:ki(()=>[Et(d.$slots,"default",{},void 0,!0),Y(i)?(ee(),ie("span",Ph,Ae(Y(n)),1)):Be("",!0)]),_:3},8,["to","target","rel"])}}},Nn=qe(kh,[["__scopeId","data-v-0ab5e7dc"]]),Mh={key:0,class:"heading-1"},Oh={key:1,class:"heading-2"},Fh={key:2,class:"heading-3"},Nh={key:3,class:"text-sm"},Bh={key:4},gs={__name:"Element",props:{style:{type:String,default:()=>""},children:{type:Object,default:()=>{}}},setup(r){const e=r;return(t,s)=>e.style==="h1"?(ee(),ie("h1",Mh,[Et(t.$slots,"default")])):e.style==="h2"?(ee(),ie("h2",Oh,[Et(t.$slots,"default")])):e.style==="h3"?(ee(),ie("h3",Fh,[Et(t.$slots,"default")])):e.style==="small"?(ee(),ie("p",Nh,[Et(t.$slots,"default")])):(ee(),ie("p",Bh,[Et(t.$slots,"default")]))}},$h={__name:"Content",props:{blocks:{type:Array,default:()=>[]}},setup(r){const e=r,t={types:{pictureTitled:wl,video:ho,videoPlayer:_h},marks:{link:Nn,internalLink:Nn,underline:"u","strike-through":"s"},styles:{normal:"p",h1:gs,h2:gs,h3:gs,small:gs}};return(s,i)=>{const n=jo;return ee(),lt(n,{blocks:e.blocks,serializers:t},null,8,["blocks"])}}};function Bn(r){return r!==null&&typeof r=="object"&&"constructor"in r&&r.constructor===Object}function wr(r,e){r===void 0&&(r={}),e===void 0&&(e={}),Object.keys(e).forEach(t=>{typeof r[t]>"u"?r[t]=e[t]:Bn(e[t])&&Bn(r[t])&&Object.keys(e[t]).length>0&&wr(r[t],e[t])})}const mo={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function Se(){const r=typeof document<"u"?document:{};return wr(r,mo),r}const Uh={document:mo,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(r){return typeof setTimeout>"u"?(r(),null):setTimeout(r,0)},cancelAnimationFrame(r){typeof setTimeout>"u"||clearTimeout(r)}};function he(){const r=typeof window<"u"?window:{};return wr(r,Uh),r}function tt(r){return r===void 0&&(r=""),r.trim().split(" ").filter(e=>!!e.trim())}function Gh(r){const e=r;Object.keys(e).forEach(t=>{try{e[t]=null}catch{}try{delete e[t]}catch{}})}function ft(r,e){return e===void 0&&(e=0),setTimeout(r,e)}function Me(){return Date.now()}function Hh(r){const e=he();let t;return e.getComputedStyle&&(t=e.getComputedStyle(r,null)),!t&&r.currentStyle&&(t=r.currentStyle),t||(t=r.style),t}function er(r,e){e===void 0&&(e="x");const t=he();let s,i,n;const a=Hh(r);return t.WebKitCSSMatrix?(i=a.transform||a.webkitTransform,i.split(",").length>6&&(i=i.split(", ").map(o=>o.replace(",",".")).join(", ")),n=new t.WebKitCSSMatrix(i==="none"?"":i)):(n=a.MozTransform||a.OTransform||a.MsTransform||a.msTransform||a.transform||a.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),s=n.toString().split(",")),e==="x"&&(t.WebKitCSSMatrix?i=n.m41:s.length===16?i=parseFloat(s[12]):i=parseFloat(s[4])),e==="y"&&(t.WebKitCSSMatrix?i=n.m42:s.length===16?i=parseFloat(s[13]):i=parseFloat(s[5])),i||0}function $t(r){return typeof r=="object"&&r!==null&&r.constructor&&Object.prototype.toString.call(r).slice(8,-1)==="Object"}function Vh(r){return typeof window<"u"&&typeof window.HTMLElement<"u"?r instanceof HTMLElement:r&&(r.nodeType===1||r.nodeType===11)}function Ce(){const r=Object(arguments.length<=0?void 0:arguments[0]),e=["__proto__","constructor","prototype"];for(let t=1;t<arguments.length;t+=1){const s=t<0||arguments.length<=t?void 0:arguments[t];if(s!=null&&!Vh(s)){const i=Object.keys(Object(s)).filter(n=>e.indexOf(n)<0);for(let n=0,a=i.length;n<a;n+=1){const o=i[n],l=Object.getOwnPropertyDescriptor(s,o);l!==void 0&&l.enumerable&&($t(r[o])&&$t(s[o])?s[o].__swiper__?r[o]=s[o]:Ce(r[o],s[o]):!$t(r[o])&&$t(s[o])?(r[o]={},s[o].__swiper__?r[o]=s[o]:Ce(r[o],s[o])):r[o]=s[o])}}}return r}function Ut(r,e,t){r.style.setProperty(e,t)}function go(r){let{swiper:e,targetPosition:t,side:s}=r;const i=he(),n=-e.translate;let a=null,o;const l=e.params.speed;e.wrapperEl.style.scrollSnapType="none",i.cancelAnimationFrame(e.cssModeFrameID);const c=t>n?"next":"prev",d=(f,h)=>c==="next"&&f>=h||c==="prev"&&f<=h,u=()=>{o=new Date().getTime(),a===null&&(a=o);const f=Math.max(Math.min((o-a)/l,1),0),h=.5-Math.cos(f*Math.PI)/2;let p=n+h*(t-n);if(d(p,t)&&(p=t),e.wrapperEl.scrollTo({[s]:p}),d(p,t)){e.wrapperEl.style.overflow="hidden",e.wrapperEl.style.scrollSnapType="",setTimeout(()=>{e.wrapperEl.style.overflow="",e.wrapperEl.scrollTo({[s]:p})}),i.cancelAnimationFrame(e.cssModeFrameID);return}e.cssModeFrameID=i.requestAnimationFrame(u)};u()}function ht(r){return r.querySelector(".swiper-slide-transform")||r.shadowRoot&&r.shadowRoot.querySelector(".swiper-slide-transform")||r}function Te(r,e){e===void 0&&(e="");const t=[...r.children];return r instanceof HTMLSlotElement&&t.push(...r.assignedElements()),e?t.filter(s=>s.matches(e)):t}function zh(r,e){const t=e.contains(r);return!t&&e instanceof HTMLSlotElement?[...e.assignedElements()].includes(r):t}function Vs(r){try{console.warn(r);return}catch{}}function _e(r,e){e===void 0&&(e=[]);const t=document.createElement(r);return t.classList.add(...Array.isArray(e)?e:tt(e)),t}function zs(r){const e=he(),t=Se(),s=r.getBoundingClientRect(),i=t.body,n=r.clientTop||i.clientTop||0,a=r.clientLeft||i.clientLeft||0,o=r===e?e.scrollY:r.scrollTop,l=r===e?e.scrollX:r.scrollLeft;return{top:s.top+o-n,left:s.left+l-a}}function Kh(r,e){const t=[];for(;r.previousElementSibling;){const s=r.previousElementSibling;e?s.matches(e)&&t.push(s):t.push(s),r=s}return t}function Yh(r,e){const t=[];for(;r.nextElementSibling;){const s=r.nextElementSibling;e?s.matches(e)&&t.push(s):t.push(s),r=s}return t}function rt(r,e){return he().getComputedStyle(r,null).getPropertyValue(e)}function Xt(r){let e=r,t;if(e){for(t=0;(e=e.previousSibling)!==null;)e.nodeType===1&&(t+=1);return t}}function dt(r,e){const t=[];let s=r.parentElement;for(;s;)e?s.matches(e)&&t.push(s):t.push(s),s=s.parentElement;return t}function zt(r,e){function t(s){s.target===r&&(e.call(r,s),r.removeEventListener("transitionend",t))}e&&r.addEventListener("transitionend",t)}function tr(r,e,t){const s=he();return r[e==="width"?"offsetWidth":"offsetHeight"]+parseFloat(s.getComputedStyle(r,null).getPropertyValue(e==="width"?"margin-right":"margin-top"))+parseFloat(s.getComputedStyle(r,null).getPropertyValue(e==="width"?"margin-left":"margin-bottom"))}function re(r){return(Array.isArray(r)?r:[r]).filter(e=>!!e)}function Qs(r){return e=>Math.abs(e)>0&&r.browser&&r.browser.need3dFix&&Math.abs(e)%90===0?e+.001:e}let Ai;function Wh(){const r=he(),e=Se();return{smoothScroll:e.documentElement&&e.documentElement.style&&"scrollBehavior"in e.documentElement.style,touch:!!("ontouchstart"in r||r.DocumentTouch&&e instanceof r.DocumentTouch)}}function vo(){return Ai||(Ai=Wh()),Ai}let Ii;function qh(r){let{userAgent:e}=r===void 0?{}:r;const t=vo(),s=he(),i=s.navigator.platform,n=e||s.navigator.userAgent,a={ios:!1,android:!1},o=s.screen.width,l=s.screen.height,c=n.match(/(Android);?[\s\/]+([\d.]+)?/);let d=n.match(/(iPad).*OS\s([\d_]+)/);const u=n.match(/(iPod)(.*OS\s([\d_]+))?/),f=!d&&n.match(/(iPhone\sOS|iOS)\s([\d_]+)/),h=i==="Win32";let p=i==="MacIntel";const m=["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"];return!d&&p&&t.touch&&m.indexOf(`${o}x${l}`)>=0&&(d=n.match(/(Version)\/([\d.]+)/),d||(d=[0,1,"13_0_0"]),p=!1),c&&!h&&(a.os="android",a.android=!0),(d||f||u)&&(a.os="ios",a.ios=!0),a}function yo(r){return r===void 0&&(r={}),Ii||(Ii=qh(r)),Ii}let Ri;function jh(){const r=he(),e=yo();let t=!1;function s(){const o=r.navigator.userAgent.toLowerCase();return o.indexOf("safari")>=0&&o.indexOf("chrome")<0&&o.indexOf("android")<0}if(s()){const o=String(r.navigator.userAgent);if(o.includes("Version/")){const[l,c]=o.split("Version/")[1].split(" ")[0].split(".").map(d=>Number(d));t=l<16||l===16&&c<2}}
vendor: 4,260 bytes, line 36
36const i=/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(r.navigator.userAgent),n=s(),a=n||i&&e.ios;return{isSafari:t||n,needPerspectiveFix:t,need3dFix:a,isWebView:i}}function Xh(){return Ri||(Ri=jh()),Ri}function Qh(r){let{swiper:e,on:t,emit:s}=r;const i=he();let n=null,a=null;const o=()=>{!e||e.destroyed||!e.initialized||(s("beforeResize"),s("resize"))},l=()=>{!e||e.destroyed||!e.initialized||(n=new ResizeObserver(u=>{a=i.requestAnimationFrame(()=>{const{width:f,height:h}=e;let p=f,m=h;u.forEach(g=>{let{contentBoxSize:y,contentRect:E,target:v}=g;v&&v!==e.el||(p=E?E.width:(y[0]||y).inlineSize,m=E?E.height:(y[0]||y).blockSize)}),(p!==f||m!==h)&&o()})}),n.observe(e.el))},c=()=>{a&&i.cancelAnimationFrame(a),n&&n.unobserve&&e.el&&(n.unobserve(e.el),n=null)},d=()=>{!e||e.destroyed||!e.initialized||s("orientationchange")};t("init",()=>{if(e.params.resizeObserver&&typeof i.ResizeObserver<"u"){l();return}i.addEventListener("resize",o),i.addEventListener("orientationchange",d)}),t("destroy",()=>{c(),i.removeEventListener("resize",o),i.removeEventListener("orientationchange",d)})}function Zh(r){let{swiper:e,extendParams:t,on:s,emit:i}=r;const n=[],a=he(),o=function(d,u){u===void 0&&(u={});const f=a.MutationObserver||a.WebkitMutationObserver,h=new f(p=>{if(e.__preventObserver__)return;if(p.length===1){i("observerUpdate",p[0]);return}const m=function(){i("observerUpdate",p[0])};a.requestAnimationFrame?a.requestAnimationFrame(m):a.setTimeout(m,0)});h.observe(d,{attributes:typeof u.attributes>"u"?!0:u.attributes,childList:e.isElement||(typeof u.childList>"u"?!0:u).childList,characterData:typeof u.characterData>"u"?!0:u.characterData}),n.push(h)},l=()=>{if(e.params.observer){if(e.params.observeParents){const d=dt(e.hostEl);for(let u=0;u<d.length;u+=1)o(d[u])}o(e.hostEl,{childList:e.params.observeSlideChildren}),o(e.wrapperEl,{attributes:!1})}},c=()=>{n.forEach(d=>{d.disconnect()}),n.splice(0,n.length)};t({observer:!1,observeParents:!1,observeSlideChildren:!1}),s("init",l),s("destroy",c)}var Jh={on(r,e,t){const s=this;if(!s.eventsListeners||s.destroyed||typeof e!="function")return s;const i=t?"unshift":"push";return r.split(" ").forEach(n=>{s.eventsListeners[n]||(s.eventsListeners[n]=[]),s.eventsListeners[n][i](e)}),s},once(r,e,t){const s=this;if(!s.eventsListeners||s.destroyed||typeof e!="function")return s;function i(){s.off(r,i),i.__emitterProxy&&delete i.__emitterProxy;for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];e.apply(s,a)}return i.__emitterProxy=e,s.on(r,i,t)},onAny(r,e){const t=this;if(!t.eventsListeners||t.destroyed||typeof r!="function")return t;const s=e?"unshift":"push";return t.eventsAnyListeners.indexOf(r)<0&&t.eventsAnyListeners[s](r),t},offAny(r){const e=this;if(!e.eventsListeners||e.destroyed||!e.eventsAnyListeners)return e;const t=e.eventsAnyListeners.indexOf(r);return t>=0&&e.eventsAnyListeners.splice(t,1),e},off(r,e){const t=this;return!t.eventsListeners||t.destroyed||!t.eventsListeners||r.split(" ").forEach(s=>{typeof e>"u"?t.eventsListeners[s]=[]:t.eventsListeners[s]&&t.eventsListeners[s].forEach((i,n)=>{(i===e||i.__emitterProxy&&i.__emitterProxy===e)&&t.eventsListeners[s].splice(n,1)})}),t},emit(){const r=this;if(!r.eventsListeners||r.destroyed||!r.eventsListeners)return r;let e,t,s;for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return typeof n[0]=="string"||Array.isArray(n[0])?(e=n[0],t=n.slice(1,n.length),s=r):(e=n[0].events,t=n[0].data,s=n[0].context||r),t.unshift(s),(Array.isArray(e)?e:e.split(" ")).forEach(l=>{r.eventsAnyListeners&&r.eventsAnyListeners.length&&r.eventsAnyListeners.forEach(c=>{c.apply(s,[l,...t])}),r.eventsListeners&&r.eventsListeners[l]&&r.eventsListeners[l].forEach(c=>{c.apply(s,t)})}),r}};function ep(){const r=this;let e,t;const s=r.el;typeof r.params.width<"u"&&r.params.width!==null?e=r.params.width:e=s.clientWidth,typeof r.params.height<"u"&&r.params.height!==null?t=r.params.height:t=s.clientHeight,!(e===0&&r.isHorizontal()||t===0&&r.isVertical())&&(e=e-parseInt(rt(s,"padding-left")||0,10)-parseInt(rt(s,"padding-right")||0,10),t=t-parseInt(rt(s,"padding-top")||0,10)-parseInt(rt(s,"padding-bottom")||0,10),Number.isNaN(e)&&(e=0),Number.isNaN(t)&&(t=0),Object.assign(r,{width:e,height:t,size:r.isH
36orizontal()?e:t}))}function tp(){const r=this;function e(w,I){return parseFloat(w.getPropertyValue(r.getDirectionLabel(I))||0)}const t=r.params,{wrapperEl:s,slidesEl:i,size:n,rtlTranslate:a,wrongRTL:o}=r,l=r.virtual&&t.virtual.enabled,c=l?r.virtual.slides.length:r.slides.length,d=Te(i,`.${r.params.slideClass}, swiper-slide`),u=l?r.virtual.slides.length:d.length;let f=[];const h=[],p=[];let m=t.slidesOffsetBefore;typeof m=="function"&&(m=t.slidesOffsetBefore.call(r));let g=t.slidesOffsetAfter;typeof g=="function"&&(g=t.slidesOffsetAfter.call(r));const y=r.snapGrid.length,E=r.slidesGrid.length;let v=t.spaceBetween,S=-m,T=0,L=0;if(typeof n>"u")return;typeof v=="string"&&v.indexOf("%")>=0?v=parseFloat(v.replace("%",""))/100*n:typeof v=="string"&&(v=parseFloat(v)),r.virtualSize=-v,d.forEach(w=>{a?w.style.marginLeft="":w.style.marginRight="",w.style.marginBottom="",w.style.marginTop=""}),t.centeredSlides&&t.cssMode&&(Ut(s,"--swiper-centered-offset-before",""),Ut(s,"--swiper-centered-offset-after",""));const b=t.grid&&t.grid.rows>1&&r.grid;b?r.grid.initSlides(d):r.grid&&r.grid.unsetSlides();let C;const A=t.slidesPerView==="auto"&&t.breakpoints&&Object.keys(t.breakpoints).filter(w=>typeof t.breakpoints[w].slidesPerView<"u").length>0;for(let w=0;w<u;w+=1){C=0;let I;if(d[w]&&(I=d[w]),b&&r.grid.updateSlide(w,I,d),!(d[w]&&rt(I,"display")==="none")){if(t.slidesPerView==="auto"){A&&(d[w].style[r.getDirectionLabel("width")]="");const P=getComputedStyle(I),R=I.style.transform,D=I.style.webkitTransform;if(R&&(I.style.transform="none"),D&&(I.style.webkitTransform="none"),t.roundLengths)C=r.isHorizontal()?tr(I,"width"):tr(I,"height");else{const _=e(P,"width"),B=e(P,"padding-left"),k=e(P,"padding-right"),M=e(P,"margin-left"),N=e(P,"margin-right"),G=P.getPropertyValue("box-sizing");if(G&&G==="border-box")C=_+M+N;else{const{clientWidth:U,offsetWidth:H}=I;C=_+B+k+M+N+(H-U)}}R&&(I.style.transform=R),D&&(I.style.webkitTransform=D),t.roundLengths&&(C=Math.floor(C))}else C=(n-(t.slidesPerView-1)*v)/t.slidesPerView,t.roundLengths&&(C=Math.floor(C)),d[w]&&(d[w].style[r.getDirectionLabel("width")]=`${C}px`);d[w]&&(d[w].swiperSlideSize=C),p.push(C),t.centeredSlides?(S=S+C/2+T/2+v,T===0&&w!==0&&(S=S-n/2-v),w===0&&(S=S-n/2-v),Math.abs(S)<1/1e3&&(S=0),t.roundLengths&&(S=Math.floor(S)),L%t.slidesPerGroup===0&&f.push(S),h.push(S)):(t.roundLengths&&(S=Math.floor(S)),(L-Math.min(r.params.slidesPerGroupSkip,L))%r.params.slidesPerGroup===0&&f.push(S),h.push(S),S=S+C+v),r.virtualSize+=C+v,T=C,L+=1}}if(r.virtualSize=Math.max(r.virtualSize,n)+g,a&&o&&(t.effect==="slide"||t.effect==="coverflow")&&(s.style.width=`${r.virtualSize+v}px`),t.setWrapperSize&&(s.style[r.getDirectionLabel("width")]=`${r.virtualSize+v}px`),b&&r.grid.updateWrapperSize(C,f),!t.centeredSlides){const w=[];for(let I=0;I<f.length;I+=1){let P=f[I];t.roundLengths&&(P=Math.floor(P)),f[I]<=r.virtualSize-n&&w.push(P)}f=w,Math.floor(r.virtualSize-n)-Math.floor(f[f.length-1])>1&&f.push(r.virtualSize-n)}if(l&&t.loop){const w=p[0]+v;if(t.slidesPerGroup>1){const I=Math.ceil((r.virtual.slidesBefore+r.virtual.slidesAfter)/t.slidesPerGroup),P=w*t.slidesPerGroup;for(let R=0;R<I;R+=1)f.push(f[f.length-1]+P)}for(let I=0;I<r.virtual.slidesBefore+r.virtual.slidesAfter;I+=1)t.slidesPerGroup===1&&f.push(f[f.length-1]+w),h.push(h[h.length-1]+w),r.virtualSize+=w}if(f.length===0&&(f=[0]),v!==0){const w=r.isHorizontal()&&a?"marginLeft":r.getDirectionLabel("marginRight");d.filter((I,P)=>!t.cssMode||t.loop?!0:P!==d.length-1).forEach(I=>{I.style[w]=`${v}px`})}if(t.centeredSlides&&t.centeredSlidesBounds){let w=0;p.forEach(P=>{w+=P+(v||0)}),w-=v;const I=w>n?w-n:0;f=f.map(P=>P<=0?-m:P>I?I+g:P)}if(t.centerInsufficientSlides){let w=0;p.forEach(P=>{w+=P+(v||0)}),w-=v;const I=(t.slidesOffsetBefore||0)+(t.slidesOffsetAfter||0);if(w+I<n){const P=(n-w-I)/2;f.forEach((R,D)=>{f[D]=R-P}),h.forEach((R,D)=>{h[D]=R+P})}}if(Object.assign(r,{slides:d,snapGrid:f,slidesGrid:h,slidesSizesGrid:p}),t.centeredSlides&&t.cssMode&&!t.centeredSlidesBounds){Ut(s,"--swiper-centered-offset-before",`${-f[0]}px`),Ut(s,"--swiper-centered-offset-after",`${r.size/2-p[p.length-1]/2}px`);const w=-r.snapGrid[0],I=-r.slidesGrid[0];r.snapGrid=r.snapGrid.map(P=>P+w),r.slidesGrid=r.slidesGrid.map(P=>P+I)}if(u!==c&&r.emit("slidesLengthChange"),f.length!==y&&(r.params.watchOverflow&&r.checkOverflow(),r.emit("snapGridLengthChange")),h.length!==E&&r.emit("slidesGridLengthChange"),t.watchSlidesProgress&&r.updateSlidesOffset(),r.emit("slidesUpdated"),!l&&!t.cssMode&&(t.effect==="slide"||t.effect==="fade")){const w=`${t.containerModifierClass}backface-hidden`,I=r.el.classList.contains(w);u<=t.maxBackfaceHiddenSlides?I||r.el.classList.add(w):I&&r.el.classList.remove(w)}}function sp(r){const e=this,t=[],s=e.virtual&&e.params.virtual.enabled;let i=0,n;typeof r=="number"?e.setTransition(r):r===!0&&e.setTransition(e.params.speed);const a=o=>s?e.slides[e.getSlideIndexByData(o)]:e.slides[o];if(e.params.slidesPerView!=="auto"&&e.params.slidesPerView>
vendor: 6,406 bytes, line 36
361)if(e.params.centeredSlides)(e.visibleSlides||[]).forEach(o=>{t.push(o)});else for(n=0;n<Math.ceil(e.params.slidesPerView);n+=1){const o=e.activeIndex+n;if(o>e.slides.length&&!s)break;t.push(a(o))}else t.push(a(e.activeIndex));for(n=0;n<t.length;n+=1)if(typeof t[n]<"u"){const o=t[n].offsetHeight;i=o>i?o:i}(i||i===0)&&(e.wrapperEl.style.height=`${i}px`)}function ip(){const r=this,e=r.slides,t=r.isElement?r.isHorizontal()?r.wrapperEl.offsetLeft:r.wrapperEl.offsetTop:0;for(let s=0;s<e.length;s+=1)e[s].swiperSlideOffset=(r.isHorizontal()?e[s].offsetLeft:e[s].offsetTop)-t-r.cssOverflowAdjustment()}const $n=(r,e,t)=>{e&&!r.classList.contains(t)?r.classList.add(t):!e&&r.classList.contains(t)&&r.classList.remove(t)};function rp(r){r===void 0&&(r=this&&this.translate||0);const e=this,t=e.params,{slides:s,rtlTranslate:i,snapGrid:n}=e;if(s.length===0)return;typeof s[0].swiperSlideOffset>"u"&&e.updateSlidesOffset();let a=-r;i&&(a=r),e.visibleSlidesIndexes=[],e.visibleSlides=[];let o=t.spaceBetween;typeof o=="string"&&o.indexOf("%")>=0?o=parseFloat(o.replace("%",""))/100*e.size:typeof o=="string"&&(o=parseFloat(o));for(let l=0;l<s.length;l+=1){const c=s[l];let d=c.swiperSlideOffset;t.cssMode&&t.centeredSlides&&(d-=s[0].swiperSlideOffset);const u=(a+(t.centeredSlides?e.minTranslate():0)-d)/(c.swiperSlideSize+o),f=(a-n[0]+(t.centeredSlides?e.minTranslate():0)-d)/(c.swiperSlideSize+o),h=-(a-d),p=h+e.slidesSizesGrid[l],m=h>=0&&h<=e.size-e.slidesSizesGrid[l],g=h>=0&&h<e.size-1||p>1&&p<=e.size||h<=0&&p>=e.size;g&&(e.visibleSlides.push(c),e.visibleSlidesIndexes.push(l)),$n(c,g,t.slideVisibleClass),$n(c,m,t.slideFullyVisibleClass),c.progress=i?-u:u,c.originalProgress=i?-f:f}}function np(r){const e=this;if(typeof r>"u"){const d=e.rtlTranslate?-1:1;r=e&&e.translate&&e.translate*d||0}const t=e.params,s=e.maxTranslate()-e.minTranslate();let{progress:i,isBeginning:n,isEnd:a,progressLoop:o}=e;const l=n,c=a;if(s===0)i=0,n=!0,a=!0;else{i=(r-e.minTranslate())/s;const d=Math.abs(r-e.minTranslate())<1,u=Math.abs(r-e.maxTranslate())<1;n=d||i<=0,a=u||i>=1,d&&(i=0),u&&(i=1)}if(t.loop){const d=e.getSlideIndexByData(0),u=e.getSlideIndexByData(e.slides.length-1),f=e.slidesGrid[d],h=e.slidesGrid[u],p=e.slidesGrid[e.slidesGrid.length-1],m=Math.abs(r);m>=f?o=(m-f)/p:o=(m+p-h)/p,o>1&&(o-=1)}Object.assign(e,{progress:i,progressLoop:o,isBeginning:n,isEnd:a}),(t.watchSlidesProgress||t.centeredSlides&&t.autoHeight)&&e.updateSlidesProgress(r),n&&!l&&e.emit("reachBeginning toEdge"),a&&!c&&e.emit("reachEnd toEdge"),(l&&!n||c&&!a)&&e.emit("fromEdge"),e.emit("progress",i)}const Ci=(r,e,t)=>{e&&!r.classList.contains(t)?r.classList.add(t):!e&&r.classList.contains(t)&&r.classList.remove(t)};function ap(){const r=this,{slides:e,params:t,slidesEl:s,activeIndex:i}=r,n=r.virtual&&t.virtual.enabled,a=r.grid&&t.grid&&t.grid.rows>1,o=u=>Te(s,`.${t.slideClass}${u}, swiper-slide${u}`)[0];let l,c,d;if(n)if(t.loop){let u=i-r.virtual.slidesBefore;u<0&&(u=r.virtual.slides.length+u),u>=r.virtual.slides.length&&(u-=r.virtual.slides.length),l=o(`[data-swiper-slide-index="${u}"]`)}else l=o(`[data-swiper-slide-index="${i}"]`);else a?(l=e.filter(u=>u.column===i)[0],d=e.filter(u=>u.column===i+1)[0],c=e.filter(u=>u.column===i-1)[0]):l=e[i];l&&(a||(d=Yh(l,`.${t.slideClass}, swiper-slide`)[0],t.loop&&!d&&(d=e[0]),c=Kh(l,`.${t.slideClass}, swiper-slide`)[0],t.loop&&!c===0&&(c=e[e.length-1]))),e.forEach(u=>{Ci(u,u===l,t.slideActiveClass),Ci(u,u===d,t.slideNextClass),Ci(u,u===c,t.slidePrevClass)}),r.emitSlidesClasses()}const As=(r,e)=>{if(!r||r.destroyed||!r.params)return;const t=()=>r.isElement?"swiper-slide":`.${r.params.slideClass}`,s=e.closest(t());if(s){let i=s.querySelector(`.${r.params.lazyPreloaderClass}`);!i&&r.isElement&&(s.shadowRoot?i=s.shadowRoot.querySelector(`.${r.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{s.shadowRoot&&(i=s.shadowRoot.querySelector(`.${r.params.lazyPreloaderClass}`),i&&i.remove())})),i&&i.remove()}},Di=(r,e)=>{if(!r.slides[e])return;const t=r.slides[e].querySelector('[loading="lazy"]');t&&t.removeAttribute("loading")},sr=r=>{if(!r||r.destroyed||!r.params)return;let e=r.params.lazyPreloadPrevNext;const t=r.slides.length;if(!t||!e||e<0)return;e=Math.min(e,t);const s=r.params.slidesPerView==="auto"?r.slidesPerViewDynamic():Math.ceil(r.params.slidesPerView),i=r.activeIndex;if(r.params.grid&&r.params.grid.rows>1){const a=i,o=[a-e];o.push(...Array.from({length:e}).map((l,c)=>a+s+c)),r.slides.forEach((l,c)=>{o.includes(l.column)&&Di(r,c)});return}const n=i+s-1;if(r.params.rewind||r.params.loop)for(let a=i-e;a<=n+e;a+=1){const o=(a%t+t)%t;(o<i||o>n)&&Di(r,o)}else for(let a=Math.max(i-e,0);a<=Math.min(n+e,t-1);a+=1)a!==i&&(a>n||a<i)&&Di(r,a)};function op(r){const{slidesGrid:e,params:t}=r,s=r.rtlTranslate?r.translate:-r.translate;let i;for(let n=0;n<e.length;n+=1)typeof e[n+1]<"u"?s>=e[n]&&s<e[n+1]-(e[n+1]-e[n])/2?i=n:s>=e[n]&&s<e[n+1]&&(i=n+1):s>=e[n]&&(i=n);return t.normalizeSlideIndex&&(i<0||typeof i>"u")&&(i=0),i}function lp(r){const e=this,t=e.rtlTranslate?e.translate:-e.translate,{snapGrid:s,params:i,activeIndex:n,realIndex:a,snapIndex:o}=e;let l=r,c;const d=h=>{let p=h-e.virtual.slidesBefore;return p<0&&(p=e.virtual.slides.length+p),p>=e.virtual.slides.length&&(p-=e.virtual.slides.length),p};if(typeof l>"u"&&(l=op(e)),s.indexOf(t)>=0)c=s.indexOf(t);else{const h=Math.min(i.slidesPerGroupSkip,l);c=h+Math.floor((l-h)/i.slidesPerGroup)}if(c>=s.length&&(c=s.length-1),l===n&&!e.params.loop){c!==o&&(e.snapIndex=c,e.emit("snapIndexChange"));return}if(l===n&&e.params.loop&&e.virtual&&e.params.virtual.enabled){e.realIndex=d(l);return}const u=e.grid&&i.grid&&i.grid.rows>1;let f;if(e.virtual&&i.virtual.enabled&&i.loop)f=d(l);else if(u){const h=e.slides.filter(m=>m.column===l)[0];let p=parseInt(h.getAttribute("data-swiper-slide-index"),10);Number.isNaN(p)&&(p=Math.max(e.slides.indexOf(h),0)),f=Math.floor(p/i.grid.rows)}else if(e.slides[l]){const h=e.slides[l].getAttribute("data-swiper-slide-index");h?f=parseInt(h,10):f=l}else f=l;Object.assign(e,{previousSnapIndex:o,snapIndex:c,previousRealIndex:a,realIndex:f,previousIndex:n,activeIndex:l}),e.initialized&&sr(e),e.emit("activeIndexChange"),e.emit("snapIndexChange"),(e.initialized||e.params.runCallbacksOnInit)&&(a!==f&&e.emit("realIndexChange"),e.emit("slideChange"))}function cp(r,e){const t=this,s=t.params;let i=r.closest(`.${s.slideClass}, swiper-slide`);!i&&t.isElement&&e&&e.length>
361&&e.includes(r)&&[...e.slice(e.indexOf(r)+1,e.length)].forEach(o=>{!i&&o.matches&&o.matches(`.${s.slideClass}, swiper-slide`)&&(i=o)});let n=!1,a;if(i){for(let o=0;o<t.slides.length;o+=1)if(t.slides[o]===i){n=!0,a=o;break}}if(i&&n)t.clickedSlide=i,t.virtual&&t.params.virtual.enabled?t.clickedIndex=parseInt(i.getAttribute("data-swiper-slide-index"),10):t.clickedIndex=a;else{t.clickedSlide=void 0,t.clickedIndex=void 0;return}s.slideToClickedSlide&&t.clickedIndex!==void 0&&t.clickedIndex!==t.activeIndex&&t.slideToClickedSlide()}var dp={updateSize:ep,updateSlides:tp,updateAutoHeight:sp,updateSlidesOffset:ip,updateSlidesProgress:rp,updateProgress:np,updateSlidesClasses:ap,updateActiveIndex:lp,updateClickedSlide:cp};function up(r){r===void 0&&(r=this.isHorizontal()?"x":"y");const e=this,{params:t,rtlTranslate:s,translate:i,wrapperEl:n}=e;if(t.virtualTranslate)return s?-i:i;if(t.cssMode)return i;let a=er(n,r);return a+=e.cssOverflowAdjustment(),s&&(a=-a),a||0}function fp(r,e){const t=this,{rtlTranslate:s,params:i,wrapperEl:n,progress:a}=t;let o=0,l=0;const c=0;t.isHorizontal()?o=s?-r:r:l=r,i.roundLengths&&(o=Math.floor(o),l=Math.floor(l)),t.previousTranslate=t.translate,t.translate=t.isHorizontal()?o:l,i.cssMode?n[t.isHorizontal()?"scrollLeft":"scrollTop"]=t.isHorizontal()?-o:-l:i.virtualTranslate||(t.isHorizontal()?o-=t.cssOverflowAdjustment():l-=t.cssOverflowAdjustment(),n.style.transform=`translate3d(${o}px, ${l}px, ${c}px)`);let d;const u=t.maxTranslate()-t.minTranslate();u===0?d=0:d=(r-t.minTranslate())/u,d!==a&&t.updateProgress(r),t.emit("setTranslate",t.translate,e)}function hp(){return-this.snapGrid[0]}function pp(){return-this.snapGrid[this.snapGrid.length-1]}function mp(r,e,t,s,i){r===void 0&&(r=0),e===void 0&&(e=this.params.speed),t===void 0&&(t=!0),s===void 0&&(s=!0);const n=this,{params:a,wrapperEl:o}=n;if(n.animating&&a.preventInteractionOnTransition)return!1;const l=n.minTranslate(),c=n.maxTranslate();let d;if(s&&r>l?d=l:s&&r<c?d=c:d=r,n.updateProgress(d),a.cssMode){const u=n.isHorizontal();if(e===0)o[u?"scrollLeft":"scrollTop"]=-d;else{if(!n.support.smoothScroll)return go({swiper:n,targetPosition:-d,side:u?"left":"top"}),!0;o.scrollTo({[u?"left":"top"]:-d,behavior:"smooth"})}return!0}return e===0?(n.setTransition(0),n.setTranslate(d),t&&(n.emit("beforeTransitionStart",e,i),n.emit("transitionEnd"))):(n.setTransition(e),n.setTranslate(d),t&&(n.emit("beforeTransitionStart",e,i),n.emit("transitionStart")),n.animating||(n.animating=!0,n.onTranslateToWrapperTransitionEnd||(n.onTranslateToWrapperTransitionEnd=function(f){!n||n.destroyed||f.target===this&&(n.wrapperEl.removeEventListener("transitionend",n.onTranslateToWrapperTransitionEnd),n.onTranslateToWrapperTransitionEnd=null,delete n.onTranslateToWrapperTransitionEnd,n.animating=!1,t&&n.emit("transitionEnd"))}),n.wrapperEl.addEventListener("transitionend",n.onTranslateToWrapperTransitionEnd))),!0}var gp={getTranslate:up,setTranslate:fp,minTranslate:hp,maxTranslate:pp,translateTo:mp};function vp(r,e){const t=this;t.params.cssMode||(t.wrapperEl.style.transitionDuration=`${r}ms`,t.wrapperEl.style.transitionDelay=r===0?"0ms":""),t.emit("setTransition",r,e)}function Eo(r){let{swiper:e,runCallbacks:t,direction:s,step:i}=r;const{activeIndex:n,previousIndex:a}=e;let o=s;if(o||(n>a?o="next":n<a?o="prev":o="reset"),e.emit(`transition${i}`),t&&n!==a){if(o==="reset"){e.emit(`slideResetTransition${i}`);return}e.emit(`slideChangeTransition${i}`),o==="next"?e.emit(`slideNextTransition${i}`):e.emit(`slidePrevTransition${i}`)}}function yp(r,e){r===void 0&&(r=!0);const t=this,{params:s}=t;s.cssMode||(s.autoHeight&&t.updateAutoHeight(),Eo({swiper:t,runCallbacks:r,direction:e,step:"Start"}))}function Ep(r,e){r===void 0&&(r=!0);const t=this,{params:s}=t;t.animating=!1,!s.cssMode&&(t.setTransition(0),Eo({swiper:t,runCallbacks:r,direction:e,step:"End"}))}var xp={setTransition:vp,transitionStart:yp,transitionEnd:Ep};function Tp(r,e,t,s,i){r===void 0&&(r=0),t===void 0&&(t=!0),typeof r=="string"&&(r=parseInt(r,10));const n=this;let a=r;a<0&&(a=0);const{params:o,snapGrid:l,slidesGrid:c,previousIndex:d,activeIndex:u,rtlTranslate:f,wrapperEl:h,enabled:p}=n;
vendor: 4,617 bytes, line 36
36if(!p&&!s&&!i||n.destroyed||n.animating&&o.preventInteractionOnTransition)return!1;typeof e>"u"&&(e=n.params.speed);const m=Math.min(n.params.slidesPerGroupSkip,a);let g=m+Math.floor((a-m)/n.params.slidesPerGroup);g>=l.length&&(g=l.length-1);const y=-l[g];if(o.normalizeSlideIndex)for(let T=0;T<c.length;T+=1){const L=-Math.floor(y*100),b=Math.floor(c[T]*100),C=Math.floor(c[T+1]*100);typeof c[T+1]<"u"?L>=b&&L<C-(C-b)/2?a=T:L>=b&&L<C&&(a=T+1):L>=b&&(a=T)}if(n.initialized&&a!==u&&(!n.allowSlideNext&&(f?y>n.translate&&y>n.minTranslate():y<n.translate&&y<n.minTranslate())||!n.allowSlidePrev&&y>n.translate&&y>n.maxTranslate()&&(u||0)!==a))return!1;a!==(d||0)&&t&&n.emit("beforeSlideChangeStart"),n.updateProgress(y);let E;a>u?E="next":a<u?E="prev":E="reset";const v=n.virtual&&n.params.virtual.enabled;if(!(v&&i)&&(f&&-y===n.translate||!f&&y===n.translate))return n.updateActiveIndex(a),o.autoHeight&&n.updateAutoHeight(),n.updateSlidesClasses(),o.effect!=="slide"&&n.setTranslate(y),E!=="reset"&&(n.transitionStart(t,E),n.transitionEnd(t,E)),!1;if(o.cssMode){const T=n.isHorizontal(),L=f?y:-y;if(e===0)v&&(n.wrapperEl.style.scrollSnapType="none",n._immediateVirtual=!0),v&&!n._cssModeVirtualInitialSet&&n.params.initialSlide>0?(n._cssModeVirtualInitialSet=!0,requestAnimationFrame(()=>{h[T?"scrollLeft":"scrollTop"]=L})):h[T?"scrollLeft":"scrollTop"]=L,v&&requestAnimationFrame(()=>{n.wrapperEl.style.scrollSnapType="",n._immediateVirtual=!1});else{if(!n.support.smoothScroll)return go({swiper:n,targetPosition:L,side:T?"left":"top"}),!0;h.scrollTo({[T?"left":"top"]:L,behavior:"smooth"})}return!0}return n.setTransition(e),n.setTranslate(y),n.updateActiveIndex(a),n.updateSlidesClasses(),n.emit("beforeTransitionStart",e,s),n.transitionStart(t,E),e===0?n.transitionEnd(t,E):n.animating||(n.animating=!0,n.onSlideToWrapperTransitionEnd||(n.onSlideToWrapperTransitionEnd=function(L){!n||n.destroyed||L.target===this&&(n.wrapperEl.removeEventListener("transitionend",n.onSlideToWrapperTransitionEnd),n.onSlideToWrapperTransitionEnd=null,delete n.onSlideToWrapperTransitionEnd,n.transitionEnd(t,E))}),n.wrapperEl.addEventListener("transitionend",n.onSlideToWrapperTransitionEnd)),!0}function Sp(r,e,t,s){r===void 0&&(r=0),t===void 0&&(t=!0),typeof r=="string"&&(r=parseInt(r,10));const i=this;if(i.destroyed)return;typeof e>"u"&&(e=i.params.speed);const n=i.grid&&i.params.grid&&i.params.grid.rows>1;let a=r;if(i.params.loop)if(i.virtual&&i.params.virtual.enabled)a=a+i.virtual.slidesBefore;else{let o;if(n){const f=a*i.params.grid.rows;o=i.slides.filter(h=>h.getAttribute("data-swiper-slide-index")*1===f)[0].column}else o=i.getSlideIndexByData(a);const l=n?Math.ceil(i.slides.length/i.params.grid.rows):i.slides.length,{centeredSlides:c}=i.params;let d=i.params.slidesPerView;d==="auto"?d=i.slidesPerViewDynamic():(d=Math.ceil(parseFloat(i.params.slidesPerView,10)),c&&d%2===0&&(d=d+1));let u=l-o<d;if(c&&(u=u||o<Math.ceil(d/2)),s&&c&&i.params.slidesPerView!=="auto"&&!n&&(u=!1),u){const f=c?o<i.activeIndex?"prev":"next":o-i.activeIndex-1<i.params.slidesPerView?"next":"prev";i.loopFix({direction:f,slideTo:!0,activeSlideIndex:f==="next"?o+1:o-l+1,slideRealIndex:f==="next"?i.realIndex:void 0})}if(n){const f=a*i.params.grid.rows;a=i.slides.filter(h=>h.getAttribute("data-swiper-slide-index")*1===f)[0].column}else a=i.getSlideIndexByData(a)}return requestAnimationFrame(()=>{i.slideTo(a,e,t,s)}),i}function bp(r,e,t){e===void 0&&(e=!0);const s=this,{enabled:i,params:n,animating:a}=s;if(!i||s.destroyed)return s;typeof r>"u"&&(r=s.params.speed);let o=n.slidesPerGroup;n.slidesPerView==="auto"&&n.slidesPerGroup===1&&n.slidesPerGroupAuto&&(o=Math.max(s.slidesPerViewDynamic("current",!0),1));const l=s.activeIndex<n.slidesPerGroupSkip?1:o,c=s.virtual&&n.virtual.enabled;if(n.loop){if(a&&!c&&n.loopPreventsSliding)return!1;if(s.loopFix({direction:"next"}),s._clientLeft=s.wrapperEl.clientLeft,s.activeIndex===s.slides.length-1&&n.cssMode)return requestAnimationFrame(()=>{s.slideTo(s.activeIndex+l,r,e,t)}),!0}return n.rewind&&s.isEnd?s.slideTo(0,r,e,t):s.slideTo(s.activeIndex+l,r,e,t)}function wp(r,e,t){e===void 0&&(e=!0);const s=this,{params:i,snapGrid:n,slidesGrid:a,rtlTranslate:o,enabled:l,animating:c}=s;if(!l||s.destroyed)return s;typeof r>"u"&&(r=s.params.speed);const d=s.virtual&&i.virtual.enabled;if(i.loop){if(c&&!d&&i.loopPreventsSliding)return!1;s.loopFix({direction:"prev"}),s._clientLeft=s.wrapperEl.clientLeft}const u=o?s.translate:-s.translate;function f(y){return y<0?-Math.floor(Math.abs(y)):Math.floor(y)}const h=f(u),p=n.map(y=>f(y));let m=n[p.indexOf(h)-1];if(typeof m>"u"&&i.cssMode){let y;
36n.forEach((E,v)=>{h>=E&&(y=v)}),typeof y<"u"&&(m=n[y>0?y-1:y])}let g=0;if(typeof m<"u"&&(g=a.indexOf(m),g<0&&(g=s.activeIndex-1),i.slidesPerView==="auto"&&i.slidesPerGroup===1&&i.slidesPerGroupAuto&&(g=g-s.slidesPerViewDynamic("previous",!0)+1,g=Math.max(g,0))),i.rewind&&s.isBeginning){const y=s.params.virtual&&s.params.virtual.enabled&&s.virtual?s.virtual.slides.length-1:s.slides.length-1;return s.slideTo(y,r,e,t)}else if(i.loop&&s.activeIndex===0&&i.cssMode)return requestAnimationFrame(()=>{s.slideTo(g,r,e,t)}),!0;return s.slideTo(g,r,e,t)}function Lp(r,e,t){e===void 0&&(e=!0);const s=this;if(!s.destroyed)return typeof r>"u"&&(r=s.params.speed),s.slideTo(s.activeIndex,r,e,t)}function Ap(r,e,t,s){e===void 0&&(e=!0),s===void 0&&(s=.5);const i=this;if(i.destroyed)return;typeof r>"u"&&(r=i.params.speed);let n=i.activeIndex;const a=Math.min(i.params.slidesPerGroupSkip,n),o=a+Math.floor((n-a)/i.params.slidesPerGroup),l=i.rtlTranslate?i.translate:-i.translate;if(l>=i.snapGrid[o]){const c=i.snapGrid[o],d=i.snapGrid[o+1];l-c>(d-c)*s&&(n+=i.params.slidesPerGroup)}else{const c=i.snapGrid[o-1],d=i.snapGrid[o];l-c<=(d-c)*s&&(n-=i.params.slidesPerGroup)}return n=Math.max(n,0),n=Math.min(n,i.slidesGrid.length-1),i.slideTo(n,r,e,t)}function Ip(){const r=this;if(r.destroyed)return;const{params:e,slidesEl:t}=r,s=e.slidesPerView==="auto"?r.slidesPerViewDynamic():e.slidesPerView;let i=r.clickedIndex,n;const a=r.isElement?"swiper-slide":`.${e.slideClass}`;if(e.loop){if(r.animating)return;n=parseInt(r.clickedSlide.getAttribute("data-swiper-slide-index"),10),e.centeredSlides?i<r.loopedSlides-s/2||i>r.slides.length-r.loopedSlides+s/2?(r.loopFix(),i=r.getSlideIndex(Te(t,`${a}[data-swiper-slide-index="${n}"]`)[0]),ft(()=>{r.slideTo(i)})):r.slideTo(i):i>r.slides.length-s?(r.loopFix(),i=r.getSlideIndex(Te(t,`${a}[data-swiper-slide-index="${n}"]`)[0]),ft(()=>{r.slideTo(i)})):r.slideTo(i)}else r.slideTo(i)}var Rp={slideTo:Tp,slideToLoop:Sp,slideNext:bp,slidePrev:wp,slideReset:Lp,slideToClosest:Ap,slideToClickedSlide:Ip};function Cp(r){const e=this,{params:t,slidesEl:s}=e;if(!t.loop||e.virtual&&e.params.virtual.enabled)return;const i=()=>{Te(s,`.${t.slideClass}, swiper-slide`).forEach((u,f)=>{u.setAttribute("data-swiper-slide-index",f)})},n=e.grid&&t.grid&&t.grid.rows>1,a=t.slidesPerGroup*(n?t.grid.rows:1),o=e.slides.length%a!==0,l=n&&e.slides.length%t.grid.rows!==0,c=d=>{for(let u=0;u<d;u+=1){const f=e.isElement?_e("swiper-slide",[t.slideBlankClass]):_e("div",[t.slideClass,t.slideBlankClass]);e.slidesEl.append(f)}};if(o){if(t.loopAddBlankSlides){const d=a-e.slides.length%a;c(d),e.recalcSlides(),e.updateSlides()}else Vs("Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");i()}else if(l){if(t.loopAddBlankSlides){const d=t.grid.rows-e.slides.length%t.grid.rows;c(d),e.recalcSlides(),e.updateSlides()}else Vs("Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");i()}else i();e.loopFix({slideRealIndex:r,direction:t.centeredSlides?void 0:"next"})}function Dp(r){let{slideRealIndex:e,slideTo:t=!0,direction:s,setTranslate:i,activeSlideIndex:n,byController:a,byMousewheel:o}=r===void 0?{}:r;const l=this;if(!l.params.loop)return;l.emit("beforeLoopFix");const{slides:c,allowSlidePrev:d,allowSlideNext:u,slidesEl:f,params:h}=l,{centeredSlides:p}=h;if(l.allowSlidePrev=!0,l.allowSlideNext=!0,l.virtual&&h.virtual.enabled){t&&(!h.centeredSlides&&l.snapIndex===0?l.slideTo(l.virtual.slides.length,0,!1,!0):h.centeredSlides&&l.snapIndex<h.slidesPerView?l.slideTo(l.virtual.slides.length+l.snapIndex,0,!1,!0):l.snapIndex===l.snapGrid.length-1&&l.slideTo(l.virtual.slidesBefore,0,!1,!0)),l.allowSlidePrev=d,l.allowSlideNext=u,l.emit("loopFix");return}let m=h.slidesPerView;m==="auto"?m=l.slidesPerViewDynamic():(m=Math.ceil(parseFloat(h.slidesPerView,10)),p&&m%2===0&&(m=m+1));const g=h.slidesPerGroupAuto?m:h.slidesPerGroup;let y=g;y%g!==0&&(y+=g-y%g),y+=h.loopAdditionalSlides,l.loopedSlides=y;const E=l.grid&&h.grid&&h.grid.rows>1;c.length<m+y?Vs("Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled and not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters"):E&&h.grid.fill==="row"&&Vs("Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`");const v=[],S=[];let T=l.activeIndex;typeof n>"u"?n=l.getSlideIndex(c.filter(R=>R.classList.contains(h.slideActiveClass))[0]):T=n;const L=s==="next"||!s,b=s==="prev"||!s;let C=0,A=0;const w=E?Math.ceil(c.length/h.grid.rows):c.length,P=(E?c[n].column:n)+(p&&typeof i>"u"?-m/2+.5:0);if(P<y){C=Math.max(y-P,g);for(let R=0;R<y-P;R+=1){const D=R-Math.floor(R/w)*w;if(E){const _=w-D-1;for(let B=c.length-1;B>=0;B-=1)c[B].column===_&&v.push(B)}else v.push(w-D-1)}}else if(P+m>w-y){A=Math.max(P-(w-y*2),g);for(let R=0;R<A;R+=1){const D=R-Math.floor(R/w)*w;
vendor: 15,160 bytes, line 36
36E?c.forEach((_,B)=>{_.column===D&&S.push(B)}):S.push(D)}}if(l.__preventObserver__=!0,requestAnimationFrame(()=>{l.__preventObserver__=!1}),b&&v.forEach(R=>{c[R].swiperLoopMoveDOM=!0,f.prepend(c[R]),c[R].swiperLoopMoveDOM=!1}),L&&S.forEach(R=>{c[R].swiperLoopMoveDOM=!0,f.append(c[R]),c[R].swiperLoopMoveDOM=!1}),l.recalcSlides(),h.slidesPerView==="auto"?l.updateSlides():E&&(v.length>0&&b||S.length>0&&L)&&l.slides.forEach((R,D)=>{l.grid.updateSlide(D,R,l.slides)}),h.watchSlidesProgress&&l.updateSlidesOffset(),t){if(v.length>0&&b){if(typeof e>"u"){const R=l.slidesGrid[T],_=l.slidesGrid[T+C]-R;o?l.setTranslate(l.translate-_):(l.slideTo(T+Math.ceil(C),0,!1,!0),i&&(l.touchEventsData.startTranslate=l.touchEventsData.startTranslate-_,l.touchEventsData.currentTranslate=l.touchEventsData.currentTranslate-_))}else if(i){const R=E?v.length/h.grid.rows:v.length;l.slideTo(l.activeIndex+R,0,!1,!0),l.touchEventsData.currentTranslate=l.translate}}else if(S.length>0&&L)if(typeof e>"u"){const R=l.slidesGrid[T],_=l.slidesGrid[T-A]-R;o?l.setTranslate(l.translate-_):(l.slideTo(T-A,0,!1,!0),i&&(l.touchEventsData.startTranslate=l.touchEventsData.startTranslate-_,l.touchEventsData.currentTranslate=l.touchEventsData.currentTranslate-_))}else{const R=E?S.length/h.grid.rows:S.length;l.slideTo(l.activeIndex-R,0,!1,!0)}}if(l.allowSlidePrev=d,l.allowSlideNext=u,l.controller&&l.controller.control&&!a){const R={slideRealIndex:e,direction:s,setTranslate:i,activeSlideIndex:n,byController:!0};Array.isArray(l.controller.control)?l.controller.control.forEach(D=>{!D.destroyed&&D.params.loop&&D.loopFix({...R,slideTo:D.params.slidesPerView===h.slidesPerView?t:!1})}):l.controller.control instanceof l.constructor&&l.controller.control.params.loop&&l.controller.control.loopFix({...R,slideTo:l.controller.control.params.slidesPerView===h.slidesPerView?t:!1})}l.emit("loopFix")}function _p(){const r=this,{params:e,slidesEl:t}=r;if(!e.loop||r.virtual&&r.params.virtual.enabled)return;r.recalcSlides();const s=[];r.slides.forEach(i=>{const n=typeof i.swiperSlideIndex>"u"?i.getAttribute("data-swiper-slide-index")*1:i.swiperSlideIndex;s[n]=i}),r.slides.forEach(i=>{i.removeAttribute("data-swiper-slide-index")}),s.forEach(i=>{t.append(i)}),r.recalcSlides(),r.slideTo(r.realIndex,0)}var Pp={loopCreate:Cp,loopFix:Dp,loopDestroy:_p};function kp(r){const e=this;if(!e.params.simulateTouch||e.params.watchOverflow&&e.isLocked||e.params.cssMode)return;const t=e.params.touchEventsTarget==="container"?e.el:e.wrapperEl;e.isElement&&(e.__preventObserver__=!0),t.style.cursor="move",t.style.cursor=r?"grabbing":"grab",e.isElement&&requestAnimationFrame(()=>{e.__preventObserver__=!1})}function Mp(){const r=this;r.params.watchOverflow&&r.isLocked||r.params.cssMode||(r.isElement&&(r.__preventObserver__=!0),r[r.params.touchEventsTarget==="container"?"el":"wrapperEl"].style.cursor="",r.isElement&&requestAnimationFrame(()=>{r.__preventObserver__=!1}))}var Op={setGrabCursor:kp,unsetGrabCursor:Mp};function Fp(r,e){e===void 0&&(e=this);function t(s){if(!s||s===Se()||s===he())return null;s.assignedSlot&&(s=s.assignedSlot);const i=s.closest(r);return!i&&!s.getRootNode?null:i||t(s.getRootNode().host)}return t(e)}function Un(r,e,t){const s=he(),{params:i}=r,n=i.edgeSwipeDetection,a=i.edgeSwipeThreshold;return n&&(t<=a||t>=s.innerWidth-a)?n==="prevent"?(e.preventDefault(),!0):!1:!0}function Np(r){const e=this,t=Se();let s=r;s.originalEvent&&(s=s.originalEvent);const i=e.touchEventsData;if(s.type==="pointerdown"){if(i.pointerId!==null&&i.pointerId!==s.pointerId)return;i.pointerId=s.pointerId}else s.type==="touchstart"&&s.targetTouches.length===1&&(i.touchId=s.targetTouches[0].identifier);if(s.type==="touchstart"){Un(e,s,s.targetTouches[0].pageX);return}const{params:n,touches:a,enabled:o}=e;if(!o||!n.simulateTouch&&s.pointerType==="mouse"||e.animating&&n.preventInteractionOnTransition)return;!e.animating&&n.cssMode&&n.loop&&e.loopFix();let l=s.target;if(n.touchEventsTarget==="wrapper"&&!zh(l,e.wrapperEl)||"which"in s&&s.which===3||"button"in s&&s.button>0||i.isTouched&&i.isMoved)return;const c=!!n.noSwipingClass&&n.noSwipingClass!=="",d=s.composedPath?s.composedPath():s.path;c&&s.target&&s.target.shadowRoot&&d&&(l=d[0]);const u=n.noSwipingSelector?n.noSwipingSelector:`.${n.noSwipingClass}`,f=!!(s.target&&s.target.shadowRoot);if(n.noSwiping&&(f?Fp(u,l):l.closest(u))){e.allowClick=!0;return}if(n.swipeHandler&&!l.closest(n.swipeHandler))return;a.currentX=s.pageX,a.currentY=s.pageY;const h=a.currentX,p=a.currentY;if(!Un(e,s,h))return;Object.assign(i,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),a.startX=h,a.startY=p,i.touchStartTime=Me(),e.allowClick=!0,e.updateSize(),e.swipeDirection=void 0,n.threshold>0&&(i.allowThresholdMove=!1);let m=!0;l.matches(i.focusableElements)&&(m=!1,l.nodeName==="SELECT"&&(i.isTouched=!1)),t.activeElement&&t.activeElement.matches(i.focusableElements)&&t.activeElement!==l&&(s.pointerType==="mouse"||s.pointerType!=="mouse"&&!l.matches(i.focusableElements))&&t.activeElement.blur();const g=m&&e.allowTouchMove&&n.touchStartPreventDefault;(n.touchStartForcePreventDefault||g)&&!l.isContentEditable&&s.preventDefault(),n.freeMode&&n.freeMode.enabled&&e.freeMode&&e.animating&&!n.cssMode&&e.freeMode.onTouchStart(),e.emit("touchStart",s)}function Bp(r){const e=Se(),t=this,s=t.touchEventsData,{params:i,touches:n,rtlTranslate:a,enabled:o}=t;if(!o||!i.simulateTouch&&r.pointerType==="mouse")return;let l=r;if(l.originalEvent&&(l=l.originalEvent),l.type==="pointermove"&&(s.touchId!==null||l.pointerId!==s.pointerId))return;let c;if(l.type==="touchmove"){if(c=[...l.changedTouches].filter(L=>L.identifier===s.touchId)[0],!c||c.identifier!==s.touchId)return}else c=l;if(!s.isTouched){s.startMoving&&s.isScrolling&&t.emit("touchMoveOpposite",l);return}const d=c.pageX,u=c.pageY;if(l.preventedByNestedSwiper){n.startX=d,n.startY=u;return}if(!t.allowTouchMove){l.target.matches(s.focusableElements)||(t.allowClick=!1),s.isTouched&&(Object.assign(n,{startX:d,startY:u,currentX:d,currentY:u}),s.touchStartTime=Me());return}if(i.touchReleaseOnEdges&&!i.loop){if(t.isVertical()){if(u<n.startY&&t.translate<=t.maxTranslate()||u>n.startY&&t.translate>=t.minTranslate()){s.isTouched=!1,s.isMoved=!1;return}}else if(d<n.startX&&t.translate<=t.maxTranslate()||d>n.startX&&t.translate>=t.minTranslate())return}if(e.activeElement&&e.activeElement.matches(s.focusableElements)&&e.activeElement!==l.target&&l.pointerType!=="mouse"&&e.activeElement.blur(),e.activeElement&&l.target===e.activeElement&&l.target.matches(s.focusableElements)){s.isMoved=!0,t.allowClick=!1;return}s.allowTouchCallbacks&&t.emit("touchMove",l),n.previousX=n.currentX,n.previousY=n.currentY,n.currentX=d,n.currentY=u;const f=n.currentX-n.startX,h=n.currentY-n.startY;if(t.params.threshold&&Math.sqrt(f**2+h**2)<t.params.threshold)return;if(typeof s.isScrolling>"u"){let L;t.isHorizontal()&&n.currentY===n.startY||t.isVertical()&&n.currentX===n.startX?s.isScrolling=!1:f*f+h*h>=25&&(L=Math.atan2(Math.abs(h),Math.abs(f))*180/Math.PI,s.isScrolling=t.isHorizontal()?L>i.touchAngle:90-L>i.touchAngle)}if(s.isScrolling&&t.emit("touchMoveOpposite",l),typeof s.startMoving>"u"&&(n.currentX!==n.startX||n.currentY!==n.startY)&&(s.startMoving=!0),s.isScrolling||l.type==="touchmove"&&s.preventTouchMoveFromPointerMove){s.isTouched=!1;return}if(!s.startMoving)return;t.allowClick=!1,!i.cssMode&&l.cancelable&&l.preventDefault(),i.touchMoveStopPropagation&&!i.nested&&l.stopPropagation();let p=t.isHorizontal()?f:h,m=t.isHorizontal()?n.currentX-n.previousX:n.currentY-n.previousY;i.oneWayMovement&&(p=Math.abs(p)*(a?1:-1),m=Math.abs(m)*(a?1:-1)),n.diff=p,p*=i.touchRatio,a&&(p=-p,m=-m);const g=t.touchesDirection;t.swipeDirection=p>0?"prev":"next",t.touchesDirection=m>0?"prev":"next";const y=t.params.loop&&!i.cssMode,E=t.touchesDirection==="next"&&t.allowSlideNext||t.touchesDirection==="prev"&&t.allowSlidePrev;if(!s.isMoved){if(y&&E&&t.loopFix({direction:t.swipeDirection}),s.startTranslate=t.getTranslate(),t.setTransition(0),t.animating){const L=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0,detail:{bySwiperTouchMove:!0}});t.wrapperEl.dispatchEvent(L)}s.allowMomentumBounce=!1,i.grabCursor&&(t.allowSlideNext===!0||t.allowSlidePrev===!0)&&t.setGrabCursor(!0),t.emit("sliderFirstMove",l)}let v;if(new Date().getTime(),s.isMoved&&s.allowThresholdMove&&g!==t.touchesDirection&&y&&E&&Math.abs(p)>=1){Object.assign(n,{startX:d,startY:u,currentX:d,currentY:u,startTranslate:s.currentTranslate}),s.loopSwapReset=!0,s.startTranslate=s.currentTranslate;return}t.emit("sliderMove",l),s.isMoved=!0,s.currentTranslate=p+s.startTranslate;let S=!0,T=i.resistanceRatio;if(i.touchReleaseOnEdges&&(T=0),p>0?(y&&E&&!v&&s.allowThresholdMove&&s.currentTranslate>(i.centeredSlides?t.minTranslate()-t.slidesSizesGrid[t.activeIndex+1]-(i.slidesPerView!=="auto"&&t.slides.length-i.slidesPerView>=2?t.slidesSizesGrid[t.activeIndex+1]+t.params.spaceBetween:0)-t.params.spaceBetween:t.minTranslate())&&t.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),s.currentTranslate>t.minTranslate()&&(S=!1,i.resistance&&(s.currentTranslate=t.minTranslate()-1+(-t.minTranslate()+s.startTranslate+p)**T))):p<0&&(y&&E&&!v&&s.allowThresholdMove&&s.currentTranslate<(i.centeredSlides?t.maxTranslate()+t.slidesSizesGrid[t.slidesSizesGrid.length-1]+t.params.spaceBetween+(i.slidesPerView!=="auto"&&t.slides.length-i.slidesPerView>=2?t.slidesSizesGrid[t.slidesSizesGrid.length-1]+t.params.spaceBetween:0):t.maxTranslate())&&t.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:t.slides.length-(i.slidesPerView==="auto"?t.slidesPerViewDynamic():Math.ceil(parseFloat(i.slidesPerView,10)))}),s.currentTranslate<t.maxTranslate()&&(S=!1,i.resistance&&(s.currentTranslate=t.maxTranslate()+1-(t.maxTranslate()-s.startTranslate-p)**T))),S&&(l.preventedByNestedSwiper=!0),!t.allowSlideNext&&t.swipeDirection==="next"&&s.currentTranslate<s.startTranslate&&(s.currentTranslate=s.startTranslate),!t.allowSlidePrev&&t.swipeDirection==="prev"&&s.currentTranslate>s.startTranslate&&(s.currentTranslate=s.startTranslate),!t.allowSlidePrev&&!t.allowSlideNext&&(s.currentTranslate=s.startTranslate),i.threshold>0)if(Math.abs(p)>i.threshold||s.allowThresholdMove){if(!s.allowThresholdMove){s.allowThresholdMove=!0,n.startX=n.currentX,n.startY=n.currentY,s.currentTranslate=s.startTranslate,n.diff=t.isHorizontal()?n.currentX-n.startX:n.currentY-n.startY;return}}else{s.currentTranslate=s.startTranslate;return}!i.followFinger||i.cssMode||((i.freeMode&&i.freeMode.enabled&&t.freeMode||i.watchSlidesProgress)&&(t.updateActiveIndex(),t.updateSlidesClasses()),i.freeMode&&i.freeMode.enabled&&t.freeMode&&t.freeMode.onTouchMove(),t.updateProgress(s.currentTranslate),t.setTranslate(s.currentTranslate))}function $p(r){const e=this,t=e.touchEventsData;let s=r;s.originalEvent&&(s=s.originalEvent);let i;if(s.type==="touchend"||s.type==="touchcancel"){if(i=[...s.changedTouches].filter(T=>T.identifier===t.touchId)[0],!i||i.identifier!==t.touchId)return}else{if(t.touchId!==null||s.pointerId!==t.pointerId)return;i=s}if(["pointercancel","pointerout","pointerleave","contextmenu"].includes(s.type)&&!(["pointercancel","contextmenu"].includes(s.type)&&(e.browser.isSafari||e.browser.isWebView)))return;t.pointerId=null,t.touchId=null;const{params:a,touches:o,rtlTranslate:l,slidesGrid:c,enabled:d}=e;if(!d||!a.simulateTouch&&s.pointerType==="mouse")return;if(t.allowTouchCallbacks&&e.emit("touchEnd",s),t.allowTouchCallbacks=!1,!t.isTouched){t.isMoved&&a.grabCursor&&e.setGrabCursor(!1),t.isMoved=!1,t.startMoving=!1;return}a.grabCursor&&t.isMoved&&t.isTouched&&(e.allowSlideNext===!0||e.allowSlidePrev===!0)&&e.setGrabCursor(!1);const u=Me(),f=u-t.touchStartTime;if(e.allowClick){const T=s.path||s.composedPath&&s.composedPath();e.updateClickedSlide(T&&T[0]||s.target,T),e.emit("tap click",s),f<300&&u-t.lastClickTime<300&&e.emit("doubleTap doubleClick",s)}if(t.lastClickTime=Me(),ft(()=>{e.destroyed||(e.allowClick=!0)}),!t.isTouched||!t.isMoved||!e.swipeDirection||o.diff===0&&!t.loopSwapReset||t.currentTranslate===t.startTranslate&&!t.loopSwapReset){t.isTouched=!1,t.isMoved=!1,t.startMoving=!1;return}t.isTouched=!1,t.isMoved=!1,t.startMoving=!1;let h;if(a.followFinger?h=l?e.translate:-e.translate:h=-t.currentTranslate,a.cssMode)return;if(a.freeMode&&a.freeMode.enabled){e.freeMode.onTouchEnd({currentPos:h});return}const p=h>=-e.maxTranslate()&&!e.params.loop;let m=0,g=e.slidesSizesGrid[0];for(let T=0;T<c.length;T+=T<a.slidesPerGroupSkip?1:a.slidesPerGroup){const L=T<a.slidesPerGroupSkip-1?1:a.slidesPerGroup;typeof c[T+L]<"u"?(p||h>=c[T]&&h<c[T+L])&&(m=T,g=c[T+L]-c[T]):(p||h>=c[T])&&(m=T,g=c[c.length-1]-c[c.length-2])}let y=null,E=null;a.rewind&&(e.isBeginning?E=a.virtual&&a.virtual.enabled&&e.virtual?e.virtual.slides.length-1:e.slides.length-1:e.isEnd&&(y=0));const v=(h-c[m])/g,S=m<a.slidesPerGroupSkip-1?1:a.slidesPerGroup;if(f>a.longSwipesMs){if(!a.longSwipes){e.slideTo(e.activeIndex);return}e.swipeDirection==="next"&&(v>=a.longSwipesRatio?e.slideTo(a.rewind&&e.isEnd?y:m+S):e.slideTo(m)),e.swipeDirection==="prev"&&(v>1-a.longSwipesRatio?e.slideTo(m+S):E!==null&&v<0&&Math.abs(v)>a.longSwipesRatio?e.slideTo(E):e.slideTo(m))}else{if(!a.shortSwipes){e.slideTo(e.activeIndex);return}e.navigation&&(s.target===e.navigation.nextEl||s.target===e.navigation.prevEl)?s.target===e.navigation.nextEl?e.slideTo(m+S):e.slideTo(m):(e.swipeDirection==="next"&&e.slideTo(y!==null?y:m+S),e.swipeDirection==="prev"&&e.slideTo(E!==null?E:m))}}function Gn(){const r=this,{params:e,el:t}=r;if(t&&t.offsetWidth===0)return;e.breakpoints&&r.setBreakpoint();const{allowSlideNext:s,allowSlidePrev:i,snapGrid:n}=r,a=r.virtual&&r.params.virtual.enabled;r.allowSlideNext=!0,r.allowSlidePrev=!0,r.updateSize(),r.updateSlides(),r.updateSlidesClasses();const o=a&&e.loop;(e.slidesPerView==="auto"||e.slidesPerView>1)&&r.isEnd&&!r.isBeginning&&!r.params.centeredSlides&&!o?r.slideTo(r.slides.length-1,0,!1,!0):r.params.loop&&!a?r.slideToLoop(r.realIndex,0,!1,!0):r.slideTo(r.activeIndex,0,!1,!0),r.autoplay&&r.autoplay.running&&r.autoplay.paused&&(clearTimeout(r.autoplay.resizeTimeout),r.autoplay.resizeTimeout=setTimeout(()=>{r.autoplay&&r.autoplay.running&&r.autoplay.paused&&r.autoplay.resume()},500)),r.allowSlidePrev=i,r.allowSlideNext=s,r.params.watchOverflow&&n!==r.snapGrid&&r.checkOverflow()}function Up(r){const e=this;e.enabled&&(e.allowClick||(e.params.preventClicks&&r.preventDefault(),e.params.preventClicksPropagation&&e.animating&&(r.stopPropagation(),r.stopImmediatePropagation())))}function Gp(){const r=this,{wrapperEl:e,rtlTranslate:t,enabled:s}=r;if(!s)return;r.previousTranslate=r.translate,r.isHorizontal()?r.translate=-e.scrollLeft:r.translate=-e.scrollTop,r.translate===0&&(r.translate=0),r.updateActiveIndex(),r.updateSlidesClasses();let i;const n=r.maxTranslate()-r.minTranslate();n===0?i=0:i=(r.translate-r.minTranslate())/n,i!==r.progress&&r.updateProgress(t?-r.translate:r.translate),r.emit("setTranslate",r.translate,!1)}function Hp(r){const e=this;As(e,r.target),!(e.params.cssMode||e.params.slidesPerView!=="auto"&&!e.params.autoHeight)&&e.update(
vendor: 1,692 bytes, line 36
36)}function Vp(){const r=this;r.documentTouchHandlerProceeded||(r.documentTouchHandlerProceeded=!0,r.params.touchReleaseOnEdges&&(r.el.style.touchAction="auto"))}const xo=(r,e)=>{const t=Se(),{params:s,el:i,wrapperEl:n,device:a}=r,o=!!s.nested,l=e==="on"?"addEventListener":"removeEventListener",c=e;!i||typeof i=="string"||(t[l]("touchstart",r.onDocumentTouchStart,{passive:!1,capture:o}),i[l]("touchstart",r.onTouchStart,{passive:!1}),i[l]("pointerdown",r.onTouchStart,{passive:!1}),t[l]("touchmove",r.onTouchMove,{passive:!1,capture:o}),t[l]("pointermove",r.onTouchMove,{passive:!1,capture:o}),t[l]("touchend",r.onTouchEnd,{passive:!0}),t[l]("pointerup",r.onTouchEnd,{passive:!0}),t[l]("pointercancel",r.onTouchEnd,{passive:!0}),t[l]("touchcancel",r.onTouchEnd,{passive:!0}),t[l]("pointerout",r.onTouchEnd,{passive:!0}),t[l]("pointerleave",r.onTouchEnd,{passive:!0}),t[l]("contextmenu",r.onTouchEnd,{passive:!0}),(s.preventClicks||s.preventClicksPropagation)&&i[l]("click",r.onClick,!0),s.cssMode&&n[l]("scroll",r.onScroll),s.updateOnWindowResize?r[c](a.ios||a.android?"resize orientationchange observerUpdate":"resize observerUpdate",Gn,!0):r[c]("observerUpdate",Gn,!0),i[l]("load",r.onLoad,{capture:!0}))};function zp(){const r=this,{params:e}=r;r.onTouchStart=Np.bind(r),r.onTouchMove=Bp.bind(r),r.onTouchEnd=$p.bind(r),r.onDocumentTouchStart=Vp.bind(r),e.cssMode&&(r.onScroll=Gp.bind(r)),r.onClick=Up.bind(r),r.onLoad=Hp.bind(r),xo(r,"on")}function Kp(){xo(this,"off")}var Yp={attachEvents:zp,detachEvents:Kp};const Hn=(r,e)=>r.grid&&e.grid&&e.grid.rows>1;function Wp(){const r=this,{realIndex:e,initialized:t,params:s,el:i}=r,n=s.breakpoints;if(!n||n&&Object.keys(n).length===0)return;
vendor: 1,647 bytes, line 36
36const a=r.getBreakpoint(n,r.params.breakpointsBase,r.el);if(!a||r.currentBreakpoint===a)return;const l=(a in n?n[a]:void 0)||r.originalParams,c=Hn(r,s),d=Hn(r,l),u=r.params.grabCursor,f=l.grabCursor,h=s.enabled;c&&!d?(i.classList.remove(`${s.containerModifierClass}grid`,`${s.containerModifierClass}grid-column`),r.emitContainerClasses()):!c&&d&&(i.classList.add(`${s.containerModifierClass}grid`),(l.grid.fill&&l.grid.fill==="column"||!l.grid.fill&&s.grid.fill==="column")&&i.classList.add(`${s.containerModifierClass}grid-column`),r.emitContainerClasses()),u&&!f?r.unsetGrabCursor():!u&&f&&r.setGrabCursor(),["navigation","pagination","scrollbar"].forEach(v=>{if(typeof l[v]>"u")return;const S=s[v]&&s[v].enabled,T=l[v]&&l[v].enabled;S&&!T&&r[v].disable(),!S&&T&&r[v].enable()});const p=l.direction&&l.direction!==s.direction,m=s.loop&&(l.slidesPerView!==s.slidesPerView||p),g=s.loop;p&&t&&r.changeDirection(),Ce(r.params,l);const y=r.params.enabled,E=r.params.loop;Object.assign(r,{allowTouchMove:r.params.allowTouchMove,allowSlideNext:r.params.allowSlideNext,allowSlidePrev:r.params.allowSlidePrev}),h&&!y?r.disable():!h&&y&&r.enable(),r.currentBreakpoint=a,r.emit("_beforeBreakpoint",l),t&&(m?(r.loopDestroy(),r.loopCreate(e),r.updateSlides()):!g&&E?(r.loopCreate(e),r.updateSlides()):g&&!E&&r.loopDestroy()),r.emit("breakpoint",l)}function qp(r,e,t){if(e===void 0&&(e="window"),!r||e==="container"&&!t)return;let s=!1;const i=he(),n=e==="window"?i.innerHeight:t.clientHeight,a=Object.keys(r).map(o=>{if(typeof o=="string"&&o.indexOf("@")===0){const l=parseFloat(o.substr(1));return{value:n*l,point:o}}return{value:o,point:o}});a.sort((o,l)=>
vendor: 4,748 bytes, line 36
36parseInt(o.value,10)-parseInt(l.value,10));for(let o=0;o<a.length;o+=1){const{point:l,value:c}=a[o];e==="window"?i.matchMedia(`(min-width: ${c}px)`).matches&&(s=l):c<=t.clientWidth&&(s=l)}return s||"max"}var jp={setBreakpoint:Wp,getBreakpoint:qp};function Xp(r,e){const t=[];return r.forEach(s=>{typeof s=="object"?Object.keys(s).forEach(i=>{s[i]&&t.push(e+i)}):typeof s=="string"&&t.push(e+s)}),t}function Qp(){const r=this,{classNames:e,params:t,rtl:s,el:i,device:n}=r,a=Xp(["initialized",t.direction,{"free-mode":r.params.freeMode&&t.freeMode.enabled},{autoheight:t.autoHeight},{rtl:s},{grid:t.grid&&t.grid.rows>1},{"grid-column":t.grid&&t.grid.rows>1&&t.grid.fill==="column"},{android:n.android},{ios:n.ios},{"css-mode":t.cssMode},{centered:t.cssMode&&t.centeredSlides},{"watch-progress":t.watchSlidesProgress}],t.containerModifierClass);e.push(...a),i.classList.add(...e),r.emitContainerClasses()}function Zp(){const r=this,{el:e,classNames:t}=r;!e||typeof e=="string"||(e.classList.remove(...t),r.emitContainerClasses())}var Jp={addClasses:Qp,removeClasses:Zp};function em(){const r=this,{isLocked:e,params:t}=r,{slidesOffsetBefore:s}=t;if(s){const i=r.slides.length-1,n=r.slidesGrid[i]+r.slidesSizesGrid[i]+s*2;r.isLocked=r.size>n}else r.isLocked=r.snapGrid.length===1;t.allowSlideNext===!0&&(r.allowSlideNext=!r.isLocked),t.allowSlidePrev===!0&&(r.allowSlidePrev=!r.isLocked),e&&e!==r.isLocked&&(r.isEnd=!1),e!==r.isLocked&&r.emit(r.isLocked?"lock":"unlock")}var tm={checkOverflow:em},ir={init:!0,direction:"horizontal",oneWayMovement:!1,swiperElementNodeName:"SWIPER-CONTAINER",touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,eventsPrefix:"swiper",enabled:!0,focusableElements:"input, select, option, textarea, button, video, label",width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerGroup:1,slidesPerGroupSkip:0,slidesPerGroupAuto:!1,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,watchOverflow:!0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:5,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,loop:!1,loopAddBlankSlides:!0,loopAdditionalSlides:0,loopPreventsSliding:!0,rewind:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,maxBackfaceHiddenSlides:10,containerModifierClass:"swiper-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-blank",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideFullyVisibleClass:"swiper-slide-fully-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function sm(r,e){return function(s){s===void 0&&(s={});const i=Object.keys(s)[0],n=s[i];if(typeof n!="object"||n===null){Ce(e,s);return}if(r[i]===!0&&(r[i]={enabled:!0}),i==="navigation"&&r[i]&&r[i].enabled&&!r[i].prevEl&&!r[i].nextEl&&(r[i].auto=!0),["pagination","scrollbar"].indexOf(i)>=0&&r[i]&&r[i].enabled&&!r[i].el&&(r[i].auto=!0),!(i in r&&"enabled"in n)){Ce(e,s);return}typeof r[i]=="object"&&!("enabled"in r[i])&&(r[i].enabled=!0),r[i]||(r[i]={enabled:!1}),Ce(e,s)}}const _i={eventsEmitter:Jh,update:dp,translate:gp,transition:xp,slide:Rp,loop:Pp,grabCursor:Op,events:Yp,breakpoints:jp,checkOverflow:tm,classes:Jp},Pi={};class Re{constructor(){let e,t;for(var s=arguments.length,i=new Array(s),n=0;n<s;n++)i[n]=arguments[n];i.length===1&&i[0].constructor&&Object.prototype.toString.call(i[0]).slice(8,-1)==="Object"?t=i[0]:[e,t]=i,t||(t={}),t=Ce({},t),e&&!t.el&&(t.el=e);const a=Se();if(t.el&&typeof t.el=="string"&&a.querySelectorAll(t.el).length>1){const d=[];return a.querySelectorAll(t.el).forEach(u=>{const f=Ce({},t,{el:u});d.push(new Re(f))}),d}const o=this;o.__swiper__=!0,o.support=vo(),o.device=yo({userAgent:t.userAgent}),o.browser=Xh(),o.eventsListeners={},o.eventsAnyListeners=[],o.modules=[...o.__modules__],t.modules&&Array.isArray(t.modules)&&o.modules.push(...t.modules);const l={};
vendor: 4,865 bytes, line 36
36o.modules.forEach(d=>{d({params:t,swiper:o,extendParams:sm(t,l),on:o.on.bind(o),once:o.once.bind(o),off:o.off.bind(o),emit:o.emit.bind(o)})});const c=Ce({},ir,l);return o.params=Ce({},c,Pi,t),o.originalParams=Ce({},o.params),o.passedParams=Ce({},t),o.params&&o.params.on&&Object.keys(o.params.on).forEach(d=>{o.on(d,o.params.on[d])}),o.params&&o.params.onAny&&o.onAny(o.params.onAny),Object.assign(o,{enabled:o.params.enabled,el:e,classNames:[],slides:[],slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal(){return o.params.direction==="horizontal"},isVertical(){return o.params.direction==="vertical"},activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,cssOverflowAdjustment(){return Math.trunc(this.translate/2**23)*2**23},allowSlideNext:o.params.allowSlideNext,allowSlidePrev:o.params.allowSlidePrev,touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,focusableElements:o.params.focusableElements,lastClickTime:0,clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,startMoving:void 0,pointerId:null,touchId:null},allowClick:!0,allowTouchMove:o.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),o.emit("_swiper"),o.params.init&&o.init(),o}getDirectionLabel(e){return this.isHorizontal()?e:{width:"height","margin-top":"margin-left","margin-bottom ":"margin-right","margin-left":"margin-top","margin-right":"margin-bottom","padding-left":"padding-top","padding-right":"padding-bottom",marginRight:"marginBottom"}[e]}getSlideIndex(e){const{slidesEl:t,params:s}=this,i=Te(t,`.${s.slideClass}, swiper-slide`),n=Xt(i[0]);return Xt(e)-n}getSlideIndexByData(e){return this.getSlideIndex(this.slides.filter(t=>t.getAttribute("data-swiper-slide-index")*1===e)[0])}recalcSlides(){const e=this,{slidesEl:t,params:s}=e;e.slides=Te(t,`.${s.slideClass}, swiper-slide`)}enable(){const e=this;e.enabled||(e.enabled=!0,e.params.grabCursor&&e.setGrabCursor(),e.emit("enable"))}disable(){const e=this;e.enabled&&(e.enabled=!1,e.params.grabCursor&&e.unsetGrabCursor(),e.emit("disable"))}setProgress(e,t){const s=this;e=Math.min(Math.max(e,0),1);const i=s.minTranslate(),a=(s.maxTranslate()-i)*e+i;s.translateTo(a,typeof t>"u"?0:t),s.updateActiveIndex(),s.updateSlidesClasses()}emitContainerClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=e.el.className.split(" ").filter(s=>s.indexOf("swiper")===0||s.indexOf(e.params.containerModifierClass)===0);e.emit("_containerClasses",t.join(" "))}getSlideClasses(e){const t=this;return t.destroyed?"":e.className.split(" ").filter(s=>s.indexOf("swiper-slide")===0||s.indexOf(t.params.slideClass)===0).join(" ")}emitSlidesClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=[];e.slides.forEach(s=>{const i=e.getSlideClasses(s);t.push({slideEl:s,classNames:i}),e.emit("_slideClass",s,i)}),e.emit("_slideClasses",t)}slidesPerViewDynamic(e,t){e===void 0&&(e="current"),t===void 0&&(t=!1);const s=this,{params:i,slides:n,slidesGrid:a,slidesSizesGrid:o,size:l,activeIndex:c}=s;let d=1;if(typeof i.slidesPerView=="number")return i.slidesPerView;if(i.centeredSlides){let u=n[c]?Math.ceil(n[c].swiperSlideSize):0,f;for(let h=c+1;h<n.length;h+=1)n[h]&&!f&&(u+=Math.ceil(n[h].swiperSlideSize),d+=1,u>l&&(f=!0));for(let h=c-1;h>=0;h-=1)n[h]&&!f&&(u+=n[h].swiperSlideSize,d+=1,u>l&&(f=!0))}else if(e==="current")for(let u=c+1;u<n.length;u+=1)(t?a[u]+o[u]-a[c]<l:a[u]-a[c]<l)&&(d+=1);else for(let u=c-1;u>=0;u-=1)a[c]-a[u]<l&&(d+=1);return d}update(){const e=this;if(!e||e.destroyed)return;const{snapGrid:t,params:s}=e;s.breakpoints&&e.setBreakpoint(),[...e.el.querySelectorAll('[loading="lazy"]')].forEach(a=>{a.complete&&As(e,a)}),e.updateSize(),e.updateSlides(),e.updateProgress(),e.updateSlidesClasses();function i(){const a=e.rtlTranslate?e.translate*-1:e.translate,o=Math.min(Math.max(a,e.maxTranslate()),e.minTranslate());e.setTranslate(o),e.updateActiveIndex(),e.updateSlidesClasses()}let n;if(s.freeMode&&s.freeMode.enabled&&!s.cssMode)i(),s.autoHeight&&e.updateAutoHeight();else{if((s.slidesPerView==="auto"||s.slidesPerView>1)&&e.isEnd&&!s.centeredSlides){const a=e.virtual&&s.virtual.enabled?e.virtual.slides:e.slides;n=e.slideTo(a.length-1,0,!1,!0)}else n=e.slideTo(e.activeIndex,0,!1,!0);n||i()}s.watchOverflow&&t!==e.snapGrid&&e.checkOverflow(),e.emit("update")}changeDirection(e,t){t===void 0&&(t=!0);const s=this,i=s.params.direction;return e||(e=i==="horizontal"?"vertical":"horizontal"),e===i||e!=="horizontal"&&e!=="vertical"||(s.el.classList.remove(`${s.params.containerModifierClass}${i}`),s.el.classList.add(`${s.params.containerModifierClass}${e}`),s.emitContainerClasses(),s.params.direction=e,s.slides.forEac
vendor: 15,177 bytes, line 36
36h(n=>{e==="vertical"?n.style.width="":n.style.height=""}),s.emit("changeDirection"),t&&s.update()),s}changeLanguageDirection(e){const t=this;t.rtl&&e==="rtl"||!t.rtl&&e==="ltr"||(t.rtl=e==="rtl",t.rtlTranslate=t.params.direction==="horizontal"&&t.rtl,t.rtl?(t.el.classList.add(`${t.params.containerModifierClass}rtl`),t.el.dir="rtl"):(t.el.classList.remove(`${t.params.containerModifierClass}rtl`),t.el.dir="ltr"),t.update())}mount(e){const t=this;if(t.mounted)return!0;let s=e||t.params.el;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return!1;s.swiper=t,s.parentNode&&s.parentNode.host&&s.parentNode.host.nodeName===t.params.swiperElementNodeName.toUpperCase()&&(t.isElement=!0);const i=()=>`.${(t.params.wrapperClass||"").trim().split(" ").join(".")}`;let a=s&&s.shadowRoot&&s.shadowRoot.querySelector?s.shadowRoot.querySelector(i()):Te(s,i())[0];return!a&&t.params.createElements&&(a=_e("div",t.params.wrapperClass),s.append(a),Te(s,`.${t.params.slideClass}`).forEach(o=>{a.append(o)})),Object.assign(t,{el:s,wrapperEl:a,slidesEl:t.isElement&&!s.parentNode.host.slideSlots?s.parentNode.host:a,hostEl:t.isElement?s.parentNode.host:s,mounted:!0,rtl:s.dir.toLowerCase()==="rtl"||rt(s,"direction")==="rtl",rtlTranslate:t.params.direction==="horizontal"&&(s.dir.toLowerCase()==="rtl"||rt(s,"direction")==="rtl"),wrongRTL:rt(a,"display")==="-webkit-box"}),!0}init(e){const t=this;if(t.initialized||t.mount(e)===!1)return t;t.emit("beforeInit"),t.params.breakpoints&&t.setBreakpoint(),t.addClasses(),t.updateSize(),t.updateSlides(),t.params.watchOverflow&&t.checkOverflow(),t.params.grabCursor&&t.enabled&&t.setGrabCursor(),t.params.loop&&t.virtual&&t.params.virtual.enabled?t.slideTo(t.params.initialSlide+t.virtual.slidesBefore,0,t.params.runCallbacksOnInit,!1,!0):t.slideTo(t.params.initialSlide,0,t.params.runCallbacksOnInit,!1,!0),t.params.loop&&t.loopCreate(),t.attachEvents();const i=[...t.el.querySelectorAll('[loading="lazy"]')];return t.isElement&&i.push(...t.hostEl.querySelectorAll('[loading="lazy"]')),i.forEach(n=>{n.complete?As(t,n):n.addEventListener("load",a=>{As(t,a.target)})}),sr(t),t.initialized=!0,sr(t),t.emit("init"),t.emit("afterInit"),t}destroy(e,t){e===void 0&&(e=!0),t===void 0&&(t=!0);const s=this,{params:i,el:n,wrapperEl:a,slides:o}=s;return typeof s.params>"u"||s.destroyed||(s.emit("beforeDestroy"),s.initialized=!1,s.detachEvents(),i.loop&&s.loopDestroy(),t&&(s.removeClasses(),n&&typeof n!="string"&&n.removeAttribute("style"),a&&a.removeAttribute("style"),o&&o.length&&o.forEach(l=>{l.classList.remove(i.slideVisibleClass,i.slideFullyVisibleClass,i.slideActiveClass,i.slideNextClass,i.slidePrevClass),l.removeAttribute("style"),l.removeAttribute("data-swiper-slide-index")})),s.emit("destroy"),Object.keys(s.eventsListeners).forEach(l=>{s.off(l)}),e!==!1&&(s.el&&typeof s.el!="string"&&(s.el.swiper=null),Gh(s)),s.destroyed=!0),null}static extendDefaults(e){Ce(Pi,e)}static get extendedDefaults(){return Pi}static get defaults(){return ir}static installModule(e){Re.prototype.__modules__||(Re.prototype.__modules__=[]);const t=Re.prototype.__modules__;typeof e=="function"&&t.indexOf(e)<0&&t.push(e)}static use(e){return Array.isArray(e)?(e.forEach(t=>Re.installModule(t)),Re):(Re.installModule(e),Re)}}Object.keys(_i).forEach(r=>{Object.keys(_i[r]).forEach(e=>{Re.prototype[e]=_i[r][e]})});Re.use([Qh,Zh]);function im(r){let{swiper:e,extendParams:t,on:s,emit:i}=r;t({virtual:{enabled:!1,slides:[],cache:!0,renderSlide:null,renderExternal:null,renderExternalUpdate:!0,addSlidesBefore:0,addSlidesAfter:0}});let n;const a=Se();e.virtual={cache:{},from:void 0,to:void 0,slides:[],offset:0,slidesGrid:[]};const o=a.createElement("div");function l(p,m){const g=e.params.virtual;if(g.cache&&e.virtual.cache[m])return e.virtual.cache[m];let y;return g.renderSlide?(y=g.renderSlide.call(e,p,m),typeof y=="string"&&(o.innerHTML=y,y=o.children[0])):e.isElement?y=_e("swiper-slide"):y=_e("div",e.params.slideClass),y.setAttribute("data-swiper-slide-index",m),g.renderSlide||(y.innerHTML=p),g.cache&&(e.virtual.cache[m]=y),y}function c(p,m){const{slidesPerView:g,slidesPerGroup:y,centeredSlides:E,loop:v,initialSlide:S}=e.params;if(m&&!v&&S>0)return;const{addSlidesBefore:T,addSlidesAfter:L}=e.params.virtual,{from:b,to:C,slides:A,slidesGrid:w,offset:I}=e.virtual;e.params.cssMode||e.updateActiveIndex();const P=e.activeIndex||0;let R;e.rtlTranslate?R="right":R=e.isHorizontal()?"left":"top";let D,_;E?(D=Math.floor(g/2)+y+L,_=Math.floor(g/2)+y+T):(D=g+(y-1)+L,_=(v?g:y)+T);let B=P-_,k=P+D;v||(B=Math.max(B,0),k=Math.min(k,A.length-1));let M=(e.slidesGrid[B]||0)-(e.slidesGrid[0]||0);v&&P>=_?(B-=_,E||(M+=e.slidesGrid[0])):v&&P<_&&(B=-_,E&&(M+=e.slidesGrid[0])),Object.assign(e.virtual,{from:B,to:k,offset:M,slidesGrid:e.slidesGrid,slidesBefore:_,slidesAfter:D});function N(){e.updateSlides(),e.updateProgress(),e.updateSlidesClasses(),i("virtualUpdate")}if(b===B&&C===k&&!p){e.slidesGrid!==w&&M!==I&&e.slides.forEach(K=>{K.style[R]=`${M-Math.abs(e.cssOverflowAdjustment())}px`}),e.updateProgress(),i("virtualUpdate");return}if(e.params.virtual.renderExternal){e.params.virtual.renderExternal.call(e,{offset:M,from:B,to:k,slides:function(){const Q=[];for(let q=B;q<=k;q+=1)Q.push(A[q]);return Q}()}),e.params.virtual.renderExternalUpdate?N():i("virtualUpdate");return}const G=[],U=[],H=K=>{let Q=K;return K<0?Q=A.length+K:Q>=A.length&&(Q=Q-A.length),Q};if(p)e.slides.filter(K=>K.matches(`.${e.params.slideClass}, swiper-slide`)).forEach(K=>{K.remove()});else for(let K=b;K<=C;K+=1)if(K<B||K>k){const Q=H(K);e.slides.filter(q=>q.matches(`.${e.params.slideClass}[data-swiper-slide-index="${Q}"], swiper-slide[data-swiper-slide-index="${Q}"]`)).forEach(q=>{q.remove()})}const z=v?-A.length:0,Z=v?A.length*2:A.length;for(let K=z;K<Z;K+=1)if(K>=B&&K<=k){const Q=H(K);typeof C>"u"||p?U.push(Q):(K>C&&U.push(Q),K<b&&G.push(Q))}if(U.forEach(K=>{e.slidesEl.append(l(A[K],K))}),v)for(let K=G.length-1;K>=0;K-=1){const Q=G[K];e.slidesEl.prepend(l(A[Q],Q))}else G.sort((K,Q)=>Q-K),G.forEach(K=>{e.slidesEl.prepend(l(A[K],K))});Te(e.slidesEl,".swiper-slide, swiper-slide").forEach(K=>{K.style[R]=`${M-Math.abs(e.cssOverflowAdjustment())}px`}),N()}function d(p){if(typeof p=="object"&&"length"in p)for(let m=0;m<p.length;m+=1)p[m]&&e.virtual.slides.push(p[m]);else e.virtual.slides.push(p);c(!0)}function u(p){const m=e.activeIndex;let g=m+1,y=1;if(Array.isArray(p)){for(let E=0;E<p.length;E+=1)p[E]&&e.virtual.slides.unshift(p[E]);g=m+p.length,y=p.length}else e.virtual.slides.unshift(p);if(e.params.virtual.cache){const E=e.virtual.cache,v={};Object.keys(E).forEach(S=>{const T=E[S],L=T.getAttribute("data-swiper-slide-index");L&&T.setAttribute("data-swiper-slide-index",parseInt(L,10)+y),v[parseInt(S,10)+y]=T}),e.virtual.cache=v}c(!0),e.slideTo(g,0)}function f(p){if(typeof p>"u"||p===null)return;let m=e.activeIndex;if(Array.isArray(p))for(let g=p.length-1;g>=0;g-=1)e.params.virtual.cache&&(delete e.virtual.cache[p[g]],Object.keys(e.virtual.cache).forEach(y=>{y>p&&(e.virtual.cache[y-1]=e.virtual.cache[y],e.virtual.cache[y-1].setAttribute("data-swiper-slide-index",y-1),delete e.virtual.cache[y])})),e.virtual.slides.splice(p[g],1),p[g]<m&&(m-=1),m=Math.max(m,0);else e.params.virtual.cache&&(delete e.virtual.cache[p],Object.keys(e.virtual.cache).forEach(g=>{g>p&&(e.virtual.cache[g-1]=e.virtual.cache[g],e.virtual.cache[g-1].setAttribute("data-swiper-slide-index",g-1),delete e.virtual.cache[g])})),e.virtual.slides.splice(p,1),p<m&&(m-=1),m=Math.max(m,0);c(!0),e.slideTo(m,0)}function h(){e.virtual.slides=[],e.params.virtual.cache&&(e.virtual.cache={}),c(!0),e.slideTo(0,0)}s("beforeInit",()=>{if(!e.params.virtual.enabled)return;let p;if(typeof e.passedParams.virtual.slides>"u"){const m=[...e.slidesEl.children].filter(g=>g.matches(`.${e.params.slideClass}, swiper-slide`));m&&m.length&&(e.virtual.slides=[...m],p=!0,m.forEach((g,y)=>{g.setAttribute("data-swiper-slide-index",y),e.virtual.cache[y]=g,g.remove()}))}p||(e.virtual.slides=e.params.virtual.slides),e.classNames.push(`${e.params.containerModifierClass}virtual`),e.params.watchSlidesProgress=!0,e.originalParams.watchSlidesProgress=!0,c(!1,!0)}),s("setTranslate",()=>{e.params.virtual.enabled&&(e.params.cssMode&&!e._immediateVirtual?(clearTimeout(n),n=setTimeout(()=>{c()},100)):c())}),s("init update resize",()=>{e.params.virtual.enabled&&e.params.cssMode&&Ut(e.wrapperEl,"--swiper-virtual-size",`${e.virtualSize}px`)}),Object.assign(e.virtual,{appendSlide:d,prependSlide:u,removeSlide:f,removeAllSlides:h,update:c})}function rm(r){let{swiper:e,extendParams:t,on:s,emit:i}=r;const n=Se(),a=he();e.keyboard={enabled:!1},t({keyboard:{enabled:!1,onlyInViewport:!0,pageUpDown:!0}});function o(d){if(!e.enabled)return;const{rtlTranslate:u}=e;let f=d;f.originalEvent&&(f=f.originalEvent);const h=f.keyCode||f.charCode,p=e.params.keyboard.pageUpDown,m=p&&h===33,g=p&&h===34,y=h===37,E=h===39,v=h===38,S=h===40;if(!e.allowSlideNext&&(e.isHorizontal()&&E||e.isVertical()&&S||g)||!e.allowSlidePrev&&(e.isHorizontal()&&y||e.isVertical()&&v||m))return!1;if(!(f.shiftKey||f.altKey||f.ctrlKey||f.metaKey)&&!(n.activeElement&&n.activeElement.nodeName&&(n.activeElement.nodeName.toLowerCase()==="input"||n.activeElement.nodeName.toLowerCase()==="textarea"))){if(e.params.keyboard.onlyInViewport&&(m||g||y||E||v||S)){let T=!1;if(dt(e.el,`.${e.params.slideClass}, swiper-slide`).length>0&&dt(e.el,`.${e.params.slideActiveClass}`).length===0)return;const L=e.el,b=L.clientWidth,C=L.clientHeight,A=a.innerWidth,w=a.innerHeight,I=zs(L);u&&(I.left-=L.scrollLeft);const P=[[I.left,I.top],[I.left+b,I.top],[I.left,I.top+C],[I.left+b,I.top+C]];for(let R=0;R<P.length;R+=1){const D=P[R];if(D[0]>=0&&D[0]<=A&&D[1]>=0&&D[1]<=w){if(D[0]===0&&D[1]===0)continue;T=!0}}if(!T)return}e.isHorizontal()?((m||g||y||E)&&(f.preventDefault?f.preventDefault():f.returnValue=!1),((g||E)&&!u||(m||y)&&u)&&e.slideNext(),((m||y)&&!u||(g||E)&&u)&&e.slidePrev()):((m||g||v||S)&&(f.preventDefault?f.preventDefault():f.returnValue=!1),(g||S)&&e.slideNext(),(m||v)&&e.slidePrev()),i("keyPress",h)}}function l(){e.keyboard.enabled||(n.addEventListener("keydown",o),e.keyboard.enabled=!0)}function c(){e.keyboard.enabled&&(n.removeEventListener("keydown",o),e.keyboard.enabled=!1)}s("init",()=>{e.params.keyboard.enabled&&l()}),s("destroy",()=>{e.keyboard.enabled&&c()}),Object.assign(e.keyboard,{enable:l,disable:c})}function nm(r){let{swiper:e,extendParams:t,on:s,emit:i}=r;const n=he();t({mousewheel:{enabled:!1,releaseOnEdges:!1,invert:!1,forceToAxis:!1,sensitivity:1,eventsTarget:"container",thresholdDelta:null,thresholdTime:null,noMousewheelClass:"swiper-no-mousewheel"}}),e.mousewheel={enabled:!1};let a,o=Me(),l;const c=[];function d(v){let b=0,C=0,A=0,w=0;return"detail"in v&&(C=v.detail),"wheelDelta"in v&&(C=-v.wheelDelta/120),"wheelDeltaY"in v&&(C=-v.wheelDeltaY/120),"wheelDeltaX"in v&&(b=-v.wheelDeltaX/120),"axis"in v&&v.axis===v.HORIZONTAL_AXIS&&(b=C,C=0),A=b*10,w=C*10,"deltaY"in v&&(w=v.deltaY),"deltaX"in v&&(A=v.deltaX),v.shiftKey&&!A&&(A=w,w=0),(A||w)&&v.deltaMode&&(v.deltaMode===1?(A*=40,w*=40):(A*=800,w*=800)),A&&!b&&(b=A<1?-1:1),w&&!C&&(C=w<1?-1:1),{spinX:b,spinY:C,pixelX:A,pixelY:w}}function u(){e.enabled&&(e.mouseEntered=!0)}function f(){e.enabled&&(e.mouseEntered=!1)}function h(v){return e.params.mousewheel.thresholdDelta&&v.delta<e.params.mousewheel.thresholdDelta||e.params.mousewheel.thresholdTime&&Me()-o<e.params.mousewheel.thresholdTime?!1:v.delta>=6&&Me()-o<60?!0:(v.direction<0?(!e.isEnd||e.params.loop)&&!e.animating&&(e.slideNext(),i("scroll",v.raw)):(!e.isBeginning||e.params.loop)&&!e.animating&&(e.slidePrev(),i("scroll",v.raw)),o=new n.Date().getTime(),!1)}function p(v){const S=e.params.mousewheel;if(v.direction<0){if(e.isEnd&&!e.params.loop&&S.releaseOnEdges)return!0}else if(e.isBeginning&&!e.params.loop&&S.releaseOnEdges)return!0;return!1}function m(v){let S=v,T=!0;if(!e.enabled||v.target.closest(`.${e.params.mousewheel.noMousewheelClass}`))return;const L=e.params.mousewheel;e.params.cssMode&&S.preventDefault();let b=e.el;e.params.mousewheel.eventsTarget!=="container"&&(b=document.querySelector(e.params.mousewheel.eventsTarget));const C=b&&b.contains(S.target);if(!e.mouseEntered&&!C&&!L.releaseOnEdges)return!0;S.originalEvent&&(S=S.originalEvent);let A=0;const w=e.rtlTranslate?-1:1,I=d(S);if(L.forceToAxis)if(e.isHorizontal())if(Math.abs(I.pixelX)>Math.abs(I.pixelY))A=-I.pixelX*w;else return!0;else if(Math.abs(I.pixelY)>Math.abs(I.pixelX))A=-I.pixelY;else return!0;else A=Math.abs(I.pixelX)>Math.abs(I.pixelY)?-I.pixelX*w:-I.pixelY;if(A===0)return!0;L.invert&&(A=-A);let P=e.getTranslate()+A*L.sensitivity;if(P>=e.minTranslate()&&(P=e.minTranslate()),P<=e.maxTranslate()&&(P=e.maxTranslate()),T=e.params.loop?!0:!(P===e.minTranslate()||P===e.maxTranslate()),T&&e.params.nested&&S.stopPropagation(),!e.params.freeMode||!e.params.freeMode.enabled){const R={time:Me(),delta:Math.abs(A),direction:Math.sign(A),raw:v};c.length>=2&&c.shift();const D=c.length?c[c.length-1]:void 0;if(c.push(R),D?(R.direction!==D.direction||R.delta>D.delta||R.time>D.time+150)&&h(R):h(R),p(R))return!0}else{const R={time:Me(),delta:Math.abs(A),direction:Math.sign(A)},D=l&&R.time<l.time+500&&R.delta<=l.delta&&R.direction===l.direction;if(!D){l=void 0;let _=e.getTranslate()+A*L.sensitivity;const B=e.isBeginning,k=e.isEnd;if(_>=e.minTranslate()&&(_=e.minTranslate()),_<=e.maxTranslate()&&(_=e.maxTranslate()),e.setTransition(0),e.setTranslate(_),e.updateProgress(),e.updateActiveIndex(),e.updateSlidesClasses(),(!B&&e.isBeginning||!k&&e.isEnd)&&e.updateSlidesClasses(),e.params.loop&&e.loopFix({direction:R.direction<0?"next":"prev",byMousewheel:!0}),e.params.freeMode.sticky){clearTimeout(a),a=void 0,c.length>=15&&c.shift();const M=c.length?c[c.length-1]:void 0,N=c[0];if(c.push(R),M&&(R.delta>M.delta||R.direction!==M.direction))c.splice(0);else if(c.length>=15&&R.time-N.time<500&&N.delta-R.delta>=1&&R.delta<=6){const G=A>0?.8:.2;l=R,c.splice(0),a=ft(()=>{e.destroyed||!e.params||e.slideToClosest(e.params.speed,!0,void 0,G)},0)}a||(a=ft(()=>{if(e.destroyed||!e.params)return;const G=.5;l=R,c.splice(0),e.slideToClosest(e.params.speed,!0,void 0,G)},500))}if(D||i("scroll",S),e.params.autoplay&&e.params.autoplayDisableOnInteraction&&e.autoplay.stop(),L.releaseOnEdges&&(_===e.minTranslate()||_===e.maxTranslate()))return!0}}return S.preventDefault?S.preventDefault():S.returnValue=!1,!1}function g(v){let S=e.el;e.params.mousewheel.eventsTarget!=="container"&&(S=document.querySelector(e.params.mousewheel.eventsTarget)),S[v]("mouseenter",u),S[v]("mouseleave",f),S[v]("wheel",m)}function y(){return e.params.cssMode?(e.wrapperEl.removeEventListener("wheel",m),!0):e.mousewheel.enabled?!1:(g("addEventListener"),e.mousewheel.enabled=!0,!0)}function E(){return e.params.cssMode?(e.wrapperEl.addEventListener(event,m),!0):e.mousewheel.enabled?(g("removeEventListener"),e.mousewheel.enabled=!1,!0):!1}s("init",()=>{!e.params.mousewheel.enabled&&e.params.cssMode&&E(),e.params.mousewheel.enabled&&y()}),s("destroy",()=>{e.params.cssMode&&y(),e.mousewheel.enabled&&E()}),Object.assign(e.mousewheel,{enable:y,disable:E})}function Lr(r,e,t,s){return r.params.createElements&&Object.keys(s).forEac
vendor: 5,350 bytes, line 36
36h(i=>{if(!t[i]&&t.auto===!0){let n=Te(r.el,`.${s[i]}`)[0];n||(n=_e("div",s[i]),n.className=s[i],r.el.append(n)),t[i]=n,e[i]=n}}),t}function am(r){let{swiper:e,extendParams:t,on:s,emit:i}=r;t({navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock",navigationDisabledClass:"swiper-navigation-disabled"}}),e.navigation={nextEl:null,prevEl:null};function n(p){let m;return p&&typeof p=="string"&&e.isElement&&(m=e.el.querySelector(p)||e.hostEl.querySelector(p),m)?m:(p&&(typeof p=="string"&&(m=[...document.querySelectorAll(p)]),e.params.uniqueNavElements&&typeof p=="string"&&m&&m.length>1&&e.el.querySelectorAll(p).length===1?m=e.el.querySelector(p):m&&m.length===1&&(m=m[0])),p&&!m?p:m)}function a(p,m){const g=e.params.navigation;p=re(p),p.forEach(y=>{y&&(y.classList[m?"add":"remove"](...g.disabledClass.split(" ")),y.tagName==="BUTTON"&&(y.disabled=m),e.params.watchOverflow&&e.enabled&&y.classList[e.isLocked?"add":"remove"](g.lockClass))})}function o(){const{nextEl:p,prevEl:m}=e.navigation;if(e.params.loop){a(m,!1),a(p,!1);return}a(m,e.isBeginning&&!e.params.rewind),a(p,e.isEnd&&!e.params.rewind)}function l(p){p.preventDefault(),!(e.isBeginning&&!e.params.loop&&!e.params.rewind)&&(e.slidePrev(),i("navigationPrev"))}function c(p){p.preventDefault(),!(e.isEnd&&!e.params.loop&&!e.params.rewind)&&(e.slideNext(),i("navigationNext"))}function d(){const p=e.params.navigation;if(e.params.navigation=Lr(e,e.originalParams.navigation,e.params.navigation,{nextEl:"swiper-button-next",prevEl:"swiper-button-prev"}),!(p.nextEl||p.prevEl))return;let m=n(p.nextEl),g=n(p.prevEl);Object.assign(e.navigation,{nextEl:m,prevEl:g}),m=re(m),g=re(g);const y=(E,v)=>{E&&E.addEventListener("click",v==="next"?c:l),!e.enabled&&E&&E.classList.add(...p.lockClass.split(" "))};m.forEach(E=>y(E,"next")),g.forEach(E=>y(E,"prev"))}function u(){let{nextEl:p,prevEl:m}=e.navigation;p=re(p),m=re(m);const g=(y,E)=>{y.removeEventListener("click",E==="next"?c:l),y.classList.remove(...e.params.navigation.disabledClass.split(" "))};p.forEach(y=>g(y,"next")),m.forEach(y=>g(y,"prev"))}s("init",()=>{e.params.navigation.enabled===!1?h():(d(),o())}),s("toEdge fromEdge lock unlock",()=>{o()}),s("destroy",()=>{u()}),s("enable disable",()=>{let{nextEl:p,prevEl:m}=e.navigation;if(p=re(p),m=re(m),e.enabled){o();return}[...p,...m].filter(g=>!!g).forEach(g=>g.classList.add(e.params.navigation.lockClass))}),s("click",(p,m)=>{let{nextEl:g,prevEl:y}=e.navigation;g=re(g),y=re(y);const E=m.target;let v=y.includes(E)||g.includes(E);if(e.isElement&&!v){const S=m.path||m.composedPath&&m.composedPath();S&&(v=S.find(T=>g.includes(T)||y.includes(T)))}if(e.params.navigation.hideOnClick&&!v){if(e.pagination&&e.params.pagination&&e.params.pagination.clickable&&(e.pagination.el===E||e.pagination.el.contains(E)))return;let S;g.length?S=g[0].classList.contains(e.params.navigation.hiddenClass):y.length&&(S=y[0].classList.contains(e.params.navigation.hiddenClass)),i(S===!0?"navigationShow":"navigationHide"),[...g,...y].filter(T=>!!T).forEach(T=>T.classList.toggle(e.params.navigation.hiddenClass))}});const f=()=>{e.el.classList.remove(...e.params.navigation.navigationDisabledClass.split(" ")),d(),o()},h=()=>{e.el.classList.add(...e.params.navigation.navigationDisabledClass.split(" ")),u()};Object.assign(e.navigation,{enable:f,disable:h,update:o,init:d,destroy:u})}function Je(r){return r===void 0&&(r=""),`.${r.trim().replace(/([\.:!+\/])/g,"\\$1").replace(/ /g,".")}`}function om(r){let{swiper:e,extendParams:t,on:s,emit:i}=r;const n="swiper-pagination";t({pagination:{el:null,bulletElement:"span",clickable:!1,hideOnClick:!1,renderBullet:null,renderProgressbar:null,renderFraction:null,renderCustom:null,progressbarOpposite:!1,type:"bullets",dynamicBullets:!1,dynamicMainBullets:1,formatFractionCurrent:E=>E,formatFractionTotal:E=>E,bulletClass:`${n}-bullet`,bulletActiveClass:`${n}-bullet-active`,modifierClass:`${n}-`,currentClass:`${n}-current`,totalClass:`${n}-total`,hiddenClass:`${n}-hidden`,progressbarFillClass:`${n}-progressbar-fill`,progressbarOppositeClass:`${n}-progressbar-opposite`,clickableClass:`${n}-clickable`,lockClass:`${n}-lock`,horizontalClass:`${n}-horizontal`,verticalClass:`${n}-vertical`,paginationDisabledClass:`${n}-disabled`}}),e.pagination={el:null,bullets:[]};let a,o=0;function l(){return!e.params.pagination.el||!e.pagination.el||Array.isArray(e.pagination.el)&&e.pagination.el.length===0}function c(E,v){const{bulletActiveClass:S}=e.params.pagination;E&&(E=E[`${v==="prev"?"previous":"next"}ElementSibling`],E&&(E.classList.add(`${S}-${v}`),E=E[`${v==="prev"?"previous":"next"}ElementSibling`],E&&E.classList.add(`${S}-${v}-${v}`)))}function d(E,v,S){if(E=E%S,v=v%S,v===E+1)return"next";if(v===E-1)return"previous"}function u(E){const v=E.target.closest(Je(e.params.pagination.bulletClass));if(!v)return;E.preventDefault();const S=Xt(v)*e.params.slidesPerGroup;if(e.params.loop){if(e.realIndex===S)return;const T=d(e.realIndex,S,e.slides.length);T==="next"?e.slideNext():T==="previous"?e.slidePrev():e.slideToLoop(S)}else e.slideTo(S)}function f(){const E=e.rtl,v=e.params.pagination;if(l())return;let S=e.pagination.el;S=re(S);let T,L;const b=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.slides.length,C=e.params.loop?Math.
vendor: 5,173 bytes, line 36
36ceil(b/e.params.slidesPerGroup):e.snapGrid.length;if(e.params.loop?(L=e.previousRealIndex||0,T=e.params.slidesPerGroup>1?Math.floor(e.realIndex/e.params.slidesPerGroup):e.realIndex):typeof e.snapIndex<"u"?(T=e.snapIndex,L=e.previousSnapIndex):(L=e.previousIndex||0,T=e.activeIndex||0),v.type==="bullets"&&e.pagination.bullets&&e.pagination.bullets.length>0){const A=e.pagination.bullets;let w,I,P;if(v.dynamicBullets&&(a=tr(A[0],e.isHorizontal()?"width":"height"),S.forEach(R=>{R.style[e.isHorizontal()?"width":"height"]=`${a*(v.dynamicMainBullets+4)}px`}),v.dynamicMainBullets>1&&L!==void 0&&(o+=T-(L||0),o>v.dynamicMainBullets-1?o=v.dynamicMainBullets-1:o<0&&(o=0)),w=Math.max(T-o,0),I=w+(Math.min(A.length,v.dynamicMainBullets)-1),P=(I+w)/2),A.forEach(R=>{const D=[...["","-next","-next-next","-prev","-prev-prev","-main"].map(_=>`${v.bulletActiveClass}${_}`)].map(_=>typeof _=="string"&&_.includes(" ")?_.split(" "):_).flat();R.classList.remove(...D)}),S.length>1)A.forEach(R=>{const D=Xt(R);D===T?R.classList.add(...v.bulletActiveClass.split(" ")):e.isElement&&R.setAttribute("part","bullet"),v.dynamicBullets&&(D>=w&&D<=I&&R.classList.add(...`${v.bulletActiveClass}-main`.split(" ")),D===w&&c(R,"prev"),D===I&&c(R,"next"))});else{const R=A[T];if(R&&R.classList.add(...v.bulletActiveClass.split(" ")),e.isElement&&A.forEach((D,_)=>{D.setAttribute("part",_===T?"bullet-active":"bullet")}),v.dynamicBullets){const D=A[w],_=A[I];for(let B=w;B<=I;B+=1)A[B]&&A[B].classList.add(...`${v.bulletActiveClass}-main`.split(" "));c(D,"prev"),c(_,"next")}}if(v.dynamicBullets){const R=Math.min(A.length,v.dynamicMainBullets+4),D=(a*R-a)/2-P*a,_=E?"right":"left";A.forEach(B=>{B.style[e.isHorizontal()?_:"top"]=`${D}px`})}}S.forEach((A,w)=>{if(v.type==="fraction"&&(A.querySelectorAll(Je(v.currentClass)).forEach(I=>{I.textContent=v.formatFractionCurrent(T+1)}),A.querySelectorAll(Je(v.totalClass)).forEach(I=>{I.textContent=v.formatFractionTotal(C)})),v.type==="progressbar"){let I;v.progressbarOpposite?I=e.isHorizontal()?"vertical":"horizontal":I=e.isHorizontal()?"horizontal":"vertical";const P=(T+1)/C;let R=1,D=1;I==="horizontal"?R=P:D=P,A.querySelectorAll(Je(v.progressbarFillClass)).forEach(_=>{_.style.transform=`translate3d(0,0,0) scaleX(${R}) scaleY(${D})`,_.style.transitionDuration=`${e.params.speed}ms`})}v.type==="custom"&&v.renderCustom?(A.innerHTML=v.renderCustom(e,T+1,C),w===0&&i("paginationRender",A)):(w===0&&i("paginationRender",A),i("paginationUpdate",A)),e.params.watchOverflow&&e.enabled&&A.classList[e.isLocked?"add":"remove"](v.lockClass)})}function h(){const E=e.params.pagination;if(l())return;const v=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.grid&&e.params.grid.rows>1?e.slides.length/Math.ceil(e.params.grid.rows):e.slides.length;let S=e.pagination.el;S=re(S);let T="";if(E.type==="bullets"){let L=e.params.loop?Math.ceil(v/e.params.slidesPerGroup):e.snapGrid.length;e.params.freeMode&&e.params.freeMode.enabled&&L>v&&(L=v);for(let b=0;b<L;b+=1)E.renderBullet?T+=E.renderBullet.call(e,b,E.bulletClass):T+=`<${E.bulletElement} ${e.isElement?'part="bullet"':""} class="${E.bulletClass}"></${E.bulletElement}>`}E.type==="fraction"&&(E.renderFraction?T=E.renderFraction.call(e,E.currentClass,E.totalClass):T=`<span class="${E.currentClass}"></span> / <span class="${E.totalClass}"></span>`),E.type==="progressbar"&&(E.renderProgressbar?T=E.renderProgressbar.call(e,E.progressbarFillClass):T=`<span class="${E.progressbarFillClass}"></span>`),e.pagination.bullets=[],S.forEach(L=>{E.type!=="custom"&&(L.innerHTML=T||""),E.type==="bullets"&&e.pagination.bullets.push(...L.querySelectorAll(Je(E.bulletClass)))}),E.type!=="custom"&&i("paginationRender",S[0])}function p(){e.params.pagination=Lr(e,e.originalParams.pagination,e.params.pagination,{el:"swiper-pagination"});const E=e.params.pagination;if(!E.el)return;let v;typeof E.el=="string"&&e.isElement&&(v=e.el.querySelector(E.el)),!v&&typeof E.el=="string"&&(v=[...document.querySelectorAll(E.el)]),v||(v=E.el),!(!v||v.length===0)&&(e.params.uniqueNavElements&&typeof E.el=="string"&&Array.isArray(v)&&v.length>1&&(v=[...e.el.querySelectorAll(E.el)],v.length>1&&(v=v.filter(S=>dt(S,".swiper")[0]===e.el)[0])),Array.isArray(v)&&v.length===1&&(v=v[0]),Object.assign(e.pagination,{el:v}),v=re(v),v.forEach(S=>{E.type==="bullets"&&E.clickable&&S.classList.add(...(E.clickableClass||"").split(" ")),S.classList.add(E.modifierClass+E.type),S.classList.add(e.isHorizontal()?E.horizontalClass:E.verticalClass),E.type==="bullets"&&E.dynamicBullets&&(S.classList.add(`${E.modifierClass}${E.type}-dynamic`),o=0,E.dynamicMainBullets<1&&(E.dynamicMainBullets=1)),E.type==="progressbar"&&E.progressbarOpposite&&S.classList.add(E.progressbarOppositeClass),E.clickable&&S.addEventListener("click",u),e.enabled||S.classList.add(E.lockClass)}))}function m(){const E=e.params.pagination;if(l())return;let v=e.pagination.el;v&&(v=re(v),v.forEach(S=>{S.classList.remove(E.hiddenClass),S.classList.remove(E.modifierClass+E.type),S.classList.remove(e.isHorizontal()?E.horizontalClass:E.verticalClass),E.clickable&&(S.classList.remove(...(E.clickableClass||"").split(" ")),S.removeEventListener("click",u))}
vendor: 7,069 bytes, line 36
36)),e.pagination.bullets&&e.pagination.bullets.forEach(S=>S.classList.remove(...E.bulletActiveClass.split(" ")))}s("changeDirection",()=>{if(!e.pagination||!e.pagination.el)return;const E=e.params.pagination;let{el:v}=e.pagination;v=re(v),v.forEach(S=>{S.classList.remove(E.horizontalClass,E.verticalClass),S.classList.add(e.isHorizontal()?E.horizontalClass:E.verticalClass)})}),s("init",()=>{e.params.pagination.enabled===!1?y():(p(),h(),f())}),s("activeIndexChange",()=>{typeof e.snapIndex>"u"&&f()}),s("snapIndexChange",()=>{f()}),s("snapGridLengthChange",()=>{h(),f()}),s("destroy",()=>{m()}),s("enable disable",()=>{let{el:E}=e.pagination;E&&(E=re(E),E.forEach(v=>v.classList[e.enabled?"remove":"add"](e.params.pagination.lockClass)))}),s("lock unlock",()=>{f()}),s("click",(E,v)=>{const S=v.target,T=re(e.pagination.el);if(e.params.pagination.el&&e.params.pagination.hideOnClick&&T&&T.length>0&&!S.classList.contains(e.params.pagination.bulletClass)){if(e.navigation&&(e.navigation.nextEl&&S===e.navigation.nextEl||e.navigation.prevEl&&S===e.navigation.prevEl))return;const L=T[0].classList.contains(e.params.pagination.hiddenClass);i(L===!0?"paginationShow":"paginationHide"),T.forEach(b=>b.classList.toggle(e.params.pagination.hiddenClass))}});const g=()=>{e.el.classList.remove(e.params.pagination.paginationDisabledClass);let{el:E}=e.pagination;E&&(E=re(E),E.forEach(v=>v.classList.remove(e.params.pagination.paginationDisabledClass))),p(),h(),f()},y=()=>{e.el.classList.add(e.params.pagination.paginationDisabledClass);let{el:E}=e.pagination;E&&(E=re(E),E.forEach(v=>v.classList.add(e.params.pagination.paginationDisabledClass))),m()};Object.assign(e.pagination,{enable:g,disable:y,render:h,update:f,init:p,destroy:m})}function lm(r){let{swiper:e,extendParams:t,on:s,emit:i}=r;const n=Se();let a=!1,o=null,l=null,c,d,u,f;t({scrollbar:{el:null,dragSize:"auto",hide:!1,draggable:!1,snapOnRelease:!0,lockClass:"swiper-scrollbar-lock",dragClass:"swiper-scrollbar-drag",scrollbarDisabledClass:"swiper-scrollbar-disabled",horizontalClass:"swiper-scrollbar-horizontal",verticalClass:"swiper-scrollbar-vertical"}}),e.scrollbar={el:null,dragEl:null};function h(){if(!e.params.scrollbar.el||!e.scrollbar.el)return;const{scrollbar:P,rtlTranslate:R}=e,{dragEl:D,el:_}=P,B=e.params.scrollbar,k=e.params.loop?e.progressLoop:e.progress;let M=d,N=(u-d)*k;R?(N=-N,N>0?(M=d-N,N=0):-N+d>u&&(M=u+N)):N<0?(M=d+N,N=0):N+d>u&&(M=u-N),e.isHorizontal()?(D.style.transform=`translate3d(${N}px, 0, 0)`,D.style.width=`${M}px`):(D.style.transform=`translate3d(0px, ${N}px, 0)`,D.style.height=`${M}px`),B.hide&&(clearTimeout(o),_.style.opacity=1,o=setTimeout(()=>{_.style.opacity=0,_.style.transitionDuration="400ms"},1e3))}function p(P){!e.params.scrollbar.el||!e.scrollbar.el||(e.scrollbar.dragEl.style.transitionDuration=`${P}ms`)}function m(){if(!e.params.scrollbar.el||!e.scrollbar.el)return;const{scrollbar:P}=e,{dragEl:R,el:D}=P;R.style.width="",R.style.height="",u=e.isHorizontal()?D.offsetWidth:D.offsetHeight,f=e.size/(e.virtualSize+e.params.slidesOffsetBefore-(e.params.centeredSlides?e.snapGrid[0]:0)),e.params.scrollbar.dragSize==="auto"?d=u*f:d=parseInt(e.params.scrollbar.dragSize,10),e.isHorizontal()?R.style.width=`${d}px`:R.style.height=`${d}px`,f>=1?D.style.display="none":D.style.display="",e.params.scrollbar.hide&&(D.style.opacity=0),e.params.watchOverflow&&e.enabled&&P.el.classList[e.isLocked?"add":"remove"](e.params.scrollbar.lockClass)}function g(P){return e.isHorizontal()?P.clientX:P.clientY}function y(P){const{scrollbar:R,rtlTranslate:D}=e,{el:_}=R;let B;B=(g(P)-zs(_)[e.isHorizontal()?"left":"top"]-(c!==null?c:d/2))/(u-d),B=Math.max(Math.min(B,1),0),D&&(B=1-B);const k=e.minTranslate()+(e.maxTranslate()-e.minTranslate())*B;e.updateProgress(k),e.setTranslate(k),e.updateActiveIndex(),e.updateSlidesClasses()}function E(P){const R=e.params.scrollbar,{scrollbar:D,wrapperEl:_}=e,{el:B,dragEl:k}=D;a=!0,c=P.target===k?g(P)-P.target.getBoundingClientRect()[e.isHorizontal()?"left":"top"]:null,P.preventDefault(),P.stopPropagation(),_.style.transitionDuration="100ms",k.style.transitionDuration="100ms",y(P),clearTimeout(l),B.style.transitionDuration="0ms",R.hide&&(B.style.opacity=1),e.params.cssMode&&(e.wrapperEl.style["scroll-snap-type"]="none"),i("scrollbarDragStart",P)}function v(P){const{scrollbar:R,wrapperEl:D}=e,{el:_,dragEl:B}=R;a&&(P.preventDefault&&P.cancelable?P.preventDefault():P.returnValue=!1,y(P),D.style.transitionDuration="0ms",_.style.transitionDuration="0ms",B.style.transitionDuration="0ms",i("scrollbarDragMove",P))}function S(P){const R=e.params.scrollbar,{scrollbar:D,wrapperEl:_}=e,{el:B}=D;a&&(a=!1,e.params.cssMode&&(e.wrapperEl.style["scroll-snap-type"]="",_.style.transitionDuration=""),R.hide&&(clearTimeout(l),l=ft(()=>{B.style.opacity=0,B.style.transitionDuration="400ms"},1e3)),i("scrollbarDragEnd",P),R.snapOnRelease&&e.slideToClosest())}function T(P){const{scrollbar:R,params:D}=e,_=R.el;if(!_)return;const B=_,k=D.passiveListeners?{passive:!1,capture:!1}:!1,M=D.passiveListeners?{passive:!0,capture:!1}:!1;if(!B)return;const N=P==="on"?"addEventListener":"removeEventListener";B[N]("pointerdown",E,k),n[N]("pointermove",v,k),n[N]("pointerup",S,M)}function L(){!e.params.scrollbar.el||!e.scrollbar.el||T("on")}function b(){!e.params.scrollbar.el||!e.scrollbar.el||T("off")}function C(){const{scrollbar:P,el:R}=e;e.params.scrollbar=Lr(e,e.originalParams.scrollbar,e.params.scrollbar,{el:"swiper-scrollbar"});const D=e.params.scrollbar;if(!D.el)return;let _;if(typeof D.el=="string"&&e.isElement&&(_=e.el.querySelector(D.el)),!_&&typeof D.el=="string"){if(_=n.querySelectorAll(D.el),!_.length)return}else _||(_=D.el);e.params.uniqueNavElements&&typeof D.el=="string"&&_.length>1&&R.querySelectorAll(D.el).length===1&&(_=R.querySelector(D.el)),_.length>0&&(_=_[0]),_.classList.add(e.isHorizontal()?D.horizontalClass:D.verticalClass);let B;_&&(B=_.querySelector(Je(e.params.scrollbar.dragClass)),B||(B=_e("div",e.params.scrollbar.dragClass),_.append(B))),Object.assign(P,{el:_,dragEl:B}),D.draggable&&L(),_&&_.classList[e.enabled?"remove":"add"](...tt(e.params.scrollbar.lockClass))}function A(){const P=e.params.scrollbar,R=e.scrollbar.el;R&&R.classList.remove(...tt(e.isHorizontal()?P.horizontalClass:P.verticalClass)),b()}s("changeDirection",()=>{if(!e.scrollbar||!e.scrollbar.el)return;const P=e.params.scrollbar;let{el:R}=e.scrollbar;R=re(R),R.forEach(D=>{D.classList.remove(P.horizontalClass,P.verticalClass),D.classList.add(e.isHorizontal()?P.horizontalClass:P.verticalClass)})}),s("init",()=>{e.params.scrollbar.enabled===!1?I():(C(),m(),h())}),s("update resize observerUpdate lock unlock changeDirection",()=>{m()}),s("setTranslate",()=>{h()}),s("setTransition",(P,R)=>{p(R)}),s("enable disable",()=>{const{el:P}=e.scrollbar;P&&P.classList[e.enabled?"remove":"add"](...tt(e.params.scrollbar.lockClass))}),s("destroy",()=>{A()});const w=()=>{e.el.classList.remove(...tt(e.params.scrollbar.scrollbarDisabledClass)),e.scrollbar.el&&e.scrollbar.el.classList.remove(...tt(e.params.scrollbar.scrollbarDisabledClass)),C(),m(
36),h()},I=()=>{e.el.classList.add(...tt(e.params.scrollbar.scrollbarDisabledClass)),e.scrollbar.el&&e.scrollbar.el.classList.add(...tt(e.params.scrollbar.scrollbarDisabledClass)),A()};Object.assign(e.scrollbar,{enable:w,disable:I,updateSize:m,setTranslate:h,init:C,destroy:A})}function cm(r){let{swiper:e,extendParams:t,on:s}=r;t({parallax:{enabled:!1}});const i="[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]",n=(l,c)=>{const{rtl:d}=e,u=d?-1:1,f=l.getAttribute("data-swiper-parallax")||"0";let h=l.getAttribute("data-swiper-parallax-x"),p=l.getAttribute("data-swiper-parallax-y");const m=l.getAttribute("data-swiper-parallax-scale"),g=l.getAttribute("data-swiper-parallax-opacity"),y=l.getAttribute("data-swiper-parallax-rotate");if(h||p?(h=h||"0",p=p||"0"):e.isHorizontal()?(h=f,p="0"):(p=f,h="0"),h.indexOf("%")>=0?h=`${parseInt(h,10)*c*u}%`:h=`${h*c*u}px`,p.indexOf("%")>=0?p=`${parseInt(p,10)*c}%`:p=`${p*c}px`,typeof g<"u"&&g!==null){const v=g-(g-1)*(1-Math.abs(c));l.style.opacity=v}let E=`translate3d(${h}, ${p}, 0px)`;if(typeof m<"u"&&m!==null){const v=m-(m-1)*(1-Math.abs(c));E+=` scale(${v})`}if(y&&typeof y<"u"&&y!==null){const v=y*c*-1;E+=` rotate(${v}deg)`}l.style.transform=E},a=()=>{const{el:l,slides:c,progress:d,snapGrid:u,isElement:f}=e,h=Te(l,i);e.isElement&&h.push(...Te(e.hostEl,i)),h.forEach(p=>{n(p,d)}),c.forEach((p,m)=>{let g=p.progress;e.params.slidesPerGroup>1&&e.params.slidesPerView!=="auto"&&(g+=Math.ceil(m/2)-d*(u.length-1)),g=Math.min(Math.max(g,-1),1),p.querySelectorAll(`${i}, [data-swiper-parallax-rotate]`).forEach(y=>{n(y,g)})})},o=function(l){l===void 0&&(l=e.params.speed);const{el:c,hostEl:d}=e,u=[...c.querySelectorAll(i)];e.isElement&&u.push(...d.querySelectorAll(i)),u.forEach(f=>{let h=parseInt(f.getAttribute("data-swiper-parallax-duration"),10)||l;l===0&&(h=0),f.style.transitionDuration=`${h}ms`})};s("beforeInit",()=>{e.params.parallax.enabled&&(e.params.watchSlidesProgress=!0,e.originalParams.watchSlidesProgress=!0)}),s("init",()=>{e.params.parallax.enabled&&a()}),s("setTranslate",()=>{e.params.parallax.enabled&&a()}),s("setTransition",(l,c)=>{e.params.parallax.enabled&&o(c)})}function dm(r){let{swiper:e,extendParams:t,on:s,emit:i}=r;const n=he();t({zoom:{enabled:!1,limitToOriginalSize:!1,maxRatio:3,minRatio:1,toggle:!0,containerClass:"swiper-zoom-container",zoomedSlideClass:"swiper-slide-zoomed"}}),e.zoom={enabled:!1};let a=1,o=!1,l,c;const d=[],u={originX:0,originY:0,slideEl:void 0,slideWidth:void 0,slideHeight:void 0,imageEl:void 0,imageWrapEl:void 0,maxRatio:3},f={isTouched:void 0,isMoved:void 0,currentX:void 0,currentY:void 0,minX:void 0,minY:void 0,maxX:void 0,maxY:void 0,width:void 0,height:void 0,startX:void 0,startY:void 0,touchesStart:{},touchesCurrent:{}},h={x:void 0,y:void 0,prevPositionX:void 0,prevPositionY:void 0,prevTime:void 0};let p=1;Object.defineProperty(e.zoom,"scale",{get(){return p},set(U){if(p!==U){const H=u.imageEl,z=u.slideEl;i("zoomChange",U,H,z)}p=U}});function m(){if(d.length<2)return 1;const U=d[0].pageX,H=d[0].pageY,z=d[1].pageX,Z=d[1].pageY;return Math.sqrt((z-U)**2+(Z-H)**2)}function g(){const U=e.params.zoom,H=u.imageWrapEl.getAttribute("data-swiper-zoom")||U.maxRatio;if(U.limitToOriginalSize&&u.imageEl&&u.imageEl.naturalWidth){const z=u.imageEl.naturalWidth/u.imageEl.offsetWidth;return Math.min(z,H)}return H}function y(){if(d.length<2)return{x:null,y:null};const U=u.imageEl.getBoundingClientRect();return[(d[0].pageX+(d[1].pageX-d[0].pageX)/2-U.x-n.scrollX)/a,(d[0].pageY+(d[1].pageY-d[0].pageY)/2-U.y-n.scrollY)/a]}function E(){return e.isElement?"swiper-slide":`.${e.params.slideClass}`}function v(U){const H=E();return!!(U.target.matches(H)||e.slides.filter(z=>z.contains(U.target)).length>0)}function S(U){const H=`.${e.params.zoom.containerClass}`;return!!(U.target.matches(H)||[...e.hostEl.querySelectorAll(H)].filter(z=>z.contains(U.target)).length>0)}function T(U){if(U.pointerType==="mouse"&&d.splice(0,d.length),!v(U))return;const H=e.params.zoom;if(l=!1,c=!1,d.push(U),!(d.length<2)){if(l=!0,u.scaleStart=m(),!u.slideEl){u.slideEl=U.target.closest(`.${e.params.slideClass}, swiper-slide`),u.slideEl||(u.slideEl=e.slides[e.activeIndex]);let z=u.slideEl.querySelector(`.${H.containerClass}`);
vendor: 4,951 bytes, line 36
36if(z&&(z=z.querySelectorAll("picture, img, svg, canvas, .swiper-zoom-target")[0]),u.imageEl=z,z?u.imageWrapEl=dt(u.imageEl,`.${H.containerClass}`)[0]:u.imageWrapEl=void 0,!u.imageWrapEl){u.imageEl=void 0;return}u.maxRatio=g()}if(u.imageEl){const[z,Z]=y();u.originX=z,u.originY=Z,u.imageEl.style.transitionDuration="0ms"}o=!0}}function L(U){if(!v(U))return;const H=e.params.zoom,z=e.zoom,Z=d.findIndex(K=>K.pointerId===U.pointerId);Z>=0&&(d[Z]=U),!(d.length<2)&&(c=!0,u.scaleMove=m(),u.imageEl&&(z.scale=u.scaleMove/u.scaleStart*a,z.scale>u.maxRatio&&(z.scale=u.maxRatio-1+(z.scale-u.maxRatio+1)**.5),z.scale<H.minRatio&&(z.scale=H.minRatio+1-(H.minRatio-z.scale+1)**.5),u.imageEl.style.transform=`translate3d(0,0,0) scale(${z.scale})`))}function b(U){if(!v(U)||U.pointerType==="mouse"&&U.type==="pointerout")return;const H=e.params.zoom,z=e.zoom,Z=d.findIndex(K=>K.pointerId===U.pointerId);Z>=0&&d.splice(Z,1),!(!l||!c)&&(l=!1,c=!1,u.imageEl&&(z.scale=Math.max(Math.min(z.scale,u.maxRatio),H.minRatio),u.imageEl.style.transitionDuration=`${e.params.speed}ms`,u.imageEl.style.transform=`translate3d(0,0,0) scale(${z.scale})`,a=z.scale,o=!1,z.scale>1&&u.slideEl?u.slideEl.classList.add(`${H.zoomedSlideClass}`):z.scale<=1&&u.slideEl&&u.slideEl.classList.remove(`${H.zoomedSlideClass}`),z.scale===1&&(u.originX=0,u.originY=0,u.slideEl=void 0)))}let C;function A(){e.touchEventsData.preventTouchMoveFromPointerMove=!1}function w(){clearTimeout(C),e.touchEventsData.preventTouchMoveFromPointerMove=!0,C=setTimeout(()=>{e.destroyed||A()})}function I(U){const H=e.device;if(!u.imageEl||f.isTouched)return;H.android&&U.cancelable&&U.preventDefault(),f.isTouched=!0;const z=d.length>0?d[0]:U;f.touchesStart.x=z.pageX,f.touchesStart.y=z.pageY}function P(U){if(!v(U)||!S(U))return;const H=e.zoom;if(!u.imageEl||!f.isTouched||!u.slideEl)return;f.isMoved||(f.width=u.imageEl.offsetWidth||u.imageEl.clientWidth,f.height=u.imageEl.offsetHeight||u.imageEl.clientHeight,f.startX=er(u.imageWrapEl,"x")||0,f.startY=er(u.imageWrapEl,"y")||0,u.slideWidth=u.slideEl.offsetWidth,u.slideHeight=u.slideEl.offsetHeight,u.imageWrapEl.style.transitionDuration="0ms");const z=f.width*H.scale,Z=f.height*H.scale;if(f.minX=Math.min(u.slideWidth/2-z/2,0),f.maxX=-f.minX,f.minY=Math.min(u.slideHeight/2-Z/2,0),f.maxY=-f.minY,f.touchesCurrent.x=d.length>0?d[0].pageX:U.pageX,f.touchesCurrent.y=d.length>0?d[0].pageY:U.pageY,Math.max(Math.abs(f.touchesCurrent.x-f.touchesStart.x),Math.abs(f.touchesCurrent.y-f.touchesStart.y))>5&&(e.allowClick=!1),!f.isMoved&&!o){if(e.isHorizontal()&&(Math.floor(f.minX)===Math.floor(f.startX)&&f.touchesCurrent.x<f.touchesStart.x||Math.floor(f.maxX)===Math.floor(f.startX)&&f.touchesCurrent.x>f.touchesStart.x)){f.isTouched=!1,A();return}if(!e.isHorizontal()&&(Math.floor(f.minY)===Math.floor(f.startY)&&f.touchesCurrent.y<f.touchesStart.y||Math.floor(f.maxY)===Math.floor(f.startY)&&f.touchesCurrent.y>f.touchesStart.y)){f.isTouched=!1,A();return}}U.cancelable&&U.preventDefault(),U.stopPropagation(),w(),f.isMoved=!0;const Q=(H.scale-a)/(u.maxRatio-e.params.zoom.minRatio),{originX:q,originY:oe}=u;f.currentX=f.touchesCurrent.x-f.touchesStart.x+f.startX+Q*(f.width-q*2),f.currentY=f.touchesCurrent.y-f.touchesStart.y+f.startY+Q*(f.height-oe*2),f.currentX<f.minX&&(f.currentX=f.minX+1-(f.minX-f.currentX+1)**.8),f.currentX>f.maxX&&(f.currentX=f.maxX-1+(f.currentX-f.maxX+1)**.8),f.currentY<f.minY&&(f.currentY=f.minY+1-(f.minY-f.currentY+1)**.8),f.currentY>f.maxY&&(f.currentY=f.maxY-1+(f.currentY-f.maxY+1)**.8),h.prevPositionX||(h.prevPositionX=f.touchesCurrent.x),h.prevPositionY||(h.prevPositionY=f.touchesCurrent.y),h.prevTime||(h.prevTime=Date.now()),h.x=(f.touchesCurrent.x-h.prevPositionX)/(Date.now()-h.prevTime)/2,h.y=(f.touchesCurrent.y-h.prevPositionY)/(Date.now()-h.prevTime)/2,Math.abs(f.touchesCurrent.x-h.prevPositionX)<2&&(h.x=0),Math.abs(f.touchesCurrent.y-h.prevPositionY)<2&&(h.y=0),h.prevPositionX=f.touchesCurrent.x,h.prevPositionY=f.touchesCurrent.y,h.prevTime=Date.now(),u.imageWrapEl.style.transform=`translate3d(${f.currentX}px, ${f.currentY}px,0)`}function R(){const U=e.zoom;if(!u.imageEl)return;if(!f.isTouched||!f.isMoved){f.isTouched=!1,f.isMoved=!1;return}f.isTouched=!1,f.isMoved=!1;let H=300,z=300;const Z=h.x*H,K=f.currentX+Z,Q=h.y*z,q=f.currentY+Q;h.x!==0&&(H=Math.abs((K-f.currentX)/h.x)),h.y!==0&&(z=Math.abs((q-f.currentY)/h.y));const oe=Math.max(H,z);f.currentX=K,f.currentY=q;const pe=f.width*U.scale,we=f.height*U.scale;f.minX=Math.min(u.slideWidth/2-pe/2,0),f.maxX=-f.minX,f.minY=Math.min(u.slideHeight/2-we/2,0),f.maxY=-f.minY,f.currentX=Math.max(Math.min(f.currentX,f.maxX),f.minX),f.currentY=Math.max(Math.min(f.currentY,f.maxY),f.minY),u.imageWrapEl.style.transitionDuration=`${oe}ms`,u.imageWrapEl.style.transform=`translate3d(${f.currentX}px, ${f.currentY}px,0)`}function D(){const U=e.zoom;u.slideEl&&e.activeIndex!==e.slides.indexOf(u.slideEl)&&(u.imageEl&&(u.imageEl.style.transform="translate3d(0,
360,0) scale(1)"),u.imageWrapEl&&(u.imageWrapEl.style.transform="translate3d(0,0,0)"),u.slideEl.classList.remove(`${e.params.zoom.zoomedSlideClass}`),U.scale=1,a=1,u.slideEl=void 0,u.imageEl=void 0,u.imageWrapEl=void 0,u.originX=0,u.originY=0)}function _(U){const H=e.zoom,z=e.params.zoom;if(!u.slideEl){U&&U.target&&(u.slideEl=U.target.closest(`.${e.params.slideClass}, swiper-slide`)),u.slideEl||(e.params.virtual&&e.params.virtual.enabled&&e.virtual?u.slideEl=Te(e.slidesEl,`.${e.params.slideActiveClass}`)[0]:u.slideEl=e.slides[e.activeIndex]);let Ot=u.slideEl.querySelector(`.${z.containerClass}`);Ot&&(Ot=Ot.querySelectorAll("picture, img, svg, canvas, .swiper-zoom-target")[0]),u.imageEl=Ot,Ot?u.imageWrapEl=dt(u.imageEl,`.${z.containerClass}`)[0]:u.imageWrapEl=void 0}if(!u.imageEl||!u.imageWrapEl)return;e.params.cssMode&&(e.wrapperEl.style.overflow="hidden",e.wrapperEl.style.touchAction="none"),u.slideEl.classList.add(`${z.zoomedSlideClass}`);let Z,K,Q,q,oe,pe,we,Ue,Ar,Ir,Rr,Cr,es,ts,ei,ti,si,ii;typeof f.touchesStart.x>"u"&&U?(Z=U.pageX,K=U.pageY):(Z=f.touchesStart.x,K=f.touchesStart.y);const Mt=typeof U=="number"?U:null;a===1&&Mt&&(Z=void 0,K=void 0,f.touchesStart.x=void 0,f.touchesStart.y=void 0);const Dr=g();H.scale=Mt||Dr,a=Mt||Dr,U&&!(a===1&&Mt)?(si=u.slideEl.offsetWidth,ii=u.slideEl.offsetHeight,Q=zs(u.slideEl).left+n.scrollX,q=zs(u.slideEl).top+n.scrollY,oe=Q+si/2-Z,pe=q+ii/2-K,Ar=u.imageEl.offsetWidth||u.imageEl.clientWidth,Ir=u.imageEl.offsetHeight||u.imageEl.clientHeight,Rr=Ar*H.scale,Cr=Ir*H.scale,es=Math.min(si/2-Rr/2,0),ts=Math.min(ii/2-Cr/2,0),ei=-es,ti=-ts,we=oe*H.scale,Ue=pe*H.scale,we<es&&(we=es),we>ei&&(we=ei),Ue<ts&&(Ue=ts),Ue>ti&&(Ue=ti)):(we=0,Ue=0),Mt&&H.scale===1&&(u.originX=0,u.originY=0),u.imageWrapEl.style.transitionDuration="300ms",u.imageWrapEl.style.transform=`translate3d(${we}px, ${Ue}px,0)`,u.imageEl.style.transitionDuration="300ms",u.imageEl.style.transform=`translate3d(0,0,0) scale(${H.scale})`}function B(){const U=e.zoom,H=e.params.zoom;if(!u.slideEl){e.params.virtual&&e.params.virtual.enabled&&e.virtual?u.slideEl=Te(e.slidesEl,`.${e.params.slideActiveClass}`)[0]:u.slideEl=e.slides[e.activeIndex];let z=u.slideEl.querySelector(`.${H.containerClass}`);z&&(z=z.querySelectorAll("picture, img, svg, canvas, .swiper-zoom-target")[0]),u.imageEl=z,z?u.imageWrapEl=dt(u.imageEl,`.${H.containerClass}`)[0]:u.imageWrapEl=void 0}!u.imageEl||!u.imageWrapEl||(e.params.cssMode&&(e.wrapperEl.style.overflow="",e.wrapperEl.style.touchAction=""),U.scale=1,a=1,f.touchesStart.x=void 0,f.touchesStart.y=void 0,u.imageWrapEl.style.transitionDuration="300ms",u.imageWrapEl.style.transform="translate3d(0,0,0)",u.imageEl.style.transitionDuration="300ms",u.imageEl.style.transform="translate3d(0,0,0) scale(1)",u.slideEl.classList.remove(`${H.zoomedSlideClass}`),u.slideEl=void 0,u.originX=0,u.originY=0)}function k(U){const H=e.zoom;H.scale&&H.scale!==1?B():_(U)}function M(){const U=e.params.passiveListeners?{passive:!0,capture:!1}:!1,H=e.params.passiveListeners?{passive:!1,capture:!0}:!0;return{passiveListener:U,activeListenerWithCapture:H}}function N(){const U=e.zoom;if(U.enabled)return;U.enabled=!0;const{passiveListener:H,activeListenerWithCapture:z}=M();e.wrapperEl.addEventListener("pointerdown",T,H),e.wrapperEl.addEventListener("pointermove",L,z),["pointerup","pointercancel","pointerout"].forEach(Z=>{e.wrapperEl.addEventListener(Z,b,H)}),e.wrapperEl.addEventListener("pointermove",P,z)}function G(){const U=e.zoom;if(!U.enabled)return;U.enabled=!1;const{passiveListener:H,activeListenerWithCapture:z}=M();e.wrapperEl.removeEventListener("pointerdown",T,H),e.wrapperEl.removeEventListener("pointermove",L,z),["pointerup","pointercancel","pointerout"].forEach(Z=>{e.wrapperEl.removeEventListener(Z,b,H)}),e.wrapperEl.removeEventListener("pointermove",P,z)}s("init",()=>{e.params.zoom.enabled&&N()}),s("destroy",()=>{G()}),s("touchStart",(U,H)=>{e.zoom.enabled&&I(H)}),s("touchEnd",(U,H)=>{e.zoom.enabled&&R()}),s("doubleTap",(U,H)=>{!e.animating&&e.params.zoom.enabled&&e.zoom.enabled&&e.params.zoom.toggle&&k(H)}),s("transitionEnd",()=>{e.zoom.enabled&&e.params.zoom.enabled&&D()}),s("slideChange",()=>{e.zoom.enabled&&e.params.zoom.enabled&&e.params.cssMode&&D()}),Object.assign(e.zoom,{enable:N,disable:G,in:_,out:B,toggle:k})}function um(r){let{swiper:e,extendParams:t,on:s}=r;t({controller:{control:void 0,inverse:!1,by:"slide"}}),e.controller={control:void 0};function i(c,d){const u=function(){let m,g,y;return(E,v)=>{for(g=-1,m=E.length;m-g>1;)y=m+g>>1,E[y]<=v?g=y:m=y;return m}}();this.x=c,this.y=d,this.lastIndex=c.length-1;let f,h;return this.interpolate=function(m){return m?(h=u(this.x,m),f=h-1,(m-this.x[f])*(this.y[h]-this.y[f])/(this.x[h]-this.x[f])+this.y[f]):0},this}function n(c){e.controller.spline=e.params.loop?new i(e.slidesGrid,c.slidesGrid):new i(e.snapGrid,c.snapGrid)}function a(c,d){const u=e.controller.control;let f,h;const p=e.constructor;function m(g){if(g.destroyed)return;const y=e.rtlTranslate?-e.translate:e.translate;e.params.controller.by==="slide"&&(n(g),h=-e.controller.spline.interpolate(-y)),(!h||e.params.controller.by==="container")&&(f=(g.maxTranslate()-g.minTranslate())/(e.maxTranslate()-e.minTranslate()),(Number.isNaN(f)||!Number.isFinite(f))&&(f=1),h=(y-e.minTranslate())*f+g.minTranslate()),e.params.controller.inverse&&(h=g.maxTranslate()-h),g.updateProgress(h),g.setTranslate(h,e),g.updateActiveIndex(),g.updateSlidesClasses()}if(Array.isArray(u))for(let g=0;g<u.length;g+=1)u[g]!==d&&u[g]instanceof p&&m(u[g]);else u instanceof p&&d!==u&&m(u)}function o(c,d){const u=e.constructor,f=e.controller.control;let h;
vendor: 5,230 bytes, line 36
36function p(m){m.destroyed||(m.setTransition(c,e),c!==0&&(m.transitionStart(),m.params.autoHeight&&ft(()=>{m.updateAutoHeight()}),zt(m.wrapperEl,()=>{f&&m.transitionEnd()})))}if(Array.isArray(f))for(h=0;h<f.length;h+=1)f[h]!==d&&f[h]instanceof u&&p(f[h]);else f instanceof u&&d!==f&&p(f)}function l(){e.controller.control&&e.controller.spline&&(e.controller.spline=void 0,delete e.controller.spline)}s("beforeInit",()=>{if(typeof window<"u"&&(typeof e.params.controller.control=="string"||e.params.controller.control instanceof HTMLElement)){(typeof e.params.controller.control=="string"?[...document.querySelectorAll(e.params.controller.control)]:[e.params.controller.control]).forEach(d=>{if(e.controller.control||(e.controller.control=[]),d&&d.swiper)e.controller.control.push(d.swiper);else if(d){const u=`${e.params.eventsPrefix}init`,f=h=>{e.controller.control.push(h.detail[0]),e.update(),d.removeEventListener(u,f)};d.addEventListener(u,f)}});return}e.controller.control=e.params.controller.control}),s("update",()=>{l()}),s("resize",()=>{l()}),s("observerUpdate",()=>{l()}),s("setTranslate",(c,d,u)=>{!e.controller.control||e.controller.control.destroyed||e.controller.setTranslate(d,u)}),s("setTransition",(c,d,u)=>{!e.controller.control||e.controller.control.destroyed||e.controller.setTransition(d,u)}),Object.assign(e.controller,{setTranslate:a,setTransition:o})}function fm(r){let{swiper:e,extendParams:t,on:s}=r;t({a11y:{enabled:!0,notificationClass:"swiper-notification",prevSlideMessage:"Previous slide",nextSlideMessage:"Next slide",firstSlideMessage:"This is the first slide",lastSlideMessage:"This is the last slide",paginationBulletMessage:"Go to slide {{index}}",slideLabelMessage:"{{index}} / {{slidesLength}}",containerMessage:null,containerRoleDescriptionMessage:null,containerRole:null,itemRoleDescriptionMessage:null,slideRole:"group",id:null,scrollOnFocus:!0}}),e.a11y={clicked:!1};let i=null,n,a,o=new Date().getTime();function l(k){const M=i;M.length!==0&&(M.innerHTML="",M.innerHTML=k)}function c(k){const M=()=>Math.round(16*Math.random()).toString(16);return"x".repeat(k).replace(/x/g,M)}function d(k){k=re(k),k.forEach(M=>{M.setAttribute("tabIndex","0")})}function u(k){k=re(k),k.forEach(M=>{M.setAttribute("tabIndex","-1")})}function f(k,M){k=re(k),k.forEach(N=>{N.setAttribute("role",M)})}function h(k,M){k=re(k),k.forEach(N=>{N.setAttribute("aria-roledescription",M)})}function p(k,M){k=re(k),k.forEach(N=>{N.setAttribute("aria-controls",M)})}function m(k,M){k=re(k),k.forEach(N=>{N.setAttribute("aria-label",M)})}function g(k,M){k=re(k),k.forEach(N=>{N.setAttribute("id",M)})}function y(k,M){k=re(k),k.forEach(N=>{N.setAttribute("aria-live",M)})}function E(k){k=re(k),k.forEach(M=>{M.setAttribute("aria-disabled",!0)})}function v(k){k=re(k),k.forEach(M=>{M.setAttribute("aria-disabled",!1)})}function S(k){if(k.keyCode!==13&&k.keyCode!==32)return;const M=e.params.a11y,N=k.target;if(!(e.pagination&&e.pagination.el&&(N===e.pagination.el||e.pagination.el.contains(k.target))&&!k.target.matches(Je(e.params.pagination.bulletClass)))){if(e.navigation&&e.navigation.prevEl&&e.navigation.nextEl){const G=re(e.navigation.prevEl);re(e.navigation.nextEl).includes(N)&&(e.isEnd&&!e.params.loop||e.slideNext(),e.isEnd?l(M.lastSlideMessage):l(M.nextSlideMessage)),G.includes(N)&&(e.isBeginning&&!e.params.loop||e.slidePrev(),e.isBeginning?l(M.firstSlideMessage):l(M.prevSlideMessage))}e.pagination&&N.matches(Je(e.params.pagination.bulletClass))&&N.click()}}function T(){if(e.params.loop||e.params.rewind||!e.navigation)return;const{nextEl:k,prevEl:M}=e.navigation;M&&(e.isBeginning?(E(M),u(M)):(v(M),d(M))),k&&(e.isEnd?(E(k),u(k)):(v(k),d(k)))}function L(){return e.pagination&&e.pagination.bullets&&e.pagination.bullets.length}function b(){return L()&&e.params.pagination.clickable}function C(){const k=e.params.a11y;L()&&e.pagination.bullets.forEach(M=>{e.params.pagination.clickable&&(d(M),e.params.pagination.renderBullet||(f(M,"button"),m(M,k.paginationBulletMessage.replace(/\{\{index\}\}/,Xt(M)+1)))),M.matches(Je(e.params.pagination.bulletActiveClass))?M.setAttribute("aria-current","true"):M.removeAttribute("aria-current")})}const A=(k,M,N)=>{d(k),k.tagName!=="BUTTON"&&(f(k,"button"),k.addEventListener("keydown",S)),m(k,N),p(k,M)},w=k=>{a&&a!==k.target&&!a.contains(k.target)&&(n=!0),e.a11y.clicked=!0},I=()=>{n=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.destroyed||(e.a11y.clicked=!1)})})},P=k=>{o=new Date().getTime()},R=k=>{if(e.a11y.clicked||!e.params.a11y.scrollOnFocus||new Date().getTime()-o<100)return;const M=k.target.closest(`.${e.params.slideClass}, swiper-slide`);if(!M||!e.slides.includes(M))return;a=M;const N=e.slides.indexOf(M)===e.activeIndex,G=e.params.watchSlidesProgress&&e.visibleSlides&&e.visibleSlides.includes(M);N||G||k.sourceCapabilities&&k.sourceCapabilities.firesTouchEvents||(e.isHorizontal()?e.el.scrollLeft=0:e.el.scrollTop=0,requestAnimationFrame(()=>{n||(e.params.loop?e.slideToLoop(parseInt(M.getAttribute("data-swiper-slide-index")),0):e.slideTo(e.slides.indexOf(M),0),n=!1)}))},D=()=>{const k=e.params.a11y;k.itemRoleDescriptionMessage&&h(e.slides,k.itemRoleDescriptionMessage),k.slideRole&&f(e.slides,k.slideRole);const M=e.slides.length;
36k.slideLabelMessage&&e.slides.forEach((N,G)=>{const U=e.params.loop?parseInt(N.getAttribute("data-swiper-slide-index"),10):G,H=k.slideLabelMessage.replace(/\{\{index\}\}/,U+1).replace(/\{\{slidesLength\}\}/,M);m(N,H)})},_=()=>{const k=e.params.a11y;e.el.append(i);const M=e.el;k.containerRoleDescriptionMessage&&h(M,k.containerRoleDescriptionMessage),k.containerMessage&&m(M,k.containerMessage),k.containerRole&&f(M,k.containerRole);const N=e.wrapperEl,G=k.id||N.getAttribute("id")||`swiper-wrapper-${c(16)}`,U=e.params.autoplay&&e.params.autoplay.enabled?"off":"polite";g(N,G),y(N,U),D();let{nextEl:H,prevEl:z}=e.navigation?e.navigation:{};H=re(H),z=re(z),H&&H.forEach(K=>A(K,G,k.nextSlideMessage)),z&&z.forEach(K=>A(K,G,k.prevSlideMessage)),b()&&re(e.pagination.el).forEach(Q=>{Q.addEventListener("keydown",S)}),Se().addEventListener("visibilitychange",P),e.el.addEventListener("focus",R,!0),e.el.addEventListener("focus",R,!0),e.el.addEventListener("pointerdown",w,!0),e.el.addEventListener("pointerup",I,!0)};function B(){i&&i.remove();let{nextEl:k,prevEl:M}=e.navigation?e.navigation:{};k=re(k),M=re(M),k&&k.forEach(G=>G.removeEventListener("keydown",S)),M&&M.forEach(G=>G.removeEventListener("keydown",S)),b()&&re(e.pagination.el).forEach(U=>{U.removeEventListener("keydown",S)}),Se().removeEventListener("visibilitychange",P),e.el&&typeof e.el!="string"&&(e.el.removeEventListener("focus",R,!0),e.el.removeEventListener("pointerdown",w,!0),e.el.removeEventListener("pointerup",I,!0))}s("beforeInit",()=>{i=_e("span",e.params.a11y.notificationClass),i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true")}),s("afterInit",()=>{e.params.a11y.enabled&&_()}),s("slidesLengthChange snapGridLengthChange slidesGridLengthChange",()=>{e.params.a11y.enabled&&D()}),s("fromEdge toEdge afterInit lock unlock",()=>{e.params.a11y.enabled&&T()}),s("paginationUpdate",()=>{e.params.a11y.enabled&&C()}),s("destroy",()=>{e.params.a11y.enabled&&B()})}function hm(r){let{swiper:e,extendParams:t,on:s}=r;t({history:{enabled:!1,root:"",replaceState:!1,key:"slides",keepQuery:!1}});let i=!1,n={};const a=h=>h.toString().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,""),o=h=>{const p=he();let m;h?m=new URL(h):m=p.location;const g=m.pathname.slice(1).split("/").filter(S=>S!==""),y=g.length,E=g[y-2],v=g[y-1];return{key:E,value:v}},l=(h,p)=>{const m=he();if(!i||!e.params.history.enabled)return;let g;e.params.url?g=new URL(e.params.url):g=m.location;const y=e.virtual&&e.params.virtual.enabled?e.slidesEl.querySelector(`[data-swiper-slide-index="${p}"]`):e.slides[p];let E=a(y.getAttribute("data-history"));if(e.params.history.root.length>0){let S=e.params.history.root;S[S.length-1]==="/"&&(S=S.slice(0,S.length-1)),E=`${S}/${h?`${h}/`:""}${E}`}else g.pathname.includes(h)||(E=`${h?`${h}/`:""}${E}`);e.params.history.keepQuery&&(E+=g.search);const v=m.history.state;v&&v.value===E||(e.params.history.replaceState?m.history.replaceState({value:E},null,E):m.history.pushState({value:E},null,E))},c=(h,p,m)=>{if(p)for(let g=0,y=e.slides.length;g<y;g+=1){const E=e.slides[g];if(a(E.getAttribute("data-history"))===p){const S=e.getSlideIndex(E);e.slideTo(S,h,m)}}else e.slideTo(0,h,m)},d=()=>{n=o(e.params.url),c(e.params.speed,n.value,!1)},u=()=>{const h=he();if(e.params.history){if(!h.history||!h.history.pushState){e.params.history.enabled=!1,e.params.hashNavigation.enabled=!0;return}if(i=!0,n=o(e.params.url),!n.key&&!n.value){e.params.history.replaceState||h.addEventListener("popstate",d);return}c(0,n.value,e.params.runCallbacksOnInit),e.params.history.replaceState||h.addEventListener("popstate",d)}},f=()=>{const h=he();e.params.history.replaceState||h.removeEventListener("popstate",d)};s("init",()=>{e.params.history.enabled&&u()}),s("destroy",()=>{e.params.history.enabled&&f()}),s("transitionEnd _freeModeNoMomentumRelease",()=>{i&&l(e.params.history.key,e.activeIndex)}),s("slideChange",()=>{i&&e.params.cssMode&&l(e.params.history.key,e.activeIndex)})}function pm(r){let{swiper:e,extendParams:t,emit:s,on:i}=r,n=!1;const a=Se(),o=he();t({hashNavigation:{enabled:!1,replaceState:!1,watchState:!1,getSlideIndex(f,h){if(e.virtual&&e.params.virtual.enabled){const p=e.slides.filter(g=>g.getAttribute("data-hash")===h)[0];return p?parseInt(p.getAttribute("data-swiper-slide-index"),10):0}
36return e.getSlideIndex(Te(e.slidesEl,`.${e.params.slideClass}[data-hash="${h}"], swiper-slide[data-hash="${h}"]`)[0])}}});const l=()=>{s("hashChange");const f=a.location.hash.replace("#",""),h=e.virtual&&e.params.virtual.enabled?e.slidesEl.querySelector(`[data-swiper-slide-index="${e.activeIndex}"]`):e.slides[e.activeIndex],p=h?h.getAttribute("data-hash"):"";if(f!==p){const m=e.params.hashNavigation.getSlideIndex(e,f);if(typeof m>"u"||Number.isNaN(m))return;e.slideTo(m)}},c=()=>{if(!n||!e.params.hashNavigation.enabled)return;const f=e.virtual&&e.params.virtual.enabled?e.slidesEl.querySelector(`[data-swiper-slide-index="${e.activeIndex}"]`):e.slides[e.activeIndex],h=f?f.getAttribute("data-hash")||f.getAttribute("data-history"):"";e.params.hashNavigation.replaceState&&o.history&&o.history.replaceState?(o.history.replaceState(null,null,`#${h}`||""),s("hashSet")):(a.location.hash=h||"",s("hashSet"))},d=()=>{if(!e.params.hashNavigation.enabled||e.params.history&&e.params.history.enabled)return;n=!0;const f=a.location.hash.replace("#","");if(f){const p=e.params.hashNavigation.getSlideIndex(e,f);e.slideTo(p||0,0,e.params.runCallbacksOnInit,!0)}e.params.hashNavigation.watchState&&o.addEventListener("hashchange",l)},u=()=>{e.params.hashNavigation.watchState&&o.removeEventListener("hashchange",l)};i("init",()=>{e.params.hashNavigation.enabled&&d()}),i("destroy",()=>{e.params.hashNavigation.enabled&&u()}),i("transitionEnd _freeModeNoMomentumRelease",()=>{n&&c()}),i("slideChange",()=>{n&&e.params.cssMode&&c()})}function mm(r){let{swiper:e,extendParams:t,on:s,emit:i,params:n}=r;e.autoplay={running:!1,paused:!1,timeLeft:0},t({autoplay:{enabled:!1,delay:3e3,waitForTransition:!0,disableOnInteraction:!1,stopOnLastSlide:!1,reverseDirection:!1,pauseOnMouseEnter:!1}});let a,o,l=n&&n.autoplay?n.autoplay.delay:3e3,c=n&&n.autoplay?n.autoplay.delay:3e3,d,u=new Date().getTime(),f,h,p,m,g,y,E;function v(M){!e||e.destroyed||!e.wrapperEl||M.target===e.wrapperEl&&(e.wrapperEl.removeEventListener("transitionend",v),!(E||M.detail&&M.detail.bySwiperTouchMove)&&w())}const S=()=>{if(e.destroyed||!e.autoplay.running)return;e.autoplay.paused?f=!0:f&&(c=d,f=!1);const M=e.autoplay.paused?d:u+c-new Date().getTime();e.autoplay.timeLeft=M,i("autoplayTimeLeft",M,M/l),o=requestAnimationFrame(()=>{S()})},T=()=>{let M;return e.virtual&&e.params.virtual.enabled?M=e.slides.filter(G=>G.classList.contains("swiper-slide-active"))[0]:M=e.slides[e.activeIndex],M?parseInt(M.getAttribute("data-swiper-autoplay"),10):void 0},L=M=>{if(e.destroyed||!e.autoplay.running)return;cancelAnimationFrame(o),S();let N=typeof M>"u"?e.params.autoplay.delay:M;l=e.params.autoplay.delay,c=e.params.autoplay.delay;const G=T();!Number.isNaN(G)&&G>0&&typeof M>"u"&&(N=G,l=G,c=G),d=N;const U=e.params.speed,H=()=>{!e||e.destroyed||(e.params.autoplay.reverseDirection?!e.isBeginning||e.params.loop||e.params.rewind?(e.slidePrev(U,!0,!0),i("autoplay")):e.params.autoplay.stopOnLastSlide||(e.slideTo(e.slides.length-1,U,!0,!0),i("autoplay")):!e.isEnd||e.params.loop||e.params.rewind?(e.slideNext(U,!0,!0),i("autoplay")):e.params.autoplay.stopOnLastSlide||(e.slideTo(0,U,!0,!0),i("autoplay")),e.params.cssMode&&(u=new Date().getTime(),requestAnimationFrame(()=>{L()})))};return N>0?(clearTimeout(a),a=setTimeout(()=>{H()},N)):requestAnimationFrame(()=>{H()}),N},b=()=>{u=new Date().getTime(),e.autoplay.running=!0,L(),i("autoplayStart")},C=()=>{e.autoplay.running=!1,clearTimeout(a),cancelAnimationFrame(o),i("autoplayStop")},A=(M,N)=>{if(e.destroyed||!e.autoplay.running)return;clearTimeout(a),M||(y=!0);const G=()=>{i("autoplayPause"),e.params.autoplay.waitForTransition?e.wrapperEl.addEventListener("transitionend",v):w()};if(e.autoplay.paused=!0,N){g&&(d=e.params.autoplay.delay),g=!1,G();return}
36d=(d||e.params.autoplay.delay)-(new Date().getTime()-u),!(e.isEnd&&d<0&&!e.params.loop)&&(d<0&&(d=0),G())},w=()=>{e.isEnd&&d<0&&!e.params.loop||e.destroyed||!e.autoplay.running||(u=new Date().getTime(),y?(y=!1,L(d)):L(),e.autoplay.paused=!1,i("autoplayResume"))},I=()=>{if(e.destroyed||!e.autoplay.running)return;const M=Se();M.visibilityState==="hidden"&&(y=!0,A(!0)),M.visibilityState==="visible"&&w()},P=M=>{M.pointerType==="mouse"&&(y=!0,E=!0,!(e.animating||e.autoplay.paused)&&A(!0))},R=M=>{M.pointerType==="mouse"&&(E=!1,e.autoplay.paused&&w())},D=()=>{e.params.autoplay.pauseOnMouseEnter&&(e.el.addEventListener("pointerenter",P),e.el.addEventListener("pointerleave",R))},_=()=>{e.el&&typeof e.el!="string"&&(e.el.removeEventListener("pointerenter",P),e.el.removeEventListener("pointerleave",R))},B=()=>{Se().addEventListener("visibilitychange",I)},k=()=>{Se().removeEventListener("visibilitychange",I)};s("init",()=>{e.params.autoplay.enabled&&(D(),B(),b())}),s("destroy",()=>{_(),k(),e.autoplay.running&&C()}),s("_freeModeStaticRelease",()=>{(p||y)&&w()}),s("_freeModeNoMomentumRelease",()=>{e.params.autoplay.disableOnInteraction?C():A(!0,!0)}),s("beforeTransitionStart",(M,N,G)=>{e.destroyed||!e.autoplay.running||(G||!e.params.autoplay.disableOnInteraction?A(!0,!0):C())}),s("sliderFirstMove",()=>{if(!(e.destroyed||!e.autoplay.running)){if(e.params.autoplay.disableOnInteraction){C();return}h=!0,p=!1,y=!1,m=setTimeout(()=>{y=!0,p=!0,A(!0)},200)}}),s("touchEnd",()=>{if(!(e.destroyed||!e.autoplay.running||!h)){if(clearTimeout(m),clearTimeout(a),e.params.autoplay.disableOnInteraction){p=!1,h=!1;return}p&&e.params.cssMode&&w(),p=!1,h=!1}}),s("slideChange",()=>{e.destroyed||!e.autoplay.running||(g=!0)}),Object.assign(e.autoplay,{start:b,stop:C,pause:A,resume:w})}function gm(r){let{swiper:e,extendParams:t,on:s}=r;t({thumbs:{swiper:null,multipleActiveThumbs:!0,autoScrollOffset:0,slideThumbActiveClass:"swiper-slide-thumb-active",thumbsContainerClass:"swiper-thumbs"}});let i=!1,n=!1;e.thumbs={swiper:null};function a(){const c=e.thumbs.swiper;if(!c||c.destroyed)return;const d=c.clickedIndex,u=c.clickedSlide;if(u&&u.classList.contains(e.params.thumbs.slideThumbActiveClass)||typeof d>"u"||d===null)return;let f;c.params.loop?f=parseInt(c.clickedSlide.getAttribute("data-swiper-slide-index"),10):f=d,e.params.loop?e.slideToLoop(f):e.slideTo(f)}function o(){const{thumbs:c}=e.params;if(i)return!1;i=!0;const d=e.constructor;if(c.swiper instanceof d)e.thumbs.swiper=c.swiper,Object.assign(e.thumbs.swiper.originalParams,{watchSlidesProgress:!0,slideToClickedSlide:!1}),Object.assign(e.thumbs.swiper.params,{watchSlidesProgress:!0,slideToClickedSlide:!1}),e.thumbs.swiper.update();else if($t(c.swiper)){const u=Object.assign({},c.swiper);Object.assign(u,{watchSlidesProgress:!0,slideToClickedSlide:!1}),e.thumbs.swiper=new d(u),n=!0}return e.thumbs.swiper.el.classList.add(e.params.thumbs.thumbsContainerClass),e.thumbs.swiper.on("tap",a),!0}function l(c){const d=e.thumbs.swiper;if(!d||d.destroyed)return;const u=d.params.slidesPerView==="auto"?d.slidesPerViewDynamic():d.params.slidesPerView;let f=1;const h=e.params.thumbs.slideThumbActiveClass;if(e.params.slidesPerView>1&&!e.params.centeredSlides&&(f=e.params.slidesPerView),e.params.thumbs.multipleActiveThumbs||(f=1),f=Math.floor(f),d.slides.forEach(g=>g.classList.remove(h)),d.params.loop||d.params.virtual&&d.params.virtual.enabled)for(let g=0;g<f;g+=1)Te(d.slidesEl,`[data-swiper-slide-index="${e.realIndex+g}"]`).forEach(y=>{y.classList.add(h)});else for(let g=0;g<f;g+=1)d.slides[e.realIndex+g]&&d.slides[e.realIndex+g].classList.add(h);const p=e.params.thumbs.autoScrollOffset,m=p&&!d.params.loop;if(e.realIndex!==d.realIndex||m){const g=d.activeIndex;let y,E;if(d.params.loop){const v=d.slides.filter(S=>S.getAttribute("data-swiper-slide-index")===`${e.realIndex}`)[0];y=d.slides.indexOf(v),E=e.activeIndex>e.previousIndex?"next":"prev"}else y=e.realIndex,E=y>e.previousIndex?"next":"prev";m&&(y+=E==="next"?p:-1*p),d.visibleSlidesIndexes&&d.visibleSlidesIndexes.indexOf(y)<0&&(d.params.centeredSlides?y>g?y=y-Math.floor(u/2)+1:y=y+Math.floor(u/2)-1:y>g&&d.params.slidesPerGroup,d.slideTo(y,c?0:void 0))}}s("beforeInit",()=>{const{thumbs:c}=e.params;if(!(!c||!c.swiper))if(typeof c.swiper=="string"||c.swiper instanceof HTMLElement){const d=Se(),u=()=>{const h=typeof c.swiper=="string"?d.querySelector(c.swiper):c.swiper;if(h&&h.swiper)c.swiper=h.swiper,o(),l(!0);else if(h){const p=`${e.params.eventsPrefix}init`,m=g=>{c.swiper=g.detail[0],h.removeEventListener(p,m),o(),l(!0),c.swiper.update(
36),e.update()};h.addEventListener(p,m)}return h},f=()=>{if(e.destroyed)return;u()||requestAnimationFrame(f)};requestAnimationFrame(f)}else o(),l(!0)}),s("slideChange update resize observerUpdate",()=>{l()}),s("setTransition",(c,d)=>{const u=e.thumbs.swiper;!u||u.destroyed||u.setTransition(d)}),s("beforeDestroy",()=>{const c=e.thumbs.swiper;!c||c.destroyed||n&&c.destroy()}),Object.assign(e.thumbs,{init:o,update:l})}function vm(r){let{swiper:e,extendParams:t,emit:s,once:i}=r;t({freeMode:{enabled:!1,momentum:!0,momentumRatio:1,momentumBounce:!0,momentumBounceRatio:1,momentumVelocityRatio:1,sticky:!1,minimumVelocity:.02}});function n(){if(e.params.cssMode)return;const l=e.getTranslate();e.setTranslate(l),e.setTransition(0),e.touchEventsData.velocities.length=0,e.freeMode.onTouchEnd({currentPos:e.rtl?e.translate:-e.translate})}function a(){if(e.params.cssMode)return;const{touchEventsData:l,touches:c}=e;l.velocities.length===0&&l.velocities.push({position:c[e.isHorizontal()?"startX":"startY"],time:l.touchStartTime}),l.velocities.push({position:c[e.isHorizontal()?"currentX":"currentY"],time:Me()})}function o(l){let{currentPos:c}=l;if(e.params.cssMode)return;const{params:d,wrapperEl:u,rtlTranslate:f,snapGrid:h,touchEventsData:p}=e,g=Me()-p.touchStartTime;if(c<-e.minTranslate()){e.slideTo(e.activeIndex);return}if(c>-e.maxTranslate()){e.slides.length<h.length?e.slideTo(h.length-1):e.slideTo(e.slides.length-1);return}if(d.freeMode.momentum){if(p.velocities.length>1){const C=p.velocities.pop(),A=p.velocities.pop(),w=C.position-A.position,I=C.time-A.time;e.velocity=w/I,e.velocity/=2,Math.abs(e.velocity)<d.freeMode.minimumVelocity&&(e.velocity=0),(I>150||Me()-C.time>300)&&(e.velocity=0)}else e.velocity=0;e.velocity*=d.freeMode.momentumVelocityRatio,p.velocities.length=0;let y=1e3*d.freeMode.momentumRatio;const E=e.velocity*y;let v=e.translate+E;f&&(v=-v);let S=!1,T;const L=Math.abs(e.velocity)*20*d.freeMode.momentumBounceRatio;let b;if(v<e.maxTranslate())d.freeMode.momentumBounce?(v+e.maxTranslate()<-L&&(v=e.maxTranslate()-L),T=e.maxTranslate(),S=!0,p.allowMomentumBounce=!0):v=e.maxTranslate(),d.loop&&d.centeredSlides&&(b=!0);else if(v>e.minTranslate())d.freeMode.momentumBounce?(v-e.minTranslate()>L&&(v=e.minTranslate()+L),T=e.minTranslate(),S=!0,p.allowMomentumBounce=!0):v=e.minTranslate(),d.loop&&d.centeredSlides&&(b=!0);else if(d.freeMode.sticky){let C;for(let A=0;A<h.length;A+=1)if(h[A]>-v){C=A;break}Math.abs(h[C]-v)<Math.abs(h[C-1]-v)||e.swipeDirection==="next"?v=h[C]:v=h[C-1],v=-v}if(b&&i("transitionEnd",()=>{e.loopFix()}),e.velocity!==0){if(f?y=Math.abs((-v-e.translate)/e.velocity):y=Math.abs((v-e.translate)/e.velocity),d.freeMode.sticky){const C=Math.abs((f?-v:v)-e.translate),A=e.slidesSizesGrid[e.activeIndex];C<A?y=d.speed:C<2*A?y=d.speed*1.5:y=d.speed*2.5}}else if(d.freeMode.sticky){e.slideToClosest();return}d.freeMode.momentumBounce&&S?(e.updateProgress(T),e.setTransition(y),e.setTranslate(v),e.transitionStart(!0,e.swipeDirection),e.animating=!0,zt(u,()=>{!e||e.destroyed||!p.allowMomentumBounce||(s("momentumBounce"),e.setTransition(d.speed),setTimeout(()=>{e.setTranslate(T),zt(u,()=>{!e||e.destroyed||e.transitionEnd()})},0))})):e.velocity?(s("_freeModeNoMomentumRelease"),e.updateProgress(v),e.setTransition(y),e.setTranslate(v),e.transitionStart(!0,e.swipeDirection),e.animating||(e.animating=!0,zt(u,()=>{!e||e.destroyed||e.transitionEnd()}))):e.updateProgress(v),e.updateActiveIndex(),e.updateSlidesClasses()}else if(d.freeMode.sticky){e.slideToClosest();return}else d.freeMode&&s("_freeModeNoMomentumRelease");(!d.freeMode.momentum||g>=d.longSwipesMs)&&(s("_freeModeStaticRelease"),e.updateProgress(),e.updateActiveIndex(),e.updateSlidesClasses())}Object.assign(e,{freeMode:{onTouchStart:n,onTouchMove:a,onTouchEnd:o}})}function ym(r){let{swiper:e,extendParams:t,on:s}=r;t({grid:{rows:1,fill:"column"}});let i,n,a,o;const l=()=>{let m=e.params.spaceBetween;return typeof m=="string"&&m.indexOf("%")>=0?m=parseFloat(m.replace("%",""))/100*e.size:typeof m=="string"&&(m=parseFloat(m)),m},c=m=>{const{slidesPerView:g}=e.params,{rows:y,fill:E}=e.params.grid,v=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:m.length;a=Math.floor(v/y),Math.floor(v/y)===v/y?i=v:i=Math.ceil(v/y)*y,g!=="auto"&&E==="row"&&(i=Math.max(i,g*y)),n=i/y},d=()=>
36{e.slides&&e.slides.forEach(m=>{m.swiperSlideGridSet&&(m.style.height="",m.style[e.getDirectionLabel("margin-top")]="")})},u=(m,g,y)=>{const{slidesPerGroup:E}=e.params,v=l(),{rows:S,fill:T}=e.params.grid,L=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:y.length;let b,C,A;if(T==="row"&&E>1){const w=Math.floor(m/(E*S)),I=m-S*E*w,P=w===0?E:Math.min(Math.ceil((L-w*S*E)/S),E);A=Math.floor(I/P),C=I-A*P+w*E,b=C+A*i/S,g.style.order=b}else T==="column"?(C=Math.floor(m/S),A=m-C*S,(C>a||C===a&&A===S-1)&&(A+=1,A>=S&&(A=0,C+=1))):(A=Math.floor(m/n),C=m-A*n);g.row=A,g.column=C,g.style.height=`calc((100% - ${(S-1)*v}px) / ${S})`,g.style[e.getDirectionLabel("margin-top")]=A!==0?v&&`${v}px`:"",g.swiperSlideGridSet=!0},f=(m,g)=>{const{centeredSlides:y,roundLengths:E}=e.params,v=l(),{rows:S}=e.params.grid;if(e.virtualSize=(m+v)*i,e.virtualSize=Math.ceil(e.virtualSize/S)-v,e.params.cssMode||(e.wrapperEl.style[e.getDirectionLabel("width")]=`${e.virtualSize+v}px`),y){const T=[];for(let L=0;L<g.length;L+=1){let b=g[L];E&&(b=Math.floor(b)),g[L]<e.virtualSize+g[0]&&T.push(b)}g.splice(0,g.length),g.push(...T)}},h=()=>{o=e.params.grid&&e.params.grid.rows>1},p=()=>{const{params:m,el:g}=e,y=m.grid&&m.grid.rows>1;o&&!y?(g.classList.remove(`${m.containerModifierClass}grid`,`${m.containerModifierClass}grid-column`),a=1,e.emitContainerClasses()):!o&&y&&(g.classList.add(`${m.containerModifierClass}grid`),m.grid.fill==="column"&&g.classList.add(`${m.containerModifierClass}grid-column`),e.emitContainerClasses()),o=y};s("init",h),s("update",p),e.grid={initSlides:c,unsetSlides:d,updateSlide:u,updateWrapperSize:f}}function Em(r){const e=this,{params:t,slidesEl:s}=e;t.loop&&e.loopDestroy();const i=n=>{if(typeof n=="string"){const a=document.createElement("div");a.innerHTML=n,s.append(a.children[0]),a.innerHTML=""}else s.append(n)};if(typeof r=="object"&&"length"in r)for(let n=0;n<r.length;n+=1)r[n]&&i(r[n]);else i(r);e.recalcSlides(),t.loop&&e.loopCreate(),(!t.observer||e.isElement)&&e.update()}function xm(r){const e=this,{params:t,activeIndex:s,slidesEl:i}=e;t.loop&&e.loopDestroy();let n=s+1;const a=o=>{if(typeof o=="string"){const l=document.createElement("div");l.innerHTML=o,i.prepend(l.children[0]),l.innerHTML=""}else i.prepend(o)};if(typeof r=="object"&&"length"in r){for(let o=0;o<r.length;o+=1)r[o]&&a(r[o]);n=s+r.length}else a(r);e.recalcSlides(),t.loop&&e.loopCreate(),(!t.observer||e.isElement)&&e.update(),e.slideTo(n,0,!1)}function Tm(r,e){const t=this,{params:s,activeIndex:i,slidesEl:n}=t;let a=i;s.loop&&(a-=t.loopedSlides,t.loopDestroy(),t.recalcSlides());const o=t.slides.length;if(r<=0){t.prependSlide(e);return}if(r>=o){t.appendSlide(e);return}let l=a>r?a+1:a;const c=[];for(let d=o-1;d>=r;d-=1){const u=t.slides[d];u.remove(),c.unshift(u)}if(typeof e=="object"&&"length"in e){for(let d=0;d<e.length;d+=1)e[d]&&n.append(e[d]);l=a>r?a+e.length:a}else n.append(e);for(let d=0;d<c.length;d+=1)n.append(c[d]);t.recalcSlides(),s.loop&&t.loopCreate(),(!s.observer||t.isElement)&&t.update(),s.loop?t.slideTo(l+t.loopedSlides,0,!1):t.slideTo(l,0,!1)}function Sm(r){const e=this,{params:t,activeIndex:s}=e;let i=s;t.loop&&(i-=e.loopedSlides,e.loopDestroy());let n=i,a;if(typeof r=="object"&&"length"in r){for(let o=0;o<r.length;o+=1)a=r[o],e.slides[a]&&e.slides[a].remove(),a<n&&(n-=1);n=Math.max(n,0)}else a=r,e.slides[a]&&e.slides[a].remove(),a<n&&(n-=1),n=Math.max(n,0);e.recalcSlides(),t.loop&&e.loopCreate(),(!t.observer||e.isElement)&&e.update(),t.loop?e.slideTo(n+e.loopedSlides,0,!1):e.slideTo(n,0,!1)}function bm(){const r=this,e=[];for(let t=0;t<r.slides.length;t+=1)e.push(t);r.removeSlide(e)}function wm(r){let{swiper:e}=r;Object.assign(e,{appendSlide:Em.bind(e),prependSlide:xm.bind(e),addSlide:Tm.bind(e),removeSlide:Sm.bind(e),removeAllSlides:bm.bind(e)})}function Pt(r){const{effect:e,swiper:t,on:s,setTranslate:i,setTransition:n,overwriteParams:a,perspective:o,recreateShadows:l,getEffectParams:c}=r;s("beforeInit",()=>{if(t.params.effect!==e)return;t.classNames.push(`${t.params.containerModifierClass}${e}`),o&&o()&&t.classNames.push(`${t.params.containerModifierClass}3d`);const u=a?a():{};Object.assign(t.params,u),Object.assign(t.originalParams,u)}),s("setTranslate",()=>{t.params.effect===e&&i()}),s("setTransition",(u,f)=>{t.params.effect===e&&n(f)}),s("transitionEnd",()=>{if(t.params.effect===e&&l){if(!c||!c().slideShadows)return;
36t.slides.forEach(u=>{u.querySelectorAll(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").forEach(f=>f.remove())}),l()}});let d;s("virtualUpdate",()=>{t.params.effect===e&&(t.slides.length||(d=!0),requestAnimationFrame(()=>{d&&t.slides&&t.slides.length&&(i(),d=!1)}))})}function Jt(r,e){const t=ht(e);return t!==e&&(t.style.backfaceVisibility="hidden",t.style["-webkit-backface-visibility"]="hidden"),t}function Zs(r){let{swiper:e,duration:t,transformElements:s,allSlides:i}=r;const{activeIndex:n}=e,a=o=>o.parentElement?o.parentElement:e.slides.filter(c=>c.shadowRoot&&c.shadowRoot===o.parentNode)[0];if(e.params.virtualTranslate&&t!==0){let o=!1,l;i?l=s:l=s.filter(c=>{const d=c.classList.contains("swiper-slide-transform")?a(c):c;return e.getSlideIndex(d)===n}),l.forEach(c=>{zt(c,()=>{if(o||!e||e.destroyed)return;o=!0,e.animating=!1;const d=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0});e.wrapperEl.dispatchEvent(d)})})}}function Lm(r){let{swiper:e,extendParams:t,on:s}=r;t({fadeEffect:{crossFade:!1}}),Pt({effect:"fade",swiper:e,on:s,setTranslate:()=>{const{slides:a}=e,o=e.params.fadeEffect;for(let l=0;l<a.length;l+=1){const c=e.slides[l];let u=-c.swiperSlideOffset;e.params.virtualTranslate||(u-=e.translate);let f=0;e.isHorizontal()||(f=u,u=0);const h=e.params.fadeEffect.crossFade?Math.max(1-Math.abs(c.progress),0):1+Math.min(Math.max(c.progress,-1),0),p=Jt(o,c);p.style.opacity=h,p.style.transform=`translate3d(${u}px, ${f}px, 0px)`}},setTransition:a=>{const o=e.slides.map(l=>ht(l));o.forEach(l=>{l.style.transitionDuration=`${a}ms`}),Zs({swiper:e,duration:a,transformElements:o,allSlides:!0})},overwriteParams:()=>({slidesPerView:1,slidesPerGroup:1,watchSlidesProgress:!0,spaceBetween:0,virtualTranslate:!e.params.cssMode})})}function Am(r){let{swiper:e,extendParams:t,on:s}=r;t({cubeEffect:{slideShadows:!0,shadow:!0,shadowOffset:20,shadowScale:.94}});const i=(l,c,d)=>{let u=d?l.querySelector(".swiper-slide-shadow-left"):l.querySelector(".swiper-slide-shadow-top"),f=d?l.querySelector(".swiper-slide-shadow-right"):l.querySelector(".swiper-slide-shadow-bottom");u||(u=_e("div",`swiper-slide-shadow-cube swiper-slide-shadow-${d?"left":"top"}`.split(" ")),l.append(u)),f||(f=_e("div",`swiper-slide-shadow-cube swiper-slide-shadow-${d?"right":"bottom"}`.split(" ")),l.append(f)),u&&(u.style.opacity=Math.max(-c,0)),f&&(f.style.opacity=Math.max(c,0))};Pt({effect:"cube",swiper:e,on:s,setTranslate:()=>{const{el:l,wrapperEl:c,slides:d,width:u,height:f,rtlTranslate:h,size:p,browser:m}=e,g=Qs(e),y=e.params.cubeEffect,E=e.isHorizontal(),v=e.virtual&&e.params.virtual.enabled;let S=0,T;y.shadow&&(E?(T=e.wrapperEl.querySelector(".swiper-cube-shadow"),T||(T=_e("div","swiper-cube-shadow"),e.wrapperEl.append(T)),T.style.height=`${u}px`):(T=l.querySelector(".swiper-cube-shadow"),T||(T=_e("div","swiper-cube-shadow"),l.append(T))));for(let b=0;b<d.length;b+=1){const C=d[b];let A=b;v&&(A=parseInt(C.getAttribute("data-swiper-slide-index"),10));let w=A*90,I=Math.floor(w/360);h&&(w=-w,I=Math.floor(-w/360));const P=Math.max(Math.min(C.progress,1),-1);let R=0,D=0,_=0;A%4===0?(R=-I*4*p,_=0):(A-1)%4===0?(R=0,_=-I*4*p):(A-2)%4===0?(R=p+I*4*p,_=p):(A-3)%4===0&&(R=-p,_=3*p+p*4*I),h&&(R=-R),E||(D=R,R=0);const B=`rotateX(${g(E?0:-w)}deg) rotateY(${g(E?w:0)}deg) translate3d(${R}px, ${D}px, ${_}px)`;P<=1&&P>-1&&(S=A*90+P*90,h&&(S=-A*90-P*90)),C.style.transform=B,y.slideShadows&&i(C,P,E)}if(c.style.transformOrigin=`50% 50% -${p/2}px`,c.style["-webkit-transform-origin"]=`50% 50% -${p/2}px`,y.shadow)if(E)T.style.transform=`translate3d(0px, ${u/2+y.shadowOffset}px, ${-u/2}px) rotateX(89.99deg) rotateZ(0deg) scale(${y.shadowScale})`;else{const b=Math.abs(S)-Math.floor(Math.abs(S)/90)*90,C=1.5-(Math.sin(b*2*Math.PI/360)/2+Math.cos(b*2*Math.PI/360)/2),A=y.shadowScale,w=y.shadowScale/C,I=y.shadowOffset;T.style.transform=`scale3d(${A}, 1, ${w}) translate3d(0px, ${f/2+I}px, ${-f/2/w}px) rotateX(-89.99deg)`}const L=(m.isSafari||m.isWebView)&&m.needPerspectiveFix?-p/2:0;c.style.transform=`translate3d(0px,0,${L}px) rotateX(${g(e.isHorizontal()?0:S)}deg) rotateY(${g(e.isHorizontal()?-S:0)}deg)`,c.style.setProperty("--swiper-cube-translate-z",`${L}px`)},setTransition:l=>{const{el:c,slides:d}=e;
36if(d.forEach(u=>{u.style.transitionDuration=`${l}ms`,u.querySelectorAll(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").forEach(f=>{f.style.transitionDuration=`${l}ms`})}),e.params.cubeEffect.shadow&&!e.isHorizontal()){const u=c.querySelector(".swiper-cube-shadow");u&&(u.style.transitionDuration=`${l}ms`)}},recreateShadows:()=>{const l=e.isHorizontal();e.slides.forEach(c=>{const d=Math.max(Math.min(c.progress,1),-1);i(c,d,l)})},getEffectParams:()=>e.params.cubeEffect,perspective:()=>!0,overwriteParams:()=>({slidesPerView:1,slidesPerGroup:1,watchSlidesProgress:!0,resistanceRatio:0,spaceBetween:0,centeredSlides:!1,virtualTranslate:!0})})}function Ct(r,e,t){const s=`swiper-slide-shadow${t?`-${t}`:""}${r?` swiper-slide-shadow-${r}`:""}`,i=ht(e);let n=i.querySelector(`.${s.split(" ").join(".")}`);return n||(n=_e("div",s.split(" ")),i.append(n)),n}function Im(r){let{swiper:e,extendParams:t,on:s}=r;t({flipEffect:{slideShadows:!0,limitRotation:!0}});const i=(l,c)=>{let d=e.isHorizontal()?l.querySelector(".swiper-slide-shadow-left"):l.querySelector(".swiper-slide-shadow-top"),u=e.isHorizontal()?l.querySelector(".swiper-slide-shadow-right"):l.querySelector(".swiper-slide-shadow-bottom");d||(d=Ct("flip",l,e.isHorizontal()?"left":"top")),u||(u=Ct("flip",l,e.isHorizontal()?"right":"bottom")),d&&(d.style.opacity=Math.max(-c,0)),u&&(u.style.opacity=Math.max(c,0))};Pt({effect:"flip",swiper:e,on:s,setTranslate:()=>{const{slides:l,rtlTranslate:c}=e,d=e.params.flipEffect,u=Qs(e);for(let f=0;f<l.length;f+=1){const h=l[f];let p=h.progress;e.params.flipEffect.limitRotation&&(p=Math.max(Math.min(h.progress,1),-1));const m=h.swiperSlideOffset;let y=-180*p,E=0,v=e.params.cssMode?-m-e.translate:-m,S=0;e.isHorizontal()?c&&(y=-y):(S=v,v=0,E=-y,y=0),h.style.zIndex=-Math.abs(Math.round(p))+l.length,d.slideShadows&&i(h,p);const T=`translate3d(${v}px, ${S}px, 0px) rotateX(${u(E)}deg) rotateY(${u(y)}deg)`,L=Jt(d,h);L.style.transform=T}},setTransition:l=>{const c=e.slides.map(d=>ht(d));c.forEach(d=>{d.style.transitionDuration=`${l}ms`,d.querySelectorAll(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").forEach(u=>{u.style.transitionDuration=`${l}ms`})}),Zs({swiper:e,duration:l,transformElements:c})},recreateShadows:()=>{e.params.flipEffect,e.slides.forEach(l=>{let c=l.progress;e.params.flipEffect.limitRotation&&(c=Math.max(Math.min(l.progress,1),-1)),i(l,c)})},getEffectParams:()=>e.params.flipEffect,perspective:()=>!0,overwriteParams:()=>({slidesPerView:1,slidesPerGroup:1,watchSlidesProgress:!0,spaceBetween:0,virtualTranslate:!e.params.cssMode})})}function Rm(r){let{swiper:e,extendParams:t,on:s}=r;t({coverflowEffect:{rotate:50,stretch:0,depth:100,scale:1,modifier:1,slideShadows:!0}}),Pt({effect:"coverflow",swiper:e,on:s,setTranslate:()=>{const{width:a,height:o,slides:l,slidesSizesGrid:c}=e,d=e.params.coverflowEffect,u=e.isHorizontal(),f=e.translate,h=u?-f+a/2:-f+o/2,p=u?d.rotate:-d.rotate,m=d.depth,g=Qs(e);for(let y=0,E=l.length;y<E;y+=1){const v=l[y],S=c[y],T=v.swiperSlideOffset,L=(h-T-S/2)/S,b=typeof d.modifier=="function"?d.modifier(L):L*d.modifier;let C=u?p*b:0,A=u?0:p*b,w=-m*Math.abs(b),I=d.stretch;typeof I=="string"&&I.indexOf("%")!==-1&&(I=parseFloat(d.stretch)/100*S);let P=u?0:I*b,R=u?I*b:0,D=1-(1-d.scale)*Math.abs(b);Math.abs(R)<.001&&(R=0),Math.abs(P)<.001&&(P=0),Math.abs(w)<.001&&(w=0),Math.abs(C)<.001&&(C=0),Math.abs(A)<.001&&(A=0),Math.abs(D)<.001&&(D=0);const _=`translate3d(${R}px,${P}px,${w}px) rotateX(${g(A)}deg) rotateY(${g(C)}deg) scale(${D})`,B=Jt(d,v);if(B.style.transform=_,v.style.zIndex=-Math.abs(Math.round(b))+1,d.slideShadows){let k=u?v.querySelector(".swiper-slide-shadow-left"):v.querySelector(".swiper-slide-shadow-top"),M=u?v.querySelector(".swiper-slide-shadow-right"):v.querySelector(".swiper-slide-shadow-bottom");k||(k=Ct("coverflow",v,u?"left":"top")),M||(M=Ct("coverflow",v,u?"right":"bottom")),k&&(k.style.opacity=b>0?b:0),M&&(M.style.opacity=-b>0?-b:0)}}},setTransition:a=>{e.slides.map(l=>
36ht(l)).forEach(l=>{l.style.transitionDuration=`${a}ms`,l.querySelectorAll(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").forEach(c=>{c.style.transitionDuration=`${a}ms`})})},perspective:()=>!0,overwriteParams:()=>({watchSlidesProgress:!0})})}function Cm(r){let{swiper:e,extendParams:t,on:s}=r;t({creativeEffect:{limitProgress:1,shadowPerProgress:!1,progressMultiplier:1,perspective:!0,prev:{translate:[0,0,0],rotate:[0,0,0],opacity:1,scale:1},next:{translate:[0,0,0],rotate:[0,0,0],opacity:1,scale:1}}});const i=o=>typeof o=="string"?o:`${o}px`;Pt({effect:"creative",swiper:e,on:s,setTranslate:()=>{const{slides:o,wrapperEl:l,slidesSizesGrid:c}=e,d=e.params.creativeEffect,{progressMultiplier:u}=d,f=e.params.centeredSlides,h=Qs(e);if(f){const p=c[0]/2-e.params.slidesOffsetBefore||0;l.style.transform=`translateX(calc(50% - ${p}px))`}for(let p=0;p<o.length;p+=1){const m=o[p],g=m.progress,y=Math.min(Math.max(m.progress,-d.limitProgress),d.limitProgress);let E=y;f||(E=Math.min(Math.max(m.originalProgress,-d.limitProgress),d.limitProgress));const v=m.swiperSlideOffset,S=[e.params.cssMode?-v-e.translate:-v,0,0],T=[0,0,0];let L=!1;e.isHorizontal()||(S[1]=S[0],S[0]=0);let b={translate:[0,0,0],rotate:[0,0,0],scale:1,opacity:1};y<0?(b=d.next,L=!0):y>0&&(b=d.prev,L=!0),S.forEach((D,_)=>{S[_]=`calc(${D}px + (${i(b.translate[_])} * ${Math.abs(y*u)}))`}),T.forEach((D,_)=>{let B=b.rotate[_]*Math.abs(y*u);T[_]=B}),m.style.zIndex=-Math.abs(Math.round(g))+o.length;const C=S.join(", "),A=`rotateX(${h(T[0])}deg) rotateY(${h(T[1])}deg) rotateZ(${h(T[2])}deg)`,w=E<0?`scale(${1+(1-b.scale)*E*u})`:`scale(${1-(1-b.scale)*E*u})`,I=E<0?1+(1-b.opacity)*E*u:1-(1-b.opacity)*E*u,P=`translate3d(${C}) ${A} ${w}`;if(L&&b.shadow||!L){let D=m.querySelector(".swiper-slide-shadow");if(!D&&b.shadow&&(D=Ct("creative",m)),D){const _=d.shadowPerProgress?y*(1/d.limitProgress):y;D.style.opacity=Math.min(Math.max(Math.abs(_),0),1)}}const R=Jt(d,m);R.style.transform=P,R.style.opacity=I,b.origin&&(R.style.transformOrigin=b.origin)}},setTransition:o=>{const l=e.slides.map(c=>ht(c));l.forEach(c=>{c.style.transitionDuration=`${o}ms`,c.querySelectorAll(".swiper-slide-shadow").forEach(d=>{d.style.transitionDuration=`${o}ms`})}),Zs({swiper:e,duration:o,transformElements:l,allSlides:!0})},perspective:()=>e.params.creativeEffect.perspective,overwriteParams:()=>({watchSlidesProgress:!0,virtualTranslate:!e.params.cssMode})})}function Dm(r){let{swiper:e,extendParams:t,on:s}=r;t({cardsEffect:{slideShadows:!0,rotate:!0,perSlideRotate:2,perSlideOffset:8}}),Pt({effect:"cards",swiper:e,on:s,setTranslate:()=>{const{slides:a,activeIndex:o,rtlTranslate:l}=e,c=e.params.cardsEffect,{startTranslate:d,isTouched:u}=e.touchEventsData,f=l?-e.translate:e.translate;for(let h=0;h<a.length;h+=1){const p=a[h],m=p.progress,g=Math.min(Math.max(m,-4),4);let y=p.swiperSlideOffset;e.params.centeredSlides&&!e.params.cssMode&&(e.wrapperEl.style.transform=`translateX(${e.minTranslate()}px)`),e.params.centeredSlides&&e.params.cssMode&&(y-=a[0].swiperSlideOffset);let E=e.params.cssMode?-y-e.translate:-y,v=0;const S=-100*Math.abs(g);let T=1,L=-c.perSlideRotate*g,b=c.perSlideOffset-Math.abs(g)*.75;const C=e.virtual&&e.params.virtual.enabled?e.virtual.from+h:h,A=(C===o||C===o-1)&&g>0&&g<1&&(u||e.params.cssMode)&&f<d,w=(C===o||C===o+1)&&g<0&&g>-1&&(u||e.params.cssMode)&&f>d;if(A||w){const D=(1-Math.abs((Math.abs(g)-.5)/.5))**.5;L+=-28*g*D,T+=-.5*D,b+=96*D,v=`${-25*D*Math.abs(g)}%`}if(g<0?E=`calc(${E}px ${l?"-":"+"} (${b*Math.abs(g)}%))`:g>0?E=`calc(${E}px ${l?"-":"+"} (-${b*Math.abs(g)}%))`:E=`${E}px`,!e.isHorizontal()){const D=v;v=E,E=D}const I=g<0?`${1+(1-T)*g}`:`${1-(1-T)*g}`,P=` 37 translate3d(${E}, ${v}, ${S}px) 38 rotateZ(${c.rotate?l?-L:L:0}deg) 39 scale(${I}) 40 `;if(c.slideShadows){let D=p.querySelector(".swiper-slide-shadow");D||(D=Ct("cards",p)),D&&(D.style.opacity=Math.min(Math.max((Math.abs(g)-.5)/.5,0),1))}p.style.zIndex=-Math.abs(Math.round(m))+a.length;const R=Jt(c,p);R.style.transform=P}},setTransition:a=>{const o=e.slides.map(l=>ht(l));o.forEach(l=>{l.style.transitionDuration=`${a}ms`,l.querySelectorAll(".swiper-slide-shadow").forEach(c=>{c.style.transitionDuration=`${a}ms`})}),Zs({swiper:e,duration:a,transformElements:o})},perspective:()=>!0,overwriteParams:()=>({watchSlidesProgress:!0,virtualTranslate:!e.params.cssMode})})}const _m=[im,rm,nm,am,om,lm,cm,dm,um,fm,hm,pm,mm,gm,vm,ym,wm,Lm,Am,Im,Rm,Cm,Dm];Re.use(_m);const Js=["eventsPrefix","injectStyles","injectStylesUrls","modules","init","_direction","oneWayMovement","swiperElementNodeName","touchEventsTarget","initialSlide","_speed","cssMode","updateOnWindowResize","resizeObserver","nested","focusableElements","_enabled","_width","_height","preventInteractionOnTransition","userAgent","url","_edgeSwipeDetection","_edgeSwipeThreshold","_freeMode","_autoHeight","setWrapperSize","virtualTranslate","_effect","breakpoints","breakpointsBase","_spaceBetween","_slidesPerView","maxBackfaceHiddenSlides","_grid","_slidesPerGroup","_slidesPerGroupSkip","_slidesPerGroupAuto","_centeredSlides","_centeredSlidesB
40ounds","_slidesOffsetBefore","_slidesOffsetAfter","normalizeSlideIndex","_centerInsufficientSlides","_watchOverflow","roundLengths","touchRatio","touchAngle","simulateTouch","_shortSwipes","_longSwipes","longSwipesRatio","longSwipesMs","_followFinger","allowTouchMove","_threshold","touchMoveStopPropagation","touchStartPreventDefault","touchStartForcePreventDefault","touchReleaseOnEdges","uniqueNavElements","_resistance","_resistanceRatio","_watchSlidesProgress","_grabCursor","preventClicks","preventClicksPropagation","_slideToClickedSlide","_loop","loopAdditionalSlides","loopAddBlankSlides","loopPreventsSliding","_rewind","_allowSlidePrev","_allowSlideNext","_swipeHandler","_noSwiping","noSwipingClass","noSwipingSelector","passiveListeners","containerModifierClass","slideClass","slideActiveClass","slideVisibleClass","slideFullyVisibleClass","slideNextClass","slidePrevClass","slideBlankClass","wrapperClass","lazyPreloaderClass","lazyPreloadPrevNext","runCallbacksOnInit","observer","observeParents","observeSlideChildren","a11y","_autoplay","_controller","coverflowEffect","cubeEffect","fadeEffect","flipEffect","creativeEffect","cardsEffect","hashNavigation","history","keyboard","mousewheel","_navigation","_pagination","parallax","_scrollbar","_thumbs","virtual","zoom","control"];function Dt(r){return typeof r=="object"&&r!==null&&r.constructor&&Object.prototype.toString.call(r).slice(8,-1)==="Object"&&!r.__swiper__}function rr(r,e){const t=["__proto__","constructor","prototype"];Object.keys(e).filter(s=>t.indexOf(s)<0).forEach(s=>{typeof r[s]>"u"?r[s]=e[s]:Dt(e[s])&&Dt(r[s])&&Object.keys(e[s]).length>0?e[s].__swiper__?r[s]=e[s]:rr(r[s],e[s]):r[s]=e[s]})}function Pm(r){return r===void 0&&(r={}),r.navigation&&typeof r.navigation.nextEl>"u"&&typeof r.navigation.prevEl>"u"}function km(r){return r===void 0&&(r={}),r.pagination&&typeof r.pagination.el>"u"}function Mm(r){return r===void 0&&(r={}),r.scrollbar&&typeof r.scrollbar.el>"u"}function Is(r){return r===void 0&&(r=""),r.replace(/-[a-z]/g,e=>e.toUpperCase().replace("-",""))}function Om(r){let{swiper:e,slides:t,passedParams:s,changedParams:i,nextEl:n,prevEl:a,scrollbarEl:o,paginationEl:l}=r;const c=i.filter(A=>A!=="children"&&A!=="direction"&&A!=="wrapperClass"),{params:d,pagination:u,navigation:f,scrollbar:h,virtual:p,thumbs:m}=e;let g,y,E,v,S,T,L,b;i.includes("thumbs")&&s.thumbs&&s.thumbs.swiper&&d.thumbs&&!d.thumbs.swiper&&(g=!0),i.includes("controller")&&s.controller&&s.controller.control&&d.controller&&!d.controller.control&&(y=!0),i.includes("pagination")&&s.pagination&&(s.pagination.el||l)&&(d.pagination||d.pagination===!1)&&u&&!u.el&&(E=!0),i.includes("scrollbar")&&s.scrollbar&&(s.scrollbar.el||o)&&(d.scrollbar||d.scrollbar===!1)&&h&&!h.el&&(v=!0),i.includes("navigation")&&s.navigation&&(s.navigation.prevEl||a)&&(s.navigation.nextEl||n)&&(d.navigation||d.navigation===!1)&&f&&!f.prevEl&&!f.nextEl&&(S=!0);const C=A=>{e[A]&&(e[A].destroy(),A==="navigation"?(e.isElement&&(e[A].prevEl.remove(),e[A].nextEl.remove()),d[A].prevEl=void 0,d[A].nextEl=void 0,e[A].prevEl=void 0,e[A].nextEl=void 0):(e.isElement&&e[A].el.remove(),d[A].el=void 0,e[A].el=void 0))};i.includes("loop")&&e.isElement&&(d.loop&&!s.loop?T=!0:!d.loop&&s.loop?L=!0:b=!0),c.forEach(A=>{if(Dt(d[A])&&Dt(s[A]))Object.assign(d[A],s[A]),(A==="navigation"||A==="pagination"||A==="scrollbar")&&"enabled"in s[A]&&!s[A].enabled&&C(A);else{const w=s[A];(w===!0||w===!1)&&(A==="navigation"||A==="pagination"||A==="scrollbar")?w===!1&&C(A):d[A]=s[A]}}),c.includes("controller")&&!y&&e.controller&&e.controller.control&&d.controller&&d.controller.control&&(e.controller.control=d.controller.control),i.includes("children")&&t&&p&&d.virtual.enabled?(p.slides=t,p.update(!0)):i.includes("virtual")&&p&&d.virtual.enabled&&(t&&(p.slides=t),p.update(!0)),i.includes("children")&&t&&d.loop&&(b=!0),g&&m.init()&&m.update(!0),y&&(e.controller.control=d.controller.control),E&&(e.isElement&&(!l||typeof l=="string")&&(l=document.createElement("div"),l.classList.add("swiper-pagination"),l.part.add("pagination"),e.el.appendChild(l)),l&&(d.pagination.el=l),u.init(
40),u.render(),u.update()),v&&(e.isElement&&(!o||typeof o=="string")&&(o=document.createElement("div"),o.classList.add("swiper-scrollbar"),o.part.add("scrollbar"),e.el.appendChild(o)),o&&(d.scrollbar.el=o),h.init(),h.updateSize(),h.setTranslate()),S&&(e.isElement&&((!n||typeof n=="string")&&(n=document.createElement("div"),n.classList.add("swiper-button-next"),n.innerHTML=e.hostEl.constructor.nextButtonSvg,n.part.add("button-next"),e.el.appendChild(n)),(!a||typeof a=="string")&&(a=document.createElement("div"),a.classList.add("swiper-button-prev"),a.innerHTML=e.hostEl.constructor.prevButtonSvg,a.part.add("button-prev"),e.el.appendChild(a))),n&&(d.navigation.nextEl=n),a&&(d.navigation.prevEl=a),f.init(),f.update()),i.includes("allowSlideNext")&&(e.allowSlideNext=s.allowSlideNext),i.includes("allowSlidePrev")&&(e.allowSlidePrev=s.allowSlidePrev),i.includes("direction")&&e.changeDirection(s.direction,!1),(T||b)&&e.loopDestroy(),(L||b)&&e.loopCreate(),e.update()}const Vn=r=>{if(parseFloat(r)===Number(r))return Number(r);if(r==="true"||r==="")return!0;if(r==="false")return!1;if(r==="null")return null;if(r!=="undefined"){if(typeof r=="string"&&r.includes("{")&&r.includes("}")&&r.includes('"')){let e;try{e=JSON.parse(r)}catch{e=r}return e}return r}},zn=["a11y","autoplay","controller","cards-effect","coverflow-effect","creative-effect","cube-effect","fade-effect","flip-effect","free-mode","grid","hash-navigation","history","keyboard","mousewheel","navigation","pagination","parallax","scrollbar","thumbs","virtual","zoom"];function Kn(r,e,t){const s={},i={};rr(s,ir);const n=[...Js,"on"],a=n.map(l=>l.replace(/_/,""));n.forEach(l=>{l=l.replace("_",""),typeof r[l]<"u"&&(i[l]=r[l])});const o=[...r.attributes];return typeof e=="string"&&typeof t<"u"&&o.push({name:e,value:Dt(t)?{...t}:t}),o.forEach(l=>{const c=zn.filter(d=>l.name.indexOf(`${d}-`)===0)[0];if(c){const d=Is(c),u=Is(l.name.split(`${c}-`)[1]);typeof i[d]>"u"&&(i[d]={}),i[d]===!0&&(i[d]={enabled:!0}),i[d][u]=Vn(l.value)}else{const d=Is(l.name);if(!a.includes(d))return;const u=Vn(l.value);i[d]&&zn.includes(l.name)&&!Dt(u)?(i[d].constructor!==Object&&(i[d]={}),i[d].enabled=!!u):i[d]=u}}),rr(s,i),s.navigation?s.navigation={prevEl:".swiper-button-prev",nextEl:".swiper-button-next",...s.navigation!==!0?s.navigation:{}}:s.navigation===!1&&delete s.navigation,s.scrollbar?s.scrollbar={el:".swiper-scrollbar",...s.scrollbar!==!0?s.scrollbar:{}}:s.scrollbar===!1&&delete s.scrollbar,s.pagination?s.pagination={el:".swiper-pagination",...s.pagination!==!0?s.pagination:{}}:s.pagination===!1&&delete s.pagination,{params:s,passedParams:i}}const Fm=
vendor: 13,444 bytes, line 40
40":host{--swiper-theme-color:#007aff}:host{position:relative;display:block;margin-left:auto;margin-right:auto;z-index:1}.swiper{width:100%;height:100%;margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function,initial);box-sizing:content-box}.swiper-android ::slotted(swiper-slide),.swiper-ios ::slotted(swiper-slide),.swiper-wrapper{transform:translate3d(0px,0,0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}::slotted(swiper-slide){flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}::slotted(.swiper-slide-invisible-blank){visibility:hidden}.swiper-autoheight,.swiper-autoheight ::slotted(swiper-slide){height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-backface-hidden ::slotted(swiper-slide){transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-cube-shadow,.swiper-3d ::slotted(swiper-slide){transform-style:preserve-3d}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode ::slotted(swiper-slide){scroll-snap-align:start start}.swiper-css-mode.swiper-horizontal>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-css-mode.swiper-vertical>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-css-mode.swiper-free-mode>.swiper-wrapper{scroll-snap-type:none}.swiper-css-mode.swiper-free-mode ::slotted(swiper-slide){scroll-snap-align:none}.swiper-css-mode.swiper-centered>.swiper-wrapper::before{content:'';flex-shrink:0;order:9999}.swiper-css-mode.swiper-centered ::slotted(swiper-slide){scroll-snap-align:center center;scroll-snap-stop:always}.swiper-css-mode.swiper-centered.swiper-horizontal ::slotted(swiper-slide):first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper::before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-css-mode.swiper-centered.swiper-vertical ::slotted(swiper-slide):first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper::before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-virtual ::slotted(swiper-slide){-webkit-backface-visibility:hidden;transform:translateZ(0)}.swiper-virtual.swiper-css-mode .swiper-wrapper::after{content:'';position:absolute;left:0;top:0;pointer-events:none}.swiper-virtual.swiper-css-mode.swiper-horizontal .swiper-wrapper::after{height:1px;width:var(--swiper-virtual-size)}.swiper-virtual.swiper-css-mode.swiper-vertical .swiper-wrapper::after{width:1px;height:var(--swiper-virtual-size)}:host{--swiper-navigation-size:44px}.swiper-button-next,.swiper-button-prev{position:absolute;top:var(--swiper-navigation-top-offset,50%);width:calc(var(--swiper-navigation-size)/ 44 * 27);height:var(--swiper-navigation-size);margin-top:calc(0px - (var(--swiper-navigation-size)/ 2));z-index:10;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--swiper-navigation-color,var(--swiper-theme-color))}.swiper-button-next.swiper-button-disabled,.swiper-button-prev.swiper-button-disabled{opacity:.35;cursor:auto;pointer-events:none}.swiper-button-next.swiper-button-hidden,.swiper-button-prev.swiper-button-hidden{opacity:0;cursor:auto;pointer-events:none}.swiper-navigation-disabled .swiper-button-next,.swiper-navigation-disabled .swiper-button-prev{display:none!important}.swiper-button-next svg,.swiper-button-prev svg{width:100%;height:100%;object-fit:contain;transform-origin:center}.swiper-rtl .swiper-button-next svg,.swiper-rtl .swiper-button-prev svg{transform:rotate(180deg)}.swiper-button-prev,.swiper-rtl .swiper-button-next{left:var(--swiper-navigation-sides-offset,10px);right:auto}.swiper-button-next,.swiper-rtl .swiper-button-prev{right:var(--swiper-navigation-sides-offset,10px);left:auto}.swiper-button-lock{display:none}.swiper-pagination{position:absolute;text-align:center;transition:.3s opacity;transform:translate3d(0,0,0);z-index:10}.swiper-pagination.swiper-pagination-hidden{opacity:0}.swiper-pagination-disabled>.swiper-pagination,.swiper-pagination.swiper-pagination-disabled{display:none!important}.swiper-horizontal>.swiper-pagination-bullets,.swiper-pagination-bullets.swiper-pagination-horizontal,.swiper-pagination-custom,.swiper-pagination-fraction{bottom:var(--swiper-pagination-bottom,8px);top:var(--swiper-pagination-top,auto);left:0;width:100%}.swiper-pagination-bullets-dynamic{overflow:hidden;font-size:0}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transform:scale(.33);position:relative}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active{transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main{transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev{transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev{transform:scale(.33)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next{transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next{transform:scale(.33)}.swiper-pagination-bullet{width:var(--swiper-pagination-bullet-width,var(--swiper-pagination-bullet-size,8px));height:var(--swiper-pagination-bullet-height,var(--swiper-pagination-bullet-size,8px));display:inline-block;border-radius:var(--swiper-pagination-bullet-border-radius,50%);background:var(--swiper-pagination-bullet-inactive-color,#000);opacity:var(--swiper-pagination-bullet-inactive-opacity, .2)}button.swiper-pagination-bullet{border:none;margin:0;padding:0;box-shadow:none;-webkit-appearance:none;appearance:none}.swiper-pagination-clickable .swiper-pagination-bullet{cursor:pointer}.swiper-pagination-bullet:only-child{display:none!important}.swiper-pagination-bullet-active{opacity:var(--swiper-pagination-bullet-opacity, 1);background:var(--swiper-pagination-color,var(--swiper-theme-color))}.swiper-pagination-vertical.swiper-pagination-bullets,.swiper-vertical>.swiper-pagination-bullets{right:var(--swiper-pagination-right,8px);left:var(--swiper-pagination-left,auto);top:50%;transform:translate3d(0px,-50%,0)}.swiper-pagination-vertical.swiper-pagination-bullets .swiper-pagination-bullet,.swiper-vertical>.swiper-pagination-bullets .swiper-pagination-bullet{margin:var(--swiper-pagination-bullet-vertical-gap,6px) 0;display:block}.swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic,.swiper-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{top:50%;transform:translateY(-50%);width:8px}.swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,.swiper-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{display:inline-block;transition:.2s transform,.2s top}.swiper-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet,.swiper-pagination-horizontal.swiper-pagination-bullets .swiper-pagination-bullet{margin:0 var(--swiper-pagination-bullet-horizontal-gap,4px)}.swiper-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic,.swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{left:50%;transform:translateX(-50%);white-space:nowrap}.swiper-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,.swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transition:.2s transform,.2s left}.swiper-horizontal.swiper-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transition:.2s transform,.2s right}.swiper-pagination-fraction{color:var(--swiper-pagination-fraction-color,inherit)}.swiper-pagination-progressbar{background:var(--swiper-pagination-progressbar-bg-color,rgba(0,0,0,.25));position:absolute}.swiper-pagination-progressbar .swiper-pagination-progressbar-fill{background:var(--swiper-pagination-color,var(--swiper-theme-color));position:absolute;left:0;top:0;width:100%;height:100%;transform:scale(0);transform-origin:left top}.swiper-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill{transform-origin:right top}.swiper-horizontal>.swiper-pagination-progressbar,.swiper-pagination-progressbar.swiper-pagination-horizontal,.swiper-pagination-progressbar.swiper-pagination-vertical.swiper-pagination-progressbar-opposite,.swiper-vertical>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite{width:100%;height:var(--swiper-pagination-progressbar-size,4px);left:0;top:0}.swiper-horizontal>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite,.swiper-pagination-progressbar.swiper-pagination-horizontal.swiper-pagination-progressbar-opposite,.swiper-pagination-progressbar.swiper-pagination-vertical,.swiper-vertical>.swiper-pagination-progressbar{width:var(--swiper-pagination-progressbar-size,4px);height:100%;left:0;top:0}.swiper-pagination-lock{display:none}.swiper-scrollbar{border-radius:var(--swiper-scrollbar-border-radius,10px);position:relative;touch-action:none;background:var(--swiper-scrollbar-bg-color,rgba(0,0,0,.1))}.swiper-scrollbar-disabled>.swiper-scrollbar,.swiper-scrollbar.swiper-scrollbar-disabled{display:none!important}.swiper-horizontal>.swiper-scrollbar,.swiper-scrollbar.swiper-scrollbar-horizontal{position:absolute;left:var(--swiper-scrollbar-sides-offset,1%);bottom:var(--swiper-scrollbar-bottom,4px);top:var(--swiper-scrollbar-top,auto);z-index:50;height:var(--swiper-scrollbar-size,4px);width:calc(100% - 2 * var(--swiper-scrollbar-sides-offset,1%))}.swiper-scrollbar.swiper-scrollbar-vertical,.swiper-vertical>.swiper-scrollbar{position:absolute;left:var(--swiper-scrollbar-left,auto);right:var(--swiper-scrollbar-right,4px);top:var(--swiper-scrollbar-sides-offset,1%);z-index:50;width:var(--swiper-scrollbar-size,4px);height:calc(100% - 2 * var(--swiper-scrollbar-sides-offset,1%))}.swiper-scrollbar-drag{height:100%;width:100%;position:relative;background:var(--swiper-scrollbar-drag-bg-color,rgba(0,0,0,.5));border-radius:var(--swiper-scrollbar-border-radius,10px);left:0;top:0}.swiper-scrollbar-cursor-drag{cursor:move}.swiper-scrollbar-lock{display:none}::slotted(.swiper-slide-zoomed){cursor:move;touch-action:none}.swiper .swiper-notification{position:absolute;left:0;top:0;pointer-events:none;opacity:0;z-index:-1000}.swiper-free-mode>.swiper-wrapper{transition-timing-function:ease-out;margin:0 auto}.swiper-grid>.swiper-wrapper{flex-wrap:wrap}.swiper-grid-column>.swiper-wrapper{flex-wrap:wrap;flex-direction:column}.swiper-fade.swiper-free-mode ::slotted(swiper-slide){transition-timing-function:ease-out}.swiper-fade ::slotted(swiper-slide){pointer-events:none;transition-property:opacity}.swiper-fade ::slotted(swiper-slide) ::slotted(swiper-slide){pointer-events:none}.swiper-fade ::slotted(.swiper-slide-active){pointer-events:auto}.swiper-fade ::slotted(.swiper-slide-active) ::slotted(.swiper-slide-active){pointer-events:auto}.swiper.swiper-cube{overflow:visible}.swiper-cube ::slotted(swiper-slide){pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1;visibility:hidden;transform-origin:0 0;width:100%;height:100%}.swiper-cube ::slotted(swiper-slide) ::slotted(swiper-slide){pointer-events:none}.swiper-cube.swiper-rtl ::slotted(swiper-slide){transform-origin:100% 0}.swiper-cube ::slotted(.swiper-slide-active),.swiper-cube ::slotted(.swiper-slide-active) ::slotted(.swiper-slide-active){pointer-events:auto}.swiper-cube ::slotted(.swiper-slide-active),.swiper-cube ::slotted(.swiper-slide-next),.swiper-cube ::slotted(.swiper-slide-prev){pointer-events:auto;visibility:visible}.swiper-cube .swiper-cube-shadow{position:absolute;left:0;bottom:0px;width:100%;height:100%;opacity:.6;z-index:0}.swiper-cube .swiper-cube-shadow:before{content:'';background:#000;position:absolute;left:0;top:0;bottom:0;right:0;filter:blur(50px)}.swiper-cube ::slotted(.swiper-slide-next)+::slotted(swiper-slide){pointer-events:auto;visibility:visible}.swiper.swiper-flip{overflow:visible}.swiper-flip ::slotted(swiper-slide){pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1}.swiper-flip ::slotted(swiper-slide) ::slotted(swiper-slide){pointer-events:none}.swiper-flip ::slotted(.swiper-slide-active),.swiper-flip ::slotted(.swiper-slide-active) ::slotted(.swiper-slide-active){pointer-events:auto}.swiper-creative ::slotted(swiper-slide){-webkit-backface-visibility:hidden;backface-visibility:hidden;overflow:hidden;transition-property:transform,opacity,height}.swiper.swiper-cards{overflow:visible}.swiper-cards ::slotted(swiper-slide){transform-origin:center bottom;-webkit-backface-visibility:hidden;backface-visibility:hidden;overflow:hidden}",
40Nm="::slotted(.swiper-slide-shadow),::slotted(.swiper-slide-shadow-bottom),::slotted(.swiper-slide-shadow-left),::slotted(.swiper-slide-shadow-right),::slotted(.swiper-slide-shadow-top){position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}::slotted(.swiper-slide-shadow){background:rgba(0,0,0,.15)}::slotted(.swiper-slide-shadow-left){background-image:linear-gradient(to left,rgba(0,0,0,.5),rgba(0,0,0,0))}::slotted(.swiper-slide-shadow-right){background-image:linear-gradient(to right,rgba(0,0,0,.5),rgba(0,0,0,0))}::slotted(.swiper-slide-shadow-top){background-image:linear-gradient(to top,rgba(0,0,0,.5),rgba(0,0,0,0))}::slotted(.swiper-slide-shadow-bottom){background-image:linear-gradient(to bottom,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-lazy-preloader{animation:swiper-preloader-spin 1s infinite linear;width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;box-sizing:border-box;border:4px solid var(--swiper-preloader-color,var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}@keyframes swiper-preloader-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}::slotted(.swiper-slide-shadow-cube.swiper-slide-shadow-bottom),::slotted(.swiper-slide-shadow-cube.swiper-slide-shadow-left),::slotted(.swiper-slide-shadow-cube.swiper-slide-shadow-right),::slotted(.swiper-slide-shadow-cube.swiper-slide-shadow-top){z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}::slotted(.swiper-slide-shadow-flip.swiper-slide-shadow-bottom),::slotted(.swiper-slide-shadow-flip.swiper-slide-shadow-left),::slotted(.swiper-slide-shadow-flip.swiper-slide-shadow-right),::slotted(.swiper-slide-shadow-flip.swiper-slide-shadow-top){z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}::slotted(.swiper-zoom-container){width:100%;height:100%;display:flex;justify-content:center;align-items:center;text-align:center}::slotted(.swiper-zoom-container)>canvas,::slotted(.swiper-zoom-container)>img,::slotted(.swiper-zoom-container)>svg{max-width:100%;max-height:100%;object-fit:contain}";class Bm{}const To=typeof window>"u"||typeof HTMLElement>"u"?Bm:HTMLElement,Yn=`<svg width="11" height="20" viewBox="0 0 11 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.38296 20.0762C0.111788 19.805 0.111788 19.3654 0.38296 19.0942L9.19758 10.2796L0.38296 1.46497C0.111788 1.19379 0.111788 0.754138 0.38296 0.482966C0.654131 0.211794 1.09379 0.211794 1.36496 0.482966L10.4341 9.55214C10.8359 9.9539 10.8359 10.6053 10.4341 11.007L1.36496 20.0762C1.09379 20.3474 0.654131 20.3474 0.38296 20.0762Z" fill="currentColor"/></svg> 41 `,So=(r,e)=>{if(typeof CSSStyleSheet<"u"&&r.adoptedStyleSheets){const t=new CSSStyleSheet;t.replaceSync(e),r.adoptedStyleSheets=[t]}else{const t=document.createElement("style");t.rel="stylesheet",t.textContent=e,r.appendChild(t)}};class bo extends To{constructor(){super(),this.attachShadow({mode:"open"})}static get nextButtonSvg(){return Yn}static get prevButtonSvg(){return Yn.replace("/></svg>",' transform-origin="center" transform="rotate(180)"/></svg>')}cssStyles(){return[Fm,...this.injectStyles&&Array.isArray(this.injectStyles)?this.injectStyles:[]].join(` 42`)}cssLinks(){return this.injectStylesUrls||[]}calcSlideSlots(){const e=this.slideSlots||0,t=[...this.querySelectorAll("[slot^=slide-]")].map(s=>parseInt(s.getAttribute("slot").split("slide-")[1],10));if(this.slideSlots=t.length?Math.max(...t)+1:0,!!this.rendered){if(this.slideSlots>e)for(let s=e;s<this.slideSlots;s+=1){const i=document.createElement("swiper-slide");i.setAttribute("part",`slide slide-${s+1}`);const n=document.createElement("slot");n.setAttribute("name",`slide-${s+1}`),i.appendChild(n),this.shadowRoot.querySelector(".swiper-wrapper").appendChild(i)}else if(this.slideSlots<e){const s=this.swiper.slides;for(let i=s.length-1;i>=0;i-=1)i>this.slideSlots&&s[i].remove()}}}render(){if(this.rendered)return;this.calcSlideSlots();let e=this.cssStyles();this.slideSlots>0&&(e=e.replace(/::slotted\(([a-z-0-9.]*)\)/g,"$1")),e.length&&So(this.shadowRoot,e),this.cssLinks().forEac
42h(s=>{if(this.shadowRoot.querySelector(`link[href="${s}"]`))return;const n=document.createElement("link");n.rel="stylesheet",n.href=s,this.shadowRoot.appendChild(n)});const t=document.createElement("div");t.classList.add("swiper"),t.part="container",t.innerHTML=` 43 <slot name="container-start"></slot> 44 <div class="swiper-wrapper" part="wrapper"> 45 <slot></slot> 46 ${Array.from({length:this.slideSlots}).map((s,i)=>` 47 <swiper-slide part="slide slide-${i}"> 48 <slot name="slide-${i}"></slot> 49 </swiper-slide> 50 `).join("")} 51 </div> 52 <slot name="container-end"></slot> 53 ${Pm(this.passedParams)?` 54 <div part="button-prev" class="swiper-button-prev">${this.constructor.prevButtonSvg}</div> 55 <div part="button-next" class="swiper-button-next">${this.constructor.nextButtonSvg}</div> 56 `:""} 57 ${km(this.passedParams)?` 58 <div part="pagination" class="swiper-pagination"></div> 59 `:""} 60 ${Mm(this.passedParams)?` 61 <div part="scrollbar" class="swiper-scrollbar"></div> 62 `:""} 63 `,this.shadowRoot.appendChild(t),this.rendered=!0}initialize(){var e=this;if(this.initialized)return;this.initialized=!0;const{params:t,passedParams:s}=Kn(this);this.swiperParams=t,this.passedParams=s,delete this.swiperParams.init,this.render(),this.swiper=new Re(this.shadowRoot.querySelector(".swiper"),{...t.virtual?{}:{observer:!0},...t,touchEventsTarget:"container",onAny:function(i){i==="observerUpdate"&&e.calcSlideSlots();const n=t.eventsPrefix?`${t.eventsPrefix}${i.toLowerCase()}`:i.toLowerCase();for(var a=arguments.length,o=new Array(a>1?a-1:0),l=1;l<a;l++)o[l-1]=arguments[l];const c=new CustomEvent(n,{detail:o,bubbles:i!=="hashChange",cancelable:!0});e.dispatchEvent(c)}})}connectedCallback(){this.initialized&&this.nested&&this.closest("swiper-slide")&&this.closest("swiper-slide").swiperLoopMoveDOM||this.init===!1||this.getAttribute("init")==="false"||this.initialize()}disconnectedCallback(){this.nested&&this.closest("swiper-slide")&&this.closest("swiper-slide").swiperLoopMoveDOM||(this.swiper&&this.swiper.destroy&&this.swiper.destroy(),this.initialized=!1)}updateSwiperOnPropChange(e,t){const{params:s,passedParams:i}=Kn(this,e,t);this.passedParams=i,this.swiperParams=s,!(this.swiper&&this.swiper.params[e]===t)&&Om({swiper:this.swiper,passedParams:this.passedParams,changedParams:[Is(e)],...e==="navigation"&&i[e]?{prevEl:".swiper-button-prev",nextEl:".swiper-button-next"}:{},...e==="pagination"&&i[e]?{paginationEl:".swiper-pagination"}:{},...e==="scrollbar"&&i[e]?{scrollbarEl:".swiper-scrollbar"}:{}})}attributeChangedCallback(e,t,s){this.initialized&&(t==="true"&&s===null&&(s=!1),this.updateSwiperOnPropChange(e,s))}static get observedAttributes(){return Js.filter(t=>t.includes("_")).map(t=>t.replace(/[A-Z]/g,s=>`-${s}`).replace("_","").toLowerCase())}}Js.forEach(r=>{r!=="init"&&(r=r.replace("_",""),Object.defineProperty(bo.prototype,r,{configurable:!0,get(){return(this.passedParams||{})[r]},set(e){this.passedParams||(this.passedParams={}),this.passedParams[r]=e,this.initialized&&this.updateSwiperOnPropChange(r,e)}}))});class $m extends To{constructor(){super(),this.attachShadow({mode:"open"})}render(){const e=this.lazy||this.getAttribute("lazy")===""||this.getAttribute("lazy")==="true";if(So(this.shadowRoot,Nm),this.shadowRoot.appendChild(document.createElement("slot")),e){const t=document.createElement("div");t.classList.add("swiper-lazy-preloader"),t.part.add("preloader"),this.shadowRoot.appendChild(t)}}initialize(){this.render()}connectedCallback(){this.initialize()}}const Um=()=>{typeof window>"u"||(window.customElements.get("swiper-container")||window.customElements.define("swiper-container",bo),window.customElements.get("swiper-slide")||window.customElements.define("swiper-slide",$m))};typeof window<"u"&&(window.SwiperElementRegisterParams=r=>{Js.push(...r)});const Gm={class:"carousel__inner"},Hm={key:0,class:"figure"},Vm={__name:"Carousel",props:{images:Object},setup(r){const{$urlFor:e}=Qt();Um(),Zt();const t=r,s=de(null),i=de(0),n=l=>{i.value=l.detail[0].realIndex},a=()=>{s.value.swiper.slideNext()};_t(()=>{o()});const o=()=>
63{t.images.forEach(c=>{const d=new Image;d.src=e(c.image.asset.url).auto("format").width(800).fit("max")})};return(l,c)=>{const d=qs;return ee(),ie("div",Gm,[se("swiper-container",{ref_key:"swiperRef",ref:s,class:"swiper-container",loop:"true","autoplay-delay":"3000",speed:"1","space-between":0,grabCursor:!1,onSwiperslidechange:n,onClick:a},[(ee(!0),ie(xt,null,Gt(r.images,u=>(ee(),ie("swiper-slide",{key:u._key,class:"swiper-slide"},[u?(ee(),ie("figure",Hm,[De(d,{image:u.image,"use-hotspot":""},null,8,["image"])])):Be("",!0)]))),128))],544)])}}},zm=qe(Vm,[["__scopeId","data-v-8d189583"]]);async function Km({query:r,params:e,livePreview:t=!0}){const s=Zt(),i=s.previewIsActive?{client:"preview",server:!1,initialCache:!1}:void 0;_t(()=>{s.previewIsActive&&t&&Oo("preview").client.listen(r,e).subscribe(l=>{setTimeout(()=>{a()},900)})});const{data:n,refresh:a}=await Fo(r,e,i);return n}function Ym({title:r,seo:e,titleImage:t}){var c,d,u,f,h,p,m,g;const s=Y(r);if(!s)return;const i=Zt(),n=(c=e==null?void 0:e.ogImage)!=null&&c.asset?(d=e==null?void 0:e.ogImage)==null?void 0:d.asset:t!=null&&t.asset?t.asset:(h=(f=(u=i.siteOptions)==null?void 0:u.seo)==null?void 0:f.ogImage)==null?void 0:h.asset,{$urlFor:a}=Qt(),o=n?a(n).width(1200).url():"",l=`${s} â ${(p=i.siteOptions)==null?void 0:p.name}`;No({title:s,meta:[{property:"og:title",content:l},e!=null&&e.metaDescription?{name:"description",content:e==null?void 0:e.metaDescription}:{},e!=null&&e.metaDescription?{property:"og:description",content:e.metaDescription}:{},e!=null&&e.metaKeywords?{name:"keywords",content:e==null?void 0:e.metaKeywords.join(",")}:{},o?{property:"og:image",content:o}:{},o?{property:"og:image:width",content:o?"1200":""}:{},o?{property:"og:image:height",content:Math.floor(1200/(((g=(m=n==null?void 0:n.metadata)==null?void 0:m.dimensions)==null?void 0:g.aspectRatio)??1.5))}:{},o?{property:"og:image:type",content:(n==null?void 0:n.mimeType)??""}:{},{name:"twitter:title",content:l},e!=null&&e.metaDescription?{name:"twitter:description",content:e==null?void 0:e.metaDescription}:{},o?{name:"twitter:image",content:o}:{}]})}const kt=r=>(Ys("data-v-db725287"),r=r(),Ws(),r),Wm={key:0,class:"content"},qm={class:"main"},jm={class:"main__inner"},Xm={class:"content-block"},Qm={key:0,class:"heading-2"},Zm={class:"carousel"},Jm={key:2,class:"caption"},eg={class:"sidebar"},tg=kt(()=>se("h2",{class:"heading-2"},"Services",-1)),sg={class:"profile-list"},ig=kt(()=>se("h2",{class:"heading-2"},"Clients",-1)),rg={class:"profile-list"},ng=["onMouseenter","href","target"],ag={key:1},og=kt(()=>se("h2",{class:"heading-2"},"Selected Awards",-1)),lg={class:"profile-list profile-list--padded"},cg=kt(()=>se("br",null,null,-1)),dg=kt(()=>se("br",null,null,-1)),ug=kt(()=>se("br",null,null,-1)),fg={class:"site-credit"},hg={class:"carousel-mobile"},pg={__name:"index",async setup(r){let e,t;const{$urlFor:s}=Qt(),i=Zt();Bo();const n=([e,t]=$o(()=>Km({query:Uo})),e=await e,t(),e),a=de(!1),o=de(null),l=de(null),c=de(null),d=p=>p.split("-")[0];Ym({title:""}),_t(async()=>{u()});const u=()=>{n.value.clients.forEach(m=>{if(m.mediaType==="image"){const g=new Image;g.src=s(m.image.asset.url).auto("format").width(800).fit("max")}})},f=p=>{if(i.isMobile)return;a.value=!0;let g=n.value.clients.find(y=>y._key===p);c.value=g.caption,g.mediaType==="image"?l.value=g.image:g.mediaType==="video"&&(o.value=g.video)},h=()=>{i.isMobile||(a.value=!1,l.value=null,o.value=null)};return(p,m)=>{var T,L,b,C,A,w;const g=$h,y=zm,E=qs,v=ho,S=Ho;return Y(n)?(ee(),ie("main",Wm,[se("section",qm,[se("div",jm,[se("div",Xm,[De(g,{blocks:(T=Y(n))==null?void 0:T.content},null,8,["blocks"]),p.isMobile?(ee(),ie("h2",Qm,"Contact")):Be("",!0),De(g,{blocks:(L=Y(n))==null?void 0:L.contact},null,8,["blocks"])]),se("div",Zm,[De(S,null,{default:ki(()=>{var I;return[Y(a)?Be("",!0):(ee(),lt(y,{key:0,images:(I=Y(n))==null?void 0:I.carousel},null,8,["images"])),Y(a)?(ee(),ie(xt,{key:1},[Y(l)!=null?(ee(),lt(E,{key:0,image:Y(l)},null,8,["image"])):Be("",!0),Y(o)!=null?(ee(),lt(v,{key:1,video:Y(o)},null,8,["video"])):Be("",!0),Y(a)&&Y(c)!=null?(ee(),ie("p",Jm,Ae(Y(c)),1)):Be("",!0)],64)):Be("",!0)]}),_:1})])])]),se("aside",eg,[tg,se("ul",sg,[(ee(!0),ie(xt,null,Gt((b=Y(n))==null?void 0:b.services,(I,P)=>(ee(),ie("li",{key:P},Ae(I),1))),128))]),ig,se("ul",rg,[(ee(!0),ie(xt,null,Gt((C=Y(n))==null?void 0:C.clients,I=>(ee(),ie("li",{key:I._key},[I.href!=null?(ee(),ie("a",{key:0,onMouseenter:P=>f(I._key),onMouseleave:h,href:I.href,target:I.blank?"_blank":"_self",rel:"noopener"},Ae(I.title),41,ng)):(ee(),ie("span",ag,Ae(I.title),1))]))),128))]),og,se("ul",lg,[(ee(!0),ie(xt,null,Gt((A=Y(n))==null?void 0:A.awards,I=>(ee(),ie("li",{key:I._key},[se("p",null,[Ft(Ae(d(I.year)),1),cg,Ft(Ae(I.award),1),dg,Ft(Ae(I.description),1),ug,Ft(Ae(I.client),1)])]))),128))]),se("div",fg,[se("div",hg,[De(S,null,{default:ki(()=>{var I;return[De(y,{images:(I=Y(n))==null?void 0:I.carousel},null,8,["images"])]}),_:1})]),Ft(" "+Ae(Y(i).siteOptions.copyrightText)+" "+Ae(new Date().getFullYear())+" ",1),De(g,{blocks:(w=Y(n))==null?void 0:w.credit},null,8,["blocks"])])])])):Be("",!0)}}},yg=qe(pg,[["__scopeId","data-v-db725287"]]);export{yg as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.