1import{d as ze,f as Ke,z as Y,x as Be,C as Ge,aa as Uu,J as Jt,k as H,K as di,L as Bi,m as Q,ad as Ba,ae as $a,n as K,H as Dt,o as kl,ac as ag,y as Me,r as Ui,af as Dl,q as le,v as Et,t as xe,_ as we,D as Ne,F as at,p as rt,s as hr,a2 as og,u as Bu,P as $u,E as cr,G as Cl,I as lg,b as fi,l as cg}from"./entry.ioxNJHcl.js";import{_ as Ml}from"./Image.B8ARxyv4.js";import{_ as an}from"./LinkEnquire.zxB88VUM.js";import{_ as Pl}from"./Swiper.vue.Dlhm7en4.js";import{N as on,K as Gu,r as Hu,_ as Vu,a as Wu}from"./swiper-element-bundle.3HXHWeio.js";import{_ as Ri}from"./ImageLazy.Do9FMnc6.js";import{_ as Ol}from"./Content.vue.DodKrJKh.js";import{g as dg}from"./get-image-src.xZjvMW6e.js";import{_ as ug}from"./Thumb.mHqcDUcH.js";const Ku=ze({__name:"ImageWrap",props:{image:{type:Object,required:!0},width:{type:Number,required:!0},height:{type:Number,default:0}},setup(s){const e=Bi,t=s,i=Ke(()=>{var o,l,c;return t.height?t.width/t.height:((c=(l=(o=t.image.asset)==null?void 0:o.metadata)==null?void 0:l.dimensions)==null?void 0:c.aspectRatio)||1}),r=Ke(()=>({"aspect-ratio":i.value})),n=Ke(()=>{var o;return(o=t.image)!=null&&o.callToAction?e:"div"}),a=Ke(()=>{var o,l;if((o=t.image)!=null&&o.callToAction){const{links:c}=(l=t.image)==null?void 0:l.callToAction;return c.length?c[0]:null}return null});return(o,l)=>(Y(),Be(di(H(n)),Jt(H(a),{style:H(r),class:"BaseImageWrap"}),{default:Ge(()=>[Uu(o.$slots,"default")]),_:3},16,["style"]))}}),hg=s=>(Ba("data-v-d312f59c"),s=s(),$a(),s),fg=hg(()=>K("span",{class:"ButtonClose__inner"},[K("span",{class:"ButtonClose__line ButtonClose__line--one"}),K("span",{class:"ButtonClose__line ButtonClose__line--three"})],-1)),mg=[fg],pg=ze({__name:"Close",emits:["click"],setup(s,{emit:e}){const t=e,i=()=>t("click");return(r,n)=>(Y(),Q("button",{class:"ButtonClose","aria-label":"Close",onClick:n[0]||(n[0]=a=>i())},mg))}}),gg=Dt(pg,[["__scopeId","data-v-d312f59c"]]),vg={class:"BaseOverlay"},Eg={class:"BaseOverlay__inner"},yg=ze({__name:"Overlay",emits:["close"],setup(s,{emit:e}){const t=e;kl(()=>{window.addEventListener("keydown",r)}),ag(()=>{window.removeEventListener("keydown",r)});const i=()=>t("close"),r=n=>{n.code==="Escape"&&i()};return(n,a)=>{const o=gg;return Y(),Q("div",vg,[K("div",Eg,[Uu(n.$slots,"default",{},void 0,!0)]),Me(o,{class:"BaseOverlay__close-button",onClick:a[0]||(a[0]=l=>i())})])}}}),qu=Dt(yg,[["__scopeId","data-v-981b2880"]]),_g={key:0,class:"col-3 ta-r"},Tg=ze({__name:"Images",props:{type:{type:String,default:"default"},_key:{type:String,default:""},images:{type:Array,default:()=>[]},disableAutoplay:{type:Boolean,default:!1}},setup(s){const e=Bi,t=Ui("default"),i=s,r={modules:[on],loop:i.images.length>1,speed:Dl*2,navigation:{nextEl:".BaseSwiper__button--next",prevEl:".BaseSwiper__button--previous"}},n=l=>{const c=i.images[l];if(!c){t.value="default";return}t.value=c.color||"default"},a=l=>l?e:"div",o=l=>{if(l){const{links:c}=l;return c.length?c[0]:null}};return(l,c)=>{const d=Ml,u=an,h=Pl;return Y(),Q("div",{class:Et(["ModulesImages",`ModulesImages--${s.type}`])},[s.images&&s.images.length?(Y(),Be(h,{key:0,id:s._key,type:s.type,slides:s.images,params:r,observe:!s.disableAutoplay,autoplay:!1,class:Et(["ModulesImages__swiper",`ModulesImages__swiper--${H(t)}`]),onSlideChange:n},{slide:Ge(({slide:f})=>[f&&f.asset?(Y(),Be(d,{key:0,image:f,width:2500,"width-mobile":950,class:"ModulesImages__image"},null,8,["image"])):le("",!0)]),caption:Ge(({slide:f})=>{var p,y,_,A,x,I,P,L,B;return[f.title?(Y(),Q("div",{key:0,class:Et(["ModulesImages__caption ff-secondary flex flex-wrap flex-align-end ma-b",`ModulesImages__caption--${f.color}`])},[K("div",{class:Et({"col-9":((p=f.priceEnquire)==null?void 0:p.option)&&((y=f.priceEnquire)==null?void 0:y.option)!=="none"})},[(Y(),Be(di(a(f.callToAction)),Jt(o(f.callToAction),{class:"cta"}),{default:Ge(()=>{var O;return[K("em",null,xe(("translate"in l?l.translate:H(we))(f.title)),1),(O=f.context)!=null&&O[H(Ne)]?(Y(),Q(at,{key:0},[rt(xe(("translate"in l?l.translate:H(we))(f.context)),1)],64)):le("",!0)]}),_:2},1040))],2),(_=f.priceEnquire)!=null&&_.option&&((A=f.priceEnquire)==null?void 0:A.option)!=="none"?(Y(),Q("div",_g,[Me(u,{option:(x=f.priceEnquire)==null?void 0:x.option,"enquire-email-address":(I=f.priceEnquire)==null?void 0:I.enquireEmailAddress,price:(P=f.priceEnquire)==null?void 0:P.price,subject:(L=f.priceEnquire)==null?void 0:L.emailSubject,body:(B=f.priceEnquire)==null?void 0:B.emailBody},null,8,["option","enquire-email-address","price","subject","body"])])):le("",!0)],2)):le("",!0)]}),_:1},8,["id","type","slides","observe","class"])):le("",!0)],2)}}}),Yu=s=>(Ba("data-v-7f951450"),s=s(),$a(),s),bg={class:"ModulesThumbnailsItem__inner"},Ag={key:1,class:"ModulesThumbnailsItem__info-wrap flex-md flex-md-wrap flex-md-align-center"},Sg={class:"ModulesThumbnailsItem__info ta-c"},xg={class:"d-b"},Ig=Yu(()=>K("br",null,null,-1)),Lg=Yu(()=>K("br",null,null,-1)),wg=ze({__name:"Item",props:{image:{type:Object,default:()=>null}},emits:["enlarge"],setup(s,{emit:e}){const t=e,i=s,r=Ke(()=>{var a,o;return i.image.title||((a=i.image.priceEnquire)==null?void 0:a.option)&&((o=i.image.priceEnquire)==null?void 0:o.option)!=="none"}),n=()=>t("enlarge");return(a,o)=>{var d,u,h,f,p,y,_,A;const l=Ri,c=an;return Y(),Q("div",{class:Et(["ModulesThumbnailsItem",[{"has-info":H(r)},{"has-image":s.image&&s.image.asset}]])},[K("div",bg,[s.image&&s.image.asset?(Y(),Q("button",{key:0,"aria-label":"Enlarge",class:"ModulesThumbnailsItem__image-wrap",onClick:o[0]||(o[0]=x=>n())},[Me(l,{image:s.image,width:1200,class:"ModulesThumbnailsItem__image"},null,8,["image"])])):le("",!0),H(r)?(Y(),Q("div",Ag,[K("div",Sg,[K("button",{"aria-label":"Enlarge",class:"ModulesThumbnailsItem__title-wrap cta ta-c",onClick:o[1]||(o[1]=x=>n())},[K("em",xg,xe(("translate"in a?a.translate:H(we))(s.image.title)),1),(d=s.image.context)!=null&&d[H(Ne)]?(Y(),Q(at,{key:0},[rt(xe(("translate"in a?a.translate:H(we))(s.image.context)),1)],64)):le("",!0)]),(u=s.image.priceEnquire)!=null&&u.option&&((h=s.image.priceEnquire)==null?void 0:h.option)!=="none"?(Y(),Q(at,{key:0},[Ig,Lg,Me(c,{option:(f=s.image.priceEnquire)==null?void 0:f.option,"enquire-email-address":(p=s.image.priceEnquire)==null?void 0:p.enquireEmailAddress,price:(y=s.image.priceEnquire)==null?void 0:y.price,subject:(_=s.image.priceEnquire)==null?void 0:_.emailSubject,body:(A=s.image.priceEnquire)==null?void 0:A.emailBody},null,8,["option","enquire-email-address","price","subject","body"])],64)):le("",!0)])])):le("",!0)])],2)}}}),Rg=Dt(wg,[["__scopeId","data-v-7f951450"]]),kg={class:"ModulesThumbnails"},Dg={class:"flex flex-wrap flex-justify-center"},Cg={class:"ModulesThumbnails__swiper-image-wrap"},Mg={class:"ModulesThumbnails__swiper-caption ta-c ma-b"},Pg={key:0,class:"d-b"}
1,Og=ze({__name:"Thumbnails",props:{_key:{type:String,default:""},images:{type:Array,default:()=>[]}},setup(s){const e=Ui(!1),t=Ui(0),r={modules:[on,Gu],loop:s.images.length>1,speed:Dl*2,navigation:{nextEl:".BaseSwiper__button--next",prevEl:".BaseSwiper__button--previous"},keyboard:{enabled:!0}},n=o=>{t.value=o,e.value=!0},a=()=>{e.value=!1};return(o,l)=>{const c=Rg,d=Ml,u=Pl,h=qu;return Y(),Q("div",kg,[K("div",Dg,[(Y(!0),Q(at,null,hr(s.images,(f,p)=>(Y(),Be(c,{key:p,image:f,class:"ModulesThumbnails__item col-6 col-md-4",onEnlarge:y=>n(p)},null,8,["image","onEnlarge"]))),128))]),Me(h,{class:Et(["ModulesThumbnails__overlay view",{active:H(e)}]),onClose:l[0]||(l[0]=f=>a())},{default:Ge(()=>[Me(u,{id:s._key,slides:s.images,"show-counter":!0,params:r,"starting-index":H(t)},{slide:Ge(({slide:f})=>[K("div",Cg,[Me(d,{image:f,width:2500,class:"ModulesThumbnails__swiper-image"},null,8,["image"])])]),caption:Ge(({slide:f})=>{var p;return[K("div",Mg,[(p=f.title)!=null&&p[H(Ne)]?(Y(),Q("em",Pg,xe(("translate"in o?o.translate:H(we))(f.title)),1)):le("",!0),rt(" "+xe(("translate"in o?o.translate:H(we))(f.context)),1)])]}),_:1},8,["id","slides","starting-index"])]),_:1},8,["class"])])}}}),Ng=Dt(Og,[["__scopeId","data-v-d6e56e3d"]]),Fg={class:"ModulesCompositeBlocksImage__inner module"},Ug={class:"module-caption flex flex-wrap ff-secondary"},Bg={key:0},$g={key:0,class:"col-3 ta-r"},Gg=ze({__name:"Image",props:{image:{type:Object,required:!0},size:{type:String,default:"large"}},setup(s){const e=Bi,t=s,i=Ke(()=>t.image.callToAction?e:"div"),r=Ke(()=>{if(t.image.callToAction){const{links:n}=t.image.callToAction;return n.length?n[0]:null}});return(n,a)=>{var d,u,h,f,p,y,_,A,x;const o=Ri,l=Ku,c=an;return Y(),Q("div",{class:Et(["ModulesCompositeBlocksImage",`ModulesCompositeBlocksImage--${s.size}`])},[K("div",Fg,[s.image&&s.image.asset?(Y(),Be(l,{key:0,width:1200,image:s.image,class:"ModulesCompositeBlocksImage__image-wrap"},{default:Ge(()=>[Me(o,{image:s.image,width:1200,class:"ModulesCompositeBlocksImage__image"},null,8,["image"])]),_:1},8,["image"])):le("",!0),K("div",Ug,[K("div",{class:Et({"col-9":((d=s.image.priceEnquire)==null?void 0:d.option)&&((u=s.image.priceEnquire)==null?void 0:u.option)!=="none"})},[(Y(),Be(di(H(i)),Jt(H(r),{class:"cta"}),{default:Ge(()=>{var I,P;return[(I=s.image.title)!=null&&I[H(Ne)]?(Y(),Q("em",Bg,xe(("translate"in n?n.translate:H(we))(s.image.title)),1)):le("",!0),(P=s.image.context)!=null&&P[H(Ne)]?(Y(),Q(at,{key:1},[rt(xe(("translate"in n?n.translate:H(we))(s.image.context)),1)],64)):le("",!0)]}),_:1},16))],2),(h=s.image.priceEnquire)!=null&&h.option&&((f=s.image.priceEnquire)==null?void 0:f.option)!=="none"?(Y(),Q("div",$g,[Me(c,{option:(p=s.image.priceEnquire)==null?void 0:p.option,"enquire-email-address":(y=s.image.priceEnquire)==null?void 0:y.enquireEmailAddress,price:(_=s.image.priceEnquire)==null?void 0:_.price,subject:(A=s.image.priceEnquire)==null?void 0:A.emailSubject,body:(x=s.image.priceEnquire)==null?void 0:x.emailBody},null,8,["option","enquire-email-address","price","subject","body"])])):le("",!0)])])],2)}}}),Hg=Dt(Gg,[["__scopeId","data-v-99e5aba5"]]),Vg=ze({__name:"Text",props:{body:{type:Object,default:()=>null},width:{type:String,default:"narrow"}},setup(s){return(e,t)=>{var r;const i=Ol;return Y(),Q("div",{class:Et(["ModulesCompositeBlocksText ff-secondary",`ModulesCompositeBlocksText--${s.width}`])},[(r=s.body)!=null&&r[H(Ne)]?(Y(),Be(i,{key:0,blocks:("translate"in e?e.translate:H(we))(s.body),class:"ModulesCompositeBlocksText__body"},null,8,["blocks"])):le("",!0)],2)}}}),Wg=Dt(Vg,[["__scopeId","data-v-6cc5c663"]]),Kg={key:0,class:"CompositeBlocks__col CompositeBlocks__col--left flex-md flex-md-wrap flex-md-align-end"},qg={class:"CompositeBlocks__col flex-md flex-md-wrap flex-md-align-end"},Yg=ze({__name:"CompositeBlocks",props:{imageSmall:{type:Object,default:()=>null},text:{type:Object,default:()=>[]},imageLarge:{type:Object,default:()=>null},alignment:{type:String,default:"right"}},setup(s){return(e,t)=>{var n;const i=Hg,r=Wg;return Y(),Q("div",{class:Et(["CompositeBlocks flex flex-wrap flex-md-justify-center",`CompositeBlocks--${s.alignment}`])},[s.imageSmall&&s.imageSmall.asset?(Y(),Q("div",Kg,[Me(i,{image:s.imageSmall,size:"small",class:"CompositeBlocks__item"},null,8,["image"])])):le("",!0),K("div",qg,[s.imageLarge&&s.imageLarge.asset?(Y(),Be(i,{key:0,image:s.imageLarge,size:"large",class:"CompositeBlocks__item"},null,8,["image"])):le("",!0),(n=s.text)!=null&&n[H(Ne)]?(Y(),Be(r,{key:1,body:s.text,width:s.imageLarge&&s.imageLarge.asset?"narrow":"default",class:"CompositeBlocks__item"},null,8,["body","width"])):le("",!0)])],2)}}}),jg={class:"ModulesImage module wrap"}
1,zg={class:"ModulesImage__image-container col col-center"},Xg={class:"ModulesImage__caption module-caption flex flex-wrap ff-secondary"},Qg={key:0},Zg={key:0,class:"col-3 ta-r"},Jg=ze({__name:"Image",props:{_key:{type:String,default:""},image:{type:Object,required:!0}},setup(s){const e=Bi,t=s,i=Ke(()=>t.image.callToAction?e:"div"),r=Ke(()=>{if(t.image.callToAction){const{links:n}=t.image.callToAction;return n.length?n[0]:null}});return(n,a)=>{var d,u,h,f,p,y,_,A,x;const o=Ri,l=Ku,c=an;return Y(),Q("div",jg,[K("div",zg,[Me(l,{width:2500,image:s.image,class:"ModulesImage__image-wrap"},{default:Ge(()=>[Me(o,{image:s.image,width:2500,class:"ModulesImage__image"},null,8,["image"])]),_:1},8,["image"]),K("div",Xg,[K("div",{class:Et({"col-9":((d=s.image.priceEnquire)==null?void 0:d.option)&&((u=s.image.priceEnquire)==null?void 0:u.option)!=="none"})},[(Y(),Be(di(H(i)),Jt(H(r),{class:"cta"}),{default:Ge(()=>{var I,P;return[(I=s.image.title)!=null&&I[H(Ne)]?(Y(),Q("em",Qg,xe(("translate"in n?n.translate:H(we))(s.image.title)),1)):le("",!0),(P=s.image.context)!=null&&P[H(Ne)]?(Y(),Q(at,{key:1},[rt(xe(("translate"in n?n.translate:H(we))(s.image.context)),1)],64)):le("",!0)]}),_:1},16))],2),(h=s.image.priceEnquire)!=null&&h.option&&((f=s.image.priceEnquire)==null?void 0:f.option)!=="none"?(Y(),Q("div",Zg,[Me(c,{option:(p=s.image.priceEnquire)==null?void 0:p.option,"enquire-email-address":(y=s.image.priceEnquire)==null?void 0:y.enquireEmailAddress,price:(_=s.image.priceEnquire)==null?void 0:_.price,subject:(A=s.image.priceEnquire)==null?void 0:A.emailSubject,body:(x=s.image.priceEnquire)==null?void 0:x.emailBody},null,8,["option","enquire-email-address","price","subject","body"])])):le("",!0)])])])}}}),e0=Dt(Jg,[["__scopeId","data-v-82dbe03a"]]);var ju={exports:{}};/*! 2 * mux-embed 3 * @version 4.30.0 4 * @copyright 2023 Mux, Inc 5 */(function(s,e){(function(){var t;t=function(){return function(){var i={80:function(a,o,l){a.exports=l(728).default},728:function(a,o,l){l.d(o,{default:function(){return tg}});var c=l(48),d=l.n(c),u=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(E){var m=16*Math.random()|0;return(E==="x"?m:3&m|8).toString(16)})},h=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},f=function(E){var m,v;if(E&&E.nodeName!==void 0)return E.muxId||(E.muxId=h()),E.muxId;try{v=document.querySelector(E)}catch{}return v&&!v.muxId&&(v.muxId=E),((m=v)===null||m===void 0?void 0:m.muxId)||E},p=function(E){var m;E&&E.nodeName!==void 0?E=f(m=E):m=document.querySelector(E);var v=m&&m.nodeName?m.nodeName.toLowerCase():"";return[m,E,v]},y=l(640),_=l.n(y),A=_().methodFactory;_().methodFactory=function(E,m,v){var g=A(E,m,v);return function(){for(var b=["[mux]"],R=0;R<arguments.length;R++)b.push(arguments[R]);g.apply(void 0,b)}},_().setLevel(_().getLevel());var x=_();function I(){return(d().doNotTrack||d().navigator&&d().navigator.doNotTrack)==="1"}var P={now:function(){var E=d().performance,m=E&&E.timing,v=m&&m.navigationStart,g=typeof v=="number"&&typeof E.now=="function"?v+E.now():Date.now();return Math.round(g)}},L=function(E){return B(E)[0]},B=function(E){if(typeof E!="string"||E==="")return["localhost"];var m,v=(E.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return v&&(m=(v.match(/[^\.]+\.[^\.]+$/)||[])[0]),[v,m]},O={exists:function(){var E=d().performance;return(E&&E.timing)!==void 0},domContentLoadedEventEnd:function(){var E=d().performance,m=E&&E.timing;return m&&m.domContentLoadedEventEnd},navigationStart:function(){var E=d().performance,m=E&&E.timing;return m&&m.navigationStart}};function F(E,m,v){v=v===void 0?1:v,E[m]=E[m]||0,E[m]+=v}var V=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],$=["x-cdn","content-type"].concat(V);function j(E){var m={};return(E=E||"").trim().split(/[\r\n]+/).forEach(function(v){if(v){var g=v.split(": "),b=g.shift();b&&($.indexOf(b.toLowerCase())>=0||b.toLowerCase().indexOf("x-litix-")===0)&&(m[b]=g.join(": "))}}),m}function z(E){if(E){var m=V.find(function(v){return E[v]!==void 0});return m?E[m]:void 0}}var ve=function(E){var m={};for(var v in E){var g=E[v];g["DATA-ID"].search("io.litix.data.")!==-1&&(m[g["DATA-ID"].replace("io.litix.data.","")]=g.VALUE)}return m};function qe(E,m){var v=Object.keys(E);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(E);m&&(g=g.filter(function(b){return Object.getOwnPropertyDescriptor(E,b).enumerable})),v.push.apply(v,g)}return v}function pe(E){for(var m=1;m<arguments.length;m++){var v=arguments[m]!=null?arguments[m]:{};
5m%2?qe(Object(v),!0).forEach(function(g){Le(E,g,v[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(v)):qe(Object(v)).forEach(function(g){Object.defineProperty(E,g,Object.getOwnPropertyDescriptor(v,g))})}return E}function Le(E,m,v){return m in E?Object.defineProperty(E,m,{value:v,enumerable:!0,configurable:!0,writable:!0}):E[m]=v,E}var Pe=function(E){if(!E)return{};var m=O.navigationStart(),v=E.loading,g=v?v.start:E.trequest,b=v?v.first:E.tfirst,R=v?v.end:E.tload;return{bytesLoaded:E.total,requestStart:Math.round(m+g),responseStart:Math.round(m+b),responseEnd:Math.round(m+R)}},J=function(E){if(E&&typeof E.getAllResponseHeaders=="function")return j(E.getAllResponseHeaders())};function ne(E,m){var v=Object.keys(E);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(E);m&&(g=g.filter(function(b){return Object.getOwnPropertyDescriptor(E,b).enumerable})),v.push.apply(v,g)}return v}function Re(E){for(var m=1;m<arguments.length;m++){var v=arguments[m]!=null?arguments[m]:{};m%2?ne(Object(v),!0).forEach(function(g){se(E,g,v[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(v)):ne(Object(v)).forEac
5h(function(g){Object.defineProperty(E,g,Object.getOwnPropertyDescriptor(v,g))})}return E}function se(E,m,v){return m in E?Object.defineProperty(E,m,{value:v,enumerable:!0,configurable:!0,writable:!0}):E[m]=v,E}var Ae=function(E,m){if(!E||!E.requestEndDate)return{};var v,g=L(E.url),b=E.url,R=E.bytesLoaded,S=new Date(E.requestStartDate).getTime(),C=new Date(E.firstByteDate).getTime(),U=new Date(E.requestEndDate).getTime(),k=isNaN(E.duration)?0:E.duration,te=typeof m.getMetricsFor=="function"?m.getMetricsFor(E.mediaType).HttpList:m.getDashMetrics().getHttpRequests(E.mediaType);return te.length>0&&(v=j(te[te.length-1]._responseHeaders||"")),{requestStart:S,requestResponseStart:C,requestResponseEnd:U,requestBytesLoaded:R,requestResponseHeaders:v,requestMediaDuration:k,requestHostname:g,requestUrl:b,requestId:v?z(v):void 0}},He=function(E,m){var v=m.getQualityFor(E),g=m.getCurrentTrackFor(E).bitrateList;return g?{currentLevel:v,renditionWidth:g[v].width||null,renditionHeight:g[v].height||null,renditionBitrate:g[v].bandwidth}:{}},xt=function(E){var m;return(m=E.match(/.*codecs\*?="(.*)"/))===null||m===void 0?void 0:m[1]},$t=function(E){try{var m,v;return(m=E.getVersion)===null||m===void 0||(v=m.call(E))===null||v===void 0?void 0:v.split(".").map(function(g){return parseInt(g)})[0]}catch{return!1}};function Ot(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}var ui=0,mr=function(){function E(){(function(g,b){if(!(g instanceof b))throw new TypeError("Cannot call a class as a function")})(this,E)}var m,v;return m=E,v=[{key:"on",value:function(g,b,R){return b._eventEmitterGuid=b._eventEmitterGuid||++ui,this._listeners=this._listeners||{},this._listeners[g]=this._listeners[g]||[],R&&(b=b.bind(R)),this._listeners[g].push(b),b}},{key:"off",value:function(g,b){var R=this._listeners&&this._listeners[g];R&&R.forEach(function(S,C){S._eventEmitterGuid===b._eventEmitterGuid&&R.splice(C,1)})}},{key:"one",value:function(g,b,R){var S=this;b._eventEmitterGuid=b._eventEmitterGuid||++ui;var C=function U(){S.off(g,U),b.apply(R||this,arguments)};C._eventEmitterGuid=b._eventEmitterGuid,this.on(g,C)}},{key:"emit",value:function(g,b){var R=this;if(this._listeners){b=b||{};var S=this._listeners["before*"]||[],C=this._listeners[g]||[],U=this._listeners["after"+g]||[],k=function(te,ce){(te=te.slice()).forEach(function(Ie){Ie.call(R,{type:g},ce)})};k(S,b),k(C,b),k(U,b)}}}],v&&Ot(m.prototype,v),Object.defineProperty(m,"prototype",{writable:!1}),E}(),Dm=mr;function Cm(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}var Mm=function(){function E(g){var b=this;(function(R,S){if(!(R instanceof S))throw new TypeError("Cannot call a class as a function")})(this,E),this.pm=g,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,g.on("playing",function(){b._playheadShouldBeProgressing=!0}),g.on("play",this._startPlaybackHeartbeatInterval.bind(this)),g.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),g.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),g.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),g.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),g.on("seeking",this._startPlaybackHeartbeatInterval.bind(this)),g.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),g.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),g.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),g.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),g.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),g.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),g.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),g.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),g.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),g.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),g.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),g.on("seeked",function(){g.data.player_is_paused?b._stopPlaybackHeartbeatInterval():b._startPlaybackHeartbeatInterval()}),g.on("timeupdate",function(){b._playbackHeartbeatInterval!==null&&g.emit("playbackheartbeat")}),g.on("devicesleep",function(R,S){b._playbackHeartbeatInterval!==null&&(d().clearInterval(b._playbackHeartbeatInterval),g.emit("playbackheartbeatend",{viewer_time:S.viewer_time}),b._playbackHeartbeatInterval=null)})}var m,v;return m=E,(v=[{key:"_startPlaybackHeartbeatInterval",value:function(){var g=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=d().setInterval(function(){g.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(d().clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}])&&Cm(m.prototype,v),Object.defineProperty(m,"prototype",{writable:!1}),E}();function _c(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}function Pm(E,m,v){return m&&_c(E.prototype,m),v&&_c(E,v),Object.defineProperty(E,"prototype",{writable:!1}),E}var Om=Pm(function E(m){var v=this;(function(g,b){if(!(g instanceof b))throw new TypeError("Cannot call a class as a function")})(this,E),m.on("viewinit",function(){v.viewErrored=!1}),m.on("error",function(g,b){try{var R=m.errorTranslator({player_error_code:b.player_error_code,player_error_message:b.player_error_message,player_error_context:b.player_error_context});R?(m.data.player_error_code=R.player_error_code||b.player_error_code,m.data.player_error_message=R.player_error_message||b.player_error_message,m.data.player_error_context=R.player_error_context||b.player_error_context,v.viewErrored=!0):(delete m.data.player_error_code,delete m.data.player_error_message,delete m.data.player_error_context)}catch(S){m.mux.log.warn("Exception in error translator callback.",S),v.viewErrored=!0}})});function Nm(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}var Fm=function(){function E(g){(function(b,R){if(!(b instanceof R))throw new TypeError("Cannot call a class as a function")})(this,E),this.pm=g,this._watchTimeTrackerLastCheckedTime=null,g.on("playbackheartbeat",this._updateWatchTime.bind(this)),g.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}var m,v;return m=E,(v=[{key:"_updateWatchTime",value:function(g,b){var R=b.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=R),F(this.pm.data,"view_watch_time",R-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=R}},{key:"_clearWatchTimeState",value:function(g,b){this._updateWatchTime(g,b),this._watchTimeTrackerLastCheckedTime=null}}])&&Nm(m.prototype,v),Object.defineProperty(m,"prototype",{writable:!1}),E}();function Um(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}var Bm=function(){function E(g){var b=this;(function(C,U){if(!(C instanceof U))throw new TypeError("Cannot call a class as a function")})(this,E),this.pm=g,this._playbackTimeTrackerLastPlayheadPosition=-1,this._lastTime=P.now(),this._isAdPlaying=!1,this._callbackUpdatePlaybackTime=null;var R=this._startPlaybackTimeTracking.bind(this);g.on("playing",R),g.on("adplaying",R),g.on("seeked",R);var S=this._stopPlaybackTimeTracking.bind(this);g.on("playbackheartbeatend",S),g.on("seeking",S),g.on("adplaying",function(){b._isAdPlaying=!0}),g.on("adended",function(){b._isAdPlaying=!1}),g.on("adpause",function(){b._isAdPlaying=!1}),g.on("adbreakstart",function(){b._isAdPlaying=!1}),g.on("adbreakend",function(){b._isAdPlaying=!1}),g.on("adplay",function(){b._isAdPlaying=!1}),g.on("viewinit",function(){b._playbackTimeTrackerLastPlayheadPosition=-1,b._lastTime=P.now(),b._isAdPlaying=!1,b._callbackUpdatePlaybackTime=null})}var m,v;return m=E,(v=[{key:"_startPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime===null&&(this._callbackUpdatePlaybackTime=this._updatePlaybackTime.bind(this),this._playbackTimeTrackerLastPlayheadPosition=this.pm.data.player_playhead_time,this.pm.on("playbackheartbeat",this._callbackUpdatePlaybackTime))}},{key:"_stopPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime&&(this._updatePlaybackTime(),this.pm.off("playbackheartbeat",this._callbackUpdatePlaybackTime),this._callbackUpdatePlaybackTime=null,this._playbackTimeTrackerLastPlayheadPosition=-1)}},{key:"_updatePlaybackTime",value:function(){var g=this.pm.data.player_playhead_time,b=P.now(),R=-1;this._playbackTimeTrackerLastPlayheadPosition>=0&&g>this._playbackTimeTrackerLastPlayheadPosition?R=g-this._playbackTimeTrackerLastPlayheadPosition:this._isAdPlaying&&(R=b-this._lastTime),R>0&&R<=1e3&&F(this.pm.data,"view_content_playback_time",R),this._playbackTimeTrackerLastPlayheadPosition=g,this._lastTime=b}}])&&Um(m.prototype,v),Object.defineProperty(m,"prototype",{writable:!1}),E}();function $m(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}var Gm=function(){function E(g){(function(R,S){if(!(R instanceof S))throw new TypeError("Cannot call a class as a function")})(this,E),this.pm=g;var b=this._updatePlayheadTime.bind(this);g.on("playbackheartbeat",b),g.on("playbackheartbeatend",b),g.on("timeupdate",b),g.on("destroy",function(){g.off("timeupdate",b)})}var m,v;return m=E,(v=[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=this.pm.data.view_max_playhead_position===void 0?this.pm.data.player_playhead_time:Math.max(this.pm.data.view_max_playhead_position,this.pm.data.player_playhead_time)}},{key:"_updatePlayheadTime",value:function(g,b){var R=this,S=function(){R.pm.currentFragmentPDT&&R.pm.currentFragmentStart&&(R.pm.data.player_program_time=R.pm.currentFragmentPDT+R.pm.data.player_playhead_time-R.pm.currentFragmentStart)};if(b&&b.player_playhead_time)this.pm.data.player_playhead_time=b.player_playhead_time,S(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var C=this.pm.getPlayheadTime();C!==void 0&&(this.pm.data.player_playhead_time=C,S(),this._updateMaxPlayheadPosition())}}}])&&$m(m.prototype,v),Object.defineProperty(m,"prototype",{writable:!1}),E}();function Tc(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}function Hm(E,m,v){return m&&Tc(E.prototype,m),v&&Tc(E,v),Object.defineProperty(E,"prototype",{writable:!1}),E}var bc=3e5,Vm=Hm(function E(m){if(function(R,S){if(!(R instanceof S))throw new TypeError("Cannot call a class as a function")}(this,E),!m.disableRebufferTracking){var v,g=function(R,S){b(S),v=void 0},b=function(R){if(v){var S=R.viewer_time-v;F(m.data,"view_rebuffer_duration",S),v=R.viewer_time,m.data.view_rebuffer_duration>bc&&(m.emit("viewend"),m.send("viewend"),m.mux.log.warn("Ending view after rebuffering for longer than ".concat(bc,"ms, future events will be ignored unless a programchange or videochange occurs.")))}m.data.view_watch_time>=0&&m.data.view_rebuffer_count>0&&(m.data.view_rebuffer_frequency=m.data.view_rebuffer_count/m.data.view_watch_time,m.data.view_rebuffer_percentage=m.data.view_rebuffer_duration/m.data.view_watch_time)};m.on("playbackheartbeat",function(R,S){return b(S)}),m.on("rebufferstart",function(R,S){v||(F(m.data,"view_rebuffer_count",1),v=S.viewer_time,m.one("rebufferend",g))}),m.on("viewinit",function(){v=void 0,m.off("rebufferend",g)})}});function Wm(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}var Km=function(){function E(g){var b=this;(function(R,S){if(!(R instanceof S))throw new TypeError("Cannot call a class as a function")})(this,E),this.pm=g,g.disableRebufferTracking||g.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,g.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),g.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),g.on("seeking",function(){b._cleanupRebufferTracker(null,{viewer_time:P.now()})}))}var m,v;return m=E,v=[{key:"_checkIfRebuffering",value:function(g,b){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)this._cleanupRebufferTracker(g,b);else if(this._lastCheckedTime!==null)if(this._lastPlayheadTime===this.pm.data.player_playhead_time){var R=b.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&R>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=b.viewer_time}else this._cleanupRebufferTracker(g,b,!0);else this._prepareRebufferTrackerState(b.viewer_time)}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(g){this._lastCheckedTime=g,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=g}},{key:"_cleanupRebufferTracker",value:function(g,b){var R=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:b.viewer_time});else{if(this._lastCheckedTime===null)return;var S=this.pm.data.player_playhead_time-this._lastPlayheadTime,C=b.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&S>0&&C-S>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+C-S}))}R?this._prepareRebufferTrackerState(b.viewer_time):this._clearRebufferTrackerState()}}],v&&Wm(m.prototype,v),Object.defineProperty(m,"prototype",{writable:!1}),E}(),qm=Km;function Ym(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}var jm=function(){function E(g){var b=this;(function(R,S){if(!(R instanceof S))throw new TypeError("Cannot call a class as a function")})(this,E),this.pm=g,g.on("viewinit",function(){var R=g.data,S=R.view_id;if(!R.view_program_changed){var C=function(U,k){var te=k.viewer_time;U.type==="playing"&&g.data.view_time_to_first_frame===void 0?b.calculateTimeToFirstFrame(te||P.now(),S):U.type!=="adplaying"||g.data.view_time_to_first_frame
5!==void 0&&!b._inPrerollPosition()||b.calculateTimeToFirstFrame(te||P.now(),S)};g.one("playing",C),g.one("adplaying",C),g.one("viewend",function(){g.off("playing",C),g.off("adplaying",C)})}})}var m,v;return m=E,(v=[{key:"_inPrerollPosition",value:function(){return this.pm.data.view_content_playback_time===void 0||this.pm.data.view_content_playback_time<=1e3}},{key:"calculateTimeToFirstFrame",value:function(g,b){b===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:g}),this.pm.data.view_time_to_first_frame=this.pm.data.view_watch_time,(this.pm.data.player_autoplay_on||this.pm.data.video_is_autoplay)&&this.NAVIGATION_START&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.NAVIGATION_START))}}])&&Ym(m.prototype,v),Object.defineProperty(m,"prototype",{writable:!1}),E}();function Ac(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}function zm(E,m,v){return m&&Ac(E.prototype,m),v&&Ac(E,v),Object.defineProperty(E,"prototype",{writable:!1}),E}var Xm=zm(function E(m){var v=this;(function(g,b){if(!(g instanceof b))throw new TypeError("Cannot call a class as a function")})(this,E),m.on("viewinit",function(){v._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb"].forEach(function(g){m.on(g,function(){if(v._lastPlayheadPosition>=0&&m.data.player_playhead_time>=0&&v._lastPlayerWidth>=0&&v._lastSourceWidth>0&&v._lastPlayerHeight>=0&&v._lastSourceHeight>0){var b=m.data.player_playhead_time-v._lastPlayheadPosition;if(b<0)return void(v._lastPlayheadPosition=-1);var R=Math.min(v._lastPlayerWidth/v._lastSourceWidth,v._lastPlayerHeight/v._lastSourceHeight),S=Math.max(0,R-1),C=Math.max(0,1-R);m.data.view_max_upscale_percentage=Math.max(m.data.view_max_upscale_percentage||0,S),m.data.view_max_downscale_percentage=Math.max(m.data.view_max_downscale_percentage||0,C),F(m.data,"view_total_content_playback_time",b),F(m.data,"view_total_upscaling",S*b),F(m.data,"view_total_downscaling",C*b)}v._lastPlayheadPosition=-1})}),["playing","hb"].forEach(function(g){m.on(g,function(){v._lastPlayheadPosition=m.data.player_playhead_time,v._lastPlayerWidth=m.data.player_width,v._lastPlayerHeight=m.data.player_height,v._lastSourceWidth=m.data.video_source_width,v._lastSourceHeight=m.data.video_source_height})})});function Sc(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}function Qm(E,m,v){return m&&Sc(E.prototype,m),v&&Sc(E,v),Object.defineProperty(E,"prototype",{writable:!1}),E}var Zm=Qm(function E(m){var v=this;(function(R,S){if(!(R instanceof S))throw new TypeError("Cannot call a class as a function")})(this,E),this.isSeeking=!1;var g=-1,b=function(){var R=P.now(),S=(m.data.viewer_time||R)-(g||R);F(m.data,"view_seek_duration",S),m.data.view_max_seek_time=Math.max(m.data.view_max_seek_time||0,S),v.isSeeking=!1,g=-1};m.on("seeking",function(R,S){Object.assign(m.data,S),v.isSeeking&&S.viewer_time-g<=2e3?g=S.viewer_time:(v.isSeeking&&b(),v.isSeeking=!0,g=S.viewer_time,F(m.data,"view_seek_count",1),m.send("seeking"))}),m.on("seeked",function(){b()}),m.on("viewend",function(){v.isSeeking&&(b(),m.send("seeked")),v.isSeeking=!1,g=-1})});function xc(E,m){return function(v){if(Array.isArray(v))return v}(E)||function(v,g){var b=v==null?null:typeof Symbol<"u"&&v[Symbol.iterator]||v["@@iterator"];if(b!=null){var R,S,C=[],U=!0,k=!1;try{for(b=b.call(v);!(U=(R=b.next()).done)&&(C.push(R.value),!g||C.length!==g);U=!0);}catch(te){k=!0,S=te}finally{try{U||b.return==null||b.return()}finally{if(k)throw S}}return C}}(E,m)||function(v,g){if(v){if(typeof v=="string")return Ic(v,g);var b=Object.prototype.toString.call(v).slice(8,-1);return b==="Object"&&v.constructor&&(b=v.constructor.name),b==="Map"||b==="Set"?Array.from(v):b==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?Ic(v,g):void 0}}
5(E,m)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 6In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Ic(E,m){(m==null||m>E.length)&&(m=E.length);for(var v=0,g=new Array(m);v<m;v++)g[v]=E[v];return g}function Jm(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}var Lc=function(E,m){E.push(m),E.sort(function(v,g){return v.viewer_time-g.viewer_time})},ep=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror","adclicked","adskipped"],tp=function(){function E(g){var b=this;(function(S,C){if(!(S instanceof C))throw new TypeError("Cannot call a class as a function")})(this,E),this.pm=g,g.on("viewinit",function(){b.isAdBreak=!1,b._currentAdRequestNumber=0,b._currentAdResponseNumber=0,b._adRequests=[],b._adResponses=[],b._adHasPlayed=!1,b._wouldBeNewAdPlay=!0,b._prerollPlayTime=void 0}),ep.forEach(function(S){return g.on(S,b._updateAdData.bind(b))});var R=function(){b.isAdBreak=!1};g.on("adbreakstart",function(){b.isAdBreak=!0}),g.on("play",R),g.on("playing",R),g.on("viewend",R),g.on("adrequest",function(S,C){C=Object.assign({ad_request_id:"generatedAdRequestId"+b._currentAdRequestNumber++},C),Lc(b._adRequests,C),F(g.data,"view_ad_request_count"),b.inPrerollPosition()&&(g.data.view_preroll_requested=!0,b._adHasPlayed||F(g.data,"view_preroll_request_count"))}),g.on("adresponse",function(S,C){C=Object.assign({ad_request_id:"generatedAdRequestId"+b._currentAdResponseNumber++},C),Lc(b._adResponses,C);var U=b.findAdRequest(C.ad_request_id);U&&F(g.data,"view_ad_request_time",Math.max(0,C.viewer_time-U.viewer_time))}),g.on("adplay",function(S,C){b._adHasPlayed=!0,b._wouldBeNewAdPlay&&(b._wouldBeNewAdPlay=!1,F(g.data,"view_ad_played_count")),b.inPrerollPosition()&&!g.data.view_preroll_played&&(g.data.view_preroll_played=!0,b._adRequests.length>0&&(g.data.view_preroll_request_time=Math.max(0,C.viewer_time-b._adRequests[0].viewer_time)),g.data.view_start&&(g.data.view_startup_preroll_request_time=Math.max(0,C.viewer_time-g.data.view_start)),b._prerollPlayTime=C.viewer_time)}),g.on("adplaying",function(S,C){b.inPrerollPosition()&&g.data.view_preroll_load_time===void 0&&b._prerollPlayTime!==void 0&&(g.data.view_preroll_load_time=C.viewer_time-b._prerollPlayTime,g.data.view_startup_preroll_load_time=C.viewer_time-b._prerollPlayTime)}),g.on("adclicked",function(S,C){b._wouldBeNewAdPlay||F(g.data,"view_ad_clicked_count")}),g.on("adskipped",function(S,C){b._wouldBeNewAdPlay||F(g.data,"view_ad_skipped_count")}),g.on("adended",function(){b._wouldBeNewAdPlay=!0}),g.on("aderror",function(){b._wouldBeNewAdPlay=!0})}var m,v;return m=E,(v=[{key:"inPrerollPosition",value:function(){return this.pm.data.view_content_playback_time===void 0||this.pm.data.view_content_playback_time<=1e3}},{key:"findAdRequest",value:function(g){for(var b=0;b<this._adRequests.length;b++)if(this._adRequests[b].ad_request_id===g)return this._adRequests[b]}},{key:"_updateAdData",value:function(g,b){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&b.ad_tag_url){var R=xc(B(b.ad_tag_url),2),S=R[0],C=R[1];this.pm.data.view_preroll_ad_tag_domain=C,this.pm.data.view_preroll_ad_tag_hostname=S}if(!this.pm.data.view_preroll_ad_asset_hostname&&b.ad_asset_url){var U=xc(B(b.ad_asset_url),2),k=U[0],te=U[1];this.pm.data.view_preroll_ad_asset_domain=te,this.pm.data.view_preroll_ad_asset_hostname=k}}this.pm.data.ad_asset_url=b==null?void 0:b.ad_asset_url,this.pm.data.ad_tag_url=b==null?void 0:b.ad_tag_url,this.pm.data.ad_creative_id=b==null?void 0:b.ad_creative_id,this.pm.data.ad_id=b==null?void 0:b.ad_id,this.pm.data.ad_universal_id=b==null?void 0:b.ad_universal_id}}])&&Jm(m.prototype,v),Object.defineProperty(m,"prototype",{writable:!1}),E}();function wc(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}function ip(E,m,v){return m&&wc(E.prototype,m),v&&wc(E,v),Object.defineProperty(E,"prototype",{writable:!1}),E}var sp=ip(function E(m){var v,g;(function(C,U){if(!(C instanceof U))throw new TypeError("Cannot call a class as a function")})(this,E);var b=function(){m.disableRebufferTracking||v&&(F(m.data,"view_waiting_rebuffer_duration",P.now()-v),v=!1,d().clearInterval(g))},R=!1,S=function(){R=!1,b()};m.on("waiting",function(){R&&(m.disableRebufferTracking||(F(m.data,"view_waiting_rebuffer_count",1),v=P.now(),g=d().setInterval(function(){if(v){var C=P.now();F(m.data,"view_waiting_rebuffer_duration",C-v),v=C}},250)))}),m.on("playing",function(){b(),R=!0}),m.on("pause",S),m.on("seeking",S)});function Rc(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}function rp(E,m,v){return m&&Rc(E.prototype,m),v&&Rc(E,v),Object.defineProperty(E,"prototype",{writable:!1}),E}var np=rp(function E(m){var v=this;(function(R,S){if(!(R instanceof S))throw new TypeError("Cannot call a class as a function")})(this,E);var g=function(){v.lastWallClockTime=P.now(),m.on("before*",b)},b=function(R){var S=P.now(),C=v.lastWallClockTime;v.lastWallClockTime=S,S-C>3e4&&(m.emit("devicesleep",{viewer_time:C}),Object.assign(m.data,{viewer_time:C}),m.send("devicesleep"),m.emit("devicewake",{viewer_time:S}),Object.assign(m.data,{viewer_time:S}),m.send("devicewake"))};m.one("playbackheartbeat",g),m.on("playbackheartbeatend",function(){m.off("before*",b),m.one("playbackheartbeat",g)})}),kc=l(375),ap=l(655),Dc=l.n(ap),Cc="muxData",Mc=function(){var E;try{E=kc.parse(Dc().get(Cc)||"")}catch{E={}}return E},Pc=function(E){try{Dc().set(Cc,kc.stringify(E),{expires:365})}catch{}},op=function(){var E=Mc();return E.mux_viewer_id=E.mux_viewer_id||u(),E.msn=E.msn||Math.random(),Pc(E),{mux_viewer_id:E.mux_viewer_id,mux_sample_number:E.msn}};function lp(E,m){var v=m.beaconCollectionDomain,g=m.beaconDomain;if(v)return"https://"+v;var b=g||"litix.io";return(E=E||"inferred").match(/^[a-z0-9]+$/)?"https://"+E+"."+b:"https://img.litix.io/a.gif"}var Oc=function(){var E;switch(Nc()){case"cellular":E="cellular";break;case"ethernet":E="wired";break;case"wifi":E="wifi";break;case void 0:break;default:E="other"}return E},Nc=function(){var E=d().navigator,m=E&&(E.connection||E.mozConnection||E.webkitConnection);return m&&m.type};Oc.getConnectionFromAPI=Nc;var cp=Oc,dp=Uc({a:"env",b:"beacon",c:"custom",d:"ad",e:"event",f:"experiment",i:"internal",m:"mux",n:"response",p:"player",q:"request",r:"retry",s:"session",t:"timestamp",u:"viewer",v:"video",w:"page",x:"view",y:"sub"}),Fc=Uc({ad:"ad",ag:"aggregate",ap:"api",al:"application",ar:"architecture",as:"asset",au:"autoplay",av:"average",bi:"bitrate",br:"break",bw:"browser",by:"bytes",ca:"cached",cb:"cancel",cc:"codec",cd:"code",cg:"category",ch:"changed",ck:"clicked",cl:"canceled",cn:"config",co:"count",ce:"counter",cp:"complete",cr:"creative",ct:"content",cu:"current",cx:"c
6onnection",cz:"context",dg:"downscaling",dm:"domain",dn:"cdn",do:"downscale",dr:"drm",dp:"dropped",du:"duration",dv:"device",ec:"encoding",ed:"edge",en:"end",eg:"engine",em:"embed",er:"error",es:"errorcode",et:"errortext",ee:"event",ev:"events",ex:"expires",ep:"experiments",fa:"failed",fi:"first",fm:"family",ft:"format",fp:"fps",fq:"frequency",fr:"frame",fs:"fullscreen",ha:"has",hb:"holdback",he:"headers",ho:"host",hn:"hostname",ht:"height",id:"id",ii:"init",in:"instance",ip:"ip",is:"is",ke:"key",la:"language",lb:"labeled",le:"level",li:"live",ld:"loaded",lo:"load",ls:"lists",lt:"latency",ma:"max",md:"media",me:"message",mf:"manifest",mi:"mime",ml:"midroll",mm:"min",mn:"manufacturer",mo:"model",mx:"mux",ne:"newest",nm:"name",no:"number",on:"on",os:"os",pa:"paused",pb:"playback",pd:"producer",pe:"percentage",pf:"played",pg:"program",ph:"playhead",pi:"plugin",pl:"preroll",pn:"playing",po:"poster",pr:"preload",ps:"position",pt:"part",py:"property",ra:"rate",rd:"requested",re:"rebuffer",rf:"rendition",rm:"remote",ro:"ratio",rp:"response",rq:"request",rs:"requests",sa:"sample",sd:"skipped",se:"session",sk:"seek",sm:"stream",so:"source",sq:"sequence",sr:"series",st:"start",su:"startup",sv:"server",sw:"software",ta:"tag",tc:"tech",te:"text",tg:"target",th:"throughput",ti:"time",tl:"total",to:"to",tt:"title",ty:"type",ug:"upscaling",un:"universal",up:"upscale",ur:"url",us:"user",va:"variant",vd:"viewed",vi:"video",ve:"version",vw:"view",vr:"viewer",wd:"width",wa:"watch",wt:"waiting"});function Uc(E){var m={};for(var v in E)E.hasOwnProperty(v)&&(m[E[v]]=v);return m}function Qa(E){var m={},v={};
6return Object.keys(E).forEach(function(g){var b=!1;if(E.hasOwnProperty(g)&&E[g]!==void 0){var R=g.split("_"),S=R[0],C=dp[S];C||(x.info("Data key word `"+R[0]+"` not expected in "+g),C=S+"_"),R.splice(1).forEach(function(U){U==="url"&&(b=!0),Fc[U]?C+=Fc[U]:Number(U)&&Math.floor(Number(U))===Number(U)?C+=U:(x.info("Data key word `"+U+"` not expected in "+g),C+="_"+U+"_")}),b?v[C]=E[g]:m[C]=E[g]}}),Object.assign(m,v)}var up={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},hp=["hb","requestcompleted","requestfailed","requestcanceled"],fp="https://img.litix.io",ki=function(E){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=E||fp,this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},up,m)};ki.prototype.queueEvent=function(E,m){var v=Object.assign({},m);return(this._eventQueue.length<=this._options.maxQueueLength||E==="eventrateexceeded")&&(this._eventQueue.push(v),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength)},ki.prototype.flushEvents=function(){var E=arguments.length>0&&arguments[0]!==void 0&&arguments[0];E&&this._eventQueue.length===1?this._eventQueue.pop():(this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending())},ki.prototype.destroy=function(){var E=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.destroyed=!0,E?this._clearBeaconQueue():this.flushEvents(),d().clearTimeout(this._sendTimeout)},ki.prototype._clearBeaconQueue=function(){var E=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,m=this._eventQueue.slice(E);E>0&&Object.assign(m[m.length-1],Qa({mux_view_message:"event queue truncated"}));var v=this._createPayload(m);Bc(this._beaconUrl,v,!0,function(){})},ki.prototype._sendBeaconQueue=function(){var E=this;if(!this._postInFlight){var m=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var v=this._createPayload(m),g=P.now();Bc(this._beaconUrl,v,!1,function(b,R){R?(E._eventQueue=m.concat(E._eventQueue),E._failureCount+=1,x.info("Error sending beacon: "+R)):E._failureCount=0,E._roundTripTime=P.now()-g,E._postInFlight=!1})}},ki.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var E=Math.pow(2,this._failureCount-1);return(1+(E*=Math.random()))*this._options.baseTimeBetweenBeacons},ki.prototype._startBeaconSending=function(){var E=this;d().clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=d().setTimeout(function(){E._eventQueue.length&&E._sendBeaconQueue(),E._startBeaconSending()},this._getNextBeaconTime()))},ki.prototype._createPayload=function(E){var m,v,g,b=this,R={transmission_timestamp:Math.round(P.now())};this._roundTripTime&&(R.rtt_ms=Math.round(this._roundTripTime));var S=function(){m=JSON.stringify({metadata:R,events:v||E}),g=m.length/1024},C=function(){return g<=b._options.maxPayloadKBSize};return S(),C()||(x.info("Payload size is too big ("+g+" kb). Removing unnecessary events."),v=E.filter(function(U){return hp.indexOf(U.e)===-1}),S()),C()||(x.info("Payload size still too big ("+g+" kb). Cropping fields.."),v.forEach(function(U){for(var k in U){var te=U[k];typeof te=="string"&&te.length>51200&&(U[k]=te.substring(0,51200))}}),S()),m};var mp=function(E){return E.length<=57344},Bc=function(E,m,v,g){if(v&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(E,m))g();else if(d().fetch)d().fetch(E,{method:"POST",body:m,headers:{"Content-Type":"text/plain"},keepalive:mp(m)}).then(function(R){return g(null,R.ok?null:"Error")}).catch(function(R){return g(null,R)});else{if(d().XMLHttpRequest){var b=new(d()).XMLHttpRequest;return b.onreadystatechange=function(){if(b.readyState===4)return g(null,b.status!==200?"error":void 0)},b.open("POST",E),b.setRequestHeader("Content-Type","text/plain"),void b.send(m)}g()}},pp=ki;function gp(E,m){return function(v){if(Array.isArray(v))return v}(E)||function(v,g){var b=v==null?null:typeof Symbol<"u"&&v[Symbol.iterator]||v["@@iterator"];if(b!=null){var R,S,C=[],U=!0,k=!1;try{for(b=b.call(v);!(U=(R=b.next()).done)&&(C.push(R.value),!g||C.length!==g);U=!0);}catch(te){k=!0,S=te}finally{try{U||b.return==null||b.return()}finally{if(k)throw S}}return C}}(E,m)||function(v,g){if(v){if(typeof v=="string")return $c(v,g);var b=Object.prototype.toString.call(v).slice(8,-1);return b==="Object"&&v.constructor&&(b=v.constructor.name),b==="Map"||b==="Set"?Array.from(v):b==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?$c(v,g):void 0}}
6(E,m)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 7In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function $c(E,m){(m==null||m>E.length)&&(m=E.length);for(var v=0,g=new Array(m);v<m;v++)g[v]=E[v];return g}function Gc(E,m){var v=Object.keys(E);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(E);m&&(g=g.filter(function(b){return Object.getOwnPropertyDescriptor(E,b).enumerable})),v.push.apply(v,g)}return v}function ks(E){for(var m=1;m<arguments.length;m++){var v=arguments[m]!=null?arguments[m]:{};m%2?Gc(Object(v),!0).forEach(function(g){dn(E,g,v[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(v)):Gc(Object(v)).forEach(function(g){Object.defineProperty(E,g,Object.getOwnPropertyDescriptor(v,g))})}return E}function pr(E){return pr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},pr(E)}function vp(E,m){if(!(E instanceof m))throw new TypeError("Cannot call a class as a function")}function Ep(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}function dn(E,m,v){return m in E?Object.defineProperty(E,m,{value:v,enumerable:!0,configurable:!0,writable:!0}):E[m]=v,E}var yp=["env_key","view_id","view_sequence_number","player_sequence_number","beacon_domain","player_playhead_time","viewer_time","mux_api_version","event","video_id","player_instance_id"],_p=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse","adrequest"],Tp=["ad_id","ad_creative_id","ad_universal_id"],bp=["viewstart","error","ended","viewend"],Ap=function(){function E(g,b){var R,S,C,U,k,te,ce,Ie,de,ue,fe,et,Tt,ht,Ve,Di=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};vp(this,E),dn(this,"previousBeaconData",null),dn(this,"lastEventTime",0),dn(this,"rateLimited",!1),this.mux=g,this.envKey=b,this.options=Di,this.eventQueue=new pp(lp(this.envKey,this.options)),this.sampleRate=(R=this.options.sampleRate)!==null&&R!==void 0?R:1,this.disableCookies=(S=this.options.disableCookies)!==null&&S!==void 0&&S,this.respectDoNotTrack=(C=this.options.respectDoNotTrack)!==null&&C!==void 0&&C,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.pageLevelData={mux_api_version:this.mux.API_VERSION,mux_embed:this.mux.NAME,mux_embed_version:this.mux.VERSION,viewer_application_name:(U=this.options.platform)===null||U===void 0?void 0:U.name,viewer_application_version:(k=this.options.platform)===null||k===void 0?void 0:k.version,viewer_application_engine:(te=this.options.platform)===null||te===void 0?void 0:te.layout,viewer_device_name:(ce=this.options.platform)===null||ce===void 0?void 0:ce.product,viewer_device_category:"",viewer_device_manufacturer:(Ie=this.options.platform)===null||Ie===void 0?void 0:Ie.manufacturer,viewer_os_family:(de=this.options.platform)===null||de===void 0||(ue=de.os)===null||ue===void 0?void 0:ue.family,viewer_os_architecture:(fe=this.options.platform)===null||fe===void 0||(et=fe.os)===null||et===void 0?void 0:et.architecture,viewer_os_version:(Tt=this.options.platform)===null||Tt===void 0||(ht=Tt.os)===null||ht===void 0?void 0:ht.version,viewer_connection_type:cp(),page_url:d()===null||d()===void 0||(Ve=d().location)===null||Ve===void 0?void 0:Ve.href},this.viewerData=this.disableCookies?{}:op()}var m,v;return m=E,(v=[{key:"send",value:function(g,b){var R;if(g&&b!=null&&b.view_id){if(this.respectDoNotTrack&&I())return x.info("Not sending `"+g+"` because Do Not Track is enabled");if(!b||pr(b)!=="object")return x.error("A data object was expected in send() but was not provided");var S,C,U=this.disableCookies?{}:(S=Mc(),C=P.now(),S.session_start&&(S.sst=S.session_start,delete S.session_start),S.session_id&&(S.sid=S.session_id,delete S.session_id),S.session_expires&&(S.sex=S.session_expires,delete S.session_expires),(!S.sex||S.sex<C)&&(S.sid=u(),S.sst=C),S.sex=C+15e5,Pc(S),{session_id:S.sid,session_start:S.sst,session_expires:S.sex}),k=ks(ks(ks(ks(ks({},this.pageLevelData),b),U),this.viewerData),{},{event:g,env_key:this.envKey});
7k.user_id&&(k.viewer_user_id=k.user_id,delete k.user_id);var te=((R=k.mux_sample_number)!==null&&R!==void 0?R:0)>=this.sampleRate,ce=Qa(this._deduplicateBeaconData(g,k));if(this.lastEventTime=this.mux.utils.now(),te)return x.info("Not sending event due to sample rate restriction",g,k,ce);if(this.envKey||x.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",g,k,ce),!this.rateLimited){if(x.info("Sending event",g,k,ce),this.rateLimited=!this.eventQueue.queueEvent(g,ce),this.mux.WINDOW_UNLOADING&&g==="viewend")this.eventQueue.destroy(!0);else if(this.mux.WINDOW_HIDDEN&&g==="hb"?this.eventQueue.flushEvents(!0):bp.indexOf(g)>=0&&this.eventQueue.flushEvents(),this.rateLimited)return k.event="eventrateexceeded",ce=Qa(k),this.eventQueue.queueEvent(k.event,ce),x.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(g,b){var R=this,S={},C=b.view_id;if(C==="-1"||g==="viewstart"||g==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)S=ks({},b),C&&(this.previousBeaconData=S),C&&g==="viewend"&&(this.previousBeaconData=null);else{var U=g.indexOf("request")===0;Object.entries(b).forEach(function(k){var te=gp(k,2),ce=te[0],Ie=te[1];R.previousBeaconData&&(Ie!==R.previousBeaconData[ce]||yp.indexOf(ce)>-1||R.objectHasChanged(U,ce,Ie,R.previousBeaconData[ce])||R.eventRequiresKey(g,ce))&&(S[ce]=Ie,R.previousBeaconData[ce]=Ie)})}return S}},{key:"objectHasChanged",value:function(g,b,R,S){return!(!g||b.indexOf("request_")!==0||b!=="request_response_headers"&&pr(R)==="object"&&pr(S)==="object"&&Object.keys(R||{}).length===Object.keys(S||{}).length)}},{key:"eventRequiresKey",value:function(g,b){return g==="renditionchange"&&b.indexOf("video_source_")===0||!(!Tp.includes(b)||!_p.includes(g))}}])&&Ep(m.prototype,v),Object.defineProperty(m,"prototype",{writable:!1}),E}();function Hc(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}function Sp(E,m,v){return m&&Hc(E.prototype,m),v&&Hc(E,v),Object.defineProperty(E,"prototype",{writable:!1}),E}var xp=Sp(function E(m){(function(k,te){if(!(k instanceof te))throw new TypeError("Cannot call a class as a function")})(this,E);var v=0,g=0,b=0,R=0,S=0,C=0,U=0;m.on("requestcompleted",function(k,te){var ce,Ie,de=te.request_start,ue=te.request_response_start,fe=te.request_response_end,et=te.request_bytes_loaded;if(R++,ue?(ce=ue-(de??0),Ie=(fe??0)-ue):Ie=(fe??0)-(de??0),Ie>0&&et&&et>0){var Tt=et/Ie*8e3;S++,g+=et,b+=Ie,m.data.view_min_request_throughput=Math.min(m.data.view_min_request_throughput||1/0,Tt),m.data.view_average_request_throughput=g/b*8e3,m.data.view_request_count=R,ce>0&&(v+=ce,m.data.view_max_request_latency=Math.max(m.data.view_max_request_latency||0,ce),m.data.view_average_request_latency=v/S)}}),m.on("requestfailed",function(k,te){R++,C++,m.data.view_request_count=R,m.data.view_request_failed_count=C}),m.on("requestcanceled",function(k,te){R++,U++,m.data.view_request_count=R,m.data.view_request_canceled_count=U})});function Vc(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}function Ip(E,m,v){return m&&Vc(E.prototype,m),v&&Vc(E,v),Object.defineProperty(E,"prototype",{writable:!1}),E}var Lp=Ip(function E(m){var v=this;(function(g,b){if(!(g instanceof b))throw new TypeError("Cannot call a class as a function")})(this,E),m.on("before*",function(g,b){var R=b.viewer_time,S=P.now(),C=v._lastEventTime;if(v._lastEventTime=S,C&&S-C>36e5){var U=Object.keys(m.data).reduce(function(k,te){return te.indexOf("video_")===0?Object.assign(k,function(ce,Ie,de){return Ie in ce?Object.defineProperty(ce,Ie,{value:de,enumerable:!0,configurable:!0,writable:!0}):ce[Ie]=de,ce}({},te,m.data[te])):k},{});m.mux.log.info("Received event after at least an hour inactivity, creating a new view"),m.emit("viewinit",Object.assign({viewer_time:R},U)),m.playbackHeartbeat._playheadShouldBeProgressing&&g.type!=="play"&&g.type!=="adbreakstart"&&(m.emit("play",{viewer_time:R}),g.type!=="playing"&&m.emit("playing",{viewer_time:R}))}})});function Za(E){return Za=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},Za(E)}function wp(E,m){return function(v){if(Array.isArray(v))return v}(E)||function(v,g){var b=v==null?null:typeof Symbol<"u"&&v[Symbol.iterator]||v["@@iterator"];if(b!=null){var R,S,C=[],U=!0,k=!1;try{for(b=b.call(v);!(U=(R=b.next()).done)&&(C.push(R.value),!g||C.length!==g);U=!0);}catch(te){k=!0,S=te}finally{try{U||b.return==null||b.return()}finally{if(k)throw S}}return C}}(E,m)||function(v,g){if(v){if(typeof v=="string")return Wc(v,g);var b=Object.prototype.toString.call(v).slice(8,-1);return b==="Object"&&v.constructor&&(b=v.constructor.name),b==="Map"||b==="Set"?Array.from(v):b==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?Wc(v,g):void 0}}
7(E,m)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 8In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Wc(E,m){(m==null||m>E.length)&&(m=E.length);for(var v=0,g=new Array(m);v<m;v++)g[v]=E[v];return g}function Rp(E,m){for(var v=0;v<m.length;v++){var g=m[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(E,g.key,g)}}function Ja(E,m){return Ja=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(v,g){return v.__proto__=g,v},Ja(E,m)}function kp(E){var m=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var v,g=un(E);if(m){var b=un(this).constructor;v=Reflect.construct(g,arguments,b)}else v=g.apply(this,arguments);return Dp(this,v)}}function Dp(E,m){if(m&&(Za(m)==="object"||typeof m=="function"))return m;if(m!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ut(E)}function ut(E){if(E===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E}function un(E){return un=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(m){return m.__proto__||Object.getPrototypeOf(m)},un(E)}var Cp=["viewstart","ended","loadstart","pause","play","playing","ratechange","waiting","adplay","adpause","adended","aderror","adplaying","adrequest","adresponse","adbreakstart","adbreakend","adfirstquartile","admidpoint","adthirdquartile","rebufferstart","rebufferend","seeked","error","hb","requestcompleted","requestfailed","requestcanceled","renditionchange"],Mp=function(E){(function(R,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function");R.prototype=Object.create(S&&S.prototype,{constructor:{value:R,writable:!0,configurable:!0}}),Object.defineProperty(R,"prototype",{writable:!1}),S&&Ja(R,S)})(b,E);var m,v,g=kp(b);function b(R,S,C){var U,k;(function(ue,fe){if(!(ue instanceof fe))throw new TypeError("Cannot call a class as a function")})(this,b),(k=g.call(this)).DOM_CONTENT_LOADED_EVENT_END=O.domContentLoadedEventEnd(),k.NAVIGATION_START=O.navigationStart(),k.mux=R,k.id=S,(U=C)!==null&&U!==void 0&&U.beaconDomain&&k.mux.log.warn("The `beaconDomain` setting has been deprecated in favor of `beaconCollectionDomain`. Please change your integration to use `beaconCollectionDomain` instead of `beaconDomain`."),(C=Object.assign({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(ue){return ue}},C)).data=C.data||{},C.data.property_key&&(C.data.env_key=C.data.property_key,delete C.data.property_key),x.setLevel(C.debug?"debug":"warn"),k.getPlayheadTime=C.getPlayheadTime,k.getStateData=C.getStateData||function(){return{}},k.getAdData=C.getAdData||function(){},k.minimumRebufferDuration=C.minimumRebufferDuration,k.sustainedRebufferThreshold=C.sustainedRebufferThreshold,k.playbackHeartbeatTime=C.playbackHeartbeatTime,k.disableRebufferTracking=C.disableRebufferTracking,k.disableRebufferTracking&&k.mux.log.warn("Disabling rebuffer tracking. This should only be used in specific circumstances as a last resort when your player is known to unreliably track rebuffering."),k.disablePlayheadRebufferTracking=C.disablePlayheadRebufferTracking,k.errorTranslator=C.errorTranslator,k.playbackEventDispatcher=new Ap(R,C.data.env_key,C),k.data={player_instance_id:u(),mux_sample_rate:C.sampleRate,beacon_domain:C.beaconCollectionDomain||C.beaconDomain},k.data.view_sequence_number=1,k.data.player_sequence_number=1,k.oldEmit=k.emit,k.emit=function(ue,fe){fe=Object.assign({viewer_time:this.mux.utils.now()},fe),this.oldEmit(ue,fe)};var te=(function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit
8("viewstart"))}).bind(ut(k));k.on("viewinit",function(ue,fe){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,fe),this._initializeViewData(),this.one("play",te),this.one("adbreakstart",te)});var ce=(function(ue){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",ue)}).bind(ut(k));if(k.on("videochange",function(ue,fe){ce(fe)}),k.on("programchange",function(ue,fe){this.data.player_is_paused&&this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."),ce(Object.assign(fe,{view_program_changed:!0})),te(),this.emit("play"),this.emit("playing")}),k.on("fragmentchange",function(ue,fe){this.currentFragmentPDT=fe.currentFragmentPDT,this.currentFragmentStart=fe.currentFragmentStart}),k.on("destroy",k.destroy),typeof window<"u"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var Ie=function(){var ue=k.data.view_start!==void 0;k.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",ue&&k.mux.WINDOW_HIDDEN&&(k.data.player_is_paused||k.emit("hb"))};window.addEventListener("visibilitychange",Ie,!1);var de=function(ue){ue.persisted||k.destroy()};window.addEventListener("pagehide",de,!1),k.on("destroy",function(){window.removeEventListener("visibilitychange",Ie),window.removeEventListener("pagehide",de)})}return k.on("playerready",function(ue,fe){Object.assign(this.data,fe)}),Cp.forEach(function(ue){k.on(ue,function(fe,et){ue.indexOf("ad")!==0&&this._updateStateData(),Object.assign(this.data,et),this._sanitizeData()}),k.on("after"+ue,function(){(ue!=="error"||this.errorTracker.viewErrored)&&this.send(ue)})}),k.on("viewend",function(ue,fe){Object.assign(k.data,fe)}),k.one("playerready",function(ue){var fe=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=fe-this.data.player_init_time),!this.mux.PLAYER_TRACKED&&this.NAVIGATION_START&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.DOM_CONTENT_LOADED_EVENT_END)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.DOM_CONTENT_LOADED_EVENT_END||1/0)-this.NAVIGATION_START)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time}),k.longResumeTracker=new Lp(ut(k)),k.errorTracker=new Om(ut(k)),new np(ut(k)),k.seekingTracker=new Zm(ut(k)),k.playheadTime=new Gm(ut(k)),k.playbackHeartbeat=new Mm(ut(k)),new Xm(ut(k)),k.watchTimeTracker=new Fm(ut(k)),new Bm(ut(k)),k.adTracker=new tp(ut(k)),new qm(ut(k)),new Vm(ut(k)),new jm(ut(k)),new sp(ut(k)),new xp(ut(k)),C.hlsjs&&k.addHLSJS(C),C.dashjs&&k.addDashJS(C),k.emit("viewinit",C.data),k}return m=b,v=[{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,this.data.view_start!==void 0&&(this.emit("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),window.clearTimeout(this._heartBeatTimeout))}},{key:"send",value:function(R){if(this.data.view_id){var S=Object.assign({},this.data);if(S.video_source_is_live===void 0&&(S.player_source_duration===1/0||S.video_source_duration===1/0?S.video_source_is_live=!0:(S.player_source_duration>0||S.video_source_duration>0)&&(S.video_source_is_live=!1)),S.video_source_is_live||["player_program_time","player_manifest_newest_program_time","player_live_edge_program_time","player_program_time","video_holdback","video_part_holdback","video_target_duration","video_part_target_duration"].forEach(function(te){S[te]=void 0}),S.video_source_url=S.video_source_url||S.player_source_url,S.video_source_url){var C=wp(B(S.video_source_url),2),U=C[0],k=C[1];S.video_source_domain=k,S.video_source_hostname=U}delete S.ad_request_id,this.playbackEventDispatcher.send(R,S),this.data.view_sequence_number++,this.data.player_sequence_number++,this._restartHeartBeat(),R==="viewend"&&delete this.data.view_id}}},{key:"_updateStateData",value:function(){Object.assign(this.data,this.get
vendor: 9,025 bytes, lines 8-17
8StateData()),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var R=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(S){var C=parseInt(R.data[S],10);R.data[S]=isNaN(C)?void 0:C}),["player_source_url","video_source_url"].forEach(function(S){if(R.data[S]){var C=R.data[S].toLowerCase();C.indexOf("data:")!==0&&C.indexOf("blob:")!==0||(R.data[S]="MSE style URL")}})}},{key:"_resetVideoData",value:function(R,S){var C=this;Object.keys(this.data).forEach(function(U){U.indexOf("video_")===0&&delete C.data[U]})}},{key:"_resetViewData",value:function(){var R=this;Object.keys(this.data).forEach(function(S){S.indexOf("view_")===0&&delete R.data[S]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(R,S){delete this.data.player_error_code,delete this.data.player_error_message}},{key:"_initializeViewData",value:function(){var R=this,S=this.data.view_id=u(),C=function(){S===R.data.view_id&&F(R.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",C):C()}},{key:"_restartHeartBeat",value:function(){var R=this;window.clearTimeout(this._heartBeatTimeout),this.errorTracker.viewErrored||(this._heartBeatTimeout=window.setTimeout(function(){R.data.player_is_paused||R.emit("hb")},1e4))}},{key:"addHLSJS",value:function(R){R.hlsjs?this.hlsjs?this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=R.hlsjs,function(S,C,U){var k=arguments.length>4?arguments[4]:void 0,te=S.log,ce=S.utils.secondsToMs,Ie=function(tt){var ae,Z=parseInt(k.version);return Z===1&&tt.programDateTime!==null&&(ae=tt.programDateTime),Z===0&&tt.pdt!==null&&(ae=tt.pdt),ae};if(O.exists()){var de=function(tt,ae){return S.emit(C,tt,ae)},ue=function(tt,ae){var Z=ae.levels,X=ae.audioTracks,Ee=ae.url,_e=ae.stats,Se=ae.networkDetails,Fe=ae.sessionData,it={},Xe={};Z.forEach(function(Wt,is){it[is]={width:Wt.width,height:Wt.height,bitrate:Wt.bitrate,attrs:Wt.attrs}}),X.forEach(function(Wt,is){Xe[is]={name:Wt.name,language:Wt.lang,bitrate:Wt.bitrate}});var ke=Pe(_e),ft=ke.bytesLoaded,$i=ke.requestStart,Er=ke.responseStart,yr=ke.responseEnd;de("requestcompleted",pe(pe({},ve(Fe)),{},{request_event_type:tt,request_bytes_loaded:ft,request_start:$i,request_response_start:Er,request_response_end:yr,request_type:"manifest",request_hostname:L(Ee),request_response_headers:J(Se),request_rendition_lists:{media:it,audio:Xe,video:{}}}))};U.on(k.Events.MANIFEST_LOADED,ue);var fe=function(tt,ae){var Z=ae.details,X=ae.level,Ee=ae.networkDetails,_e=ae.stats,Se=Pe(_e),Fe=Se.bytesLoaded,it=Se.requestStart,Xe=Se.responseStart,ke=Se.responseEnd,ft=Z.fragments[Z.fragments.length-1],$i=Ie(ft)+ce(ft.duration);de("requestcompleted",{request_event_type:tt,request_bytes_loaded:Fe,request_start:it,request_response_start:Xe,request_response_end:ke,request_current_level:X,request_type:"manifest",request_hostname:L(Z.url),request_response_headers:J(Ee),video_holdback:Z.holdBack&&ce(Z.holdBack),video_part_holdback:Z.partHoldBack&&ce(Z.partHoldBack),video_part_target_duration:Z.partTarget&&ce(Z.partTarget),video_target_duration:Z.targetduration&&ce(Z.targetduration),video_source_is_live:Z.live,player_manifest_newest_program_time:isNaN($i)?void 0:$i})};U.on(k.Events.LEVEL_LOADED,fe);var et=function(tt,ae){var Z=ae.details,X=ae.networkDetails,Ee=ae.stats,_e=Pe(Ee),Se=_e.bytesLoaded,Fe=_e.requestStart,it=_e.responseStart,Xe=_e.responseEnd;de("requestcompleted",{request_event_type:tt,request_bytes_loaded:Se,request_start:Fe,request_response_start:it,request_response_end:Xe,request_type:"manifest",request_hostname:L(Z.url),request_response_headers:J(X)})};U.on(k.Events.AUDIO_TRACK_LOADED,et);var Tt=function(tt,ae){var Z=ae.stats,X=ae.networkDetails,Ee=ae.frag;Z=Z||Ee.stats;var _e=Pe(Z),Se=_e.bytesLoaded,Fe=_e.requestStart,it=_e.responseStart,Xe=_e.responseEnd,ke=X?J(X):void 0,ft={request_event_type:tt,request_bytes_loaded:Se,request_start:Fe,request_response_start:it,request_response_end:Xe,request_hostname:X?L(X.responseURL):void 0,request_id:ke?z(ke):void 0,request_response_headers:ke,request_media_duration:Ee.duration,request_url:X==null?void 0:X.responseURL};Ee.type==="main"?(ft.request_type="media",ft.request_current_level=Ee.level,ft.request_video_width=(U.levels[Ee.level]||{}).width,ft.request_video_height=(U.levels[Ee.level]||{}).height,ft.request_labeled_bitrate=(U.levels[Ee.level]||{}).bitrate):ft.request_type=Ee.type,de("requestcompleted",ft)};U.on(k.Events.FRAG_LOADED,Tt);var ht=function(tt,ae){var Z=ae.frag,X=Z.start,Ee={currentFragmentPDT:Ie(Z),currentFragmentStart:ce(X)};de("fragmentchange",Ee)};U.on(k.Events.FRAG_CHANGED,ht);var Ve=function(tt,ae){var Z=ae.type,X=ae.details,Ee=ae.response,_e=ae.fatal,Se=ae.frag,Fe=ae.networkDetails,it=(Se==null?void 0:Se.url)||ae.url||"",Xe=Fe?J(Fe):void 0;if(X!==k.ErrorDetails.MANIFEST_LOAD_ERROR&&X!==k.ErrorDetails.MANIFEST_LOAD_TIMEOUT&&X!==k.ErrorDetails.FRAG_LOAD_ERROR&&X!==k.ErrorDetails.FRAG_LOAD_TIMEOUT&&X!==k.ErrorDetails.LEVEL_LOAD_ERROR&&X!==k.ErrorDetails.LEVEL_LOAD_TIMEOUT&&X!==k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR&&X!==k.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT&&X!==k.ErrorDetails.SUBTITLE_LOAD_ERROR&&X!==k.ErrorDetails.SUBTITLE_LOAD_TIMEOUT&&X!==k.ErrorDetails.KEY_LOAD_ERROR&&X!==k.ErrorDetails.KEY_LOAD_TIMEOUT||de("requestfailed",{request_error:X,request_url:it,request_hostname:L(it),request_id:Xe?z(Xe):void 0,request_type:X===k.ErrorDetails.FRAG_LOAD_ERROR||X===k.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":X===k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||X===k.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":X===k.ErrorDetails.SUBTITLE_LOAD_ERROR||X===k.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":X===k.ErrorDetails.KEY_LOAD_ERROR||X===k.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:Ee==null?void 0:Ee.code,request_error_text:Ee==null?void 0:Ee.text}),_e){var ke,ft="".concat(it?"url: ".concat(it,` 9`):"")+"".concat(Ee&&(Ee.code||Ee.text)?"response: ".concat(Ee.code,", ").concat(Ee.text,` 10`):"")+"".concat(ae.reason?"failure reason: ".concat(ae.reason,` 11`):"")+"".concat(ae.level?"level: ".concat(ae.level,` 12`):"")+"".concat(ae.parent?"parent stream controller: ".concat(ae.parent,` 13`):"")+"".concat(ae.buffer?"buffer length: ".concat(ae.buffer,` 14`):"")+"".concat(ae.error?"error: ".concat(ae.error,` 15`):"")+"".concat(ae.event?"event: ".concat(ae.event,` 16`):"")+"".concat(ae.err?"error message: ".concat((ke=ae.err)===null||ke===void 0?void 0:ke.message,` 17`):"");de("error",{player_error_code:Z,player_error_message:X,player_error_context:ft})}};U.on(k.Events.ERROR,Ve);var Di=function(tt,ae){var Z=ae.frag,X=Z&&Z._url||"";de("requestcanceled",{request_event_type:tt,request_url:X,request_type:"media",request_hostname:L(X)})};U.on(k.Events.FRAG_LOAD_EMERGENCY_ABORTED,Di);var ts=function(tt,ae){var Z=ae.level,X=U.levels[Z];if(X&&X.attrs&&X.attrs.BANDWIDTH){var Ee,_e=X.attrs.BANDWIDTH,Se=parseFloat(X.attrs["FRAME-RATE"]);isNaN(Se)||(Ee=Se),_e?de("renditionchange",{video_source_fps:Ee,video_source_bitrate:_e,video_source_width:X.width,video_source_height:X.height,video_source_rendition_name:X.name,video_source_codec:X==null?void 0:X.videoCodec}):te.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};U.on(k.Events.LEVEL_SWITCHED,ts),U._stopMuxMonitor=function(){U.off(k.Events.MANIFEST_LOADED,ue),U.off(k.Events.LEVEL_LOADED,fe),U.off(k.Events.AUDIO_TRACK_LOADED,et),U.off(k.Events.FRAG_LOADED,Tt),U.off(k.Events.FRAG_CHANGED,ht),U.off(k.Events.ERROR,Ve),U.off(k.Events.FRAG_LOAD_EMERGENCY_ABORTED,Di),U.off(k.Events.LEVEL_SWITCHED,ts),U.off(k.Events.DESTROYING,U._stopMuxMonitor),delete U._stopMuxMonitor},U.on(k.Events.DESTROYING,U._stopMuxMonitor)}else te.warn("performance timing not supported. Not tracking HLS.js.")}(this.mux,this.id,R.hlsjs,{},R.Hls||window.Hls)):this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")}},{key:"removeHLSJS",value:function(){var R;this.hlsjs&&((R=this.hlsjs)&&typeof R._stopMuxMonitor=="function"&&R._stopMuxMonitor(),this.hlsjs=void 0)}},{key:"addDashJS",value:function(R){R.dashjs?this.dashjs?this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):(this.dashjs=R.dashjs,function(S,C,U){var k=S.log;if(U&&U.on){var te=$t(U),ce=function(Z,X){return S.emit(C,Z,X)},Ie=function(Z){var X=Z.type,Ee=(Z.data||{}).url;ce("requestcompleted",{request_event_type:X,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:L(Ee),request_url:Ee})};U.on("manifestLoaded",Ie);var de={},ue=function(Z){if(typeof Z.getRequests!="function")return null;var X=Z.getRequests({state:"executed"});return X.length===0?null:X[X.length-1]},fe=function(Z){var X=Z.type,Ee=Z.fragmentModel,_e=Z.chunk,Se=ue(Ee);et({type:X,request:Se,chunk:_e})},et=function(Z){var X=Z.type,Ee=Z.chunk,_e=Z.request,Se=(Ee||{}).mediaInfo||{},Fe=Se.type,it=Se.bitrateList,Xe={};
17(it=it||[]).forEach(function(_r,hi){Xe[hi]={},Xe[hi].width=_r.width,Xe[hi].height=_r.height,Xe[hi].bitrate=_r.bandwidth,Xe[hi].attrs={}}),Fe==="video"?de.video=Xe:Fe==="audio"?de.audio=Xe:de.media=Xe;var ke=Ae(_e,U),ft=ke.requestStart,$i=ke.requestResponseStart,Er=ke.requestResponseEnd,yr=ke.requestResponseHeaders,Wt=ke.requestMediaDuration,is=ke.requestHostname,so=ke.requestUrl,ro=ke.requestId;ce("requestcompleted",{request_event_type:X,request_start:ft,request_response_start:$i,request_response_end:Er,request_bytes_loaded:-1,request_type:Fe+"_init",request_response_headers:yr,request_hostname:is,request_id:ro,request_url:so,request_media_duration:Wt,request_rendition_lists:de})};te>=4?U.on("initFragmentLoaded",et):U.on("initFragmentLoaded",fe);var Tt=function(Z){var X=Z.type,Ee=Z.fragmentModel,_e=Z.chunk,Se=ue(Ee);ht({type:X,request:Se,chunk:_e})},ht=function(Z){var X=Z.type,Ee=Z.chunk,_e=Z.request,Se=Ee||{},Fe=Se.mediaInfo,it=Se.start,Xe=(Fe||{}).type,ke=Ae(_e,U),ft=ke.requestStart,$i=ke.requestResponseStart,Er=ke.requestResponseEnd,yr=ke.requestBytesLoaded,Wt=ke.requestResponseHeaders,is=ke.requestMediaDuration,so=ke.requestHostname,ro=ke.requestUrl,_r=ke.requestId,hi=He(Xe,U),ig=hi.currentLevel,sg=hi.renditionWidth,rg=hi.renditionHeight,ng=hi.renditionBitrate;ce("requestcompleted",{request_event_type:X,request_start:ft,request_response_start:$i,request_response_end:Er,request_bytes_loaded:yr,request_type:Xe,request_response_headers:Wt,request_hostname:so,request_id:_r,request_url:ro,request_media_start_time:it,request_media_duration:is,request_current_level:ig,request_labeled_bitrate:ng,request_video_width:sg,request_video_height:rg})};te>=4?U.on("mediaFragmentLoaded",ht):U.on("mediaFragmentLoaded",Tt);var Ve={video:void 0,audio:void 0,totalBitrate:void 0},Di=function(){if(Ve.video&&typeof Ve.video.bitrate=="number"){if(Ve.video.width&&Ve.video.height){var Z=Ve.video.bitrate;return Ve.audio&&typeof Ve.audio.bitrate=="number"&&(Z+=Ve.audio.bitrate),Z!==Ve.totalBitrate?(Ve.totalBitrate=Z,{video_source_bitrate:Z,video_source_height:Ve.video.height,video_source_width:Ve.video.width,video_source_codec:xt(Ve.video.codec)}):void 0}k.warn("have bitrate info for video but missing width/height")}},ts=function(Z,X,Ee){if(typeof Z.newQuality=="number"){var _e=Z.mediaType;if(_e==="audio"||_e==="video"){var Se=U.getBitrateInfoListFor(_e).find(function(it){return it.qualityIndex===Z.newQuality});if(Se&&typeof Se.bitrate=="number"){Ve[_e]=Re(Re({},Se),{},{codec:U.getCurrentTrackFor(_e).codec});var Fe=Di();Fe&&ce("renditionchange",Fe)}else k.warn("missing bitrate info for ".concat(_e))}}else k.warn("missing evt.newQuality in qualityChangeRendered event",Z)};U.on("qualityChangeRendered",ts);var tt=function(Z){var X=Z.request,Ee=Z.mediaType;ce("requestcanceled",{request_event_type:(X=X||{}).type+"_"+X.action,request_url:X.url,request_type:Ee,request_hostname:L(X.url)})};U.on("fragmentLoadingAbandoned",tt);var ae=function(Z){var X,Ee,_e=Z.error,Se=(_e==null||(X=_e.data)===null||X===void 0?void 0:X.request)||{},Fe=(_e==null||(Ee=_e.data)===null||Ee===void 0?void 0:Ee.response)||{};(_e==null?void 0:_e.code)===27&&ce("requestfailed",{request_error:Se.type+"_"+Se.action,request_url:Se.url,request_hostname:L(Se.url),request_type:Se.mediaType,request_error_code:Fe.status,request_error_text:Fe.statusText});var it="".concat(Se!=null&&Se.url?"url: ".concat(Se.url,` 18`):"")+"".concat(Fe!=null&&Fe.status||Fe!=null&&Fe.statusText?"response: ".concat(Fe==null?void 0:Fe.status,", ").concat(Fe==null?void 0:Fe.statusText,` 19`):"");ce("error",{player_error_code:_e==null?void 0:_e.code,player_error_message:_e==null?void 0:_e.message,player_error_context:it})};U.on("error",ae),U._stopMuxMonitor=function(){U.off("manifestLoaded",Ie),U.off("initFragmentLoaded",et),U.off("mediaFragmentLoaded",ht),U.off("qualityChangeRendered",ts),U.off("error",ae),U.off("fragmentLoadingAbandoned",tt),delete U._stopMuxMonitor}}else k.warn("Invalid dash.js player reference. Monitoring blocked.")}(this.mux,this.id,R.dashjs)):this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")}},{key:"removeDashJS",value:function(){var R;this.dashjs&&((R=this.dashjs)&&typeof R._stopMuxMonitor=="function"&&R._stopMuxMonitor(),this.dashjs=void 0)}}],v&&Rp(m.prototype,v),Object.defineProperty(m,"prototype",{writable:!1}),b}(Dm),Pp=Mp,Op=l(153),gr=l.n(Op);function eo(E){return eo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},eo(E)}function Kc(E,m){return function(v){if(Array.isArray(v))return v}(E)||function(v,g){var b=v==null?null:typeof Symbol<"u"&&v[Symbol.iterator]||v["@@iterator"];if(b!=null){var R,S,C=[],U=!0,k=!1;try{for(b=b.call(v);!(U=(R=b.next()).done)&&(C.push(R.value),!g||C.length!==g);U=!0);}catch(te){k=!0,S=te}finally{try{U||b.return==null||b.return()}finally{if(k)throw S}}return C}}(E,m)||function(v,g){if(v){if(typeof v=="string")return qc(v,g);var b=Object.prototype.toString.call(v).slice(8,-1);return b==="Object"&&v.constructor&&(b=v.constructor.name),b==="Map"||b==="Set"?Array.from(v):b==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?qc(v,g):void 0}}
19(E,m)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 20In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function qc(E,m){(m==null||m>E.length)&&(m=E.length);for(var v=0,g=new Array(m);v<m;v++)g[v]=E[v];return g}var Ds,Np=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],Fp={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};d()&&d().WeakMap&&(Ds=new WeakMap);var Up="#EXT-X-TARGETDURATION",Bp="#EXT-X-PART-INF",$p="#EXT-X-SERVER-CONTROL",Gp="#EXTINF",Hp="#EXT-X-PROGRAM-DATE-TIME",Vp="#EXT-X-VERSION",Wp="#EXT-X-SESSION-DATA",hn=function(E){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(E),this.manifest};hn.prototype.process=function(E){var m;for(this.buffer+=E,m=this.buffer.indexOf(` 21`);m>-1;m=this.buffer.indexOf(` 22`))this.processLine(this.buffer.substring(0,m)),this.buffer=this.buffer.substring(m+1)}
vendor: 4,260 bytes, line 22
22,hn.prototype.processLine=function(E){var m=E.indexOf(":"),v=jp(E,m),g=v[0],b=v.length===2?io(v[1]):void 0;if(g[0]!=="#")this.currentUri.uri=g,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(g){case Up:if(!isFinite(b)||b<0)return;this.manifest.targetDuration=b,this.setHoldBack();break;case Bp:to(this.manifest,v),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case $p:to(this.manifest,v),this.setHoldBack();break;case Gp:b===0?this.currentUri.duration=.01:b>0&&(this.currentUri.duration=b);break;case Hp:var R=b,S=new Date(R);this.manifest.dateTimeString||(this.manifest.dateTimeString=R,this.manifest.dateTimeObject=S),this.currentUri.dateTimeString=R,this.currentUri.dateTimeObject=S;break;case Vp:to(this.manifest,v);break;case Wp:var C=zp(v[1]),U=ve(C);Object.assign(this.manifest.sessionData,U)}},hn.prototype.setHoldBack=function(){var E=this.manifest,m=E.serverControl,v=E.targetDuration,g=E.partTargetDuration;if(m){var b="holdBack",R="partHoldBack",S=v&&3*v,C=g&&2*g;v&&!m.hasOwnProperty(b)&&(m[b]=S),S&&m[b]<S&&(m[b]=S),g&&!m.hasOwnProperty(R)&&(m[R]=3*g),g&&m[R]<C&&(m[R]=C)}};var to=function(E,m){var v,g=Yc(m[0].replace("#EXT-X-",""));Yp(m[1])?(v={},v=Object.assign(qp(m[1]),v)):v=io(m[1]),E[g]=v},Yc=function(E){return E.toLowerCase().replace(/-(\w)/g,function(m){return m[1].toUpperCase()})},io=function(E){if(E.toLowerCase()==="yes"||E.toLowerCase()==="no")return E.toLowerCase()==="yes";var m=E.indexOf(":")!==-1?E:parseFloat(E);return isNaN(m)?E:m},Kp=function(E){var m={},v=E.split("=");return v.length>1&&(m[Yc(v[0])]=io(v[1])),m},qp=function(E){for(var m=E.split(","),v={},g=0;m.length>g;g++){var b=m[g],R=Kp(b);v=Object.assign(R,v)}return v},Yp=function(E){return E.indexOf("=")>-1},jp=function(E,m){return m===-1?[E]:[E.substring(0,m),E.substring(m+1)]},zp=function(E){var m={};if(E){var v=E.search(",");return[E.slice(0,v),E.slice(v+1)].forEach(function(g,b){for(var R=g.replace(/['"]+/g,"").split("="),S=0;S<R.length;S++)R[S]==="DATA-ID"&&(m["DATA-ID"]=R[1-S]),R[S]==="VALUE"&&(m.VALUE=R[1-S])}),{data:m}}},Xp=hn,Qp={safeCall:function(E,m,v,g){var b=g;if(E&&typeof E[m]=="function")try{b=E[m].apply(E,v)}catch(R){x.info("safeCall error",R)}return b},safeIncrement:F,getComputedStyle:function(E,m){var v;if(E&&m&&d()&&typeof d().getComputedStyle=="function")return Ds&&Ds.has(E)&&(v=Ds.get(E)),v||(v=d().getComputedStyle(E,null),Ds&&Ds.set(E,v)),v.getPropertyValue(m)},secondsToMs:function(E){return Math.floor(1e3*E)},assign:Object.assign,headersStringToObject:j,cdnHeadersToRequestId:z,extractHostnameAndDomain:B,extractHostname:L,manifestParser:Xp,generateShortID:h,generateUUID:u,now:P.now},Zp={PLAYER_READY:"playerready",VIEW_INIT:"viewinit",VIDEO_CHANGE:"videochange",PLAY:"play",PAUSE:"pause",PLAYING:"playing",TIME_UPDATE:"timeupdate",SEEKING:"seeking",SEEKED:"seeked",REBUFFER_START:"rebufferstart",REBUFFER_END:"rebufferend",ERROR:"error",ENDED:"ended",RENDITION_CHANGE:"renditionchange",ORIENTATION_CHANGE:"orientationchange",AD_REQUEST:"adrequest",AD_RESPONSE:"adresponse",AD_BREAK_START:"adbreakstart",AD_PLAY:"adplay",AD_PLAYING:"adplaying",AD_PAUSE:"adpause",AD_FIRST_QUARTILE:"adfirstquartile",AD_MID_POINT:"admidpoint",AD_THIRD_QUARTILE:"adthirdquartile",AD_ENDED:"adended",AD_BREAK_END:"adbreakend",AD_ERROR:"aderror",REQUEST_COMPLETED:"requestcompleted",REQUEST_FAILED:"requestfailed",REQUEST_CANCELLED:"requestcanceled"};function Jp(E,m){return function(v){if(Array.isArray(v))return v}(E)||function(v,g){var b=v==null?null:typeof Symbol<"u"&&v[Symbol.iterator]||v["@@iterator"];if(b!=null){var R,S,C=[],U=!0,k=!1;try{for(b=b.call(v);!(U=(R=b.next()).done)&&(C.push(R.value),!g||C.length!==g);U=!0);}catch(te){k=!0,S=te}finally{try{U||b.return==null||b.return()}finally{if(k)throw S}}return C}}(E,m)||function(v,g){if(v){if(typeof v=="string")return jc(v,g);var b=Object.prototype.toString.call(v).slice(8,-1);return b==="Object"&&v.constructor&&(b=v.constructor.name),b==="Map"||b==="Set"?Array.from(v):b==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?jc(v,g):void 0}}
22(E,m)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 23In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function jc(E,m){(m==null||m>E.length)&&(m=E.length);for(var v=0,g=new Array(m);v<m;v++)g[v]=E[v];return g}var Vt={},vr=function E(m){var v=arguments;typeof m=="string"?E.hasOwnProperty(m)?d().setTimeout(function(){v=Array.prototype.splice.call(v,1),E[m].apply(null,v)},0):x.warn("`"+m+"` is an unknown task"):typeof m=="function"?d().setTimeout(function(){m(E)},0):x.warn("`"+m+"` is invalid.")},eg={loaded:P.now(),NAME:"mux-embed",VERSION:"4.30.0",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(E,m){return function(v,g,b){var R=Kc(p(g),3),S=R[0],C=R[1],U=R[2],k=v.log,te=v.utils.getComputedStyle,ce=v.utils.secondsToMs;if(!S)return k.error("No element was found with the `"+C+"` query selector.");if(U!=="video"&&U!=="audio")return k.error("The element of `"+C+"` was not a media element.");S.mux&&(S.mux.destroy(),delete S.mux,k.warn("Already monitoring this video element, replacing existing event listeners")),(b=Object.assign({automaticErrorTracking:!0},b)).data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:v.VERSION},b.data),b.getPlayheadTime=function(){return ce(S.currentTime)},b.getStateData=function(){var de,ue,fe=this.hlsjs&&this.hlsjs.url,et=this.dashjs&&eo(this.dashjs.getSource==="function")&&this.dashjs.getSource(),Tt={player_is_paused:S.paused,player_playhead_time:ce(S.currentTime),player_width:parseInt(te(S,"width")),player_height:parseInt(te(S,"height")),player_autoplay_on:S.autoplay,player_preload_on:S.preload,player_language_code:S.lang,player_is_fullscreen:gr()&&!!(gr().fullscreenElement||gr().webkitFullscreenElement||gr().mozFullScreenElement||gr().msFullscreenElement),video_poster_url:S.poster,video_source_url:fe||et||S.currentSrc,video_source_duration:ce(S.duration),video_source_height:S.videoHeight,video_source_width:S.videoWidth,view_dropped_frame_count:(de=S)===null||de===void 0||(ue=de.getVideoPlaybackQuality)===null||ue===void 0?void 0:ue.call(de).droppedVideoFrames},ht=b.getPlayheadTime();if(S.getStartDate&&ht>0){var Ve=S.getStartDate();if(Ve&&typeof Ve.getTime=="function"&&Ve.getTime()){var Di=Ve.getTime();if(Tt.player_program_time=Di+ht,S.seekable.length>0){var ts=Di+S.seekable.end(S.seekable.length-1);Tt.player_live_edge_program_time=ts}}}return Tt},S.mux=S.mux||{},S.mux.deleted=!1,S.mux.emit=function(de,ue){v.emit(C,de,ue)};var Ie=function(){k.error("The monitor for this video element has already been destroyed.")};S.mux.destroy=function(){Object.keys(S.mux.listeners).forEach(function(de){S.removeEventListener(de,S.mux.listeners[de],!1)}),delete S.mux.listeners,S.mux.destroy=Ie,S.mux.swapElement=Ie,S.mux.emit=Ie,S.mux.addHLSJS=Ie,S.mux.addDashJS=Ie,S.mux.removeHLSJS=Ie,S.mux.removeDashJS=Ie,S.mux.deleted=!0,v.emit(C,"destroy")},S.mux.swapElement=function(de){var ue=Kc(p(de),3),fe=ue[0],et=ue[1],Tt=ue[2];return fe?Tt!=="video"&&Tt!=="audio"?v.log.error("The element of `"+et+"` was not a media element."):(fe.muxId=S.muxId,delete S.muxId,fe.mux=fe.mux||{},fe.mux.listeners=Object.assign({},S.mux.listeners),delete S.mux.listeners,Object.keys(fe.mux.listeners).forEach(function(ht){S.removeEventListener(ht,fe.mux.listeners[ht],!1),fe.addEventListener(ht,fe.mux.listeners[ht],!1)}),fe.mux.swapElement=S.mux.swapElement,fe.mux.destroy=S.mux.destroy,delete S.mux,void(S=fe)):v.log.error("No element was found with the `"+et+"` query selector.")},S.mux.addHLSJS=function(de){v.addHLSJS(C,de)},S.mux.addDashJS=function(de){v.addDashJS(C,de)},S.mux.removeHLSJS=function(){v.removeHLSJS(C)},S.mux.removeDashJS=function(){v.removeDashJS(C)},v.init(C,b),v.emit(C,"playerready"),S.paused||(v.emit(C,"play"),S.readyState>2&&v.emit(C,"playing")),S.mux.listeners={}
23,Np.forEach(function(de){(de!=="error"||b.automaticErrorTracking)&&(S.mux.listeners[de]=function(){var ue={};if(de==="error"){if(!S.error||S.error.code===1)return;ue.player_error_code=S.error.code,ue.player_error_message=Fp[S.error.code]||S.error.message}v.emit(C,de,ue)},S.addEventListener(de,S.mux.listeners[de],!1))})}(vr,E,m)},destroyMonitor:function(E){var m=Jp(p(E),1)[0];m&&m.mux&&typeof m.mux.destroy=="function"?m.mux.destroy():x.error("A video element monitor for `"+E+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(E,m){var v=f(E);Vt[v]?Vt[v].addHLSJS(m):x.error("A monitor for `"+v+"` has not been initialized.")},addDashJS:function(E,m){var v=f(E);Vt[v]?Vt[v].addDashJS(m):x.error("A monitor for `"+v+"` has not been initialized.")},removeHLSJS:function(E){var m=f(E);Vt[m]?Vt[m].removeHLSJS():x.error("A monitor for `"+m+"` has not been initialized.")},removeDashJS:function(E){var m=f(E);Vt[m]?Vt[m].removeDashJS():x.error("A monitor for `"+m+"` has not been initialized.")},init:function(E,m){I()&&m&&m.respectDoNotTrack&&x.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var v=f(E);Vt[v]=new Pp(vr,v,m)},emit:function(E,m,v){var g=f(E);Vt[g]?(Vt[g].emit(m,v),m==="destroy"&&delete Vt[g]):x.error("A monitor for `"+g+"` has not been initialized.")},checkDoNotTrack:I,log:x,utils:Qp,events:Zp,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(vr,eg),d()!==void 0&&typeof d().addEventListener=="function"&&d().addEventListener("pagehide",function(E){E.persisted||(vr.WINDOW_UNLOADING=!0)},!1);var tg=vr},655:function(a,o,l){var c,d;function u(h){return u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(f){return typeof f}:function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f},u(h);/*! 24 * JavaScript Cookie v2.1.3 25 * https://github.com/js-cookie/js-cookie 26 * 27 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack 28 * Released under the MIT license 29 */}(function(h){var f=!1;if((d=typeof(c=h)=="function"?c.call(o,l,o,a):c)===void 0||(a.exports=d),f=!0,u(o)==="object"&&(a.exports=h(),f=!0),!f){var p=window.Cookies,y=window.Cookies=h();y.noConflict=function(){return window.Cookies=p,y}}})(function(){var h=function(){for(var f=0,p={};f<arguments.length;f++){var y=arguments[f];for(var _ in y)p[_]=y[_]}return p};return function f(p){function y(_,A,x){var I;if(typeof document<"u"){if(arguments.length>1){if(typeof(x=h({path:"/"},y.defaults,x)).expires=="number"){var P=new Date;P.setMilliseconds(P.getMilliseconds()+864e5*x.expires),x.expires=P}try{I=JSON.stringify(A),/^[\{\[]/.test(I)&&(A=I)}catch{}return A=p.write?p.write(A,_):encodeURIComponent(String(A)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),_=(_=(_=encodeURIComponent(String(_))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[_,"=",A,x.expires?"; expires="+x.expires.toUTCString():"",x.path?"; path="+x.path:"",x.domain?"; domain="+x.domain:"",x.secure?"; secure":""].join("")}_||(I={});for(var L=document.cookie?document.cookie.split("; "):[],B=/(%[0-9A-Z]{2})+/g,O=0;O<L.length;O++){var F=L[O].split("="),V=F.slice(1).join("=");V.charAt(0)==='"'&&(V=V.slice(1,-1));try{var $=F[0].replace(B,decodeURIComponent);if(V=p.read?p.read(V,$):p(V,$)||V.replace(B,decodeURIComponent),this.json)try{V=JSON.parse(V)}catch{}if(_===$){I=V;break}_||(I[$]=V)}catch{}}return I}}return y.set=y,y.get=function(_){return y.call(y,_)},y.getJSON=function(){return y.apply({json:!0},[].slice.call(arguments))},y.defaults={},y.remove=function(_,A){y(_,"",h(A,{expires:-1}))},y.withConverter=f,y}(function(){})})},153:function(a,o,l){var c,d=l.g!==void 0?l.g:typeof window<"u"?window:{},u=l(558);typeof document<"u"?c=document:(c=d["__GLOBAL_DOCUMENT_CACHE@4"])||(c=d["__GLOBAL_DOCUMENT_CACHE@4"]=u),a.exports=c},48:function(a,o,l){var c;c=typeof window<"u"?window:l.g!==void 0?l.g:typeof self<"u"?self:{},a.exports=c},640:function(a,o,l){var c,d;(function(u,h){c=function(){var f=function(){},p="undefined",y=typeof window!==p&&typeof window.navigator!==p&&/Trident\/|MSIE /.test(window.navigator.userAgent),_=["trace","debug","info","warn","error"];function A(j,z){var ve=j[z];if(typeof ve.bind=="function")return ve.bind(j);try{return Function.prototype.bind.call(ve,j)}catch{return function(){return Function.prototype.apply.apply(ve,[j,arguments])}}}function x(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function I(j){return j==="debug"&&(j="log"),typeof console!==p&&(j==="trace"&&y?x:console[j]!==void 0?A
29(console,j):console.log!==void 0?A(console,"log"):f)}function P(j,z){for(var ve=0;ve<_.length;ve++){var qe=_[ve];this[qe]=ve<j?f:this.methodFactory(qe,j,z)}this.log=this.debug}function L(j,z,ve){return function(){typeof console!==p&&(P.call(this,z,ve),this[j].apply(this,arguments))}}function B(j,z,ve){return I(j)||L.apply(this,arguments)}function O(j,z,ve){var qe,pe=this;z=z??"WARN";var Le="loglevel";function Pe(se){var Ae=(_[se]||"silent").toUpperCase();if(typeof window!==p&&Le){try{return void(window.localStorage[Le]=Ae)}catch{}try{window.document.cookie=encodeURIComponent(Le)+"="+Ae+";"}catch{}}}function J(){var se;if(typeof window!==p&&Le){try{se=window.localStorage[Le]}catch{}if(typeof se===p)try{var Ae=window.document.cookie,He=Ae.indexOf(encodeURIComponent(Le)+"=");He!==-1&&(se=/^([^;]+)/.exec(Ae.slice(He))[1])}catch{}return pe.levels[se]===void 0&&(se=void 0),se}}function ne(){if(typeof window!==p&&Le){try{return void window.localStorage.removeItem(Le)}catch{}try{window.document.cookie=encodeURIComponent(Le)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}typeof j=="string"?Le+=":"+j:typeof j=="symbol"&&(Le=void 0),pe.name=j,pe.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},pe.methodFactory=ve||B,pe.getLevel=function(){return qe},pe.setLevel=function(se,Ae){if(typeof se=="string"&&pe.levels[se.toUpperCase()]!==void 0&&(se=pe.levels[se.toUpperCase()]),!(typeof se=="number"&&se>=0&&se<=pe.levels.SILENT))throw"log.setLevel() called with invalid level: "+se;if(qe=se,Ae!==!1&&Pe(se),P.call(pe,se,j),typeof console===p&&se<pe.levels.SILENT)return"No console available for logging"},pe.setDefaultLevel=function(se){z=se,J()||pe.setLevel(se,!1)},pe.resetLevel=function(){pe.setLevel(z,!1),ne()},pe.enableAll=function(se){pe.setLevel(pe.levels.TRACE,se)},pe.disableAll=function(se){pe.setLevel(pe.levels.SILENT,se)};var Re=J();Re==null&&(Re=z),pe.setLevel(Re,!1)}var F=new O,V={};F.getLogger=function(j){if(typeof j!="symbol"&&typeof j!="string"||j==="")throw new TypeError("You must supply a name when creating a logger.");var z=V[j];return z||(z=V[j]=new O(j,F.getLevel(),F.methodFactory)),z};var $=typeof window!==p?window.log:void 0;return F.noConflict=function(){return typeof window!==p&&window.log===F&&(window.log=$),F},F.getLoggers=function(){return V},F.default=F,F},(d=typeof c=="function"?c.call(o,l,o,a):c)===void 0||(a.exports=d)})()},375:function(a,o){var l=Object.prototype.hasOwnProperty;function c(u){try{return decodeURIComponent(u.replace(/\+/g," "))}catch{return null}}function d(u){try{return encodeURIComponent(u)}catch{return null}}o.stringify=function(u,h){h=h||"";var f,p,y=[];for(p in typeof h!="string"&&(h="?"),u)if(l.call(u,p)){if((f=u[p])||f!=null&&!isNaN(f)||(f=""),p=d(p),f=d(f),p===null||f===null)continue;y.push(p+"="+f)}return y.length?h+y.join("&"):""},o.parse=function(u){for(var h,f=/([^=?#&]+)=?([^&]*)/g,p={};h=f.exec(u);){var y=c(h[1]),_=c(h[2]);y===null||_===null||y in p||(p[y]=_)}return p}},558:function(){}},r={};function n(a){var o=r[a];if(o!==void 0)return o.exports;var l=r[a]={exports:{}};return i[a].call(l.exports,l,l.exports,n),l.exports}return n.n=function(a){var o=a&&a.__esModule?function(){return a.default}:function(){return a};return n.d(o,{a:o}),o},n.d=function(a,o){for(var l in o)n.o(o,l)&&!n.o(a,l)&&Object.defineProperty(a,l,{enumerable:!0,get:o[l]})},n.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),n.o=function(a,o){return Object.prototype.hasOwnProperty.call(a,o)},n(80)}()},s.exports=t()})()})(ju);var t0=ju.exports;const Nl=og(t0);function i0(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var zu={exports:{}};(function(s,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,c,d){if(d=d||{}
vendor: 4,245 bytes, line 29
29,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 h=o.parseURL(c);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return d.alwaysNormalize?(h.path=o.normalizePath(h.path),o.buildURLFromParts(h)):c;var f=o.parseURL(l);if(!f)throw new Error("Error trying to parse base URL.");if(!f.netLoc&&f.path&&f.path[0]!=="/"){var p=r.exec(f.path);f.netLoc=p[1],f.path=p[2]}f.netLoc&&!f.path&&(f.path="/");var y={scheme:f.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(y.netLoc=f.netLoc,h.path[0]!=="/"))if(!h.path)y.path=f.path,h.params||(y.params=f.params,h.query||(y.query=f.query));else{var _=f.path,A=_.substring(0,_.lastIndexOf("/")+1)+h.path;y.path=o.normalizePath(A)}return y.path===null&&(y.path=d.alwaysNormalize?o.normalizePath(h.path):h.path),o.buildURLFromParts(y)},parseURL:function(l){var c=i.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}};s.exports=o})()})(zu);var Fl=zu.exports;function zc(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(s,r).enumerable})),t.push.apply(t,i)}return t}function Pt(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zc(Object(t),!0).forEach(function(i){s0(s,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):zc(Object(t)).forEach(function(i){Object.defineProperty(s,i,Object.getOwnPropertyDescriptor(t,i))})}return s}function s0(s,e,t){return e=n0(e),e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function dt(){return dt=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},dt.apply(this,arguments)}function r0(s,e){if(typeof s!="object"||s===null)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var i=t.call(s,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function n0(s){var e=r0(s,"string");return typeof e=="symbol"?e:String(e)}const oe=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},a0=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=o0},o0=Number.MAX_SAFE_INTEGER||9007199254740991;let T=function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_FRAG_PROCESSED="hl
29sSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s}({}),me=function(s){return s.NETWORK_ERROR="networkError",s.MEDIA_ERROR="mediaError",s.KEY_SYSTEM_ERROR="keySystemError",s.MUX_ERROR="muxError",s.OTHER_ERROR="otherError",s}({}),G=function(s){return s.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",s.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",s.KEY_SYSTEM_NO_SESSION="keySystemNoSession",s.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",s.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",s.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",s.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",s.MANIFEST_LOAD_ERROR="manifestLoadError",s.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",s.MANIFEST_PARSING_ERROR="manifestParsingError",s.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",s.LEVEL_EMPTY_ERROR="levelEmptyError",s.LEVEL_LOAD_ERROR="levelLoadError",s.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",s.LEVEL_PARSING_ERROR="levelParsingError",s.LEVEL_SWITCH_ERROR="levelSwitchError",s.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",s.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",s.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",s.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",s.FRAG_LOAD_ERROR="fragLoadError",s.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",s.FRAG_DECRYPT_ERROR="fragDecryptError",s.FRAG_PARSING_ERROR="fragParsingError",s.FRAG_GAP="fragGap",s.REMUX_ALLOC_ERROR="remuxAllocError",s.KEY_LOAD_ERROR="keyLoadError",s.KEY_LOAD_TIMEOUT="keyLoadTimeOut",s.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",s.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",s.BUFFER_APPEND_ERROR="bufferAppendError",s.BUFFER_APPENDING_ERROR="bufferAppendingError",s.BUFFER_STALLED_ERROR="bufferStalledError",s.BUFFER_FULL_ERROR="bufferFullError",s.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",s.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",s.INTERNAL_EXCEPTION="internalException",s.INTERNAL_ABORTED="aborted",s.UNKNOWN="unknown",s}({});const ns=function(){},Go={trace:ns,debug:ns,log:ns,warn:ns,info:ns,error:ns};let qr=Go;function l0(s){const e=self.console[s];return e?e.bind(self.console,`[${s}] >`):ns}function c0(s,...e){e.forEach(function(t){qr[t]=s[t]?s[t].bind(s):l0(t)})}function d0(s,e){if(self.console&&s===!0||typeof s=="object"){c0(s,"debug","log","info","warn","error");try{qr.log(`Debug logs enabled for "${e}" in hls.js version 1.4.14`)}catch{qr=Go}}else qr=Go}const D=qr,u0=/^(\d+)x(\d+)$/,Xc=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ze{constructor(e){typeof e=="string"&&(e=Ze.parseAttrList(e));for(const t in e)e.hasOwnProperty(t)&&(t.substring(0,2)==="X-"&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])}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 i=new Uint8Array(t.length/2);for(let r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(r*2,r*2+2),16);return i}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 i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=u0.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={},r='"';for(Xc.lastIndex=0;(t=Xc.exec(e))!==null;){let n=t[2];n.indexOf(r)===0&&n.lastIndexOf(r)===n.length-1&&(n=n.slice(1,-1));const a=t[1].trim();i[a]=n}return i}}function h0(s){return s!=="ID"&&s!=="CLASS"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function f0(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"}class Xu{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const r in i)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==i[r]){D.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=dt(new Ze({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const i=new Date(this.attr["END-DATE"]);oe(i.getTime())&&(this._endDate=i)}}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(oe(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&&oe(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class Ga{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 $e={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Qu{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[$e.AUDIO]:null,[$e.VIDEO]:null,[$e.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2),r=[];i.length===1?r[0]=t?t.byteRangeEndOffset:0:r[0]=parseInt(i[1]),r[1]=parseInt(i[0])+r[0],this._byteRange=r}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=Fl.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class no extends Qu{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 Ga,this.urlId=0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 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 i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!oe(this.programDateTime))return null;const e=oe(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;
vendor: 12,658 bytes, line 29
29if(this.levelkeys){const t=Object.keys(this.levelkeys),i=t.length;if(i>1||i===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,i,r,n,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:a};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,i),l.startDTS=Math.min(l.startDTS,r),l.endDTS=Math.max(l.endDTS,n)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[$e.AUDIO]=null,e[$e.VIDEO]=null,e[$e.AUDIOVIDEO]=null}}class m0 extends Qu{constructor(e,t,i,r,n){super(i),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 Ga,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;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 p0=10;class g0{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,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>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?oe(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||p0}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 Ul(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function v0(s){const e=Zu(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function E0(s){const e=function(i,r,n){const a=i[r];i[r]=i[n],i[n]=a};e(s,0,3),e(s,1,2),e(s,4,5),e(s,6,7)}function y0(s){const e=s.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),r=i[i.length-1].split(",");if(r.length===2){const n=r[0]==="base64",a=r[1];n?(i.splice(-1,1),t=Ul(a)):t=v0(a)}}return t}function Zu(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}var Je={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Bt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Qc(s){switch(s){case Bt.FAIRPLAY:return Je.FAIRPLAY;case Bt.PLAYREADY:return Je.PLAYREADY;case Bt.WIDEVINE:return Je.WIDEVINE;case Bt.CLEARKEY:return Je.CLEARKEY}}var Ju={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function _0(s){if(s===Ju.WIDEVINE)return Je.WIDEVINE}function Zc(s){switch(s){case Je.FAIRPLAY:return Bt.FAIRPLAY;case Je.PLAYREADY:return Bt.PLAYREADY;case Je.WIDEVINE:return Bt.WIDEVINE;case Je.CLEARKEY:return Bt.CLEARKEY}}function ao(s){const{drmSystems:e,widevineLicenseUrl:t}=s,i=e?[Je.FAIRPLAY,Je.WIDEVINE,Je.PLAYREADY,Je.CLEARKEY].filter(r=>!!e[r]):[];return!i[Je.WIDEVINE]&&t&&i.push(Je.WIDEVINE),i}const eh=function(){return typeof self<"u"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function T0(s,e,t,i){let r;switch(s){case Je.FAIRPLAY:r=["cenc","sinf"];break;case Je.WIDEVINE:case Je.PLAYREADY:r=["cenc"];break;case Je.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return b0(r,e,t,i)}function b0(s,e,t,i){return[{initDataTypes:s,persistentState:i.persistentState||"not-allowed",distinctiveIdentifier:i.distinctiveIdentifier||"not-allowed",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs="${n}"`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs="${n}"`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function Ss(s,e,t){return Uint8Array.prototype.slice?s.slice(e,t):new Uint8Array(Array.prototype.slice.call(s,e,t))}const Bl=(s,e)=>e+10<=s.length&&s[e]===73&&s[e+1]===68&&s[e+2]===51&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,th=(s,e)=>e+10<=s.length&&s[e]===51&&s[e+1]===68&&s[e+2]===73&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,va=(s,e)=>{const t=e;let i=0;for(;Bl(s,e);){i+=10;const r=Ha(s,e+6);i+=r,th(s,e+10)&&(i+=10),e+=i}if(i>0)return s.subarray(t,t+i)},Ha=(s,e)=>{let t=0;return t=(s[e]&127)<<21,t|=(s[e+1]&127)<<14,t|=(s[e+2]&127)<<7,t|=s[e+3]&127,t},A0=(s,e)=>Bl(s,e)&&Ha(s,e+6)+10<=s.length-e,S0=s=>{const e=sh(s);for(let t=0;t<e.length;t++){const i=e[t];if(ih(i))return k0(i)}},ih=s=>s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp",x0=s=>{const e=String.fromCharCode(s[0],s[1],s[2],s[3]),t=Ha(s,4),i=10;return{type:e,size:t,data:s.subarray(i,i+t)}},sh=s=>{let e=0;const t=[];for(;Bl(s,e);){const i=Ha(s,e+6);e+=10;const r=e+i;for(;e+8<r;){const n=x0(s.subarray(e)),a=I0(n);a&&t.push(a),e+=n.size+10}th(s,e)&&(e+=10)}return t},I0=s=>s.type==="PRIV"?L0(s):s.type[0]==="W"?R0(s):w0(s),L0=s=>{if(s.size<2)return;const e=wi(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}},w0=s=>{if(s.size<2)return;if(s.type==="TXXX"){let t=1;const i=wi(s.data.subarray(t),!0);t+=i.length+1;const r=wi(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=wi(s.data.subarray(1));return{key:s.type,data:e}},R0=s=>{if(s.type==="WXXX"){if(s.size<2)return;let t=1;const i=wi(s.data.subarray(t),!0);t+=i.length+1;const r=wi(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=wi(s.data);return{key:s.type,data:e}},k0=s=>{if(s.data.byteLength===8){const e=new Uint8Array(s.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}},wi=(s,e=!1)=>{const t=D0();if(t){const c=t.decode(s);if(e){const d=c.indexOf("\0");return d!==-1?c.substring(0,d):c}return c.replace(/\0/g,"")}const i=s.length;let r,n,a,o="",l=0;for(;l<i;){if(r=s[l++],r===0&&e)return o;if(r===0||r===3)continue;switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(r);break;case 12:case 13:n=s[l++],o+=String.fromCharCode((r&31)<<6|n&63);break;case 14:n=s[l++],a=s[l++],o+=String.fromCharCode((r&15)<<12|(n&63)<<6|(a&63)<<0);break}}return o};let oo;function D0(){if(!navigator.userAgent.includes("PlayStation 4"))return!oo&&typeof self.TextDecoder<"u"&&(oo=new self.TextDecoder("utf-8")),oo}const Ii={hexDump:function(s){let e="";for(let t=0;t<s.length;t++){let i=s[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}},Ea=Math.pow(2,32)-1,C0=[].push,rh={video:1,audio:2,id3:3,text:4};function At(s){return String.fromCharCode.apply(null,s)}function nh(s,e){const t=s[e]<<8|s[e+1];return t<0?65536+t:t}function ye(s,e){const t=ah(s,e);return t<0?4294967296+t:t}function ah(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function lo(s,e,t){s[e]=t>>24,s[e+1]=t>>16&255,s[e+2]=t>>8&255,s[e+3]=t&255}function De(s,e){const t=[];if(!e.length)return t;const i=s.byteLength;for(let r=0;r<i;){const n=ye(s,r),a=At(s.subarray(r+4,r+8)),o=n>1?r+n:i;if(a===e[0])if(e.length===1)t.push(s.subarray(r+8,o));else{const l=De(s.subarray(r+8,o),e.slice(1));l.length&&C0.apply(t,l)}r=o}return t}function M0(s){const e=[],t=s[0];let i=8;const r=ye(s,i);i+=4;const n=0,a=0;t===0?i+=8:i+=16,i+=2;let o=s.length+a;const l=nh(s,i);i+=2;for(let c=0;c<l;c++){let d=i;const u=ye(s,d);d+=4;const h=u&2147483647;if((u&2147483648)>>>31===1)return D.warn("SIDX has hierarchical references (not supported)"),null;const p=ye(s,d);d+=4,e.push({referenceSize:h,subsegmentDuration:p,info:{duration:p/r,start:o,end:o+h-1}}),o+=h,d+=4,i=d}return{earliestPresentationTime:n,timescale:r,version:t,referencesCount:l,references:e}}function oh(s){const e=[],t=De(s,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],a=De(n,["tkhd"])[0];if(a){let o=a[0],l=o===0?12:20;const c=ye(a,l),d=De(n,["mdia","mdhd"])[0];if(d){o=d[0],l=o===0?12:20;const u=ye(d,l),h=De(n,["mdia","hdlr"])[0];if(h){const f=At(h.subarray(8,12)),p={soun:$e.AUDIO,vide:$e.VIDEO}[f];if(p){const y=De(n,["mdia","minf","stbl","stsd"])[0];let _;y&&(_=At(y.subarray(12,16))),e[c]={timescale:u,type:p},e[p]={timescale:u,id:c,codec:_}}}}}}return De(s,["moov","mvex","trex"]).forEach(r=>{const n=ye(r,4),a=e[n];a&&(a.default={duration:ye(r,12),flags:ye(r,20)})}),e}function P0(s,e){if(!s||!e)return s;const t=e.keyId;return t&&e.isCommonEncryption&&De(s,["moov","trak"]).forEach(r=>{const a=De(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=De(a,["enca"]);const l=o.length>0;l||(o=De(a,["encv"])),o.forEach(c=>{const d=l?c.subarray(28):c.subarray(78);De(d,["sinf"]).forEach(h=>{const f=lh(h);if(f){const p=f.subarray(8,24);p.some(y=>y!==0)||(D.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${Ii.hexDump(p)} -> ${Ii.hexDump(t)}`),f.set(t,8))}})})}),s}function lh(s){const e=De(s,["schm"])[0];if(e){const t=At(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return De(s,["schi","tenc"])[0]}return D.error("[eme] missing 'schm' box"),null}function O0(s,e){return De(e,["moof","traf"]).reduce((t,i)=>{const r=De(i,["tfdt"])[0],n=r[0],a=De(i,["tfhd"]).reduce((o,l)=>{const c=ye(l,4),d=s[c];if(d){let u=ye(r,4);if(n===1){if(u===Ea)return D.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),o;u*=Ea+1,u+=ye(r,8)}const h=d.timescale||9e4,f=u/h;if(oe(f)&&(o===null||f<o))return f}return o},null);return a!==null&&oe(a)&&(t===null||a<t)?a:t},null)}function N0(s,e){let t=0,i=0,r=0;const n=De(s,["moof","traf"]);for(let a=0;a<n.length;a++){const o=n[a],l=De(o,["tfhd"])[0],c=ye(l,4),d=e[c];if(!d)continue;const u=d.default,h=ye(l,0)|(u==null?void 0:u.flags);let f=u==null?void 0:u.duration;h&8&&(h&2?f=ye(l,12):f=ye(l,8));const p=d.timescale||9e4,y=De(o,["trun"]);for(let _=0;_<y.length;_++){if(t=F0(y[_]),!t&&f){const A=ye(y[_],4);t=f*A}d.type===$e.VIDEO?i+=t/p:d.type===$e.AUDIO&&(r+=t/p)}}if(i===0&&r===0){let a=0;const o=De(s,["sidx"]);for(let l=0;l<o.length;l++){const c=M0(o[l]);c!=null&&c.references&&(a+=c.references.reduce((d,u)=>d+u.info.duration||0,0))}return a}return i||r}function F0(s){const e=ye(s,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const r=ye(s,4);for(let n=0;n<r;n++){if(e&256){const a=ye(s,t);i+=a,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}
29function U0(s,e,t){De(e,["moof","traf"]).forEach(i=>{De(i,["tfhd"]).forEach(r=>{const n=ye(r,4),a=s[n];if(!a)return;const o=a.timescale||9e4;De(i,["tfdt"]).forEach(l=>{const c=l[0];let d=ye(l,4);if(c===0)d-=t*o,d=Math.max(d,0),lo(l,4,d);else{d*=Math.pow(2,32),d+=ye(l,8),d-=t*o,d=Math.max(d,0);const u=Math.floor(d/(Ea+1)),h=Math.floor(d%(Ea+1));lo(l,4,u),lo(l,8,h)}})})})}function B0(s){const e={valid:null,remainder:null},t=De(s,["moof"]);if(t){if(t.length<2)return e.remainder=s,e}else return e;const i=t[t.length-1];return e.valid=Ss(s,0,i.byteOffset-8),e.remainder=Ss(s,i.byteOffset-8),e}function ws(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function Jc(s,e){const t=[],i=e.samples,r=e.timescale,n=e.id;let a=!1;return De(i,["moof"]).map(l=>{const c=l.byteOffset-8;De(l,["traf"]).map(u=>{const h=De(u,["tfdt"]).map(f=>{const p=f[0];let y=ye(f,4);return p===1&&(y*=Math.pow(2,32),y+=ye(f,8)),y/r})[0];return h!==void 0&&(s=h),De(u,["tfhd"]).map(f=>{const p=ye(f,4),y=ye(f,0)&16777215,_=(y&1)!==0,A=(y&2)!==0,x=(y&8)!==0;let I=0;const P=(y&16)!==0;let L=0;const B=(y&32)!==0;let O=8;p===n&&(_&&(O+=8),A&&(O+=4),x&&(I=ye(f,O),O+=4),P&&(L=ye(f,O),O+=4),B&&(O+=4),e.type==="video"&&(a=$0(e.codec)),De(u,["trun"]).map(F=>{const V=F[0],$=ye(F,0)&16777215,j=($&1)!==0;let z=0;const ve=($&4)!==0,qe=($&256)!==0;let pe=0;const Le=($&512)!==0;let Pe=0;const J=($&1024)!==0,ne=($&2048)!==0;let Re=0;const se=ye(F,4);let Ae=8;j&&(z=ye(F,Ae),Ae+=4),ve&&(Ae+=4);let He=z+c;for(let xt=0;xt<se;xt++){if(qe?(pe=ye(F,Ae),Ae+=4):pe=I,Le?(Pe=ye(F,Ae),Ae+=4):Pe=L,J&&(Ae+=4),ne&&(V===0?Re=ye(F,Ae):Re=ah(F,Ae),Ae+=4),e.type===$e.VIDEO){let $t=0;for(;$t<Pe;){const Ot=ye(i,He);if(He+=4,G0(a,i[He])){const ui=i.subarray(He,He+Ot);ch(ui,a?2:1,s+Re/r,t)}He+=Ot,$t+=Ot+4}}s+=pe/r}}))})})}),t}function $0(s){if(!s)return!1;const e=s.indexOf("."),t=e<0?s:s.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function G0(s,e){if(s){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function ch(s,e,t,i){const r=dh(s);let n=0;n+=e;let a=0,o=0,l=!1,c=0;for(;n<r.length;){a=0;do{if(n>=r.length)break;c=r[n++],a+=c}while(c===255);o=0;do{if(n>=r.length)break;c=r[n++],o+=c}while(c===255);const d=r.length-n;if(!l&&a===4&&n<r.length){if(l=!0,r[n++]===181){const h=nh(r,n);if(n+=2,h===49){const f=ye(r,n);if(n+=4,f===1195456820){const p=r[n++];if(p===3){const y=r[n++],_=31&y,A=64&y,x=A?2+_*3:0,I=new Uint8Array(x);if(A){I[0]=y;for(let P=1;P<x;P++)I[P]=r[n++]}i.push({type:p,payloadType:a,pts:t,bytes:I})}}}}}else if(a===5&&o<d){if(l=!0,o>16){const u=[];for(let p=0;p<16;p++){const y=r[n++].toString(16);u.push(y.length==1?"0"+y:y),(p===3||p===5||p===7||p===9)&&u.push("-")}const h=o-16,f=new Uint8Array(h);for(let p=0;p<h;p++)f[p]=r[n++];i.push({payloadType:a,pts:t,uuid:u.join(""),userData:wi(f),userDataBytes:f})}}else if(o<d)n+=o;else if(o>d)break}}function dh(s){const e=s.byteLength,t=[];let i=1;for(;i<e-2;)s[i]===0&&s[i+1]===0&&s[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return s;const r=e-t.length,n=new Uint8Array(r);let a=0;for(i=0;i<r;a++,i++)a===t[0]&&(a++,t.shift()),n[i]=s[a];return n}function H0(s){const e=s[0];let t="",i="",r=0,n=0,a=0,o=0,l=0,c=0;if(e===0){for(;At(s.subarray(c,c+1))!=="\0";)t+=At(s.subarray(c,c+1)),c+=1;for(t+=At(s.subarray(c,c+1)),c+=1;At(s.subarray(c,c+1))!=="\0";)i+=At(s.subarray(c,c+1)),c+=1;i+=At(s.subarray(c,c+1)),c+=1,r=ye(s,12),n=ye(s,16),o=ye(s,20),l=ye(s,24),c=28}else if(e===1){c+=4,r=ye(s,c),c+=4;const u=ye(s,c);c+=4;const h=ye(s,c);for(c+=4,a=2**32*u+h,a0(a)||(a=Number.MAX_SAFE_INTEGER,D.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=ye(s,c),c+=4,l=ye(s,c),c+=4;At(s.subarray(c,c+1))!=="\0";)t+=At(s.subarray(c,c+1)),c+=1;for(t+=At(s.subarray(c,c+1)),c+=1;At(s.subarray(c,c+1))!=="\0";)i+=At(s.subarray(c,c+1)),c+=1;i+=At(s.subarray(c,c+1)),c+=1}const d=s.subarray(c,s.byteLength);return{schemeIdUri:t,value:i,timeScale:r,presentationTime:a,presentationTimeDelta:n,eventDuration:o,id:l,payload:d}}function V0(s,...e){const t=e.length;let i=8,r=t;for(;r--;)i+=e[r].byteLength;const n=new Uint8Array(i);for(n[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=i&255,n.set(s,4),r=0,i=8;r<t;r++)n.set(e[r],i),i+=e[r].byteLength;return n}function W0(s,e,t){if(s.byteLength!==16)throw new RangeError("Invalid system id");let i,r;if(e){i=1,r=new Uint8Array(e.length*16);for(let o=0;o<e.length;o++){const l=e[o];if(l.byteLength!==16)throw new RangeError("Invalid key");r.set(l,o*16)}}else i=0,r=new Uint8Array;let n;i>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),V0([112,115,115,104],new Uint8Array([i,0,0,0]),s,n,r,a,t||new Uint8Array)}function K0(s){if(!(s instanceof ArrayBuffer)||s.byteLength<32)return null;
vendor: 4,706 bytes, line 29
29const e={version:0,systemId:"",kids:null,data:null},t=new DataView(s),i=t.getUint32(0);if(s.byteLength!==i&&i>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=Ii.hexDump(new Uint8Array(s,12,16));const n=t.getUint32(28);if(e.version===0){if(i-32<n)return null;e.data=new Uint8Array(s,32,n)}else if(e.version===1){e.kids=[];for(let a=0;a<n;a++)e.kids.push(new Uint8Array(s,32+a*16,16))}return e}let fn={};class Qr{static clearKeyUriToKeyIdMap(){fn={}}constructor(e,t,i,r=[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=i,this.keyFormatVersions=r,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 Bt.FAIRPLAY:case Bt.WIDEVINE:case Bt.PLAYREADY:case Bt.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&&D.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=q0(e);return new Qr(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=y0(this.uri);if(t)switch(this.keyFormat){case Bt.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Bt.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=W0(i,null,t);const r=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(r)),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=Ul(d).subarray(0,16);E0(u),this.keyId=u}}break}default:{let i=t.subarray(0,16);if(i.length!==16){const r=new Uint8Array(16);r.set(i,16-i.length),i=r}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=fn[this.uri];if(!i){const r=Object.keys(fn).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,r),fn[this.uri]=i}this.keyId=i}return this}}function q0(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const uh=/\{\$([a-zA-Z0-9-_]+)\}/g;function ed(s){return uh.test(s)}function Ft(s,e,t){if(s.variableList!==null||s.hasVariableRefs)for(let i=t.length;i--;){const r=t[i],n=e[r];n&&(e[r]=Ho(s,n))}}function Ho(s,e){if(s.variableList!==null||s.hasVariableRefs){const t=s.variableList;return e.replace(uh,i=>{const r=i.substring(2,i.length-1),n=t==null?void 0:t[r];return n===void 0?(s.playlistParsingError||(s.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),i):n})}return e}function td(s,e,t){let i=s.variableList;i||(s.variableList=i={});let r,n;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(r))n=a.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(a){s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else r=e.NAME,n=e.VALUE;r in i?s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):i[r]=n||""}function Y0(s,e,t){const i=e.IMPORT;if(t&&i in t){let r=s.variableList;r||(s.variableList=r={}),r[i]=t[i]}else s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}function Va(){if(!(typeof self>"u"))return self.MediaSource||self.WebKitMediaSource}const j0={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dva1:!0,dvav:!0,dvh1:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}},id=Va();function z0(s,e){const t=j0[e];return!!t&&t[s.slice(0,4)]===!0}function co(s,e){var t;
29return(t=id==null?void 0:id.isTypeSupported(`${e||"video"}/mp4;codecs="${s}"`))!=null?t:!1}const sd=/#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,rd=/#EXT-X-MEDIA:(.*)/g,X0=/^#EXT(?:INF|-X-TARGETDURATION):/m,nd=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),Q0=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)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class li{static findGroup(e,t){for(let i=0;i<e.length;i++){const r=e[i];if(r.id===t)return r}}static convertAVC1ToAVCOTI(e){const t=e.split(".");if(t.length>2){let i=t.shift()+".";return i+=parseInt(t.shift()).toString(16),i+=("000"+parseInt(t.shift()).toString(16)).slice(-4),i}return e}static resolve(e,t){return Fl.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return X0.test(e)}static parseMasterPlaylist(e,t){const i=ed(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},n=[];sd.lastIndex=0;let a;for(;(a=sd.exec(e))!=null;)if(a[1]){var o;const c=new Ze(a[1]);Ft(r,c,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const d=Ho(r,a[2]),u={attrs:c,bitrate:c.decimalInteger("AVERAGE-BANDWIDTH")||c.decimalInteger("BANDWIDTH"),name:c.NAME,url:li.resolve(d,t)},h=c.decimalResolution("RESOLUTION");h&&(u.width=h.width,u.height=h.height),Z0((c.CODECS||"").split(/[ ,]+/).filter(f=>f),u),u.videoCodec&&u.videoCodec.indexOf("avc1")!==-1&&(u.videoCodec=li.convertAVC1ToAVCOTI(u.videoCodec)),(o=u.unknownCodecs)!=null&&o.length||n.push(u),r.levels.push(u)}else if(a[3]){const c=a[3],d=a[4];switch(c){case"SESSION-DATA":{const u=new Ze(d);Ft(r,u,["DATA-ID","LANGUAGE","VALUE","URI"]);const h=u["DATA-ID"];h&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[h]=u);break}case"SESSION-KEY":{const u=ad(d,t,r);u.encrypted&&u.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(u)):D.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${d}"`);break}case"DEFINE":{{const u=new Ze(d);Ft(r,u,["NAME","VALUE","QUERYPARAM"]),td(r,u,t)}break}case"CONTENT-STEERING":{const u=new Ze(d);Ft(r,u,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:li.resolve(u["SERVER-URI"],t),pathwayId:u["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=od(d);break}}}const l=n.length>0&&n.length<r.levels.length;return r.levels=l?n:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,i){let r;const n={},a=i.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(rd.lastIndex=0;(r=rd.exec(e))!==null;){const c=new Ze(r[1]),d=c.TYPE;if(d){const u=o[d],h=n[d]||[];n[d]=h,Ft(i,c,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const f={attrs:c,bitrate:0,id:l++,groupId:c["GROUP-ID"]||"",instreamId:c["INSTREAM-ID"],name:c.NAME||c.LANGUAGE||"",type:d,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:c.LANGUAGE,url:c.URI?li.resolve(c.URI,t):""};if(u!=null&&u.length){const p=li.findGroup(u,f.groupId)||u[0];ld(f,p,"audioCodec"),ld(f,p,"textCodec")}h.push(f)}}return n}static parseLevelPlaylist(e,t,i,r,n,a){const o=new g0(t),l=o.fragments;let c=null,d=0,u=0,h=0,f=0,p=null,y=new no(r,t),_,A,x,I=-1,P=!1;for(nd.lastIndex=0,o.m3u8=e,o.hasVariableRefs=ed(e);(_=nd.exec(e))!==null;){P&&(P=!1,y=new no(r,t),y.start=h,y.sn=d,y.cc=f,y.level=i,c&&(y.initSegment=c,y.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null));const F=_[1];if(F){y.duration=parseFloat(F);const V=(" "+_[2]).slice(1);y.title=V||null,y.tagList.push(V?["INF",F,V]:["INF",F])}else if(_[3]){if(oe(y.duration)){y.start=h,x&&ud(y,x,o),y.sn=d,y.level=i,y.cc=f,y.urlId=n,l.push(y);const V=(" "+_[3]).slice(1);y.relurl=Ho(o,V),cd(y,p),p=y,h+=y.duration,d++,u=0,P=!0}}else if(_[4]){const V=(" "+_[4]).slice(1);p?y.setByteRange(V,p):y.setByteRange(V)}else if(_[5])y.rawProgramDateTime=(" "+_[5]).slice(1),y.tagList.push(["PROGRAM-DATE-TIME",y.rawProgramDateTime]),I===-1&&(I=l.length);
vendor: 14,786 bytes, line 29
29else{if(_=_[0].match(Q0),!_){D.warn("No matches on slow regex match for level playlist!");continue}for(A=1;A<_.length&&!(typeof _[A]<"u");A++);const V=(" "+_[A]).slice(1),$=(" "+_[A+1]).slice(1),j=_[A+2]?(" "+_[A+2]).slice(1):"";switch(V){case"PLAYLIST-TYPE":o.type=$.toUpperCase();break;case"MEDIA-SEQUENCE":d=o.startSN=parseInt($);break;case"SKIP":{const z=new Ze($);Ft(o,z,["RECENTLY-REMOVED-DATERANGES"]);const ve=z.decimalInteger("SKIPPED-SEGMENTS");if(oe(ve)){o.skippedSegments=ve;for(let pe=ve;pe--;)l.unshift(null);d+=ve}const qe=z.enumeratedString("RECENTLY-REMOVED-DATERANGES");qe&&(o.recentlyRemovedDateranges=qe.split(" "));break}case"TARGETDURATION":o.targetduration=Math.max(parseInt($),1);break;case"VERSION":o.version=parseInt($);break;case"EXTM3U":break;case"ENDLIST":o.live=!1;break;case"#":($||j)&&y.tagList.push(j?[$,j]:[$]);break;case"DISCONTINUITY":f++,y.tagList.push(["DIS"]);break;case"GAP":y.gap=!0,y.tagList.push([V]);break;case"BITRATE":y.tagList.push([V,$]);break;case"DATERANGE":{const z=new Ze($);Ft(o,z,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Ft(o,z,z.clientAttrs);const ve=new Xu(z,o.dateRanges[z.ID]);ve.isValid||o.skippedSegments?o.dateRanges[ve.id]=ve:D.warn(`Ignoring invalid DATERANGE tag: "${$}"`),y.tagList.push(["EXT-X-DATERANGE",$]);break}case"DEFINE":{{const z=new Ze($);Ft(o,z,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in z?Y0(o,z,a):td(o,z,t)}break}case"DISCONTINUITY-SEQUENCE":f=parseInt($);break;case"KEY":{const z=ad($,t,o);if(z.isSupported()){if(z.method==="NONE"){x=void 0;break}x||(x={}),x[z.keyFormat]&&(x=dt({},x)),x[z.keyFormat]=z}else D.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${$}"`);break}case"START":o.startTimeOffset=od($);break;case"MAP":{const z=new Ze($);if(Ft(o,z,["BYTERANGE","URI"]),y.duration){const ve=new no(r,t);dd(ve,z,i,x),c=ve,y.initSegment=c,c.rawProgramDateTime&&!y.rawProgramDateTime&&(y.rawProgramDateTime=c.rawProgramDateTime)}else dd(y,z,i,x),c=y,P=!0;break}case"SERVER-CONTROL":{const z=new Ze($);o.canBlockReload=z.bool("CAN-BLOCK-RELOAD"),o.canSkipUntil=z.optionalFloat("CAN-SKIP-UNTIL",0),o.canSkipDateRanges=o.canSkipUntil>0&&z.bool("CAN-SKIP-DATERANGES"),o.partHoldBack=z.optionalFloat("PART-HOLD-BACK",0),o.holdBack=z.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const z=new Ze($);o.partTarget=z.decimalFloatingPoint("PART-TARGET");break}case"PART":{let z=o.partList;z||(z=o.partList=[]);const ve=u>0?z[z.length-1]:void 0,qe=u++,pe=new Ze($);Ft(o,pe,["BYTERANGE","URI"]);const Le=new m0(pe,y,t,qe,ve);z.push(Le),y.duration+=Le.duration;break}case"PRELOAD-HINT":{const z=new Ze($);Ft(o,z,["URI"]),o.preloadHint=z;break}case"RENDITION-REPORT":{const z=new Ze($);Ft(o,z,["URI"]),o.renditionReports=o.renditionReports||[],o.renditionReports.push(z);break}default:D.warn(`line parsed but not handled: ${_}`);break}}}p&&!p.relurl?(l.pop(),h-=p.duration,o.partList&&(o.fragmentHint=p)):o.partList&&(cd(y,p),y.cc=f,o.fragmentHint=y,x&&ud(y,x,o));const L=l.length,B=l[0],O=l[L-1];if(h+=o.skippedSegments*o.targetduration,h>0&&L&&O){o.averagetargetduration=h/L;const F=O.sn;o.endSN=F!=="initSegment"?F:0,o.live||(O.endList=!0),B&&(o.startCC=B.cc)}else o.endSN=0,o.startCC=0;return o.fragmentHint&&(h+=o.fragmentHint.duration),o.totalduration=h,o.endCC=f,I>0&&J0(l,I),o}}function ad(s,e,t){var i,r;const n=new Ze(s);Ft(t,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const a=(i=n.METHOD)!=null?i:"",o=n.URI,l=n.hexadecimalInteger("IV"),c=n.KEYFORMATVERSIONS,d=(r=n.KEYFORMAT)!=null?r:"identity";o&&n.IV&&!l&&D.error(`Invalid IV: ${n.IV}`);const u=o?li.resolve(o,e):"",h=(c||"1").split("/").map(Number).filter(Number.isFinite);return new Qr(a,u,d,h,l)}function od(s){const t=new Ze(s).decimalFloatingPoint("TIME-OFFSET");return oe(t)?t:null}function Z0(s,e){["video","audio","text"].forEach(t=>{const i=s.filter(r=>z0(r,t));if(i.length){const r=i.filter(n=>n.lastIndexOf("avc1",0)===0||n.lastIndexOf("mp4a",0)===0);e[`${t}Codec`]=r.length>0?r[0]:i[0],s=s.filter(n=>i.indexOf(n)===-1)}}),e.unknownCodecs=s}function ld(s,e,t){const i=e[t];i&&(s[t]=i)}function J0(s,e){let t=s[e];for(let i=e;i--;){const r=s[i];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function cd(s,e){s.rawProgramDateTime?s.programDateTime=Date.parse(s.rawProgramDateTime):e!=null&&e.programDateTime&&(s.programDateTime=e.endProgramDateTime),oe(s.programDateTime)||(s.programDateTime=null,s.rawProgramDateTime=null)}function dd(s,e,t,i){s.relurl=e.URI,e.BYTERANGE&&s.setByteRange(e.BYTERANGE),s.level=t,s.sn="initSegment",i&&(s.levelkeys=i),s.initSegment=null}function ud(s,e,t){s.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&i.push(s)}var Ce={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},ge={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function hd(s){const{type:e}=s;switch(e){case Ce.AUDIO_TRACK:return ge.AUDIO;case Ce.SUBTITLE_TRACK:return ge.SUBTITLE;default:return ge.MAIN}}function uo(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class ev{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(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.LEVEL_LOADING,this.onLevelLoading,this),e.on(T.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(T.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.LEVEL_LOADING,this.onLevelLoading,this),e.off(T.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(T.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,r=t.loader,n=i||r,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:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Ce.MANIFEST,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:r,url:n,deliveryDirectives:a}=t;this.load({id:i,level:r,responseType:"text",type:Ce.LEVEL,url:n,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:a}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:Ce.AUDIO_TRACK,url:n,deliveryDirectives:a})}onSubtitleTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:a}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:Ce.SUBTITLE_TRACK,url:n,deliveryDirectives:a})}load(e){var t;const i=this.hls.config;let r=this.getInternalLoader(e);if(r){const c=r.context;if(c&&c.url===e.url){D.trace("[playlist-loader]: playlist request ongoing");return}D.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===Ce.MANIFEST?n=i.manifestLoadPolicy.default:n=dt({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),(t=e.deliveryDirectives)!=null&&t.part){let c;if(e.type===Ce.LEVEL&&e.level!==null?c=this.hls.levels[e.level].details:e.type===Ce.AUDIO_TRACK&&e.id!==null?c=this.hls.audioTracks[e.id].details:e.type===Ce.SUBTITLE_TRACK&&e.id!==null&&(c=this.hls.subtitleTracks[e.id].details),c){const d=c.partTarget,u=c.targetduration;if(d&&u){const h=Math.max(d*3,u*.8)*1e3;n=dt({},n,{maxTimeToFirstByteMs:Math.min(h,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,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,h)=>{const f=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"),h||null,d);return}d.parsing.start=performance.now(),li.isMediaPlaylist(p)?this.handleTrackOrLevelPlaylist(c,d,u,h||null,f):this.handleMasterPlaylist(c,d,u,h)},onError:(c,d,u,h)=>{this.handleNetworkError(d,u,!1,c,h)},onTimeout:(c,d,u)=>{this.handleNetworkError(d,u,!0,void 0,c)}};r.load(e,o,l)}handleMasterPlaylist(e,t,i,r){const n=this.hls,a=e.data,o=uo(e,i),l=li.parseMasterPlaylist(a,o);if(l.playlistParsingError){this.handleManifestParsingError(e,i,l.playlistParsingError,r,t);return}const{contentSteering:c,levels:d,sessionData:u,sessionKeys:h,startTimeOffset:f,variableList:p}=l;this.variableList=p;const{AUDIO:y=[],SUBTITLES:_,"CLOSED-CAPTIONS":A}=li.parseMasterPlaylistMedia(a,o,l);y.length&&!y.some(I=>!I.url)&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(D.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),y.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ze({}),bitrate:0,url:""})),n.trigger(T.MANIFEST_LOADED,{levels:d,audioTracks:y,subtitles:_,captions:A,contentSteering:c,url:o,stats:t,networkDetails:r,sessionData:u,sessionKeys:h,startTimeOffset:f,variableList:p})}handleTrackOrLevelPlaylist(e,t,i,r,n){const a=this.hls,{id:o,level:l,type:c}=i,d=uo(e,i),u=oe(o)?o:0,h=oe(l)?l:u,f=hd(i),p=li.parseLevelPlaylist(e.data,d,h,f,u,this.variableList);if(c===Ce.MANIFEST){const y={attrs:new Ze({}),bitrate:0,details:p,name:"",url:d};a.trigger(T.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:d,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=p,this.handlePlaylistLoaded(p,e,t,i,r,n)}handleManifestParsingError(e,t,i,r,n){this.hls.trigger(T.ERROR,{type:me.NETWORK_ERROR,details:G.MANIFEST_PARSING_ERROR,fatal:t.type===Ce.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,i=!1,r,n){let a=`A network ${i?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===Ce.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===Ce.AUDIO_TRACK||e.type===Ce.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);D.warn(`[playlist-loader]: ${a}`);let l=G.UNKNOWN,c=!1;const d=this.getInternalLoader(e);switch(e.type){case Ce.MANIFEST:l=i?G.MANIFEST_LOAD_TIMEOUT:G.MANIFEST_LOAD_ERROR,c=!0;break;case Ce.LEVEL:l=i?G.LEVEL_LOAD_TIMEOUT:G.LEVEL_LOAD_ERROR,c=!1;break;case Ce.AUDIO_TRACK:l=i?G.AUDIO_TRACK_LOAD_TIMEOUT:G.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case Ce.SUBTITLE_TRACK:l=i?G.SUBTITLE_TRACK_LOAD_TIMEOUT:G.SUBTITLE_LOAD_ERROR,c=!1;break}d&&this.resetInternalLoader(e.type);const u={type:me.NETWORK_ERROR,details:l,fatal:c,url:e.url,loader:d,context:e,error:o,networkDetails:t,stats:n};if(r){const h=(t==null?void 0:t.url)||e.url;u.response=Pt({url:h,data:void 0},r)}this.hls.trigger(T.ERROR,u)}handlePlaylistLoaded(e,t,i,r,n,a){const o=this.hls,{type:l,level:c,id:d,groupId:u,deliveryDirectives:h}=r,f=uo(t,r),p=hd(r),y=typeof r.level=="number"&&p===ge.MAIN?c:void 0;if(!e.fragments.length){const A=new Error("No Segments found in Playlist");o.trigger(T.ERROR,{type:me.NETWORK_ERROR,details:G.LEVEL_EMPTY_ERROR,fatal:!1,url:f,error:A,reason:A.message,response:t,context:r,level:y,parent:p,networkDetails:n,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const _=e.playlistParsingError;if(_){o.trigger(T.ERROR,{type:me.NETWORK_ERROR,details:G.LEVEL_PARSING_ERROR,fatal:!1,url:f,error:_,reason:_.message,response:t,context:r,level:y,parent:p,networkDetails:n,stats:i});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case Ce.MANIFEST:case Ce.LEVEL:o.trigger(T.LEVEL_LOADED,{details:e,level:y||0,id:d||0,stats:i,networkDetails:n,deliveryDirectives:h});break;case Ce.AUDIO_TRACK:o.trigger(T.AUDIO_TRACK_LOADED,{details:e,id:d||0,groupId:u||"",stats:i,networkDetails:n,deliveryDirectives:h});break;case Ce.SUBTITLE_TRACK:o.trigger(T.SUBTITLE_TRACK_LOADED,{details:e,id:d||0,groupId:u||"",stats:i,networkDetails:n,deliveryDirectives:h});break}}}function hh(s,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=s,e.dispatchEvent(t)}function fh(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(e.id))try{if(s.addCue(e),!s.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){D.debug(`[texttrack-utils]: ${i}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,s.addCue(r)}catch(r){D.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(s.mode=t)}function ir(s){const e=s.mode;if(e==="disabled"&&(s.mode="hidden"),s.cues)for(let t=s.cues.length;t--;)s.removeCue(s.cues[t]);e==="disabled"&&(s.mode=e)}function Vo(s,e,t,i){const r=s.mode;if(r==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const n=iv(s.cues,e,t);for(let a=0;a<n.length;a++)(!i||i(n[a]))&&s.removeCue(n[a])}r==="disabled"&&(s.mode=r)}function tv(s,e){if(e<s[0].startTime)return 0;const t=s.length-1;if(e>s[t].endTime)return-1;let i=0,r=t;for(;i<=r;){const n=Math.floor((r+i)/2);if(e<s[n].startTime)r=n-1;else if(e>s[n].startTime&&i<t)i=n+1;else return n}return s[i].startTime-e<e-s[r].startTime?i:r}function iv(s,e,t){const i=[],r=tv(s,e);if(r>-1)for(let n=r,a=s.length;n<a;n++){const o=s[n];if(o.startTime>=e&&o.endTime<=t)i.push(o);else if(o.startTime>t)return i}return i}var ai={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const sv=.25;function Wo(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function fd(s,e,t,i,r){let n=new s(e,t,"");try{n.value=i,r&&(n.type=r)}catch{n=new s(e,t,JSON.stringify(r?Pt({type:r},i):i))}return n}const mn=(()=>{const s=Wo();try{s&&new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function ho(s,e){return s.getTime()/1e3-e}function rv(s){return Uint8Array.from(s.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class nv{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;
29e.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(T.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(T.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(T.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(T.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(ir(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 i=e[t];if(i.kind==="metadata"&&i.label==="id3")return hh(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:r}}}=this;if(!i&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=Wo();if(a)for(let o=0;o<n.length;o++){const l=n[o].type;if(l===ai.emsg&&!i||!r)continue;const c=sh(n[o].data);if(c){const d=n[o].pts;let u=d+n[o].duration;u>mn&&(u=mn),u-d<=0&&(u=d+sv);for(let f=0;f<c.length;f++){const p=c[f];if(!ih(p)){this.updateId3CueEnds(d,l);const y=fd(a,d,u,p,l);y&&this.id3Track.addCue(y)}}}}}updateId3CueEnds(e,t){var i;const r=(i=this.id3Track)==null?void 0:i.cues;if(r)for(let n=r.length;n--;){const a=r[n];a.type===t&&a.startTime<e&&a.endTime===mn&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:r}){const{id3Track:n,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:l}}=a;if(n&&(o||l)){let c;r==="audio"?c=d=>d.type===ai.audioId3&&l:r==="video"?c=d=>d.type===ai.emsg&&o:c=d=>d.type===ai.audioId3&&l||d.type===ai.emsg&&o,Vo(n,t,i,c)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:r}=this,{dateRanges:n}=t,a=Object.keys(n);if(r){const d=Object.keys(i).filter(u=>!a.includes(u));for(let u=d.length;u--;){const h=d[u];Object.keys(i[h].cues).forEach(f=>{r.removeCue(i[h].cues[f])}),delete i[h]}}const o=t.fragments[t.fragments.length-1];if(a.length===0||!oe(o==null?void 0:o.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const l=o.programDateTime/1e3-o.start,c=Wo();for(let d=0;d<a.length;d++){const u=a[d],h=n[u],f=i[u],p=(f==null?void 0:f.cues)||{};let y=(f==null?void 0:f.durationKnown)||!1;const _=ho(h.startDate,l);let A=mn;const x=h.endDate;if(x)A=ho(x,l),y=!0;else if(h.endOnNext&&!y){const P=a.reduce((L,B)=>{const O=n[B];return O.class===h.class&&O.id!==B&&O.startDate>h.startDate&&L.push(O),L},[]).sort((L,B)=>L.startDate.getTime()-B.startDate.getTime())[0];P&&(A=ho(P.startDate,l),y=!0)}const I=Object.keys(h.attr);for(let P=0;P<I.length;P++){const L=I[P];if(!h0(L))continue;const B=p[L];if(B)y&&!f.durationKnown&&(B.endTime=A);else if(c){let O=h.attr[L];f0(L)&&(O=rv(O));const F=fd(c,_,A,{key:L,data:O},ai.dateRange);F&&(F.id=u,this.id3Track.addCue(F),p[L]=F)}}i[u]={cues:p,dateRange:h,durationKnown:y}}}}class av{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:i,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,l=this.hls.userConfig;let c=o&&i||t;(l.liveSyncDuration||l.liveSyncDurationCount||c===0)&&(c=n!==void 0?n:a*r);const d=r;return c+Math.min(this.stallCount*1,d)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(e===null||t===null||i===null)return null;const r=i.edge,n=e-t-this.edgeStalled,a=r-i.totalduration,o=r-(this.config.lowLatencyMode&&i.partTarget||i.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 i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}
29registerListeners(){this.hls.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(T.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(T.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(T.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(T.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(T.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(T.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 i;t.details===G.BUFFER_STALLED_ERROR&&(this.stallCount++,(i=this.levelDetails)!=null&&i.live&&D.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 i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:n}=this.config;if(!r||n===1)return;const a=this.targetLatency;if(a===null)return;const o=i-a,l=Math.min(this.maxLatency,a+t.targetduration),c=o<l;if(t.live&&c&&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 Ko=["NONE","TYPE-0","TYPE-1",null];var Yr={No:"",Yes:"YES",v2:"v2"};function ov(s,e){const{canSkipUntil:t,canSkipDateRanges:i,endSN:r}=s,n=e!==void 0?e-r:0;return t&&n<t?i?Yr.v2:Yr.Yes:Yr.No}class md{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}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 Zr{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=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.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.unknownCodecs=e.unknownCodecs,this.codecSet=[e.videoCodec,e.audioCodec].filter(t=>t).join(",").replace(/\.[^.,]+/g,"")}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get attrs(){return this._attrs[this._urlId]}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get uri(){return this.url[this._urlId]||""}get urlId(){return this._urlId}set urlId(e){const t=e%this.url.length;this._urlId!==t&&(this.fragmentError=0,this.loadError=0,this.details=void 0,this._urlId=t)}get audioGroupId(){var e;return(e=this.audioGroupIds)==null?void 0:e[this.urlId]}get textGroupId(){var e;return(e=this.textGroupIds)==null?void 0:e[this.urlId]}addFallback(e){this.url.push(e.url),this._attrs.push(e.attrs)}}function fo(s,e){const t=e.startPTS;if(oe(t)){let i=0,r;e.sn>s.sn?(i=t-s.start,r=s):(i=s.start-t,r=e),r.duration!==i&&(r.duration=i)}else e.sn>s.sn?s.cc===e.cc&&s.minEndPTS?e.start=s.start+(s.minEndPTS-s.start):e.start=s.start+s.duration:e.start=Math.max(s.start-e.duration,0)}function mh(s,e,t,i,r,n){i-t<=0&&(D.warn("Fragment should have a positive duration",e),i=t+e.duration,n=r+e.duration);let o=t,l=i;const c=e.startPTS,d=e.endPTS;if(oe(c)){const _=Math.abs(c-t);oe(e.deltaPTS)?e.deltaPTS=Math.max(_,e.deltaPTS):e.deltaPTS=_,o=Math.max(t,c),t=Math.min(t,c),r=Math.min(r,e.startDTS),l=Math.min(i,d),i=Math.max(i,d),n=Math.max(n,e.endDTS)}const u=t-e.start;e.start!==0&&(e.start=t),e.duration=i-e.start,e.startPTS=t,e.maxStartPTS=o,e.startDTS=r,e.endPTS=i,e.minEndPTS=l,e.endDTS=n;const h=e.sn;if(!s||h<s.startSN||h>s.endSN)return 0;let f;const p=h-s.startSN,y=s.fragments;for(y[p]=e,f=p;f>0;f--)fo(y[f],y[f-1]);for(f=p;f<y.length-1;f++)fo(y[f],y[f+1]);return s.fragmentHint&&fo(y[y.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,u}function lv(s,e){let t=null;const i=s.fragments;for(let l=i.length-1;l>=0;l--){const c=i[l].initSegment;if(c){t=c;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;let r=0,n;if(uv(s,e,(l,c)=>{l.relurl&&(r=l.cc-c.cc),oe(l.startPTS)&&oe(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,c.urlId=l.urlId,l.initSegment&&(c.initSegment=l.initSegment,t=l.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEac
vendor: 4,180 bytes, line 29
29h(c=>{var d;(!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){D.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=cv(s.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const a=e.fragments;if(r){D.warn("discontinuity sliding from playlist, take drift into account");for(let l=0;l<a.length;l++)a[l].cc+=r}e.skippedSegments&&(e.startCC=e.fragments[0].cc),dv(s.partList,e.partList,(l,c)=>{c.elementaryStreams=l.elementaryStreams,c.stats=l.stats}),n?mh(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):ph(s,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=s.driftStartTime,e.driftStart=s.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=s.driftEndTime,e.driftEnd=s.driftEnd,e.advancedDateTime=s.advancedDateTime}function cv(s,e,t){const i=dt({},s);return t&&t.forEach(r=>{delete i[r]}),Object.keys(e).forEach(r=>{const n=new Xu(e[r].attr,i[r]);n.isValid?i[r]=n:D.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[r].attr)}"`)}),i}function dv(s,e,t){if(s&&e){let i=0;for(let r=0,n=s.length;r<=n;r++){const a=s[r],o=e[r+i];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?t(a,o):i--}}}function uv(s,e,t){const i=e.skippedSegments,r=Math.max(s.startSN,e.startSN)-e.startSN,n=(s.fragmentHint?1:0)+(i?e.endSN:Math.min(s.endSN,e.endSN))-e.startSN,a=e.startSN-s.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;for(let c=r;c<=n;c++){const d=l[a+c];let u=o[c];i&&!u&&c<i&&(u=e.fragments[c]=d),d&&u&&t(d,u)}}function ph(s,e){const t=e.startSN+e.skippedSegments-s.startSN,i=s.fragments;t<0||t>=i.length||qo(e,i[t].start)}function qo(s,e){if(e){const t=s.fragments;for(let i=s.skippedSegments;i<t.length;i++)t[i].start+=e;s.fragmentHint&&(s.fragmentHint.start+=e)}}function hv(s,e=1/0){let t=1e3*s.targetduration;if(s.updated){const i=s.fragments;if(i.length&&t*4>e){const n=i[i.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function fv(s,e,t){if(!(s!=null&&s.details))return null;const i=s.details;let r=i.fragments[e-i.startSN];return r||(r=i.fragmentHint,r&&r.sn===e)?r:e<i.startSN&&t&&t.sn===e?t:null}function pd(s,e,t){var i;return s!=null&&s.details?gh((i=s.details)==null?void 0:i.partList,e,t):null}function gh(s,e,t){if(s)for(let i=s.length;i--;){const r=s[i];if(r.index===t&&r.fragment.sn===e)return r}return null}function ya(s){switch(s.details){case G.FRAG_LOAD_TIMEOUT:case G.KEY_LOAD_TIMEOUT:case G.LEVEL_LOAD_TIMEOUT:case G.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function gd(s,e){const t=ya(e);return s.default[`${t?"timeout":"error"}Retry`]}function $l(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function vd(s){return Pt(Pt({},s),{errorRetry:null,timeoutRetry:null})}function _a(s,e,t,i){return!!s&&e<s.maxNumRetry&&(mv(i)||!!t)}function mv(s){return s===0&&navigator.onLine===!1||!!s&&(s<400||s>499)}const vh={search:function(s,e){let t=0,i=s.length-1,r=null,n=null;for(;t<=i;){r=(t+i)/2|0,n=s[r];const a=e(n);if(a>0)t=r+1;else if(a<0)i=r-1;else return n}return null}};function pv(s,e,t){if(e===null||!Array.isArray(s)||!s.length||!oe(e))return null;const i=s[0].programDateTime;if(e<(i||0))return null;const r=s[s.length-1].endProgramDateTime;if(e>=(r||0))return null;t=t||0;for(let n=0;n<s.length;++n){const a=s[n];if(gv(e,t,a))return a}return null}function Jr(s,e,t=0,i=0){let r=null;if(s?r=e[s.sn-e[0].sn+1]||null:t===0&&e[0].start===0&&(r=e[0]),r&&Yo(t,i,r)===0)return r;const n=vh.search(e,Yo.bind(null,t,i));return n&&(n!==s||!r)?n:r}function Yo(s=0,e=0,t){if(t.start<=s&&t.start+t.duration>s)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=s?1:t.start-i>s&&t.start?-1:0}
29function gv(s,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>s}function vv(s,e){return vh.search(s,t=>t.cc<e?1:t.cc>e?-1:0)}const Ev=3e5;var wt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},jt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class yv{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=D.log.bind(D,"[info]:"),this.warn=D.warn.bind(D,"[warning]:"),this.error=D.error.bind(D,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(T.ERROR,this.onError,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(T.ERROR,this.onError,this),e.off(T.ERROR,this.onErrorOut,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){this.playlistError=0}stopLoad(){}getVariantLevelIndex(e){return(e==null?void 0:e.type)===ge.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,r;if(t.fatal)return;const n=this.hls,a=t.context;switch(t.details){case G.FRAG_LOAD_ERROR:case G.FRAG_LOAD_TIMEOUT:case G.KEY_LOAD_ERROR:case G.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case G.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction={action:wt.DoNothing,flags:jt.None};return}case G.FRAG_GAP:case G.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=wt.SendAlternateToPenaltyBox;return}case G.LEVEL_EMPTY_ERROR:case G.LEVEL_PARSING_ERROR:{var o,l;const c=t.parent===ge.MAIN?t.level:n.loadLevel;t.details===G.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 G.LEVEL_LOAD_ERROR:case G.LEVEL_LOAD_TIMEOUT:typeof(a==null?void 0:a.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.level));return;case G.AUDIO_TRACK_LOAD_ERROR:case G.AUDIO_TRACK_LOAD_TIMEOUT:case G.SUBTITLE_LOAD_ERROR:case G.SUBTITLE_TRACK_LOAD_TIMEOUT:if(a){const c=n.levels[n.loadLevel];if(c&&(a.type===Ce.AUDIO_TRACK&&a.groupId===c.audioGroupId||a.type===Ce.SUBTITLE_TRACK&&a.groupId===c.textGroupId)){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=wt.SendAlternateToPenaltyBox,t.errorAction.flags=jt.MoveAllAlternatesMatchingHost;return}}return;case G.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const c=n.levels[n.loadLevel],d=c==null?void 0:c.attrs["HDCP-LEVEL"];d&&(t.errorAction={action:wt.SendAlternateToPenaltyBox,flags:jt.MoveAllAlternatesMatchingHDCP,hdcpLevel:d})}return;case G.BUFFER_ADD_CODEC_ERROR:case G.REMUX_ALLOC_ERROR:t.errorAction=this.getLevelSwitchAction(t,(r=t.level)!=null?r:n.loadLevel);return;case G.INTERNAL_EXCEPTION:case G.BUFFER_APPENDING_ERROR:case G.BUFFER_APPEND_ERROR:case G.BUFFER_FULL_ERROR:case G.LEVEL_SWITCH_ERROR:case G.BUFFER_STALLED_ERROR:case G.BUFFER_SEEK_OVER_HOLE:case G.BUFFER_NUDGE_ON_STALL:t.errorAction={action:wt.DoNothing,flags:jt.None};return}if(t.type===me.KEY_SYSTEM_ERROR){const c=this.getVariantLevelIndex(t.frag);t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c);return}}getPlaylistRetryOrSwitchAction(e,t){var i;const r=this.hls,n=gd(r.config.playlistLoadPolicy,e),a=this.playlistError++,o=(i=e.response)==null?void 0:i.code;if(_a(n,a,ya(e),o))return{action:wt.RetryRequest,flags:jt.None,retryConfig:n,retryCount:a};const c=this.getLevelSwitchAction(e,t);return n&&(c.retryConfig=n,c.retryCount=a),c}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:n,keyLoadPolicy:a}=t.config,o=gd(e.details.startsWith("key")?a:n,e),l=t.levels.reduce((u,h)=>u+h.fragmentError,0);if(r){var c;e.details!==G.FRAG_GAP&&r.fragmentError++;const u=(c=e.response)==null?void 0:c.code;if(_a(o,l,ya(e),u))return{action:wt.RetryRequest,flags:jt.None,retryConfig:o,retryCount:l}}const d=this.getLevelSwitchAction(e,i);return o&&(d.retryConfig=o,d.retryCount=l),d}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const r=this.hls.levels[t];if(r&&(r.loadError++,i.autoLevelEnabled)){var n,a;let o=-1;const{levels:l,loadLevel:c,minAutoLevel:d,maxAutoLevel:u}=i,h=(n=e.frag)==null?void 0:n.type,{type:f,groupId:p}=(a=e.context)!=null?a:{};for(let y=l.length;y--;){const _=(y+c)%l.length;if(_!==c&&_>=d&&_<=u&&l[_].loadError===0){const A=l[_];if(e.details===G.FRAG_GAP&&e.frag){const x=l[_].details;if(x){const I=Jr(e.frag,x.fragments,e.frag.start);if(I!=null&&I.gap)continue}}else{if(f===Ce.AUDIO_TRACK&&p===A.audioGroupId||f===Ce.SUBTITLE_TRACK&&p===A.textGroupId)continue;if(h===ge.AUDIO&&r.audioGroupId===A.audioGroupId||h===ge.SUBTITLE&&r.textGroupId===A.textGroupId)continue}o=_;break}}if(o>-1&&i.loadLevel!==o)return e.levelRetry=!0,this.playlistError=0,{action:wt.SendAlternateToPenaltyBox,flags:jt.None,nextAutoLevel:o}}return{action:wt.SendAlternateToPenaltyBox,flags:jt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case wt.DoNothing:break;case wt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==G.FRAG_GAP&&(t.fatal=!0);break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:r,hdcpLevel:n,nextAutoLevel:a}=i;switch(r){case jt.None:this.switchLevel(e,a);break;case jt.MoveAllAlternatesMatchingHost:i.resolved||(i.resolved=this.redundantFailover(e));break;case jt.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=Ko[Ko.indexOf(n)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.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)}redundantFailover(e){const{hls:t,penalizedRenditions:i}=this,r=e.parent===ge.MAIN?e.level:t.loadLevel,n=t.levels[r],a=n.url.length,o=e.frag?e.frag.urlId:n.urlId;n.urlId===o&&(!e.frag||n.details)&&this.penalizeRendition(n,e);for(let l=1;l<a;l++){const c=(o+l)%a,d=i[c];if(!d||_v(d,e,i[o]))return this.warn(`Switching to Redundant Stream ${c+1}/${a}: "${n.url[c]}" after ${e.details}
29`),this.playlistError=0,t.levels.forEach(u=>{u.urlId=c}),t.nextLoadLevel=r,!0}return!1}penalizeRendition(e,t){const{penalizedRenditions:i}=this,r=i[e.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};r.lastErrorPerfMs=performance.now(),r.errors.push(t),r.details=e.details,i[e.urlId]=r}}function _v(s,e,t){if(performance.now()-s.lastErrorPerfMs>Ev)return!0;const i=s.details;if(e.details===G.FRAG_GAP&&i&&e.frag){const r=e.frag.start,n=Jr(null,i.fragments,r);if(n&&!n.gap)return!0}if(t&&s.errors.length<t.errors.length){const r=s.errors[s.errors.length-1];if(i&&r.frag&&e.frag&&Math.abs(r.frag.start-e.frag.start)>i.targetduration*3)return!0}return!1}class Gl{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=D.log.bind(D,`${t}:`),this.warn=D.warn.bind(D,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){clearTimeout(this.timer),this.timer=-1}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t){const i=t==null?void 0:t.renditionReports;if(i){let r=-1;for(let n=0;n<i.length;n++){const a=i[n];let o;try{o=new self.URL(a.URI,t.url).href}catch(l){D.warn(`Could not construct new URL for Rendition Report: ${l}`),o=a.URI||""}if(o===e){r=n;break}else o===e.substring(0,o.length)&&(r=n)}if(r!==-1){const n=i[r],a=parseInt(n["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let o=parseInt(n["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const l=Math.min(t.age-t.partTarget,t.targetduration);o>=0&&l>t.partTarget&&(o+=1)}return new md(a,o>=0?o:void 0,Yr.No)}}}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,i){const{details:r,stats:n}=t,a=self.performance.now(),o=n.loading.first?Math.max(0,a-n.loading.first):0;if(r.advancedDateTime=Date.now()-o,r.live||i!=null&&i.live){if(r.reloaded(i),i&&this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),i&&r.fragments.length>0&&lv(i,r),!this.canLoad||!r.live)return;let l,c,d;if(r.canBlockReload&&r.endSN&&r.advanced){const _=this.hls.config.lowLatencyMode,A=r.lastPartSn,x=r.endSN,I=r.lastPartIndex,P=I!==-1,L=A===x,B=_?0:I;P?(c=L?x+1:A,d=L?B:I+1):c=x+1;const O=r.age,F=O+r.ageHeader;let V=Math.min(F-r.partTarget,r.targetduration*1.5);if(V>0){if(i&&V>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${V} with playlist age: ${r.age}`),V=0;else{const $=Math.floor(V/r.targetduration);if(c+=$,d!==void 0){const j=Math.round(V%r.targetduration/r.partTarget);d+=j}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${O.toFixed(2)}s goal: ${V} skip sn ${$} to part ${d}`)}r.tuneInGoal=V}if(l=this.getDeliveryDirectives(r,t.deliveryDirectives,c,d),_||!L){this.loadPlaylist(l);return}}else(r.canBlockReload||r.canSkipUntil)&&(l=this.getDeliveryDirectives(r,t.deliveryDirectives,c,d));const u=this.hls.mainForwardBufferInfo,h=u?u.end-u.len:0,f=(r.edge-h)*1e3,p=hv(r,f);r.updated&&a>this.requestScheduled+p&&(this.requestScheduled=n.loading.start),c!==void 0&&r.canBlockReload?this.requestScheduled=n.loading.first+p-(r.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+p<a?this.requestScheduled=a:this.requestScheduled-a<=0&&(this.requestScheduled+=p);let y=this.requestScheduled-a;y=Math.max(0,y),this.log(`reload live playlist ${e} in ${Math.round(y)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(l),y)}else this.clearTimer()}getDeliveryDirectives(e,t,i,r){let n=ov(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=Yr.No),new md(i,r,n)}checkRetry(e){const t=e.details,i=ya(e),r=e.errorAction,{action:n,retryCount:a=0,retryConfig:o}=r||{},l=!!r&&!!o&&(n===wt.RetryRequest||!r.resolved&&n===wt.SendAlternateToPenaltyBox);if(l){var c;if(this.requestScheduled=-1,a>=o.maxNumRetry)return!1;if(i&&(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=$l(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,r.resolved=!0}return l}}let mo;class Tv extends Gl{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-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(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(T.LEVEL_LOADED,this.onLevelLoaded,this),e.on(T.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(T.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(T.FRAG_LOADED,this.onFragLoaded,this),e.on(T.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(T.LEVEL_LOADED,this.onLevelLoaded,this),e.off(T.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(T.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(T.FRAG_LOADED,this.onFragLoaded,this),e.off(T.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}
29startLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.startLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[]}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=[],r={};let n;t.levels.forEach(a=>{var o;const l=a.attrs;((o=a.audioCodec)==null?void 0:o.indexOf("mp4a.40.34"))!==-1&&(mo||(mo=/chrome|firefox/i.test(navigator.userAgent)),mo&&(a.audioCodec=void 0));const{AUDIO:c,CODECS:d,"FRAME-RATE":u,"PATHWAY-ID":h,RESOLUTION:f,SUBTITLES:p}=l,_=`${`${h||"."}-`}${a.bitrate}-${f}-${u}-${d}`;n=r[_],n?n.addFallback(a):(n=new Zr(a),r[_]=n,i.push(n)),Ta(n,"audio",c),Ta(n,"text",p)}),this.filterAndSortMediaOptions(i,t)}filterAndSortMediaOptions(e,t){let i=[],r=[],n=!1,a=!1,o=!1,l=e.filter(({audioCodec:f,videoCodec:p,width:y,height:_,unknownCodecs:A})=>(n||(n=!!(y&&_)),a||(a=!!p),o||(o=!!f),!(A!=null&&A.length)&&(!f||co(f,"audio"))&&(!p||co(p,"video"))));if((n||a)&&o&&(l=l.filter(({videoCodec:f,width:p,height:y})=>!!f||!!(p&&y))),l.length===0){Promise.resolve().then(()=>{if(this.hls){const f=new Error("no level with compatible codecs found in manifest");this.hls.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:f,reason:f.message})}});return}t.audioTracks&&(i=t.audioTracks.filter(f=>!f.audioCodec||co(f.audioCodec,"audio")),Ed(i)),t.subtitles&&(r=t.subtitles,Ed(r));const c=l.slice(0);l.sort((f,p)=>f.attrs["HDCP-LEVEL"]!==p.attrs["HDCP-LEVEL"]?(f.attrs["HDCP-LEVEL"]||"")>(p.attrs["HDCP-LEVEL"]||"")?1:-1:f.bitrate!==p.bitrate?f.bitrate-p.bitrate:f.attrs["FRAME-RATE"]!==p.attrs["FRAME-RATE"]?f.attrs.decimalFloatingPoint("FRAME-RATE")-p.attrs.decimalFloatingPoint("FRAME-RATE"):f.attrs.SCORE!==p.attrs.SCORE?f.attrs.decimalFloatingPoint("SCORE")-p.attrs.decimalFloatingPoint("SCORE"):n&&f.height!==p.height?f.height-p.height:0);let d=c[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==c.length)){for(let f=0;f<c.length;f++)if(c[f].pathwayId===l[0].pathwayId){d=c[f];break}}this._levels=l;for(let f=0;f<l.length;f++)if(l[f]===d){this._firstLevel=f,this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${d.bitrate}`);break}const u=o&&!a,h={levels:l,audioTracks:i,subtitleTracks:r,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:o,video:a,altAudio:!u&&i.some(f=>!!f.url)};this.hls.trigger(T.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(T.ERROR,{type:me.OTHER_ERROR,details:G.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:d,reason:d.message}),u)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,i===e&&a.details&&r&&n===o)return;this.log(`Switching to level ${e}${o?" with Pathway "+o:""} from level ${i}${n?" with Pathway "+n:""}`);const l=dt({},a,{level:e,maxBitrate:a.maxBitrate,attrs:a.attrs,uri:a.uri,urlId:a.urlId});delete l._attrs,delete l._urlId,this.hls.trigger(T.LEVEL_SWITCHING,l);const c=a.details;if(!c||c.live){const d=this.switchParams(a.uri,r==null?void 0:r.details);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._firstLevel}else return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===Ce.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragLoaded(e,{frag:t}){if(t!==void 0&&t.type===ge.MAIN){const i=this._levels[t.level];i!==void 0&&(i.loadError=0)}}onLevelLoaded(e,t){var i;const{level:r,details:n}=t,a=this._levels[r];if(!a){var o;this.warn(`Invalid level index ${r}`),(o=t.deliveryDirectives)!=null&&o.skip&&(n.deltaUpdateFailed=!0);return}r===this.currentLevelIndex?(a.fragmentError===0&&(a.loadError=0),this.playlistLoaded(r,t,a.details)):(i=t.deliveryDirectives)!=null&&i.skip&&(n.deltaUpdateFailed=!0)}onAudioTrackSwitched(e,t){const i=this.currentLevel;if(!i)return;const r=this.hls.audioTracks[t.id].groupId;if(i.audioGroupIds&&i.audioGroupId!==r){let n=-1;for(let a=0;a<i.audioGroupIds.length;a++)if(i.audioGroupIds[a]===r){n=a;break}n!==-1&&n!==i.urlId&&(i.urlId=n,this.canLoad&&this.startLoad())}}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){const r=i.urlId;let n=i.uri;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}const a=i.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${a?" Pathway "+a:""} URI ${r+1}/${i.url.length} ${n}`),this.clearTimer(),this.hls.trigger(T.LEVEL_LOADING,{url:n,level:t,id:r,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,t){const i=(n,a)=>a!==t,r=this._levels.filter((n,a)=>a!==e?!0:n.url.length>1&&t!==void 0?(n.url=n.url.filter(i),n.audioGroupIds&&(n.audioGroupIds=n.audioGroupIds.filter(i)),n.textGroupIds&&(n.textGroupIds=n.textGroupIds.filter(i)),n.urlId=0,!0):(this.steering&&this.steering.removeLevel(n),!1));this.hls.trigger(T.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(e,{levels:t}){t.forEach((i,r)=>{const{details:n}=i;
29n!=null&&n.fragments&&n.fragments.forEach(a=>{a.level=r})}),this._levels=t}}function Ta(s,e,t){t&&(e==="audio"?(s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds[s.url.length-1]=t):e==="text"&&(s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds[s.url.length-1]=t))}function Ed(s){const e={};s.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}var vt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class bv{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(T.BUFFER_APPENDED,this.onBufferAppended,this),e.on(T.FRAG_BUFFERED,this.onFragBuffered,this),e.on(T.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(T.BUFFER_APPENDED,this.onBufferAppended,this),e.off(T.FRAG_BUFFERED,this.onFragBuffered,this),e.off(T.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let r=i.length;r--;){const n=i[r];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:i}=this,r=Object.keys(i);for(let n=r.length;n--;){const a=i[r[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,i,r){this.timeRanges&&(this.timeRanges[e]=t);const n=(r==null?void 0:r.fragment.sn)||-1;Object.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===i&&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:i,part:r}=e;if(!t||i.sn==="initSegment")return;const n=Cs(i),a=this.fragments[n];if(!a||a.buffered&&i.gap)return;const o=!i.relurl;Object.keys(t).forEach(l=>{const c=i.elementaryStreams[l];if(!c)return;const d=t[l],u=o||c.partial===!0;a.range[l]=this.getBufferedTimes(i,r,u,d)}),a.loaded=null,Object.keys(a.range).length?(a.buffered=!0,(a.body.endList=i.endList||a.body.endList)&&(this.endListFragments[a.body.type]=a),pn(a)||this.removeParts(i.sn-1,i.type)):this.removeFragment(a.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(r=>r.fragment.sn>=e))}fragBuffered(e,t){const i=Cs(e);let r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,i,r){const n={time:[],partial:i},a=e.start,o=e.end,l=e.minEndPTS||o,c=e.maxStartPTS||a;for(let d=0;d<r.length;d++){const u=r.start(d)-this.bufferPadding,h=r.end(d)+this.bufferPadding;if(c>=u&&l<=h){n.time.push({startPTS:Math.max(a,r.start(d)),endPTS:Math.min(o,r.end(d))});break}else if(a<h&&o>u)n.partial=!0,n.time.push({startPTS:Math.max(a,r.start(d)),endPTS:Math.min(o,r.end(d))});else if(o<=u)break}return n}getPartialFragment(e){let t=null,i,r,n,a=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(c=>{const d=l[c];d&&pn(d)&&(r=d.body.start-o,n=d.body.end+o,e>=r&&e<=n&&(i=Math.min(e-r,n-e),a<=i&&(t=d.body,a=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||pn(t))}getState(e){const t=Cs(e),i=this.fragments[t];return i?i.buffered?pn(i)?vt.PARTIAL:vt.OK:vt.APPENDING:vt.NOT_LOADED}isTimeBuffered(e,t,i){let r,n;for(let a=0;a<i.length;a++){if(r=i.start(a)-this.bufferPadding,n=i.end(a)+this.bufferPadding,e>=r&&t<=n)return!0;if(t<=r)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:r}=t;if(i.sn==="initSegment"||i.bitrateTest)return;const n=r?null:t,a=Cs(i);this.fragments[a]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:r,timeRanges:n}=t;if(i.sn==="initSegment")return;const a=i.type;if(r){let o=this.activePartLists[a];o||(this.activePartLists[a]=o=[]),o.push(r)}
vendor: 4,479 bytes, line 29
29this.timeRanges=n,Object.keys(n).forEach(o=>{const l=n[o];this.detectEvictedFragments(o,l,a,r)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Cs(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const l=o.body;l.type!==i||r&&!l.gap||l.start<t&&l.end>e&&(o.buffered||n)&&this.removeFragment(l)})}removeFragment(e){const t=Cs(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const r=e.sn;this.activePartLists[e.type]=i.filter(n=>n.fragment.sn!==r)}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 pn(s){var e,t,i;return s.buffered&&(s.body.gap||((e=s.range.video)==null?void 0:e.partial)||((t=s.range.audio)==null?void 0:t.partial)||((i=s.range.audiovideo)==null?void 0:i.partial))}function Cs(s){return`${s.type}_${s.level}_${s.urlId}_${s.sn}`}const yd=Math.pow(2,17);class Av{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 i=e.url;if(!i)return Promise.reject(new Oi({type:me.NETWORK_ERROR,details:G.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(f=>f[0]==="GAP")){l(Td(e));return}else e.gap=!1;const c=this.loader=e.loader=n?new n(r):new a(r),d=_d(e),u=vd(r.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:yd};e.stats=c.stats,c.load(d,h,{onSuccess:(f,p,y,_)=>{this.resetLoader(e,c);let A=f.data;y.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(A.slice(0,16)),A=A.slice(16)),o({frag:e,part:null,payload:A,networkDetails:_})},onError:(f,p,y,_)=>{this.resetLoader(e,c),l(new Oi({type:me.NETWORK_ERROR,details:G.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Pt({url:i,data:void 0},f),error:new Error(`HTTP Error ${f.code} ${f.text}`),networkDetails:y,stats:_}))},onAbort:(f,p,y)=>{this.resetLoader(e,c),l(new Oi({type:me.NETWORK_ERROR,details:G.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:y,stats:f}))},onTimeout:(f,p,y)=>{this.resetLoader(e,c),l(new Oi({type:me.NETWORK_ERROR,details:G.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:y,stats:f}))},onProgress:(f,p,y,_)=>{t&&t({frag:e,part:null,payload:y,networkDetails:_})}})})}loadPart(e,t,i){this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(Td(e,t));return}const c=this.loader=e.loader=n?new n(r):new a(r),d=_d(e,t),u=vd(r.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:yd};t.stats=c.stats,c.load(d,h,{onSuccess:(f,p,y,_)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const A={frag:e,part:t,payload:f.data,networkDetails:_};i(A),o(A)},onError:(f,p,y,_)=>{this.resetLoader(e,c),l(new Oi({type:me.NETWORK_ERROR,details:G.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Pt({url:d.url,data:void 0},f),error:new Error(`HTTP Error ${f.code} ${f.text}`),networkDetails:y,stats:_}))},onAbort:(f,p,y)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),l(new Oi({type:me.NETWORK_ERROR,details:G.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:y,stats:f}))},onTimeout:(f,p,y)=>{this.resetLoader(e,c),l(new Oi({type:me.NETWORK_ERROR,details:G.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:y,stats:f}))}})})}updateStatsFromPart(e,t){const i=e.stats,r=t.stats,n=r.total;if(i.loaded+=r.loaded,n){const l=Math.round(e.duration/t.duration),c=Math.min(Math.round(i.loaded/n),l),u=(l-c)*Math.round(i.loaded/c);i.total=i.loaded+u}else i.total=Math.max(i.loaded,i.total);const a=i.loading,o=r.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}
vendor: 4,554 bytes, line 29
29resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function _d(s,e=null){const t=e||s,i={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(oe(r)&&oe(n)){var a;let o=r,l=n;if(s.sn==="initSegment"&&((a=s.decryptdata)==null?void 0:a.method)==="AES-128"){const c=n-r;c%16&&(l=n+(16-c%16)),r!==0&&(i.resetIV=!0,o=r-16)}i.rangeStart=o,i.rangeEnd=l}return i}function Td(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),i={type:me.MEDIA_ERROR,details:G.FRAG_GAP,fatal:!1,frag:s,error:t,networkDetails:null};return e&&(i.part=e),(e||s).stats.aborted=!0,new Oi(i)}class Oi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Sv{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const t in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[t].loader;if(i){if(e&&e!==i.context.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=G.KEY_LOAD_ERROR,i,r,n){return new Oi({type:me.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:i,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:r}=e;for(let n=0;n<t.length;n++){const a=t[n];if(r<=a.cc&&(i==="initSegment"||a.sn==="initSegment"||i<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 i,r;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,G.KEY_LOAD_ERROR,c))}const a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,G.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));let o=this.keyUriToKeyInfo[a];if((i=o)!=null&&i.decryptdata.key)return n.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((r=o)!=null&&r.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,G.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const r=this.emeController.loadKey(i);if(r)return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,i))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,r=i.loader,n=new r(i);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=i.keyLoadPolicy.default,d={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(h,f,p,y)=>{const{frag:_,keyInfo:A,url:x}=p;if(!_.decryptdata||A!==this.keyUriToKeyInfo[x])return o(this.createKeyLoadError(_,G.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),y));A.decryptdata.key=_.decryptdata.key=new Uint8Array(h.data),_.keyLoader=null,A.loader=null,a({frag:_,keyInfo:A})},onError:(h,f,p,y)=>{this.resetLoader(f),o(this.createKeyLoadError(t,G.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),p,Pt({url:l.url,data:void 0},h)))},onTimeout:(h,f,p)=>{this.resetLoader(f),o(this.createKeyLoadError(t,G.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),p))},onAbort:(h,f,p)=>{this.resetLoader(f),o(this.createKeyLoadError(t,G.INTERNAL_ABORTED,new Error("key loading aborted"),p))}};n.load(l,d,u)})}
29resetLoader(e){const{frag:t,keyInfo:i,url:r}=e,n=i.loader;t.keyLoader===n&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],n&&n.destroy()}}class xv{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(){}}const Iv={length:0,start:()=>0,end:()=>0};class Ye{static isBuffered(e,t){try{if(e){const i=Ye.getBuffered(e);for(let r=0;r<i.length;r++)if(t>=i.start(r)&&t<=i.end(r))return!0}}catch{}return!1}static bufferInfo(e,t,i){try{if(e){const r=Ye.getBuffered(e),n=[];let a;for(a=0;a<r.length;a++)n.push({start:r.start(a),end:r.end(a)});return this.bufferedInfo(n,t,i)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.sort(function(c,d){const u=c.start-d.start;return u||d.end-c.end});let r=[];if(i)for(let c=0;c<e.length;c++){const d=r.length;if(d){const u=r[d-1].end;e[c].start-u<i?e[c].end>u&&(r[d-1].end=e[c].end):r.push(e[c])}else r.push(e[c])}else r=e;let n=0,a,o=t,l=t;for(let c=0;c<r.length;c++){const d=r[c].start,u=r[c].end;if(t+i>=d&&t<u)o=d,l=u,n=l-t;else if(t+i<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 D.log("failed to get media.buffered",t),Iv}}}class Hl{constructor(e,t,i,r=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=gn(),this.buffering={audio:gn(),video:gn(),audiovideo:gn()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=a}}function gn(){return{start:0,executeStart:0,executeEnd:0,end:0}}function Eh(s,e){let t=null;for(let i=0,r=s.length;i<r;i++){const n=s[i];if(n&&n.cc===e){t=n;break}}return t}function Lv(s,e,t){return!!(e.details&&(t.endCC>t.startCC||s&&s.cc<t.startCC))}function wv(s,e,t=0){const i=s.fragments,r=e.fragments;if(!r.length||!i.length){D.log("No fragments to align");return}const n=Eh(i,r[0].cc);if(!n||n&&!n.startPTS){D.log("No frag in previous level to align on");return}return n}function bd(s,e){if(s){const t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function Vl(s,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)bd(t[i],s);e.fragmentHint&&bd(e.fragmentHint,s),e.alignedSliding=!0}function Rv(s,e,t){e&&(kv(s,t,e),!t.alignedSliding&&e.details&&Dv(t,e.details),!t.alignedSliding&&e.details&&!t.skippedSegments&&ph(e.details,t))}function kv(s,e,t){if(Lv(s,t,e)){const i=wv(t.details,e);i&&oe(i.start)&&(D.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),Vl(i.start,e))}}function Dv(s,e){if(!e.fragments.length||!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=e.fragments[0].programDateTime,i=s.fragments[0].programDateTime,r=(i-t)/1e3+e.fragments[0].start;r&&oe(r)&&(D.log(`Adjusting PTS using programDateTime delta ${i-t}ms, sliding:${r.toFixed(3)} ${s.url} `),Vl(r,s))}function yh(s,e){if(!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=s.fragments,i=e.fragments;if(!t.length||!i.length)return;const r=Math.round(i.length/2)-1,n=i[r],a=Eh(t,n.cc)||t[Math.round(t.length/2)-1],o=n.programDateTime,l=a.programDateTime;if(o===null||l===null)return;const c=(l-o)/1e3-(a.start-n.start);Vl(c,s)}class Cv{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}
vendor: 10,692 bytes, line 29
29decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class Mv{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 Pv(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?Ss(s,0,e-t):s}class Ov{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),i=new Uint32Array(4);for(let r=0;r<4;r++)i[r]=t.getUint32(r*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],n=i[1],a=i[2],o=i[3],l=this.invSubMix,c=l[0],d=l[1],u=l[2],h=l[3],f=new Uint32Array(256);let p=0,y=0,_=0;for(_=0;_<256;_++)_<128?f[_]=_<<1:f[_]=_<<1^283;for(_=0;_<256;_++){let A=y^y<<1^y<<2^y<<3^y<<4;A=A>>>8^A&255^99,e[p]=A,t[A]=p;const x=f[p],I=f[x],P=f[I];let L=f[A]*257^A*16843008;r[p]=L<<24|L>>>8,n[p]=L<<16|L>>>16,a[p]=L<<8|L>>>24,o[p]=L,L=P*16843009^I*65537^x*257^p*16843008,c[A]=L<<24|L>>>8,d[A]=L<<16|L>>>16,u[A]=L<<8|L>>>24,h[A]=L,p?(p=x^f[f[f[P^x]]],y^=f[f[y]]):p=y=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,r=0;for(;r<t.length&&i;)i=t[r]===this.key[r],r++;if(i)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,h=this.rcon,f=this.invSubMix,p=f[0],y=f[1],_=f[2],A=f[3];let x,I;for(o=0;o<a;o++){if(o<n){x=c[o]=t[o];continue}I=x,o%n===0?(I=I<<8|I>>>24,I=u[I>>>24]<<24|u[I>>>16&255]<<16|u[I>>>8&255]<<8|u[I&255],I^=h[o/n|0]<<24):n>6&&o%n===4&&(I=u[I>>>24]<<24|u[I>>>16&255]<<16|u[I>>>8&255]<<8|u[I&255]),c[o]=x=(c[o-n]^I)>>>0}for(l=0;l<a;l++)o=a-l,l&3?I=c[o]:I=c[o-4],l<4||o<=4?d[l]=I:d[l]=p[u[I>>>24]]^y[u[I>>>16&255]]^_[u[I>>>8&255]]^A[u[I&255]],d[l]=d[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const r=this.keySize+6,n=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,l=o[0],c=o[1],d=o[2],u=o[3],h=this.uint8ArrayToUint32Array_(i);let f=h[0],p=h[1],y=h[2],_=h[3];const A=new Int32Array(e),x=new Int32Array(A.length);let I,P,L,B,O,F,V,$,j,z,ve,qe,pe,Le;const Pe=this.networkToHostOrderSwap;for(;t<A.length;){for(j=Pe(A[t]),z=Pe(A[t+1]),ve=Pe(A[t+2]),qe=Pe(A[t+3]),O=j^n[0],F=qe^n[1],V=ve^n[2],$=z^n[3],pe=4,Le=1;Le<r;Le++)I=l[O>>>24]^c[F>>16&255]^d[V>>8&255]^u[$&255]^n[pe],P=l[F>>>24]^c[V>>16&255]^d[$>>8&255]^u[O&255]^n[pe+1],L=l[V>>>24]^c[$>>16&255]^d[O>>8&255]^u[F&255]^n[pe+2],B=l[$>>>24]^c[O>>16&255]^d[F>>8&255]^u[V&255]^n[pe+3],O=I,F=P,V=L,$=B,pe=pe+4;I=a[O>>>24]<<24^a[F>>16&255]<<16^a[V>>8&255]<<8^a[$&255]^n[pe],P=a[F>>>24]<<24^a[V>>16&255]<<16^a[$>>8&255]<<8^a[O&255]^n[pe+1],L=a[V>>>24]<<24^a[$>>16&255]<<16^a[O>>8&255]<<8^a[F&255]^n[pe+2],B=a[$>>>24]<<24^a[O>>16&255]<<16^a[F>>8&255]<<8^a[V&255]^n[pe+3],x[t]=Pe(I^f),x[t+1]=Pe(B^p),x[t+2]=Pe(L^y),x[t+3]=Pe(P^_),f=j,p=z,y=ve,_=qe,t=t+4}return x.buffer}}const Nv=16;class Wl{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 i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}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 i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Pv(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i){return this.useSoftware?new Promise((r,n)=>{this.softwareDecrypt(new Uint8Array(e),t,i);const a=this.flush();a?r(a.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)}softwareDecrypt(e,t,i){const{currentIV:r,currentResult:n,remainderData:a}=this;this.logOnce("JS AES decrypt"),a&&(e=ws(a,e),this.remainderData=null);const o=this.getValidChunk(e);if(!o.length)return null;r&&(i=r);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new Ov),l.expandKey(t);const c=n;return this.currentResult=l.decrypt(o.buffer,0,i),this.currentIV=Ss(o,-16).buffer,c||null}webCryptoDecrypt(e,t,i){const r=this.subtle;return(this.key!==t||!this.fastAesKey)&&(this.key=t,this.fastAesKey=new Mv(r,t)),this.fastAesKey.expandKey().then(n=>r?(this.logOnce("WebCrypto AES decrypt"),new Cv(r,new Uint8Array(i)).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(D.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,i)))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const r=this.flush();if(r)return r.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%Nv;return i!==e.length&&(t=Ss(e,0,i),this.remainderData=Ss(e,i)),t}logOnce(e){this.logEnabled&&(D.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Fv={toString:function(s){let e="";const t=s.length;for(let i=0;i<t;i++)e+=`[${s.start(i).toFixed(3)}-${s.end(i).toFixed(3)}]`;return e}},q={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 Kl extends xv{constructor(e,t,i,r,n){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=q.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=r,this.log=D.log.bind(D,`${r}:`),this.warn=D.warn.bind(D,`${r}:`),this.hls=e,this.fragmentLoader=new Av(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Wl(e.config),e.on(T.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=q.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const i=t.partList;if(i!=null&&i.length){const n=i[i.length-1];return Ye.isBuffered(this.media,n.start+n.duration/2)}const r=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(r)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levels[this.levelLastLoaded])==null?void 0:e.details}}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const r=this.config;this.levels&&r.autoStartLoad&&this.state===q.STOPPED&&this.startLoad(r.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:i,mediaBuffer:r,state:n}=this,a=i?i.currentTime:0,o=Ye.bufferInfo(r||i,a,e.maxBufferHole);if(this.log(`media seeking to ${oe(a)?a.toFixed(3):a}, state: ${n}`),this.state===q.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)}}i&&(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.stopLoad(),super.onHandlerDestroying()}onHandlerDestroyed(){this.state=q.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,i){this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const r=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,i,r).then(n=>{if(!n)return;const a=this.state;if(this.fragContextChanged(e)){(a===q.FRAG_LOADING||!this.fragCurrent&&a===q.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=q.IDLE);return}
29"payload"in n&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(T.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===q.STOPPED||this.state===q.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===vt.APPENDING){const n=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,n),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength);this.reduceMaxBufferLength(o)&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===vt.PARTIAL&&i.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,i=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:i};this.hls.trigger(T.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{if(!i||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:r}=this,{payload:n}=i,a=e.decryptdata;if(n&&n.byteLength>0&&a&&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 r.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:e}),l}).then(l=>{const c=self.performance.now();return r.trigger(T.FRAG_DECRYPTED,{frag:e,payload:l,stats:{tstart:o,tdecrypt:c}}),i.payload=l,i})}return i}).then(i=>{const{fragCurrent:r,hls:n,levels:a}=this;if(!a)throw new Error("init load aborted, missing levels");const o=e.stats;this.state=q.IDLE,t.fragmentError=0,e.data=new Uint8Array(i.payload),o.parsing.start=o.buffering.start=self.performance.now(),o.parsing.end=o.buffering.end=self.performance.now(),i.frag===r&&n.trigger(T.FRAG_BUFFERED,{stats:o,frag:r,part:null,id:e.type}),this.tick()}).catch(i=>{this.state===q.STOPPED||this.state===q.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.level!==t.level||e.sn!==t.sn||e.urlId!==t.urlId}fragBufferedComplete(e,t){var i,r,n,a;const o=this.mediaBuffer?this.mediaBuffer:this.media;this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===ge.MAIN?"level":"track"} ${e.level} (frag:[${((i=e.startPTS)!=null?i:NaN).toFixed(3)}-${((r=e.endPTS)!=null?r:NaN).toFixed(3)}] > buffer:${o?Fv.toString(Ye.getBuffered(o)):"(detached)"})`),this.state=q.IDLE,o&&(!this.loadedmetadata&&e.type==ge.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:i,part:r,partsLoaded:n}=e,a=!n||n.length===0||n.some(l=>!l),o=new Hl(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,r){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=q.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(d=>{if(!this.fragContextChanged(d.frag))return this.hls.trigger(T.KEY_LOADED,d),this.state===q.KEY_LOADING&&(this.state=q.IDLE),d}),this.hls.trigger(T.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),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const d=a.partList;if(d&&r){i>e.end&&a.fragmentHint&&(e=a.fragmentHint);const u=this.getNextPart(d,e,i);if(u>-1){const h=d[u];this.log(`Loading part sn: ${e.sn} p: ${h.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(i.toFixed(3))}`),this.nextLoadPosition=h.start+h.duration,this.state=q.FRAG_LOADING;let f;return o?f=o.then(p=>!p||this.fragContextChanged(p.frag)?null:this.doFragPartsLoad(e,h,t,r)).catch(p=>this.handleFragLoadError(p)):f=this.doFragPartsLoad(e,h,t,r).catch(p=>this.handleFragLoadError(p)),this.hls.trigger(T.FRAG_LOADING,{frag:e,part:h,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):f}else if(!e.url||this.loadedEndOfParts(d,i))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(i.toFixed(3))}`),oe(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=q.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,r)).catch(d=>
vendor: 4,327 bytes, line 29
29this.handleFragLoadError(d)):c=Promise.all([this.fragmentLoader.load(e,l?r:void 0),o]).then(([d])=>(!l&&d&&r&&r(d),d)).catch(d=>this.handleFragLoadError(d)),this.hls.trigger(T.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c}doFragPartsLoad(e,t,i,r){return new Promise((n,a)=>{var o;const l=[],c=(o=i.details)==null?void 0:o.partList,d=u=>{this.fragmentLoader.loadPart(e,u,r).then(h=>{l[u.index]=h;const f=h.part;this.hls.trigger(T.FRAG_LOADED,h);const p=pd(i,e.sn,u.index+1)||gh(c,e.sn,u.index+1);if(p)d(p);else return n({frag:e,part:f,partsLoaded:l})}).catch(a)};d(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===G.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(T.ERROR,t)}else this.hls.trigger(T.ERROR,{type:me.OTHER_ERROR,details:G.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==q.PARSING){!this.fragCurrent&&this.state!==q.STOPPED&&this.state!==q.ERROR&&(this.state=q.IDLE);return}const{frag:i,part:r,level:n}=t,a=self.performance.now();i.stats.parsing.end=a,r&&(r.stats.parsing.end=a),this.updateLevelTiming(i,r,n,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:r,sn:n,part:a}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of level ${r}. The current chunk will not be buffered.`),null;const o=t[r],l=a>-1?pd(o,n,a):null,c=l?l.fragment:fv(o,n,i);return c?(i&&i!==c&&(c.stats=i.stats),{frag:c,part:l,level:o}):null}bufferFragmentData(e,t,i,r,n){var a;if(!e||this.state!==q.PARSING)return;const{data1:o,data2:l}=e;let c=o;if(o&&l&&(c=ws(o,l)),!((a=c)!=null&&a.length))return;const d={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:c};if(this.hls.trigger(T.BUFFER_APPENDING,d),e.dropped&&e.independent&&!i){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Ye.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,r=Ye.bufferInfo(t,i,0),n=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),o=Math.max(Math.min(e.start-a,r.end-a),i+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return oe(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:r}}=this,n=Ye.bufferInfo(e,t,r);if(n.len===0&&n.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,i);if(a&&n.nextStart<a.end)return Ye.bufferInfo(e,t,Math.max(n.nextStart,r))}return n}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e){const t=this.config,i=e||t.maxBufferLength;return t.maxMaxBufferLength>=i?(t.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to ${t.maxMaxBufferLength}s`),!0):!1}getAppendedFrag(e,t=ge.MAIN){const i=this.fragmentTracker.getAppendedFrag(e,ge.MAIN);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,r=i.length;if(!r)return null;const{config:n}=this,a=i[0].start;let o;if(t.live){const l=n.initialLiveManifestSize;if(r<l)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${l})`),null;!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(o=this.getInitialLiveFragment(t,i),this.startPosition=o?this.hls.liveSyncPosition||o.start:e)}else e<=a&&(o=i[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 i=this.fragmentTracker.getState(e);return(i===vt.OK||i===vt.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,r,n){const a=e.gap,o=this.getNextFragment(this.nextLoadPosition,t);if(o===null)return o;if(e=o,a&&e&&!e.gap&&i.nextStart){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r);if(l!==null&&i.len+l.len>=n)return this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.
29initSegment:e}getNextPart(e,t,i){let r=-1,n=!1,a=!0;for(let o=0,l=e.length;o<l;o++){const c=e[o];if(a=a&&!c.independent,r>-1&&i<c.start)break;const d=c.loaded;d?r=-1:(n||c.independent||a)&&c.fragment===t&&(r=o),n=d}return r}loadedEndOfParts(e,t){const i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let r=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),r=pv(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=i.sn+1;if(n>=e.startSN&&n<=e.endSN){const a=t[n-e.startSN];i.cc===a.cc&&(r=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=vv(t,i.cc),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){const{config:r}=this;let{fragPrevious:n}=this,{fragments:a,endSN:o}=i;const{fragmentHint:l}=i,c=r.maxFragLookUpTolerance,d=i.partList,u=!!(r.lowLatencyMode&&d!=null&&d.length&&l);u&&l&&!this.bitrateTest&&(a=a.concat(l),o=l.sn);let h;if(e<t){const f=e>t-c?0:c;h=Jr(n,a,e,f)}else h=a[a.length-1];if(h){const f=h.sn-i.startSN,p=this.fragmentTracker.getState(h);if((p===vt.OK||p===vt.PARTIAL&&h.gap)&&(n=h),n&&h.sn===n.sn&&(!u||d[0].fragment.sn>h.sn)&&n&&h.level===n.level){const _=a[f+1];h.sn<o&&this.fragmentTracker.getState(_)!==vt.OK?h=_:h=null}}return h}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const r=this.hls.liveSyncPosition,n=i.currentTime,a=e.fragments[0].start,o=e.edge,l=n>=a-t.maxFragLookUpTolerance&&n<=o;if(r!==null&&i.duration>r&&(n<r||!l)){const c=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!l&&i.readyState<4||n<o-c)&&(this.loadedmetadata||(this.nextLoadPosition=r),i.readyState&&(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${r.toFixed(3)}`),i.currentTime=r))}}alignPlaylists(e,t){const{levels:i,levelLastLoaded:r,fragPrevious:n}=this,a=r!==null?i[r]:null,o=e.fragments.length;if(!o)return this.warn("No fragments in live playlist"),0;const l=e.fragments[0].start,c=!t,d=e.alignedSliding&&oe(l);if(c||!d&&!l){Rv(n,a,e);const u=e.fragments[0].start;return this.log(`Live playlist sliding: ${u.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${n?n.sn:"na"} fragments: ${o}`),u}return l}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;if(i<t&&(i=-1),i===-1||this.lastCurrentTime===-1){const r=this.startTimeOffset!==null,n=r?this.startTimeOffset:e.startTimeOffset;n!==null&&oe(n)?(i=t+n,n<0&&(i+=e.totalduration),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Start time offset ${n} found in ${r?"multivariant":"media"} playlist, adjust startPosition to ${i}`),this.startPosition=i):e.live?i=this.hls.liveSyncPosition||t:this.startPosition=i=0,this.lastCurrentTime=i}this.nextLoadPosition=i}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!==q.FRAG_LOADING_WAITING_RETRY)&&(this.state=q.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const u=this.getCurrentContext(t.chunkMeta);u&&(t.frag=u.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var r;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const n=t.details===G.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(i,!0);const a=t.errorAction,{action:o,retryCount:l=0,retryConfig:c}=a||{};if(a&&o===wt.RetryRequest&&c){var d;this.resetStartWhenNotLoaded((d=this.levelLastLoaded)!=null?d:i.level);const u=$l(c,l);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${l+1}/${c.maxNumRetry} in ${u}ms`),a.resolved=!0,this.retryDate=self.performance.now()+u,this.state=q.FRAG_LOADING_WAITING_RETRY}else c&&a?(this.resetFragmentErrors(e),l<c.maxNumRetry?n||(a.resolved=!0):D.warn(`${t.details} reached or exceeded max retry (${l})`)):(a==null?void 0:a.action)===wt.SendAlternateToPenaltyBox?this.state=q.WAITING_LEVEL:this.state=q.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===q.PARSING||this.state===q.PARSED){const t=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,t),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.len);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${t} buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(e){e===ge.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==q.STOPPED&&(this.state=q.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const r=Ye.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===q.ENDED&&this.resetLoadingState()}
29resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=q.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=this.levels?this.levels[e].details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){var t;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((t=this.levelLastLoaded)!=null?t:e.level),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,r){var n;const a=i.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 h=r?0:mh(a,e,d.startPTS,d.endPTS,d.startDTS,d.endDTS);return this.hls.trigger(T.LEVEL_PTS_UPDATED,{details:a,level:i,drift:h,type:c,frag:e,start:d.startPTS,end:d.endPTS}),!0}return l},!1))i.fragmentError=0;else if(((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(i.fragmentError===0&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(l.message),this.hls.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=q.PARSED,this.hls.trigger(T.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){if(e.event==="demuxerWorker"){var t,i,r;this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded((t=(i=this.levelLastLoaded)!=null?i:(r=this.fragCurrent)==null?void 0:r.level)!=null?t:0),this.resetLoadingState()}}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function _h(){return self.SourceBuffer||self.WebKitSourceBuffer}function Uv(){const s=Va();if(!s)return!1;const e=_h(),t=s&&typeof s.isTypeSupported=="function"&&s.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),i=!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function";return!!t&&!!i}function Bv(){var s;const e=_h();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}function $v(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Gv(){const s=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(s);return{worker:new self.Worker(e),objectURL:e}}function Hv(s){const e=new self.URL(s,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function Li(s="",e=9e4){return{type:s,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Th{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,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=ws(this.cachedData,e),this.cachedData=null);let i=va(e,0),r=i?i.length:0,n;const a=this._audioTrack,o=this._id3Track,l=i?S0(i):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&oe(l))&&(this.basePTS=Vv(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:ai.audioId3,duration:Number.POSITIVE_INFINITY});r<c;){if(this.canParse(e,r)){const d=this.appendFrame(a,e,r);d?(this.frameIndex++,this.lastPTS=d.sample.pts,r+=d.length,n=r):r=c}else A0(e,r)?(i=va(e,r),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:ai.audioId3,duration:Number.POSITIVE_INFINITY}),r+=i.length,n=r):r++;if(r===c&&n!==c){const d=Ss(e,n);this.cachedData?this.cachedData=ws(this.cachedData,d):this.cachedData=d}}return{audioTrack:a,videoTrack:Li(),id3Track:o,textTrack:Li()}}demuxSampleAes(e,t,i){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:Li(),id3Track:this._id3Track,textTrack:Li()}}destroy(){}}const Vv=(s,e,t)=>{if(oe(s))return s*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};function Wv(s,e,t,i){let r,n,a,o;const l=navigator.userAgent.toLowerCase(),c=i,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=((e[t+2]&192)>>>6)+1;const u=(e[t+2]&60)>>>2;if(u>d.length-1){s.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!0,reason:`invali
29d ADTS sampling index:${u}`});return}return a=(e[t+2]&1)<<2,a|=(e[t+3]&192)>>>6,D.log(`manifest codec:${i}, ADTS type:${r}, samplingIndex:${u}`),/firefox/i.test(l)?u>=6?(r=5,o=new Array(4),n=u-3):(r=2,o=new Array(2),n=u):l.indexOf("android")!==-1?(r=2,o=new Array(2),n=u):(r=5,o=new Array(4),i&&(i.indexOf("mp4a.40.29")!==-1||i.indexOf("mp4a.40.5")!==-1)||!i&&u>=6?n=u-3:((i&&i.indexOf("mp4a.40.2")!==-1&&(u>=6&&a===1||/vivaldi/i.test(l))||!i&&a===1)&&(r=2,o=new Array(2)),n=u)),o[0]=r<<3,o[0]|=(u&14)>>1,o[1]|=(u&1)<<7,o[1]|=a<<3,r===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."+r,manifestCodec:c}}function bh(s,e){return s[e]===255&&(s[e+1]&246)===240}function Ah(s,e){return s[e+1]&1?7:9}function ql(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function Kv(s,e){return e+5<s.length}function ba(s,e){return e+1<s.length&&bh(s,e)}function qv(s,e){return Kv(s,e)&&bh(s,e)&&ql(s,e)<=s.length-e}function Yv(s,e){if(ba(s,e)){const t=Ah(s,e);if(e+t>=s.length)return!1;const i=ql(s,e);if(i<=t)return!1;const r=e+i;return r===s.length||ba(s,r)}return!1}function Sh(s,e,t,i,r){if(!s.samplerate){const n=Wv(e,t,i,r);if(!n)return;s.config=n.config,s.samplerate=n.samplerate,s.channelCount=n.channelCount,s.codec=n.codec,s.manifestCodec=n.manifestCodec,D.log(`parsed codec:${s.codec}, rate:${n.samplerate}, channels:${n.channelCount}`)}}function xh(s){return 1024*9e4/s}function jv(s,e){const t=Ah(s,e);if(e+t<=s.length){const i=ql(s,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Ih(s,e,t,i,r){const n=xh(s.samplerate),a=i+r*n,o=jv(e,t);let l;if(o){const{frameLength:u,headerLength:h}=o,f=h+u,p=Math.max(0,t+f-e.length);p?(l=new Uint8Array(f-h),l.set(e.subarray(t+h,e.length),0)):l=e.subarray(t+h,t+f);const y={unit:l,pts:a};return p||s.samples.push(y),{sample:y,length:f,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}}class zv extends Th{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let i=(va(e,0)||[]).length;for(let r=e.length;i<r;i++)if(Yv(e,i))return D.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return qv(e,t)}appendFrame(e,t,i){Sh(e,this.observer,t,i,e.manifestCodec);const r=Ih(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const Xv=/\/emsg[-/]ID3/i;class Qv{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,i,r){const n=this.videoTrack=Li("video",1),a=this.audioTrack=Li("audio",1),o=this.txtTrack=Li("text",1);if(this.id3Track=Li("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=oh(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=rh.text,n.sampleDuration=0,n.duration=a.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return e=e.length>16384?e.subarray(0,16384):e,De(e,["moof"]).length>0}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=ws(this.remainderData,e));const o=B0(i);this.remainderData=o.remainder,r.samples=o.valid||new Uint8Array}else r.samples=i;const a=this.extractID3Track(r,t);return n.samples=Jc(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return i.samples=Jc(e,t),{videoTrack:t,audioTrack:Li(),id3Track:r,textTrack:Li()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=De(e.samples,["emsg"]);r&&r.forEach(n=>{const a=H0(n);if(Xv.test(a.schemeIdUri)){const o=oe(a.presentationTime)?a.presentationTime/a.timeScale:t+
vendor: 11,388 bytes, line 29
29a.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;i.samples.push({data:c,len:c.byteLength,dts:o,pts:o,type:ai.emsg,duration:l})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}let vn=null;const Zv=[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],Jv=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],eE=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],tE=[0,1,1,4];function Lh(s,e,t,i,r){if(t+24>e.length)return;const n=wh(e,t);if(n&&t+n.frameLength<=e.length){const a=n.samplesPerFrame*9e4/n.sampleRate,o=i+r*a,l={unit:e.subarray(t,t+n.frameLength),pts:o,dts:o};return s.config=[],s.channelCount=n.channelCount,s.samplerate=n.sampleRate,s.samples.push(l),{sample:l,length:n.frameLength,missing:0}}}function wh(s,e){const t=s[e+1]>>3&3,i=s[e+1]>>1&3,r=s[e+2]>>4&15,n=s[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&n!==3){const a=s[e+2]>>1&1,o=s[e+3]>>6,l=t===3?3-i:i===3?3:4,c=Zv[l*14+r-1]*1e3,u=Jv[(t===3?0:t===2?1:2)*3+n],h=o===3?1:2,f=eE[t][i],p=tE[i],y=f*8*p,_=Math.floor(f*c/u+a)*p;if(vn===null){const I=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);vn=I?parseInt(I[1]):0}return!!vn&&vn<=87&&i===2&&c>=224e3&&o===0&&(s[e+3]=s[e+3]|128),{sampleRate:u,channelCount:h,frameLength:_,samplesPerFrame:y}}}function Yl(s,e){return s[e]===255&&(s[e+1]&224)===224&&(s[e+1]&6)!==0}function Rh(s,e){return e+1<s.length&&Yl(s,e)}function iE(s,e){return Yl(s,e)&&4<=s.length-e}function sE(s,e){if(e+1<s.length&&Yl(s,e)){const i=wh(s,e);let r=4;i!=null&&i.frameLength&&(r=i.frameLength);const n=e+r;return n===s.length||Rh(s,n)}return!1}class Ad{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,i=e.byteLength-t,r=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");r.set(e.subarray(i,i+n)),this.word=new DataView(r.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 i=this.word>>>32-t;if(e>32&&D.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?i<<t|this.readBits(t):i}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,i=8,r;for(let n=0;n<e;n++)i!==0&&(r=this.readEG(),i=(t+r+256)%256),t=i===0?t:i}readSPS(){let e=0,t=0,i=0,r=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),h=this.skipBits.bind(this),f=this.skipEG.bind(this),p=this.skipUEG.bind(this),y=this.skipScalingList.bind(this);l();const _=l();if(c(5),h(3),l(),p(),_===100||_===110||_===122||_===244||_===44||_===83||_===86||_===118||_===128){const B=d();if(B===3&&h(1),p(),p(),h(1),u())for(a=B!==3?8:12,o=0;o<a;o++)u()&&(o<6?y(16):y(64))}p();const A=d();if(A===0)d();else if(A===1)for(h(1),f(),f(),n=d(),o=0;o<n;o++)f();p(),h(1);const x=d(),I=d(),P=c(1);P===0&&h(1),h(1),u()&&(e=d(),t=d(),i=d(),r=d());let L=[1,1];if(u()&&u())switch(l()){case 1:L=[1,1];break;case 2:L=[12,11];break;case 3:L=[10,11];break;case 4:L=[16,11];break;case 5:L=[40,33];break;case 6:L=[24,11];break;case 7:L=[20,11];break;case 8:L=[32,11];break;case 9:L=[80,33];break;case 10:L=[18,11];break;case 11:L=[15,11];break;case 12:L=[64,33];break;case 13:L=[160,99];break;case 14:L=[4,3];break;case 15:L=[3,2];break;case 16:L=[2,1];break;case 255:{L=[l()<<8|l(),l()<<8|l()];break}}return{width:Math.ceil((x+1)*16-e*2-t*2),height:(2-P)*(I+1)*16-(P?2:4)*(i+r),pixelRatio:L}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class rE{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Wl(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);r.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)i.set(e.subarray(n,n+16),r);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(i.subarray(r,r+16),n);return e}decryptAvcSample(e,t,i,r,n){const a=dh(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,i+1,r)})}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(i>=n.length);i++){const a=n[i];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,i,r,a),!this.decrypter.isSync()))return}}}}const It=188;class qi{constructor(e,t,i){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._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=e,this.config=t,this.typeSupported=i}static probe(e){const t=qi.syncOffset(e);return t>0&&D.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let i=Math.min(It*5,e.length-It)+1,r=0;for(;r<i;){let n=!1,a=-1,o=0;for(let l=r;l<t;l+=It)if(e[l]===71){if(o++,a===-1&&(a=l,a!==0&&(i=Math.min(a+It*99,e.length-It)+1)),n||(n=jo(e,l)===0),n&&o>1&&(a===0&&o>2||l+It>i))return a}else{if(o)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:rh[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=qi.createTrack("video"),this._audioTrack=qi.createTrack("audio",r),this._id3Track=qi.createTrack("id3"),this._txtTrack=qi.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=r}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_avcTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null}demux(e,t,i=!1,r=!1){i||(this.sampleAes=null);let n;const a=this._avcTrack,o=this._audioTrack,l=this._id3Track,c=this._txtTrack;let d=a.pid,u=a.pesData,h=o.pid,f=l.pid,p=o.pesData,y=l.pesData,_=null,A=this.pmtParsed,x=this._pmtId,I=e.length;if(this.remainderData&&(e=ws(this.remainderData,e),I=e.length,this.remainderData=null),I<It&&!r)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:l,textTrack:c};const P=Math.max(0,qi.syncOffset(e));I-=(I-P)%It,I<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,I,e.buffer.byteLength-I));let L=0;for(let O=P;O<I;O+=It)if(e[O]===71){const F=!!(e[O+1]&64),V=jo(e,O),$=(e[O+3]&48)>>4;let j;if($>1){if(j=O+5+e[O+4],j===O+It)continue}else j=O+4;switch(V){case d:F&&(u&&(n=Ms(u))&&this.parseAVCPES(a,c,n,!1),u={data:[],size:0}),u&&(u.data.push(e.subarray(j,O+It)),u.size+=O+It-j);break;case h:if(F){if(p&&(n=Ms(p)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,n);break;case"mp3":this.parseMPEGPES(o,n);break}p={data:[],size:0}}p&&(p.data.push(e.subarray(j,O+It)),p.size+=O+It-j);break;case f:F&&(y&&(n=Ms(y))&&this.parseID3PES(l,n),y={data:[],size:0}),y&&(y.data.push(e.subarray(j,O+It)),y.size+=O+It-j);break;case 0:F&&(j+=e[j]+1),x=this._pmtId=nE(e,j);break;case x:{F&&(j+=e[j]+1);const z=aE(e,j,this.typeSupported,i);d=z.avc,d>0&&(a.pid=d),h=z.audio,h>0&&(o.pid=h,o.segmentCodec=z.segmentCodec),f=z.id3,f>0&&(l.pid=f),_!==null&&!A&&(D.warn(`MPEG-TS PMT found at ${O} after unknown PID '${_}'. Backtracking to sync byte @${P} to parse all TS packets.`),_=null,O=P-188),A=this.pmtParsed=!0;break}case 17:case 8191:break;default:_=V;break}}else L++;if(L>0){const O=new Error(`Found ${L} TS packet/s that do not start with 0x47`);this.observer.emit(T.ERROR,T.ERROR,{type:me.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!1,error:O,reason:O.message})}a.pesData=u,o.pesData=p,l.pesData=y;const B={audioTrack:o,videoTrack:a,id3Track:l,textTrack:c};return r&&this.extractRemainingSamples(B),B}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._avcTrack,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:i,id3Track:r,textTrack:n}=e,a=i.pesData,o=t.pesData,l=r.pesData;let c;if(a&&(c=Ms(a))?(this.parseAVCPES(i,n,c,!0),i.pesData=null):i.pesData=a,o&&(c=Ms(o))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,c);break;case"mp3":this.parseMPEGPES(t,c);break}t.pesData=null}else o!=null&&o.size&&D.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;l&&(c=Ms(l))?(this.parseID3PES(r,c),r.pesData=null):r.pesData=l}demuxSampleAes(e,t,i){const r=this.demux(e,i,!0,!this.config.progressive),n=this.sampleAes=new rE(this.observer,this.config,t);return this.decrypt(r,n)}decrypt(e,t){return new Promise(i=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{i(e)})})}destroy(){this._duration=0}parseAVCPES(e,t,i,r){const n=this.parseAVCNALu(e,i.data);let a=this.avcSample,o,l=!1;i.data=null,a&&n.length&&!e.audFound&&(Tr(a,e),a=this.avcSample=En(!1,i.pts,i.dts,"")),n.forEac
29h(c=>{var d;switch(c.type){case 1:{let h=!1;o=!0;const f=c.data;if(l&&f.length>4){const p=new Ad(f).readSliceType();(p===2||p===4||p===7||p===9)&&(h=!0)}if(h){var u;(u=a)!=null&&u.frame&&!a.key&&(Tr(a,e),a=this.avcSample=null)}a||(a=this.avcSample=En(!0,i.pts,i.dts,"")),a.frame=!0,a.key=h;break}case 5:o=!0,(d=a)!=null&&d.frame&&!a.key&&(Tr(a,e),a=this.avcSample=null),a||(a=this.avcSample=En(!0,i.pts,i.dts,"")),a.key=!0,a.frame=!0;break;case 6:{o=!0,ch(c.data,1,i.pts,t.samples);break}case 7:if(o=!0,l=!0,!e.sps){const h=c.data,p=new Ad(h).readSPS();e.width=p.width,e.height=p.height,e.pixelRatio=p.pixelRatio,e.sps=[h],e.duration=this._duration;const y=h.subarray(1,4);let _="avc1.";for(let A=0;A<3;A++){let x=y[A].toString(16);x.length<2&&(x="0"+x),_+=x}e.codec=_}break;case 8:o=!0,e.pps||(e.pps=[c.data]);break;case 9:o=!1,e.audFound=!0,a&&Tr(a,e),a=this.avcSample=En(!1,i.pts,i.dts,"");break;case 12:o=!0;break;default:o=!1,a&&(a.debug+="unknown NAL "+c.type+" ");break}a&&o&&a.units.push(c)}),r&&a&&(Tr(a,e),this.avcSample=null)}getLastNalUnit(e){var t;let i=this.avcSample,r;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const n=i.units;r=n[n.length-1]}return r}parseAVCNALu(e,t){const i=t.byteLength;let r=e.naluState||0;const n=r,a=[];let o=0,l,c,d,u=-1,h=0;for(r===-1&&(u=0,h=t[0]&31,r=0,o=1);o<i;){if(l=t[o++],!r){r=l?0:1;continue}if(r===1){r=l?0:2;continue}if(!l)r=3;else if(l===1){if(u>=0){const f={data:t.subarray(u,o-r-1),type:h};a.push(f)}else{const f=this.getLastNalUnit(e.samples);if(f&&(n&&o<=4-n&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-n)),c=o-r-1,c>0)){const p=new Uint8Array(f.data.byteLength+c);p.set(f.data,0),p.set(t.subarray(0,c),f.data.byteLength),f.data=p,f.state=0}}o<i?(d=t[o]&31,u=o,h=d,r=0):r=-1}else r=0}if(u>=0&&r>=0){const f={data:t.subarray(u,i),type:h,state:r};a.push(f)}if(a.length===0){const f=this.getLastNalUnit(e.samples);if(f){const p=new Uint8Array(f.data.byteLength+t.byteLength);p.set(f.data,0),p.set(t,f.data.byteLength),f.data=p}}return e.naluState=r,a}parseAACPES(e,t){let i=0;const r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const u=r.missing,h=r.sample.unit.byteLength;if(u===-1){const f=new Uint8Array(h+n.byteLength);f.set(r.sample.unit,0),f.set(n,h),n=f}else{const f=h-u;r.sample.unit.set(n.subarray(0,u),f),e.samples.push(r.sample),i=r.missing}}let a,o;for(a=i,o=n.length;a<o-1&&!ba(n,a);a++);if(a!==i){let u;const h=a<o-1;h?u=`AAC PES did not start with ADTS header,offset:${a}`:u="No ADTS header found in AAC PES";const f=new Error(u);if(D.warn(`parsing error: ${u}`),this.observer.emit(T.ERROR,T.ERROR,{type:me.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!1,levelRetry:h,error:f,reason:u}),!h)return}Sh(e,this.observer,n,a,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(r){const u=xh(e.samplerate);l=r.sample.pts+u}else{D.warn("[tsdemuxer]: AAC PES unknown PTS");return}let c=0,d;for(;a<o;)if(d=Ih(e,n,a,l,c),a+=d.length,d.missing){this.aacOverFlow=d;break}else for(c++;a<o-1&&!ba(n,a);a++);}parseMPEGPES(e,t){const i=t.data,r=i.length;let n=0,a=0;const o=t.pts;if(o===void 0){D.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<r;)if(Rh(i,a)){const l=Lh(e,i,a,o,n);if(l)a+=l.length,n++;else break}else a++}parseID3PES(e,t){if(t.pts===void 0){D.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=dt({},t,{type:this._avcTrack?ai.emsg:ai.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function En(s,e,t,i){return{key:s,frame:!1,pts:e,dts:t,units:[],debug:i,length:0}}function jo(s,e){return((s[e+1]&31)<<8)+s[e+2]}function nE(s,e){return(s[e+10]&31)<<8|s[e+11]}function aE(s,e,t,i){const r={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},n=(s[e+1]&15)<<8|s[e+2],a=e+3+n-4,o=(s[e+10]&15)<<8|s[e+11];for(e+=12+o;e<a;){const l=jo(s,e);switch(s[e]){case 207:if(!i){D.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:r.audio===-1&&(r.audio=l);break;case 21:r.id3===-1&&(r.id3=l);break;case 219:if(!i){D.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:r.avc===-1&&(r.avc=l);break;case 3:case 4:t.mpeg!==!0&&t.mp3!==!0?D.log("MPEG audio found, not supported in this browser"):r.audio===-1&&(r.audio=l,r.segmentCodec="mp3");break;case 36:D.warn("Unsupported HEVC stream type found");break}e+=((s[e+3]&15)<<8|s[e+4])+5}return r}function Ms(s){let e=0,t,i,r,n,a;const o=s.data;if(!s||s.size===0)return null;for(;o[0].length<19&&o.length>1;){const c=new Uint8Array(o[0].length+o[1].length);c.set(o[0]),c.set(o[1],o[0].length),o[0]=c,o.splice(1,1)}if(t=o[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(i=(t[4]<<8)+t[5],i&&i>s.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&&(D.warn(`${Math.round((n-a)/9e4)}s delta between PTS and DTS, align them`),n=a)):a=n),r=t[8];let d=r+9;if(s.size<=d)return null;s.size-=d;const u=new Uint8Array(s.size);for(let h=0,f=o.length;h<f;h++){t=o[h];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 i&&(i-=r+3),{data:u,pts:n,dts:a,len:i}}return null}function Tr(s,e){if(s.units.length&&s.frame){if(s.pts===void 0){const t=e.samples,i=t.length;if(i){const r=t[i-1];s.pts=r.pts,s.dts=r.dts}else{e.dropped++;return}}e.samples.push(s)}s.debug.length&&D.log(s.pts+"/"+s.dts+":"+s.debug)}class oE extends Th{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let i=(va(e,0)||[]).length;for(let r=e.length;i<r;i++)if(sE(e,i))return D.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return iE(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Lh(e,t,i,this.basePTS,this.frameIndex)}}class Sd{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 Gi=Math.pow(2,32)-1;class N{static init(){N.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in N.types)N.types.hasOwnProperty(e)&&(N.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]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);N.HDLR_TYPES={video:t,audio:i};
vendor: 28,889 bytes, line 29
29const r=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]);N.STTS=N.STSC=N.STCO=n,N.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),N.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),N.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),N.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]);N.FTYP=N.box(N.types.ftyp,a,l,a,o),N.DINF=N.box(N.types.dinf,N.box(N.types.dref,r))}static box(e,...t){let i=8,r=t.length;const n=r;for(;r--;)i+=t[r].byteLength;const a=new Uint8Array(i);for(a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=i&255,a.set(e,4),r=0,i=8;r<n;r++)a.set(t[r],i),i+=t[r].byteLength;return a}static hdlr(e){return N.box(N.types.hdlr,N.HDLR_TYPES[e])}static mdat(e){return N.box(N.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(Gi+1)),r=Math.floor(t%(Gi+1));return N.box(N.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,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return N.box(N.types.mdia,N.mdhd(e.timescale,e.duration),N.hdlr(e.type),N.minf(e))}static mfhd(e){return N.box(N.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"?N.box(N.types.minf,N.box(N.types.smhd,N.SMHD),N.DINF,N.stbl(e)):N.box(N.types.minf,N.box(N.types.vmhd,N.VMHD),N.DINF,N.stbl(e))}static moof(e,t,i){return N.box(N.types.moof,N.mfhd(e),N.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=N.trak(e[t]);return N.box.apply(null,[N.types.moov,N.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(N.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=N.trex(e[t]);return N.box.apply(null,[N.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Gi+1)),r=Math.floor(t%(Gi+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,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&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 N.box(N.types.mvhd,n)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let r,n;for(r=0;r<t.length;r++)n=t[r].flags,i[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return N.box(N.types.sdtp,i)}static stbl(e){return N.box(N.types.stbl,N.stsd(e),N.box(N.types.stts,N.STTS),N.box(N.types.stsc,N.STSC),N.box(N.types.stsz,N.STSZ),N.box(N.types.stco,N.STCO))}static avc1(e){let t=[],i=[],r,n,a;for(r=0;r<e.sps.length;r++)n=e.sps[r],a=n.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],a=n.byteLength,i.push(a>>>8&255),i.push(a&255),i=i.concat(Array.prototype.slice.call(n));const o=N.box(N.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),l=e.width,c=e.height,d=e.pixelRatio[0],u=e.pixelRatio[1];return N.box(N.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,N.box(N.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),N.box(N.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 mp4a(e){const t=e.samplerate;return N.box(N.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0]),N.box(N.types.esds,N.esds(e)))}static mp3(e){const t=e.samplerate;return N.box(N.types[".mp3"],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 stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?N.box(N.types.stsd,N.STSD,N.mp3(e)):N.box(N.types.stsd,N.STSD,N.mp4a(e)):N.box(N.types.stsd,N.STSD,N.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,r=e.width,n=e.height,a=Math.floor(i/(Gi+1)),o=Math.floor(i%(Gi+1));return N.box(N.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,r>>8&255,r&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const i=N.sdtp(e),r=e.id,n=Math.floor(t/(Gi+1)),a=Math.floor(t%(Gi+1));return N.box(N.types.traf,N.box(N.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),N.box(N.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])),N.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,N.box(N.types.trak,N.tkhd(e),N.mdia(e))}static trex(e){const t=e.id;return N.box(N.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 i=e.samples||[],r=i.length,n=12+16*r,a=new Uint8Array(n);let o,l,c,d,u,h;for(t+=8+n,a.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<r;o++)l=i[o],c=l.duration,d=l.size,u=l.flags,h=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,h>>>24&255,h>>>16&255,h>>>8&255,h&255],12+16*o);return N.box(N.types.trun,a)}static initSegment(e){N.types||N.init();const t=N.moov(e),i=new Uint8Array(N.FTYP.byteLength+t.byteLength);return i.set(N.FTYP),i.set(t,N.FTYP.byteLength),i}}N.types=void 0;N.HDLR_TYPES=void 0;N.STTS=void 0;N.STSC=void 0;N.STCO=void 0;N.STSZ=void 0;N.VMHD=void 0;N.SMHD=void 0;N.STSD=void 0;N.FTYP=void 0;N.DINF=void 0;const kh=9e4;function jl(s,e,t=1,i=!1){const r=s*e*t;return i?Math.round(r):r}function lE(s,e,t=1,i=!1){return jl(s,e,1/t,i)}function br(s,e=!1){return jl(s,1e3,1/kh,e)}function cE(s,e=1){return jl(s,kh,1/e)}const dE=10*1e3,xd=1024,uE=1152;let yn=null,po=null;class go{constructor(e,t,i,r=""){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.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,yn===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);yn=a?parseInt(a[1]):0}if(po===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);po=n?parseInt(n[1]):0}}destroy(){}resetTimeStamp(e){D.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){D.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){D.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1}getVideoStartPts(e){let t=!1;const i=e.reduce((r,n)=>{const a=n.pts-r;return a<-4294967296?(t=!0,Xt(r,n.pts)):a>0?r:n.pts},e[0].pts);return t&&D.debug("PTS rollover detected"),i}remux(e,t,i,r,n,a,o,l){let c,d,u,h,f,p,y=n,_=n;const A=e.pid>-1,x=t.pid>-1,I=t.samples.length,P=e.samples.length>0,L=o&&I>0||I>1;if((!A||P)&&(!x||L)||this.ISGenerated||o){this.ISGenerated||(u=this.generateIS(e,t,n,a));const O=this.isVideoContiguous;let F=-1,V;if(L&&(F=hE(t.samples),!O&&this.config.forceKeyFrameOnDiscontinuity))if(p=!0,F>0){D.warn(`[mp4-remuxer]: Dropped ${F} out of ${I} video samples due to a missing keyframe`);const $=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(F),t.dropped+=F,_+=(t.samples[0].pts-$)/t.inputTimeScale,V=_}else F===-1&&(D.warn(`[mp4-remuxer]: No keyframe found out of ${I} video samples`),p=!1);if(this.ISGenerated){if(P&&L){const $=this.getVideoStartPts(t.samples),z=(Xt(e.samples[0].pts,$)-$)/t.inputTimeScale;y+=Math.max(0,z),_+=Math.max(0,-z)}if(P){if(e.samplerate||(D.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(e,t,n,a)),d=this.remuxAudio(e,y,this.isAudioContiguous,a,x||L||l===ge.AUDIO?_:void 0),L){const $=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(D.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(e,t,n,a)),c=this.remuxVideo(t,_,O,$)}}else L&&(c=this.remuxVideo(t,_,O,0));c&&(c.firstKeyFrame=F,c.independent=F!==-1,c.firstKeyFramePTS=V)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(f=Dh(i,n,this._initPTS,this._initDTS)),r.samples.length&&(h=Ch(r,n,this._initPTS))),{audio:d,video:c,initSegment:u,independent:p,text:h,id3:f}}generateIS(e,t,i,r){const n=e.samples,a=t.samples,o=this.typeSupported,l={},c=this._initPTS;let d=!c||r,u="audio/mp4",h,f,p;if(d&&(h=f=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}l.audio={id:"audio",container:u,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):N.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(p=e.inputTimeScale,!c||p!==c.timescale?h=f=n[0].pts-Math.round(p*i):d=!1)}if(t.sps&&t.pps&&a.length&&(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:N.initSegment([t]),metadata:{width:t.width,height:t.height}},d))if(p=t.inputTimeScale,!c||p!==c.timescale){const y=this.getVideoStartPts(a),_=Math.round(p*i);f=Math.min(f,Xt(a[0].dts,y)-_),h=Math.min(h,y-_)}else d=!1;if(Object.keys(l).length)return this.ISGenerated=!0,d?(this._initPTS={baseTime:h,timescale:p},this._initDTS={baseTime:f,timescale:p}):h=p=void 0,{tracks:l,initPTS:h,timescale:p}}remuxVideo(e,t,i,r){const n=e.inputTimeScale,a=e.samples,o=[],l=a.length,c=this._initPTS;let d=this.nextAvcDts,u=8,h=this.videoSampleDuration,f,p,y=Number.POSITIVE_INFINITY,_=Number.NEGATIVE_INFINITY,A=!1;if(!i||d===null){const J=t*n,ne=a[0].pts-Xt(a[0].dts,a[0].pts);d=J-ne}const x=c.baseTime*n/c.timescale;for(let J=0;J<l;J++){const ne=a[J];ne.pts=Xt(ne.pts-x,d),ne.dts=Xt(ne.dts-x,d),ne.dts<a[J>0?J-1:J].dts&&(A=!0)}A&&a.sort(function(J,ne){const Re=J.dts-ne.dts,se=J.pts-ne.pts;return Re||se}),f=a[0].dts,p=a[a.length-1].dts;const I=p-f,P=I?Math.round(I/(l-1)):h||e.inputTimeScale/30;if(i){const J=f-d,ne=J>P,Re=J<-1;if((ne||Re)&&(ne?D.warn(`AVC: ${br(J,!0)} ms (${J}dts) hole between fragments detected, filling it`):D.warn(`AVC: ${br(-J,!0)} ms (${J}dts) overlapping between fragments detected`),!Re||d>=a[0].pts)){f=d;const se=a[0].pts-J;a[0].dts=f,a[0].pts=se,D.log(`Video: First PTS/DTS adjusted: ${br(se,!0)}/${br(f,!0)}, delta: ${br(J,!0)} ms`)}}f=Math.max(0,f);let L=0,B=0;for(let J=0;J<l;J++){const ne=a[J],Re=ne.units,se=Re.length;let Ae=0;for(let He=0;He<se;He++)Ae+=Re[He].data.length;B+=Ae,L+=se,ne.length=Ae,ne.dts=Math.max(ne.dts,f),y=Math.min(ne.pts,y),_=Math.max(ne.pts,_)}p=a[l-1].dts;const O=B+4*L+8;let F;try{F=new Uint8Array(O)}catch(J){this.observer.emit(T.ERROR,T.ERROR,{type:me.MUX_ERROR,details:G.REMUX_ALLOC_ERROR,fatal:!1,error:J,bytes:O,reason:`fail allocating video mdat ${O}`});return}const V=new DataView(F.buffer);V.setUint32(0,O),F.set(N.types.mdat,4);let $=!1,j=Number.POSITIVE_INFINITY,z=Number.POSITIVE_INFINITY,ve=Number.NEGATIVE_INFINITY,qe=Number.NEGATIVE_INFINITY;for(let J=0;J<l;J++){const ne=a[J],Re=ne.units;let se=0;for(let xt=0,$t=Re.length;xt<$t;xt++){const Ot=Re[xt],ui=Ot.data,mr=Ot.data.byteLength;V.setUint32(u,mr),u+=4,F.set(ui,u),u+=mr,se+=4+mr}let Ae;if(J<l-1)h=a[J+1].dts-ne.dts,Ae=a[J+1].pts-ne.pts;else{const xt=this.config,$t=J>0?ne.dts-a[J-1].dts:P;if(Ae=J>0?ne.pts-a[J-1].pts:P,xt.stretchShortVideoTrack&&this.nextAudioPts!==null){const Ot=Math.floor(xt.maxBufferHole*n),ui=(r?y+r*n:this.nextAudioPts)-ne.pts;ui>Ot?(h=ui-$t,h<0?h=$t:$=!0,D.log(`[mp4-remuxer]: It is approximately ${ui/90} ms to the next segment; using duration ${h/90} ms for the last video frame.`)):h=$t}else h=$t}const He=Math.round(ne.pts-ne.dts);j=Math.min(j,h),ve=Math.max(ve,h),z=Math.min(z,Ae),qe=Math.max(qe,Ae),o.push(new Id(ne.key,h,se,He))}if(o.length){if(yn){if(yn<70){const J=o[0].flags;J.dependsOn=2,J.isNonSync=0}}else if(po&&qe-z<ve-j&&P/ve<.025&&o[0].cts===0){D.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let J=f;for(let ne=0,Re=o.length;ne<Re;ne++){const se=J+o[ne].duration,Ae=J+o[ne].cts;if(ne<Re-1){const He=se+o[ne+1].cts;o[ne].duration=He-Ae}else o[ne].duration=ne?o[ne-1].duration:P;o[ne].cts=0,J=se}}}h=$||!h?P:h,this.nextAvcDts=d=p+h,this.videoSampleDuration=h,this.isVideoContiguous=!0;const Pe={data1:N.moof(e.sequenceNumber++,f,dt({},e,{samples:o})),data2:F,startPTS:y/n,endPTS:(_+h)/n,startDTS:f/n,endDTS:d/n,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Pe}remuxAudio(e,t,i,r,n){const a=e.inputTimeScale,o=e.samplerate?e.samplerate:a,l=a/o,c=e.segmentCodec==="aac"?xd:uE,d=c*l,u=this._initPTS,h=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,f=[],p=n!==void 0;let y=e.samples,_=h?0:8,A=this.nextAudioPts||-1;const x=t*a,I=u.baseTime*a/u.timescale;if(this.isAudioContiguous=i=i||y.length&&A>0&&(r&&Math.abs(x-A)<9e3||Math.abs(Xt(y[0].pts-I,x)-A)<20*d),y.forEach(function(Le){Le.pts=Xt(Le.pts-I,x)}),!i||A<0){if(y=y.filter(Le=>Le.pts>=0),!y.length)return;n===0?A=0:r&&!p?A=Math.max(0,x):A=y[0].pts}if(e.segmentCodec==="aac"){const Le=this.config.maxAudioFramesDrift;for(let Pe=0,J=A;Pe<y.length;Pe++){const ne=y[Pe],Re=ne.pts,se=Re-J,Ae=Math.abs(1e3*se/a);if(se<=-Le*d&&p)Pe===0&&(D.warn(`Audio frame @ ${(Re/a).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*se/a)} ms.`),this.nextAudioPts=A=J=Re);else if(se>=Le*d&&Ae<dE&&p){let He=Math.round(se/d);J=Re-He*d,J<0&&(He--,J+=d),Pe===0&&(this.nextAudioPts=A=J),D.warn(`[mp4-remuxer]: Injecting ${He} audio frame @ ${(J/a).toFixed(3)}s due to ${Math.round(1e3*se/a)} ms gap.`);for(let xt=0;xt<He;xt++){const $t=Math.max(J,0);let Ot=Sd.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);Ot||(D.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ot=ne.unit.subarray()),y.splice(Pe,0,{unit:Ot,pts:$t}),J+=d,Pe++}}ne.pts=J,J+=d}}let P=null,L=null,B,O=0,F=y.length;for(;F--;)O+=y[F].unit.byteLength;for(let Le=0,Pe=y.length;Le<Pe;Le++){const J=y[Le],ne=J.unit;let Re=J.pts;if(L!==null){const Ae=f[Le-1];Ae.duration=Math.round((Re-L)/l)}else if(i&&e.segmentCodec==="aac"&&(Re=A),P=Re,O>0){O+=_;try{B=new Uint8Array(O)}catch(Ae){this.observer.emit(T.ERROR,T.ERROR,{type:me.MUX_ERROR,details:G.REMUX_ALLOC_ERROR,fatal:!1,error:Ae,bytes:O,reason:`fail allocating audio mdat ${O}`});return}h||(new DataView(B.buffer).setUint32(0,O),B.set(N.types.mdat,4))}else return;B.set(ne,_);const se=ne.byteLength;_+=se,f.push(new Id(!0,c,se,0)),L=Re}const V=f.length;if(!V)return;const $=f[f.length-1];this.nextAudioPts=A=L+l*$.duration;const j=h?new Uint8Array(0):N.moof(e.sequenceNumber++,P/l,dt({},e,{samples:f}));e.samples=[];const z=P/a,ve=A/a,pe={data1:j,data2:B,startPTS:z,endPTS:ve,startDTS:z,endDTS:ve,type:"audio",hasAudio:!0,hasVideo:!1,nb:V};return this.isAudioContiguous=!0,pe}remuxEmptyAudio(e,t,i,r){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:r.startDTS*n)+d,h=r.endDTS*n+d,f=o*xd,p=Math.ceil((h-u)/f),y=Sd.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(D.warn("[mp4-remuxer]: remux empty Audio"),!y){D.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const _=[];for(let A=0;A<p;A++){const x=u+A*f;_.push({unit:y,pts:x,dts:x})}return e.samples=_,this.remuxAudio(e,t,i,!1)}}function Xt(s,e){let t;if(e===null)return s;for(e<s?t=-8589934592:t=8589934592;Math.abs(s-e)>4294967296;)s+=t;return s}function hE(s){for(let e=0;e<s.length;e++)if(s[e].key)return e;return-1}function Dh(s,e,t,i){const r=s.samples.length;if(!r)return;const n=s.inputTimeScale;for(let o=0;o<r;o++){const l=s.samples[o];l.pts=Xt(l.pts-t.baseTime*n/t.timescale,e*n)/n,l.dts=Xt(l.dts-i.baseTime*n/i.timescale,e*n)/n}const a=s.samples;return s.samples=[],{samples:a}}function Ch(s,e,t){const i=s.samples.length;if(!i)return;const r=s.inputTimeScale;for(let a=0;a<i;a++){const o=s.samples[a];o.pts=Xt(o.pts-t.baseTime*r/t.timescale,e*r)/r}s.samples.sort((a,o)=>a.pts-o.pts);const n=s.samples;return s.samples=[],{samples:n}}class Id{constructor(e,t,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=r,this.flags=new fE(e)}}class fE{constructor(e){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=e?2:1,this.isNonSync=e?0:1}}class mE{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,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(P0(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const r=this.initData=oh(e);t||(t=Ld(r.audio,$e.AUDIO)),i||(i=Ld(r.video,$e.VIDEO));const n={};r.audio&&r.video?n.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:r.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?n.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:D.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,i,r,n,a){var o,l;let{initPTS:c,lastEndTime:d}=this;const u={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};oe(d)||(d=this.lastEndTime=n||0);const h=t.samples;if(!(h!=null&&h.length))return u;const f={initPTS:void 0,timescale:1};let p=this.initData;if((o=p)!=null&&o.length||(this.generateInitSegment(h),p=this.initData),!((l=p)!=null&&l.length))return D.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1);const y=N0(h,p),_=O0(p,h),A=_===null?n:_;(pE(c,A,n,y)||f.timescale!==c.timescale&&a)&&(f.initPTS=A-n,c&&c.timescale===1&&D.warn(`Adjusting initPTS by ${f.initPTS-c.baseTime}`),this.initPTS=c={baseTime:f.initPTS,timescale:1});const x=e?A-c.baseTime/c.timescale:d,I=x+y;U0(p,h,c.baseTime/c.timescale),y>0?this.lastEndTime=I:(D.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const P=!!p.audio,L=!!p.video;let B="";P&&(B+="audio"),L&&(B+="video");const O={data1:h,startPTS:x,startDTS:x,endPTS:I,endDTS:I,type:B,hasAudio:P,hasVideo:L,nb:1,dropped:0};return u.audio=O.type==="audio"?O:void 0,u.video=O.type!=="audio"?O:void 0,u.initSegment=f,u.id3=Dh(i,n,c,c),r.samples.length&&(u.text=Ch(r,n,c)),u}}function pE(s,e,t,i){if(s===null)return!0;const r=Math.max(i,1),n=e-s.baseTime/s.timescale;return Math.abs(n-t)>r}function Ld(s,e){const t=s==null?void 0:s.codec;return t&&t.length>4?t:t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":t==="avc1"||e===$e.VIDEO?"avc1.42e01e":"mp4a.40.5"}let Ni;try{Ni=self.performance.now.bind(self.performance)}catch{D.debug("Unable to use Performance API on this environment"),Ni=typeof self<"u"&&self.Date.now}const vo=[{demux:Qv,remux:mE},{demux:qi,remux:go},{demux:zv,remux:go},{demux:oE,remux:go}];class wd{constructor(e,t,i,r,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=i,this.vendor=r,this.id=n}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,r){const n=i.transmuxing;n.executeStart=Ni();let a=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:l}=this;r&&(this.currentTransmuxState=r);const{contiguous:c,discontinuity:d,trackSwitch:u,accurateTimeOffset:h,timeOffset:f,initSegmentChange:p}=r||o,{audioCodec:y,videoCodec:_,defaultInitPts:A,duration:x,initSegmentData:I}=l,P=gE(a,t);if(P&&P.method==="AES-128"){const F=this.getDecrypter();if(F.isSync()){let V=F.softwareDecrypt(a,P.key.buffer,P.iv.buffer);if(i.part>-1&&(V=F.flush()),!V)return n.executeEnd=Ni(),Eo(i);a=new Uint8Array(V)}else return this.decryptionPromise=F.webCryptoDecrypt(a,P.key.buffer,P.iv.buffer).then(V=>{const $=this.push(V,null,i);return this.decryptionPromise=null,$}),this.decryptionPromise}const L=this.needsProbing(d,u);if(L){const F=this.configureTransmuxer(a);if(F)return D.warn(`[transmuxer] ${F.message}`),this.observer.emit(T.ERROR,T.ERROR,{type:me.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!1,error:F,reason:F.message}),n.executeEnd=Ni(),Eo(i)}(d||u||p||L)&&this.resetInitSegment(I,y,_,x,t),(d||p||L)&&this.resetInitialTimestamp(A),c||this.resetContiguity();const B=this.transmux(a,P,f,h,i),O=this.currentTransmuxState;return O.contiguous=!0,O.discontinuity=!1,O.trackSwitch=!1,n.executeEnd=Ni(),B}flush(e){const t=e.transmuxing;t.executeStart=Ni();const{decrypter:i,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return n.then(()=>this.flush(e));const a=[],{timeOffset:o}=r;if(i){const u=i.flush();u&&a.push(this.push(u,null,e))}const{demuxer:l,remuxer:c}=this;if(!l||!c)return t.executeEnd=Ni(),[Eo(e)];const d=l.flush(o);return Fn(d)?d.then(u=>(this.flushRemux(a,u,e),a)):(this.flushRemux(a,d,e),a)}flushRemux(e,t,i){const{audioTrack:r,videoTrack:n,id3Track:a,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:c}=this.currentTransmuxState;D.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const d=this.remuxer.remux(r,n,a,o,c,l,!0,this.id);e.push({remuxResult:d,chunkMeta:i}),i.transmuxing.executeEnd=Ni()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,r,n){const{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,t,i,r),o.resetInitSegment(e,t,i,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,r,n){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,i,r,n):a=this.transmuxUnencrypted(e,i,r,n),a}transmuxUnencrypted(e,t,i,r){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,i,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,i,r,n){return this.demuxer.demuxSampleAes(e,t,i).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,i,r,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:r,vendor:n}=this;let a;for(let u=0,h=vo.length;u<h;u++)if(vo[u].demux.probe(e)){a=vo[u];break}if(!a)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,l=this.remuxer,c=a.remux,d=a.demux;(!l||!(l instanceof c))&&(this.remuxer=new c(i,t,r,n)),(!o||!(o instanceof d))&&(this.demuxer=new d(i,t,r),this.probe=d.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Wl(this.config)),e}}function gE(s,e){let t=null;return s.byteLength>0&&e!=null&&e.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Eo=s=>({remuxResult:{},chunkMeta:s});function Fn(s){return"then"in s&&s.then instanceof Function}class vE{constructor(e,t,i,r,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=i,this.duration=r,this.defaultInitPts=n||null}}class EE{constructor(e,t,i,r,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=i,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=a}}var Mh={exports:{}};(function(s){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(l,c,d){this.fn=l,this.context=c,this.once=d||!1}function n(l,c,d,u,h){if(typeof d!="function")throw new TypeError("The listener must be a function");var f=new r(d,u||l,h),p=t?t+c:c;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],f]:l._events[p].push(f):(l._events[p]=f,l._eventsCount++),l}function a(l,c){--l._eventsCount===0?l._events=new i:delete l._events[c]}function o(){this._events=new i,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 h=0,f=u.length,p=new Array(f);h<f;h++)p[h]=u[h].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,h,f,p){var y=t?t+c:c;if(!this._events[y])return!1;var _=this._events[y],A=arguments.length,x,I;if(_.fn){switch(_.once&&this.removeListener(c,_.fn,void 0,!0),A){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,d),!0;case 3:return _.fn.call(_.context,d,u),!0;case 4:return _.fn.call(_.context,d,u,h),!0;case 5:return _.fn.call(_.context,d,u,h,f),!0;case 6:return _.fn.call(_.context,d,u,h,f,p),!0}for(I=1,x=new Array(A-1);I<A;I++)x[I-1]=arguments[I];_.fn.apply(_.context,x)}else{var P=_.length,L;for(I=0;I<P;I++)switch(_[I].once&&this.removeListener(c,_[I].fn,void 0,!0),A){case 1:_[I].fn.call(_[I].context);break;case 2:_[I].fn.call(_[I].context,d);break;case 3:_[I].fn.call(_[I].context,d,u);break;case 4:_[I].fn.call(_[I].context,d,u,h);break;default:if(!x)for(L=1,x=new Array(A-1);L<A;L++)x[L-1]=arguments[L];_[I].fn.apply(_[I].context,x)}}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,h){var f=t?t+c:c;if(!this._events[f])return this;if(!d)return a(this,f),this;var p=this._events[f];if(p.fn)p.fn===d&&(!h||p.once)&&(!u||p.context===u)&&a(this,f);else{for(var y=0,_=[],A=p.length;y<A;y++)(p[y].fn!==d||h&&!p[y].once||u&&p[y].context!==u)&&_.push(p[y]);_.length?this._events[f]=_.length===1?_[0]:_:a(this,f)}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 i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,s.exports=o})(Mh);var yE=Mh.exports,zl=i0(yE);const yo=Va()||{isTypeSupported:()=>!1};class Ph{constructor(e,t,i,r){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=i,this.onFlush=r;const a=(c,d)=>{d=d||{},d.frag=this.frag,d.id=this.id,c===T.ERROR&&(this.error=d.error),this.hls.trigger(c,d)};this.observer=new zl,this.observer.on(T.FRAG_DECRYPTED,a),this.observer.on(T.ERROR,a);const o={mp4:yo.isTypeSupported("video/mp4"),mpeg:yo.isTypeSupported("audio/mpeg"),mp3:yo.isTypeSupported('audio/mp4; codecs="mp3"')},l=navigator.vendor;if(this.useWorker&&typeof Worker<"u"&&(n.workerPath||$v())){try{n.workerPath?(D.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=Hv(n.workerPath)):(D.log(`injecting Web Worker for "${t}"`),this.workerContext=Gv()),this.onwmsg=u=>this.onWorkerMessage(u);const{worker:d}=this.workerContext;d.addEventListener("message",this.onwmsg),d.onerror=u=>{const h=new Error(`${u.message} (${u.filename}:${u.lineno})`);n.enableWorker=!1,D.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(T.ERROR,{type:me.OTHER_ERROR,details:G.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:h})}
29,d.postMessage({cmd:"init",typeSupported:o,vendor:l,id:t,config:JSON.stringify(n)})}catch(d){D.warn(`Error setting up "${t}" Web Worker, fallback to inline`,d),this.resetWorker(),this.error=null,this.transmuxer=new wd(this.observer,o,n,l,t)}return}this.transmuxer=new wd(this.observer,o,n,l,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,i,r,n,a,o,l,c,d){var u,h;c.transmuxing.start=self.performance.now();const{transmuxer:f}=this,p=a?a.start:n.start,y=n.decryptdata,_=this.frag,A=!(_&&n.cc===_.cc),x=!(_&&c.level===_.level),I=_?c.sn-_.sn:-1,P=this.part?c.part-this.part.index:-1,L=I===0&&c.id>1&&c.id===(_==null?void 0:_.stats.chunkCount),B=!x&&(I===1||I===0&&(P===1||L&&P<=0)),O=self.performance.now();(x||I||n.stats.parsing.start===0)&&(n.stats.parsing.start=O),a&&(P||!B)&&(a.stats.parsing.start=O);const F=!(_&&((u=n.initSegment)==null?void 0:u.url)===((h=_.initSegment)==null?void 0:h.url)),V=new EE(A,B,l,x,p,F);if(!B||A||F){D.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${c.sn} p: ${c.part} level: ${c.level} id: ${c.id} 30 discontinuity: ${A} 31 trackSwitch: ${x} 32 contiguous: ${B} 33 accurateTimeOffset: ${l} 34 timeOffset: ${p} 35 initSegmentChange: ${F}`);const $=new vE(i,r,t,o,d);this.configureTransmuxer($)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:y,chunkMeta:c,state:V},e instanceof ArrayBuffer?[e]:[]);else if(f){const $=f.push(e,y,c,V);Fn($)?(f.async=!0,$.then(j=>{this.handleTransmuxComplete(j)}).catch(j=>{this.transmuxerError(j,c,"transmuxer-interface push error")})):(f.async=!1,this.handleTransmuxComplete($))}}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 i=t.flush(e);Fn(i)||t.async?(Fn(i)||(i=Promise.resolve(i)),i.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data,i=this.hls;switch(t.event){case"init":{var r;const n=(r=this.workerContext)==null?void 0:r.objectURL;n&&self.URL.revokeObjectURL(n);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":D[t.data.logType]&&D[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.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)}}const _E=250,_o=2,TE=.1,bE=.05;class AE{constructor(e,t,i,r){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=i,this.hls=r}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:r,stalled:n}=this;if(r===null)return;const{currentTime:a,seeking:o}=r,l=this.seeking&&!o,c=!this.seeking&&o;if(this.seeking=o,a!==e){if(this.moved=!0,n!==null){if(this.stallReported){const A=self.performance.now()-n;D.warn(`playback not stuck anymore @${a}, after ${Math.round(A)}ms`),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if(c||l){this.stalled=null;return}if(r.paused&&!o||r.ended||r.playbackRate===0||!Ye.getBuffered(r).length)return;const d=Ye.bufferInfo(r,a,0),u=d.len>0,h=d.nextStart||0;if(!u&&!h)return;if(o){const A=d.len>_o,x=!h||t&&t.start<=a||h-a>_o&&!this.fragmentTracker.getPartialFragment(a);if(A||x)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var f;
35const A=Math.max(h,d.start||0)-a,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=(x==null||(f=x.details)==null?void 0:f.live)?x.details.targetduration*2:_o,L=this.fragmentTracker.getPartialFragment(a);if(A>0&&(A<=P||L)){this._trySkipBufferHole(L);return}}const p=self.performance.now();if(n===null){this.stalled=p;return}const y=p-n;if(!o&&y>=_E&&(this._reportStall(d),!this.media))return;const _=Ye.bufferInfo(r,a,i.maxBufferHole);this._tryFixBufferStall(_,y)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:r,media:n}=this;if(n===null)return;const a=n.currentTime,o=r.getPartialFragment(a);o&&(this._trySkipBufferHole(o)||!this.media)||(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-a<i.maxBufferHole)&&t>i.highBufferWatchdogPeriod*1e3&&(D.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:r}=this;if(!r&&i){this.stallReported=!0;const n=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);D.warn(n.message),t.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:r}=this;if(r===null)return 0;const n=r.currentTime,a=Ye.bufferInfo(r,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&&r.readyState<3,d=o-n;if(d>0&&(l||c)){if(d>t.maxBufferHole){const{fragmentTracker:h}=this;let f=!1;if(n===0){const p=h.getAppendedFrag(0,ge.MAIN);p&&o<p.end&&(f=!0)}if(!f){const p=e||h.getAppendedFrag(n,ge.MAIN);if(p){let y=!1,_=p.end;for(;_<o;){const A=h.getPartialFragment(_);if(A)_+=A.duration;else{y=!0;break}}if(y)return 0}}}const u=Math.max(o+bE,n+TE);if(D.warn(`skipping hole, adjusting currentTime from ${n} to ${u}`),this.moved=!0,this.stalled=null,r.currentTime=u,e&&!e.gap){const h=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${u}`);i.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:e})}return u}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:i,nudgeRetry:r}=this;if(i===null)return;const n=i.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){const a=n+(r+1)*e.nudgeOffset,o=new Error(`Nudging 'currentTime' from ${n} to ${a}`);D.warn(o.message),i.currentTime=a,t.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.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`);D.error(a.message),t.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.BUFFER_STALLED_ERROR,error:a,fatal:!0})}}}const SE=100;class xE extends Kl{constructor(e,t,i){super(e,t,i,"[stream-controller]",ge.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;
35e.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_PARSED,this.onManifestParsed,this),e.on(T.LEVEL_LOADING,this.onLevelLoading,this),e.on(T.LEVEL_LOADED,this.onLevelLoaded,this),e.on(T.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(T.ERROR,this.onError,this),e.on(T.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(T.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(T.BUFFER_CREATED,this.onBufferCreated,this),e.on(T.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(T.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(T.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_PARSED,this.onManifestParsed,this),e.off(T.LEVEL_LOADED,this.onLevelLoaded,this),e.off(T.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(T.ERROR,this.onError,this),e.off(T.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(T.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(T.BUFFER_CREATED,this.onBufferCreated,this),e.off(T.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(T.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(T.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),this.onMediaDetaching()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:i}=this;if(this.stopLoad(),this.setInterval(SE),this.level=-1,!this.startFragRequested){let r=i.startLevel;r===-1&&(i.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=i.nextAutoLevel),this.level=i.nextLoadLevel=r,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=q.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=q.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case q.WAITING_LEVEL:{var e;const{levels:i,level:r}=this,n=i==null||(e=i[r])==null?void 0:e.details;if(n&&(!n.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(n))break;this.state=q.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=q.IDLE;break}break}case q.FRAG_LOADING_WAITING_RETRY:{var t;const i=self.performance.now(),r=this.retryDate;(!r||i>=r||(t=this.media)!=null&&t.seeking)&&(this.resetStartWhenNotLoaded(this.level),this.state=q.IDLE)}break}this.state===q.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:r}=this,{config:n,nextLoadLevel:a}=e;if(t===null||!r&&(this.startFragRequested||!n.startFragPrefetch)||this.altAudio&&this.audioOnly||!(i!=null&&i[a]))return;const o=i[a],l=this.getMainFwdBufferInfo();if(l===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(l,c)){const _={};this.altAudio&&(_.type="video"),this.hls.trigger(T.BUFFER_EOS,_),this.state=q.ENDED;return}e.loadLevel!==a&&e.manualLevel===-1&&this.log(`Adapting to level ${a} from level ${this.level}`),this.level=e.nextLoadLevel=a;const d=o.details;if(!d||this.state===q.WAITING_LEVEL||d.live&&this.levelLastLoaded!==a){this.level=a,this.state=q.WAITING_LEVEL;return}const u=l.len,h=this.getMaxBufferLength(o.maxBitrate);if(u>=h)return;this.backtrackFragment&&this.backtrackFragment.start>l.end&&(this.backtrackFragment=null);const f=this.backtrackFragment?this.backtrackFragment.start:l.end;let p=this.getNextFragment(f,d);if(this.couldBacktrack&&!this.fragPrevious&&p&&p.sn!=="initSegment"&&this.fragmentTracker.getState(p)!==vt.OK){var y;const A=((y=this.backtrackFragment)!=null?y:p).sn-d.startSN,x=d.fragments[A-1];x&&p.cc===x.cc&&(p=x,this.fragmentTracker.removeFragment(x))}else this.backtrackFragment&&l.len&&(this.backtrackFragment=null);if(p&&this.isLoopLoading(p,f)){if(!p.gap){const A=this.audioOnly&&!this.altAudio?$e.AUDIO:$e.VIDEO,x=(A===$e.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;x&&this.afterBufferFlushed(x,A,ge.MAIN)}p=this.getNextFragmentLoopLoading(p,d,l,ge.MAIN,h)}p&&(p.initSegment&&!p.initSegment.data&&!this.bitrateTest&&(p=p.initSegment),this.loadFragment(p,o,f))}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);this.fragCurrent=e,r===vt.NOT_LOADED||r===vt.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,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,ge.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 i;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.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?i=this.fragCurrent.duration*l.maxBitrate/(1e3*c)+1:i=0}else i=0;const a=this.getBufferedFrag(t.currentTime+i);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*.5),c*.75));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 q.KEY_LOADING:case q.FRAG_LOADING:case q.FRAG_LOADING_WAITING_RETRY:case q.PARSING:case q.PARSED:this.state=q.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 i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new AE(this.config,i,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;oe(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();if(i===null||i.len===0){this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(T.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.levels=this.fragPlaying=this.backtrackFragment=null,this.altAudio=this.audioOnly=!1}onManifestParsed(e,t){let i=!1,r=!1,n;
35t.levels.forEach(a=>{n=a.audioCodec,n&&(n.indexOf("mp4a.40.2")!==-1&&(i=!0),n.indexOf("mp4a.40.5")!==-1&&(r=!0))}),this.audioCodecSwitch=i&&r&&!Bv(),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:i}=this;if(!i||this.state!==q.IDLE)return;const r=i[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(r.details))&&(this.state=q.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:r}=this,n=t.level,a=t.details,o=a.totalduration;if(!r){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=r[n],c=this.fragCurrent;c&&(this.state===q.FRAG_LOADING||this.state===q.FRAG_LOADING_WAITING_RETRY)&&(c.level!==t.level||c.urlId!==l.urlId)&&c.loader&&this.abortCurrentFrag();let d=0;if(a.live||(i=l.details)!=null&&i.live){if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;d=this.alignPlaylists(a,l.details)}if(l.details=a,this.levelLastLoaded=n,this.hls.trigger(T.LEVEL_UPDATED,{details:a,level:n}),this.state===q.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=q.IDLE}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,d),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const o=a[i.level],l=o.details;if(!l){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const c=o.videoCodec,d=l.PTSKnown||!l.live,u=(t=i.initSegment)==null?void 0:t.data,h=this._getAudioCodec(o),f=this.transmuxer=this.transmuxer||new Ph(this.hls,ge.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=r?r.index:-1,y=p!==-1,_=new Hl(i.level,i.sn,i.stats.chunkCount,n.byteLength,p,y),A=this.initPTS[i.cc];f.push(n,u,h,c,i,r,l.totalduration,d,_,A)}onAudioTrackSwitching(e,t){const i=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;i&&(n.trigger(T.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(T.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,r=!!this.hls.audioTracks[i].url;if(r){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=r,this.tick()}onBufferCreated(e,t){const i=t.tracks;let r,n,a=!1;for(const o in i){const l=i[o];if(l.id==="main"){if(n=o,r=l,o==="video"){const c=i[o];c&&(this.videoBuffer=c.buffer)}}else a=!0}a&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i&&i.type!==ge.MAIN)return;if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===q.PARSED&&(this.state=q.IDLE);return}const n=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=q.ERROR;return}switch(t.details){case G.FRAG_GAP:case G.FRAG_PARSING_ERROR:case G.FRAG_DECRYPT_ERROR:case G.FRAG_LOAD_ERROR:case G.FRAG_LOAD_TIMEOUT:case G.
35KEY_LOAD_ERROR:case G.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ge.MAIN,t);break;case G.LEVEL_LOAD_ERROR:case G.LEVEL_LOAD_TIMEOUT:case G.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===q.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===Ce.LEVEL&&(this.state=q.IDLE);break;case G.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case G.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Ye.getBuffered(e).length){const i=this.state!==q.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,i)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=q.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==$e.AUDIO||this.audioOnly&&!this.altAudio){const i=(t===$e.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,t,ge.MAIN)}}onLevelsUpdated(e,t){this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const r=Ye.getBuffered(e),a=(r.length?r.start(0):0)-i;a>0&&(a<this.config.maxBufferHole||a<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${a} to match buffer start`),i+=a,this.startPosition=i),this.log(`seek to target start position ${i} from current time ${t}`),e.currentTime=i}}_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(i=>{const{hls:r}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=q.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(),r.trigger(T.FRAG_LOADED,i),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i="main",{hls:r}=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:h,id3:f,initSegment:p}=n,{details:y}=d,_=this.altAudio?void 0:n.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=q.PARSING,p){if(p!=null&&p.tracks){const I=l.initSegment||l;this._bufferInitSegment(d,p.tracks,I,a),r.trigger(T.FRAG_PARSING_INIT_SEGMENT,{frag:I,id:i,tracks:p.tracks})}const A=p.initPTS,x=p.timescale;oe(A)&&(this.initPTS[l.cc]={baseTime:A,timescale:x},r.trigger(T.INIT_PTS_FOUND,{frag:l,id:i,initPTS:A,timescale:x}))}if(u&&y&&l.sn!=="initSegment"){const A=y.fragments[l.sn-1-y.startSN],x=l.sn===y.startSN,I=!A||l.cc>A.cc;if(n.independent!==!1){const{startPTS:P,endPTS:L,startDTS:B,endDTS:O}=u;if(c)c.elementaryStreams[u.type]={startPTS:P,endPTS:L,startDTS:B,endDTS:O};else if(u.firstKeyFrame&&u.independent&&a.id===1&&!I&&(this.couldBacktrack=!0),u.dropped&&u.independent){const F=this.getMainFwdBufferInfo(),V=(F?F.end:this.getLoadPosition())+this.config.maxBufferHole,$=u.firstKeyFramePTS?u.firstKeyFramePTS:P;if(!x&&V<$-this.config.maxBufferHole&&!I){this.backtrack(l);return}else I&&(l.gap=!0);l.setElementaryStreamInfo(u.type,l.start,L,l.start,O,!0)}l.setElementaryStreamInfo(u.type,P,L,B,O),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(u,l,c,a,x||I)}else if(x||I)l.gap=!0;else{this.backtrack(l);return}}if(_){const{startPTS:A,endPTS:x,startDTS:I,endDTS:P}=_;c&&(c.elementaryStreams[$e.AUDIO]={startPTS:A,endPTS:x,startDTS:I,endDTS:P}),l.setElementaryStreamInfo($e.AUDIO,A,x,I,P),this.bufferFragmentData(_,l,c,a)}if(y&&f!=null&&(t=f.samples)!=null&&t.length){const A={id:i,frag:l,details:y,samples:f.samples};r.trigger(T.FRAG_PARSING_METADATA,A)}if(y&&h){const A={id:i,frag:l,details:y,samples:h.samples};r.trigger(T.FRAG_PARSING_USERDATA,A)}}_bufferInitSegment(e,t,i,r){if(this.state!==q.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();this.audioCodecSwitch&&(l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),n.metadata.channelCount!==1&&c.indexOf("firefox")===-1&&(l="mp4a.40.5")),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.attrs.CODECS||""}/${o.codec}]`),this.hls.trigger(T.BUFFER_CODECS,t),Object.keys(t).forEach(l=>{const d=t[l].initSegment;d!=null&&d.byteLength&&this.hls.trigger(T.BUFFER_APPENDING,{type:l,data:d,frag:i,part:null,chunkMeta:r,parent:i.type})}),this.tick()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,ge.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=q.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(Ye.isBuffered(e,i)?t=this.getAppendedFrag(i):Ye.isBuffered(e,i+.
351)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n||t.urlId!==r.urlId)&&(this.fragPlaying=t,this.hls.trigger(T.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(T.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,i=this.currentFrag;if(i&&oe(t)&&oe(i.programDateTime)){const r=i.programDateTime+(t-i.start)*1e3;return new Date(r)}}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 Ps{constructor(e,t=0,i=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_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*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 IE{constructor(e,t,i,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_
35=new Ps(e),this.fast_=new Ps(t),this.defaultTTFB_=r,this.ttfb_=new Ps(e)}update(e,t){const{slow_:i,fast_:r,ttfb_:n}=this;i.halfLife!==e&&(this.slow_=new Ps(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Ps(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new Ps(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,r=e/1e3,n=i/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,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(){}}class LE{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=-1,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=e;const t=e.config;this.bwEstimator=new IE(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(T.FRAG_LOADING,this.onFragLoading,this),e.on(T.FRAG_LOADED,this.onFragLoaded,this),e.on(T.FRAG_BUFFERED,this.onFragBuffered,this),e.on(T.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(T.LEVEL_LOADED,this.onLevelLoaded,this)}unregisterListeners(){const{hls:e}=this;e.off(T.FRAG_LOADING,this.onFragLoading,this),e.off(T.FRAG_LOADED,this.onFragLoaded,this),e.off(T.FRAG_BUFFERED,this.onFragBuffered,this),e.off(T.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(T.LEVEL_LOADED,this.onLevelLoaded,this)}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null}onFragLoading(e,t){var i;const r=t.frag;this.ignoreFragment(r)||(this.fragCurrent=r,this.partCurrent=(i=t.part)!=null?i:null,this.clearTimer(),this.timer=self.setInterval(this.onCheck,100))}onLevelSwitching(e,t){this.clearTimer()}getTimeToLoadFrag(e,t,i,r){const n=e+i/t,a=r?this.lastLevelLoadSec:0;return n+a}onLevelLoaded(e,t){const i=this.hls.config,{total:r,bwEstimate:n}=t.stats;oe(r)&&oe(n)&&(this.lastLevelLoadSec=8*r/n),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}_abandonRulesCheck(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{autoLevelEnabled:r,media:n}=i;if(!e||!n)return;const a=performance.now(),o=t?t.stats:e.stats,l=t?t.duration:e.duration,c=a-o.loading.start;if(o.aborted||o.loaded&&o.loaded===o.total||e.level===0){this.clearTimer(),this._nextAutoLevel=-1;return}if(!r||n.paused||!n.playbackRate||!n.readyState)return;const d=i.mainForwardBufferInfo;if(d===null)return;const u=this.bwEstimator.getEstimateTTFB(),h=Math.abs(n.playbackRate);if(c<=Math.max(u,1e3*(l/(h*2))))return;const f=d.len/h;if(f>=2*l/h)return;const p=o.loading.first?o.loading.first-o.loading.start:-1,y=o.loaded&&p>-1,_=this.bwEstimator.getEstimate(),{levels:A,minAutoLevel:x}=i,I=A[e.level],P=o.total||Math.max(o.loaded,Math.round(l*I.maxBitrate/8));let L=c-p;L<1&&y&&(L=Math.min(c,o.loaded*8/_));const B=y?o.loaded*1e3/L:0,O=B?(P-o.loaded)/B:P*8/_+u/1e3;if(O<=f)return;const F=B?B*8:_;let V=Number.POSITIVE_INFINITY,$;for($=e.level-1;$>x;$--){const j=A[$].maxBitrate;if(V=this.getTimeToLoadFrag(u/1e3,F,l*j,!A[$].details),V<f)break}V>=O||V>l*10||(i.nextLoadLevel=$,y?this.bwEstimator.sample(c-Math.min(u,p),o.loaded):this.bwEstimator.sampleTTFB(c),this.clearTimer(),D.warn(`[abr] Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} is loading too slowly; 36 Time to underbuffer: ${f.toFixed(3)} s 37 Estimated load time for current fragment: ${O.toFixed(3)} s 38 Estimated load time for down switch fragment: ${V.toFixed(3)} s 39 TTFB estimate: ${p} 40 Current BW estimate: ${oe(_)?(_/1024).toFixed(3):"Unknown"} Kb/s 41 New BW estimate: ${(this.bwEstimator.getEstimate()/1024).toFixed(3)} Kb/s 42 Aborting and switching to level ${$}`),e.loader&&(this.fragCurrent=this.partCurrent=null,e.abortRequests()),i.trigger(T.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:o}))}onFragLoaded(e,{frag:t,part:i}
42){const r=i?i.stats:t.stats;if(t.type===ge.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){const n=i?i.duration:t.duration,a=this.hls.levels[t.level],o=(a.loaded?a.loaded.bytes:0)+r.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:r,frag:t,part:i,id:t.type};this.onFragBuffered(T.FRAG_BUFFERED,n),t.bitrateTest=!1}}}onFragBuffered(e,t){const{frag:i,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:i.stats;if(n.aborted||this.ignoreFragment(i))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.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==ge.MAIN||e.sn==="initSegment"}clearTimer(){self.clearInterval(this.timer)}get nextAutoLevel(){const e=this._nextAutoLevel,t=this.bwEstimator;if(e!==-1&&!t.canEstimate())return e;let i=this.getNextABRAutoLevel();if(e!==-1){const r=this.hls.levels;if(r.length>Math.max(e,i)&&r[e].loadError<=r[i].loadError)return e}return e!==-1&&(i=Math.min(e,i)),i}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:r,config:n,minAutoLevel:a,media:o}=i,l=t?t.duration:e?e.duration:0,c=o&&o.playbackRate!==0?Math.abs(o.playbackRate):1,d=this.bwEstimator?this.bwEstimator.getEstimate():n.abrEwmaDefaultEstimate,u=i.mainForwardBufferInfo,h=(u?u.len:0)/c;let f=this.findBestLevel(d,a,r,h,n.abrBandWidthFactor,n.abrBandWidthUpFactor);if(f>=0)return f;D.trace(`[abr] ${h?"rebuffering expected":"buffer is empty"}, finding optimal quality level`);let p=l?Math.min(l,n.maxStarvationDelay):n.maxStarvationDelay,y=n.abrBandWidthFactor,_=n.abrBandWidthUpFactor;if(!h){const A=this.bitrateTestDelay;A&&(p=(l?Math.min(l,n.maxLoadingDelay):n.maxLoadingDelay)-A,D.trace(`[abr] bitrate test took ${Math.round(1e3*A)}ms, set first fragment max fetchDuration to ${Math.round(1e3*p)} ms`),y=_=1)}return f=this.findBestLevel(d,a,r,h+p,y,_),Math.max(f,0)}findBestLevel(e,t,i,r,n,a){var o;const{fragCurrent:l,partCurrent:c,lastLoadedFragLevel:d}=this,{levels:u}=this.hls,h=u[d],f=!!(h!=null&&(o=h.details)!=null&&o.live),p=h==null?void 0:h.codecSet,y=c?c.duration:l?l.duration:0,_=this.bwEstimator.getEstimateTTFB()/1e3;let A=t,x=-1;for(let I=i;I>=t;I--){const P=u[I];if(!P||p&&P.codecSet!==p){P&&(A=Math.min(I,A),x=Math.max(I,x));continue}x!==-1&&D.trace(`[abr] Skipped level(s) ${A}-${x} with CODECS:"${u[x].attrs.CODECS}"; not compatible with "${h.attrs.CODECS}"`);const L=P.details,B=(c?L==null?void 0:L.partTarget:L==null?void 0:L.averagetargetduration)||y;let O;I<=d?O=n*e:O=a*e;const F=u[I].maxBitrate,V=this.getTimeToLoadFrag(_,O,F*B,L===void 0);if(D.trace(`[abr] level:${I} adjustedbw-bitrate:${Math.round(O-F)} avgDuration:${B.toFixed(1)} maxFetchDuration:${r.toFixed(1)} fetchDuration:${V.toFixed(1)}`),O>F&&(V===0||!oe(V)||f&&!this.bitrateTestDelay||V<r))return I}return-1}set nextAutoLevel(e){this._nextAutoLevel=e}}class Oh{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=wE(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function wE(s,e){const t=new Uint8Array(e);let i=0;for(let r=0;r<s.length;r++){const n=s[r];t.set(n,i),i+=n.length}return t}const Rd=100;class RE extends Kl{constructor(e,t,i){super(e,t,i,"[audio-stream-controller]",ge.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.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;
vendor: 9,478 bytes, line 42
42e.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.LEVEL_LOADED,this.onLevelLoaded,this),e.on(T.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(T.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(T.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(T.ERROR,this.onError,this),e.on(T.BUFFER_RESET,this.onBufferReset,this),e.on(T.BUFFER_CREATED,this.onBufferCreated,this),e.on(T.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(T.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(T.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.LEVEL_LOADED,this.onLevelLoaded,this),e.off(T.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(T.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(T.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(T.ERROR,this.onError,this),e.off(T.BUFFER_RESET,this.onBufferReset,this),e.off(T.BUFFER_CREATED,this.onBufferCreated,this),e.off(T.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(T.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(T.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){if(i==="main"){const a=t.cc;this.initPTS[t.cc]={baseTime:r,timescale:n},this.log(`InitPTS for cc: ${a} found from main: ${r}`),this.videoTrackCC=a,this.state===q.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=q.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(Rd),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=q.IDLE):(this.loadedmetadata=!1,this.state=q.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case q.IDLE:this.doTickIdle();break;case q.WAITING_TRACK:{var e;const{levels:i,trackId:r}=this,n=i==null||(e=i[r])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=q.WAITING_INIT_PTS}break}case q.FRAG_LOADING_WAITING_RETRY:{var t;const i=performance.now(),r=this.retryDate;(!r||i>=r||(t=this.media)!=null&&t.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=q.IDLE);break}case q.WAITING_INIT_PTS:{const i=this.waitingData;if(i){const{frag:r,part:n,cache:a,complete:o}=i;if(this.initPTS[r.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=q.FRAG_LOADING;const l=a.flush(),c={frag:r,part:n,payload:l,networkDetails:null};this._handleFragmentLoadProgress(c),o&&super._handleFragmentLoadComplete(c)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${r.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const l=this.getLoadPosition(),c=Ye.bufferInfo(this.mediaBuffer,l,this.config.maxBufferHole);Yo(c.end,this.config.maxFragLookUpTolerance,r)<0&&(this.log(`Waiting fragment cc (${r.cc}) @ ${r.start} cancelled because another fragment at ${c.end} is needed`),this.clearWaitingFragment())}}else this.state=q.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=q.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:i,trackId:r}=this,n=e.config;if(!(t!=null&&t[r])||!i&&(this.startFragRequested||!n.startFragPrefetch))return;const a=t[r],o=a.details;if(!o||o.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(o)){this.state=q.WAITING_TRACK;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,$e.AUDIO,ge.AUDIO));const c=this.getFwdBufferInfo(l,ge.AUDIO);if(c===null)return;const{bufferedTrack:d,switchingTrack:u}=this;if(!u&&this._streamEnded(c,o)){e.trigger(T.BUFFER_EOS,{type:"audio"}),this.state=q.ENDED;return}const h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,ge.MAIN),f=c.len,p=this.getMaxBufferLength(h==null?void 0:h.len);if(f>=p&&!u)return;const _=o.fragments[0].start;let A=c.end;if(u&&i){const L=this.getLoadPosition();d&&u.attrs!==d.attrs&&(A=L),o.PTSKnown&&L<_&&(c.end>_||c.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=_+.05)}let x=this.getNextFragment(A,o),I=!1;if(x&&this.isLoopLoading(x,A)&&(I=!!x.gap,x=this.getNextFragmentLoopLoading(x,o,c,ge.MAIN,p)),!x){this.bufferFlushed=!0;return}const P=h&&x.start>h.end+o.targetduration;if(P||!(h!=null&&h.len)&&c.len){const L=this.getAppendedFrag(x.start,ge.MAIN);if(L===null||(I||(I=!!L.gap||!!P&&h.len===0),P&&!I||I&&c.nextStart&&c.nextStart<L.end))return}this.loadFragment(x,a,A)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new Zr(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?this.setInterval(Rd):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=q.IDLE):(this.switchingTrack=null,this.bufferedTrack=t,this.state=q.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!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(T.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:r}=this,{details:n,id:a}=t;if(!r){this.warn(`Audio tracks were reset while loading level ${a}`);return}this.log(`Track ${a} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const o=r[a];let l=0;if(n.live||(i=o.details)!=null&&i.live){this.checkLiveUpdate(n);const c=this.mainDetails;if(n.deltaUpdateFailed||!c)return;!o.details&&n.hasProgramDateTime&&c.hasProgramDateTime?(yh(n,c),l=n.fragments[0].start):l=this.alignPlaylists(n,o.details)}o.details=n,this.levelLastLoaded=a,!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(o.details,l),this.state===q.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=q.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,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 ${i.sn} of level ${i.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(i.start);return}const u=a.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new Ph(this.hls,ge.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const f=this.initPTS[i.cc],p=(t=i.initSegment)==null?void 0:t.data;if(f!==void 0){const _=r?r.index:-1,A=_!==-1,x=new Hl(i.level,i.sn,i.stats.chunkCount,n.byteLength,_,A);h.push(n,p,u,"",i,r,d.totalduration,!1,x,f)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${d.startSN} ,${d.endSN}],track ${o}`);const{cache:y}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new Oh,complete:!1};y.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=q.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 i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i.type!==ge.AUDIO){if(!this.loadedmetadata&&i.type===ge.MAIN){const n=this.videoBuffer||this.media;n&&Ye.getBuffered(n).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(i.sn!=="initSegment"){this.fragPrevious=i;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(T.AUDIO_TRACK_SWITCHED,Pt({},n)))}this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=q.ERROR;return}switch(t.details){case G.FRAG_GAP:case G.FRAG_PARSING_ERROR:case G.FRAG_DECRYPT_ERROR:case G.FRAG_LOAD_ERROR:case G.FRAG_LOAD_TIMEOUT:case G.
42KEY_LOAD_ERROR:case G.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ge.AUDIO,t);break;case G.AUDIO_TRACK_LOAD_ERROR:case G.AUDIO_TRACK_LOAD_TIMEOUT:case G.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===q.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===Ce.AUDIO_TRACK&&(this.state=q.IDLE);break;case G.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case G.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushed(e,{type:t}){t===$e.AUDIO&&(this.bufferFlushed=!0,this.state===q.ENDED&&(this.state=q.IDLE))}_handleTransmuxComplete(e){var t;const i="audio",{hls:r}=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:h,text:f,id3:p,initSegment:y}=n;if(this.fragContextChanged(l)||!u){this.fragmentTracker.removeFragment(l);return}if(this.state=q.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),y!=null&&y.tracks){const _=l.initSegment||l;this._bufferInitSegment(y.tracks,_,a),r.trigger(T.FRAG_PARSING_INIT_SEGMENT,{frag:_,id:i,tracks:y.tracks})}if(h){const{startPTS:_,endPTS:A,startDTS:x,endDTS:I}=h;c&&(c.elementaryStreams[$e.AUDIO]={startPTS:_,endPTS:A,startDTS:x,endDTS:I}),l.setElementaryStreamInfo($e.AUDIO,_,A,x,I),this.bufferFragmentData(h,l,c,a)}if(p!=null&&(t=p.samples)!=null&&t.length){const _=dt({id:i,frag:l,details:u},p);r.trigger(T.FRAG_PARSING_METADATA,_)}if(f){const _=dt({id:i,frag:l,details:u},f);r.trigger(T.FRAG_PARSING_USERDATA,_)}}_bufferInitSegment(e,t,i){if(this.state!==q.PARSING)return;e.video&&delete e.video;const r=e.audio;if(!r)return;r.levelCodec=r.codec,r.id="audio",this.log(`Init audio buffer, container:${r.container}, codecs[parsed]=[${r.codec}]`),this.hls.trigger(T.BUFFER_CODECS,e);const n=r.initSegment;if(n!=null&&n.byteLength){const a={type:"audio",frag:t,part:null,chunkMeta:i,parent:t.type,data:n};this.hls.trigger(T.BUFFER_APPENDING,a)}this.tick()}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||r===vt.NOT_LOADED||r===vt.PARTIAL){var n;e.sn==="initSegment"?this._loadInitSegment(e,t):(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=q.WAITING_INIT_PTS):(this.startFragRequested=!0,super.loadFragment(e,t,i))}else this.clearTrackerIfNeeded(e)}completeAudioSwitch(e){const{hls:t,media:i,bufferedTrack:r}=this,n=r==null?void 0:r.attrs,a=e.attrs;i&&n&&(n.CHANNELS!==a.CHANNELS||n.NAME!==a.NAME||n.LANGUAGE!==a.LANGUAGE)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio")),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(T.AUDIO_TRACK_SWITCHED,Pt({},e))}}class kE extends Gl{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_PARSED,this.onManifestParsed,this),e.on(T.LEVEL_LOADING,this.onLevelLoading,this),e.on(T.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(T.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(T.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_PARSED,this.onManifestParsed,this),e.off(T.LEVEL_LOADING,this.onLevelLoading,this),e.off(T.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(T.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(T.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:r,details:n}=t,a=this.tracksInGroup[i];
42if(!a||a.groupId!==r){this.warn(`Track with id:${i} and group:${r} not found in active group ${a.groupId}`);return}const o=a.details;a.details=t.details,this.log(`audio-track ${i} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,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!=null&&t.audioGroupIds))return;const i=t.audioGroupIds[t.urlId];if(this.groupId!==i){this.groupId=i||null;const r=this.tracks.filter(a=>!i||a.groupId===i);this.selectDefaultTrack&&!r.some(a=>a.default)&&(this.selectDefaultTrack=!1),this.tracksInGroup=r;const n={audioTracks:r};this.log(`Updating audio tracks, ${r.length} track(s) found in group:${i}`),this.hls.trigger(T.AUDIO_TRACKS_UPDATED,n),this.selectInitialTrack()}else this.shouldReloadPlaylist(this.currentTrack)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===Ce.AUDIO_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&(this.requestScheduled=-1,this.checkRetry(t))}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();const i=this.currentTrack;t[this.trackId];const r=t[e],{groupId:n,name:a}=r;if(this.log(`Switching to audio-track ${e} "${a}" lang:${r.lang} group:${n}`),this.trackId=e,this.currentTrack=r,this.selectDefaultTrack=!1,this.hls.trigger(T.AUDIO_TRACK_SWITCHING,Pt({},r)),r.details&&!r.details.live)return;const o=this.switchParams(r.url,i==null?void 0:i.details);this.loadPlaylist(o)}selectInitialTrack(){const e=this.tracksInGroup,t=this.findTrackId(this.currentTrack)|this.findTrackId(null);if(t!==-1)this.setAudioTrack(t);else{const i=new Error(`No track found for running audio group-ID: ${this.groupId} track count: ${e.length}`);this.warn(i.message),this.hls.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:i})}}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||e.attrs["STABLE-RENDITION-ID"]!==void 0&&e.attrs["STABLE-RENDITION-ID"]===r.attrs["STABLE-RENDITION-ID"]||e.name===r.name&&e.lang===r.lang))return r.id}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(t)){const i=t.id,r=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 ${i} "${t.name}" lang:${t.lang} group:${r}`),this.clearTimer(),this.hls.trigger(T.AUDIO_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}}function Nh(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!DE(s[t].attrs,e[t].attrs))return!1;return!0}function DE(s,e){const t=s["STABLE-RENDITION-ID"];return t?t===e["STABLE-RENDITION-ID"]:!["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED"].some(i=>s[i]!==e[i])}const kd=500;class CE extends Kl{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",ge.SUBTITLE),this.levels=[],this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;
42e.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.LEVEL_LOADED,this.onLevelLoaded,this),e.on(T.ERROR,this.onError,this),e.on(T.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(T.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(T.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(T.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(T.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(T.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.LEVEL_LOADED,this.onLevelLoaded,this),e.off(T.ERROR,this.onError,this),e.off(T.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(T.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(T.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(T.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(T.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(T.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=q.IDLE,this.setInterval(kd),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:i,success:r}=t;if(this.fragPrevious=i,this.state=q.IDLE,!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let a;const o=i.start;for(let c=0;c<n.length;c++)if(o>=n[c].start&&o<=n[c].end){a=n[c];break}const l=i.start+i.duration;a?a.end=l:(a={start:o,end:l},n.push(a)),this.fragmentTracker.fragBuffered(i)}onBufferFlushing(e,t){const{startOffset:i,endOffset:r}=t;if(i===0&&r!==Number.POSITIVE_INFINITY){const n=r-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(i,n,ge.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===ge.MAIN){var i;(i=this.media)!=null&&i.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===ge.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==q.STOPPED&&(this.state=q.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(Nh(this.levels,t)){this.levels=t.map(i=>new Zr(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new Zr(i);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,ge.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){if(this.currentTrackId=t.id,!this.levels.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(kd)}onSubtitleTrackLoaded(e,t){var i;const{details:r,id:n}=t,{currentTrackId:a,levels:o}=this;if(!o.length)return;const l=o[a];if(n>=o.length||n!==a||!l)return;this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(r.live||(i=l.details)!=null&&i.live){const d=this.mainDetails;if(r.deltaUpdateFailed||!d)return;const u=d.fragments[0];l.details?(c=this.alignPlaylists(r,l.details),c===0&&u&&(c=u.start,qo(r,c))):r.hasProgramDateTime&&d.hasProgramDateTime?(yh(r,d),c=r.fragments[0].start):u&&(c=u.start,qo(r,c))}l.details=r,this.levelLastLoaded=n,!this.startFragRequested&&(this.mainDetails||!r.live)&&this.setStartPosition(l.details,c),this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===q.IDLE&&(Jr(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&r&&r.key&&r.iv&&r.method==="AES-128"){const a=performance.now();
42this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer).catch(o=>{throw n.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const l=performance.now();n.trigger(T.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:a,tdecrypt:l}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=q.IDLE})}}doTick(){if(!this.media){this.state=q.IDLE;return}if(this.state===q.IDLE){const{currentTrackId:e,levels:t}=this,i=t[e];if(!t.length||!i||!i.details)return;const{config:r}=this,n=this.getLoadPosition(),a=Ye.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:o,len:l}=a,c=this.getFwdBufferInfo(this.media,ge.MAIN),d=i.details,u=this.getMaxBufferLength(c==null?void 0:c.len)+d.levelTargetDuration;if(l>u)return;const h=d.fragments,f=h.length,p=d.edge;let y=null;const _=this.fragPrevious;if(o<p){const A=r.maxFragLookUpTolerance,x=o>p-A?0:A;y=Jr(_,h,Math.max(h[0].start,o),x),!y&&_&&_.start<h[0].start&&(y=h[0])}else y=h[f-1];if(!y)return;if(y=this.mapToInitFragWhenRequired(y),y.sn!=="initSegment"){const A=y.sn-d.startSN,x=h[A-1];x&&x.cc===y.cc&&this.fragmentTracker.getState(x)===vt.NOT_LOADED&&(y=x)}this.fragmentTracker.getState(y)===vt.NOT_LOADED&&this.loadFragment(y,i,o)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,i){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,i))}get mediaBufferTimeRanges(){return new ME(this.tracksBuffered[this.currentTrackId]||[])}}class ME{constructor(e){this.buffered=void 0;const t=(i,r,n)=>{if(r=r>>>0,r>n-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return e[r][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}class PE extends Gl{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.trackChangeListener=()=>this.onTextTracksChanged(),this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes(this.trackId)}registerListeners(){const{hls:e}=this;
vendor: 1,630 bytes, line 42
42e.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_PARSED,this.onManifestParsed,this),e.on(T.LEVEL_LOADING,this.onLevelLoading,this),e.on(T.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(T.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(T.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_PARSED,this.onManifestParsed,this),e.off(T.LEVEL_LOADING,this.onLevelLoading,this),e.off(T.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(T.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(T.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.trackChangeListener,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),To(this.media.textTracks).forEac
42h(t=>{ir(t)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,details:r}=t,{trackId:n}=this,a=this.tracksInGroup[n];if(!a){this.warn(`Invalid subtitle track id ${i}`);return}const o=a.details;a.details=t.details,this.log(`subtitle track ${i} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,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!=null&&t.textGroupIds))return;const i=t.textGroupIds[t.urlId],r=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;if(this.groupId!==i){const n=this.tracks.filter(l=>!i||l.groupId===i);this.tracksInGroup=n;const a=this.findTrackId(r==null?void 0:r.name)||this.findTrackId();this.groupId=i||null;const o={subtitleTracks:n};this.log(`Updating subtitle tracks, ${n.length} track(s) found in "${i}" group-id`),this.hls.trigger(T.SUBTITLE_TRACKS_UPDATED,o),a!==-1&&this.setSubtitleTrack(a,r)}else this.shouldReloadPlaylist(r)&&this.setSubtitleTrack(this.trackId,r)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||e===r.name))return r.id}return-1}onError(e,t){t.fatal||!t.context||t.context.type===Ce.SUBTITLE_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.checkRetry(t)}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1;const t=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,t)}loadPlaylist(e){super.loadPlaylist();const t=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(t)){const i=t.id,r=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 ${i}`),this.hls.trigger(T.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}toggleTrackModes(e){const{media:t,trackId:i}=this;if(!t)return;const r=To(t.textTracks),n=r.filter(o=>o.groupId===this.groupId);if(e===-1)[].slice.call(r).forEach(o=>{o.mode="disabled"});else{const o=n[i];o&&(o.mode="disabled")}const a=n[e];a&&(a.mode=this.subtitleDisplay?"showing":"hidden")}setSubtitleTrack(e,t){var i;const r=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(e===-1||(i=r[e])!=null&&i.details)||e<-1||e>=r.length)return;this.clearTimer();const n=r[e];if(this.log(`Switching to subtitle-track ${e}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:"")),this.trackId=e,n){const{id:a,groupId:o="",name:l,type:c,url:d}=n;this.hls.trigger(T.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:l,type:c,url:d});const u=this.switchParams(n.url,t==null?void 0:t.details);this.loadPlaylist(u)}else this.hls.trigger(T.SUBTITLE_TRACK_SWITCH,{id:e})}onTextTracksChanged(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=-1;const t=To(this.media.textTracks);for(let i=0;i<t.length;i++)if(t[i].mode==="hidden")e=i;else if(t[i].mode==="showing"){e=i;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)}}function To(s){const e=[];for(let t=0;t<s.length;t++){const i=s[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(s[t])}return e}class OE{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t){const i=this.queues[t];i.push(e),i.length===1&&this.buffers[t]&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise(n=>{t=n}),r={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(r,e),i}executeNext(e){const{buffers:t,queues:i}=this,r=t[e],n=i[e];if(n.length){const a=n[0];try{a.execute()}catch(o){D.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),a.onError(o),r!=null&&r.updating||(n.shift(),this.executeNext(e))}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Dd=Va(),Cd=/([ha]vc.)(?:\.[^.,]+)+/;class NE{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.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=()=>{const{media:t,mediaSource:i}=this;D.log("[buffer-controller]: Media source opened"),t&&(t.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(T.MEDIA_ATTA
42CHED,{media:t})),i&&i.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{D.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=()=>{D.log("[buffer-controller]: Media source ended")},this._onMediaEmptied=()=>{const{media:t,_objectUrl:i}=this;t&&t.src!==i&&D.error(`Media element src was set while attaching MediaSource (${i} > ${t.src})`)},this.hls=e,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}registerListeners(){const{hls:e}=this;e.on(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_PARSED,this.onManifestParsed,this),e.on(T.BUFFER_RESET,this.onBufferReset,this),e.on(T.BUFFER_APPENDING,this.onBufferAppending,this),e.on(T.BUFFER_CODECS,this.onBufferCodecs,this),e.on(T.BUFFER_EOS,this.onBufferEos,this),e.on(T.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(T.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(T.FRAG_PARSED,this.onFragParsed,this),e.on(T.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;
42e.off(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_PARSED,this.onManifestParsed,this),e.off(T.BUFFER_RESET,this.onBufferReset,this),e.off(T.BUFFER_APPENDING,this.onBufferAppending,this),e.off(T.BUFFER_CODECS,this.onBufferCodecs,this),e.off(T.BUFFER_EOS,this.onBufferEos,this),e.off(T.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(T.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(T.FRAG_PARSED,this.onFragParsed,this),e.off(T.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new OE(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,D.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media;if(i&&Dd){const r=this.mediaSource=new Dd;r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(r),this._objectUrl=i.src,i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(D.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(r){D.warn(`[buffer-controller]: onMediaDetaching: ${r.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),e.src===i?(e.removeAttribute("src"),e.load()):D.warn("[buffer-controller]: media.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(T.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{const t=this.sourceBuffer[e];try{t&&(this.removeBufferListeners(e),this.mediaSource&&this.mediaSource.removeSourceBuffer(t),this.sourceBuffer[e]=void 0)}catch(i){D.warn(`[buffer-controller]: Failed to reset the ${e} buffer`,i)}}),this._initSourceBuffer()}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length;Object.keys(t).forEach(r=>{if(i){const n=this.tracks[r];if(n&&typeof n.buffer.changeType=="function"){const{id:a,codec:o,levelCodec:l,container:c,metadata:d}=t[r],u=(n.levelCodec||n.codec).replace(Cd,"$1"),h=(l||o).replace(Cd,"$1");if(u!==h){const f=`${c};codecs=${l||o}`;this.appendChangeType(r,f),D.log(`[buffer-controller]: switching codec ${u} to ${h}`),this.tracks[r]={buffer:n.buffer,codec:o,container:c,levelCodec:l,metadata:d,id:a}}}}else this.pendingTracks[r]=t[r]}),!i&&(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())}appendChangeType(e,t){const{operationQueue:i}=this,r={execute:()=>{const n=this.sourceBuffer[e];n&&(D.log(`[buffer-controller]: changing ${e} sourceBuffer type to ${t}`),n.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{D.warn(`[buffer-controller]: Failed to change ${e} SourceBuffer type`,n)}};i.append(r,e)}onBufferAppending(e,t){const{hls:i,operationQueue:r,tracks:n}=this,{data:a,type:o,frag:l,part:c,chunkMeta:d}=t,u=d.buffering[o],h=self.performance.now();u.start=h;const f=l.stats.buffering,p=c?c.stats.buffering:null;f.start===0&&(f.start=h),p&&p.start===0&&(p.start=h);const y=n.audio;let _=!1;o==="audio"&&(y==null?void 0:y.container)==="audio/mpeg"&&(_=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const A=l.start,x={execute:()=>{if(u.executeStart=self.performance.now(),_){const I=this.sourceBuffer[o];if(I){const P=A-I.timestampOffset;Math.abs(P)>=.1&&(D.log(`[buffer-controller]: Updating audio SourceBuffer timestampOffset to ${A} (delta: ${P}) sn: ${l.sn}
42)`),I.timestampOffset=A)}}this.appendExecutor(a,o)},onStart:()=>{},onComplete:()=>{const I=self.performance.now();u.executeEnd=u.end=I,f.first===0&&(f.first=I),p&&p.first===0&&(p.first=I);const{sourceBuffer:P}=this,L={};for(const B in P)L[B]=Ye.getBuffered(P[B]);this.appendError=0,this.hls.trigger(T.BUFFER_APPENDED,{type:o,frag:l,part:c,chunkMeta:d,parent:l.type,timeRanges:L})},onError:I=>{D.error(`[buffer-controller]: Error encountered while trying to append to the ${o} SourceBuffer`,I);const P={type:me.MEDIA_ERROR,parent:l.type,details:G.BUFFER_APPEND_ERROR,frag:l,part:c,chunkMeta:d,error:I,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?P.details=G.BUFFER_FULL_ERROR:(this.appendError++,P.details=G.BUFFER_APPEND_ERROR,this.appendError>i.config.appendErrorMaxRetry&&(D.error(`[buffer-controller]: Failed ${i.config.appendErrorMaxRetry} times to append segment in sourceBuffer`),P.fatal=!0)),i.trigger(T.ERROR,P)}};r.append(x,o)}onBufferFlushing(e,t){const{operationQueue:i}=this,r=n=>({execute:this.removeExecutor.bind(this,n,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(T.BUFFER_FLUSHED,{type:n})},onError:a=>{D.warn(`[buffer-controller]: Failed to remove from ${n} SourceBuffer`,a)}});t.type?i.append(r(t.type),t.type):this.getSourceBufferTypes().forEach(n=>{i.append(r(n),n)})}onFragParsed(e,t){const{frag:i,part:r}=t,n=[],a=r?r.elementaryStreams:i.elementaryStreams;a[$e.AUDIOVIDEO]?n.push("audiovideo"):(a[$e.AUDIO]&&n.push("audio"),a[$e.VIDEO]&&n.push("video"));const o=()=>{const l=self.performance.now();i.stats.buffering.end=l,r&&(r.stats.buffering.end=l);const c=r?r.stats:i.stats;this.hls.trigger(T.FRAG_BUFFERED,{frag:i,part:r,stats:c,id:i.type})};n.length===0&&D.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(o,n)}onFragChanged(e,t){this.flushBackBuffer()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((r,n)=>{const a=this.sourceBuffer[n];return a&&(!t.type||t.type===n)&&(a.ending=!0,a.ended||(a.ended=!0,D.log(`[buffer-controller]: ${n} sourceBuffer now EOS`))),r&&!!(!a||a.ended)},!0)&&(D.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(n=>{const a=this.sourceBuffer[n];a&&(a.ending=!1)});const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&D.info(`[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}D.log("[buffer-controller]: Calling mediaSource.endOfStream()"),r.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}flushBackBuffer(){const{hls:e,details:t,media:i,sourceBuffer:r}=this;if(!i||t===null)return;const n=this.getSourceBufferTypes();if(!n.length)return;const a=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(!oe(a)||a<0)return;const o=i.currentTime,l=t.levelTargetDuration,c=Math.max(a,l),d=Math.floor(o/l)*l-c;n.forEach(u=>{const h=r[u];if(h){const f=Ye.getBuffered(h);if(f.length>0&&d>f.start(0)){if(e.trigger(T.BACK_BUFFER_REACHED,{bufferEnd:d}),t.live)e.trigger(T.LIVE_BACK_BUFFER_REACHED,{bufferEnd:d});else if(h.ended&&f.end(f.length-1)-o<l*2){D.info(`[buffer-controller]: Cannot flush ${u} back buffer while SourceBuffer is in ended state`);return}e.trigger(T.BUFFER_FLUSHING,{startOffset:0,endOffset:d,type:u})}}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:i,mediaSource:r}=this,n=e.fragments[0].start+e.totalduration,a=i.duration,o=oe(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(D.log("[buffer-controller]: Media Source duration is set to Infinity"),r.duration=1/0,this.updateSeekableRange(e)):(n>o&&n>a||!oe(a))&&(D.log(`[buffer-controller]: Updating Media Source duration to ${n.toFixed(3)}`),r.duration=n)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){const n=Math.max(0,i[0].start),a=Math.max(n,n+e.totalduration);t.setLiveSeekableRange(n,a)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,r=Object.keys(i).length;if(r&&!e||r===2){this.createSourceBuffers(i),this.pendingTracks={};const n=this.getSourceBufferTypes();if(n.length)this.hls.trigger(T.BUFFER_CREATED,{tracks:this.tracks}
42),n.forEach(a=>{t.executeNext(a)});else{const a=new Error("could not create source buffer for media codec(s)");this.hls.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:a,reason:a.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const r in e)if(!t[r]){const n=e[r];if(!n)throw Error(`source buffer exists for track ${r}, however track does not`);const a=n.levelCodec||n.codec,o=`${n.container};codecs=${a}`;D.log(`[buffer-controller]: creating sourceBuffer(${o})`);try{const l=t[r]=i.addSourceBuffer(o),c=r;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[r]={buffer:l,codec:a,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id}}catch(l){D.error(`[buffer-controller]: error while trying to add sourceBuffer: ${l.message}`),this.hls.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:o})}}}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){const{operationQueue:t}=this;t.current(e).onComplete(),t.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){const i=new Error(`${e} SourceBuffer error`);D.error(`[buffer-controller]: ${i}`,t),this.hls.trigger(T.ERROR,{type:me.MEDIA_ERROR,details:G.BUFFER_APPENDING_ERROR,error:i,fatal:!1});const r=this.operationQueue.current(e);r&&r.onError(t)}removeExecutor(e,t,i){const{media:r,mediaSource:n,operationQueue:a,sourceBuffer:o}=this,l=o[e];if(!r||!n||!l){D.warn(`[buffer-controller]: Attempting to remove from the ${e} SourceBuffer, but it does not exist`),a.shiftAndExecuteNext(e);return}const c=oe(r.duration)?r.duration:1/0,d=oe(n.duration)?n.duration:1/0,u=Math.max(0,t),h=Math.min(i,c,d);h>u&&!l.ending?(l.ended=!1,D.log(`[buffer-controller]: Removing [${u},${h}] from the ${e} SourceBuffer`),l.remove(u,h)):a.shiftAndExecuteNext(e)}appendExecutor(e,t){const{operationQueue:i,sourceBuffer:r}=this,n=r[t];if(!n){D.warn(`[buffer-controller]: Attempting to append to the ${t} SourceBuffer, but it does not exist`),i.shiftAndExecuteNext(t);return}n.ended=!1,n.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){D.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:i}=this,r=t.map(n=>i.appendBlocker(n));Promise.all(r).then(()=>{e(),t.forEach(n=>{const a=this.sourceBuffer[n];a!=null&&a.updating||i.shiftAndExecuteNext(n)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const r=this.sourceBuffer[e];if(!r)return;const n=i.bind(this,e);this.listeners[e].push({event:t,listener:n}),r.addEventListener(t,n)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(i=>{t.removeEventListener(i.event,i.listener)})}}const Md={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},Fh=function(e){let t=e;return Md.hasOwnProperty(e)&&(t=Md[e]),String.fromCharCode(t)},si=15,Ci=100,FE={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},UE={17:2,18:4,21:6,22:8,23:10,19:13,20:15},BE={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},$E={25:2,26:4,29:6,30:8,31:10,27:13,28:15},GE=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class HE{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;D.log(`${this.time} [${e}] ${i}`)}}}const ss=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Uh{constructor(e,t,i,r,n){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=i||!1,this.background=r||"black",this.flash=n||!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 i=0;i<t.length;i++){const r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class VE{constructor(e,t,i,r,n,a){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new Uh(t,i,r,n,a)}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 WE{constructor(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(let t=0;t<Ci;t++)this.chars.push(new VE);this.logger=e,this.pos=0,this.currPenState=new Uh}equals(e){let t=!0;for(let i=0;i<Ci;i++)if(!this.chars[i].equals(e.chars[i])){t=!1;break}return t}copy(e){for(let t=0;t<Ci;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Ci;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}
vendor: 5,798 bytes, lines 42-43
42setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Ci&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Ci)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].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=Fh(e);if(this.pos>=Ci){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<Ci;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 i=0;i<Ci;i++){const r=this.chars[i].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class bo{constructor(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(let t=0;t<si;t++)this.rows.push(new WE(e));this.logger=e,this.currRow=si-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}reset(){for(let e=0;e<si;e++)this.rows[e].clear();this.currRow=si-1}equals(e){let t=!0;for(let i=0;i<si;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<si;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<si;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<si;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&&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 i=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,a=Math.max(n-1,0);i.setCursor(e.indent),e.color=i.chars[a].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}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 i="",r=-1;for(let n=0;n<si;n++){const a=this.rows[n].getTextString();a&&(r=n+1,e?t.push("Row "+r+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(` 43`)),i}getTextAndFormat(){return this.rows}}class Pd{constructor(e,t,i){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 bo(i),this.nonDisplayedMemory=new bo(i),this.lastOutputScreen=new bo(i),this.currRollUpRow=this.displayedMemory.rows[si-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[si-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 i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);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})}
43ccRDC(){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 i=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[i]}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 Od{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;const r=new HE;this.channels=[null,new Pd(e,t,r),new Pd(e+1,i,r)],this.cmdHistory=Fd(),this.logger=r}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){let i,r,n,a=!1;this.logger.time=e;for(let o=0;o<t.length;o+=2)if(r=t[o]&127,n=t[o+1]&127,!(r===0&&n===0)){if(this.logger.log(3,"["+ss([t[o],t[o+1]])+"] -> ("+ss([r,n])+")"),i=this.parseCmd(r,n),i||(i=this.parseMidrow(r,n)),i||(i=this.parsePAC(r,n)),i||(i=this.parseBackgroundAttributes(r,n)),!i&&(a=this.parseChars(r,n),a)){const l=this.currentChannel;l&&l>0?this.channels[l].insertChars(a):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!i&&!a&&this.logger.log(2,"Couldn't parse cleaned data "+ss([r,n])+" orig: "+ss([t[o],t[o+1]]))}}parseCmd(e,t){const{cmdHistory:i}=this,r=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(r||n))return!1;if(Nd(e,t,i))return Os(null,null,i),this.logger.log(3,"Repeated command ("+ss([e,t])+") is dropped"),!0;const a=e===20||e===21||e===23?1:2,o=this.channels[a];return e===20||e===21||e===28||e===29?t===32?o.ccRCL():t===33?o.ccBS():t===34?o.ccAOF():t===35?o.ccAON():t===36?o.ccDER():t===37?o.ccRU(2):t===38?o.ccRU(3):t===39?o.ccRU(4):t===40?o.ccFON():t===41?o.ccRDC():t===42?o.ccTR():t===43?o.ccRTD():t===44?o.ccEDM():t===45?o.ccCR():t===46?o.ccENM():t===47&&o.ccEOC():o.ccTO(t-32),Os(e,t,i),this.currentChannel=a,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[i];return r?(r.ccMIDROW(t),this.logger.log(3,"MIDROW ("+ss([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const r=this.cmdHistory,n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,a=(e===16||e===24)&&t>=64&&t<=95;if(!(n||a))return!1;if(Nd(e,t,r))return Os(null,null,r),!0;const o=e<=23?1:2;t>=64&&t<=95?i=o===1?FE[e]:BE[e]:i=o===1?UE[e]:$E[e];const l=this.channels[o];return l?(l.setPAC(this.interpretPAC(i,t)),Os(e,t,r),this.currentChannel=o,!0):!1}interpretPAC(e,t){let i;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,r.underline=(i&1)===1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((i-16)/2)*4,r}parseChars(e,t){let i,r=null,n=null;if(e>=25?(i=2,n=e-8):(i=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 '"+Fh(a)+"' in channel "+i),r=[a]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);if(r){const a=ss(r);this.logger.log(3,"Char codes = "+a.join(",")),Os(e,t,this.cmdHistory)}return r}
vendor: 9,348 bytes, lines 43-49
43parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(i||r))return!1;let n;const a={};e===16||e===24?(n=Math.floor((t-32)/2),a.background=GE[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),Os(e,t,this.cmdHistory),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}this.cmdHistory=Fd()}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function Os(s,e,t){t.a=s,t.b=e}function Nd(s,e,t){return t.a===s&&t.b===e}function Fd(){return{a:null,b:null}}class _n{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,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var Xl=function(){if(typeof self<"u"&&self.VTTCue)return self.VTTCue;const s=["","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 i(o){return t(s,o)}function r(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 h="",f=!1,p=o,y=l,_=c,A=null,x="",I=!0,P="auto",L="start",B=50,O="middle",F=50,V="middle";Object.defineProperty(d,"id",n({},u,{get:function(){return h},set:function($){h=""+$}})),Object.defineProperty(d,"pauseOnExit",n({},u,{get:function(){return f},set:function($){f=!!$}})),Object.defineProperty(d,"startTime",n({},u,{get:function(){return p},set:function($){if(typeof $!="number")throw new TypeError("Start time must be set to a number.");p=$,this.hasBeenReset=!0}})),Object.defineProperty(d,"endTime",n({},u,{get:function(){return y},set:function($){if(typeof $!="number")throw new TypeError("End time must be set to a number.");y=$,this.hasBeenReset=!0}})),Object.defineProperty(d,"text",n({},u,{get:function(){return _},set:function($){_=""+$,this.hasBeenReset=!0}})),Object.defineProperty(d,"region",n({},u,{get:function(){return A},set:function($){A=$,this.hasBeenReset=!0}})),Object.defineProperty(d,"vertical",n({},u,{get:function(){return x},set:function($){const j=i($);if(j===!1)throw new SyntaxError("An invalid or illegal string was specified.");x=j,this.hasBeenReset=!0}})),Object.defineProperty(d,"snapToLines",n({},u,{get:function(){return I},set:function($){I=!!$,this.hasBeenReset=!0}})),Object.defineProperty(d,"line",n({},u,{get:function(){return P},set:function($){if(typeof $!="number"&&$!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");P=$,this.hasBeenReset=!0}})),Object.defineProperty(d,"lineAlign",n({},u,{get:function(){return L},set:function($){const j=r($);if(!j)throw new SyntaxError("An invalid or illegal string was specified.");L=j,this.hasBeenReset=!0}})),Object.defineProperty(d,"position",n({},u,{get:function(){return B},set:function($){if($<0||$>100)throw new Error("Position must be between 0 and 100.");B=$,this.hasBeenReset=!0}})),Object.defineProperty(d,"positionAlign",n({},u,{get:function(){return O},set:function($){const j=r($);if(!j)throw new SyntaxError("An invalid or illegal string was specified.");O=j,this.hasBeenReset=!0}})),Object.defineProperty(d,"size",n({},u,{get:function(){return F},set:function($){if($<0||$>100)throw new Error("Size must be between 0 and 100.");F=$,this.hasBeenReset=!0}})),Object.defineProperty(d,"align",n({},u,{get:function(){return V},set:function($){const j=r($);if(!j)throw new SyntaxError("An invalid or illegal string was specified.");V=j,this.hasBeenReset=!0}})),d.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class KE{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Bh(s){function e(i,r,n,a){return(i|0)*3600+(r|0)*60+(n|0)+parseFloat(a||0)}const t=s.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 qE{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function $h(s,e,t,i){const r=i?s.split(i):[s];for(const n in r){if(typeof r[n]!="string")continue;const a=r[n].split(t);if(a.length!==2)continue;const o=a[0],l=a[1];e(o,l)}}const zo=new Xl(0,0,""),Tn=zo.align==="middle"?"middle":"center";function YE(s,e,t){const i=s;function r(){const o=Bh(s);if(o===null)throw new Error("Malformed timestamp: "+i);return s=s.replace(/^[^\sa-zA-Z-]+/,""),o}function n(o,l){const c=new qE;$h(o,function(h,f){let p;switch(h){case"region":for(let y=t.length-1;y>=0;y--)if(t[y].id===f){c.set(h,t[y].region);break}break;case"vertical":c.alt(h,f,["rl","lr"]);break;case"line":p=f.split(","),c.integer(h,p[0]),c.percent(h,p[0])&&c.set("snapToLines",!1),c.alt(h,p[0],["auto"]),p.length===2&&c.alt("lineAlign",p[1],["start",Tn,"end"]);break;case"position":p=f.split(","),c.percent(h,p[0]),p.length===2&&c.alt("positionAlign",p[1],["start",Tn,"end","line-left","line-right","auto"]);break;case"size":c.percent(h,f);break;case"align":c.alt(h,f,["start",Tn,"end","left","right"]);break}},/:/,/\s/),l.region=c.get("region",null),l.vertical=c.get("vertical","");let d=c.get("line","auto");d==="auto"&&zo.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",Tn);let u=c.get("position","auto");u==="auto"&&zo.position===50&&(u=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=u}function a(){s=s.replace(/^\s+/,"")}if(a(),e.startTime=r(),a(),s.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);s=s.slice(3),a(),e.endTime=r(),a(),n(s,e)}function Gh(s){return s.replace(/<br(?: \/)?>/gi,` 44`)}class jE{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new KE,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 i(){let n=t.buffer,a=0;for(n=Gh(n);a<n.length&&n[a]!=="\r"&&n[a]!==` 45`;)++a;const o=n.slice(0,a);return n[a]==="\r"&&++a,n[a]===` 46`&&++a,t.buffer=n.slice(a),o}function r(n){$h(n,function(a,o){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=i();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=i(),t.state){case"HEADER":/:/.test(n)?r(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 Xl(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{YE(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+=` 47`),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+=` 48 49`,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 zE=/\r\n|\n\r|\n|\r/g,Ao=function(e,t,i=0){return e.slice(i,i+t.length)===t},XE=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!oe(t)||!oe(i)||!oe(r)||!oe(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*r,t+=60*60*1e3*n,t},So=function(e){let t=5381,i=e.length;for(;i;)t=t*33^e.charCodeAt(--i);return(t>>>0).toString()};function Ql(s,e,t){return So(s.toString())+So(e.toString())+So(t)}const QE=function(e,t,i){let r=e[t],n=e[r.prevCC];if(!n||!n.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(a=n)!=null&&a.new;){var a;
vendor: 4,859 bytes, lines 49-53
49e.ccOffset+=r.start-n.start,r.new=!1,r=n,n=e[r.prevCC]}e.presentationOffset=i};function ZE(s,e,t,i,r,n,a){const o=new jE,l=wi(new Uint8Array(s)).trim().replace(zE,` 50`).split(` 51`),c=[],d=e?cE(e.baseTime,e.timescale):0;let u="00:00.000",h=0,f=0,p,y=!0;o.oncue=function(_){const A=t[i];let x=t.ccOffset;const I=(h-d)/9e4;if(A!=null&&A.new&&(f!==void 0?x=t.ccOffset=A.start:QE(t,i,I)),I){if(!e){p=new Error("Missing initPTS for VTT MPEGTS");return}x=I-t.presentationOffset}const P=_.endTime-_.startTime,L=Xt((_.startTime+x-f)*9e4,r*9e4)/9e4;_.startTime=Math.max(L,0),_.endTime=Math.max(L+P,0);const B=_.text.trim();_.text=decodeURIComponent(encodeURIComponent(B)),_.id||(_.id=Ql(_.startTime,_.endTime,B)),_.endTime>0&&c.push(_)},o.onparsingerror=function(_){p=_},o.onflush=function(){if(p){a(p);return}n(c)},l.forEach(_=>{if(y)if(Ao(_,"X-TIMESTAMP-MAP=")){y=!1,_.slice(16).split(",").forEach(A=>{Ao(A,"LOCAL:")?u=A.slice(6):Ao(A,"MPEGTS:")&&(h=parseInt(A.slice(7)))});try{f=XE(u)/1e3}catch(A){p=A}return}else _===""&&(y=!1);o.parse(_+` 52`)}),o.flush()}const xo="stpp.ttml.im1t",Hh=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Vh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,JE={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ud(s,e,t,i){const r=De(new Uint8Array(s),["mdat"]);if(r.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(o=>wi(o)),a=lE(e.baseTime,1,e.timescale);try{n.forEach(o=>t(ey(o,a)))}catch(o){i(o)}}function ey(s,e){const r=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(n).reduce((u,h)=>(u[h]=r.getAttribute(`ttp:${h}`)||n[h],u),{}),o=r.getAttribute("xml:space")!=="preserve",l=Bd(Io(r,"styling","style")),c=Bd(Io(r,"layout","region")),d=Io(r,"body","[begin]");return[].map.call(d,u=>{const h=Wh(u,o);if(!h||!u.hasAttribute("begin"))return null;const f=wo(u.getAttribute("begin"),a),p=wo(u.getAttribute("dur"),a);let y=wo(u.getAttribute("end"),a);if(f===null)throw $d(u);if(y===null){if(p===null)throw $d(u);y=f+p}const _=new Xl(f-e,y-e,h);_.id=Ql(_.startTime,_.endTime,_.text);const A=c[u.getAttribute("region")],x=l[u.getAttribute("style")],I=ty(A,x,l),{textAlign:P}=I;if(P){const L=JE[P];L&&(_.lineAlign=L),_.align=P}return dt(_,I),_}).filter(u=>u!==null)}function Io(s,e,t){const i=s.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function Bd(s){return s.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function Wh(s,e){return[].slice.call(s.childNodes).reduce((t,i,r)=>{var n;return i.nodeName==="br"&&r?t+` 53`:(n=i.childNodes)!=null&&n.length?Wh(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function ty(s,e,t){const i="http://www.w3.org/ns/ttml#styling";let r=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=s!=null&&s.hasAttribute("style")?s.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(r=t[a]),n.reduce((o,l)=>{const c=Lo(e,i,l)||Lo(s,i,l)||Lo(r,i,l);return c&&(o[l]=c),o},{})}function Lo(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function $d(s){return new Error(`Could not parse ttml timestamp ${s}`)}function wo(s,e){if(!s)return null;let t=Bh(s);return t===null&&(Hh.test(s)?t=iy(s,e):Vh.test(s)&&(t=sy(s,e))),t}function iy(s,e){const t=Hh.exec(s),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function sy(s,e){const t=Vh.exec(s),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class ry{constructor(e){if(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.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Gd(),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}},this.config.enableCEA708Captions){const t=new _n(this,"textTrack1"),i=new _n(this,"textTrack2"),r=new _n(this,"textTrack3"),n=new _n(this,"textTrack4");this.cea608Parser1=new Od(1,t,i),this.cea608Parser2=new Od(3,r,n)}
53e.on(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(T.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(T.FRAG_LOADING,this.onFragLoading,this),e.on(T.FRAG_LOADED,this.onFragLoaded,this),e.on(T.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(T.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(T.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(T.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(T.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(T.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(T.FRAG_LOADING,this.onFragLoading,this),e.off(T.FRAG_LOADED,this.onFragLoaded,this),e.off(T.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(T.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(T.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(T.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(T.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null}addCues(e,t,i,r,n){let a=!1;for(let o=n.length;o--;){const l=n[o],c=ay(l[0],l[1],t,i);if(c>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],i),a=!0,c/(i-t)>.5))return}if(a||n.push([t,i]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,i,r)}else{const o=this.Cues.newCue(null,t,i,r);this.hls.trigger(T.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){const{unparsedVttFrags:a}=this;i==="main"&&(this.initPTS[t.cc]={baseTime:r,timescale:n}),a.length&&(this.unparsedVttFrags=[],a.forEach(o=>{this.onFragLoaded(T.FRAG_LOADED,o)}))}getExistingTrack(e){const{media:t}=this;if(t)for(let i=0;i<t.textTracks.length;i++){const r=t.textTracks[i];if(r[e])return r}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:r}=this,{label:n,languageCode:a}=t[e],o=this.getExistingTrack(e);if(o)i[e]=o,ir(i[e]),hh(i[e],r);else{const l=this.createTextTrack("captions",n,a);l&&(l[e]=!0,i[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,r={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(T.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,i){const r=this.media;if(r)return r.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{ir(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Gd(),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 i=0;i<t.length;i++)ir(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(n=>n.textCodec===xo);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(Nh(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const a=this.media?this.media.textTracks:null;this.tracks.forEach((o,l)=>{let c;if(a&&l<a.length){let d=null;for(let u=0;u<a.length;u++)if(ny(a[u],o)){d=a[u];break}d&&(c=d)}if(c)ir(c);else{const d=this._captionsOrSubtitlesFromCharacteristics(o);c=this.createTextTrack(d,o.name,o.lang),c&&(c.mode="disabled")}c&&(c.groupId=o.groupId,this.textTracks.push(c))})}else if(this.tracks.length){const a=this.tracks.map(o=>
53({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(T.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}_captionsOrSubtitlesFromCharacteristics(e){if(e.attrs.CHARACTERISTICS){const t=/transcribes-spoken-dialog/gi.test(e.attrs.CHARACTERISTICS),i=/describes-music-and-sound/gi.test(e.attrs.CHARACTERISTICS);if(t&&i)return"captions"}return"subtitles"}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const r=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!r)return;const n=`textTrack${r[1]}`,a=this.captionsProperties[n];a&&(a.label=i.name,i.lang&&(a.languageCode=i.lang),a.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){const{cea608Parser1:i,cea608Parser2:r,lastSn:n,lastPartIndex:a}=this;if(!(!this.enabled||!(i&&r))&&t.frag.type===ge.MAIN){var o,l;const c=t.frag.sn,d=(o=t==null||(l=t.part)==null?void 0:l.index)!=null?o:-1;c===n+1||c===n&&d===a+1||(i.reset(),r.reset()),this.lastSn=c,this.lastPartIndex=d}}onFragLoaded(e,t){const{frag:i,payload:r}=t;if(i.type===ge.SUBTITLE)if(r.byteLength){const n=i.decryptdata,a="stats"in t;if(n==null||!n.encrypted||a){const o=this.tracks[i.level],l=this.vttCCs;l[i.cc]||(l[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),o&&o.textCodec===xo?this._parseIMSC1(i,r):this._parseVTTs(t)}}else this.hls.trigger(T.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Ud(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),i.trigger(T.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{D.log(`Failed to parse IMSC1: ${r}`),i.trigger(T.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:i,payload:r}=e,{initPTS:n,unparsedVttFrags:a}=this,o=n.length-1;if(!n[i.cc]&&o===-1){a.push(e);return}const l=this.hls,c=(t=i.initSegment)!=null&&t.data?ws(i.initSegment.data,new Uint8Array(r)):r;ZE(c,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,d=>{this._appendCues(d,i.level),l.trigger(T.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},d=>{const u=d.message==="Missing initPTS for VTT MPEGTS";u?a.push(e):this._fallbackToIMSC1(i,r),D.log(`Failed to parse VTT cue: ${d}`),!(u&&o>i.cc)&&l.trigger(T.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:d})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Ud(t,this.initPTS[e.cc],()=>{i.textCodec=xo,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(n=>fh(r,n))}else{const r=this.tracks[t];if(!r)return;const n=r.default?"default":"subtitles"+t;i.trigger(T.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===ge.SUBTITLE&&this.onFragLoaded(T.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){const{cea608Parser1:i,cea608Parser2:r}=this;if(!this.enabled||!(i&&r))return;const{frag:n,samples:a}=t;if(!(n.type===ge.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);i.addData(a[o].pts,c[0]),r.addData(a[o].pts,c[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:r,type:n}){const{media:a}=this;if(!(!a||a.currentTime<i)){if(!n||n==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(l=>Vo(o[l],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(l=>Vo(o[l],t,r))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let r=2;for(let n=0;n<i;n++){const a=e[r++],o=127&e[r++],l=127&e[r++];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 ny(s,e){return!!s&&s.label===e.name&&!(s.textTrack1||s.textTrack2)}function ay(s,e,t,i){return Math.min(e,i)-Math.max(s,t)}function Gd(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class Zl{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.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(T.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(T.MEDIA_ATTA
53CHING,this.onMediaAttaching,this),e.on(T.MANIFEST_PARSED,this.onManifestParsed,this),e.on(T.BUFFER_CODECS,this.onBufferCodecs,this),e.on(T.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(T.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(T.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(T.MANIFEST_PARSED,this.onManifestParsed,this),e.off(T.BUFFER_CODECS,this.onBufferCodecs,this),e.off(T.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){const e=this.hls.levels;if(e.length){const t=this.hls;t.autoLevelCapping=this.getMaxLevel(e.length-1),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 i=t.filter((r,n)=>this.isLevelAllowed(r)&&n<=e);return this.clientRect=null,Zl.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),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 i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.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(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const r=(a,o)=>o?a.width!==o.width||a.height!==o.height:!0;let n=e.length-1;for(let a=0;a<e.length;a+=1){const o=e[a];if((o.width>=t||o.height>=i)&&r(o,e[a+1])){n=a;break}}return n}}class oy{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}
vendor: 16,713 bytes, lines 53-54
53registerListeners(){this.hls.on(T.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(T.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const r=performance.now();if(t){if(this.lastTime){const n=r-this.lastTime,a=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,l=1e3*a/n,c=this.hls;if(c.trigger(T.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:i}),l>0&&a>c.config.fpsDroppedMonitoringThreshold*o){let d=c.currentLevel;D.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(T.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:c.currentLevel}),c.autoLevelCapping=d,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=i,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 bn="[eme]";class ar{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=ar.CDMCleanupPromise?[ar.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=D.debug.bind(D,bn),this.log=D.log.bind(D,bn),this.warn=D.warn.bind(D,bn),this.error=D.error.bind(D,bn),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(T.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(T.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(T.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(T.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(T.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(T.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(T.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,r=t[e];if(r)return r.licenseUrl;if(e===Je.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(a,o,l)=>!!a&&l.indexOf(a)===o,r=t.map(a=>a.audioCodec).filter(i),n=t.map(a=>a.videoCodec).filter(i);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((a,o)=>{const l=c=>{const d=c.shift();this.getMediaKeysPromise(d,r,n).then(u=>a({keySystem:d,mediaKeys:u})).catch(u=>{c.length?l(c):u instanceof Kt?o(u):o(new Kt({type:me.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_NO_ACCESS,error:u,fatal:!0},u.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${i}`;return eh===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return i(e,t)}getMediaKeysPromise(e,t,i){const r=T0(e,t,i,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(r)}`),a=this.requestMediaKeySystemAccess(e,r);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:i}){this.log(`Creating key-system session "${t}" keyId: ${Ii.hexDump(e.keyId||[])}`);const r=i.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,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 Ii.hexDump(e.keyId)}updateKeySession(e,t){var i;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${Ii.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])} 54 } (data length: ${t&&t.byteLength})`),r.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,i)=>{const r=ao(this.config),n=e.map(Qc).filter(a=>!!a&&r.indexOf(a)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:a})=>{const o=Zc(a);o?t(o):i(new Error(`Unable to find format for key-system "${a}"`))}).catch(i)})}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),r=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let n=this.keyIdToKeySessionPromise[i];return n||(n=this.keyIdToKeySessionPromise[i]=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 ${r}`),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 Kt?this.hls.trigger(T.ERROR,e.data):this.hls.trigger(T.ERROR,{type:me.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const r=Qc(e.keyFormat),n=r?[r]:ao(this.config);return this.attemptKeySystemAccess(n)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=ao(this.config)),e.length===0)throw new Kt({type:me.KEY_SYSTEM_ERROR,details:G.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:i}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),i===null)return;let r,n;if(t==="sinf"&&this.config.drmSystems[Je.FAIRPLAY]){const d=At(new Uint8Array(i));try{const u=Ul(JSON.parse(d).sinf),h=lh(new Uint8Array(u));if(!h)return;r=h.subarray(8,24),n=Je.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const d=K0(i);if(d===null)return;d.version===0&&d.systemId===Ju.WIDEVINE&&d.data&&(r=d.data.subarray(8,24)),n=_0(d.systemId)}if(!n||!r)return;const a=Ii.hexDump(r),{keyIdToKeySessionPromise:o,mediaKeySessions:l}=this;let c=o[a];for(let d=0;d<l.length;d++){const u=l[d],h=u.decryptdata;if(h.pssh||!h.keyId)continue;const f=Ii.hexDump(h.keyId);if(a===f||h.uri.replace(/-/g,"").indexOf(a)!==-1){c=o[f],delete o[f],h.pssh=new Uint8Array(i),h.keyId=r,c=o[a]=c.then(()=>this.generateRequestWithPreferredKeySession(u,t,i,"encrypted-event-key-match"));break}}c||(c=o[a]=this.getKeySystemSelectionPromise([n]).then(({keySystem:d,mediaKeys:u})=>{var h;this.throwIfDestroyed();const f=new Qr("ISO-23001-7",a,(h=Zc(d))!=null?h:"");return f.pssh=new Uint8Array(i),f.keyId=r,this.attemptSetMediaKeys(d,u).then(()=>{this.throwIfDestroyed();const p=this.createMediaKeySessionContext({decryptdata:f,keySystem:d,mediaKeys:u});return this.generateRequestWithPreferredKeySession(p,t,i,"encrypted-event-no-match")})})),c.catch(d=>this.handleError(d))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(i).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>i.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,i,r){var n,a;const o=(n=this.config.drmSystems)==null||(a=n[e.keySystem])==null?void 0:a.generateRequest;if(o)try{const h=o.call(this.hls,t,i,e);if(!h)throw new Error("Invalid response from configured generateRequest filter");t=h.initDataType,i=e.decryptdata.pssh=h.initData?new Uint8Array(h.initData):null}catch(h){var l;if(this.warn(h.message),(l=this.hls)!=null&&l.config.debug)throw h}if(i===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const c=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${c} (init data type: ${t} length: ${i?i.byteLength:null})`);const d=new zl;e.mediaKeysSession.onmessage=h=>{const f=e.mediaKeysSession;if(!f){d.emit("error",new Error("invalid state"));return}const{messageType:p,message:y}=h;this.log(`"${p}" message event for session "${f.sessionId}" message size: ${y.byteLength}`),p==="license-request"||p==="license-renewal"?this.renewLicense(e,y).catch(_=>{this.handleError(_),d.emit("error",_)}):p==="license-release"?e.keySystem===Je.FAIRPLAY&&(this.updateKeySession(e,Zu("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${p}"`)},e.mediaKeysSession.onkeystatuseschange=h=>{if(!e.mediaKeysSession){d.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const p=e.keyStatus;d.emit("keyStatus",p),p==="expired"&&(this.warn(`${e.keySystem} expired for key ${c}`),this.renewKeySession(e))};const u=new Promise((h,f)=>{d.on("error",f),d.on("keyStatus",p=>{p.startsWith("usable")?h():p==="output-restricted"?f(new Kt({type:me.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):p==="internal-error"?f(new Kt({type:me.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${p}"`)):p==="expired"?f(new Error("key expired while generating request")):this.warn(`unhandled key status change "${p}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var h;this.log(`Request generated for key-session "${(h=e.mediaKeysSession)==null?void 0:h.sessionId}" keyId: ${c}`)}).catch(h=>{throw new Kt({type:me.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_NO_SESSION,error:h,fatal:!1},`Error generating key-session request: ${h}`)}).then(()=>u).catch(h=>{throw d.removeAllListeners(),this.removeSession(e),h}).then(()=>(d.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${Ii.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${Ii.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=t.loader,r=new i(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching serverCertificate 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:(h,f,p,y)=>{a(h.data)},onError:(h,f,p,y)=>{o(new Kt({type:me.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:Pt({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${n}). Status: ${h.code} (${h.text})`))},onTimeout:(h,f,p)=>{o(new Kt({type:me.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(h,f,p)=>{o(new Error("aborted"))}};r.load(l,d,u)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((r,n)=>{e.setServerCertificate(i).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${i==null?void 0:i.byteLength}) on "${t}"`),r(e)}).catch(a=>{n(new Kt({type:me.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(r=>{throw new Kt({type:me.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:r,fatal:!0},r.message)}))}setupLicenseXHR(e,t,i,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,i,r)}).catch(a=>{if(!i.decryptdata)throw a;return e.open("POST",t,!0),n.call(this.hls,e,t,i,r)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((r,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)}r(l)}else{const l=i.errorRetry,c=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||o.status>=400&&o.status<500)n(new Kt({type:me.KEY_SYSTEM_ERROR,details:G.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(r,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})=>{l.send(c)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.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={},Qr.clearKeyUriToKeyIdMap();const i=t.length;
54ar.CDMCleanupPromise=Promise.all(t.map(r=>this.removeSession(r)).concat(e==null?void 0:e.setMediaKeys(null).catch(r=>{this.log(`Could not clear media keys: ${r}. media.src: ${e==null?void 0:e.src}`)}))).then(()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(r=>{this.log(`Could not close sessions and clear media keys: ${r}. media.src: ${e==null?void 0:e.src}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),t.onmessage=null,t.onkeystatuseschange=null,i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);return r>-1&&this.mediaKeySessions.splice(r,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}}ar.CDMCleanupPromise=void 0;class Kt 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}}const ly=1;var Nt={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",
54KEY:"k",OTHER:"o"};const cy="h";class Yi{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.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=r=>{try{this.apply(r,{ot:Nt.MANIFEST,su:!this.initialized})}catch(n){D.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=r=>{try{const n=r.frag,a=this.hls.levels[n.level],o=this.getObjectType(n),l={d:n.duration*1e3,ot:o};(o===Nt.VIDEO||o===Nt.AUDIO||o==Nt.MUXED)&&(l.br=a.bitrate/1e3,l.tb=this.getTopBandwidth(o)/1e3,l.bl=this.getBufferLength(o)),this.apply(r,l)}catch(n){D.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||Yi.uuid(),this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.registerListeners())}registerListeners(){const e=this.hls;
54e.on(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(T.MEDIA_DETACHED,this.onMediaDetached,this),e.on(T.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(T.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(T.MEDIA_DETACHED,this.onMediaDetached,this),e.off(T.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=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 i,r;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:ly,sf:cy,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){dt(t,this.createData());const i=t.ot===Nt.INIT||t.ot===Nt.VIDEO||t.ot===Nt.MUXED;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){const r=Yi.toHeaders(t);if(!Object.keys(r).length)return;e.headers||(e.headers={}),dt(e.headers,r)}else{const r=Yi.toQuery(t);if(!r)return;e.url=Yi.appendQueryToUri(e.url,r)}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Nt.TIMED_TEXT;if(e.sn==="initSegment")return Nt.INIT;if(t==="audio")return Nt.AUDIO;if(t==="main")return this.hls.audioTracks.length?Nt.VIDEO:Nt.MUXED}getTopBandwidth(e){let t=0,i;const r=this.hls;if(e===Nt.AUDIO)i=r.audioTracks;else{const n=r.maxAutoLevel,a=n>-1?n+1:r.levels.length;i=r.levels.slice(0,a)}for(const n of i)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,i=e===Nt.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:Ye.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(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,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(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)}}}static uuid(){const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}static serialize(e){const t=[],i=c=>!Number.isNaN(c)&&c!=null&&c!==""&&c!==!1,r=c=>Math.round(c),n=c=>r(c/100)*100,o={br:r,d:r,bl:n,dl:n,mtp:n,nor:c=>encodeURIComponent(c),rtp:n,tb:r},l=Object.keys(e||{}).sort();for(const c of l){let d=e[c];if(!i(d)||c==="v"&&d===1||c=="pr"&&d===1)continue;const u=o[c];u&&(d=u(d));const h=typeof d;let f;c==="ot"||c==="sf"||c==="st"?f=`${c}=${d}`:h==="boolean"?f=c:h==="number"?f=`${c}=${d}`:f=`${c}=${JSON.stringify(d)}`,t.push(f)}return t.join(",")}static toHeaders(e){const t=Object.keys(e),i={},r=["Object","Request","Session","Status"],n=[{},{},{},{}],a={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3};for(const o of t){const l=a[o]!=null?a[o]:1;n[l][o]=e[o]}for(let o=0;o<n.length;o++){const l=Yi.serialize(n[o]);l&&(i[`CMCD-${r[o]}`]=l)}return i}static toQuery(e){return`CMCD=${encodeURIComponent(Yi.serialize(e))}`}static appendQueryToUri(e,t){if(!t)return e;const i=e.includes("?")?"&":"?";return`${e}${i}${t}`}}const dy=3e5;class uy{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=D.log.bind(D,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(T.MANIFEST_LOADING,this.onManifestLoading,this),e.on(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(T.MANIFEST_PARSED,this.onManifestParsed,this),e.on(T.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(T.MANIFEST_LOADING,this.onManifestLoading,this),e.off(T.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(T.MANIFEST_PARSED,this.onManifestParsed,this),e.off(T.ERROR,this.onError,this))}
54startLoad(){if(this.started=!0,self.clearTimeout(this.reloadTimer),this.enabled&&this.uri)if(this.updated){const e=Math.max(this.timeToLoad*1e3-(performance.now()-this.updated),0);this.scheduleRefresh(this.uri,e)}else this.loadSteeringManifest(this.uri)}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),self.clearTimeout(this.reloadTimer)}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(i=>i!==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:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((i==null?void 0:i.action)===wt.SendAlternateToPenaltyBox&&i.flags===jt.MoveAllAlternatesMatchingHost){let r=this.pathwayPriority;const n=this.pathwayId;this.penalizedPathways[n]||(this.penalizedPathways[n]=performance.now()),!r&&this.levels&&(r=this.levels.reduce((a,o)=>(a.indexOf(o.pathwayId)===-1&&a.push(o.pathwayId),a),[])),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==n)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}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 i=this.penalizedPathways,r=performance.now();
54Object.keys(i).forEach(n=>{r-i[n]>dy&&delete i[n]});for(let n=0;n<e.length;n++){const a=e[n];if(i[a])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,this.hls.trigger(T.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}}}clonePathways(e){const t=this.levels;if(!t)return;const i={},r={};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=dt({},d);u.details=void 0,u.url=Kh(d.uri,d.attrs["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l);const h=new Ze(d.attrs);h["PATHWAY-ID"]=a;const f=h.AUDIO&&`${h.AUDIO}_clone_${a}`,p=h.SUBTITLES&&`${h.SUBTITLES}_clone_${a}`;f&&(i[h.AUDIO]=f,h.AUDIO=f),p&&(r[h.SUBTITLES]=p,h.SUBTITLES=p),u.attrs=h;const y=new Zr(u);return Ta(y,"audio",f),Ta(y,"text",p),y});t.push(...c),Hd(this.audioTracks,i,l,a),Hd(this.subtitleTracks,r,l,a)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const d=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+d)}const n={responseType:"json",url:r.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,h,f)=>{this.log(`Loaded steering manifest: "${r}"`);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":y,"PATHWAY-CLONES":_,"PATHWAY-PRIORITY":A}=p;if(y)try{this.uri=new self.URL(y,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${y}`);return}this.scheduleRefresh(this.uri||h.url),_&&this.clonePathways(_),A&&this.updatePathwayPriority(A)},onError:(d,u,h,f)=>{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 y=this.loader;if(typeof(y==null?void 0:y.getResponseHeader)=="function"){const _=y.getResponseHeader("Retry-After");_&&(p=parseFloat(_)*1e3)}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,p)},onTimeout:(d,u,h)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,l,c)}scheduleRefresh(e,t=this.timeToLoad*1e3){self.clearTimeout(this.reloadTimer),this.reloadTimer=self.setTimeout(()=>{this.loadSteeringManifest(e)},t)}}function Hd(s,e,t,i){s&&Object.keys(e).forEach(r=>{const n=s.filter(a=>a.groupId===r).map(a=>{const o=dt({},a);return o.details=void 0,o.attrs=new Ze(o.attrs),o.url=o.attrs.URI=Kh(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[r],o.attrs["PATHWAY-ID"]=i,o});s.push(...n)})}function Kh(s,e,t,i){const{HOST:r,PARAMS:n,[t]:a}=i;let o;e&&(o=a==null?void 0:a[e],o&&(s=o));const l=new self.URL(s);return r&&!o&&(l.host=r),n&&Object.keys(n).sort().forEach(c=>{c&&l.searchParams.set(c,n[c])}),l.href}const hy=/^age:\s*[\d.]+\s*$/im;class qh{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=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Ga,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=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,i){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=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e)return;const i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>
54{if(!this.stats.aborted)return n(i,t.url)}).catch(a=>(i.open("GET",t.url,!0),n(i,t.url))).then(()=>{this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(a=>{this.callbacks.onError({code:i.status,text:a.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const r=this.context.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=i.loadPolicy;if(r)for(const o in r)e.setRequestHeader(o,r[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),i.timeout=n&&oe(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const r=t.readyState,n=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.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-(i.loading.first-i.loading.start)))),r===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)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const l=o?t.response:t.responseText,c=t.responseType==="arraybuffer"?l.byteLength:l.length;if(i.loaded=i.total=c,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first),!this.callbacks)return;const d=this.callbacks.onProgress;if(d&&d(i,e,l,t),!this.callbacks)return;const u={url:t.responseURL,data:l,code:a};this.callbacks.onSuccess(u,i,e,t)}else{const l=n.loadPolicy.errorRetry,c=i.retry;_a(l,c,!1,a)?this.retry(l):(D.error(`${a} while loading ${e.url}`),this.callbacks.onError({code:a,text:t.statusText},e,t,i))}}}loadtimeout(){var e;const t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry,i=this.stats.retry;if(_a(t,i,!0))this.retry(t);else{D.warn(`timeout while loading ${this.context.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=$l(e,i.retry),i.retry++,D.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t.url}, retrying ${i.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&&hy.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 fy(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const my=/(\d+)-(\d+)\/(\d+)/;class Vd{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Ey,this.controller=new self.AbortController,this.stats=new Ga}destroy(){this.loader=this.callbacks=null,this.abortInternal()}abortInternal(){const e=this.response;e!=null&&e.ok||(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,i){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=py(e,this.controller.signal),a=i.onProgress,o=e.responseType==="arraybuffer",l=o?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=c&&oe(c)?c:d,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},t.timeout),self.fetch(this.request).then(u=>{this.response=this.loader=u;const h=Math.max(self.performance.now(),r.loading.start);
54if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},d-(h-r.loading.start)),!u.ok){const{status:f,statusText:p}=u;throw new yy(p||"fetch, bad network response",f,u)}return r.loading.first=h,r.total=vy(u.headers)||r.total,a&&oe(t.highWaterMark)?this.loadProgressively(u,r,e,t.highWaterMark,a):o?u.arrayBuffer():e.responseType==="json"?u.json():u.text()}).then(u=>{const{response:h}=this;self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const f=u[l];f&&(r.loaded=r.total=f);const p={url:h.url,data:u,code:h.status};a&&!oe(t.highWaterMark)&&a(r,e,u,h),i.onSuccess(p,r,e,h)}).catch(u=>{if(self.clearTimeout(this.requestTimeout),r.aborted)return;const h=u&&u.code||0,f=u?u.message:null;i.onError({code:h,text:f},e,u?u.details:null,r)})}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,i,r=0,n){const a=new Oh,o=e.body.getReader(),l=()=>o.read().then(c=>{if(c.done)return a.dataLength&&n(t,i,a.flush(),e),Promise.resolve(new ArrayBuffer(0));const d=c.value,u=d.length;return t.loaded+=u,u<r||a.dataLength?(a.push(d),a.dataLength>=r&&n(t,i,a.flush(),e)):n(t,i,d,e),l()}).catch(()=>Promise.reject());return l()}}function py(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(dt({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function gy(s){const e=my.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function vy(s){const e=s.get("Content-Range");if(e){const i=gy(e);if(oe(i))return i}const t=s.get("Content-Length");if(t)return parseInt(t)}function Ey(s,e){return new self.Request(s.url,e)}class yy extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const _y=/\s/,Ty={newCue(s,e,t,i){const r=[];let n,a,o,l,c;const d=self.VTTCue||self.TextTrackCue;for(let h=0;h<i.rows.length;h++)if(n=i.rows[h],o=!0,l=0,c="",!n.isEmpty()){var u;for(let y=0;y<n.chars.length;y++)_y.test(n.chars[y].uchar)&&o?l++:(c+=n.chars[y].uchar,o=!1);n.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const f=Gh(c.trim()),p=Ql(e,t,f);s!=null&&(u=s.cues)!=null&&u.getCueById(p)||(a=new d(e,t,f),a.id=p,a.line=h+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),r.push(a))}return s&&r.length&&(r.sort((h,f)=>h.line==="auto"||f.line==="auto"?0:h.line>8&&f.line>8?f.line-h.line:h.line-f.line),r.forEach(h=>fh(s,h))),r}},by={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Ay=Pt(Pt({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength: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:qh,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:LE,bufferController:NE,capLevelController:Zl,errorController:yv,fpsController:oy,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:eh,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,cert
54LoadPolicy:{default:by},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},Sy()),{},{subtitleStreamController:CE,subtitleTrackController:PE,timelineController:ry,audioStreamController:RE,audioTrackController:kE,emeController:ar,cmcdController:Yi,contentSteeringController:uy});function Sy(){return{cueHandler:Ty,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 xy(s,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=Xo(s),i=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(n=>{const a=`${n==="level"?"playlist":n}LoadPolicy`,o=e[a]===void 0,l=[];r.forEach(c=>{const d=`${n}Loading${c}`,u=e[d];if(u!==void 0&&o){l.push(d);const h=t[a].default;switch(e[a]={default:h},c){case"TimeOut":h.maxLoadTimeMs=u,h.maxTimeToFirstByteMs=u;break;case"MaxRetry":h.errorRetry.maxNumRetry=u,h.timeoutRetry.maxNumRetry=u;break;case"RetryDelay":h.errorRetry.retryDelayMs=u,h.timeoutRetry.retryDelayMs=u;break;case"MaxRetryTimeout":h.errorRetry.maxRetryDelayMs=u,h.timeoutRetry.maxRetryDelayMs=u;break}}}),l.length&&D.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${a}": ${JSON.stringify(e[a])}`)}),Pt(Pt({},t),e)}function Xo(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(Xo):Object.keys(s).reduce((e,t)=>(e[t]=Xo(s[t]),e),{}):s}function Iy(s){const e=s.loader;e!==Vd&&e!==qh?(D.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):fy()&&(s.loader=Vd,s.progressive=!0,s.enableSoftwareAES=!0,D.log("[config]: Progressive streaming enabled, using FetchLoader"))}class Ts{static get version(){return"1.4.14"}static isSupported(){return Uv()}static get Events(){return T}static get ErrorTypes(){return me}static get ErrorDetails(){return G}static get DefaultConfig(){return Ts.defaultConfig?Ts.defaultConfig:Ay}static set DefaultConfig(e){Ts.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new zl,this._autoLevelCapping=void 0,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,d0(e.debug||!1,"Hls instance");const t=this.config=xy(Ts.DefaultConfig,e);this.userConfig=e,this._autoLevelCapping=-1,t.progressive&&Iy(t);const{abrController:i,bufferController:r,capLevelController:n,errorController:a,fpsController:o}=t,l=new a(this),c=this.abrController=new i(this),d=this.bufferController=new r(this),u=this.capLevelController=new n(this),h=new o(this),f=new ev(this),p=new nv(this),y=t.contentSteeringController,_=y?new y(this):null,A=this.levelController=new Tv(this,_),x=new bv(this),I=new Sv(this.config),P=this.streamController=new xE(this,x,I);u.setStreamController(P),h.setStreamController(P);const L=[f,A,P];_&&L.splice(1,0,_),this.networkControllers=L;const B=[c,d,u,h,p,x];this.audioTrackController=this.createController(t.audioTrackController,L);const O=t.audioStreamController;O&&L.push(new O(this,x,I)),this.subtitleTrackController=this.createController(t.subtitleTrackController,L);const F=t.subtitleStreamController;F&&L.push(new F(this,x,I)),this.createController(t.timelineController,B),I.emeController=this.emeController=this.createController(t.emeController,B),this.cmcdController=this.createController(t.cmcdController,B),this.latencyController=this.createController(av,B),this.coreComponents=B,L.push(l);const V=l.onErrorOut;typeof V=="function"&&this.on(T.ERROR,V,l)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,r){this._emitter.off(e,t,i,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}
54trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){D.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),this.trigger(T.ERROR,{type:me.OTHER_ERROR,details:G.INTERNAL_EXCEPTION,fatal:!1,event:e,error:i})}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){D.log("destroy"),this.trigger(T.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.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){D.log("attachMedia"),this._media=e,this.trigger(T.MEDIA_ATTACHING,{media:e})}detachMedia(){D.log("detachMedia"),this.trigger(T.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,r=this.url=Fl.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});D.log(`loadSource:${r}`),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(T.MANIFEST_LOADING,{url:e})}startLoad(e=-1){D.log(`startLoad(${e})`),this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){D.log("stopLoad"),this.networkControllers.forEach(e=>{e.stopLoad()})}swapAudioCodec(){D.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){D.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e,t=0){this.levelController.removeLevel(e,t)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){D.log(`set currentLevel:${e}`),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){D.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){D.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){D.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){return this.levelController.startLevel}set startLevel(e){D.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}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(D.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e)}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){Ko.indexOf(e)>-1&&(this._maxHdcpLevel=e)}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 i=e.length;for(let r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let r;if(t===-1&&e&&e.length?r=e.length-1:r=t,i)for(let n=r;n--;){const a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=i)return n}return r}get nextAutoLevel(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)}set nextAutoLevel(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}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 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}}Ts.defaultConfig=void 0;
54var nt=Ts,Vi=class Rr extends Error{constructor(e,t=Rr.MEDIA_ERR_CUSTOM,i,r){var n;super(e),this.name="MediaError",this.code=t,this.context=r,this.fatal=i??(t>=Rr.MEDIA_ERR_NETWORK&&t<=Rr.MEDIA_ERR_ENCRYPTED),this.message||(this.message=(n=Rr.defaultMessages[this.code])!=null?n:"")}};Vi.MEDIA_ERR_ABORTED=1,Vi.MEDIA_ERR_NETWORK=2,Vi.MEDIA_ERR_DECODE=3,Vi.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Vi.MEDIA_ERR_ENCRYPTED=5,Vi.MEDIA_ERR_CUSTOM=100,Vi.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var or=Vi,Ly=s=>s==null,Yh=(s,e)=>Ly(e)?!1:s in e,Qo={ANY:"any",MUTED:"muted"},Zi={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},sr={MSE:"mse",NATIVE:"native"},Un={HEADER:"header",QUERY:"query",NONE:"none"},Wd=Object.values(Un),Ji={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Kd={HLS:Ji.M3U8};[...Object.values(Ji)];var Zt=(s,e,t,i,r=s)=>{r.addEventListener(e,t,i),s.addEventListener("teardown",()=>{r.removeEventListener(e,t)},{once:!0})};function wy(s,e,t){e&&t>e&&(t=e);for(let i=0;i<s.length;i++)if(s.start(i)<=t&&s.end(i)>=t)return!0;return!1}var Ry=s=>{let e=s.indexOf("?");if(e<0)return[s];let t=s.slice(0,e),i=s.slice(e);return[t,i]},Wa=s=>{let e=s.type;if(e){let i=e.toUpperCase();return Yh(i,Kd)?Kd[i]:e}let{src:t}=s;return t?ky(t):""},jh=s=>s==="VOD"?Zi.ON_DEMAND:Zi.LIVE,zh=s=>s==="EVENT"?Number.POSITIVE_INFINITY:s==="VOD"?Number.NaN:0,ky=s=>{let e="";try{e=new URL(s).pathname}catch{console.error("invalid url")}let t=e.lastIndexOf(".");if(t<0)return"";let i=e.slice(t+1).toUpperCase();return Yh(i,Ji)?Ji[i]:""},Dy=Object.values(Qo),qd=s=>typeof s=="boolean"||typeof s=="string"&&Dy.includes(s),Cy=({autoplay:s},e,t)=>{let i=!1,r=!1,n=qd(s)?s:!!s,a=()=>{i||Zt(e,"playing",()=>{i=!0},{once:!0})};if(a(),Zt(e,"loadstart",()=>{i=!1,a(),Ro(e,n)},{once:!0}),Zt(e,"loadstart",()=>{t||(r=!Number.isFinite(e.duration)),Ro(e,n)},{once:!0}),t&&t.once(nt.Events.LEVEL_LOADED,(o,l)=>{var c;r=(c=l.details.live)!=null?c:!1}),!n){let o=()=>{r&&(t!=null&&t.liveSyncPosition?e.currentTime=t.liveSyncPosition:Number.isFinite(e.seekable.end(0))&&(e.currentTime=e.seekable.end(0)))};t&&Zt(e,"play",()=>{e.preload==="metadata"?t.once(nt.Events.LEVEL_UPDATED,o):o()},{once:!0})}return o=>{i||(n=qd(o)?o:!!o,Ro(e,n))}},Ro=(s,e)=>{if(!e)return;let t=s.muted,i=()=>s.muted=t;switch(e){case Qo.ANY:s.play().catch(()=>{s.muted=!0,s.play().catch(i)});break;case Qo.MUTED:s.muted=!0,s.play().catch(i);break;default:s.play().catch(()=>{});break}},My=({preload:s,src:e},t,i)=>{let r=u=>{u!=null&&["","none","metadata","auto"].includes(u)?t.setAttribute("preload",u):t.removeAttribute("preload")};if(!i)return r(s),r;let n=!1,a=!1,o=i.config.maxBufferLength,l=i.config.maxBufferSize,c=u=>{r(u);let h=u??t.preload;a||h==="none"||(h==="metadata"?(i.config.maxBufferLength=1,i.config.maxBufferSize=1):(i.config.maxBufferLength=o,i.config.maxBufferSize=l),d())},d=()=>{!n&&e&&(n=!0,i.loadSource(e))};return Zt(t,"play",()=>{a=!0,i.config.maxBufferLength=o,i.config.maxBufferSize=l,d()},{once:!0}),c(s),c};function Py(s,e){var t;if(!("videoTracks"in s))return;let i=new WeakMap;e.on(nt.Events.MANIFEST_PARSED,function(c,d){l();let u=s.addVideoTrack("main");u.selected=!0;for(let[h,f]of d.levels.entries()){let p=u.addRendition(f.url[0],f.width,f.height,f.videoCodec,f.bitrate);i.set(f,`${h}`),p.id=`${h}`}}),e.on(nt.Events.AUDIO_TRACKS_UPDATED,function(c,d){o();for(let u of d.audioTracks){let h=u.default?"main":"alternative",f=s.addAudioTrack(h,u.name,u.lang);f.id=`${u.id}`,u.default&&(f.enabled=!0)}}),s.audioTracks.addEventListener("change",()=>{var c;let d=+((c=[...s.audioTracks].find(h=>h.enabled))==null?void 0:c.id),u=e.audioTracks.map(h=>h.id);d!=e.audioTrack&&u.includes(d)&&(e.audioTrack=d)}),e.on(nt.Events.LEVELS_UPDATED,function(c,d){var u;let h=s.videoTracks[(u=s.videoTracks.selectedIndex)!=null?u:0];if(!h)return;let f=d.levels.map(p=>i.get(p));for(let p of s.videoRenditions)p.id&&!f.includes(p.id)&&h.removeRendition(p)});let r=c=>{let d=c.target.selectedIndex;d!=e.nextLevel&&n(d)},n=c=>{let d=s.currentTime,u=!1,h=(f,p)=>{u||(u=!Number.isFinite(p.endOffset))};e.on(nt.Events.BUFFER_FLUSHING,h),e.nextLevel=c,e.off(nt.Events.BUFFER_FLUSHING,h),u||e.trigger(nt.Events.BUFFER_FLUSHING,{startOffset:d+10,endOffset:1/0,type:"video"})};(t=s.videoRenditions)==null||t.addEventListener("change",r);let a=()=>{for(let c of s.videoTracks)s.removeVideoTrack(c)},o=()=>{for(let c of s.audioTracks)s.removeAudioTrack(c)},l=()=>{a(),o()};e.once(nt.Events.DESTROYING,l)}function Oy(s,e){e.on(nt.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(r,{tracks:n})=>
54{n.forEach(a=>{var o;let l=(o=a.subtitleTrack)!=null?o:a.closedCaptions,c=e.subtitleTracks.findIndex(({lang:d,name:u,type:h})=>d==(l==null?void 0:l.lang)&&u===a.label&&h.toLowerCase()===a.kind);Xh(s,a.kind,a.label,l==null?void 0:l.lang,`${a.kind}${c}`)})});let t=()=>{var r;if(!e.subtitleTracks.length)return;let n=Array.from(s.textTracks).find(o=>o.id&&o.mode==="showing"&&["subtitles","captions"].includes(o.kind)),a=`${(r=e.subtitleTracks[e.subtitleTrack])==null?void 0:r.type.toLowerCase()}${e.subtitleTrack}`;if(n&&(e.subtitleTrack<0||(n==null?void 0:n.id)!==a)){let o=e.subtitleTracks.findIndex(({lang:l,name:c,type:d})=>l==n.language&&c===n.label&&d.toLowerCase()===n.kind);e.subtitleTrack=o}n&&(n==null?void 0:n.id)===a&&n.cues&&Array.from(n.cues).forEach(o=>{n.addCue(o)})};s.textTracks.addEventListener("change",t),e.on(nt.Events.CUES_PARSED,(r,{track:n,cues:a})=>{let o=s.textTracks.getTrackById(n);if(!o)return;let l=o.mode==="disabled";l&&(o.mode="hidden"),a.forEach(c=>{var d;(d=o.cues)!=null&&d.getCueById(c.id)||o.addCue(c)}),l&&(o.mode="disabled")}),e.once(nt.Events.DESTROYING,()=>{s.textTracks.removeEventListener("change",t),s.querySelectorAll("track[data-removeondestroy]").forEach(r=>{r.remove()})});let i=()=>
54{Array.from(s.textTracks).forEach(r=>{var n,a;if(!["subtitles","caption"].includes(r.kind)&&r.label==="thumbnails"){if(!((n=r.cues)!=null&&n.length)){let o=s.querySelector('track[label="thumbnails"]'),l=(a=o==null?void 0:o.getAttribute("src"))!=null?a:"";o==null||o.removeAttribute("src"),setTimeout(()=>{o==null||o.setAttribute("src",l)},0)}r.mode!=="hidden"&&(r.mode="hidden")}})};e.once(nt.Events.MANIFEST_LOADED,i),e.once(nt.Events.MEDIA_ATTACHED,i)}function Xh(s,e,t,i,r){let n=document.createElement("track");return n.kind=e,n.label=t,i&&(n.srclang=i),r&&(n.id=r),n.track.mode=["subtitles","captions"].includes(e)?"disabled":"hidden",n.setAttribute("data-removeondestroy",""),s.append(n),n.track}var ln="cuepoints",Jl=Object.freeze({label:ln}),ec=(s,{label:e=ln}=Jl)=>{var t;return(t=Array.from(s.querySelectorAll("track")).find(i=>i.track.label===e&&i.track.kind==="metadata"))==null?void 0:t.track};async function Qh(s,e,t=Jl){let i=ec(s,t);if(!i){let{label:r=ln}=t;i=Xh(s,"metadata",r),i.mode="hidden",await new Promise(n=>setTimeout(()=>n(void 0),0))}return i.mode!=="hidden"&&(i.mode="hidden"),[...e].sort(({time:r},{time:n})=>n-r).forEach(({time:r,value:n})=>{var a,o;let l=Array.prototype.findIndex.call(i==null?void 0:i.cues,f=>f.startTime>=r),c=(a=i==null?void 0:i.cues)==null?void 0:a[l],d=c?c.startTime:Number.isFinite(s.duration)?s.duration:Number.MAX_SAFE_INTEGER,u=(o=i==null?void 0:i.cues)==null?void 0:o[l-1];u&&(u.endTime=r);let h=new VTTCue(r,d,JSON.stringify(n??null));i.addCue(h)}),i}var Zh=s=>({time:s.startTime,value:JSON.parse(s.text)});function Ny(s,e={label:ln}){let t=ec(s,e);return t!=null&&t.cues?Array.from(t.cues,i=>Zh(i)):[]}function Jh(s,e={label:ln}){var t,i;let r=ec(s,e);if(!((t=r==null?void 0:r.activeCues)!=null&&t.length))return;let{currentTime:n}=s,a=Array.prototype.find.call((i=r.activeCues)!=null?i:[],({startTime:o,endTime:l})=>o<=n&&l>n);return Zh(a)}async function Fy(s,e=Jl){return new Promise(t=>{Zt(s,"loadstart",async()=>{let i=await Qh(s,[],e);Zt(s,"cuechange",()=>{let r=Jh(s);if(r){let n=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:r});s.dispatchEvent(n)}},{},i),t(i)})})}function Uy(s,e){if(e){let t=e.playingDate;if(t!=null)return new Date(t.getTime()-s.currentTime*1e3)}return typeof s.getStartDate=="function"?s.getStartDate():new Date(NaN)}function By(s,e){if(e&&e.playingDate)return e.playingDate;if(typeof s.getStartDate=="function"){let t=s.getStartDate();return new Date(t.getTime()+s.currentTime*1e3)}return new Date(NaN)}var $y=async s=>fetch(s).then(e=>e.text()).then(e=>{let t=e.split(` 55`).find((i,r,n)=>r&&n[r-1].startsWith("#EXT-X-STREAM-INF"));return fetch(t).then(i=>i.text()).then(i=>i.split(` 56`))}),Gy=s=>{var e,t,i;let r=(t=((e=s.find(l=>l.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?e:"").split(":")[1])==null?void 0:t.trim(),n=jh(r),a=zh(r),o;if(n===Zi.LIVE){let l=s.find(c=>c.startsWith("#EXT-X-PART-INF"));if(l)o=+l.split(":")[1].split("=")[1]*2;else{let c=s.find(u=>u.startsWith("#EXT-X-TARGETDURATION")),d=(i=c==null?void 0:c.split(":"))==null?void 0:i[1];o=+(d??6)*3}}return{streamType:n,targetLiveWindow:a,liveEdgeStartOffset:o}},Hy=async(s,e)=>{if(e===Ji.MP4)return{streamType:Zi.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0};if(e===Ji.M3U8){let t=await $y(s);return Gy(t)}return console.error(`Media type ${e} is an unrecognized or unsupported type for src ${s}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0}},Yd=async(s,e,t=Wa({src:s}))=>{var i,r,n;let{streamType:a,targetLiveWindow:o,liveEdgeStartOffset:l}=await Hy(s,t);((i=St.get(e))!=null?i:{}).liveEdgeStartOffset=l,((r=St.get(e))!=null?r:{}).targetLiveWindow=o,e.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((n=St.get(e))!=null?n:{}).streamType=a,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},Vy=s=>{var e;let t=s.type,i=jh(t),r=zh(t),n,a=!!((e=s.partList)!=null&&e.length);return i===Zi.LIVE&&(n=a?s.partTarget*2:s.targetduration*3),{streamType:i,targetLiveWindow:r,liveEdgeStartOffset:n,lowLatency:a}},Wy=(s,e,t)=>{var i,r,n,a,o,l,c,d;let{streamType:u,targetLiveWindow:h,liveEdgeStartOffset:f,lowLatency:p}=Vy(s);if(u===Zi.LIVE){p?(t.config.backBufferLength=(i=t.userConfig.backBufferLength)!=null?i:4,t.config.maxFragLookUpTolerance=(r=t.userConfig.maxFragLookUpTolerance)!=null?r:.001,t.config.abrBandWidthUpFactor=(n=t.userConfig.abrBandWidthUpFactor)!=null?n:t.config.abrBandWidthFactor):t.config.backBufferLength=(a=t.userConfig.backBufferLength)!=null?a:8;let y=Object.freeze({get length(){return e.seekable.length},start(_){return e.seekable.start(_)},end(_){var A;return _>this.length?e.seekable.end(_):(A=t.liveSyncPosition)!=null?A:e.seekable.end(_)}});((o=St.get(e))!=null?o:{}).seekable=y}((l=St.get(e))!=null?l:{}).liveEdgeStartOffset=f,((c=St.get(e))!=null?c:{}).targetLiveWindow=h,e.dispatchEvent(new CustomEvent("targetlivewindowch
56ange",{composed:!0,bubbles:!0})),((d=St.get(e))!=null?d:{}).streamType=u,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},jd,zd,Ky=(zd=(jd=globalThis==null?void 0:globalThis.navigator)==null?void 0:jd.userAgent)!=null?zd:"",qy=Ky.toLowerCase().indexOf("android")!==-1,St=new WeakMap,ef="mux.com",Xd,Qd,tf=(Qd=(Xd=nt).isSupported)==null?void 0:Qd.call(Xd),Yy=qy,jy=()=>Nl.utils.now(),zy=Nl.utils.generateUUID,Xy=({playbackId:s,customDomain:e=ef,maxResolution:t,minResolution:i,renditionOrder:r,tokens:{playback:n}={},extraSourceParams:a={}}={})=>{if(!s)return;let[o,l=""]=Ry(s),c=new URL(`https://stream.${e}/${o}.m3u8${l}`);return n||c.searchParams.has("token")?(c.searchParams.forEach((d,u)=>{u!="token"&&c.searchParams.delete(u)}),n&&c.searchParams.set("token",n)):(t&&c.searchParams.set("max_resolution",t),i&&(c.searchParams.set("min_resolution",i),t&&+t.slice(0,-1)<+i.slice(0,-1)&&console.error("minResolution must be <= maxResolution","minResolution",i,"maxResolution",t)),r&&c.searchParams.set("rendition_order",r),Object.entries(a).forEach(([d,u])=>{u!=null&&c.searchParams.set(d,u)})),c.toString()},Qy=s=>{if(!s)return;let[e]=s.split("?");return e||void 0},Zy=s=>{if(!s||!s.startsWith("https://stream."))return;let[e]=new URL(s).pathname.slice(1).split(".m3u8");return e||void 0},Jy=s=>{var e,t,i;return(e=s==null?void 0:s.metadata)!=null&&e.video_id?s.metadata.video_id:cf(s)&&(i=(t=Qy(s.playbackId))!=null?t:Zy(s.src))!=null?i:s.src},e_=s=>{var e;return(e=St.get(s))==null?void 0:e.error},t_=s=>{var e,t;return(t=(e=St.get(s))==null?void 0:e.streamType)!=null?t:Zi.UNKNOWN},i_=s=>{var e,t;return(t=(e=St.get(s))==null?void 0:e.targetLiveWindow)!=null?t:Number.NaN},sf=s=>{var e,t;return(t=(e=St.get(s))==null?void 0:e.seekable)!=null?t:s.seekable},s_=s=>{var e;let t=(e=St.get(s))==null?void 0:e.liveEdgeStartOffset;if(typeof t!="number")return Number.NaN;let i=sf(s);return i.length?i.end(i.length-1)-t:Number.NaN},tc=.034,r_=(s,e,t=tc)=>Math.abs(s-e)<=t,rf=(s,e,t=tc)=>s>e||r_(s,e,t),n_=(s,e=tc)=>s.paused&&rf(s.currentTime,s.duration,e),nf=(s,e)=>{var t,i,r;if(!e)return;if(s.readyState>2)return!1;let n=e.currentLevel>=0?(i=(t=e.levels)==null?void 0:t[e.currentLevel])==null?void 0:i.details:(r=e.levels.find(u=>!!u.details))==null?void 0:r.details;if(!n||n.live)return;let{fragments:a}=n;if(!(a!=null&&a.length))return;if(s.currentTime<s.duration-(n.targetduration+.5))return!1;let o=a[a.length-1];if(s.currentTime<=o.start)return!1;let l=o.start+o.duration/2,c=s.buffered.start(s.buffered.length-1),d=s.buffered.end(s.buffered.length-1);return l>c&&l<d},af=(s,e)=>s.ended||s.loop?s.ended:e&&nf(s,e)?!0:n_(s),a_=(s,e,t)=>{of(e,t);let{metadata:i={}}=s,{view_session_id:r=zy()}=i,n=Jy(s);i.view_session_id=r,i.video_id=n,s.metadata=i,St.set(e,{});let a=o_(s,e);c_(s,e,a),d_(s,e,a),Fy(e);let o=Cy(s,e,a),l=My(s,e,a);return{engine:a,setAutoplay:o,setPreload:l}},of=(s,e)=>{let t=e==null?void 0:e.engine;t&&(t.detachMedia(),t.destroy()),s!=null&&s.mux&&!s.mux.deleted&&(s.mux.destroy(),delete s.mux),s&&(s.removeAttribute("src"),s.load(),s.removeEventListener("error",uf),s.removeEventListener("error",Zo),s.removeEventListener("durationchange",df),St.delete(s),s.dispatchEvent(new Event("teardown")))};function lf(s,e){var t;let i=Wa(s);if(i!==Ji.M3U8)return!0;let r=!i||((t=e.canPlayType(i))!=null?t:!0),{preferPlayback:n}=s,a=n===sr.MSE,o=n===sr.NATIVE;return r&&(o||!(tf&&(a||Yy)))}var o_=(s,e)=>{let{debug:t,streamType:i,startTime:r=-1,metadata:n,preferCmcd:a,_hlsConfig:o={}}=s,l=Wa(s)===Ji.M3U8,c=lf(s,e);if(l&&!c&&tf){let d={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},u=l_(i),h=a!==Un.NONE?{useHeaders:a===Un.HEADER,sessionId:n==null?void 0:n.view_session_id,contentId:n==null?void 0:n.video_id}:void 0;return new nt({debug:t,startPosition:r,cmcd:h,xhrSetup:(f,p)=>{var y,_;if(a&&a!==Un.QUERY)return;let A=new URL(p);if(!A.searchParams.has("CMCD"))return;let x=((_=(y=A.searchParams.get("CMCD"))==null?void 0:y.split(","))!=null?_:[]).filter(I=>I.startsWith("sid")||I.startsWith("cid")).join(",");A.searchParams.set("CMCD",x),f.open("GET",A)},...d,...u,...o}
56)}},l_=s=>s===Zi.LIVE?{backBufferLength:8}:{},cf=({playbackId:s,src:e,customDomain:t})=>{if(s)return!0;if(typeof e!="string")return!1;let i=window==null?void 0:window.location.href,r=new URL(e,i).hostname.toLocaleLowerCase();return r.includes(ef)||!!t&&r.includes(t.toLocaleLowerCase())},c_=(s,e,t)=>{var i;let{envKey:r}=s,n=cf(s);if(r||n){let{playerInitTime:a,playerSoftwareName:o,playerSoftwareVersion:l,beaconCollectionDomain:c,debug:d,disableCookies:u}=s,h={...s.metadata,video_title:((i=s==null?void 0:s.metadata)==null?void 0:i.video_title)||void 0},f=p=>typeof p.player_error_code=="string"?!1:typeof s.errorTranslator=="function"?s.errorTranslator(p):p;Nl.monitor(e,{debug:d,beaconCollectionDomain:c,hlsjs:t,Hls:t?nt:void 0,automaticErrorTracking:!1,errorTranslator:f,disableCookies:u,data:{...r?{env_key:r}:{},player_software_name:o,player_software:o,player_software_version:l,player_init_time:a,...h}})}},d_=(s,e,t)=>{var i;let r=lf(s,e),{src:n}=s,a=o=>{e.ended||!af(e,t)||(nf(e,t)?e.currentTime=e.buffered.end(e.buffered.length-1):e.dispatchEvent(new Event("ended")))};if(e&&r){let o=Wa(s);typeof n=="string"?(e.preload==="none"?Zt(e,"loadstart",()=>Yd(n,e,o)):Yd(n,e,o),e.setAttribute("src",n),s.startTime&&(((i=St.get(e))!=null?i:{}).startTime=s.startTime,e.addEventListener("durationchange",df,{once:!0}))):e.removeAttribute("src"),e.addEventListener("error",uf),e.addEventListener("error",Zo),e.addEventListener("emptied",()=>{e.querySelectorAll("track[data-removeondestroy]").forEach(l=>{l.remove()})},{once:!0}),Zt(e,"pause",a),Zt(e,"seeked",a),Zt(e,"play",()=>{e.ended||rf(e.currentTime,e.duration)&&(e.currentTime=e.seekable.start(0))})}else t&&n?(t.once(nt.Events.LEVEL_LOADED,(o,l)=>{Wy(l.details,e,t)}),t.on(nt.Events.ERROR,(o,l)=>{let c={[nt.ErrorTypes.NETWORK_ERROR]:or.MEDIA_ERR_NETWORK,[nt.ErrorTypes.MEDIA_ERROR]:or.MEDIA_ERR_DECODE},d=new or("",c[l.type]);d.fatal=l.fatal,d.data=l,e.dispatchEvent(new CustomEvent("error",{detail:d}))}),e.addEventListener("error",Zo),Zt(e,"waiting",a),Py(s,t),Oy(e,t),t.attachMedia(e)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function df(s){var e;let t=s.target,i=(e=St.get(t))==null?void 0:e.startTime;if(i&&wy(t.seekable,t.duration,i)){let r=t.preload==="auto";r&&(t.preload="none"),t.currentTime=i,r&&(t.preload="auto")}}async function uf(s){if(!s.isTrusted)return;s.stopImmediatePropagation();let e=s.target;if(!(e!=null&&e.error))return;let{message:t,code:i}=e.error,r=new or(t,i);if(e.src&&(i!==or.MEDIA_ERR_DECODE||i!==void 0))try{let{status:n}=await fetch(e.src);r.data={response:{code:n}}}catch{}e.dispatchEvent(new CustomEvent("error",{detail:r}))}function Zo(s){var e,t;if(!(s instanceof CustomEvent)||!(s.detail instanceof or))return;let i=s.target,r=s.detail;!r||!r.fatal||(((e=St.get(i))!=null?e:{}).error=r,(t=i.mux)==null||t.emit("error",{player_error_code:r.code,player_error_message:r.message,player_error_context:r.context}))}var u_=Object.defineProperty,h_=Object.getPrototypeOf,f_=Reflect.get,m_=(s,e,t)=>e in s?u_(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,We=(s,e,t)=>(m_(s,typeof e!="symbol"?e+"":e,t),t),ic=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},M=(s,e,t)=>(ic(s,e,"read from private field"),t?t.call(s):e.get(s)),re=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},he=(s,e,t,i)=>(ic(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),st=(s,e,t)=>(ic(s,e,"access private method"),t),ko=(s,e,t)=>f_(h_(s),t,e),Ka=class{addEventListener(){}removeEventListener(){}dispatchEvent(s){return!0}};if(typeof DocumentFragment>"u"){class s extends Ka{}globalThis.DocumentFragment=s}
56var sc=class extends Ka{},p_=class extends Ka{},g_={get(s){},define(s,e,t){},upgrade(s){},whenDefined(s){return Promise.resolve(sc)}},Bn,v_=class{constructor(s,e={}){re(this,Bn,void 0),he(this,Bn,e==null?void 0:e.detail)}get detail(){return M(this,Bn)}initCustomEvent(){}};Bn=new WeakMap;function E_(s,e){return new sc}var y_={document:{createElement:E_},DocumentFragment,customElements:g_,CustomEvent:v_,EventTarget:Ka,HTMLElement:sc,HTMLVideoElement:p_},__=typeof window>"u"||typeof globalThis.customElements>"u",Do=__?y_:globalThis,T_=()=>{try{return"0.17.3"}catch{}return"UNKNOWN"},b_=T_(),A_=()=>b_,hf=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],Zd,Jo=(Zd=globalThis.document)==null?void 0:Zd.createElement("template");Jo&&(Jo.innerHTML=` 57 <style> 58 :host { 59 display: inline-flex; 60 line-height: 0; 61 flex-direction: column; 62 justify-content: end; 63 } 64 65 audio { 66 width: 100%; 67 } 68 </style> 69 <slot name="media"></slot> 70 <slot></slot> 71 `);var Jd,el=(Jd=globalThis.document)==null?void 0:Jd.createElement("template");el&&(el.innerHTML=` 72 <style> 73 :host { 74 display: inline-block; 75 line-height: 0; 76 } 77 78 video { 79 max-width: 100%; 80 max-height: 100%; 81 min-width: 100%; 82 min-height: 100%; 83 object-fit: var(--media-object-fit, contain); 84 object-position: var(--media-object-position, 50% 50%); 85 } 86 87 video::-webkit-media-text-track-container { 88 transform: var(--media-webkit-text-track-transform); 89 transition: var(--media-webkit-text-track-transition); 90 } 91 </style> 92 <slot name="media"></slot> 93 <slot></slot> 94 `);var ff=(s,{tag:e,is:t})=>{var i,r,n,a,o,l,c,d,u,h,f,p,y,_,A,x;let I=(i=globalThis.document)==null?void 0:i.createElement(e,{is:t}),P=I?S_(I):[];return r=class extends s{constructor(){super(),re(this,u),re(this,f),re(this,y),re(this,A),re(this,l,void 0),re(this,c,void 0),re(this,d,new Map),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0)))}static get observedAttributes(){var L,B,O;return st(L=r,a,o).call(L),[...(O=(B=I==null?void 0:I.constructor)==null?void 0:B.observedAttributes)!=null?O:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var L,B,O;return(O=(B=(L=M(this,c))!=null?L:this.shadowRoot.querySelector(e))!=null?B:this.querySelector(":scope > [slot=media]"))!=null?O:this.querySelector(e)}set nativeEl(L){he(this,c,L)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(L){this.toggleAttribute("muted",!!L)}get src(){return this.getAttribute("src")}set src(L){this.setAttribute("src",`${L}`)}get preload(){var L,B;return(B=this.getAttribute("preload"))!=null?B:(L=this.nativeEl)==null?void 0:L.preload}set preload(L){this.setAttribute("preload",`${L}`)}init(){var L,B;if(!this.nativeEl){let O=document.createElement(e,{is:t});O.part=e,this.shadowRoot.querySelector('slot[name="media"]').append(O)}this.nativeEl.muted=this.hasAttribute("muted");for(let O of P)st(this,y,_).call(this,O);this.shadowRoot.addEventListener("slotchange",this);for(let O of this.constructor.Events)(B=(L=this.shadowRoot).addEventListener)==null||B.call(L,O,this,!0)}handleEvent(L){if(L.type==="slotchange"){st(this,f,p).call(this);return}L.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(L.type,{detail:L.detail}))}attributeChangedCallback(L,B,O){st(this,u,h).call(this),st(this,A,x).call(this,L,B,O)}connectedCallback(){st(this,u,h).call(this)}},n=new WeakMap,a=new WeakSet,o=function(){if(M(this,n))return;he(this,n,!0);let L=new Set(this.observedAttributes);L.delete("muted");for(let B of P)if(!(B in this.prototype))if(typeof I[B]=="function")this.prototype[B]=function(...O){return st(this,u,h).call(this),this.call?this.call(B,...O):this.nativeEl[B].apply(this.nativeEl,O)};else{let O={get(){var F,V,$;st(this,u,h).call(this);let j=B.toLowerCase();if(L.has(j)){let z=this.getAttribute(j);return z===null?!1:z===""?!0:z}return($=(F=this.get)==null?void 0:F.call(this,B))!=null?$:(V=this.nativeEl)==null?void 0:V[B]}};B!==B.toUpperCase()&&(O.set=function(F){st(this,u,h).call(this);let V=B.toLowerCase();if(L.has(V)){F===!0||F===!1||F==null?this.toggleAttribute(V,!!F):this.setAttribute(V,F);return}if(this.set){this.set(B,F);return}this.nativeEl[B]=F}),Object.defineProperty(this.prototype,B,O)}},l=new WeakMap,c=new WeakMap,d=new WeakMap,u=new WeakSet,h=function(){M(this,l)||(he(this,l,!0),this.init())},f=new WeakSet,p=function(){let L=new Map(M(this,d));this.shadowRoot.querySelector("slot:not([name])").assignedElements().filter(
94B=>["track","source"].includes(B.localName)).forEach(B=>{var O,F;L.delete(B);let V=M(this,d).get(B);V||(V=B.cloneNode(),M(this,d).set(B,V)),(F=(O=this.nativeEl).append)==null||F.call(O,V),V.localName==="track"&&V.default&&(V.kind==="chapters"||V.kind==="metadata")&&V.track.mode==="disabled"&&(V.track.mode="hidden")}),L.forEach(B=>B.remove())},y=new WeakSet,_=function(L){if(Object.prototype.hasOwnProperty.call(this,L)){let B=this[L];delete this[L],this[L]=B}},A=new WeakSet,x=function(L,B,O){var F,V,$,j,z,ve;["id","class"].includes(L)||!r.observedAttributes.includes(L)&&this.constructor.observedAttributes.includes(L)||(O===null?(V=(F=this.nativeEl).removeAttribute)==null||V.call(F,L):((j=($=this.nativeEl).getAttribute)==null?void 0:j.call($,L))!=O&&((ve=(z=this.nativeEl).setAttribute)==null||ve.call(z,L,O)))},re(r,a),We(r,"Events",hf),We(r,"template",e.endsWith("audio")?Jo:el),re(r,n,void 0),r};function S_(s){let e=[];for(let t=Object.getPrototypeOf(s);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t))e.push(...Object.getOwnPropertyNames(t));return e}var Co=globalThis.document?ff(HTMLElement,{tag:"video"}):class{};globalThis.document&&ff(HTMLElement,{tag:"audio"});var xs=new WeakMap,Mo=class extends Error{},x_=class extends Error{},I_=globalThis.WeakRef?class extends Set{add(s){super.add(new WeakRef(s))}forEach(s){super.forEach(e=>{let t=e.deref();t&&s(t)})}}:Set;function L_(s){mf()?pf()?s(chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>s(chrome.cast.isAvailable)):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>s(chrome.cast.isAvailable))}}function w_(){return globalThis.chrome}function R_(){let s="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";if(globalThis.chrome.cast||document.querySelector(`script[src="${s}"]`))return;let e=document.createElement("script");e.src=s,document.head.append(e)}function mf(){return typeof chrome<"u"&&chrome.cast&&chrome.cast.isAvailable}function pf(){return typeof cast<"u"&&cast.framework}function Rs(){if(pf())return cast.framework.CastContext.getInstance()}function rc(){var s;return(s=Rs())==null?void 0:s.getCurrentSession()}function nc(){var s;return(s=rc())==null?void 0:s.getSessionObj().media[0]}function k_(s){return new Promise((e,t)=>{nc().editTracksInfo(s,e,t)})}function D_(s){return new Promise((e,t)=>{nc().getStatus(s,e,t)})}function gf(s){return Rs().setOptions({...vf(),...s})}function vf(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}var $n=new I_,Xi=new WeakSet,lt;L_(s=>{s&&!lt&&(lt=cast.framework,Rs().addEventListener(lt.CastContextEventType.CAST_STATE_CHANGED,e=>{$n.forEach(t=>{var i,r;return(r=(i=xs.get(t)).onCastStateChanged)==null?void 0:r.call(i,e)})}),Rs().addEventListener(lt.CastContextEventType.SESSION_STATE_CHANGED,e=>{$n.forEach(t=>{var i,r;return(r=(i=xs.get(t)).onSessionStateChanged)==null?void 0:r.call(i,e)})}),$n.forEach(e=>{var t,i;return(i=(t=xs.get(e)).init)==null?void 0:i.call(t)}))});var eu=0,Ue,Gn,zt,ji,rr,Us,bs,tl,zi,as,il,tu,Aa,sl,rl,Ef,Hn,nl,al,iu,Vn,Po,C_=class extends EventTarget{constructor(s){super(),re(this,zi),re(this,il),re(this,Aa),re(this,rl),re(this,Hn),re(this,al),re(this,Vn),re(this,Ue,void 0),re(this,Gn,void 0),re(this,zt,void 0),re(this,ji,void 0),re(this,rr,"disconnected"),re(this,Us,!1),re(this,bs,new Set),re(this,tl,new WeakMap),he(this,Ue,s),$n.add(this),xs.set(this,{init:()=>st(this,Hn,nl).call(this),onCastStateChanged:()=>st(this,Aa,sl).call(this),onSessionStateChanged:()=>st(this,rl,Ef).call(this),getCastPlayer:()=>M(this,zi,as)}),st(this,Hn,nl).call(this)}get state(){return M(this,rr)}async watchAvailability(s){if(M(this,Ue).disableRemotePlayback)throw new Mo("disableRemotePlayback attribute is present.");return M(this,tl).set(s,++eu),M(this,bs).add(s),eu}async cancelWatchAvailability(s){if(M(this,Ue).disableRemotePlayback)throw new Mo("disableRemotePlayback attribute is present.");s?M(this,bs).delete(s):M(this,bs).clear()}async prompt(){var s,e;if(M(this,Ue).disableRemotePlayback)throw new Mo("disableRemotePlayback attribute is present.");if(!mf())throw new x_("The RemotePlayback API is disabled on this platform.");let t=Xi.has(M(this,Ue));Xi.add(M(this,Ue)),gf(M(this,Ue).castOptions),Object.entries(M(this,ji)).forEac
94h(([i,r])=>{M(this,zt).controller.addEventListener(i,r)});try{await Rs().requestSession()}catch(i){if(i==="cancel"){t||Xi.delete(M(this,Ue));return}throw new Error(i)}(e=(s=xs.get(M(this,Ue)))==null?void 0:s.loadOnPrompt)==null||e.call(s)}};Ue=new WeakMap,Gn=new WeakMap,zt=new WeakMap,ji=new WeakMap,rr=new WeakMap,Us=new WeakMap,bs=new WeakMap,tl=new WeakMap,zi=new WeakSet,as=function(){if(Xi.has(M(this,Ue)))return M(this,zt)},il=new WeakSet,tu=function(){Xi.has(M(this,Ue))&&(Object.entries(M(this,ji)).forEach(([s,e])=>{M(this,zt).controller.removeEventListener(s,e)}),Xi.delete(M(this,Ue)),M(this,Ue).muted=M(this,zt).isMuted,M(this,Ue).currentTime=M(this,zt).savedPlayerState.currentTime,M(this,zt).savedPlayerState.isPaused===!1&&M(this,Ue).play())},Aa=new WeakSet,sl=function(){let s=Rs().getCastState();if(Xi.has(M(this,Ue))&&s==="CONNECTING"&&(he(this,rr,"connecting"),this.dispatchEvent(new Event("connecting"))),!M(this,Us)&&s!=null&&s.includes("CONNECT")){he(this,Us,!0);for(let e of M(this,bs))e(!0)}else if(M(this,Us)&&(!s||s==="NO_DEVICES_AVAILABLE")){he(this,Us,!1);for(let e of M(this,bs))e(!1)}},rl=new WeakSet,Ef=async function(){var s;let{SESSION_RESUMED:e}=lt.SessionState;if(Rs().getSessionState()===e&&M(this,Ue).castSrc===((s=nc())==null?void 0:s.media.contentId)){Xi.add(M(this,Ue)),Object.entries(M(this,ji)).forEach(([t,i])=>{M(this,zt).controller.addEventListener(t,i)});try{await D_(new chrome.cast.media.GetStatusRequest)}catch(t){console.error(t)}M(this,ji)[lt.RemotePlayerEventType.IS_PAUSED_CHANGED](),M(this,ji)[lt.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},Hn=new WeakSet,nl=function(){!lt||M(this,Gn)||(he(this,Gn,!0),gf(M(this,Ue).castOptions),M(this,Ue).textTracks.addEventListener("change",()=>st(this,Vn,Po).call(this)),st(this,Aa,sl).call(this),he(this,zt,new lt.RemotePlayer),new lt.RemotePlayerController(M(this,zt)),he(this,ji,{[lt.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:s})=>{s===!0?(he(this,rr,"connected"),this.dispatchEvent(new Event("connect"))):(st(this,il,tu).call(this),he(this,rr,"disconnected"),this.dispatchEvent(new Event("disconnect")))},[lt.RemotePlayerEventType.DURATION_CHANGED]:()=>{M(this,Ue).dispatchEvent(new Event("durationchange"))},[lt.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{M(this,Ue).dispatchEvent(new Event("volumechange"))},[lt.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{M(this,Ue).dispatchEvent(new Event("volumechange"))},[lt.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{var s;(s=M(this,zi,as))!=null&&s.isMediaLoaded&&M(this,Ue).dispatchEvent(new Event("timeupdate"))},[lt.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{M(this,Ue).dispatchEvent(new Event("resize"))},[lt.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{M(this,Ue).dispatchEvent(new Event(this.paused?"pause":"play"))},[lt.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var s,e;((s=M(this,zi,as))==null?void 0:s.playerState)!==chrome.cast.media.PlayerState.PAUSED&&M(this,Ue).dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(e=M(this,zi,as))==null?void 0:e.playerState]))},[lt.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{var s;(s=M(this,zi,as))!=null&&s.isMediaLoaded&&(await Promise.resolve(),st(this,al,iu).call(this))}}))},al=new WeakSet,iu=function(){st(this,Vn,Po).call(this)},Vn=new WeakSet,Po=async function(){var s,e,t,i,r;if(!M(this,zi,as))return;let n=((e=(s=M(this,zt).mediaInfo)==null?void 0:s.tracks)!=null?e:[]).filter(({type:h})=>h===chrome.cast.media.TrackType.TEXT),a=[...M(this,Ue).textTracks].filter(({kind:h})=>h==="subtitles"||h==="captions"),o=n.map(({language:h,name:f,trackId:p})=>{var y;let{mode:_}=(y=a.find(A=>A.language===h&&A.label===f))!=null?y:{};return _?{mode:_,trackId:p}:!1}).filter(Boolean),l=o.filter(({mode:h})=>h!=="showing").map(({trackId:h})=>h),c=o.find(({mode:h})=>h==="showing"),d=(r=(i=(t=rc())==null?void 0:t.getSessionObj().media[0])==null?void 0:i.activeTrackIds)!=null?r:[],u=d;if(d.length&&(u=u.filter(h=>!l.includes(h))),c!=null&&c.trackId&&(u=[...u,c.trackId]),u=[...new Set(u)],!((h,f)=>h.length===f.length&&h.every(p=>f.includes(p)))(d,u))try{let h=new chrome.cast.media.EditTracksInfoRequest(u);await k_(h)}catch(h){console.error(h)}};var M_=s=>{var e,t,i,r,n,a,o,l,c;return t=class extends s{constructor(){super(...arguments),re(this,a),re(this,l),re(this,i,{paused:!1}),re(this,r,vf()),re(this,n,void 0)}get remote(){return M(this,n)?M(this,n):w_()?(R_(),xs.set(this,{loadOnPrompt:()=>st(this,l,c).call(this)}),he(this,n,new C_(this))):super.remote}attributeChangedCallback(d,u,h){if(super.attributeChangedCallback(d,u,h),d==="c
94ast-receiver"&&h){M(this,r).receiverApplicationId=h;return}if(M(this,a,o))switch(d){case"cast-stream-type":case"cast-src":this.load();break}}async load(){var d,u;if(!M(this,a,o))return super.load();let h=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),f=[...this.querySelectorAll("track")].filter(({kind:A,src:x})=>x&&(A==="subtitles"||A==="captions")),p=[],y=0;f.length&&(h.tracks=f.map(A=>{let x=++y;p.length===0&&A.track.mode==="showing"&&p.push(x);let I=new chrome.cast.media.Track(x,chrome.cast.media.TrackType.TEXT);return I.trackContentId=A.src,I.trackContentType="text/vtt",I.subtype=A.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,I.name=A.label,I.language=A.srclang,I})),this.castStreamType==="live"?h.streamType=chrome.cast.media.StreamType.LIVE:h.streamType=chrome.cast.media.StreamType.BUFFERED,h.metadata=new chrome.cast.media.GenericMediaMetadata,h.metadata.title=this.title,h.metadata.images=[{url:this.poster}];let _=new chrome.cast.media.LoadRequest(h);_.currentTime=(d=super.currentTime)!=null?d:0,_.autoplay=!M(this,i).paused,_.activeTrackIds=p,await((u=rc())==null?void 0:u.loadMedia(_)),this.dispatchEvent(new Event("volumechange"))}play(){var d;if(M(this,a,o)){M(this,a,o).isPaused&&((d=M(this,a,o).controller)==null||d.playOrPause());return}return super.play()}pause(){var d;if(M(this,a,o)){M(this,a,o).isPaused||(d=M(this,a,o).controller)==null||d.playOrPause();return}super.pause()}get castOptions(){return M(this,r)}get castReceiver(){var d;return(d=this.getAttribute("cast-receiver"))!=null?d:void 0}set castReceiver(d){this.castReceiver!=d&&this.setAttribute("cast-receiver",`${d}`)}get castSrc(){var d,u,h;return(h=(u=this.getAttribute("cast-src"))!=null?u:(d=this.querySelector("source"))==null?void 0:d.src)!=null?h:this.currentSrc}set castSrc(d){this.castSrc!=d&&this.setAttribute("cast-src",`${d}`)}get castContentType(){var d;return(d=this.getAttribute("cast-content-type"))!=null?d:void 0}set castContentType(d){this.setAttribute("cast-content-type",`${d}`)}get castStreamType(){var d,u;return(u=(d=this.getAttribute("cast-stream-type"))!=null?d:this.streamType)!=null?u:void 0}set castStreamType(d){this.setAttribute("cast-stream-type",`${d}`)}get readyState(){if(M(this,a,o))switch(M(this,a,o).playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return M(this,a,o)?M(this,a,o).isPaused:super.paused}get muted(){var d;return M(this,a,o)?(d=M(this,a,o))==null?void 0:d.isMuted:super.muted}set muted(d){var u;if(M(this,a,o)){(d&&!M(this,a,o).isMuted||!d&&M(this,a,o).isMuted)&&((u=M(this,a,o).controller)==null||u.muteOrUnmute());return}super.muted=d}get volume(){var d,u;return M(this,a,o)?(u=(d=M(this,a,o))==null?void 0:d.volumeLevel)!=null?u:1:super.volume}set volume(d){var u;if(M(this,a,o)){M(this,a,o).volumeLevel=+d,(u=M(this,a,o).controller)==null||u.setVolumeLevel();return}super.volume=d}get duration(){var d,u,h;return M(this,a,o)&&(d=M(this,a,o))!=null&&d.isMediaLoaded?(h=(u=M(this,a,o))==null?void 0:u.duration)!=null?h:NaN:super.duration}get currentTime(){var d,u,h;return M(this,a,o)&&(d=M(this,a,o))!=null&&d.isMediaLoaded?(h=(u=M(this,a,o))==null?void 0:u.currentTime)!=null?h:0:super.currentTime}set currentTime(d){var u;if(M(this,a,o)){M(this,a,o).currentTime=d,(u=M(this,a,o).controller)==null||u.seek();return}super.currentTime=d}},i=new WeakMap,r=new WeakMap,n=new WeakMap,a=new WeakSet,o=function(){var d,u;return(u=(d=xs.get(this.remote))==null?void 0:d.getCastPlayer)==null?void 0:u.call(d)},l=new WeakSet,c=async function(){M(this,i).paused=ko(t.prototype,this,"paused"),ko(t.prototype,this,"pause").call(this),this.muted=ko(t.prototype,this,"muted");try{await this.load()}catch(d){console.error(d)}},We(t,"observedAttributes",[...(e=s.observedAttributes)!=null?e:[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"]),t},qa=class extends Event{constructor(s,e){super(s),We(this,"track"),this.track=e.track}},ol=new WeakMap;function ee(s){var e;return(e=ol.get(s))!=null?e:P_(s,{})}function P_(s,e){let t=ol.get(s);return t||ol.set(s,t={}),Object.assign(t,e)}function ll(s,e){let t=s.videoTracks;ee(e).media=s,ee(e).renditionSet||(ee(e).renditionSet=new Set);let i=ee(t).trackSet;i.add(e);let r=i.size-1;
94r in dl.prototype||Object.defineProperty(dl.prototype,r,{get(){return[...ee(this).trackSet][r]}}),queueMicrotask(()=>{t.dispatchEvent(new qa("addtrack",{track:e}))})}function cl(s){var e;let t=(e=ee(s).media)==null?void 0:e.videoTracks;t&&(ee(t).trackSet.delete(s),queueMicrotask(()=>{t.dispatchEvent(new qa("removetrack",{track:s}))}))}function O_(s){var e;let t=(e=ee(s).media.videoTracks)!=null?e:[],i=!1;for(let r of t)r!==s&&(r.selected=!1,i=!0);if(i){if(ee(t).changeRequested)return;ee(t).changeRequested=!0,queueMicrotask(()=>{delete ee(t).changeRequested,t.dispatchEvent(new Event("change"))})}}var os,ls,cs,Bs,kr,dl=class extends EventTarget{constructor(){super(),re(this,Bs),re(this,os,void 0),re(this,ls,void 0),re(this,cs,void 0),ee(this).trackSet=new Set}[Symbol.iterator](){return M(this,Bs,kr).values()}get length(){return M(this,Bs,kr).size}getTrackById(s){var e;return(e=[...M(this,Bs,kr)].find(t=>t.id===s))!=null?e:null}get selectedIndex(){return[...M(this,Bs,kr)].findIndex(s=>s.selected)}get onaddtrack(){return M(this,os)}set onaddtrack(s){M(this,os)&&(this.removeEventListener("addtrack",M(this,os)),he(this,os,void 0)),typeof s=="function"&&(he(this,os,s),this.addEventListener("addtrack",s))}get onremovetrack(){return M(this,ls)}set onremovetrack(s){M(this,ls)&&(this.removeEventListener("removetrack",M(this,ls)),he(this,ls,void 0)),typeof s=="function"&&(he(this,ls,s),this.addEventListener("removetrack",s))}get onchange(){return M(this,cs)}set onchange(s){M(this,cs)&&(this.removeEventListener("change",M(this,cs)),he(this,cs,void 0)),typeof s=="function"&&(he(this,cs,s),this.addEventListener("change",s))}};os=new WeakMap,ls=new WeakMap,cs=new WeakMap,Bs=new WeakSet,kr=function(){return ee(this).trackSet};var Ya=class extends Event{constructor(s,e){super(s),We(this,"rendition"),this.rendition=e.rendition}};function N_(s,e){let t=ee(s).media.videoRenditions;ee(e).media=ee(s).media,ee(e).track=s;let i=ee(s).renditionSet;i.add(e);let r=i.size-1;r in ul.prototype||Object.defineProperty(ul.prototype,r,{get(){return $s(this)[r]}}),queueMicrotask(()=>{s.selected&&t.dispatchEvent(new Ya("addrendition",{rendition:e}))})}function F_(s){let e=ee(s).media.videoRenditions,t=ee(s).track;ee(t).renditionSet.delete(s),queueMicrotask(()=>{ee(s).track.selected&&e.dispatchEvent(new Ya("removerendition",{rendition:s}))})}function U_(s){let e=ee(s).media.videoRenditions;!e||ee(e).changeRequested||(ee(e).changeRequested=!0,queueMicrotask(()=>{delete ee(e).changeRequested,ee(s).track.selected&&e.dispatchEvent(new Event("change"))}))}function $s(s){return[...ee(s).media.videoTracks].filter(e=>e.selected).flatMap(e=>[...ee(e).renditionSet])}var ds,us,hs,ul=class extends EventTarget{constructor(){super(...arguments),re(this,ds,void 0),re(this,us,void 0),re(this,hs,void 0)}[Symbol.iterator](){return $s(this).values()}get length(){return $s(this).length}getRenditionById(s){var e;return(e=$s(this).find(t=>`${t.id}`==`${s}`))!=null?e:null}get selectedIndex(){return $s(this).findIndex(s=>s.selected)}set selectedIndex(s){for(let[e,t]of $s(this).entries())t.selected=e===s}get onaddrendition(){return M(this,ds)}set onaddrendition(s){M(this,ds)&&(this.removeEventListener("addrendition",M(this,ds)),he(this,ds,void 0)),typeof s=="function"&&(he(this,ds,s),this.addEventListener("addrendition",s))}get onremoverendition(){return M(this,us)}set onremoverendition(s){M(this,us)&&(this.removeEventListener("removerendition",M(this,us)),he(this,us,void 0)),typeof s=="function"&&(he(this,us,s),this.addEventListener("removerendition",s))}get onchange(){return M(this,hs)}set onchange(s){M(this,hs)&&(this.removeEventListener("change",M(this,hs)),he(this,hs,void 0)),typeof s=="function"&&(he(this,hs,s),this.addEventListener("change",s))}};ds=new WeakMap,us=new WeakMap,hs=new WeakMap;var Dr,B_=class{constructor(){We(this,"src"),We(this,"id"),We(this,"width"),We(this,"height"),We(this,"bitrate"),We(this,"frameRate"),We(this,"codec"),re(this,Dr,!1)}get selected(){return M(this,Dr)}set selected(s){M(this,Dr)!==s&&(he(this,Dr,s),U_(this))}};Dr=new WeakMap;
94var Cr,yf=class{constructor(){We(this,"id"),We(this,"kind"),We(this,"label",""),We(this,"language",""),We(this,"sourceBuffer"),re(this,Cr,!1)}addRendition(s,e,t,i,r,n){let a=new B_;return a.src=s,a.width=e,a.height=t,a.frameRate=n,a.bitrate=r,a.codec=i,N_(this,a),a}removeRendition(s){F_(s)}get selected(){return M(this,Cr)}set selected(s){M(this,Cr)!==s&&(he(this,Cr,s),s===!0&&O_(this))}};Cr=new WeakMap;function $_(s,e){let t=ee(s).media.audioRenditions;ee(e).media=ee(s).media,ee(e).track=s;let i=ee(s).renditionSet;i.add(e);let r=i.size-1;r in hl.prototype||Object.defineProperty(hl.prototype,r,{get(){return Gs(this)[r]}}),queueMicrotask(()=>{s.enabled&&t.dispatchEvent(new Ya("addrendition",{rendition:e}))})}function G_(s){let e=ee(s).media.audioRenditions,t=ee(s).track;ee(t).renditionSet.delete(s),queueMicrotask(()=>{ee(s).track.enabled&&e.dispatchEvent(new Ya("removerendition",{rendition:s}))})}function H_(s){let e=ee(s).media.audioRenditions;!e||ee(e).changeRequested||(ee(e).changeRequested=!0,queueMicrotask(()=>{delete ee(e).changeRequested,ee(s).track.enabled&&e.dispatchEvent(new Event("change"))}))}function Gs(s){return[...ee(s).media.audioTracks].filter(e=>e.enabled).flatMap(e=>[...ee(e).renditionSet])}var fs,ms,ps,hl=class extends EventTarget{constructor(){super(...arguments),re(this,fs,void 0),re(this,ms,void 0),re(this,ps,void 0)}[Symbol.iterator](){return Gs(this).values()}get length(){return Gs(this).length}getRenditionById(s){var e;return(e=Gs(this).find(t=>`${t.id}`==`${s}`))!=null?e:null}get selectedIndex(){return Gs(this).findIndex(s=>s.selected)}set selectedIndex(s){for(let[e,t]of Gs(this).entries())t.selected=e===s}get onaddrendition(){return M(this,fs)}set onaddrendition(s){M(this,fs)&&(this.removeEventListener("addrendition",M(this,fs)),he(this,fs,void 0)),typeof s=="function"&&(he(this,fs,s),this.addEventListener("addrendition",s))}get onremoverendition(){return M(this,ms)}set onremoverendition(s){M(this,ms)&&(this.removeEventListener("removerendition",M(this,ms)),he(this,ms,void 0)),typeof s=="function"&&(he(this,ms,s),this.addEventListener("removerendition",s))}get onchange(){return M(this,ps)}set onchange(s){M(this,ps)&&(this.removeEventListener("change",M(this,ps)),he(this,ps,void 0)),typeof s=="function"&&(he(this,ps,s),this.addEventListener("change",s))}};fs=new WeakMap,ms=new WeakMap,ps=new WeakMap;var Mr,V_=class{constructor(){We(this,"src"),We(this,"id"),We(this,"bitrate"),We(this,"codec"),re(this,Mr,!1)}get selected(){return M(this,Mr)}set selected(s){M(this,Mr)!==s&&(he(this,Mr,s),H_(this))}};Mr=new WeakMap;function fl(s,e){let t=s.audioTracks;ee(e).media=s,ee(e).renditionSet||(ee(e).renditionSet=new Set);let i=ee(t).trackSet;i.add(e);let r=i.size-1;r in pl.prototype||Object.defineProperty(pl.prototype,r,{get(){return[...ee(this).trackSet][r]}}),queueMicrotask(()=>{t.dispatchEvent(new qa("addtrack",{track:e}))})}function ml(s){var e;let t=(e=ee(s).media)==null?void 0:e.audioTracks;t&&(ee(t).trackSet.delete(s),queueMicrotask(()=>{t.dispatchEvent(new qa("removetrack",{track:s}))}))}function W_(s){let e=ee(s).media.audioTracks;!e||ee(e).changeRequested||(ee(e).changeRequested=!0,queueMicrotask(()=>{delete ee(e).changeRequested,e.dispatchEvent(new Event("change"))}))}var gs,vs,Es,Pr,Wn,pl=class extends EventTarget{constructor(){super(),re(this,Pr),re(this,gs,void 0),re(this,vs,void 0),re(this,Es,void 0),ee(this).trackSet=new Set}[Symbol.iterator](){return M(this,Pr,Wn).values()}get length(){return M(this,Pr,Wn).size}getTrackById(s){var e;return(e=[...M(this,Pr,Wn)].find(t=>t.id===s))!=null?e:null}get onaddtrack(){return M(this,gs)}set onaddtrack(s){M(this,gs)&&(this.removeEventListener("addtrack",M(this,gs)),he(this,gs,void 0)),typeof s=="function"&&(he(this,gs,s),this.addEventListener("addtrack",s))}get onremovetrack(){return M(this,vs)}set onremovetrack(s){M(this,vs)&&(this.removeEventListener("removetrack",M(this,vs)),he(this,vs,void 0)),typeof s=="function"&&(he(this,vs,s),this.addEventListener("removetrack",s))}get onchange(){return M(this,Es)}set onchange(s){M(this,Es)&&(this.removeEventListener("change",M(this,Es)),he(this,Es,void 0)),typeof s=="function"&&(he(this,Es,s),this.addEventListener("change",s))}};gs=new WeakMap,vs=new WeakMap,Es=new WeakMap,Pr=new WeakSet,Wn=function(){return ee(this).trackSet};
94var Or,_f=class{constructor(){We(this,"id"),We(this,"kind"),We(this,"label",""),We(this,"language",""),We(this,"sourceBuffer"),re(this,Or,!1)}addRendition(s,e,t){let i=new V_;return i.src=s,i.codec=e,i.bitrate=t,$_(this,i),i}removeRendition(s){G_(s)}get enabled(){return M(this,Or)}set enabled(s){M(this,Or)!==s&&(he(this,Or,s),W_(this))}};Or=new WeakMap;var su=Sa(globalThis.HTMLMediaElement,"video"),ru=Sa(globalThis.HTMLMediaElement,"audio");function K_(s){if(!(s!=null&&s.prototype))return s;let e=Sa(s,"video");(!e||`${e}`.includes("[native code]"))&&Object.defineProperty(s.prototype,"videoTracks",{get(){return q_(this)}});let t=Sa(s,"audio");(!t||`${t}`.includes("[native code]"))&&Object.defineProperty(s.prototype,"audioTracks",{get(){return Y_(this)}}),"addVideoTrack"in s.prototype||(s.prototype.addVideoTrack=function(n,a="",o=""){let l=new yf;return l.kind=n,l.label=a,l.language=o,ll(this,l),l}),"removeVideoTrack"in s.prototype||(s.prototype.removeVideoTrack=cl),"addAudioTrack"in s.prototype||(s.prototype.addAudioTrack=function(n,a="",o=""){let l=new _f;return l.kind=n,l.label=a,l.language=o,fl(this,l),l}),"removeAudioTrack"in s.prototype||(s.prototype.removeAudioTrack=ml),"videoRenditions"in s.prototype||Object.defineProperty(s.prototype,"videoRenditions",{get(){return i(this)}});let i=n=>{let a=ee(n).videoRenditions;return a||(a=new ul,ee(a).media=n,ee(n).videoRenditions=a),a};"audioRenditions"in s.prototype||Object.defineProperty(s.prototype,"audioRenditions",{get(){return r(this)}});let r=n=>{let a=ee(n).audioRenditions;return a||(a=new hl,ee(a).media=n,ee(n).audioRenditions=a),a};return s}function Sa(s,e){var t;if(s!=null&&s.prototype)return(t=Object.getOwnPropertyDescriptor(s.prototype,`${e}Tracks`))==null?void 0:t.get}function q_(s){var e;let t=ee(s).videoTracks;if(!t&&(t=new dl,ee(s).videoTracks=t,su)){let i=su.call((e=s.nativeEl)!=null?e:s);for(let r of i)ll(s,r);i.addEventListener("change",()=>{t.dispatchEvent(new Event("change"))}),i.addEventListener("addtrack",r=>{if([...t].some(n=>n instanceof yf)){for(let n of i)cl(n);return}ll(s,r.track)}),i.addEventListener("removetrack",r=>{cl(r.track)})}return t}function Y_(s){var e;let t=ee(s).audioTracks;
vendor: 6,955 bytes, line 94
94if(!t&&(t=new pl,ee(s).audioTracks=t,ru)){let i=ru.call((e=s.nativeEl)!=null?e:s);for(let r of i)fl(s,r);i.addEventListener("change",()=>{t.dispatchEvent(new Event("change"))}),i.addEventListener("addtrack",r=>{if([...t].some(n=>n instanceof _f)){for(let n of i)ml(n);return}fl(s,r.track)}),i.addEventListener("removetrack",r=>{ml(r.track)})}return t}hf.push("castchange","entercast","leavecast");var ie={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_COOKIES:"disable-cookies",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",MIN_RESOLUTION:"min-resolution",RENDITION_ORDER:"rendition-order",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PREFER_CMCD:"prefer-cmcd",PREFER_PLAYBACK:"prefer-playback",START_TIME:"start-time",STREAM_TYPE:"stream-type",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type"},j_=Object.values(ie),z_=A_(),X_="mux-video",gi,Nr,Kn,Fr,qn,Yn,jn,zn,Ur,Xn,Q_=class extends Co{constructor(){super(),re(this,Ur),re(this,gi,void 0),re(this,Nr,void 0),re(this,Kn,void 0),re(this,Fr,{}),re(this,qn,void 0),re(this,Yn,void 0),re(this,jn,void 0),re(this,zn,void 0),he(this,Kn,jy())}static get observedAttributes(){var s;return[...j_,...(s=Co.observedAttributes)!=null?s:[]]}get preferCmcd(){var s;return(s=this.getAttribute(ie.PREFER_CMCD))!=null?s:void 0}set preferCmcd(s){s!==this.preferCmcd&&(s?Wd.includes(s)?this.setAttribute(ie.PREFER_CMCD,s):console.warn(`Invalid value for preferCmcd. Must be one of ${Wd.join()}`):this.removeAttribute(ie.PREFER_CMCD))}get playerInitTime(){return M(this,Kn)}get playerSoftwareName(){var s;return(s=M(this,jn))!=null?s:X_}set playerSoftwareName(s){he(this,jn,s)}get playerSoftwareVersion(){var s;return(s=M(this,Yn))!=null?s:z_}set playerSoftwareVersion(s){he(this,Yn,s)}get _hls(){var s;return(s=M(this,gi))==null?void 0:s.engine}get mux(){var s;return(s=this.nativeEl)==null?void 0:s.mux}get error(){var s;return(s=e_(this.nativeEl))!=null?s:null}get errorTranslator(){return M(this,zn)}set errorTranslator(s){he(this,zn,s)}get src(){return this.getAttribute("src")}set src(s){s!==this.src&&(s==null?this.removeAttribute("src"):this.setAttribute("src",s))}get type(){var s;return(s=this.getAttribute(ie.TYPE))!=null?s:void 0}set type(s){s!==this.type&&(s?this.setAttribute(ie.TYPE,s):this.removeAttribute(ie.TYPE))}get autoplay(){let s=this.getAttribute("autoplay");return s===null?!1:s===""?!0:s}set autoplay(s){let e=this.autoplay;s!==e&&(s?this.setAttribute("autoplay",typeof s=="string"?s:""):this.removeAttribute("autoplay"))}get preload(){let s=this.getAttribute("preload");return s===""?"auto":["none","metadata","auto"].includes(s)?s:super.preload}set preload(s){s!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(s)?this.setAttribute("preload",s):this.removeAttribute("preload"))}get debug(){return this.getAttribute(ie.DEBUG)!=null}set debug(s){s!==this.debug&&(s?this.setAttribute(ie.DEBUG,""):this.removeAttribute(ie.DEBUG))}get disableCookies(){return this.hasAttribute(ie.DISABLE_COOKIES)}set disableCookies(s){s!==this.disableCookies&&(s?this.setAttribute(ie.DISABLE_COOKIES,""):this.removeAttribute(ie.DISABLE_COOKIES))}get startTime(){let s=this.getAttribute(ie.START_TIME);if(s==null)return;let e=+s;return Number.isNaN(e)?void 0:e}set startTime(s){s!==this.startTime&&(s==null?this.removeAttribute(ie.START_TIME):this.setAttribute(ie.START_TIME,`${s}`))}get playbackId(){var s;return(s=this.getAttribute(ie.PLAYBACK_ID))!=null?s:void 0}set playbackId(s){s!==this.playbackId&&(s?this.setAttribute(ie.PLAYBACK_ID,s):this.removeAttribute(ie.PLAYBACK_ID))}get maxResolution(){var s;return(s=this.getAttribute(ie.MAX_RESOLUTION))!=null?s:void 0}set maxResolution(s){s!==this.maxResolution&&(s?this.setAttribute(ie.MAX_RESOLUTION,s):this.removeAttribute(ie.MAX_RESOLUTION))}get minResolution(){var s;return(s=this.getAttribute(ie.MIN_RESOLUTION))!=null?s:void 0}set minResolution(s){s!==this.minResolution&&(s?this.setAttribute(ie.MIN_RESOLUTION,s):this.removeAttribute(ie.MIN_RESOLUTION))}get renditionOrder(){var s;return(s=this.getAttribute(ie.RENDITION_ORDER))!=null?s:void 0}set renditionOrder(s){s!==this.renditionOrder&&(s?this.setAttribute(ie.RENDITION_ORDER,s):this.removeAttribute(ie.RENDITION_ORDER))}get customDomain(){var s;return(s=this.getAttribute(ie.CUSTOM_DOMAIN))!=null?s:void 0}set customDomain(s){s!==this.customDomain&&(s?this.setAttribute(ie.CUSTOM_DOMAIN,s):this.removeAttribute(ie.CUSTOM_DOMAIN))}get ended(){return af(this.nativeEl,this._hls)}get envKey(){var s;return(s=this.getAttribute(ie.ENV_KEY))!=null?s:void 0}set envKey(s){s!==this.envKey&&(s?this.setAttribute(ie.ENV_KEY,s):this.removeAttribute(ie.ENV_KEY))}get beaconCollectionDomain(){var s;return(s=this.getAttribute(ie.BEACON_COLLECTION_DOMAIN))!=null?s:void 0}set beaconCollectionDomain(s){s!==this.beaconCollectionDomain&&(s?this.setAttribute(ie.BEACON_COLLECTION_DOMAIN,s):this.removeAttribute(ie.BEACON_COLLECTION_DOMAIN))}get streamType(){var s;return(s=this.getAttribute(ie.STREAM_TYPE))!=null?s:t_(this.nativeEl)}set streamType(s){s!==this.streamType&&(s?this.setAttribute(ie.STREAM_TYPE,s):this.removeAttribute(ie.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(ie.TARGET_LIVE_WINDOW)?+this.getAttribute(ie.TARGET_LIVE_WINDOW):i_(this.nativeEl)}set targetLiveWindow(s){s!=this.targetLiveWindow&&(s==null?this.removeAttribute(ie.TARGET_LIVE_WINDOW):this.setAttribute(ie.TARGET_LIVE_WINDOW,`${+s}`))}get liveEdgeStart(){var s,e;if(this.hasAttribute(ie.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:t}=this,i=(s=this.nativeEl.seekable.end(0))!=null?s:0,r=(e=this.nativeEl.seekable.start(0))!=null?e:0;return Math.max(r,i-t)}return s_(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(ie.LIVE_EDGE_OFFSET))return+this.getAttribute(ie.LIVE_EDGE_OFFSET)}set liveEdgeOffset(s){s!=this.targetLiveWindow&&(s==null?this.removeAttribute(ie.LIVE_EDGE_OFFSET):this.setAttribute(ie.LIVE_EDGE_OFFSET,`${+s}`))}get seekable(){return sf(this.nativeEl)}async addCuePoints(s){return Qh(this.nativeEl,s)}get activeCuePoint(){return Jh(this.nativeEl)}get cuePoints(){return Ny(this.nativeEl)}getStartDate(){return Uy(this.nativeEl,this._hls)}get currentPdt(){return By(this.nativeEl,this._hls)}get preferPlayback(){let s=this.getAttribute(ie.PREFER_PLAYBACK);if(s===sr.MSE||s===sr.NATIVE)return s}set preferPlayback(s){s!==this.preferPlayback&&(s===sr.MSE||s===sr.NATIVE?this.setAttribute(ie.PREFER_PLAYBACK,s):this.removeAttribute(ie.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(s=>s.startsWith("metadata-")&&![ie.METADATA_URL].includes(s)).reduce((s,e)=>{let t=this.getAttribute(e);return t!=null&&(s[e.replace(/^metadata-/,"").replace(/-/g,"_")]=t),s},{}),...M(this,Fr)}}set metadata(s){he(this,Fr,s??{}),this.mux&&this.mux.emit("hb",M(this,Fr))}
94get _hlsConfig(){return M(this,qn)}set _hlsConfig(s){he(this,qn,s)}load(){he(this,gi,a_(this,this.nativeEl,M(this,gi)))}unload(){of(this.nativeEl,M(this,gi)),he(this,gi,void 0)}attributeChangedCallback(s,e,t){var i,r;switch(Co.observedAttributes.includes(s)&&!["src","autoplay","preload"].includes(s)&&super.attributeChangedCallback(s,e,t),s){case ie.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=t??void 0;break;case ie.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=t??void 0;break;case"src":{let n=!!e,a=!!t;!n&&a?st(this,Ur,Xn).call(this):n&&!a?this.unload():n&&a&&(this.unload(),st(this,Ur,Xn).call(this));break}case"autoplay":if(t===e)break;(i=M(this,gi))==null||i.setAutoplay(this.autoplay);break;case"preload":if(t===e)break;(r=M(this,gi))==null||r.setPreload(t);break;case ie.PLAYBACK_ID:this.src=Xy(this);break;case ie.DEBUG:{let n=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=n);break}case ie.METADATA_URL:t&&fetch(t).then(n=>n.json()).then(n=>this.metadata=n).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${t}!`));break;case ie.STREAM_TYPE:(t==null||t!==e)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case ie.TARGET_LIVE_WINDOW:(t==null||t!==e)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break}}connectedCallback(){var s;(s=super.connectedCallback)==null||s.call(this),this.nativeEl&&this.src&&!M(this,gi)&&st(this,Ur,Xn).call(this)}disconnectedCallback(){this.unload()}};gi=new WeakMap,Nr=new WeakMap,Kn=new WeakMap,Fr=new WeakMap,qn=new WeakMap,Yn=new WeakMap,jn=new WeakMap,zn=new WeakMap,Ur=new WeakSet,Xn=async function(){M(this,Nr)||(await he(this,Nr,Promise.resolve()),he(this,Nr,null),this.load())};var nu=class extends M_(K_(Q_)){};Do.customElements.get("mux-video")||(Do.customElements.define("mux-video",nu),Do.MuxVideoElement=nu);const be={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},je={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},nr={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_PAUSED:"mediaPaused",MEDIA_HAS_P
94LAYED:"mediaHasPlayed",MEDIA_ENDED:"mediaEnded",MEDIA_MUTED:"mediaMuted",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_IS_PIP:"mediaIsPip",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_LOADING:"mediaLoading",MEDIA_BUFFERED:"mediaBuffered",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_CHAPTERS_CUES:"mediaChaptersCues"},Tf=Object.entries(nr),w=Tf.reduce((s,[e,t])=>(s[e]=`${t.toLowerCase()}`,s),{}),fr=Tf.reduce((s,[e,t])=>(s[e]=`${t.toLowerCase()}`,s),{USER_INACTIVE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"});Object.entries(fr).reduce((s,[e,t])=>{const i=w[e];return i&&(s[t]=i),s},{userinactivechange:"userinactive"});const Z_=Object.entries(w).reduce((s,[e,t])=>{const i=fr[e];return i&&(s[t]=i),s},{userinactive:"userinactivechange"}),Fi={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},Hs={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"},au={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},qt={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},Si={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"},es={AUDIO_PLAYER:()=>"audio player",VIDEO_PLAYER:()=>"video player",VOLUME:()=>"volume",SEEK:()=>"seek",CLOSED_CAPTIONS:()=>"closed captions",PLAYBACK_RATE:({playbackRate:s=1}={})=>`current playback rate ${s}`,PLAYBACK_TIME:()=>"playback time",MEDIA_LOADING:()=>"media loading",SETTINGS:()=>"settings",AUDIO_TRACKS:()=>"audio tracks",QUALITY:()=>"quality"},kt={PLAY:()=>"play",PAUSE:()=>"pause",MUTE:()=>"mute",UNMUTE:()=>"unmute",ENTER_AIRPLAY:()=>"start airplay",EXIT_AIRPLAY:()=>"stop airplay",ENTER_CAST:()=>"start casting",EXIT_CAST:()=>"stop casting",ENTER_FULLSCREEN:()=>"enter fullscreen mode",EXIT_FULLSCREEN:()=>"exit fullscreen mode",ENTER_PIP:()=>"enter picture in picture mode",EXIT_PIP:()=>"exit picture in picture mode",SEEK_FORWARD_N_SECS:({seekOffset:s=30}={})=>`seek forward ${s} seconds`,SEEK_BACK_N_SECS:({seekOffset:s=30}={})=>`seek back ${s} seconds`,SEEK_LIVE:()=>"seek to live",PLAYING_LIVE:()=>"playing live"};function J_(s){return s==null?void 0:s.map(eT).join(" ")}function eT(s){if(s){const{id:e,width:t,height:i}=s;return[e,t,i].filter(r=>r!=null).join(":")}}function tT(s){return s==null?void 0:s.map(iT).join(" ")}function iT(s){if(s){const{id:e,kind:t,language:i,label:r}=s;return[e,t,i,r].filter(n=>n!=null).join(":")}}function Oo(s,e=!1){return s.split("_").map(function(t,i){return(i||e?t[0].toUpperCase():t[0].toLowerCase())+t.slice(1).toLowerCase()}).join("")}function sT(s){return typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s)}const bf=s=>new Promise(e=>setTimeout(e,s)),ou=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],rT=(s,e)=>{const t=s===1?ou[e].singular:ou[e].plural;return`${s} ${t}`},jr=s=>{if(!sT(s))return"";const e=Math.abs(s),t=e!==s,i=new Date(0,0,0,0,0,e,0);return`${[i.getHours(),i.getMinutes(),i.getSeconds()].map((o,l)=>o&&rT(o,l)).filter(o=>o).join(", ")}${t?" remaining":""}`};function Is(s,e){let t=!1;s<0&&(t=!0,s=0-s),s=s<0?0:s;let i=Math.floor(s%60),r=Math.floor(s/60%60),n=Math.floor(s/3600);const a=Math.floor(e/60%60),o=Math.floor(e/3600);return(isNaN(s)||s===1/0)&&(n=r=i="0"),n=n>0||o>0?n+":":"",r=((n||a>=10)&&r<10?"0"+r:r)+":",i=i<10?"0"+i:i,(t?"-":"")+n+r+i}const Af=(s,e,t=".value")=>{const i=s.querySelector(t);i&&(i.textContent=e)},nT=(s,e)=>{const t=`slot[name="${e}"]`,i=s.shadowRoot.querySelector(t);return i?i.children:[]},Sf=(s,e)=>nT(s,e)[0],xa=(s,e)=>!s||!e?!1:s.contains(e)?!0:xa(s,e.getRootNode().host),ac=(s,e)=>{if(!s)return null;const t=s.closest(e);return t||ac(s.getRootNode().host,e)};function aT(s){var e;const t=(e=s==null?void 0:s.getRootNode)==null?void 0:e.call(s);return t instanceof ShadowRoot||t instanceof Document?t:null}function oT(s,e=3){if(s.checkVisibility)return s.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0});let t=s;for(;t&&e>0;){const i=getComputedStyle(t);if(i.opacity==="0"||i.visibility==="hidden"||i.display==="none")return!1;t=t.parentElement,e--}return!0}function lT(s,e,t,i){const r=No(t,i),n=No(t,{x:s,y:e}),a=No(i,{x:s,y:e});return n>r||a>r?n>a?1:0:n/r}function No(s,e){return Math.sqrt(Math.pow(e.x-s.x,2)+Math.pow(e.y-s.y,2))}function Rt(s,e){const t=cT(s,i=>i===e);return t||xf(s,e)}function cT(s,e){var t;let i;for(i of s.querySelectorAll("style")){let r;try{r=(t=i.sheet)==null?void 0:t.cssRules}catch{continue}for(let n of r??[])if(e(n.selectorText))return n}}function xf(s,e){var t,i;const r=(t=s.querySelectorAll("style"))!=null?t:[],n=r==null?void 0:r[r.length-1];return n!=null&&n.sheet?(n==null||n.sheet.insertRule(`${e}{}`,n.sheet.cssRules.length),(i=n.sheet.cssRules)==null?void 0:i[n.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",s),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function ct(s,e,t=Number.NaN){const i=s.getAttribute(e);return i!=null?+i:t}function Mt(s,e,t){const i=+t;if(t==null||Number.isNaN(i)){s.hasAttribute(e)&&s.removeAttribute(e);return}ct(s,e,void 0)!==i&&s.setAttribute(e,`${i}`)}function yt(s,e){return s.hasAttribute(e)}function _t(s,e,t){if(t==null){s.hasAttribute(e)&&s.removeAttribute(e);return}yt(s,e)!=t&&s.toggleAttribute(e,t)}function ei(s,e,t=null){var i;return(i=s.getAttribute(e))!=null?i:t}function ti(s,e,t){if(t==null){s.hasAttribute(e)&&s.removeAttribute(e);return}const i=`${t}`;ei(s,e,void 0)!==i&&s.setAttribute(e,i)}let lu=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}};class dT{observe(){}unobserve(){}disconnect(){}}const If={createElement:function(){return new Ia.HTMLElement},createElementNS:function(){return new Ia.HTMLElement},addEventListener(){},removeEventListener(){}},Ia={ResizeObserver:dT,document:If,HTMLElement:class extends lu{},DocumentFragment:class extends lu{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia(s){return{matches:!1,media:s}}},Lf=typeof window>"u"||typeof window.customElements>"u",wf=Object.keys(Ia).every(s=>s in globalThis),W=Lf&&!wf?Ia:globalThis,Te=Lf&&!wf?If:globalThis.document;var uT=Object.defineProperty,hT=(s,e,t)=>e in s?uT(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,fT=(s,e,t)=>(hT(s,typeof e!="symbol"?e+"":e,t),t),Rf=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Yt=(s,e,t)=>(Rf(s,e,"read from private field"),t?t.call(s):e.get(s)),An=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},Sn=(s,e,t,i)=>(Rf(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),vi,Qn,Vs,Zn;const kf=Te.createElement("template");kf.innerHTML=` 95<style> 96 :host { 97 font: var(--media-font, 98 var(--media-font-weight, bold) 99 var(--media-font-size, 14px) / 100 var(--media-text-content-height, var(--media-control-height, 24px)) 101 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 102 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 103 background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 104 padding: var(--media-button-padding, var(--media-control-padding, 10px)); 105 justify-content: var(--media-button-justify-content, center); 106 display: inline-flex; 107 align-items: center; 108 vertical-align: middle; 109 box-sizing: border-box; 110 transition: background .15s linear; 111 pointer-events: auto; 112 cursor: pointer; 113 -webkit-tap-highlight-color: transparent; 114 } 115 116 117 :host(:focus-visible) { 118 box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9); 119 outline: 0; 120 } 121 122 :host(:where(:focus)) { 123 box-shadow: none; 124 outline: 0; 125 } 126 127 :host(:hover) { 128 background: var(--media-control-hover-background, rgba(50 50 70 / .7)); 129 } 130 131 svg, img, ::slotted(svg), ::slotted(img) { 132 width: var(--media-button-icon-width); 133 height: var(--media-button-icon-height, var(--media-control-height, 24px)); 134 transform: var(--media-button-icon-transform); 135 transition: var(--media-button-icon-transition); 136 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 137 vertical-align: middle; 138 max-width: 100%; 139 max-height: 100%; 140 min-width: 100%; 141 } 142</style> 143`;class ii extends W.HTMLElement{constructor(e={}){if(super(),An(this,vi,void 0),fT(this,"preventClick",!1),An(this,Qn,t=>{this.preventClick||this.handleClick(t)}),An(this,Vs,t=>{const{key:i}=t;if(!this.keysUsed.includes(i)){this.removeEventListener("keyup",Yt(this,Vs));return}this.preventClick||this.handleClick(t)}),An(this,Zn,t=>{const{metaKey:i,altKey:r,key:n}=t;if(i||r||!this.keysUsed.includes(n)){this.removeEventListener("keyup",Yt(this,Vs));return}this.addEventListener("keyup",Yt(this,Vs),{once:!0})}),!this.shadowRoot){this.attachShadow({mode:"open"});const t=kf.content.cloneNode(!0);this.nativeEl=t;let i=e.slotTemplate;i||(i=Te.createElement("template"),i.innerHTML=`<slot>${e.defaultContent||""}</slot>`),this.nativeEl.appendChild(i.content.cloneNode(!0)),this.shadowRoot.appendChild(t)}}static get observedAttributes(){return["disabled",je.MEDIA_CONTROLLER]}enable(){this.addEventListener("click",Yt(this,Qn)),this.addEventListener("keydown",Yt(this,Zn)),this.tabIndex=0}disable(){this.removeEventListener("click",Yt(this,Qn)),this.removeEventListener("keydown",Yt(this,Zn)),this.removeEventListener("keyup",Yt(this,Vs)),this.tabIndex=-1}attributeChangedCallback(e,t,i){var r,n,a,o,l;e===je.MEDIA_CONTROLLER?(t&&((n=(r=Yt(this,vi))==null?void 0:r.unassociateElement)==null||n.call(r,this),Sn(this,vi,null)),i&&this.isConnected&&(Sn(this,vi,(a=this.getRootNode())==null?void 0:a.getElementById(i)),(l=(o=Yt(this,vi))==null?void 0:o.associateElement)==null||l.call(o,this))):e==="disabled"&&i!==t&&(i==null?this.enable():this.disable())}connectedCallback(){var e,t,i;const{style:r}=Rt(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","button");const n=this.getAttribute(je.MEDIA_CONTROLLER);n&&(Sn(this,vi,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(i=(t=Yt(this,vi))==null?void 0:t.associateElement)==null||i.call(t,this))}disconnectedCallback(){var e,t;this.disable(),(t=(e=Yt(this,vi))==null?void 0:e.unassociateElement)==null||t.call(e,this),Sn(this,vi,null)}get keysUsed(){return["Enter"," "]}handleClick(e){}}vi=new WeakMap;Qn=new WeakMap;Vs=new WeakMap;Zn=new WeakMap;W.customElements.get("media-chrome-button")||W.customElements.define("media-chrome-button",ii);const cu=`<svg aria-hidden="true" viewBox="0 0 26 24"> 144 <path d="M22.13 3H3.87a.87.87 0 0 0-.87.87v13.26a.87.87 0 0 0 .87.87h3.4L9 16H5V5h16v11h-4l1.72 2h3.4a.87.87 0 0 0 .87-.87V3.87a.87.87 0 0 0-.86-.87Zm-8.75 11.44a.5.5 0 0 0-.76 0l-4.91 5.73a.5.5 0 0 0 .38.83h9.82a.501.501 0 0 0 .38-.83l-4.91-5.73Z"/> 145</svg> 146`,Df=Te.createElement("template");Df.innerHTML=` 147 <style> 148 :host([${w.MEDIA_IS_AIRPLAYING}]) slot:not([name=exit]):not([name=icon]) { 149 display: none !important; 150 } 151 152 153 :host(:not([${w.MEDIA_IS_AIRPLAYING}])) slot:not([name=enter]):not([name=icon]) { 154 display: none !important; 155 } 156 </style> 157 158 <slot name="icon"> 159 <slot name="enter">${cu}</slot> 160 <slot name="exit">${cu}</slot> 161 </slot> 162`;const du=s=>{const e=s.mediaIsAirplaying?kt.EXIT_AIRPLAY():kt.ENTER_AIRPLAY();s.setAttribute("aria-label",e)};class mT extends ii{static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_IS_AIRPLAYING,w.MEDIA_AIRPLAY_UNAVAILABLE]}constructor(e={}){super({slotTemplate:Df,...e})}connectedCallback(){super.connectedCallback(),du(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===w.MEDIA_IS_AIRPLAYING&&du(this)}get mediaIsAirplaying(){return yt(this,w.MEDIA_IS_AIRPLAYING)}set mediaIsAirplaying(e){_t(this,w.MEDIA_IS_AIRPLAYING,e)}get mediaAirplayUnavailable(){return ei(this,w.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(e){ti(this,w.MEDIA_AIRPLAY_UNAVAILABLE,e)}handleClick(){const e=new W.CustomEvent(be.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(e)}}W.customElements.get("media-airplay-button")||W.customElements.define("media-airplay-button",mT);const pT='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/></g></svg>',gT='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/><path class="cast_caf_icon_boxfill" d="M5,7 L5,8.63 C8,8.6 13.37,14 13.37,17 L19,17 L19,7 Z"/></g></svg>',Cf=Te.createElement("template");Cf.innerHTML=` 163 <style> 164 :host([${w.MEDIA_IS_CASTING}]) slot:not([name=exit]):not([name=icon]) { 165 display: none !important; 166 } 167 168 169 :host(:not([${w.MEDIA_IS_CASTING}])) slot:not([name=enter]):not([name=icon]) { 170 display: none !important; 171 } 172 </style> 173 174 <slot name="icon"> 175 <slot name="enter">${pT}</slot> 176 <slot name="exit">${gT}</slot> 177 </slot> 178`;const uu=s=>{const e=s.mediaIsCasting?kt.EXIT_CAST():kt.ENTER_CAST();s.setAttribute("aria-label",e)};class vT extends ii{static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_IS_CASTING,w.MEDIA_CAST_UNAVAILABLE]}constructor(e={}){super({slotTemplate:Cf,...e})}connectedCallback(){super.connectedCallback(),uu(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===w.MEDIA_IS_CASTING&&uu(this)}get mediaIsCasting(){return yt(this,w.MEDIA_IS_CASTING)}set mediaIsCasting(e){_t(this,w.MEDIA_IS_CASTING,e)}get mediaCastUnavailable(){return ei(this,w.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(e){ti(this,w.MEDIA_CAST_UNAVAILABLE,e)}handleClick(){const e=this.mediaIsCasting?be.MEDIA_EXIT_CAST_REQUEST:be.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new W.CustomEvent(e,{composed:!0,bubbles:!0}))}}W.customElements.get("media-cast-button")||W.customElements.define("media-cast-button",vT);var Mf=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Hi=(s,e,t)=>(Mf(s,e,"read from private field"),t?t.call(s):e.get(s)),ET=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},xn=(s,e,t,i)=>(Mf(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),Ut;const Pf=Te.createElement("template");Pf.innerHTML=` 179<style> 180 :host { 181 display: var(--media-control-display, var(--media-gesture-receiver-display, inline-block)); 182 box-sizing: border-box; 183 } 184</style> 185`;class yT extends W.HTMLElement{constructor(e={}){if(super(),ET(this,Ut,void 0),!this.s
185hadowRoot){const t=this.attachShadow({mode:"open"}),i=Pf.content.cloneNode(!0);this.nativeEl=i;let r=e.slotTemplate;r||(r=Te.createElement("template"),r.innerHTML=`<slot>${e.defaultContent||""}</slot>`),this.nativeEl.appendChild(r.content.cloneNode(!0)),t.appendChild(i)}}static get observedAttributes(){return[je.MEDIA_CONTROLLER,w.MEDIA_PAUSED]}attributeChangedCallback(e,t,i){var r,n,a,o,l;e===je.MEDIA_CONTROLLER&&(t&&((n=(r=Hi(this,Ut))==null?void 0:r.unassociateElement)==null||n.call(r,this),xn(this,Ut,null)),i&&this.isConnected&&(xn(this,Ut,(a=this.getRootNode())==null?void 0:a.getElementById(i)),(l=(o=Hi(this,Ut))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,i,r;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),xn(this,Ut,_T(this)),this.getAttribute(je.MEDIA_CONTROLLER)&&((t=(e=Hi(this,Ut))==null?void 0:e.associateElement)==null||t.call(e,this)),(i=Hi(this,Ut))==null||i.addEventListener("pointerdown",this),(r=Hi(this,Ut))==null||r.addEventListener("click",this)}disconnectedCallback(){var e,t,i,r;this.getAttribute(je.MEDIA_CONTROLLER)&&((t=(e=Hi(this,Ut))==null?void 0:e.unassociateElement)==null||t.call(e,this)),(i=Hi(this,Ut))==null||i.removeEventListener("pointerdown",this),(r=Hi(this,Ut))==null||r.removeEventListener("click",this),xn(this,Ut,null)}handleEvent(e){var t;const i=(t=e.composedPath())==null?void 0:t[0];if(["video","media-controller"].includes(i==null?void 0:i.localName)){if(e.type==="pointerdown")this._pointerType=e.pointerType;else if(e.type==="click"){const{clientX:n,clientY:a}=e,{left:o,top:l,width:c,height:d}=this.getBoundingClientRect(),u=n-o,h=a-l;if(u<0||h<0||u>c||h>d||c===0&&d===0)return;const{pointerType:f=this._pointerType}=e;if(this._pointerType=void 0,f===au.TOUCH){this.handleTap(e);return}else if(f===au.MOUSE){this.handleMouseClick(e);return}}}}get mediaPaused(){return yt(this,w.MEDIA_PAUSED)}set mediaPaused(e){_t(this,w.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(e){const t=this.mediaPaused?be.MEDIA_PLAY_REQUEST:be.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new W.CustomEvent(t,{composed:!0,bubbles:!0}))}}Ut=new WeakMap;function _T(s){var e;const t=s.getAttribute(je.MEDIA_CONTROLLER);return t?(e=s.getRootNode())==null?void 0:e.getElementById(t):ac(s,"media-controller")}W.customElements.get("media-gesture-receiver")||W.customElements.define("media-gesture-receiver",yT);const hu=new WeakMap,oc=s=>{let e=hu.get(s);return e||hu.set(s,e=new Set),e},Of=new W.ResizeObserver(s=>{for(let e of s)for(let t of oc(e.target))t(e)});function Nf(s,e){oc(s).add(e),Of.observe(s)}function TT(s,e){const t=oc(s);t.delete(e),t.size||Of.unobserve(s)}var bT=Object.defineProperty,AT=(s,e,t)=>e in s?bT(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,ST=(s,e,t)=>(AT(s,typeof e!="symbol"?e+"":e,t),t),lc=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Ws=(s,e,t)=>(lc(s,e,"read from private field"),t?t.call(s):e.get(s)),rs=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},Fo=(s,e,t,i)=>(lc(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),ci=(s,e,t)=>(lc(s,e,"access private method"),t),La,Mi,gl,Ff,vl,Uf,en,ja,za,cc,dr,tn;const Oe={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive"},Bf=Te.createElement("template");Bf.innerHTML=` 186 <style> 187 188 :host([${w.MEDIA_IS_FULLSCREEN}]) ::slotted([slot=media]) { 189 outline: none; 190 } 191 192 :host { 193 box-sizing: border-box; 194 position: relative; 195 display: inline-block; 196 line-height: 0; 197 background-color: var(--media-background-color, #000); 198 } 199 200 :host(:not([${Oe.AUDIO}])) [part~=layer]:not([part~=media-layer]) { 201 position: absolute; 202 top: 0; 203 left: 0; 204 bottom: 0; 205 right: 0; 206 display: flex; 207 flex-flow: column nowrap; 208 align-items: start; 209 pointer-events: none; 210 background: none; 211 } 212 213 slot[name=media] { 214 display: var(--media-slot-display, contents); 215 } 216 217 218 :host([${Oe.AUDIO}]) slot[name=media] { 219 display: var(--media-slot-display, none); 220 } 221 222 223 :host([${Oe.AUDIO}]) [part~=layer][part~=gesture-layer] { 224 height: 0; 225 display: block; 226 } 227 228 229 :host(:not([${Oe.AUDIO}])[${Oe.GESTURES_DISABLED}]) ::slotted([slot=gestures-chrome]), 230 :host(:not([${Oe.AUDIO}])[${Oe.GESTURES_DISABLED}]) media-gesture-receiver[slot=gestures-chrome] { 231 display: none; 232 } 233 234 235 ::slotted(:not([slot=media]):not([slot=poster]):not(media-loading-indicator):not([hidden])) { 236 pointer-events: auto; 237 } 238 239 :host(:not([${Oe.AUDIO}])) *[part~=layer][part~=centered-layer] { 240 align-items: center; 241 justify-content: center; 242 } 243 244 :host(:not([${Oe.AUDIO}])) ::slotted(media-gesture-receiver[slot=gestures-chrome]), 245 :host(:not([${Oe.AUDIO}])) media-gesture-receiver[slot=gestures-chrome] { 246 align-self: stretch; 247 flex-grow: 1; 248 } 249 250 slot[name=middle-chrome] { 251 display: inline; 252 flex-grow: 1; 253 pointer-events: none; 254 background: none; 255 } 256 257 258 ::slotted([slot=media]), 259 ::slotted([slot=poster]) { 260 width: 100%; 261 height: 100%; 262 } 263 264 265 :host(:not([${Oe.AUDIO}])) .spacer { 266 flex-grow: 1; 267 } 268 269 270 :host(:-webkit-full-screen) { 271 272 width: 100% !important; 273 height: 100% !important; 274 } 275 276 277 ::slotted(:not([slot=media]):not([${Oe.NO_AUTOHIDE}]):not([hidden])) { 278 opacity: 1; 279 transition: opacity 0.25s; 280 } 281 282 283 :host([${Oe.USER_INACTIVE}]:not([${w.MEDIA_PAUSED}]):not([${w.MEDIA_IS_AIRPLAYING}
283]):not([${w.MEDIA_IS_CASTING}]):not([${Oe.AUDIO}])) ::slotted(:not([slot=media]):not([${Oe.NO_AUTOHIDE}])) { 284 opacity: 0; 285 transition: opacity 1s; 286 } 287 288 :host([${Oe.USER_INACTIVE}]:not([${w.MEDIA_PAUSED}]):not([${w.MEDIA_IS_CASTING}]):not([${Oe.AUDIO}])) ::slotted([slot=media]) { 289 cursor: none; 290 } 291 292 ::slotted(media-control-bar) { 293 align-self: stretch; 294 } 295 296 297 :host(:not([${Oe.AUDIO}])[${w.MEDIA_HAS_PLAYED}]) slot[name=poster] { 298 display: none; 299 } 300 301 ::slotted([role="menu"]) { 302 align-self: end; 303 } 304 305 ::slotted([role="dialog"]) { 306 align-self: center; 307 } 308 </style> 309 310 <slot name="media" part="layer media-layer"></slot> 311 <slot name="poster" part="layer poster-layer"></slot> 312 <slot name="gestures-chrome" part="layer gesture-layer"> 313 <media-gesture-receiver slot="gestures-chrome"></media-gesture-receiver> 314 </slot> 315 <span part="layer vertical-layer"> 316 <slot name="top-chrome" part="top chrome"></slot> 317 <slot name="middle-chrome" part="middle chrome"></slot> 318 <slot name="centered-chrome" part="layer centered-layer center centered chrome"></slot> 319 320 <slot part="bottom chrome"></slot> 321 </span> 322`;const xT=Object.values(w),IT="sm:384 md:576 lg:768 xl:960";function LT(s){wT(s.target,s.contentRect.width)}function wT(s,e){var t;if(!s.isConnected)return;const i=(t=s.getAttribute(Oe.BREAKPOINTS))!=null?t:IT,r=RT(i),n=kT(r,e);let a=!1;if(Object.keys(r).forEach(o=>{if(n.includes(o)){s.hasAttribute(`breakpoint${o}`)||(s.setAttribute(`breakpoint${o}`,""),a=!0);return}s.hasAttribute(`breakpoint${o}`)&&(s.removeAttribute(`breakpoint${o}`),a=!0)}),a){const o=new CustomEvent(fr.BREAKPOINTS_CHANGE,{detail:n});s.dispatchEvent(o)}}function RT(s){const e=s.split(/\s+/);return Object.fromEntries(e.map(t=>t.split(":")))}function kT(s,e){return Object.keys(s).filter(t=>e>=s[t])}class DT extends W.HTMLElement{constructor(){super(),rs(this,gl),rs(this,vl),rs(this,en),rs(this,za),rs(this,dr),rs(this,La,0),rs(this,Mi,void 0),ST(this,"breakpointsComputed",!1),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Bf.content.cloneNode(!0)));const e=a=>{const o=this.media;for(let l of a)l.type==="childList"&&(l.removedNodes.forEach(c=>{if(c.slot=="media"&&l.target==this){let d=l.previousSibling&&l.previousSibling.previousElementSibling;if(!d||!o)this.mediaUnsetCallback(c);else{let u=d.slot!=="media";for(;(d=d.previousSibling)!==null;)d.slot=="media"&&(u=!1);u&&this.mediaUnsetCallback(c)}}}),o&&l.addedNodes.forEach(c=>{c===o&&o!==Ws(this,Mi)&&this.handleMediaUpdated(o).then(d=>this.mediaSetCallback(d))}))};new MutationObserver(e).observe(this,{childList:!0,subtree:!0});let i=!1;Nf(this,a=>{i||(setTimeout(()=>{LT(a),i=!1,this.breakpointsComputed||(this.breakpointsComputed=!0,this.dispatchEvent(new CustomEvent(fr.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))},0),i=!0)});let n=this.querySelector(":scope > slot[slot=media]");n&&n.addEventListener("slotchange",()=>{if(!n.assignedElements({flatten:!0}).length){Ws(this,Mi)&&this.mediaUnsetCallback(Ws(this,Mi));return}this.media&&this.media!==Ws(this,Mi)&&this.handleMediaUpdated(this.media).then(o=>this.mediaSetCallback(o))})}static get observedAttributes(){return[Oe.AUTOHIDE,Oe.GESTURES_DISABLED].concat(xT).filter(e=>![w.MEDIA_RENDITION_LIST,w.MEDIA_AUDIO_TRACK_LIST,w.MEDIA_CHAPTERS_CUES].includes(e))}attributeChangedCallback(e,t,i){e.toLowerCase()==Oe.AUTOHIDE&&(this.autohide=i)}get media(){let e=this.querySelector(":scope > [slot=media]");return(e==null?void 0:e.nodeName)=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){Fo(this,Mi,e);const t=i=>(Fo(this,Mi,null),console.error('Media Chrome: Media element set with slot="media" does not appear to be compatible.',i),Promise.reject(i));return e?(e.localName.includes("-")&&await W.customElements.whenDefined(e.localName),e):t(e)}connectedCallback(){var e;const i=this.getAttribute(Oe.AUDIO)!=null?es.AUDIO_PLAYER():es.VIDEO_PLAYER();this.setAttribute("role","region"),this.setAttribute("aria-label",i),this.media&&this.media!==Ws(this,Mi)&&this.handleMediaUpdated(this.media).then(r=>this.mediaSetCallback(r)),this.setAttribute(Oe.USER_INACTIVE,""),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),(e=W.window)==null||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;this.media&&this.mediaUnsetCallback(this.media),(e=W.window)==null||e.removeEventListener("mouseup",this)}mediaSetCallback(e){}mediaUnsetCallback(e){}handleEvent(e){switch(e.type){case"pointerdown":Fo(this,La,e.timeStamp);break;case"pointermove":ci(this,gl,Ff).call(this,e);break;case"pointerup":ci(this,vl,Uf).call(this,e);break;case"mouseleave":ci(this,en,ja).call(this);break;case"mouseup":this.removeAttribute(Oe.KEYBOARD_CONTROL);break;
322case"keyup":ci(this,dr,tn).call(this),this.setAttribute(Oe.KEYBOARD_CONTROL,"");break}}set autohide(e){e=Number(e),this._autohide=isNaN(e)?0:e}get autohide(){return this._autohide===void 0?2:this._autohide}}La=new WeakMap;Mi=new WeakMap;gl=new WeakSet;Ff=function(s){s.pointerType!=="mouse"&&s.timeStamp-Ws(this,La)<250||(ci(this,za,cc).call(this),clearTimeout(this._inactiveTimeout),[this,this.media].includes(s.target)&&ci(this,dr,tn).call(this))};vl=new WeakSet;Uf=function(s){if(s.pointerType==="touch"){const e=!this.hasAttribute(Oe.USER_INACTIVE);[this,this.media].includes(s.target)&&e?ci(this,en,ja).call(this):ci(this,dr,tn).call(this)}else s.composedPath().some(e=>["media-play-button","media-fullscreen-button"].includes(e==null?void 0:e.localName))&&ci(this,dr,tn).call(this)};en=new WeakSet;ja=function(){if(this.autohide<0||this.hasAttribute(Oe.USER_INACTIVE))return;this.setAttribute(Oe.USER_INACTIVE,"");const s=new W.CustomEvent(fr.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(s)};za=new WeakSet;cc=function(){if(!this.hasAttribute(Oe.USER_INACTIVE))return;this.removeAttribute(Oe.USER_INACTIVE);const s=new W.CustomEvent(fr.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(s)};dr=new WeakSet;tn=function(){ci(this,za,cc).call(this),clearTimeout(this._inactiveTimeout),!(this.autohide<0)&&(this._inactiveTimeout=setTimeout(()=>{ci(this,en,ja).call(this)},this.autohide*1e3))};var $f=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},pt=(s,e,t)=>($f(s,e,"read from private field"),t?t.call(s):e.get(s)),Ar=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},In=(s,e,t,i)=>($f(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),Ks,qs,wa,As,Pi,Wi;class Gf{constructor(e,t,{defaultValue:i}={defaultValue:void 0}){Ar(this,Pi),Ar(this,Ks,void 0),Ar(this,qs,void 0),Ar(this,wa,void 0),Ar(this,As,new Set),In(this,Ks,e),In(this,qs,t),In(this,wa,new Set(i))}[Symbol.iterator](){return pt(this,Pi,Wi).values()}get length(){return pt(this,Pi,Wi).size}get value(){var e;return(e=[...pt(this,Pi,Wi)].join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(In(this,As,new Set),this.add(...(t=e==null?void 0:e.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return[...pt(this,Pi,Wi)][e]}values(){return pt(this,Pi,Wi).values()}forEach(e){pt(this,Pi,Wi).forEach(e)}add(...e){var t,i;e.forEach(r=>pt(this,As).add(r)),!(this.value===""&&!((t=pt(this,Ks))!=null&&t.hasAttribute(`${pt(this,qs)}`)))&&((i=pt(this,Ks))==null||i.setAttribute(`${pt(this,qs)}`,`${this.value}`))}remove(...e){var t;e.forEach(i=>pt(this,As).delete(i)),(t=pt(this,Ks))==null||t.setAttribute(`${pt(this,qs)}`,`${this.value}`)}contains(e){return pt(this,Pi,Wi).has(e)}toggle(e,t){return typeof t<"u"?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){return this.remove(e),this.add(t),e===t}}Ks=new WeakMap;qs=new WeakMap;wa=new WeakMap;As=new WeakMap;Pi=new WeakSet;Wi=function(){return pt(this,As).size?pt(this,As):pt(this,wa)};const CT=(s="")=>s.split(/\s+/),Hf=(s="")=>{let[e,t,i]=s.split(":");
322const r=i?decodeURIComponent(i):void 0;return e=e==="cc"?"captions":"subtitles",{kind:e,language:t,label:r}},Vf=(s="",e={})=>CT(s).map(t=>{const i=Hf(t);return{...e,...i}}),Wf=s=>Array.isArray(s)?s.map(e=>typeof e=="string"?Hf(e):e):typeof s=="string"?Vf(s):[s],MT=({kind:s,label:e,language:t}={kind:"subtitles"})=>e?`${s==="captions"?"cc":"sb"}:${t}:${encodeURIComponent(e)}`:t,El=(s=[])=>Array.prototype.map.call(s,MT).join(" "),PT=(s,e)=>t=>t[s]===e,Kf=s=>{const e=Object.entries(s).map(([t,i])=>PT(t,i));return t=>e.every(i=>i(t))},Sr=(s,e=[],t=[])=>{const i=Wf(t).map(Kf),r=n=>i.some(a=>a(n));Array.from(e).filter(r).forEach(n=>{n.mode=s})},sn=(s,e=()=>!0)=>{if(!(s!=null&&s.textTracks))return[];const t=typeof e=="function"?e:Kf(e);return Array.from(s.textTracks).filter(t)},OT=s=>!!s.getAttribute(w.MEDIA_SUBTITLES_SHOWING),ot={enter:"requestFullscreen",exit:"exitFullscreen",rootEvents:["fullscreenchange"],mediaEvents:[],element:"fullscreenElement",error:"fullscreenerror",enabled:"fullscreenEnabled"};Te.fullscreenElement===void 0&&(ot.enter="webkitRequestFullScreen",ot.exit=Te.webkitExitFullscreen!=null?"webkitExitFullscreen":"webkitCancelFullScreen",ot.rootEvents=["webkitfullscreenchange"],ot.mediaEvents=["webkitbeginfullscreen","webkitendfullscreen"],ot.element="webkitFullscreenElement",ot.error="webkitfullscreenerror",ot.enabled="webkitFullscreenEnabled");let Ln;const dc=()=>{var s,e;return Ln||(Ln=(e=(s=Te)==null?void 0:s.createElement)==null?void 0:e.call(s,"video"),Ln)},NT=async(s=dc())=>{if(!s)return!1;const e=s.volume;return s.volume=e/2+.1,await bf(0),s.volume!==e},FT=/.*Version\/.*Safari\/.*/.test(W.navigator.userAgent),UT=(s=dc())=>W.matchMedia("(display-mode: standalone)").matches&&FT?!1:typeof(s==null?void 0:s.requestPictureInPicture)=="function",BT=(s=dc())=>{let e=Te[ot.enabled];return!e&&s&&(e="webkitSupportsFullscreen"in s),e},qf=BT(),$T=UT(),GT=!!W.WebKitPlaybackTargetAvailabilityEvent,HT=!!W.chrome;let Ra;const VT=NT().then(s=>(Ra=s,Ra)),WT=Object.values(Si),Jn=s=>sn(s.media,e=>[Fi.SUBTITLES,Fi.CAPTIONS].includes(e.kind)).sort((e,t)=>e.kind>=t.kind?1:-1),Yf=s=>sn(s.media,e=>e.mode===Hs.SHOWING&&[Fi.SUBTITLES,Fi.CAPTIONS].includes(e.kind)),Ht={MEDIA_PAUSED:{get:function(s){const{media:e}=s;return e?e.paused:!0},mediaEvents:["play","playing","pause","emptied"]},MEDIA_HAS_PLAYED:{get:function(s){const{media:e}=s;return e?!e.paused:!1},mediaEvents:["playing","emptied"]},MEDIA_ENDED:{get:function(s){const{media:e}=s;return e?e.ended:!1},mediaEvents:["seeked","ended","emptied"]},MEDIA_PLAYBACK_RATE:{get:function(s){const{media:e}=s;return!e||typeof e.playbackRate>"u"?1:e.playbackRate},mediaEvents:["ratechange","loadstart"]},MEDIA_MUTED:{get:function(s){const{media:e}=s;return!e||typeof e.muted>"u"?!1:e.muted},mediaEvents:["volumechange"]},MEDIA_VOLUME:{get:function(s){const{media:e}=s;return!e||typeof e.volume>"u"?1:Number(e.volume)},mediaEvents:["volumechange"]},MEDIA_VOLUME_LEVEL:{get:function(s){const{media:e}=s;let t="high";if(!e||typeof e.volume>"u")return t;const{muted:i,volume:r}=e;return r===0||i?t="off":r<.5?t="low":r<.75&&(t="medium"),t},mediaEvents:["volumechange"]},MEDIA_CURRENT_TIME:{get:function(s){const{media:e}=s;return!e||typeof e.currentTime>"u"?0:e.currentTime},mediaEvents:["playing","pause","timeupdate","loadedmetadata"]},MEDIA_DURATION:{get:function(s){const{media:e}=s;return s.hasAttribute("defaultduration")&&(!e||!e.duration||Number.isNaN(e.duration)||!Number.isFinite(e.duration))?+s.getAttribute("defaultduration"):!e||!Number.isFinite(e.duration)?Number.NaN:e.duration},mediaEvents:["durationchange","loadedmetadata","emptied"]},MEDIA_SEEKABLE:{get:function(s){var e;const{media:t}=s;if(!((e=t==null?void 0:t.seekable)!=null&&e.length))return;const i=t.seekable.start(0),r=t.seekable.end(t.seekable.length-1);if(!(!i&&!r))return[Number(i.toFixed(3)),Number(r.toFixed(3))]},mediaEvents:["loadedmetadata","emptied","progress"]},MEDIA_LOADING:{get:function(s){var e;return((e=s.media)==null?void 0:e.readyState)<3},mediaEvents:["waiting","playing","emptied"]},MEDIA_BUFFERED:{get:function(s){var e,t,i;const r=(e=s.media)==null?void 0:e.buffered;return Array.from((i=(t=s.media)==null?void 0:t.buffered)!=null?i:[]).map((n,a)=>[Number(r.start(a)).toFixed(3),Number(r.end(a)).toFixed(3)])},mediaEvents:["progress","emptied"]},MEDIA_STREAM_TYPE:{get:function(s){const{media:e}=s;if(!e)return;const{streamType:t}=e;if(WT.includes(t)){if(t===Si.UNKNOWN){const r=s.getAttribute("defaultstreamtype");return[Si.LIVE,Si.ON_DEMAND].includes(r)?r:void 0}return t}const i=e.duration;if(i===1/0)return Si.LIVE;if(Number.isFinite(i))return Si.ON_DEMAND;{const r=s.getAttribute("defaultstreamtype");if([Si.LIVE,Si.ON_DEMAND].includes(r))return r}}
322,mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},MEDIA_TARGET_LIVE_WINDOW:{get:function(s){const{media:e}=s;if(!e)return Number.NaN;const{targetLiveWindow:t}=e,i=Ht.MEDIA_STREAM_TYPE.get(s);return(t==null||Number.isNaN(t))&&i===Si.LIVE?0:t},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},MEDIA_TIME_IS_LIVE:{get:function(s){const{media:e}=s;if(!e)return!1;if(typeof e.liveEdgeStart=="number")return Number.isNaN(e.liveEdgeStart)?!1:e.currentTime>=e.liveEdgeStart;if(!(Ht.MEDIA_STREAM_TYPE.get(s)==="live"))return!1;const i=e.seekable;if(!i)return!0;if(!i.length)return!1;const r=s.hasAttribute("liveedgeoffset")?Number(s.getAttribute("liveedgeoffset")):10,n=i.end(i.length-1)-r;return e.currentTime>=n},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},MEDIA_IS_FULLSCREEN:{get:function(s,e){var t,i;const r=s.media;if(r&&Te[ot.element]===void 0&&"webkitDisplayingFullscreen"in r)return r.webkitDisplayingFullscreen&&r.webkitPresentationMode==="fullscreen";let n;return e?n=Te[ot.element]?e.target:null:n=(i=(t=aT(s))==null?void 0:t.fullscreenElement)!=null?i:Te[ot.element],xa(s.fullscreenElement,n)},rootEvents:ot.rootEvents,mediaEvents:ot.mediaEvents},MEDIA_IS_PIP:{get:function(s,e){var t;const i=s.media;if(!i)return!1;if(e)return e.type=="enterpictureinpicture";{const r=(t=s.getRootNode().pictureInPictureElement)!=null?t:Te.pictureInPictureElement;return xa(i,r)}},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},MEDIA_IS_AIRPLAYING:{get:function(s){var e;const{media:t}=s;return!(t!=null&&t.remote)||((e=t.remote)==null?void 0:e.state)==="disconnected"?!1:t.remote.state},remoteEvents:["playing","connect","connecting","disconnect"]},MEDIA_IS_CASTING:{get:function(s){var e;const{media:t}=s;return!(t!=null&&t.remote)||((e=t.remote)==null?void 0:e.state)==="disconnected"?!1:t.remote.state},remoteEvents:["connect","connecting","disconnect"]},MEDIA_AIRPLAY_UNAVAILABLE:{get:function(s,{availability:e=!1}={}){if(!GT)return qt.UNSUPPORTED;if(!(e==null||e===!0))return qt.UNAVAILABLE},mediaSetCallback(s,e){var t;s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(t=s.remote)==null||t.watchAvailability(r=>e({availability:r}))},mediaUnsetCallback(s){var e;s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(e=s.remote)==null||e.cancelWatchAvailability()}},MEDIA_CAST_UNAVAILABLE:{get:function(s,{availability:e=!1}={}){var t;const{media:i}=s;if(!HT||!((t=i==null?void 0:i.remote)!=null&&t.state))return qt.UNSUPPORTED;if(!(e==null||e===!0))return qt.UNAVAILABLE},mediaSetCallback(s,e){var t;s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(t=s.remote)==null||t.watchAvailability(r=>e({availability:r}))},mediaUnsetCallback(s){var e;s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(e=s.remote)==null||e.cancelWatchAvailability()}},MEDIA_FULLSCREEN_UNAVAILABLE:{get:function(){return qf?void 0:qt.UNAVAILABLE}},MEDIA_PIP_UNAVAILABLE:{get:function(){return $T?void 0:qt.UNSUPPORTED}},MEDIA_RENDITION_UNAVAILABLE:{get:function(s){var e;const{media:t}=s;if(!(t!=null&&t.videoRenditions))return qt.UNSUPPORTED;if(!((e=t.videoRenditions)!=null&&e.length))return qt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},MEDIA_AUDIO_TRACK_UNAVAILABLE:{get:function(s){var e,t;const{media:i}=s;if(!(i!=null&&i.audioTracks))return qt.UNSUPPORTED;if(((t=(e=i.audioTracks)==null?void 0:e.length)!=null?t:0)<=1)return qt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},MEDIA_VOLUME_UNAVAILABLE:{get:function(s){if(Ra!==void 0&&!Ra)return qt.UNSUPPORTED;const{media:e}=s;if(e&&typeof e.volume>"u")return qt.UNAVAILABLE},mediaEvents:["loadstart"]},MEDIA_SUBTITLES_LIST:{get:function(s){return Jn(s).map(({kind:e,label:t,language:i})=>({kind:e,label:t,language:i}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},MEDIA_SUBTITLES_SHOWING:{get:function(s,e){var t;
322return s.hasAttribute("defaultsubtitles")&&["addtrack","removetrack"].includes(e==null?void 0:e.type)&&[Fi.CAPTIONS,Fi.SUBTITLES].includes((t=e==null?void 0:e.track)==null?void 0:t.kind)&&ka.MEDIA_TOGGLE_SUBTITLES_REQUEST(void 0,{detail:!0},s),Yf(s).map(({kind:i,label:r,language:n})=>({kind:i,label:r,language:n}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack","change"]},MEDIA_CHAPTERS_CUES:{get:function(s){var e;const{media:t}=s;if(!t)return[];const[i]=sn(t,{kind:Fi.CHAPTERS});return Array.from((e=i==null?void 0:i.cues)!=null?e:[]).map(({text:r,startTime:n,endTime:a})=>({text:r,startTime:n,endTime:a}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},MEDIA_RENDITION_LIST:{get:function(s){var e;const{media:t}=s;return[...(e=t==null?void 0:t.videoRenditions)!=null?e:[]]},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},MEDIA_RENDITION_SELECTED:{get:function(s){var e,t,i;const{media:r}=s;return(i=(t=r==null?void 0:r.videoRenditions)==null?void 0:t[(e=r.videoRenditions)==null?void 0:e.selectedIndex])==null?void 0:i.id},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},MEDIA_AUDIO_TRACK_LIST:{get:function(s){var e;const{media:t}=s;return[...(e=t==null?void 0:t.audioTracks)!=null?e:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},MEDIA_AUDIO_TRACK_ENABLED:{get:function(s){var e,t;const{media:i}=s;return(t=[...(e=i==null?void 0:i.audioTracks)!=null?e:[]].find(r=>r.enabled))==null?void 0:t.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]}},ka={MEDIA_PLAY_REQUEST:(s,e,t)=>{var i;const r=Ht.MEDIA_STREAM_TYPE.get(t),n=t.getAttribute("noautoseektolive")===null;r==Si.LIVE&&n&&ka.MEDIA_SEEK_TO_LIVE_REQUEST(s),(i=s.play())==null||i.catch(()=>{})},MEDIA_PAUSE_REQUEST:s=>s.pause(),MEDIA_MUTE_REQUEST:s=>s.muted=!0,MEDIA_UNMUTE_REQUEST:s=>{s.muted=!1,s.volume===0&&(s.volume=.25)},MEDIA_VOLUME_REQUEST:(s,e,t)=>{const i=e.detail;if(s.volume=i,i>0&&s.muted&&(s.muted=!1),!t.hasAttribute("novolumepref"))try{W.localStorage.setItem("media-chrome-pref-volume",i.toString())}catch{}},MEDIA_ENTER_FULLSCREEN_REQUEST:(s,e,t)=>{if(!qf){console.warn("MediaChrome: Fullscreen support is unavailable; not entering fullscreen");return}Te.pictureInPictureElement&&Te.exitPictureInPicture(),t[ot.enter]?t.fullscreenElement[ot.enter]():s.webkitEnterFullscreen?s.webkitEnterFullscreen():s.requestFullscreen?s.requestFullscreen():console.warn("MediaChrome: Fullscreen not supported")},MEDIA_EXIT_FULLSCREEN_REQUEST:()=>{Te[ot.exit]()},MEDIA_ENTER_PIP_REQUEST:s=>{if(!Te.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!s.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}Te[ot.element]&&Te[ot.exit]();const e=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};s.requestPictureInPicture().catch(t=>{if(t.code===11)if(s.readyState===0&&s.preload==="none"){const i=()=>{s.removeEventListener("loadedmetadata",r),s.preload="none"},r=()=>{s.requestPictureInPicture().catch(e),i()};s.addEventListener("loadedmetadata",r),s.preload="metadata",setTimeout(()=>{s.readyState===0&&e(),i()},1e3)}else throw t;else throw t})},MEDIA_EXIT_PIP_REQUEST:()=>{Te.pictureInPictureElement&&Te.exitPictureInPicture()},MEDIA_ENTER_CAST_REQUEST:async s=>{var e;if(((e=s.remote)==null?void 0:e.state)==="disconnected"){if(Te[ot.element]&&Te[ot.exit](),!s.remote.prompt){console.warn("MediaChrome: Casting is not supported in this environment");return}try{await s.remote.prompt()}catch{}}},MEDIA_EXIT_CAST_REQUEST:s=>{var e;((e=s.remote)==null?void 0:e.state)==="connected"&&s.remote.prompt()},MEDIA_SEEK_REQUEST:(s,e)=>{const t=e.detail;(s.readyState>0||s.readyState===void 0)&&(s.currentTime=t)},MEDIA_PLAYBACK_RATE_REQUEST:(s,e)=>{s.playbackRate=e.detail},MEDIA_PREVIEW_REQUEST:(s,e,t)=>{var i,r,n,a,o,l;if(!s)return;const c=e.detail;if(c===null){t.propagateMediaState(w.MEDIA_PREVIEW_TIME,void 0),t.propagateMediaState(w.MEDIA_PREVIEW_IMAGE,void 0),t.propagateMediaState(w.MEDIA_PREVIEW_COORDS,void 0);return}t.propagateMediaState(w.MEDIA_PREVIEW_TIME,c);const[d]=sn(s,{kind:Fi.CHAPTERS}),u=Array.from((i=d==null?void 0:d.cues)!=null?i:[]).find(A=>A.startTime<=c&&A.endTime>c);t.propagateMediaState(w.MEDIA_PREVIEW_CHAPTER,u==null?void 0:u.text);const[h]=sn(s,{kind:Fi.METADATA,label:"thumbnails"}),f=Array.from((r=h==null?void 0:h.cues)!=null?r:[]).find(A=>A.startTime>=c);if(!f)return;const p=/'^(?:[a-z]+:)?\/\//i.test((n=f==null?void 0:f.text)!=null?n:"")||(a=s.querySelector('track[label="thumbnails"]'))==null?void 0:a.src,y=new URL((o=f==null?void 0:f.text)!=null?o:"./",p),_=(l=new
322URLSearchParams(y.hash).get("#xywh"))!=null?l:"";t.propagateMediaState(w.MEDIA_PREVIEW_IMAGE,y.href),t.propagateMediaState(w.MEDIA_PREVIEW_COORDS,_.split(","))},MEDIA_SHOW_SUBTITLES_REQUEST:(s,e,t)=>{var i;const r=Jn(t),{detail:n=[]}=e,a=Wf(n),o=(i=a[0])==null?void 0:i.language;o&&!(t!=null&&t.hasAttribute("nosubtitleslangpref"))&&W.localStorage.setItem("media-chrome-pref-subtitles-lang",o),Sr(Hs.SHOWING,r,a)},MEDIA_DISABLE_SUBTITLES_REQUEST:(s,e,t)=>{const i=Jn(t),{detail:r=[]}=e;Sr(Hs.DISABLED,i,r)},MEDIA_TOGGLE_SUBTITLES_REQUEST:(s,e,t)=>{const{detail:i}=e??{},r=Jn(t),n=Yf(t),a=!!n.length;if(r.length){if(i===!1||a&&i!==!0)Sr(Hs.DISABLED,r,n);else if(i===!0||!a&&i!==!1){let o=r[0];if(!(t!=null&&t.hasAttribute("nosubtitleslangpref"))){const u=W.localStorage.getItem("media-chrome-pref-subtitles-lang"),h=u?[u,...W.navigator.languages]:W.navigator.languages,f=r.filter(p=>h.some(y=>p.language.toLowerCase().startsWith(y.split("-")[0]))).sort((p,y)=>{const _=h.findIndex(x=>p.language.toLowerCase().startsWith(x.split("-")[0])),A=h.findIndex(x=>y.language.toLowerCase().startsWith(x.split("-")[0]));return _-A});f[0]&&(o=f[0])}const{language:l,label:c,kind:d}=o;Sr(Hs.DISABLED,r,n),Sr(Hs.SHOWING,r,[{language:l,label:c,kind:d}])}}},MEDIA_AIRPLAY_REQUEST:async s=>{if(s!=null&&s.remote){if(!s.remote.prompt){console.warn("MediaChrome: AirPlay is not supported in this environment");return}try{await s.remote.prompt()}catch{}}},MEDIA_SEEK_TO_LIVE_REQUEST:s=>{const e=s.seekable;if(!e){console.warn("MediaChrome: Media element does not support seeking to live.");return}if(!e.length){console.warn("MediaChrome: Media is unable to seek to live.");return}s.currentTime=e.end(e.length-1)},MEDIA_RENDITION_REQUEST:(s,e)=>{if(!(s!=null&&s.videoRenditions)){console.warn("MediaChrome: Rendition selection not supported by this media.");return}const t=e.detail,i=[...s.videoRenditions].findIndex(r=>
322r.id==t);s.videoRenditions.selectedIndex!=i&&(s.videoRenditions.selectedIndex=i)},MEDIA_AUDIO_TRACK_REQUEST:(s,e)=>{if(!(s!=null&&s.audioTracks)){console.warn("MediaChrome: Audio track selection not supported by this media.");return}const t=e.detail;for(let i of s.audioTracks)i.enabled=t==i.id}};var uc=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},xi=(s,e,t)=>(uc(s,e,"read from private field"),t?t.call(s):e.get(s)),xr=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},Uo=(s,e,t,i)=>(uc(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),lr=(s,e,t)=>(uc(s,e,"access private method"),t),Qi,Br,Ys,ur,rn,ea,yl;const jf=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],KT=10,fu=0,Ct={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",DEFAULT_DURATION:"defaultduration",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYS_USED:"keysused",LIVE_EDGE_OFFSET:"liveedgeoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_HOTKEYS:"nohotkeys"};class qT extends DT{constructor(){super(),xr(this,ur),xr(this,ea),xr(this,Qi,new Gf(this,Ct.HOTKEYS)),xr(this,Br,void 0),xr(this,Ys,void 0),Ht.MEDIA_VOLUME_UNAVAILABLE.get(this)===void 0&&VT.then(()=>{this.propagateMediaState(w.MEDIA_VOLUME_UNAVAILABLE,Ht.MEDIA_VOLUME_UNAVAILABLE.get(this))}),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,this.associateElement(this),Object.keys(ka).forEach(e=>{const t=`_handle${Oo(e,!0)}`;this[t]=i=>{if(i.stopPropagation(),!this.media){console.warn("MediaController: No media available.");return}ka[e](this.media,i,this)},this.addEventListener(be[e],this[t])}),this._mediaStatePropagators={},Object.keys(Ht).forEach(e=>{this._mediaStatePropagators[e]=t=>{this.propagateMediaState(nr[e],Ht[e].get(this,t))}})}static get observedAttributes(){return super.observedAttributes.concat(Ct.NO_HOTKEYS,Ct.HOTKEYS,Ct.DEFAULT_STREAM_TYPE,Ct.DEFAULT_SUBTITLES,Ct.DEFAULT_DURATION)}get fullscreenElement(){var e;return(e=xi(this,Br))!=null?e:this}set fullscreenElement(e){this.hasAttribute(Ct.FULLSCREEN_ELEMENT)&&this.removeAttribute(Ct.FULLSCREEN_ELEMENT),Uo(this,Br,e)}attributeChangedCallback(e,t,i){var r;if(super.attributeChangedCallback(e,t,i),e===Ct.NO_HOTKEYS)i!==t&&i===""?(this.hasAttribute(Ct.HOTKEYS)&&console.warn("Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):i!==t&&i===null&&this.enableHotkeys();else if(e===Ct.HOTKEYS)xi(this,Qi).value=i;else if(e===Ct.DEFAULT_SUBTITLES&&i!==t&&i==="")this.dispatchEvent(new W.CustomEvent(be.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:!0}));else if(e===Ct.DEFAULT_STREAM_TYPE)this.propagateMediaState(nr.MEDIA_STREAM_TYPE);else if(e===Ct.FULLSCREEN_ELEMENT){const n=i?(r=xi(this,Ys))==null?void 0:r.getElementById(i):void 0;Uo(this,Br,n)}}connectedCallback(){super.connectedCallback(),Uo(this,Ys,this.getRootNode()),this.enableHotkeys()}disconnectedCallback(){super.disconnectedCallback(),this.disableHotkeys(),this.dispatchEvent(new W.CustomEvent(be.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:!1}))}mediaSetCallback(e){if(super.mediaSetCallback(e),e.hasAttribute("tabindex")||(e.tabIndex=-1),Object.keys(Ht).forEach(t=>{const{mediaSetCallback:i,mediaEvents:r,rootEvents:n,textTracksEvents:a,videoRenditionsEvents:o,audioTracksEvents:l,remoteEvents:c}=Ht[t],d=this._mediaStatePropagators[t];i&&(i(e,d),d()),r==null||r.forEach(u=>{e.addEventListener(u,d),d()}),n==null||n.forEach(u=>{var h;(h=xi(this,Ys))==null||h.addEventListener(u,d),d()}),a==null||a.forEach(u=>{var h;(h=e.textTracks)==null||h.addEventListener(u,d),d()}),o==null||o.forEach(u=>{var h;(h=e.videoRenditions)==null||h.addEventListener(u,d),d()}),l==null||l.forEach(u=>{var h;(h=e.audioTracks)==null||h.addEventListener(u,d),d()}),c==null||c.forEach(u=>{var h;(h=e.remote)==null||h.addEventListener(u,d),d()})}),!this.hasAttribute("novolumepref"))try{const t=W.localStorage.getItem("media-chrome-pref-volume");t!==null&&(e.volume=t)}catch(t){console.debug("Error getting volume pref",t)}}mediaUnsetCallback(e){super.mediaUnsetCallback(e),Object.keys(Ht).forEach(t=>{const{mediaUnsetCallback:i,mediaEvents:r,rootEvents:n,textTracksEvents:a,videoRenditionsEvents:o,audioTracksEvents:l,remoteEvents:c}=Ht[t],d=this._mediaStatePropagators[t];r==null||r.forEach(u=>{e.removeEventListener(u,d)}
322),n==null||n.forEach(u=>{var h;(h=xi(this,Ys))==null||h.removeEventListener(u,d)}),a==null||a.forEach(u=>{var h;(h=e.textTracks)==null||h.removeEventListener(u,d)}),o==null||o.forEach(u=>{var h;(h=e.videoRenditions)==null||h.removeEventListener(u,d),d()}),l==null||l.forEach(u=>{var h;(h=e.audioTracks)==null||h.removeEventListener(u,d),d()}),c==null||c.forEach(u=>{var h;(h=e.remote)==null||h.removeEventListener(u,d),d()}),i&&(i(e,d),d())}),this.propagateMediaState(nr.MEDIA_PAUSED,!0)}propagateMediaState(e,t){const i=vu(this.mediaStateReceivers,e);if(gu(this.mediaStateReceivers,e,t),i===vu(this.mediaStateReceivers,e))return;const r=e.toLowerCase(),n=new W.CustomEvent(Z_[r],{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(n)}associateElement(e){if(!e)return;const{associatedElementSubscriptions:t}=this;if(t.has(e))return;const i=this.registerMediaStateReceiver.bind(this),r=this.unregisterMediaStateReceiver.bind(this),n=ZT(e,i,r);Object.keys(be).forEach(a=>{e.addEventListener(be[a],this[`_handle${Oo(a,!0)}`])}),t.set(e,n)}unassociateElement(e){if(!e)return;const{associatedElementSubscriptions:t}=this;if(!t.has(e))return;t.get(e)(),t.delete(e),Object.keys(be).forEach(r=>{e.removeEventListener(be[r],this[`_handle${Oo(r,!0)}`])})}registerMediaStateReceiver(e){if(!e)return;const t=this.mediaStateReceivers;t.indexOf(e)>-1||(t.push(e),Object.keys(Ht).forEach(r=>{const n=Ht[r];gu([e],nr[r],n.get(this))}))}unregisterMediaStateReceiver(e){const t=this.mediaStateReceivers,i=t.indexOf(e);i<0||t.splice(i,1)}enableHotkeys(){this.addEventListener("keydown",lr(this,ea,yl))}disableHotkeys(){this.removeEventListener("keydown",lr(this,ea,yl)),this.removeEventListener("keyup",lr(this,ur,rn))}get hotkeys(){return xi(this,Qi)}keyboardShortcutHandler(e){var t,i,r,n;if(((n=(r=(t=e.target.getAttribute(Ct.KEYS_USED))==null?void 0:t.split(" "))!=null?r:(i=e.target)==null?void 0:i.keysUsed)!=null?n:[]).map(f=>f==="Space"?" ":f).filter(Boolean).includes(e.key))return;let o,l,c,d,u;const h=KT;if(!xi(this,Qi).contains(`no${e.key.toLowerCase()}`)&&!(e.key===" "&&xi(this,Qi).contains("nospace")))switch(e.key){case" ":case"k":o=this.getAttribute(w.MEDIA_PAUSED)!=null?be.MEDIA_PLAY_REQUEST:be.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new W.CustomEvent(o,{composed:!0,bubbles:!0}));break;case"m":o=this.getAttribute(w.MEDIA_VOLUME_LEVEL)==="off"?be.MEDIA_UNMUTE_REQUEST:be.MEDIA_MUTE_REQUEST,this.dispatchEvent(new W.CustomEvent(o,{composed:!0,bubbles:!0}));break;case"f":o=this.getAttribute(w.MEDIA_IS_FULLSCREEN)!=null?be.MEDIA_EXIT_FULLSCREEN_REQUEST:be.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new W.CustomEvent(o,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new W.CustomEvent(be.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":l=this.getAttribute(w.MEDIA_CURRENT_TIME),c=l&&!Number.isNaN(+l)?+l:fu,d=Math.max(c-h,0),u=new W.CustomEvent(be.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:d}),this.dispatchEvent(u);break;case"ArrowRight":l=this.getAttribute(w.MEDIA_CURRENT_TIME),c=l&&!Number.isNaN(+l)?+l:fu,d=Math.max(c+h,0),u=new W.CustomEvent(be.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:d}),this.dispatchEvent(u);break}}}Qi=new WeakMap;Br=new WeakMap;Ys=new WeakMap;ur=new WeakSet;rn=function(s){const{key:e}=s;if(!jf.includes(e)){this.removeEventListener("keyup",lr(this,ur,rn));return}this.keyboardShortcutHandler(s)};ea=new WeakSet;yl=function(s){const{metaKey:e,altKey:t,key:i}=s;if(e||t||!jf.includes(i)){this.removeEventListener("keyup",lr(this,ur,rn));return}[" ","ArrowLeft","ArrowRight"].includes(i)&&!(xi(this,Qi).contains(`no${i.toLowerCase()}`)||i===" "&&xi(this,Qi).contains("nospace"))&&s.preventDefault(),this.addEventListener("keyup",lr(this,ur,rn),{once:!0})};const YT=Object.values(w),jT=Object.values(nr),hc=s=>{var e,t,i,r;let{observedAttributes:n}=s.constructor;!n&&((e=s.nodeName)!=null&&e.includes("-"))&&(W.customElements.upgrade(s),{observedAttributes:n}=s.constructor);const a=(r=(i=(t=s==null?void 0:s.getAttribute)==null?void 0:t.call(s,je.MEDIA_CHROME_ATTRIBUTES))==null?void 0:i.split)==null?void 0:r.call(i,/\s+/);return Array.isArray(n||a)?(n||a).filter(o=>YT.includes(o)):[]},zT=s=>{var e,t;return(e=s.nodeName)!=null&&e.includes("-")&&W.customElements.get((t=s.nodeName)==null?void 0:t.toLowerCase())&&!(s instanceof W.customElements.get(s.nodeName.toLowerCase()))&&W.customElements.upgrade(s),jT.some(i=>i in s)},_l=s=>zT(s)||!!hc(s).length,mu=s=>{var e;return(e=s==null?void 0:s.join)==null?void 0:e.call(s,":")},pu={[w.MEDIA_SUBTITLES_LIST]:El,[w.MEDIA_SUBTITLES_SHOWING]:El,[w.MEDIA_SEEKABLE]:mu,[w.MEDIA_BUFFERED]:s=>s==null?void 0:s.map(mu).join(" "),[w.MEDIA_PREVIEW_COORDS]:s=>s==null?void 0:s.join(" "),[w.MEDIA_RENDITION_LIST]:J_,[w.MEDIA_AUDIO_TRACK_LIST]:tT},XT=async(s,e,t)=>{var i,r;if(s.isConnected||await bf(0),typeof t=="boolean"||t==null)return _t(s,e,t);if(typeof t=="number")return Mt(s,e,t);if(typeof t=="string")return ti(s,e,t);if(Array.isArray(t)&&!t.length)return s.removeAttribute(e);
322const n=(r=(i=pu[e])==null?void 0:i.call(pu,t))!=null?r:t;return s.setAttribute(e,n)},QT=s=>{var e;return!!((e=s.closest)!=null&&e.call(s,'*[slot="media"]'))},ys=(s,e)=>{if(QT(s))return;const t=(r,n)=>{var a,o;_l(r)&&n(r);const{children:l=[]}=r??{},c=(o=(a=r==null?void 0:r.shadowRoot)==null?void 0:a.children)!=null?o:[];[...l,...c].forEach(u=>ys(u,n))},i=s==null?void 0:s.nodeName.toLowerCase();if(i.includes("-")&&!_l(s)){W.customElements.whenDefined(i).then(()=>{t(s,e)});return}t(s,e)},gu=(s,e,t)=>{s.forEach(i=>{if(e in i){i[e]=t;return}const r=hc(i),n=e.toLowerCase();r.includes(n)&&XT(i,n,t)})},vu=(s,e)=>{for(const t of s){if(e in t)return t[e];const i=hc(t),r=e.toLowerCase();if(i.includes(r))return t.getAttribute(r)}},ZT=(s,e,t)=>{ys(s,e);const i=d=>{var u;const h=(u=d==null?void 0:d.composedPath()[0])!=null?u:d.target;e(h)},r=d=>{var u;const h=(u=d==null?void 0:d.composedPath()[0])!=null?u:d.target;t(h)};s.addEventListener(be.REGISTER_MEDIA_STATE_RECEIVER,i),s.addEventListener(be.UNREGISTER_MEDIA_STATE_RECEIVER,r);const n=d=>{d.forEach(u=>{const{addedNodes:h=[],removedNodes:f=[],type:p,target:y,attributeName:_}=u;p==="childList"?(Array.prototype.forEach.call(h,A=>ys(A,e)),Array.prototype.forEach.call(f,A=>ys(A,t))):p==="attributes"&&_===je.MEDIA_CHROME_ATTRIBUTES&&(_l(y)?e(y):t(y))})};let a=[];const o=d=>{const u=d.target;u.name!=="media"&&(a.forEach(h=>ys(h,t)),a=[...u.assignedElements({flatten:!0})],a.forEach(h=>ys(h,e)))};s.addEventListener("slotchange",o);const l=new MutationObserver(n);return l.observe(s,{childList:!0,attributes:!0,subtree:!0}),()=>{ys(s,t),s.removeEventListener("slotchange",o),l.disconnect(),s.removeEventListener(be.REGISTER_MEDIA_STATE_RECEIVER,i),s.removeEventListener(be.UNREGISTER_MEDIA_STATE_RECEIVER,r)}};W.customElements.get("media-controller")||W.customElements.define("media-controller",qT);var fc=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Qe=(s,e,t)=>(fc(s,e,"read from private field"),t?t.call(s):e.get(s)),bt=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},Ki=(s,e,t,i)=>(fc(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),ri=(s,e,t)=>(fc(s,e,"access private method"),t),Ei,Xa,ta,ia,ni,Da,sa,ra,na,mc,zf,aa,Tl,oa,bl,Ca,pc,Al,Xf,Sl,Qf,xl,Zf,Il,Jf;const em=Te.createElement("template");em.innerHTML=` 323 <style> 324 :host { 325 --_focus-box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9)); 326 --_media-range-padding: var(--media-range-padding, var(--media-control-padding, 10px)); 327 328 box-shadow: var(--_focus-visible-box-shadow, none); 329 background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 330 height: calc(var(--media-control-height, 24px) + 2 * var(--_media-range-padding)); 331 display: inline-flex; 332 align-items: center; 333 334 vertical-align: middle; 335 box-sizing: border-box; 336 position: relative; 337 width: 100px; 338 transition: background .15s linear; 339 cursor: pointer; 340 pointer-events: auto; 341 touch-action: none; 342 z-index: 1; 343 } 344 345 346 input[type=range]:focus { 347 outline: 0; 348 } 349 input[type=range]:focus::-webkit-slider-runnable-track { 350 outline: 0; 351 } 352 353 :host(:hover) { 354 background: var(--media-control-hover-background, rgb(50 50 70 / .7)); 355 } 356 357 #leftgap { 358 padding-left: var(--media-range-padding-left, var(--_media-range-padding)); 359 } 360 361 #rightgap { 362 padding-right: var(--media-range-padding-right, var(--_media-range-padding)); 363 } 364 365 #startpoint, 366 #endpoint { 367 position: absolute; 368 } 369 370 #endpoint { 371 right: 0; 372 } 373 374 #container { 375 376 width: var(--media-range-track-width, 100%); 377 transform: translate(var(--media-range-track-translate-x, 0px), var(--media-range-track-translate-y, 0px)); 378 position: relative; 379 height: 100%; 380 display: flex; 381 align-items: center; 382 min-width: 40px; 383 } 384 385 #range { 386 387 display: var(--media-time-range-hover-display, block); 388 bottom: var(--media-time-range-hover-bottom, -7px); 389 height: var(--media-time-range-hover-height, max(100% + 7px, 25px)); 390 width: 100%; 391 position: absolute; 392 cursor: pointer; 393 394 -webkit-appearance: none; 395 -webkit-tap-highlight-color: transparent; 396 background: transparent; 397 margin: 0; 398 z-index: 1; 399 } 400 401 @media (hover: hover) { 402 #range { 403 bottom: var(--media-time-range-hover-bottom, -5px); 404 height: var(--media-time-range-hover-height, max(100% + 5px, 20px)); 405 } 406 } 407 408 409 410 #range::-webkit-slider-thumb { 411 -webkit-appearance: none; 412 background: transparent; 413 width: .1px; 414 height: .1px; 415 } 416 417 418 #range::-moz-range-thumb { 419 background: transparent; 420 border: transparent; 421 width: .1px; 422 height: .1px; 423 } 424 425 #appearance { 426 height: var(--media-range-track-height, 4px); 427 display: flex; 428 flex-direction: column; 429 justify-content: center; 430 width: 100%; 431 position: absolute; 432 433 will-change: transform; 434 } 435 436 #background, 437 #track { 438 border-radius: var(--media-range-track-border-radius, 1px); 439 position: absolute; 440 width: 100%; 441 height: 100%; 442 } 443 444 #background { 445 background: var(--media-range-track-background, rgb(255 255 255 / .2)); 446 backdrop-filter: var(--media-range-track-background-backdrop-filter); 447 -webkit-backdrop-filter: var(--media-range-track-background-backdrop-filter); 448 } 449 450 #track { 451 border: var(--media-range-track-border, none); 452 outline: var(--media-range-track-outline); 453 outline-offset: var(--media-range-track-outline-offset); 454 backdrop-filter: var(--media-range-track-backdrop-filter); 455 -webkit-backdrop-filter: var(--media-range-track-backdrop-filter);
456 box-shadow: var(--media-range-track-box-shadow, none); 457 overflow: hidden; 458 } 459 460 #progress, 461 #highlight, 462 #pointer { 463 position: absolute; 464 height: 100%; 465 will-change: width; 466 } 467 468 #progress { 469 background: var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238))); 470 transition: var(--media-range-track-transition); 471 } 472 473 #pointer { 474 background: var(--media-range-track-pointer-background); 475 border-right: var(--media-range-track-pointer-border-right); 476 transition: visibility .25s, opacity .25s; 477 visibility: hidden; 478 opacity: 0; 479 } 480 481 @media (hover: hover) { 482 :host(:hover) #pointer { 483 transition: visibility .5s, opacity .5s; 484 visibility: visible; 485 opacity: 1; 486 } 487 } 488 489 #thumb { 490 width: var(--media-range-thumb-width, 10px); 491 height: var(--media-range-thumb-height, 10px); 492 margin-left: calc(var(--media-range-thumb-width, 10px) / -2); 493 border: var(--media-range-thumb-border, none); 494 border-radius: var(--media-range-thumb-border-radius, 10px); 495 background: var(--media-range-thumb-background, var(--media-primary-color, rgb(238 238 238))); 496 box-shadow: var(--media-range-thumb-box-shadow, 1px 1px 1px transparent); 497 transition: var(--media-range-thumb-transition); 498 transform: var(--media-range-thumb-transform, none); 499 opacity: var(--media-range-thumb-opacity, 1); 500 position: absolute; 501 left: 0; 502 cursor: pointer; 503 } 504 505 :host([disabled]) #thumb { 506 background-color: #777; 507 } 508 509 .segments #appearance { 510 height: var(--media-range-segment-hover-height, 7px); 511 } 512 513 #background, 514 #track { 515 clip-path: url(#segments-clipping); 516 } 517 518 #segments { 519 --segments-gap: var(--media-range-segments-gap, 2px); 520 position: absolute; 521 width: 100%; 522 height: 100%; 523 } 524 525 #segments-clipping { 526 transform: translateX(calc(var(--segments-gap) / 2)); 527 } 528 529 #segments-clipping:empty { 530 display: none; 531 } 532 533 #segments-clipping rect { 534 height: var(--media-range-track-height, 4px); 535 y: calc((var(--media-range-segment-hover-height, 7px) - var(--media-range-track-height, 4px)) / 2); 536 transition: var(--media-range-segment-transition, transform .1s ease-in-out); 537 transform: var(--media-range-segment-transform, scaleY(1)); 538 transform-origin: center; 539 } 540 </style> 541 <div id="leftgap"></div> 542 <div id="container"> 543 <div id="startpoint"></div> 544 <div id="endpoint"></div> 545 <div id="appearance" part="appearance"> 546 <div id="background"></div> 547 <div id="track"> 548 <div id="highlight"></div> 549 <div id="pointer"></div> 550 <div id="progress"></div> 551 </div> 552 <div id="thumb"></div> 553 <svg id="segments"><clipPath id="segments-clipping"></clipPath></svg> 554 </div>
555 <input id="range" type="range" min="0" max="1" step="any" value="0"> 556 </div> 557 <div id="rightgap"></div> 558`;class gc extends W.HTMLElement{constructor(){super(),bt(this,mc),bt(this,aa),bt(this,oa),bt(this,Ca),bt(this,Al),bt(this,Sl),bt(this,xl),bt(this,Il),bt(this,Ei,void 0),bt(this,Xa,void 0),bt(this,ta,void 0),bt(this,ia,void 0),bt(this,ni,{}),bt(this,Da,[]),bt(this,sa,()=>{if(this.range.matches(":focus-visible")){const{style:e}=Rt(this.shadowRoot,":host");e.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}}),bt(this,ra,()=>{const{style:e}=Rt(this.shadowRoot,":host");e.removeProperty("--_focus-visible-box-shadow")}),bt(this,na,()=>{const e=this.shadowRoot.querySelector("#segments-clipping");e&&e.parentNode.append(e)}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(em.content.cloneNode(!0))),this.container=this.shadowRoot.querySelector("#container"),Ki(this,ta,this.shadowRoot.querySelector("#startpoint")),Ki(this,ia,this.shadowRoot.querySelector("#endpoint")),this.range=this.shadowRoot.querySelector("#range"),this.appearance=this.shadowRoot.querySelector("#appearance")}static get observedAttributes(){return["disabled","aria-disabled",je.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,i){var r,n,a,o,l;e===je.MEDIA_CONTROLLER?(t&&((n=(r=Qe(this,Ei))==null?void 0:r.unassociateElement)==null||n.call(r,this),Ki(this,Ei,null)),i&&this.isConnected&&(Ki(this,Ei,(a=this.getRootNode())==null?void 0:a.getElementById(i)),(l=(o=Qe(this,Ei))==null?void 0:o.associateElement)==null||l.call(o,this))):(e==="disabled"||e==="aria-disabled"&&t!==i)&&(i==null?(this.range.removeAttribute(e),ri(this,aa,Tl).call(this)):(this.range.setAttribute(e,i),ri(this,oa,bl).call(this)))}connectedCallback(){var e,t,i;const{style:r}=Rt(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),Qe(this,ni).pointer=Rt(this.shadowRoot,"#pointer"),Qe(this,ni).progress=Rt(this.shadowRoot,"#progress"),Qe(this,ni).thumb=Rt(this.shadowRoot,"#thumb");const n=this.getAttribute(je.MEDIA_CONTROLLER);n&&(Ki(this,Ei,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(i=(t=Qe(this,Ei))==null?void 0:t.associateElement)==null||i.call(t,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",Qe(this,sa)),this.shadowRoot.addEventListener("focusout",Qe(this,ra)),ri(this,aa,Tl).call(this),Nf(this.container,Qe(this,na))}disconnectedCallback(){var e,t;ri(this,oa,bl).call(this),(t=(e=Qe(this,Ei))==null?void 0:e.unassociateElement)==null||t.call(e,this),Ki(this,Ei,null),this.shadowRoot.removeEventListener("focusin",Qe(this,sa)),this.shadowRoot.removeEventListener("focusout",Qe(this,ra)),TT(this.container,Qe(this,na))}updatePointerBar(e){Qe(this,ni).pointer.style.setProperty("width",`${this.getPointerRatio(e)*100}%`)}updateBar(){const e=this.range.valueAsNumber*100;Qe(this,ni).progress.style.setProperty("width",`${e}%`),Qe(this,ni).thumb.style.setProperty("left",`${e}%`)}updateSegments(e){const t=this.shadowRoot.querySelector("#segments-clipping");if(t.textContent="",!(e!=null&&e.length))return;Qe(this,ni).activeSegment=xf(this.shadowRoot,"#segments-clipping rect:nth-child(0)"),this.container.classList.toggle("segments",!!e.length);const i=[...new Set([+this.range.min,...e.flatMap(n=>[n.start,n.end]),+this.range.max])];Ki(this,Da,[...i]);const r=i.pop();for(const[n,a]of i.entries()){const[o,l]=[n===0,n===i.length-1],c=o?"calc(var(--segments-gap) / -1)":`${a*100}%`,u=`calc(${((l?r:i[n+1])-a)*100}%${o||l?"":" - var(--segments-gap)"})`,h=Te.createElementNS("http://www.w3.org/2000/svg","rect"),f=Rt(this.shadowRoot,`#segments-clipping rect:nth-child(${n+1})`);f.style.setProperty("x",c),f.style.setProperty("width",u),t.append(h)}}getPointerRatio(e){let t=lT(e.clientX,e.clientY,Qe(this,ta).getBoundingClientRect(),Qe(this,ia).getBoundingClientRect());return Math.max(0,Math.min(1,t))}get dragging(){return this.hasAttribute("dragging")}handleEvent(e){switch(e.type){case"pointermove":ri(this,Il,Jf).call(this,e);break;case"input":this.updateBar();break;case"pointerenter":ri(this,Al,Xf).call(this,e);break;case"pointerdown":ri(this,Ca,pc).call(this,e);break;case"pointerup":ri(this,Sl,Qf).call(this);break;case"pointerleave":ri(this,xl,Zf).call(this);break}}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}}Ei=new WeakMap;Xa=new WeakMap;ta=new WeakMap;
558ia=new WeakMap;ni=new WeakMap;Da=new WeakMap;sa=new WeakMap;ra=new WeakMap;na=new WeakMap;mc=new WeakSet;zf=function(s){const e=Qe(this,ni).activeSegment;if(!e)return;const t=this.getPointerRatio(s),r=`#segments-clipping rect:nth-child(${Qe(this,Da).findIndex((n,a,o)=>{const l=o[a+1];return l!=null&&t>=n&&t<=l})+1})`;(e.selectorText!=r||!e.style.transform)&&(e.selectorText=r,e.style.setProperty("transform","var(--media-range-segment-hover-transform, scaleY(2))"))};aa=new WeakSet;Tl=function(){this.hasAttribute("disabled")||(this.addEventListener("input",this),this.addEventListener("pointerdown",this),this.addEventListener("pointerenter",this))};oa=new WeakSet;bl=function(){var s,e;this.removeEventListener("input",this),this.removeEventListener("pointerdown",this),this.removeEventListener("pointerenter",this),(s=W.window)==null||s.removeEventListener("pointerup",this),(e=W.window)==null||e.removeEventListener("pointermove",this)};Ca=new WeakSet;pc=function(s){var e;Ki(this,Xa,s.composedPath().includes(this.range)),(e=W.window)==null||e.addEventListener("pointerup",this)};Al=new WeakSet;Xf=function(s){var e;s.pointerType!=="mouse"&&ri(this,Ca,pc).call(this,s),this.addEventListener("pointerleave",this),(e=W.window)==null||e.addEventListener("pointermove",this)};Sl=new WeakSet;Qf=function(){var s;(s=W.window)==null||s.removeEventListener("pointerup",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled")};xl=new WeakSet;Zf=function(){var s,e;this.removeEventListener("pointerleave",this),(s=W.window)==null||s.removeEventListener("pointermove",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled"),(e=Qe(this,ni).activeSegment)==null||e.style.removeProperty("transform")};Il=new WeakSet;Jf=function(s){this.toggleAttribute("dragging",s.buttons===1||s.pointerType!=="mouse"),this.updatePointerBar(s),ri(this,mc,zf).call(this,s),this.dragging&&(s.pointerType!=="mouse"||!Qe(this,Xa))&&(this.range.disabled=!0,this.range.valueAsNumber=this.getPointerRatio(s),this.range.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})))};W.customElements.get("media-chrome-range")||W.customElements.define("media-chrome-range",gc);var tm=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},wn=(s,e,t)=>(tm(s,e,"read from private field"),t?t.call(s):e.get(s)),JT=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},Rn=(s,e,t,i)=>(tm(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),yi;const im=Te.createElement("template");im.innerHTML=` 559 <style> 560 :host { 561 562 box-sizing: border-box; 563 display: var(--media-control-display, var(--media-control-bar-display, inline-flex)); 564 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 565 --media-loading-indicator-icon-height: 44px; 566 } 567 568 ::slotted(media-time-range), 569 ::slotted(media-volume-range) { 570 min-height: 100%; 571 } 572 573 ::slotted(media-time-range), 574 ::slotted(media-clip-selector) { 575 flex-grow: 1; 576 } 577 </style> 578 579 <slot></slot> 580`;class eb extends W.HTMLElement{constructor(){super(),JT(this,yi,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(im.content.cloneNode(!0)))}static get observedAttributes(){return[je.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,i){var r,n,a,o,l;e===je.MEDIA_CONTROLLER&&(t&&((n=(r=wn(this,yi))==null?void 0:r.unassociateElement)==null||n.call(r,this),Rn(this,yi,null)),i&&this.isConnected&&(Rn(this,yi,(a=this.getRootNode())==null?void 0:a.getElementById(i)),(l=(o=wn(this,yi))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,i;const r=this.getAttribute(je.MEDIA_CONTROLLER);r&&(Rn(this,yi,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(i=(t=wn(this,yi))==null?void 0:t.associateElement)==null||i.call(t,this))}disconnectedCallback(){var e,t;(t=(e=wn(this,yi))==null?void 0:e.unassociateElement)==null||t.call(e,this),Rn(this,yi,null)}}yi=new WeakMap;W.customElements.get("media-control-bar")||W.customElements.define("media-control-bar",eb);var sm=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},kn=(s,e,t)=>(sm(s,e,"read from private field"),t?t.call(s):e.get(s)),tb=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},Dn=(s,e,t,i)=>(sm(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),_i;const rm=Te.createElement("template");rm.innerHTML=` 581 <style> 582 :host { 583 font: var(--media-font, 584 var(--media-font-weight, normal) 585 var(--media-font-size, 14px) / 586 var(--media-text-content-height, var(--media-control-height, 24px)) 587 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 588 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 589 background: var(--media-text-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)))); 590 padding: var(--media-control-padding, 10px); 591 display: inline-flex; 592 justify-content: center; 593 align-items: center; 594 vertical-align: middle; 595 box-sizing: border-box; 596 text-align: center; 597 pointer-events: auto; 598 } 599 600 601 :host(:focus-visible) { 602 box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9); 603 outline: 0; 604 } 605 606 607 :host(:where(:focus)) { 608 box-shadow: none; 609 outline: 0; 610 } 611 </style> 612 <slot></slot> 613`;class cn extends W.HTMLElement{constructor(){super(),tb(this,_i,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(rm.content.cloneNode(!0)))}static get observedAttributes(){return[je.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,i){var r,n,a,o,l;
613e===je.MEDIA_CONTROLLER&&(t&&((n=(r=kn(this,_i))==null?void 0:r.unassociateElement)==null||n.call(r,this),Dn(this,_i,null)),i&&this.isConnected&&(Dn(this,_i,(a=this.getRootNode())==null?void 0:a.getElementById(i)),(l=(o=kn(this,_i))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,i;const{style:r}=Rt(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`);const n=this.getAttribute(je.MEDIA_CONTROLLER);n&&(Dn(this,_i,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(i=(t=kn(this,_i))==null?void 0:t.associateElement)==null||i.call(t,this))}disconnectedCallback(){var e,t;(t=(e=kn(this,_i))==null?void 0:e.unassociateElement)==null||t.call(e,this),Dn(this,_i,null)}}_i=new WeakMap;W.customElements.get("media-text-display")||W.customElements.define("media-text-display",cn);var ib=cn,nm=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Eu=(s,e,t)=>(nm(s,e,"read from private field"),t?t.call(s):e.get(s)),sb=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},rb=(s,e,t,i)=>(nm(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),$r;class nb extends cn{constructor(){super(),sb(this,$r,void 0),rb(this,$r,this.shadowRoot.querySelector("slot")),Eu(this,$r).textContent=Is(0)}static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_DURATION]}attributeChangedCallback(e,t,i){e===w.MEDIA_DURATION&&(Eu(this,$r).textContent=Is(i)),super.attributeChangedCallback(e,t,i)}get mediaDuration(){return ct(this,w.MEDIA_DURATION)}set mediaDuration(e){Mt(this,w.MEDIA_DURATION,e)}}$r=new WeakMap;W.customElements.get("media-duration-display")||W.customElements.define("media-duration-display",nb);var am=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Bo=(s,e,t)=>(am(s,e,"read from private field"),t?t.call(s):e.get(s)),ab=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},ob=(s,e,t,i)=>(am(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),js;const oi={REMAINING:"remaining",SHOW_DURATION:"showduration",NO_TOGGLE:"notoggle"},yu=[...Object.values(oi),w.MEDIA_CURRENT_TIME,w.MEDIA_DURATION,w.MEDIA_SEEKABLE],_u=["Enter"," "],lb=" / ",Tu=(s,{timesSep:e=lb}={})=>{var t,i,r,n;const a=s.hasAttribute(oi.REMAINING),o=s.hasAttribute(oi.SHOW_DURATION),l=(t=s.mediaCurrentTime)!=null?t:0,[,c]=(i=s.mediaSeekable)!=null?i:[],d=(n=(r=s.mediaDuration)!=null?r:c)!=null?n:0,u=Is(a?0-(d-l):l);return o?`${u}${e}${Is(d)}`:u},cb="video not loaded, unknown time.",db=s=>{var e;const t=s.mediaCurrentTime,[,i]=(e=s.mediaSeekable)!=null?e:[],r=s.mediaDuration||i;if(t==null||r==null){s.setAttribute("aria-valuetext",cb);return}const n=s.hasAttribute(oi.REMAINING),a=s.hasAttribute(oi.SHOW_DURATION),o=jr(n?0-(r-t):t);if(!a){s.setAttribute("aria-valuetext",o);return}const l=jr(r),c=`${o} of ${l}`;s.setAttribute("aria-valuetext",c)};class ub extends cn{constructor(){super(),ab(this,js,void 0),ob(this,js,this.shadowRoot.querySelector("slot")),Bo(this,js).innerHTML=`${Tu(this)}`}static get observedAttributes(){return[...super.observedAttributes,...yu,"disabled"]}connectedCallback(){const{style:e}=Rt(this.shadowRoot,":host(:hover:not([notoggle]))");e.setProperty("cursor","pointer"),e.setProperty("background","var(--media-control-hover-background, rgba(50 50 70 / .7))"),this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","progressbar"),this.setAttribute("aria-label",es.PLAYBACK_TIME());const t=i=>{const{key:r}=i;if(!_u.includes(r)){this.removeEventListener("keyup",t);return}this.toggleTimeDisplay()};this.addEventListener("keydown",i=>{const{metaKey:r,altKey:n,key:a}=i;if(r||n||!_u.includes(a)){this.removeEventListener("keyup",t);return}this.addEventListener("keyup",t)}),this.addEventListener("click",this.toggleTimeDisplay),super.connectedCallback()}toggleTimeDisplay(){this.noToggle||(this.hasAttribute("remaining")?this.removeAttribute("remaining"):this.setAttribute("remaining",""))}disconnectedCallback(){this.disable(),super.disconnectedCallback()}attributeChangedCallback(e,t,i){yu.includes(e)?this.update():e==="disabled"&&i!==t&&(i==null?this.enable():this.disable()),super.attributeChangedCallback(e,t,i)}enable(){this.tabIndex=0}disable(){this.tabIndex=-1}get remaining(){return yt(this,oi.REMAINING)}set remaining(e){_t(this,oi.REMAINING,e)}get showDuration(){return yt(this,oi.SHOW_DURATION)}set showDuration(e){_t(this,oi.SHOW_DURATION,e)}get noToggle(){return yt(this,oi.NO_TOGGLE)}set noToggle(e){_t(this,oi.NO_TOGGLE,e)}get mediaDuration(){return ct(this,w.MEDIA_DURATION)}set mediaDuration(e){Mt(this,w.MEDIA_DURATION,e)}get mediaCurrentTime(){return ct(this,w.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){Mt(this,w.MEDIA_CURRENT_TIME,e)}get mediaSeekable(){const e=this.getAttribute(w.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}set mediaSeekable(e){if(e==null){this.removeAttribute(w.MEDIA_SEEKABLE);return}this.setAttribute(w.MEDIA_SEEKABLE,e.join(":"))}update(){const e=Tu(this);db(this),e!==Bo(this,js).innerHTML&&(Bo(this,js).innerHTML=e)}}js=new WeakMap;W.customElements.get("media-time-display")||W.customElements.define("media-time-display",ub);const hb=`<svg aria-hidden="true" viewBox="0 0 26 24"> 614 <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79
6140 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/> 615</svg>`,fb=`<svg aria-hidden="true" viewBox="0 0 26 24"> 616 <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.81 2.81 0 0 0-.74-1.32 2.94 2.94 0 0 0-2.13-.78 3.18 3.18 0 0 0-2.43 1 4 4 0 0 0-.92 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.23 3.23 0 0 0 1.07-1.74l-1.4-.45a2.06 2.06 0 0 1-.6 1.07Zm12.32-8.41a2.59 2.59 0 0 0-2.3-2.51C18.72 3.05 15.86 3 13 3c-2.86 0-5.72.05-7.53.17a2.59 2.59 0 0 0-2.3 2.51c-.23 4.207-.23 8.423 0 12.63a2.57 2.57 0 0 0 2.3 2.5c1.81.13 4.67.19 7.53.19 2.86 0 5.72-.06 7.53-.19a2.57 2.57 0 0 0 2.3-2.5c.23-4.207.23-8.423 0-12.63Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.14-.21-8.29 0-12.43a1.11 1.11 0 0 1 .91-1.11C7.24 4.56 10 4.49 13 4.49s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.14.21 8.29 0 12.43Z"/> 617</svg>`,om=Te.createElement("template");om.innerHTML=` 618 <style> 619 :host([aria-checked="true"]) slot[name=off] { 620 display: none !important; 621 } 622 623 624 :host(:not([aria-checked="true"])) slot[name=on] { 625 display: none !important; 626 } 627 </style> 628 629 <slot name="icon"> 630 <slot name="on">${hb}</slot> 631 <slot name="off">${fb}</slot> 632 </slot> 633`;const bu=s=>{s.setAttribute("aria-checked",OT(s))};class mb extends ii{static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_SUBTITLES_LIST,w.MEDIA_SUBTITLES_SHOWING]}constructor(e={}){super({slotTemplate:om,...e}),this._captionsReady=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",es.CLOSED_CAPTIONS()),bu(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===w.MEDIA_SUBTITLES_SHOWING&&bu(this)}get mediaSubtitlesList(){return Au(this,w.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){Su(this,w.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return Au(this,w.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){Su(this,w.MEDIA_SUBTITLES_SHOWING,e)}handleClick(){this.dispatchEvent(new W.CustomEvent(be.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}))}}const Au=(s,e)=>{const t=s.getAttribute(e);return t?Vf(t):[]},Su=(s,e,t)=>{if(!(t!=null&&t.length)){s.removeAttribute(e);return}const i=El(t);s.getAttribute(e)!==i&&s.setAttribute(e,i)};W.customElements.get("media-captions-button")||W.customElements.define("media-captions-button",mb);const Ns={SEEK_OFFSET:"seekoffset"},la=30,pb=`<svg aria-hidden="true" viewBox="0 0 20 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(8.9 19.87)">${la}</text><path d="M10 6V3l5.61 4L10 10.94V8a5.54 5.54 0 0 0-1.9 10.48v2.12A7.5 7.5 0 0 1 10 6Z"/></svg>`,lm=Te.createElement("template");lm.innerHTML=` 634 <slot name="icon">${pb}</slot> 635`;const gb=0;class vb extends ii{static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_CURRENT_TIME,Ns.SEEK_OFFSET]}constructor(e={}){super({slotTemplate:lm,...e})}connectedCallback(){this.seekOffset=ct(this,Ns.SEEK_OFFSET,la),super.connectedCallback()}attributeChangedCallback(e,t,i){e===Ns.SEEK_OFFSET&&(this.seekOffset=ct(this,Ns.SEEK_OFFSET,la)),super.attributeChangedCallback(e,t,i)}get seekOffset(){return ct(this,Ns.SEEK_OFFSET,la)}set seekOffset(e){Mt(this,Ns.SEEK_OFFSET,e),this.setAttribute("aria-label",kt.SEEK_FORWARD_N_SECS({seekOffset:this.seekOffset})),Af(Sf(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return ct(this,w.MEDIA_CURRENT_TIME,gb)}set mediaCurrentTime(e){Mt(this,w.MEDIA_CURRENT_TIME,e)}handleClick(){const e=this.mediaCurrentTime+this.seekOffset,t=new W.CustomEvent(be.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}W.customElements.get("media-seek-forward-button")||W.customElements.define("media-seek-forward-button",vb);const Eb=`<svg aria-hidden="true" viewBox="0 0 26 24"> 636 <path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/> 637</svg>`,yb=`<svg aria-hidden="true" viewBox="0 0 26 24"> 638 <path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/> 639</svg>`,cm=Te.createElement("template");cm.innerHTML=` 640 <style> 641 :host([${w.MEDIA_IS_FULLSCREEN}]) slot:not([name=exit]):not([name=icon]) { 642 display: none !important; 643 } 644 645 646 :host(:not([${w.MEDIA_IS_FULLSCREEN}])) slot:not([name=enter]):not([name=icon]) { 647 display: none !important; 648 } 649 </style> 650 651 <slot name="icon"> 652 <slot name="enter">${Eb}</slot> 653 <slot name="exit">${yb}</slot> 654 </slot> 655`;const xu=s=>{const e=s.mediaIsFullscreen?kt.EXIT_FULLSCREEN():kt.ENTER_FULLSCREEN();s.setAttribute("aria-label",e)};class _b extends ii{static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_IS_FULLSCREEN,w.MEDIA_FULLSCREEN_UNAVAILABLE]}constructor(e={}){super({slotTemplate:cm,...e})}connectedCallback(){xu(this),super.connectedCallback()}attributeChangedCallback(e,t,i){e===w.MEDIA_IS_FULLSCREEN&&xu(this),super.attributeChangedCallback(e,t,i)}get mediaFullscreenUnavailable(){return ei(this,w.MEDIA_FULLSCREEN_UNAVAILABLE)}set mediaFullscreenUnavailable(e){ti(this,w.MEDIA_FULLSCREEN_UNAVAILABLE,e)}get mediaIsFullscreen(){return yt(this,w.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(e){_t(this,w.MEDIA_IS_FULLSCREEN,e)}handleClick(){const e=this.mediaIsFullscreen?be.MEDIA_EXIT_FULLSCREEN_REQUEST:be.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new W.CustomEvent(e,{composed:!0,bubbles:!0}))}}W.customElements.get("media-fullscreen-button")||W.customElements.define("media-fullscreen-button",_b);const{MEDIA_TIME_IS_LIVE:ca,MEDIA_PAUSED:zr}=w,{MEDIA_SEEK_TO_LIVE_REQUEST:Tb,MEDIA_PLAY_REQUEST:bb}=be,Ab='<svg viewBox="0 0 6 12"><circle cx="3" cy="6" r="2"></circle></svg>',dm=Te.createElement("template");dm.innerHTML=` 656 <style> 657 658 slot[name=indicator] > *, 659 :host ::slotted([slot=indicator]) { 660 661 min-width: auto; 662 fill: var(--media-live-button-icon-color, rgb(140, 140, 140)); 663 color: var(--media-live-button-icon-color, rgb(140, 140, 140)); 664 } 665 666 :host([${ca}]:not([${zr}])) slot[name=indicator] > *, 667 :host([${ca}]:not([${zr}])) ::slotted([slot=indicator]) { 668 fill: var(--media-live-button-indicator-color, rgb(255, 0, 0)); 669 color: var(--media-live-button-indicator-color, rgb(255, 0, 0)); 670 } 671 672 :host([${ca}]:not([${zr}])) {
673 cursor: not-allowed; 674 } 675 676 </style> 677 678 <slot name="indicator">${Ab}</slot> 679 680 <slot name="spacer"> </slot><slot name="text">LIVE</slot> 681`;const Iu=s=>{const e=s.mediaPaused||!s.mediaTimeIsLive,t=e?kt.SEEK_LIVE():kt.PLAYING_LIVE();s.setAttribute("aria-label",t),e?s.removeAttribute("aria-disabled"):s.setAttribute("aria-disabled","true")};class Sb extends ii{static get observedAttributes(){return[...super.observedAttributes,zr,ca]}constructor(e={}){super({slotTemplate:dm,...e})}connectedCallback(){Iu(this),super.connectedCallback()}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),Iu(this)}get mediaPaused(){return yt(this,w.MEDIA_PAUSED)}set mediaPaused(e){_t(this,w.MEDIA_PAUSED,e)}get mediaTimeIsLive(){return yt(this,w.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(e){_t(this,w.MEDIA_TIME_IS_LIVE,e)}handleClick(){!this.mediaPaused&&this.mediaTimeIsLive||(this.dispatchEvent(new W.CustomEvent(Tb,{composed:!0,bubbles:!0})),this.hasAttribute(zr)&&this.dispatchEvent(new W.CustomEvent(bb,{composed:!0,bubbles:!0})))}}W.customElements.get("media-live-button")||W.customElements.define("media-live-button",Sb);const{MEDIA_VOLUME_LEVEL:Ir}=w,xb=`<svg aria-hidden="true" viewBox="0 0 24 24"> 682 <path d="M16.5 12A4.5 4.5 0 0 0 14 8v2.18l2.45 2.45a4.22 4.22 0 0 0 .05-.63Zm2.5 0a6.84 6.84 0 0 1-.54 2.64L20 16.15A8.8 8.8 0 0 0 21 12a9 9 0 0 0-7-8.77v2.06A7 7 0 0 1 19 12ZM4.27 3 3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25A6.92 6.92 0 0 1 14 18.7v2.06A9 9 0 0 0 17.69 19l2 2.05L21 19.73l-9-9L4.27 3ZM12 4 9.91 6.09 12 8.18V4Z"/> 683</svg>`,Lu=`<svg aria-hidden="true" viewBox="0 0 24 24"> 684 <path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4Z"/> 685</svg>`,Ib=`<svg aria-hidden="true" viewBox="0 0 24 24"> 686 <path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4ZM14 3.23v2.06a7 7 0 0 1 0 13.42v2.06a9 9 0 0 0 0-17.54Z"/> 687</svg>`,um=Te.createElement("template");um.innerHTML=` 688 <style> 689 690 :host(:not([${Ir}])) slot:not([name=high]):not([name=icon]), 691 :host([${Ir}=high]) slot:not([name=high]):not([name=icon]) { 692 display: none !important; 693 } 694 695 :host([${Ir}=off]) slot:not([name=off]):not([name=icon]) { 696 display: none !important; 697 } 698 699 :host([${Ir}
699=low]) slot:not([name=low]):not([name=icon]) { 700 display: none !important; 701 } 702 703 :host([${Ir}=medium]) slot:not([name=medium]):not([name=icon]) { 704 display: none !important; 705 } 706 </style> 707 708 <slot name="icon"> 709 <slot name="off">${xb}</slot> 710 <slot name="low">${Lu}</slot> 711 <slot name="medium">${Lu}</slot> 712 <slot name="high">${Ib}</slot> 713 </slot> 714`;const wu=s=>{const t=s.mediaVolumeLevel==="off"?kt.UNMUTE():kt.MUTE();s.setAttribute("aria-label",t)};class Lb extends ii{static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_VOLUME_LEVEL]}constructor(e={}){super({slotTemplate:um,...e})}connectedCallback(){wu(this),super.connectedCallback()}attributeChangedCallback(e,t,i){e===w.MEDIA_VOLUME_LEVEL&&wu(this),super.attributeChangedCallback(e,t,i)}get mediaVolumeLevel(){return ei(this,w.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(e){ti(this,w.MEDIA_VOLUME_LEVEL,e)}handleClick(){const e=this.mediaVolumeLevel==="off"?be.MEDIA_UNMUTE_REQUEST:be.MEDIA_MUTE_REQUEST;this.dispatchEvent(new W.CustomEvent(e,{composed:!0,bubbles:!0}))}}W.customElements.get("media-mute-button")||W.customElements.define("media-mute-button",Lb);const Ru=`<svg aria-hidden="true" viewBox="0 0 28 24"> 715 <path d="M24 3H4a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h20a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1Zm-1 16H5V5h18v14Zm-3-8h-7v5h7v-5Z"/> 716</svg>`,hm=Te.createElement("template");hm.innerHTML=` 717 <style> 718 :host([${w.MEDIA_IS_PIP}]) slot:not([name=exit]):not([name=icon]) { 719 display: none !important; 720 } 721 722 723 :host(:not([${w.MEDIA_IS_PIP}])) slot:not([name=enter]):not([name=icon]) { 724 display: none !important; 725 } 726 </style> 727 728 <slot name="icon"> 729 <slot name="enter">${Ru}</slot> 730 <slot name="exit">${Ru}</slot> 731 </slot> 732`;const ku=s=>{const e=s.mediaIsPip?kt.EXIT_PIP():kt.ENTER_PIP();s.setAttribute("aria-label",e)};class wb extends ii{static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_IS_PIP,w.MEDIA_PIP_UNAVAILABLE]}constructor(e={}){super({slotTemplate:hm,...e})}connectedCallback(){ku(this),super.connectedCallback()}attributeChangedCallback(e,t,i){e===w.MEDIA_IS_PIP&&ku(this),super.attributeChangedCallback(e,t,i)}get mediaPipUnavailable(){return ei(this,w.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(e){ti(this,w.MEDIA_PIP_UNAVAILABLE,e)}get mediaIsPip(){return yt(this,w.MEDIA_IS_PIP)}set mediaIsPip(e){_t(this,w.MEDIA_IS_PIP,e)}handleClick(){const e=this.mediaIsPip?be.MEDIA_EXIT_PIP_REQUEST:be.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new W.CustomEvent(e,{composed:!0,bubbles:!0}))}}W.customElements.get("media-pip-button")||W.customElements.define("media-pip-button",wb);const Rb=`<svg aria-hidden="true" viewBox="0 0 24 24"> 733 <path d="m6 21 15-9L6 3v18Z"/> 734</svg>`,kb=`<svg aria-hidden="true" viewBox="0 0 24 24"> 735 <path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/> 736</svg>`,fm=Te.createElement("template");fm.innerHTML=` 737 <style> 738 :host([${w.MEDIA_PAUSED}]) slot[name=pause] { 739 display: none !important; 740 } 741 742 :host(:not([${w.MEDIA_PAUSED}])) slot[name=play] { 743 display: none !important; 744 } 745 </style> 746 747 <slot name="icon"> 748 <slot name="play">${Rb}</slot> 749 <slot name="pause">${kb}</slot> 750 </slot> 751`;const Du=s=>{const e=s.mediaPaused?kt.PLAY():kt.PAUSE();s.setAttribute("aria-label",e)};class Db extends ii{static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_PAUSED,w.MEDIA_ENDED]}constructor(e={}){super({slotTemplate:fm,...e})}connectedCallback(){Du(this),super.connectedCallback()}attributeChangedCallback(e,t,i){e===w.MEDIA_PAUSED&&Du(this),super.attributeChangedCallback(e,t,i)}get mediaPaused(){return yt(this,w.MEDIA_PAUSED)}set mediaPaused(e){_t(this,w.MEDIA_PAUSED,e)}handleClick(){const e=this.mediaPaused?be.MEDIA_PLAY_REQUEST:be.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new W.CustomEvent(e,{composed:!0,bubbles:!0}))}}W.customElements.get("media-play-button")||W.customElements.define("media-play-button",Db);var Cb=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Cn=(s,e,t)=>(Cb(s,e,"read from private field"),t?t.call(s):e.get(s)),Mb=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},zs;const $o={RATES:"rates"},Pb=[1,1.2,1.5,1.7,2],Mn=1,mm=Te.createElement("template");
751mm.innerHTML=` 752 <style> 753 :host { 754 min-width: 5ch; 755 padding: var(--media-button-padding, var(--media-control-padding, 10px 5px)); 756 } 757 </style> 758 <slot name="icon"></slot> 759`;class Ob extends ii{constructor(e={}){super({slotTemplate:mm,...e}),Mb(this,zs,new Gf(this,$o.RATES,{defaultValue:Pb})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${Mn}x`}static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_PLAYBACK_RATE,$o.RATES]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===$o.RATES&&(Cn(this,zs).value=i),e===w.MEDIA_PLAYBACK_RATE){const r=i?+i:Number.NaN,n=Number.isNaN(r)?Mn:r;this.container.innerHTML=`${n}x`,this.setAttribute("aria-label",es.PLAYBACK_RATE({playbackRate:n}))}}get rates(){return Cn(this,zs)}set rates(e){e?Array.isArray(e)&&(Cn(this,zs).value=e.join(" ")):Cn(this,zs).value=""}get mediaPlaybackRate(){return ct(this,w.MEDIA_PLAYBACK_RATE,Mn)}set mediaPlaybackRate(e){Mt(this,w.MEDIA_PLAYBACK_RATE,e)}handleClick(){var e,t;const i=Array.from(this.rates.values(),a=>+a).sort((a,o)=>a-o),r=(t=(e=i.find(a=>a>this.mediaPlaybackRate))!=null?e:i[0])!=null?t:Mn,n=new W.CustomEvent(be.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(n)}}zs=new WeakMap;W.customElements.get("media-playback-rate-button")||W.customElements.define("media-playback-rate-button",Ob);const mi={PLACEHOLDER_SRC:"placeholdersrc",SRC:"src"},pm=Te.createElement("template");pm.innerHTML=` 760 <style> 761 :host { 762 pointer-events: none; 763 display: var(--media-poster-image-display, inline-block); 764 box-sizing: border-box; 765 } 766 767 img { 768 max-width: 100%; 769 max-height: 100%; 770 min-width: 100%; 771 min-height: 100%; 772 background-repeat: no-repeat; 773 background-position: var(--media-poster-image-background-position, var(--media-object-position, center)); 774 background-size: var(--media-poster-image-background-size, var(--media-object-fit, contain)); 775 object-fit: var(--media-object-fit, contain); 776 object-position: var(--media-object-position, center); 777 } 778 </style> 779 780 <img part="poster img" aria-hidden="true" id="image"/> 781`;const Nb=s=>{s.style.removeProperty("background-image")},Fb=(s,e)=>{s.style["background-image"]=`url('${e}')`};class Ub extends W.HTMLElement{static get observedAttributes(){return[mi.PLACEHOLDER_SRC,mi.SRC]}constructor(){super(),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(pm.content.cloneNode(!0))),this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(e,t,i){e===mi.SRC&&(i==null?this.image.removeAttribute(mi.SRC):this.image.setAttribute(mi.SRC,i)),e===mi.PLACEHOLDER_SRC&&(i==null?Nb(this.image):Fb(this.image,i))}get placeholderSrc(){return ei(this,mi.PLACEHOLDER_SRC)}set placeholderSrc(e){ti(this,mi.SRC,e)}get src(){return ei(this,mi.SRC)}set src(e){ti(this,mi.SRC,e)}}W.customElements.get("media-poster-image")||W.customElements.define("media-poster-image",Ub);const Fs={SEEK_OFFSET:"seekoffset"},da=30,Bb=`<svg aria-hidden="true" viewBox="0 0 20 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(2.18 19.87)">${da}</text><path d="M10 6V3L4.37 7 10 10.94V8a5.54 5.54 0 0 1 1.9 10.48v2.12A7.5 7.5 0 0 0 10 6Z"/></svg>`,gm=Te.createElement("template");gm.innerHTML=` 782 <slot name="icon">${Bb}</slot> 783`;const $b=0;class Gb extends ii{static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_CURRENT_TIME,Fs.SEEK_OFFSET]}constructor(e={}){super({slotTemplate:gm,...e})}connectedCallback(){this.seekOffset=ct(this,Fs.SEEK_OFFSET,da),super.connectedCallback()}attributeChangedCallback(e,t,i){e===Fs.SEEK_OFFSET&&(this.seekOffset=ct(this,Fs.SEEK_OFFSET,da)),super.attributeChangedCallback(e,t,i)}get seekOffset(){return ct(this,Fs.SEEK_OFFSET,da)}set seekOffset(e){Mt(this,Fs.SEEK_OFFSET,e),this.setAttribute("aria-label",kt.SEEK_BACK_N_SECS({seekOffset:this.seekOffset})),Af(Sf(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return ct(this,w.MEDIA_CURRENT_TIME,$b)}set mediaCurrentTime(e){Mt(this,w.MEDIA_CURRENT_TIME,e)}handleClick(){const e=Math.max(this.mediaCurrentTime-this.seekOffset,0),t=new W.CustomEvent(be.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}W.customElements.get("media-seek-backward-button")||W.customElements.define("media-seek-backward-button",Gb);var vm=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Cu=(s,e,t)=>(vm(s,e,"read from private field"),t?t.call(s):e.get(s)),Hb=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},Vb=(s,e,t,i)=>(vm(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),Gr;class Wb extends cn{constructor(){super(),Hb(this,Gr,void 0),Vb(this,Gr,this.shadowRoot.querySelector("slot")),Cu(this,Gr).textContent=Is(0)}static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_PREVIEW_TIME]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===w.MEDIA_PREVIEW_TIME&&i!=null&&(Cu(this,Gr).textContent=Is(i))}get mediaPreviewTime(){return ct(this,w.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){Mt(this,w.MEDIA_PREVIEW_TIME,e)}}Gr=new WeakMap;W.customElements.get("media-preview-time-display")||W.customElements.define("media-preview-time-display",Wb);var Em=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Pn=(s,e,t)=>(Em(s,e,"read from private field"),t?t.call(s):e.get(s)),Kb=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},On=(s,e,t,i)=>(Em(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),Ti;const ym=Te.createElement("template");ym.innerHTML=` 784 <style> 785 :host { 786 box-sizing: border-box; 787 display: var(--media-control-display, var(--media-preview-thumbn
787ail-display, inline-block)); 788 overflow: hidden; 789 } 790 791 img { 792 display: none; 793 position: relative; 794 } 795 </style> 796 <img crossorigin loading="eager" decoding="async"> 797`;class qb extends W.HTMLElement{constructor(){super(),Kb(this,Ti,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(ym.content.cloneNode(!0)))}static get observedAttributes(){return[je.MEDIA_CONTROLLER,w.MEDIA_PREVIEW_IMAGE,w.MEDIA_PREVIEW_COORDS]}connectedCallback(){var e,t,i;const r=this.getAttribute(je.MEDIA_CONTROLLER);r&&(On(this,Ti,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(i=(t=Pn(this,Ti))==null?void 0:t.associateElement)==null||i.call(t,this))}disconnectedCallback(){var e,t;(t=(e=Pn(this,Ti))==null?void 0:e.unassociateElement)==null||t.call(e,this),On(this,Ti,null)}attributeChangedCallback(e,t,i){var r,n,a,o,l;[w.MEDIA_PREVIEW_IMAGE,w.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===je.MEDIA_CONTROLLER&&(t&&((n=(r=Pn(this,Ti))==null?void 0:r.unassociateElement)==null||n.call(r,this),On(this,Ti,null)),i&&this.isConnected&&(On(this,Ti,(a=this.getRootNode())==null?void 0:a.getElementById(i)),(l=(o=Pn(this,Ti))==null?void 0:o.associateElement)==null||l.call(o,this)))}get mediaPreviewImage(){return ei(this,w.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){ti(this,w.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewCoords(){const e=this.getAttribute(w.MEDIA_PREVIEW_COORDS);if(e)return e.split(/\s+/).map(t=>+t)}set mediaPreviewCoords(e){if(!e){this.removeAttribute(w.MEDIA_PREVIEW_COORDS);return}this.setAttribute(w.MEDIA_PREVIEW_COORDS,e.join(" "))}update(){const e=this.mediaPreviewCoords,t=this.mediaPreviewImage;if(!(e&&t))return;const[i,r,n,a]=e,o=t.split("#")[0],l=getComputedStyle(this),{maxWidth:c,maxHeight:d,minWidth:u,minHeight:h}=l,f=Math.min(parseInt(c)/n,parseInt(d)/a),p=Math.max(parseInt(u)/n,parseInt(h)/a),y=f<1,_=y?f:p>1?p:1,{style:A}=Rt(this.shadowRoot,":host"),x=Rt(this.shadowRoot,"img").style,I=this.shadowRoot.querySelector("img"),P=y?"min":"max";A.setProperty(`${P}-width`,"initial","important"),A.setProperty(`${P}-height`,"initial","important"),A.width=`${n*_}px`,A.height=`${a*_}px`;const L=()=>{x.width=`${this.imgWidth*_}px`,x.height=`${this.imgHeight*_}px`,x.display="block"};I.src!==o&&(I.onload=()=>{this.imgWidth=I.naturalWidth,this.imgHeight=I.naturalHeight,L()},I.src=o,L()),L(),x.transform=`translate(-${i*_}px, -${r*_}px)`}}Ti=new WeakMap;W.customElements.get("media-preview-thumbnail")||W.customElements.define("media-preview-thumbnail",qb);var _m=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Mu=(s,e,t)=>(_m(s,e,"read from private field"),t?t.call(s):e.get(s)),Yb=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},jb=(s,e,t,i)=>(_m(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),Hr;class zb extends ib{constructor(){super(),Yb(this,Hr,void 0),jb(this,Hr,this.shadowRoot.querySelector("slot"))}static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_PREVIEW_CHAPTER]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===w.MEDIA_PREVIEW_CHAPTER&&i!==t){if(i==null){Mu(this,Hr).textContent="",this.removeAttribute("aria-valuetext");return}Mu(this,Hr).textContent=i,this.setAttribute("aria-valuetext",`chapter: ${i}`)}}get mediaPreviewChapter(){return ei(this,w.MEDIA_PREVIEW_CHAPTER)}set mediaPreviewChapter(e){ti(this,w.MEDIA_PREVIEW_CHAPTER,e)}}Hr=new WeakMap;W.customElements.get("media-preview-chapter-display")||W.customElements.define("media-preview-chapter-display",zb);var Tm=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},mt=(s,e,t)=>(Tm(s,e,"read from private field"),t?t.call(s):e.get(s)),pi=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},Gt=(s,e,t,i)=>(Tm(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),Xb=(s,e,t,i)=>({set _(r){Gt(s,e,r,t)},get _(){return mt(s,e,i)}}),Xs,ua,Qs,Vr,ha,fa,ma,Zs,_s,pa;class Qb{constructor(e,t,i){pi(this,Xs,void 0),pi(this,ua,void 0),pi(this,Qs,void 0),pi(this,Vr,void 0),pi(this,ha,void 0),pi(this,fa,void 0),pi(this,ma,void 0),pi(this,Zs,void 0),pi(this,_s,0),pi(this,pa,(r=performance.now())=>{Gt(this,_s,requestAnimationFrame(mt(this,pa))),Gt(this,Vr,performance.now()-mt(this,Qs));const n=1e3/this.fps;if(mt(this,Vr)>n){Gt(this,Qs,r-mt(this,Vr)%n);const a=1e3/((r-mt(this,ua))/++Xb(this,ha)._),o=(r-mt(this,fa))/1e3/this.duration;let l=mt(this,ma)+o*this.playbackRate;l-mt(this,Xs).valueAsNumber>0?Gt(this,Zs,this.playbackRate/this.duration/a):(Gt(this,Zs,.995*mt(this,Zs)),l=mt(this,Xs).valueAsNumber+mt(this,Zs)),this.callback(l)}}),Gt(this,Xs,e),this.callback=t,this.fps=i}start(){mt(this,_s)===0&&(Gt(this,Qs,performance.now()),Gt(this,ua,mt(this,Qs)),Gt(this,ha,0),mt(this,pa).call(this))}stop(){mt(this,_s)!==0&&(cancelAnimationFrame(mt(this,_s)),Gt(this,_s,0))}update({start:e,duration:t,playbackRate:i}){const r=e-mt(this,Xs).valueAsNumber;(r>0||r<-.03)&&this.callback(e),Gt(this,ma,e),Gt(this,fa,performance.now()),this.duration=t,this.playbackRate=i}}Xs=new WeakMap;ua=new WeakMap;Qs=new WeakMap;Vr=new WeakMap;ha=new WeakMap;fa=new WeakMap;ma=new WeakMap;Zs=new WeakMap;_s=new WeakMap;pa=new WeakMap;var vc=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},gt=(s,e,t)=>(vc(s,e,"read from private field"),t?t.call(s):e.get(s)),Lt=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},bi=(s,e,t,i)=>(vc(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),Qt=(s,e,t)=>(vc(s,e,"access private method"),t),Js,Ls,Ma,Xr,Pa,Wr,Oa,Na,er,tr,Kr,Ec,bm,Ll,Fa,yc,wl,Am,nn,Ua,Rl,Sm;const Zb="video not loaded, unknown time.",Jb=s=>
797{const e=s.range,t=jr(+Im(s)),i=jr(+s.mediaSeekableEnd),r=t&&i?`${t} of ${i}`:Zb;e.setAttribute("aria-valuetext",r)},xm=Te.createElement("template");xm.innerHTML=` 798 <style> 799 :host { 800 --media-preview-border-radius: 3px; 801 --media-box-padding-left: 10px; 802 --media-box-padding-right: 10px; 803 } 804 805 #highlight { 806 background: var(--media-time-range-buffered-color, rgb(255 255 255 / .4)); 807 } 808 809 #preview-rail, 810 #current-rail { 811 812 width: 1%; 813 position: absolute; 814 left: 0; 815 bottom: 100%; 816 pointer-events: none; 817 will-change: transform; 818 } 819 820 [part~="box"] { 821 822 position: absolute; 823 bottom: 100%; 824 display: flex; 825 flex-direction: column; 826 align-items: center; 827 transform: translateX(-50%); 828 } 829 830 [part~="preview-box"] { 831 transition-property: var(--media-preview-transition-property, visibility, opacity); 832 transition-duration: var(--media-preview-transition-duration-out, .25s); 833 transition-delay: var(--media-preview-transition-delay-out, 0s); 834 visibility: hidden; 835 opacity: 0; 836 } 837 838 :host(:is([${w.MEDIA_PREVIEW_IMAGE}], [${w.MEDIA_PREVIEW_TIME}])[dragging]) [part~="preview-box"] { 839 transition-duration: var(--media-preview-transition-duration-in, .5s); 840 transition-delay: var(--media-preview-transition-delay-in, .25s); 841 visibility: visible; 842 opacity: 1; 843 } 844 845 @media (hover: hover) { 846 :host(:is([${w.MEDIA_PREVIEW_IMAGE}], [${w.MEDIA_PREVIEW_TIME}]):hover) [part~="preview-box"] { 847 transition-duration: var(--media-preview-transition-duration-in, .5s); 848 transition-delay: var(--media-preview-transition-delay-in, .25s); 849 visibility: visible; 850 opacity: 1; 851 } 852 } 853 854 media-preview-thumbnail, 855 ::slotted(media-preview-thumbnail) { 856 visibility: hidden; 857 858 transition: visibility 0s .25s; 859 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 860 background: var(--media-preview-thumbnail-background, var(--media-preview-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))))); 861 box-shadow: var(--media-preview-thumbnail-box-shadow, 0 0 4px rgb(0 0 0 / .2)); 862 max-width: var(--media-preview-thumbnail-max-width, 180px); 863 max-height: var(--media-preview-thumbnail-max-height, 160px); 864 min-width: var(--media-preview-thumbnail-min-width, 120px); 865 min-height: var(--media-preview-thumbnail-min-height, 80px); 866 border: var(--media-preview-thumbnail-border); 867 border-radius: var(--media-preview-thumbnail-border-radius, 868 var(--media-preview-border-radius) var(--media-preview-border-radius) 0 0); 869 } 870 871 :host([${w.MEDIA_PREVIEW_IMAGE}][dragging]) media-preview-thumbnail, 872 :host([${w.MEDIA_PREVIEW_IMAGE}][dragging]) ::slotted(media-preview-thumbnail) { 873 transition-delay: var(--media-preview-transition-delay-in, .25s); 874 visibility: visible; 875 } 876 877 @media (hover: hover) { 878 :host([${w.MEDIA_PREVIEW_IMAGE}]:hover) media-preview-thumbnail, 879 :host([${w.MEDIA_PREVIEW_IMAGE}]:hover) ::slotted(media-preview-thumbnail) { 880 transition-delay: var(--media-preview-transition-delay-in, .25s); 881 visibility: visible; 882 } 883 884 :host([${w.MEDIA_PREVIEW_TIME}]:hover) { 885 --media-time-range-hover-display: block; 886 } 887 } 888 889 media-preview-chapter-display, 890 ::slotted(media-preview-chapter-display) { 891 display: none; 892 line-height: 1.3; 893 min-width: 0; 894 895 transition: min-width 0s, border-radius 0s, margin 0s, padding 0s; 896 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 897 background: var(--media-preview-chapter-background, var(--media-preview-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))))); 898 border-radius: var(--media-preview-chapter-border-radius, 899 var(--media-preview-border-radius) var(--media-preview-border-radius) 900 var(--media-preview-border-radius) var(--media-preview-border-radius)); 901 padding: var(--media-preview-chapter-padding, 4px 10px); 902 margin: var(--media-preview-chapter-margin, 0 0 5px); 903 text-shadow: var(--media-preview-chapter-text-shadow, 0 0 4px rgb(0 0 0 / .75)); 904 } 905 906 :host([${w.MEDIA_PREVIEW_IMAGE}]) media-preview-chapter-display, 907 :host([${w.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-chapter-display) { 908 transition-delay: var(--media-preview-transition-delay-in, .25s); 909 border-radius: var(--media-preview-chapter-border-radius, 0); 910 padding: var(--media-preview-chapter-padding, 4px 10px 0); 911 margin: var(--media-preview-chapter-margin, 0); 912 min-width: 100%; 913 } 914 915 media-preview-chapter-display[${w.MEDIA_PREVIEW_CHAPTER}]:not([${w.MEDIA_PREVIEW_CHAPTER}=""]), 916 ::slotted(media-preview-chapter-display[${w.MEDIA_PREVIEW_CHAPTER}]:not([${w.MEDIA_PREVIEW_CHAPTER}=""])) { 917 display: initial; 918 } 919 920 media-preview-time-display, 921 ::slotted(media-preview-time-display) { 922 line-height: 1.3; 923 min-width: 0; 924 925 transition: min-width 0s, border-radius 0s; 926 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 927 background: var(--media-preview-time-background, var(--media-preview-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))))); 928 border-radius: var(--media-preview-time-border-radius, 929 var(--media-preview-border-radius) var(--media-preview-border-radius) 930 var(--media-preview-border-radius) var(--media-preview-border-radius)); 931 padding: var(--media-preview-time-padding, 4px 10px); 932 margin: var(--media-preview-time-margin, 0 0 10px); 933 text-shadow: var(--media-preview-time-text-shadow, 0 0 4px rgb(0 0 0 / .75)); 934 } 935 936 :host([${w.MEDIA_PREVIEW_IMAGE}]) media-preview-time-display, 937 :host([${w.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-time-display) { 938 transition-delay: var(--media-preview-transition-delay-in, .25s); 939 border-radius: var(--media-preview-time-border-radius, 940 0 0 var(--media-preview-border-radius) var(--media-preview-border-radius)); 941 min-width: 100%; 942 } 943 944 :host([${w.MEDIA_PREVIEW_TIME}]:hover) { 945 --media-time-range-hover-display: block; 946 } 947 </style> 948 <div id="preview-rail"> 949 <slot name="preview" part="box preview-box">
950 <media-preview-thumbnail></media-preview-thumbnail> 951 <media-preview-chapter-display></media-preview-chapter-display> 952 <media-preview-time-display></media-preview-time-display> 953 </slot> 954 </div> 955 <div id="current-rail"> 956 <slot name="current" part="box current-box"> 957 958 </slot> 959 </div> 960`;const Nn=(s,e=s.mediaCurrentTime)=>{if(Number.isNaN(s.mediaSeekableEnd))return 0;const t=(e-s.mediaSeekableStart)/(s.mediaSeekableEnd-s.mediaSeekableStart);return Math.max(0,Math.min(t,1))},Im=(s,e=s.range.valueAsNumber)=>Number.isNaN(s.mediaSeekableEnd)?0:e*(s.mediaSeekableEnd-s.mediaSeekableStart)+s.mediaSeekableStart;class eA extends gc{constructor(){super(),Lt(this,tr),Lt(this,Ec),Lt(this,Fa),Lt(this,wl),Lt(this,nn),Lt(this,Rl),Lt(this,Js,void 0),Lt(this,Ls,void 0),Lt(this,Ma,void 0),Lt(this,Xr,void 0),Lt(this,Pa,void 0),Lt(this,Wr,void 0),Lt(this,Oa,void 0),Lt(this,Na,void 0),Lt(this,er,void 0),Lt(this,Ll,t=>{this.dragging||(this.range.valueAsNumber=t,this.updateBar())}),this.container.appendChild(xm.content.cloneNode(!0)),bi(this,Ma,this.shadowRoot.querySelectorAll('[part~="box"]')),bi(this,Pa,this.shadowRoot.querySelector('[part~="preview-box"]')),bi(this,Wr,this.shadowRoot.querySelector('[part~="current-box"]'));const e=getComputedStyle(this);bi(this,Oa,parseInt(e.getPropertyValue("--media-box-padding-left"))),bi(this,Na,parseInt(e.getPropertyValue("--media-box-padding-right"))),bi(this,Ls,new Qb(this.range,gt(this,Ll),60))}static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_PAUSED,w.MEDIA_DURATION,w.MEDIA_SEEKABLE,w.MEDIA_CURRENT_TIME,w.MEDIA_PREVIEW_IMAGE,w.MEDIA_PREVIEW_TIME,w.MEDIA_PREVIEW_CHAPTER,w.MEDIA_BUFFERED,w.MEDIA_PLAYBACK_RATE,w.MEDIA_LOADING,w.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",es.SEEK()),Qt(this,tr,Kr).call(this),bi(this,Js,this.getRootNode()),(e=gt(this,Js))==null||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),Qt(this,tr,Kr).call(this),(e=gt(this,Js))==null||e.removeEventListener("transitionstart",this),bi(this,Js,null)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),t!=i&&(e===w.MEDIA_CURRENT_TIME||e===w.MEDIA_PAUSED||e===w.MEDIA_ENDED||e===w.MEDIA_LOADING||e===w.MEDIA_DURATION||e===w.MEDIA_SEEKABLE?(gt(this,Ls).update({start:Nn(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),Qt(this,tr,Kr).call(this),Jb(this)):e===w.MEDIA_BUFFERED&&this.updateBufferedBar(),e===w.MEDIA_DURATION&&(this.mediaChaptersCues=gt(this,er)))}get mediaChaptersCues(){return gt(this,er)}set mediaChaptersCues(e){var t;bi(this,er,e),this.updateSegments((t=gt(this,er))==null?void 0:t.map(i=>({start:Nn(this,i.startTime),end:Nn(this,i.endTime)})))}get mediaPaused(){return yt(this,w.MEDIA_PAUSED)}set mediaPaused(e){_t(this,w.MEDIA_PAUSED,e)}get mediaLoading(){return yt(this,w.MEDIA_LOADING)}set mediaLoading(e){_t(this,w.MEDIA_LOADING,e)}get mediaDuration(){return ct(this,w.MEDIA_DURATION)}set mediaDuration(e){Mt(this,w.MEDIA_DURATION,e)}get mediaCurrentTime(){return ct(this,w.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){Mt(this,w.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return ct(this,w.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){Mt(this,w.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){const e=this.getAttribute(w.MEDIA_BUFFERED);return e?e.split(" ").map(t=>t.split(":").map(i=>+i)):[]}set mediaBuffered(e){if(!e){this.removeAttribute(w.MEDIA_BUFFERED);return}const t=e.map(i=>i.join(":")).join(" ");this.setAttribute(w.MEDIA_BUFFERED,t)}get mediaSeekable(){const e=this.getAttribute(w.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}set mediaSeekable(e){if(e==null){this.removeAttribute(w.MEDIA_SEEKABLE);return}this.setAttribute(w.MEDIA_SEEKABLE,e.join(":"))}get mediaSeekableEnd(){var e;const[,t=this.mediaDuration]=(e=this.mediaSeekable)!=null?e:[];return t}get mediaSeekableStart(){var e;const[t=0]=(e=this.mediaSeekable)!=null?e:[];return t}get mediaPreviewImage(){return ei(this,w.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){ti(this,w.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return ct(this,w.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){Mt(this,w.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return yt(this,w.MEDIA_ENDED)}set mediaEnded(e){_t(this,w.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;const t=this.mediaBuffered;if(!t.length)return;let i;if(this.mediaEnded)i=1;else{const n=this.mediaCurrentTime,[,a=this.mediaSeekableStart]=(e=t.find(([o,l])=>o<=n&&n<=l))!=null?e:[];i=Nn(this,a)}const{style:r}=Rt(this.shadowRoot,"#highlight");r.setProperty("width",`${i*100}%`)}updateCurrentBox(){if(!gt(this,Wr).assignedElements().length)return;const e=Qt(this,Fa,yc).call(this,gt(this,Wr),this.range.valueAsNumber),{style:t}=Rt(this.shadowRoot,"#current-rail");t.transform=`translateX(${e})`}handleEvent(e){switch(super.handleEvent(e),e.type){case"input":Qt(this,Rl,Sm).call(this);break;case"pointermove":Qt(this,wl,Am).call(this,e);break;case"pointerup":case"pointerleave":Qt(this,nn,Ua).call(this,null);break;case"transitionstart":xa(e.target,this)&&setTimeout(()=>
960Qt(this,tr,Kr).call(this),0);break}}}Js=new WeakMap;Ls=new WeakMap;Ma=new WeakMap;Xr=new WeakMap;Pa=new WeakMap;Wr=new WeakMap;Oa=new WeakMap;Na=new WeakMap;er=new WeakMap;tr=new WeakSet;Kr=function(){Qt(this,Ec,bm).call(this)?gt(this,Ls).start():gt(this,Ls).stop()};Ec=new WeakSet;bm=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaDuration>0&&oT(this)};Ll=new WeakMap;Fa=new WeakSet;yc=function(s,e){var t;let i=`${e*100*100}%`;const r=s.offsetWidth;if(!r)return i;const n=(t=this.getAttribute("bounds")?ac(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?t:this,a=this.range.getBoundingClientRect(),o=n.getBoundingClientRect(),l=(gt(this,Oa)-(a.left-o.left-r/2))/a.width*100,c=(o.right-a.left-r/2-gt(this,Na))/a.width*100;return Number.isNaN(l)||(i=`max(${l*100}%, ${i})`),Number.isNaN(c)||(i=`min(${i}, ${c*100}%)`),i};wl=new WeakSet;Am=function(s){const e=[...gt(this,Ma)].some(l=>s.composedPath().includes(l));if(!this.dragging&&(e||!s.composedPath().includes(this))){Qt(this,nn,Ua).call(this,null);return}const t=this.mediaDuration;if(!t)return;const i=this.range.getBoundingClientRect();let r=(s.clientX-i.left)/i.width;r=Math.max(0,Math.min(1,r));const n=Qt(this,Fa,yc).call(this,gt(this,Pa),r),{style:a}=Rt(this.shadowRoot,"#preview-rail");a.transform=`translateX(${n})`;const o=Math.round(gt(this,Xr))-Math.round(r*t);Math.abs(o)<1||(bi(this,Xr,r*t),Qt(this,nn,Ua).call(this,gt(this,Xr)))};nn=new WeakSet;Ua=function(s){this.dispatchEvent(new W.CustomEvent(be.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:s}))};Rl=new WeakSet;Sm=function(){gt(this,Ls).stop();const s=Im(this);this.dispatchEvent(new W.CustomEvent(be.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:s}))};W.customElements.get("media-time-range")||W.customElements.define("media-time-range",eA);var Lm=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Lr=(s,e,t)=>(Lm(s,e,"read from private field"),t?t.call(s):e.get(s)),Pu=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},wr=(s,e,t,i)=>(Lm(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),Ai,ga;const Ou={LOADING_DELAY:"loadingdelay"},wm=500,Rm=Te.createElement("template"),tA=` 961<svg aria-hidden="true" viewBox="0 0 100 100"> 962 <path d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"> 963 <animateTransform 964 attributeName="transform" 965 attributeType="XML" 966 type="rotate" 967 dur="1s" 968 from="0 50 50" 969 to="360 50 50" 970 repeatCount="indefinite" /> 971 </path> 972</svg> 973`;Rm.innerHTML=` 974<style> 975:host { 976 display: var(--media-control-display, var(--media-loading-indicator-display, inline-block)); 977 vertical-align: middle; 978 box-sizing: border-box; 979 --_loading-indicator-delay: var(--media-loading-indicator-transition-delay, ${wm}ms); 980} 981 982#status { 983 color: rgba(0,0,0,0); 984 width: 0px; 985 height: 0px; 986} 987 988:host slot[name=icon] > *, 989:host ::slotted([slot=icon]) { 990 opacity: var(--media-loading-indicator-opacity, 0); 991 transition: opacity 0.15s; 992} 993 994:host([${w.MEDIA_LOADING}]:not([${w.MEDIA_PAUSED}])) slot[name=icon] > *, 995:host([${w.MEDIA_LOADING}]:not([${w.MEDIA_PAUSED}])) ::slotted([slot=icon]) { 996 opacity: var(--media-loading-indicator-opacity, 1); 997 transition: opacity 0.15s var(--_loading-indicator-delay); 998} 999 1000:host #status { 1001 visibility: var(--media-loading-indicator-opacity, hidden); 1002 transition: visibility 0.15s; 1003} 1004 1005:host([${w.MEDIA_LOADING}]:not([${w.MEDIA_PAUSED}])) #status { 1006 visibility: var(--media-loading-indicator-opacity, visible); 1007 transition: visibility 0.15s var(--_loading-indicator-delay); 1008} 1009 1010svg, img, ::slotted(svg), ::slotted(img) { 1011 width: var(--media-loading-indicator-icon-width); 1012 height: var(--media-loading-indicator-icon-height, 100px); 1013 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 1014 vertical-align: middle; 1015} 1016</style> 1017 1018<slot name="icon">${tA}</slot> 1019<div id="status" role="status" aria-live="polite">${es.MEDIA_LOADING()}</div> 1020`;class iA extends W.HTMLElement{constructor(){if(super(),Pu(this,Ai,void 0),Pu(this,ga,wm),!this.shadowRoot){const e=this.attachShadow({mode:"open"}),t=Rm.content.cloneNode(!0);e.appendChild(t)}}static get observedAttributes(){return[je.MEDIA_CONTROLLER,w.MEDIA_PAUSED,w.MEDIA_LOADING,Ou.
1020LOADING_DELAY]}attributeChangedCallback(e,t,i){var r,n,a,o,l;e===Ou.LOADING_DELAY&&t!==i?this.loadingDelay=Number(i):e===je.MEDIA_CONTROLLER&&(t&&((n=(r=Lr(this,Ai))==null?void 0:r.unassociateElement)==null||n.call(r,this),wr(this,Ai,null)),i&&this.isConnected&&(wr(this,Ai,(a=this.getRootNode())==null?void 0:a.getElementById(i)),(l=(o=Lr(this,Ai))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,i;const r=this.getAttribute(je.MEDIA_CONTROLLER);r&&(wr(this,Ai,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(i=(t=Lr(this,Ai))==null?void 0:t.associateElement)==null||i.call(t,this))}disconnectedCallback(){var e,t;(t=(e=Lr(this,Ai))==null?void 0:e.unassociateElement)==null||t.call(e,this),wr(this,Ai,null)}get loadingDelay(){return Lr(this,ga)}set loadingDelay(e){wr(this,ga,e);const{style:t}=Rt(this.shadowRoot,":host");t.setProperty("--_loading-indicator-delay",`var(--media-loading-indicator-transition-delay, ${e}ms)`)}get mediaPaused(){return yt(this,w.MEDIA_PAUSED)}set mediaPaused(e){_t(this,w.MEDIA_PAUSED,e)}get mediaLoading(){return yt(this,w.MEDIA_LOADING)}set mediaLoading(e){_t(this,w.MEDIA_LOADING,e)}}Ai=new WeakMap;ga=new WeakMap;W.customElements.get("media-loading-indicator")||W.customElements.define("media-loading-indicator",iA);const sA=1,rA=s=>s.mediaMuted?0:s.mediaVolume,nA=({value:s})=>`${Math.round(s*100)}%`;class aA extends gc{static get observedAttributes(){return[...super.observedAttributes,w.MEDIA_VOLUME,w.MEDIA_MUTED,w.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{const e=this.range.value,t=new W.CustomEvent(be.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)})}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",es.VOLUME())}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),(e===w.MEDIA_VOLUME||e===w.MEDIA_MUTED)&&(this.range.valueAsNumber=rA(this),this.range.setAttribute("aria-valuetext",nA(this.range)),this.updateBar())}get mediaVolume(){return ct(this,w.MEDIA_VOLUME,sA)}set mediaVolume(e){Mt(this,w.MEDIA_VOLUME,e)}get mediaMuted(){return yt(this,w.MEDIA_MUTED)}set mediaMuted(e){_t(this,w.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return ei(this,w.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){ti(this,w.MEDIA_VOLUME_UNAVAILABLE,e)}}W.customElements.get("media-volume-range")||W.customElements.define("media-volume-range",aA);const km=s=>(Ba("data-v-319c58be"),s=s(),$a(),s),oA={class:"BaseMuxVideo"},lA=["playback-id"],cA=["src"],dA=km(()=>K("media-play-button",{slot:"centered-chrome"},[K("svg",{slot:"play",width:"34",height:"39",viewBox:"0 0 34 39",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[K("path",{d:"M34 19.5L0.250002 38.9856L0.250004 0.0144276L34 19.5Z",fill:"white"})])],-1)),uA=km(()=>K("media-control-bar",null,[K("media-play-button",null,[K("svg",{slot:"play",width:"34",height:"39",viewBox:"0 0 34 39",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[K("path",{d:"M34 19.5L0.250002 38.9856L0.250004 0.0144276L34 19.5Z",fill:"white"})]),K("svg",{slot:"pause",width:"11",height:"15",viewBox:"0 0 11 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[K("rect",{width:"3.57143",height:"15",fill:"white"}),K("rect",{x:"7.14307",width:"3.57143",height:"15",fill:"white"})])]),K("media-seek-backward-button",{seekoffset:"10"},[K("svg",{slot:"icon",width:"17",height:"19",viewBox:"0 0 17 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[K("path",{d:"M1 10.6333C1 14.7018 4.29817 17.9999 8.36667 17.9999C12.4352 17.9999 15.7333 14.7018 15.7333 10.6333C15.7333 6.56477 12.4352 3.2666 8.36667 3.2666C6.81435 3.2666 5.37418 3.74674 4.18656 4.5666",stroke:"white","stroke-width":"1.5"}),K("path",{d:"M4.27401 0.899902L3.2666 4.79574L6.5 6.8999",stroke:"white","stroke-width":"1.5"}),K("path",{d:"M7.24091 8.3055V13.25H6.01566V10.089H4.73241V9.2625C5.47916 9.2625 6.12441 9.0015 6.18966 8.3055H7.24091ZM12.097 10.785C12.097 12.6917 11.082 13.3443 10.0452 13.3443C8.98674 13.3443 7.98624 12.67 7.98624 10.785C7.98624 8.9 9.02299 8.2475 10.0452 8.2475C11.053 8.2475 12.097 8.8855 12.097 10.785ZM10.0452 9.19C9.30574 9.19 9.16074 10.06 9.16074 10.785C9.16074 11.5172 9.30574 12.4017 10.0452 12.4017C10.7847 12.4017 10.9152 11.5245 10.9152 10.785C10.9152 10.06 10.7775 9.19 10.0452 9.19Z",fill:"white"})])]),K("media-seek-forward-button",{seekoffset:"10"},[K("svg",{slot:"icon",width:"17",height:"19",viewBox:"0 0 17 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[K("path",{d:"M15.7334 10.6333C15.7334 14.7018 12.4352 17.9999 8.36673 17.9999C4.29823 17.9999 1.00006 14.7018 1.00006 10.6333C1.00006 6.56477 4.29823 3.2666 8.36673 3.2666C9.91905 3.2666 11.3592 3.74674 12.5468 4.5666",
1020stroke:"white","stroke-width":"1.5"}),K("path",{d:"M12.4594 1L13.4668 4.89583L9.50013 6.1",stroke:"white","stroke-width":"1.5"}),K("path",{d:"M7.24091 8.3055V13.25H6.01566V10.089H4.73241V9.2625C5.47916 9.2625 6.12441 9.0015 6.18966 8.3055H7.24091ZM12.097 10.785C12.097 12.6917 11.082 13.3443 10.0452 13.3443C8.98674 13.3443 7.98624 12.67 7.98624 10.785C7.98624 8.9 9.02299 8.2475 10.0452 8.2475C11.053 8.2475 12.097 8.8855 12.097 10.785ZM10.0452 9.19C9.30574 9.19 9.16074 10.06 9.16074 10.785C9.16074 11.5172 9.30574 12.4017 10.0452 12.4017C10.7847 12.4017 10.9152 11.5245 10.9152 10.785C10.9152 10.06 10.7775 9.19 10.0452 9.19Z",fill:"white"})])]),K("media-time-range"),K("media-pip-button",null,[K("svg",{slot:"icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[K("path",{d:"M13.2727 6.45455V1H1V13.2727H7.47727",stroke:"white","stroke-width":"1.5"}),K("rect",{x:"7.88599",y:"7.20459",width:"7.36364",height:"7.36364",stroke:"white","stroke-width":"1.5"})])]),K("media-fullscreen-button",null,[K("svg",{slot:"enter",width:"14",height:"15",viewBox:"0 0 14 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[K("line",{x1:"0.750244",y1:"3.27836e-08",x2:"0.750244",y2:"4.79972",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"12.9634",y1:"14.4902",x2:"12.9634",y2:"9.69051",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"0.000244141",y1:"13.7402",x2:"4.79997",y2:"13.7402",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"13.7134",y1:"0.75",x2:"8.91366",y2:"0.75",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"4.7998",y1:"0.75",x2:"8.15392e-05",y2:"0.75",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"8.91406",y1:"13.7402",x2:"13.7138",y2:"13.7402",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"0.750244",y1:"9.59961",x2:"0.750244",y2:"14.3993",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"12.9634",y1:"4.7998",x2:"12.9634",y2:"8.15064e-05",stroke:"white","stroke-width":"1.5"})]),K("svg",{slot:"exit",width:"14",height:"15",viewBox:"0 0 14 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[K("line",{x1:"0.750244",y1:"3.27836e-08",x2:"0.750244",y2:"4.79972",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"12.9634",y1:"14.4902",x2:"12.9634",y2:"9.69051",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"0.000244141",y1:"13.7402",x2:"4.79997",y2:"13.7402",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"13.7134",y1:"0.75",x2:"8.91366",y2:"0.75",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"4.7998",y1:"0.75",x2:"8.15392e-05",y2:"0.75",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"8.91406",y1:"13.7402",x2:"13.7138",y2:"13.7402",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"0.750244",y1:"9.59961",x2:"0.750244",y2:"14.3993",stroke:"white","stroke-width":"1.5"}),K("line",{x1:"12.9634",y1:"4.7998",x2:"12.9634",y2:"8.15064e-05",stroke:"white","stroke-width":"1.5"})])])],-1)),Nu=1920,Fu=1080,hA=ze({__name:"MuxVideo",props:{video:{type:Object,required:!0},image:{type:Object,default:()=>null}},setup(s){const e=s,t=Ke(()=>e.image?dg({image:e.image,width:Nu,height:Fu}):`https://image.mux.com/${e.video.asset.playbackId}/thumbnail.webp?width=${Nu}&height=${Fu}&fit_mode=smartcrop`);return(i,r)=>(Y(),Q("div",oA,[K("media-controller",null,[K("mux-video",{"playback-id":s.video.asset.playbackId,"max-resolution":"1080p","min-resolution":"720p",slot:"media",crossorigin:""},null,8,lA),K("media-poster-image",{slot:"poster",src:H(t)},null,8,cA),dA,uA])]))}}),fA=Dt(hA,[["__scopeId","data-v-319c58be"]]),mA={class:"ModulesVideo module"},pA={class:"ModulesVideo__video-container"},gA={class:"module-caption ff-secondary"},vA={key:0},EA=ze({__name:"Video",props:{_key:{type:String,default:""},video:{type:Object,required:!0},posterImage:{type:Object,default:()=>null},title:{type:Object,default:()=>null},context:{type:Object,default:()=>null},callToAction:{type:Object,default:()=>null}},setup(s){const e=Bi,t=s,i=Ke(()=>t.callToAction?e:"div"),r=Ke(()=>{if(t.callToAction){const{links:n}=t.callToAction;return n.length?n[0]:null}});return(n,a)=>{const o=fA;return Y(),Q("div",mA,[K("div",pA,[Me(o,{video:s.video,image:s.posterImage,class:"ModulesVideo__video"},null,8,["video","image"]),K("div",gA,[(Y(),Be(di(H(i)),Jt(H(r),{class:"cta"}),{default:Ge(()=>{var l,c;return[(l=s.title)!=null&&l[H(Ne)]?(Y(),Q("em",vA,xe(("translate"in n?n.translate:H(we))(s.title)),1)):le("",!0),(c=s.context)!=null&&c[H(Ne)]?(Y(),Q(at,{key:1},[rt(xe(("translate"in n?n.translate:H(we))(s.context)),1)],64)):le("",!0)]}),_:1},16))])])])}}}),yA=Dt(EA,[["__scopeId","data-v-8a286089"]]),_A={"data-module":"exhibitions",class:"ModulesExhibitions"},TA={class:"ModulesExhibitions__content flex flex-wrap flex-justify-center wrap-secondary"},bA={key:0,class:"d-b"},AA={key:1,class:"d-b"},SA={key:0,class:"ModulesExhibitions__button-wrap wrap-full ta-c"},xA=ze({__name:"Exhibitions",props:{_key:{type:String,default:""},items:{type:Array,default:()=>[]}},setup(s){const e=Bi,t=Bu(),i=s,r=Ui(1),n=Ui(16),a=Ke(()=>t.getTranslations),o=Ke(()=>{if(!i.items||!i.items.length)return 0;const{length:f}=i.items;return Math.floor(f/n.value)}),l=Ke(()=>{if(!i.items||!i.items.length)return[];const f=n.value*r.value;return i.items.slice(0,f)}),c=f=>f==="listOnly"?"span":e,d=f=>{var p;if(((p=f.exhibition)==null?void 0:p.type)!=="listOnly")return{linkType:f.type,url:f.url,newWindow:f.newWindow,path:u(f)}},u=f=>{var p,y;return f.type==="linkInternal"?`/exhibitions/${(y=(p=f.exhibition)==null?void 0:p.slug)==null?void 0:y.current}`:f.url},h=()=>{r.value-1<o.value&&(r.value+=1)};return(f,p)=>{const y=ug;return Y(),Q("div",_A,[K("div",TA,[(Y(!0),Q(at,null,hr(H(l),(_,A)=>{var x;return Y(),Be(y,{key:A,type:(x=_.exhibition)==null?void 0:x.type,"link-type":_.type,image:_.image||_.exhibition.image,"has-info":!!(_.exhibition.title||_.title),url:_.url,"new-window":_.newWindow,path:u(_),class:"ModulesExhibitions__item col-secondary col-6 col-md-3"},{default:Ge(()=>{var I;return[(Y(),Be(di(c((I=_.exhibition)==null?void 0:I.type)),Jt(d(_),{class:"ModulesExhibitions__item-link cta"}),{default:Ge(()=>{var P,L,B;return[(P=_.exhibition.title)!=null&&P[H(Ne)]?(Y(),Q("em",bA,xe(("translate"in f?f.translate:H(we))(_.exhibition.title)),1)):(L=_.title)!=null&&L[H(Ne)]?(Y(),Q("em",AA,xe(("translate"in f?f.translate:H(we))(_.title)),1)):le("",!0),rt(" "+xe((B=_.exhibition.location)!=null&&B[H(Ne)]?("translate"in f?f.translate:H(we))(_.exhibition.location):("translate"in f?f.translate:H(we))(_.context)),1)]}),_:2},1040))]}),_:2},1032,["type","link-type","image","has-info","url","new-window","path"])}),128))]),s.items&&s.items.length&&s.items.length>H(n)&&H(r)-1<H(o)?(Y(),Q("div",SA,[K("button",{class:"cta","aria-lavel":"See more",onClick:p[
10200]||(p[0]=_=>h())},xe(("translate"in f?f.translate:H(we))(H(a).seeMore)||"See more"),1)])):le("",!0)])}}}),IA=Dt(xA,[["__scopeId","data-v-eb2ef1e0"]]),LA={class:"ModulesWorksItem__inner"},wA={class:"ModulesWorksItem__info-wrap flex-md flex-md-wrap flex-md-align-center hidden-mobile"},RA={class:"ModulesWorksItem__info"},kA={key:0,class:"d-b"},DA={class:"ModulesWorksItem__swiper-image-wrap"},CA={class:"ModulesWorksItem__swiper-caption-wrap wrap-full ta-c"},MA={class:"ModulesWorksItem__swiper-caption ma-b"},PA={key:0},OA={key:2},NA=ze({__name:"Item",props:{_key:{type:String,default:""},image:{type:Object,required:!0},title:{type:Object,default:()=>null},year:{type:String,default:""},context:{type:Object,default:()=>null},imageType:{type:String,default:"fullscreen"},additionalWorkItems:{type:Array,default:()=>[]}},setup(s){const e={modules:[on,Gu],loop:!0,speed:Dl*2,navigation:{nextEl:".BaseSwiper__button--next",prevEl:".BaseSwiper__button--previous"},keyboard:{enabled:!0}},t=Ui("default"),i=Ui(!1),r=s,n=Ke(()=>{var u,h,f;return((f=(h=(u=r.image.asset)==null?void 0:u.metadata)==null?void 0:h.dimensions)==null?void 0:f.aspectRatio)||1}),a=Ke(()=>n.value<=1?"portrait":"landscape"),o=Ke(()=>[{image:r.image,title:r.title,year:r.year,context:r.context,imageType:r.imageType},...r.additionalWorkItems]),l=u=>{const h=o.value[u];if(!h){t.value="default";return}const{image:f}=h;t.value=f&&f.color?f.color:"default"},c=()=>{i.value=!0},d=()=>{i.value=!1};return(u,h)=>{var A;const f=Ri,p=Ml,y=Pl,_=qu;return Y(),Q("div",{class:Et(["ModulesWorksItem",[{"has-info":!!s.title},`ModulesWorksItem--${H(a)}`]])},[K("div",LA,[K("button",{"aria-label":"Enlarge",class:"ModulesWorksItem__image-wrap",onClick:h[0]||(h[0]=x=>c())},[Me(f,{image:s.image,width:1200,class:"ModulesWorksItem__image"},null,8,["image"])]),K("div",wA,[K("div",RA,[K("button",{"aria-label":"Enlarge",class:"ModulesWorksItem__title cta ta-c",onClick:h[1]||(h[1]=x=>c())},[(A=s.title)!=null&&A[H(Ne)]?(Y(),Q("em",kA,xe(("translate"in u?u.translate:H(we))(s.title)),1)):le("",!0),rt(" "+xe(s.year),1)])])])]),Me(_,{class:Et(["ModulesWorksItem__view view",[{active:H(i)},`ModulesWorksItem__view--${H(t)}`]]),onClose:h[2]||(h[2]=x=>d())},{default:Ge(()=>[Me(y,{id:s._key,slides:H(o),"show-counter":!0,params:e,onSlideChange:l},{slide:Ge(({slide:x})=>{var I,P,L;return[K("div",{class:Et(["ModulesWorksItem__swiper-slide-wrap",`ModulesWorksItem__swiper-slide-wrap--${x.imageType}`])},[K("div",DA,[Me(p,{image:x.image,width:2500,class:"ModulesWorksItem__swiper-image"},null,8,["image"])]),K("div",CA,[K("div",MA,[(I=x.title)!=null&&I[H(Ne)]?(Y(),Q("em",PA,xe(("translate"in u?u.translate:H(we))(x.title)),1)):le("",!0),x.year?(Y(),Q(at,{key:1},[rt(", "+xe(x.year),1)],64)):le("",!0),(P=x.title)!=null&&P[H(Ne)]&&((L=x.context)!=null&&L[H(Ne)])?(Y(),Q("br",OA)):le("",!0),rt(" "+xe(("translate"in u?u.translate:H(we))(x.context)),1)])])],2)]}),_:1},8,["id","slides"])]),_:1},8,["class"])],2)}}}),FA=Dt(NA,[["__scopeId","data-v-a54bb588"]]),UA={"data-module":"works",class:"ModulesWorks flex-md flex-md-wrap flex-md-justify-center"},BA=ze({__name:"Works",props:{_key:{type:String,default:""},items:{type:Array,default:()=>[]}},setup(s){return(e,t)=>{const i=FA;return Y(),Q("div",UA,[(Y(!0),Q(at,null,hr(s.items,(r,n)=>(Y(),Be(i,Jt({key:n},{...r},{class:"ModulesWorks__thumb col-md-4"}),null,16))),128))])}}}
1020),$A=Dt(BA,[["__scopeId","data-v-85899f83"]]),GA={class:"ModulesText module wrap"},HA={class:"ModulesText__body-wrap col col-center col-md-6 ff-secondary"},VA=ze({__name:"Text",props:{_key:{type:String,default:""},body:{type:Object,required:!0}},setup(s){return(e,t)=>{var r;const i=Ol;return Y(),Q("div",GA,[K("div",HA,[(r=s.body)!=null&&r[H(Ne)]?(Y(),Be(i,{key:0,blocks:("translate"in e?e.translate:H(we))(s.body),class:"ModulesText__body"},null,8,["blocks"])):le("",!0)])])}}}),WA=Dt(VA,[["__scopeId","data-v-a7d2ff6f"]]),KA=s=>(Ba("data-v-82053a8b"),s=s(),$a(),s),qA={class:"ModulesArtwork module wrap"},YA={class:"ModulesArtwork__section col col-center ma-b"},jA={class:"ModulesArtwork__swiper-container-wrap"},zA=["id"],XA={class:"ModulesArtwork__section col-center"},QA={class:"flex flex-wrap flex-justify-center ma-b"},ZA={class:"col col-1-half hidden-desktop"},JA={class:"col col-9 ta-c"},eS={class:"ModulesArtwork__title"},tS=KA(()=>K("br",null,null,-1)),iS={class:"ModulesArtwork__title-additional"},sS={class:"col col-1-half hidden-desktop"},rS={class:"ModulesArtwork__section col"},nS=["innerHTML"],aS={key:1,class:"pa-t ta-c"},oS={class:"ModulesArtwork__section ModulesArtwork__section--body col col-center"},lS=ze({__name:"Artwork",props:{_key:{type:String,default:""},images:{type:Array,required:!0},title:{type:String,default:""},subtitle:{type:String,default:""},year:{type:String,default:""},context:{type:String,default:""},priceEnquire:{type:Object,default:()=>{}},callToAction:{type:Object,default:()=>{}},body:{type:Object,default:()=>{}}},setup(s){const e=Bi;Hu();const t=s,i=Ui(null),r={modules:[on],loop:!0,speed:520,navigation:{nextEl:`.ModulesArtwork__swiper-button--next-${t._key}`,prevEl:`.ModulesArtwork__swiper-button--previous-${t._key}`}};kl(()=>{setTimeout(()=>{const o=i.value;o&&(Object.assign(o,r),o.initialize())},$u)});const n=Ke(()=>t.callToAction?e:"div"),a=Ke(()=>{if(t.callToAction){const{links:o}=t.callToAction;return o.length?o[0]:null}});return(o,l)=>{var p,y,_,A,x,I;const c=Ri,d=Vu,u=Wu,h=an,f=Ol;return Y(),Q("div",qA,[K("div",YA,[K("div",jA,[K("swiper-container",{id:`swiper-${s._key}`,init:!1,ref_key:"swiperContainer",ref:i,class:"ModulesArtwork__swiper-container swiper-container"},[(Y(!0),Q(at,null,hr(s.images,(P,L)=>(Y(),Q("swiper-slide",{key:L,class:"ModulesArtwork__swiper-slide"},[Me(c,{image:P,width:1632,height:1088,class:"ModulesArtwork__swiper-image"},null,8,["image"])]))),128))],8,zA),s.images.length>1?(Y(),Q("div",{key:0,class:Et(["ModulesArtwork__swiper-button ModulesArtwork__swiper-button--previous swiper-button swiper-button--previous hidden-mobile",`ModulesArtwork__swiper-button--previous-${s._key}`])},[Me(d,{class:"swiper-button-icon"})],2)):le("",!0),s.images.length>1?(Y(),Q("div",{key:1,class:Et(["ModulesArtwork__swiper-button ModulesArtwork__swiper-button--next swiper-button swiper-button--next hidden-mobile",`ModulesArtwork__swiper-button--next-${s._key}`])},[Me(u,{class:"swiper-button-icon"})],2)):le("",!0)])]),K("div",XA,[K("div",QA,[K("div",ZA,[s.images.length>1?(Y(),Q("div",{key:0,class:Et(["ModulesArtwork__swiper-button ModulesArtwork__swiper-button--inline ModulesArtwork__swiper-button--previous",`ModulesArtwork__swiper-button--previous-${s._key}`])},[Me(d,{class:"ModulesArtwork__swiper-button-icon swiper-button-icon"})],2)):le("",!0)]),K("div",JA,[K("h3",eS,[s.subtitle?(Y(),Be(di(H(n)),Jt({key:0},H(a),{class:"cta"}),{default:Ge(()=>{var P,L;return[rt(xe(("translate"in o?o.translate:H(we))((L=(P=s.callToAction)==null?void 0:P.links[0])==null?void 0:L.title)||("translate"in o?o.translate:H(we))(s.subtitle)),1),tS]}),_:1},16)):le("",!0),K("span",iS,[K("em",null,xe(("translate"in o?o.translate:H(we))(s.title)),1),s.year?(Y(),Q(at,{key:0},[rt(", "+xe(s.year),1)],64)):le("",!0)])])]),K("div",sS,[s.images.length>1?(Y(),Q("div",{key:0,class:Et(["ModulesArtwork__swiper-button ModulesArtwork__swiper-button--inline ModulesArtwork__swiper-button--next",`ModulesArtwork__swiper-button--next-${s._key}`])},[Me(u,{class:"ModulesArtwork__swiper-button-icon swiper-button-icon"})],2)):le("",!0)])]),K("div",rS,[s.context?(Y(),Q("p",{key:0,innerHTML:s.context,class:"ModulesArtwork__context ff-secondary ta-c"},null,8,nS)):le("",!0),(p=s.priceEnquire)!=null&&p.option&&((y=s.priceEnquire)==null?void 0:y.option)!=="none"?(Y(),Q("div",aS,[Me(h,{option:(_=s.priceEnquire)==null?void 0:_.option,"enquire-email-address":(A=s.priceEnquire)==null?void 0:A.enquireEmailAddress,price:(x=s.priceEnquire)==null?void 0:x.price,subject:s.priceEnquire.emailSubject,body:s.priceEnquire.emailBody,class:"d-ib ff-secondary"},null,8,["option","enquire-email-address","price","subject","body"])])):le("",!0)]),K("div",oS,[(I=s.body)!=null&&I[H(Ne)]?(Y(),Be(f,{key:0,blocks:("translate"in o?o.translate:H(we))(s.body),class:"pa-t-l ff-secondary"},null,8,["blocks"])):le("",!0)])])])}}}),cS=Dt(lS,[["__scopeId","data-v-82053a8b"]]),dS={class:"ModulesHeading module wrap"}
1020,uS={class:"ModulesHeading__heading-wrap col col-center col-md-6 ta-c fs-l"},hS=ze({__name:"Heading",props:{_key:{type:String,default:""},heading:{type:String,required:!0}},setup(s){return(e,t)=>(Y(),Q("div",dS,[K("div",uS,[K("h2",null,xe(s.heading),1)])]))}}),fS=Dt(hS,[["__scopeId","data-v-d2af2549"]]),mS={class:"Modules"},tx=ze({__name:"Modules",props:{modules:{type:Array,required:!0}},setup(s){const e=Tg,t=Ng,i=Yg,r=e0,n=yA,a=IA,o=$A,l=WA,c=cS,d=fS,u=f=>{switch(f){case"module.images":return e;case"module.thumbnails":return t;case"module.compositeBlocks":return i;case"module.image":return r;case"module.video":return n;case"module.exhibitions":return a;case"module.works":case"module.worksAdditional":return o;case"module.text":return l;case"module.artwork":return c;case"module.heading":return d;default:return}},h=f=>{const{_type:p,...y}=f;return f._type==="module.images"?{type:"inline",...y}:y};return(f,p)=>(Y(),Q("div",mS,[(Y(!0),Q(at,null,hr(s.modules,(y,_)=>(Y(),Be(di(u(y._type)),Jt({key:_},h(y),{class:"Modules__module"}),null,16))),128))]))}}),pS={class:"RelatedEntriesExhibition"},gS={class:"related__title ff-secondary ta-c"},vS={key:1},ES=ze({__name:"Exhibition",props:{image:{type:Object,default:()=>null},exhibition:{type:Object,default:()=>null}},setup(s){const e=s,t=Ke(()=>e.image||e.exhibition.image);return(i,r)=>{var o,l,c,d,u;const n=Ri,a=Cl;return Y(),Q("div",pS,[Me(a,{to:("getLocalizedPath"in i?i.getLocalizedPath:H(cr))(`/exhibitions/${s.exhibition.slug.current}`),class:"related__image-wrap"},{default:Ge(()=>[H(t)&&H(t).asset?(Y(),Be(n,{key:0,image:H(t),width:1200,class:"related__image"},null,8,["image"])):le("",!0)]),_:1},8,["to"]),K("span",gS,[(o=s.exhibition.title)!=null&&o[H(Ne)]||(l=s.exhibition.artists)!=null&&l[H(Ne)]?(Y(),Be(a,{key:0,to:("getLocalizedPath"in i?i.getLocalizedPath:H(cr))(`/exhibitions/${s.exhibition.slug.current}`),class:"cta"},{default:Ge(()=>[K("em",null,xe(("translate"in i?i.translate:H(we))(s.exhibition.title||s.exhibition.artists)),1)]),_:1},8,["to"])):le("",!0),((c=s.exhibition.title)!=null&&c[H(Ne)]||(d=s.exhibition.artists)!=null&&d[H(Ne)])&&((u=s.exhibition.location)!=null&&u[H(Ne)])?(Y(),Q("br",vS)):le("",!0),rt(" "+xe(("translate"in i?i.translate:H(we))(s.exhibition.location)),1)])])}}}),yS={class:"RelatedEntriesArtist"},_S={class:"related__title ff-secondary ta-c"},TS={key:0},bS={key:1},AS=K("br",null,null,-1),SS={key:1},xS=ze({__name:"Artist",props:{image:{type:Object,default:()=>null},artist:{type:Object,default:()=>null},workTitle:{type:Object,default:()=>null},context:{type:Object,default:()=>null}},setup(s){const e=s,t=Ke(()=>e.image||e.artist.image);return(i,r)=>{var o,l,c;const n=Ri,a=Cl;return Y(),Q("div",yS,[Me(a,{to:("getLocalizedPath"in i?i.getLocalizedPath:H(cr))(`/artists/${s.artist.slug.current}`),class:"related__image-wrap"},{default:Ge(()=>[H(t)&&H(t).asset?(Y(),Be(n,{key:0,image:H(t),width:1200,class:"related__image"},null,8,["image"])):le("",!0)]),_:1},8,["to"]),K("span",_S,[Me(a,{to:("getLocalizedPath"in i?i.getLocalizedPath:H(cr))(`/artists/${s.artist.slug.current}`),class:"cta"},{default:Ge(()=>{var d;return[(d=s.workTitle)!=null&&d[H(Ne)]?(Y(),Q("em",TS,xe(("translate"in i?i.translate:H(we))(s.workTitle)),1)):(Y(),Q("em",bS,[s.artist.firstName?(Y(),Q(at,{key:0},[rt(xe(s.artist.firstName),1)],64)):le("",!0),rt(" "+xe(s.artist.lastName),1)]))]}),_:1},8,["to"]),(o=s.workTitle)!=null&&o[H(Ne)]?(Y(),Q(at,{key:0},[AS,s.artist.firstName?(Y(),Q(at,{key:0},[rt(xe(s.artist.firstName),1)],64)):le("",!0),rt(" "+xe(s.artist.lastName),1)],64)):le("",!0),(l=s.context)!=null&&l[H(Ne)]?(Y(),Q(at,{key:1},[(c=s.workTitle)!=null&&c[H(Ne)]?(Y(),Q(at,{key:0},[rt(", ")],64)):(Y(),Q("br",SS)),rt(xe(("translate"in i?i.translate:H(we))(s.context)),1)],64)):le("",!0)])])}}}),IS={class:"RelatedEntriesExternal"},LS={class:"related__title ff-secondary ta-c"},wS=ze({__name:"External",props:{image:{type:Object,required:!0},url:{type:String,default:""},newWindow:{type:Boolean,default:!1},title:{type:Object,default:()=>null},context:{type:Object,default:()=>null}},setup(s){return(e,t)=>{const i=Ri,r=Bi;return Y(),Q("div",IS,[Me(r,{"link-type":"linkExternal",url:s.url,"new-window":s.newWindow,class:"related__image-wrap"},{default:Ge(()=>[s.image&&s.image.asset?(Y(),Be(i,{key:0,image:s.image,width:1200,class:"related__image"},null,8,["image"])):le("",!0)]),_:1},8,["url","new-window"]),K("span",LS,[s.title?(Y(),Be(r,{key:0,"link-type":"linkExternal",url:s.url,"new-window":s.newWindow,class:"d-b cta"},{default:Ge(()=>[K("em",null,xe(("translate"in e?e.translate:H(we))(s.title)),1)]),_:1},8,["url","new-window"])):le("",!0),rt(" "+xe(("translate"in e?e.translate:H(we))(s.context)),1)])])}}}),RS={class:"RelatedEntriesProduct"},kS={class:"related__title ff-secondary ta-c"},DS=K("br",null,null,-1),CS=ze({__name:"Product",props:{image:{type:Object,default:()=>null},product:{type:Object,default:()=>null}},setup(s){const e=s,t=Ke(()=>e.image||e.product.image);return(i,r)=>{var o;const n=Ri,a=Cl;return Y(),Q("div",RS,[Me(a,{to:("getLocalizedPath"in i?i.getLocalizedPath:H(cr))(`/products/${s.product.slug}`),class:"related__image-wrap"},{default:Ge(()=>[H(t)&&H(t).asset?(Y(),Be(n,{key:0,image:H(t),width:1200,class:"related__image"},null,8,["image"])):le("",!0)]),_:1},8,["to"]),K("span",kS,[Me(a,{to:("getLocalizedPath"in i?i.getLocalizedPath:H(cr))(`/products/${s.product.slug}`),class:"cta"},{default:Ge(()=>[K("em",null,xe(("translate"in i?i.translate:H(we))(s.product.title)),1)]),_:1},8,["to"]),(o=s.product.artists)!=null&&o[H(Ne)]?(Y(),Q(at,{key:0},[DS,rt(xe(("translate"in i?i.translate:H(we))(s.product.artists)),1)],64)):le("",!0)])])}}}),MS={class:"RelatedEntriesNews"},PS={class:"related__title ff-secondary ta-c"},OS=K("br",null,null,-1),NS=ze({__name:"News",props:{image:{type:Object,default:()=>null},news:{type:Object,default:()=>null}},setup(s){const e=Bi,t=s,i=Ke(()=>t.image||t.news.image),r=Ke(()=>t.news.callToAction?e:"div"),n=Ke(()=>{if(t.news.callToAction){const{links:a}=t.news.callToAction;return a.length?a[0]:null}});return(a,o)=>{var c;const l=Ri;return Y(),Q("div",MS,[(Y(),Be(di(H(r)),Jt(H(n),{class:"related__image-wrap"}),{default:Ge(()=>[H(i)&&H(i).asset?(Y(),Be(l,{key:0,image:H(i),width:1200,class:"related__image"},null,8,["image"])):le("",!0)]),_:1},16)),K("span",PS,[(Y(),Be(di(H(r)),Jt(H(n),{class:"cta"}),{default:Ge(()=>[K("em",null,xe(("translate"in a?a.translate:H(we))(s.news.title)),1)]),_:1},16)),(c=s.news.location)!=null&&c[H(Ne)]?(Y(),Q(at,{key:0},[OS,rt(xe(("translate"in a?a.translate:H(we))(s.news.location)),1)],64)):le("",!0)])])}}}),FS={class:"RelatedEntries"},US={key:0,class:"RelatedEntries__swiper-button RelatedEntries__swiper-button--previous swiper-button swiper-button--previous"},BS={key:1,class:"RelatedEntries__swiper-button RelatedEntries__swiper-button--next swiper-button swiper-button--next"},$S=ze({__name:"RelatedEntries",props:{entries:{type:Array,required:!0}},setup(s){const e=ES,t=xS,i=wS,r=CS,n=NS;Hu();const a=Ui(null),l={modules:[on],loop:s.entries.length>2,speed:520,slidesPerView:2,navigation:{nextEl:".RelatedEntries__swiper-button--next",prevEl:".RelatedEntries__swiper-button--previous"},breakpoints:{992:{slidesPerView:3}}};kl(()=>{setTimeout(()=>{const u=a.value;u&&(Object.assign(u,l),u.initialize())},$u)});const c=u=>{switch(u){case"related.exhibition":return e;case"related.artist":return t;case"related.external":return i;case"related.product":return r;case"related.news":return n;default:return}},d=u=>{const{_type:h,...f}=u;switch(h){case"related.exhibition":return{image:u.image,exhibition:u.exhibition};case"related.artist":return{image:u.image,artist:u.artist,workTitle:u.workTitle,context:u.context};case"related.product":return{image:u.image,product:u.product};case"related.news":return{image:u.image,news:u.news};default:return f}};return(u,h)=>{const f=Vu,p=Wu;return Y(),Q("div",FS,[K("swiper-container",{init:!1,ref_key:"swiperContainer",ref:a,class:"RelatedEntries__swiper-container swiper-container"},[(Y(!0),Q(at,null,hr(s.entries,(y,_)=>(Y(),Q("swiper-slide",{key:_,class:"RelatedEntries__swiper-slide"},[(Y(),Be(di(c(y._type)),Jt(d(y),{class:"RelatedEntries__entry"}),null,16))]))),128))],512),s.entries.length>3?(Y(),Q("div",US,[Me(f,{class:"RelatedEntries__swiper-button-icon swiper-button-icon"})])):le("",!0),s.entries.length>3?(Y(),Q("div",BS,[Me(p,{class:"RelatedEntries__swiper-button-icon swiper-button-icon"})])):le("",!0)])}}}),ix=Dt($S,[["__scopeId","data-v-018806d5"]]),sx=async(s,e)=>{const i=Bu().activePreview?{client:"preview"}:void 0;return await lg(s,e,i)},rx=` 1021relatedEntries[]{ 1022 ..., 1023 "title": { 1024 ${fi("title","localeTitle")} 1025 }, 1026 "context": { 1027 ${fi("context","localeContext")} 1028 }, 1029 image{..., asset->}, 1030 "exhibition": { 1031 "title": { 1032 ${fi("relatedExhibition->title","relatedExhibition->localeTitle")} 1033 }, 1034 "slug": relatedExhibition->slug, 1035 "image": relatedExhibition->image{..., asset->}, 1036 "location": { 1037 ${fi("relatedExhibition->location","relatedExhibition->localeLocation")} 1038 }, 1039 }, 1040 "artist": { 1041 "firstName": relatedArtist->firstName, 1042 "lastName": relatedArtist->lastName, 1043 "slug": relatedArtist->slug, 1044 "image": relatedArtist->image{..., asset->}, 1045 "workTitle": { 1046 ${fi("relatedArtist->workTitle","relatedArtist->localeWorkTitle")} 1047 }, 1048 "context": { 1049 ${fi("relatedArtist->context","relatedArtist->localeContext")} 1050 }, 1051 }, 1052 "product": { 1053 "title": { 1054 ${fi("relatedProduct->title","relatedProduct->localeTitle")} 1055 }, 1056 "artists": { 1057 ${fi("relatedProduct->artists","relatedProduct->localeArtists")}
1057 1058 }, 1059 "slug": relatedProduct->store.slug.current, 1060 "image": relatedProduct->image{..., asset->}, 1061 }, 1062 "news": { 1063 "title": { 1064 ${fi("relatedNews->title","relatedNews->localeTitle")} 1065 }, 1066 "callToAction": relatedNews->callToAction{ 1067 links[]{ 1068 ${cg} 1069 } 1070 }, 1071 "image": relatedNews->image{..., asset->}, 1072 "location": { 1073 ${fi("relatedNews->location","relatedNews->localeLocation")} 1074 }, 1075 }, 1076}, 1077`;export{tx as _,ix as a,Yg as b,qu as c,Ku as d,rx as r,sx as u};
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.